
PK 
/*! For license information please see main.js.LICENSE.txt */
(()=>{
var e, t = {
344: (e,t,i)=>{
"use strict";
var r, n, o, s, a = !1, l = !1, c = [];
function u(e) {
!function(e) {
c.includes(e) || c.push(e);
l || a || (a = !0,
queueMicrotask(d))
}(e)
}
function h(e) {
let t = c.indexOf(e);
-1 !== t && c.splice(t, 1)
}
function d() {
a = !1,
l = !0;
for (let e = 0; e < c.length; e++)
c[e]();
c.length = 0,
l = !1
}
var p = !0;
function f(e) {
n = e
}
var m = []
, _ = []
, g = [];
function y(e, t) {
"function" == typeof t ? (e._x_cleanups || (e._x_cleanups = []),
e._x_cleanups.push(t)) : (t = e,
_.push(t))
}
function x(e, t) {
e._x_attributeCleanups && Object.entries(e._x_attributeCleanups).forEach((([i,r])=>{
(void 0 === t || t.includes(i)) && (r.forEach((e=>e())),
delete e._x_attributeCleanups[i])
}
))
}
var v = new MutationObserver(I)
, b = !1;
function w() {
v.observe(document, {
subtree: !0,
childList: !0,
attributes: !0,
attributeOldValue: !0
}),
b = !0
}
function T() {
(E = E.concat(v.takeRecords())).length && !S && (S = !0,
queueMicrotask((()=>{
I(E),
E.length = 0,
S = !1
}
))),
v.disconnect(),
b = !1
}
var E = []
, S = !1;
function C(e) {
if (!b)
return e();
T();
let t = e();
return w(),
t
}
var M = !1
, A = [];
function I(e) {
if (M)
return void (A = A.concat(e));
let t = []
, i = []
, r = new Map
, n = new Map;
for (let o = 0; o < e.length; o++)
if (!e[o].target._x_ignoreMutationObserver && ("childList" === e[o].type && (e[o].addedNodes.forEach((e=>1 === e.nodeType && t.push(e))),
e[o].removedNodes.forEach((e=>1 === e.nodeType && i.push(e)))),
"attributes" === e[o].type)) {
let t = e[o].target
, i = e[o].attributeName
, s = e[o].oldValue
, a = ()=>{
r.has(t) || r.set(t, []),
r.get(t).push({
name: i,
value: t.getAttribute(i)
})
}
, l = ()=>{
n.has(t) || n.set(t, []),
n.get(t).push(i)
}
;
t.hasAttribute(i) && null === s ? a() : t.hasAttribute(i) ? (l(),
a()) : l()
}
n.forEach(((e,t)=>{
x(t, e)
}
)),
r.forEach(((e,t)=>{
m.forEach((i=>i(t, e)))
}
));
for (let e of i)
if (!t.includes(e) && (_.forEach((t=>t(e))),
e._x_cleanups))
for (; e._x_cleanups.length; )
e._x_cleanups.pop()();
t.forEach((e=>{
e._x_ignoreSelf = !0,
e._x_ignore = !0
}
));
for (let e of t)
i.includes(e) || e.isConnected && (delete e._x_ignoreSelf,
delete e._x_ignore,
g.forEach((t=>t(e))),
e._x_ignore = !0,
e._x_ignoreSelf = !0);
t.forEach((e=>{
delete e._x_ignoreSelf,
delete e._x_ignore
}
)),
t = null,
i = null,
r = null,
n = null
}
function z(e) {
return L(D(e))
}
function k(e, t, i) {
return e._x_dataStack = [t, ...D(i || e)],
()=>{
e._x_dataStack = e._x_dataStack.filter((e=>e !== t))
}
}
function P(e, t) {
let i = e._x_dataStack[0];
Object.entries(t).forEach((([e,t])=>{
i[e] = t
}
))
}
function D(e) {
return e._x_dataStack ? e._x_dataStack : "function" == typeof ShadowRoot && e instanceof ShadowRoot ? D(e.host) : e.parentNode ? D(e.parentNode) : []
}
function L(e) {
let t = new Proxy({},{
ownKeys: ()=>Array.from(new Set(e.flatMap((e=>Object.keys(e))))),
has: (t,i)=>e.some((e=>e.hasOwnProperty(i))),
get: (i,r)=>(e.find((e=>{
if (e.hasOwnProperty(r)) {
let i = Object.getOwnPropertyDescriptor(e, r);
if (i.get && i.get._x_alreadyBound || i.set && i.set._x_alreadyBound)
return !0;
if ((i.get || i.set) && i.enumerable) {
let n = i.get
, o = i.set
, s = i;
n = n && n.bind(t),
o = o && o.bind(t),
n && (n._x_alreadyBound = !0),
o && (o._x_alreadyBound = !0),
Object.defineProperty(e, r, {
...s,
get: n,
set: o
})
}
return !0
}
return !1
}
)) || {})[r],
set: (t,i,r)=>{
let n = e.find((e=>e.hasOwnProperty(i)));
return n ? n[i] = r : e[e.length - 1][i] = r,
!0
}
});
return t
}
function B(e) {
let t = (i,r="")=>{
Object.entries(Object.getOwnPropertyDescriptors(i)).forEach((([n,{value: o, enumerable: s}])=>{
if (!1 === s || void 0 === o)
return;
let a = "" === r ? n : `${r}.${n}`;
"object" == typeof o && null !== o && o._x_interceptor ? i[n] = o.initialize(e, a, n) : !(e=>"object" == typeof e && !Array.isArray(e) && null !== e)(o) || o === i || o instanceof Element || t(o, a)
}
))
}
;
return t(e)
}
function O(e, t=(()=>{}
)) {
let i = {
initialValue: void 0,
_x_interceptor: !0,
initialize(t, i, r) {
return e(this.initialValue, (()=>function(e, t) {
return t.split(".").reduce(((e,t)=>e[t]), e)
}(t, i)), (e=>R(t, i, e)), i, r)
}
};
return t(i),
e=>{
if ("object" == typeof e && null !== e && e._x_interceptor) {
let t = i.initialize.bind(i);
i.initialize = (r,n,o)=>{
let s = e.initialize(r, n, o);
return i.initialValue = s,
t(r, n, o)
}
} else
i.initialValue = e;
return i
}
}
function R(e, t, i) {
if ("string" == typeof t && (t = t.split(".")),
1 !== t.length) {
if (0 === t.length)
throw error;
return e[t[0]] || (e[t[0]] = {}),
R(e[t[0]], t.slice(1), i)
}
e[t[0]] = i
}
var F = {};
function U(e, t) {
F[e] = t
}
function V(e, t) {
return Object.entries(F).forEach((([i,r])=>{
Object.defineProperty(e, `$ ${i}`, {
get() {
let[e,i] = oe(t);
return e = {
interceptor: O,
...e
},
y(t, i),
r(t, e)
},
enumerable: !1
})
}
)),
e
}
function j(e, t, i, ...r) {
try {
return i(...r)
} catch (i) {
N(i, e, t)
}
}
function N(e, t, i) {
Object.assign(e, {
el: t,
expression: i
}),
console.warn(`Alpine Expression Error: ${e.message}\n\n ${i ? 'Expression: "' + i + '"\n\n' : ""}`, t),
setTimeout((()=>{
throw e
}
), 0)
}
var G = !0;
function $(e, t, i={}) {
let r;
return q(e, t)((e=>r = e), i),
r
}
function q(...e) {
return Z(...e)
}
var Z = W;
function W(e, t) {
let i = {};
V(i, e);
let r = [i, ...D(e)];
if ("function" == typeof t)
return function(e, t) {
return (i=(()=>{}
),{scope: r={}, params: n=[]}={})=>{
H(i, t.apply(L([r, ...e]), n))
}
}(r, t);
let n = function(e, t, i) {
let r = function(e, t) {
if (X[e])
return X[e];
let i = Object.getPrototypeOf((async function() {}
)).constructor
, r = /^[\n\s]*if.*\(.*\)/.test(e) || /^(let|const)\s/.test(e) ? `(() => { ${e} })()` : e;
let n = (()=>{
try {
return new i(["__self", "scope"],`with (scope) { __self.result = ${r} }; __self.finished = true; return __self.result;`)
} catch (i) {
return N(i, t, e),
Promise.resolve()
}
}
)();
return X[e] = n,
n
}(t, i);
return (n=(()=>{}
),{scope: o={}, params: s=[]}={})=>{
r.result = void 0,
r.finished = !1;
let a = L([o, ...e]);
if ("function" == typeof r) {
let e = r(r, a).catch((e=>N(e, i, t)));
r.finished ? (H(n, r.result, a, s, i),
r.result = void 0) : e.then((e=>{
H(n, e, a, s, i)
}
)).catch((e=>N(e, i, t))).finally((()=>r.result = void 0))
}
}
}(r, t, e);
return j.bind(null, e, t, n)
}
var X = {};
function H(e, t, i, r, n) {
if (G && "function" == typeof t) {
let o = t.apply(i, r);
o instanceof Promise ? o.then((t=>H(e, t, i, r))).catch((e=>N(e, n, t))) : e(o)
} else
e(t)
}
var Y = "x-";
function K(e="") {
return Y + e
}
var J = {};
function Q(e, t) {
J[e] = t
}
function ee(e, t, i) {
if (t = Array.from(t),
e._x_virtualDirectives) {
let i = Object.entries(e._x_virtualDirectives).map((([e,t])=>({
name: e,
value: t
})))
, r = te(i);
i = i.map((e=>r.find((t=>t.name === e.name)) ? {
name: `x-bind:${e.name}`,
value: `"${e.value}"`
} : e)),
t = t.concat(i)
}
let r = {}
, n = t.map(ae(((e,t)=>r[e] = t))).filter(ue).map(function(e, t) {
return ({name: i, value: r})=>{
let n = i.match(he())
, o = i.match(/:([a-zA-Z0-9\-:]+)/)
, s = i.match(/\.[^.\]]+(?=[^\]]*$)/g) || []
, a = t || e[i] || i;
return {
type: n ? n[1] : null,
value: o ? o[1] : null,
modifiers: s.map((e=>e.replace(".", ""))),
expression: r,
original: a
}
}
}(r, i)).sort(fe);
return n.map((t=>function(e, t) {
let i = ()=>{}
, r = J[t.type] || i
, [n,o] = oe(e);
!function(e, t, i) {
e._x_attributeCleanups || (e._x_attributeCleanups = {}),
e._x_attributeCleanups[t] || (e._x_attributeCleanups[t] = []),
e._x_attributeCleanups[t].push(i)
}(e, t.original, o);
let s = ()=>{
e._x_ignore || e._x_ignoreSelf || (r.inline && r.inline(e, t, n),
r = r.bind(r, e, t, n),
ie ? re.get(ne).push(r) : r())
}
;
return s.runCleanups = o,
s
}(e, t)))
}
function te(e) {
return Array.from(e).map(ae()).filter((e=>!ue(e)))
}
var ie = !1
, re = new Map
, ne = Symbol();
function oe(e) {
let t = []
, [i,r] = function(e) {
let t = ()=>{}
;
return [i=>{
let r = n(i);
return e._x_effects || (e._x_effects = new Set,
e._x_runEffects = ()=>{
e._x_effects.forEach((e=>e()))
}
),
e._x_effects.add(r),
t = ()=>{
void 0 !== r && (e._x_effects.delete(r),
o(r))
}
,
r
}
, ()=>{
t()
}
]
}(e);
t.push(r);
return [{
Alpine: Je,
effect: i,
cleanup: e=>t.push(e),
evaluateLater: q.bind(q, e),
evaluate: $.bind($, e)
}, ()=>t.forEach((e=>e()))]
}
var se = (e,t)=>({name: i, value: r})=>(i.startsWith(e) && (i = i.replace(e, t)),
{
name: i,
value: r
});
function ae(e=(()=>{}
)) {
return ({name: t, value: i})=>{
let {name: r, value: n} = le.reduce(((e,t)=>t(e)), {
name: t,
value: i
});
return r !== t && e(r, t),
{
name: r,
value: n
}
}
}
var le = [];
function ce(e) {
le.push(e)
}
function ue({name: e}) {
return he().test(e)
}
var he = ()=>new RegExp(`^${Y}([^:^.]+)\\b`);
var de = "DEFAULT"
, pe = ["ignore", "ref", "data", "id", "bind", "init", "for", "mask", "model", "modelable", "transition", "show", "if", de, "teleport"];
function fe(e, t) {
let i = -1 === pe.indexOf(e.type) ? de : e.type
, r = -1 === pe.indexOf(t.type) ? de : t.type;
return pe.indexOf(i) - pe.indexOf(r)
}
function me(e, t, i={}) {
e.dispatchEvent(new CustomEvent(t,{
detail: i,
bubbles: !0,
composed: !0,
cancelable: !0
}))
}
var _e = []
, ge = !1;
function ye(e=(()=>{}
)) {
return queueMicrotask((()=>{
ge || setTimeout((()=>{
xe()
}
))
}
)),
new Promise((t=>{
_e.push((()=>{
e(),
t()
}
))
}
))
}
function xe() {
for (ge = !1; _e.length; )
_e.shift()()
}
function ve(e, t) {
if ("function" == typeof ShadowRoot && e instanceof ShadowRoot)
return void Array.from(e.children).forEach((e=>ve(e, t)));
let i = !1;
if (t(e, (()=>i = !0)),
i)
return;
let r = e.firstElementChild;
for (; r; )
ve(r, t),
r = r.nextElementSibling
}
function be(e, ...t) {
console.warn(`Alpine Warning: ${e}`, ...t)
}
var we = []
, Te = [];
function Ee() {
return we.map((e=>e()))
}
function Se() {
return we.concat(Te).map((e=>e()))
}
function Ce(e) {
we.push(e)
}
function Me(e) {
Te.push(e)
}
function Ae(e, t=!1) {
return Ie(e, (e=>{
if ((t ? Se() : Ee()).some((t=>e.matches(t))))
return !0
}
))
}
function Ie(e, t) {
if (e) {
if (t(e))
return e;
if (e._x_teleportBack && (e = e._x_teleportBack),
e.parentElement)
return Ie(e.parentElement, t)
}
}
function ze(e, t=ve) {
!function(e) {
ie = !0;
let t = Symbol();
ne = t,
re.set(t, []);
let i = ()=>{
for (; re.get(t).length; )
re.get(t).shift()();
re.delete(t)
}
;
e(i),
ie = !1,
i()
}((()=>{
t(e, ((e,t)=>{
ee(e, e.attributes).forEach((e=>e())),
e._x_ignore && t()
}
))
}
))
}
function ke(e, t) {
return Array.isArray(t) ? Pe(e, t.join(" ")) : "object" == typeof t && null !== t ? function(e, t) {
let i = e=>e.split(" ").filter(Boolean)
, r = Object.entries(t).flatMap((([e,t])=>!!t && i(e))).filter(Boolean)
, n = Object.entries(t).flatMap((([e,t])=>!t && i(e))).filter(Boolean)
, o = []
, s = [];
return n.forEach((t=>{
e.classList.contains(t) && (e.classList.remove(t),
s.push(t))
}
)),
r.forEach((t=>{
e.classList.contains(t) || (e.classList.add(t),
o.push(t))
}
)),
()=>{
s.forEach((t=>e.classList.add(t))),
o.forEach((t=>e.classList.remove(t)))
}
}(e, t) : "function" == typeof t ? ke(e, t()) : Pe(e, t)
}
function Pe(e, t) {
return t = !0 === t ? t = "" : t || "",
(t=>(e.classList.add(...t),
()=>{
e.classList.remove(...t)
}
))(t.split(" ").filter((t=>!e.classList.contains(t))).filter(Boolean))
}
function De(e, t) {
return "object" == typeof t && null !== t ? function(e, t) {
let i = {};
return Object.entries(t).forEach((([t,r])=>{
i[t] = e.style[t],
t.startsWith("--") || (t = t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()),
e.style.setProperty(t, r)
}
)),
setTimeout((()=>{
0 === e.style.length && e.removeAttribute("style")
}
)),
()=>{
De(e, i)
}
}(e, t) : function(e, t) {
let i = e.getAttribute("style", t);
return e.setAttribute("style", t),
()=>{
e.setAttribute("style", i || "")
}
}(e, t)
}
function Le(e, t=(()=>{}
)) {
let i = !1;
return function() {
i ? t.apply(this, arguments) : (i = !0,
e.apply(this, arguments))
}
}
function Be(e, t, i={}) {
e._x_transition || (e._x_transition = {
enter: {
during: i,
start: i,
end: i
},
leave: {
during: i,
start: i,
end: i
},
in(i=(()=>{}
), r=(()=>{}
)) {
Re(e, t, {
during: this.enter.during,
start: this.enter.start,
end: this.enter.end
}, i, r)
},
out(i=(()=>{}
), r=(()=>{}
)) {
Re(e, t, {
during: this.leave.during,
start: this.leave.start,
end: this.leave.end
}, i, r)
}
})
}
function Oe(e) {
let t = e.parentNode;
if (t)
return t._x_hidePromise ? t : Oe(t)
}
function Re(e, t, {during: i, start: r, end: n}={}, o=(()=>{}
), s=(()=>{}
)) {
if (e._x_transitioning && e._x_transitioning.cancel(),
0 === Object.keys(i).length && 0 === Object.keys(r).length && 0 === Object.keys(n).length)
return o(),
void s();
let a, l, c;
!function(e, t) {
let i, r, n, o = Le((()=>{
C((()=>{
i = !0,
r || t.before(),
n || (t.end(),
xe()),
t.after(),
e.isConnected && t.cleanup(),
delete e._x_transitioning
}
))
}
));
e._x_transitioning = {
beforeCancels: [],
beforeCancel(e) {
this.beforeCancels.push(e)
},
cancel: Le((function() {
for (; this.beforeCancels.length; )
this.beforeCancels.shift()();
o()
}
)),
finish: o
},
C((()=>{
t.start(),
t.during()
}
)),
ge = !0,
requestAnimationFrame((()=>{
if (i)
return;
let o = 1e3 * Number(getComputedStyle(e).transitionDuration.replace(/,.*/, "").replace("s", ""))
, s = 1e3 * Number(getComputedStyle(e).transitionDelay.replace(/,.*/, "").replace("s", ""));
0 === o && (o = 1e3 * Number(getComputedStyle(e).animationDuration.replace("s", ""))),
C((()=>{
t.before()
}
)),
r = !0,
requestAnimationFrame((()=>{
i || (C((()=>{
t.end()
}
)),
xe(),
setTimeout(e._x_transitioning.finish, o + s),
n = !0)
}
))
}
))
}(e, {
start() {
a = t(e, r)
},
during() {
l = t(e, i)
},
before: o,
end() {
a(),
c = t(e, n)
},
after: s,
cleanup() {
l(),
c()
}
})
}
function Fe(e, t, i) {
if (-1 === e.indexOf(t))
return i;
const r = e[e.indexOf(t) + 1];
if (!r)
return i;
if ("scale" === t && isNaN(r))
return i;
if ("duration" === t) {
let e = r.match(/([0-9]+)ms/);
if (e)
return e[1]
}
return "origin" === t && ["top", "right", "left", "center", "bottom"].includes(e[e.indexOf(t) + 2]) ? [r, e[e.indexOf(t) + 2]].join(" ") : r
}
Q("transition", ((e,{value: t, modifiers: i, expression: r},{evaluate: n})=>{
"function" == typeof r && (r = n(r)),
r ? function(e, t, i) {
Be(e, ke, "");
let r = {
enter: t=>{
e._x_transition.enter.during = t
}
,
"enter-start": t=>{
e._x_transition.enter.start = t
}
,
"enter-end": t=>{
e._x_transition.enter.end = t
}
,
leave: t=>{
e._x_transition.leave.during = t
}
,
"leave-start": t=>{
e._x_transition.leave.start = t
}
,
"leave-end": t=>{
e._x_transition.leave.end = t
}
};
r[i](t)
}(e, r, t) : function(e, t, i) {
Be(e, De);
let r = !t.includes("in") && !t.includes("out") && !i
, n = r || t.includes("in") || ["enter"].includes(i)
, o = r || t.includes("out") || ["leave"].includes(i);
t.includes("in") && !r && (t = t.filter(((e,i)=>i < t.indexOf("out"))));
t.includes("out") && !r && (t = t.filter(((e,i)=>i > t.indexOf("out"))));
let s = !t.includes("opacity") && !t.includes("scale")
, a = s || t.includes("opacity")
, l = s || t.includes("scale")
, c = a ? 0 : 1
, u = l ? Fe(t, "scale", 95) / 100 : 1
, h = Fe(t, "delay", 0)
, d = Fe(t, "origin", "center")
, p = "opacity, transform"
, f = Fe(t, "duration", 150) / 1e3
, m = Fe(t, "duration", 75) / 1e3
, _ = "cubic-bezier(0.4, 0.0, 0.2, 1)";
n && (e._x_transition.enter.during = {
transformOrigin: d,
transitionDelay: h,
transitionProperty: p,
transitionDuration: `${f}s`,
transitionTimingFunction: _
},
e._x_transition.enter.start = {
opacity: c,
transform: `scale(${u})`
},
e._x_transition.enter.end = {
opacity: 1,
transform: "scale(1)"
});
o && (e._x_transition.leave.during = {
transformOrigin: d,
transitionDelay: h,
transitionProperty: p,
transitionDuration: `${m}s`,
transitionTimingFunction: _
},
e._x_transition.leave.start = {
opacity: 1,
transform: "scale(1)"
},
e._x_transition.leave.end = {
opacity: c,
transform: `scale(${u})`
})
}(e, i, t)
}
)),
window.Element.prototype._x_toggleAndCascadeWithTransitions = function(e, t, i, r) {
const n = "visible" === document.visibilityState ? requestAnimationFrame : setTimeout;
let o = ()=>n(i);
t ? e._x_transition && (e._x_transition.enter || e._x_transition.leave) ? e._x_transition.enter && (Object.entries(e._x_transition.enter.during).length || Object.entries(e._x_transition.enter.start).length || Object.entries(e._x_transition.enter.end).length) ? e._x_transition.in(i) : o() : e._x_transition ? e._x_transition.in(i) : o() : (e._x_hidePromise = e._x_transition ? new Promise(((t,i)=>{
e._x_transition.out((()=>{}
), (()=>t(r))),
e._x_transitioning.beforeCancel((()=>i({
isFromCancelledTransition: !0
})))
}
)) : Promise.resolve(r),
queueMicrotask((()=>{
let t = Oe(e);
t ? (t._x_hideChildren || (t._x_hideChildren = []),
t._x_hideChildren.push(e)) : n((()=>{
let t = e=>{
let i = Promise.all([e._x_hidePromise, ...(e._x_hideChildren || []).map(t)]).then((([e])=>e()));
return delete e._x_hidePromise,
delete e._x_hideChildren,
i
}
;
t(e).catch((e=>{
if (!e.isFromCancelledTransition)
throw e
}
))
}
))
}
)))
}
;
var Ue = !1;
function Ve(e, t=(()=>{}
)) {
return (...i)=>Ue ? t(...i) : e(...i)
}
function je(e, t, i, n=[]) {
switch (e._x_bindings || (e._x_bindings = r({})),
e._x_bindings[t] = i,
t = n.includes("camel") ? t.toLowerCase().replace(/-(\w)/g, ((e,t)=>t.toUpperCase())) : t) {
case "value":
!function(e, t) {
if ("radio" === e.type)
void 0 === e.attributes.value && (e.value = t),
window.fromModel && (e.checked = Ne(e.value, t));
else if ("checkbox" === e.type)
Number.isInteger(t) ? e.value = t : Number.isInteger(t) || Array.isArray(t) || "boolean" == typeof t || [null, void 0].includes(t) ? Array.isArray(t) ? e.checked = t.some((t=>Ne(t, e.value))) : e.checked = !!t : e.value = String(t);
else if ("SELECT" === e.tagName)
!function(e, t) {
const i = [].concat(t).map((e=>e + ""));
Array.from(e.options).forEach((e=>{
e.selected = i.includes(e.value)
}
))
}(e, t);
else {
if (e.value === t)
return;
e.value = t
}
}(e, i);
break;
case "style":
!function(e, t) {
e._x_undoAddedStyles && e._x_undoAddedStyles();
e._x_undoAddedStyles = De(e, t)
}(e, i);
break;
case "class":
!function(e, t) {
e._x_undoAddedClasses && e._x_undoAddedClasses();
e._x_undoAddedClasses = ke(e, t)
}(e, i);
break;
default:
!function(e, t, i) {
[null, void 0, !1].includes(i) && function(e) {
return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(e)
}(t) ? e.removeAttribute(t) : (Ge(t) && (i = t),
function(e, t, i) {
e.getAttribute(t) != i && e.setAttribute(t, i)
}(e, t, i))
}(e, t, i)
}
}
function Ne(e, t) {
return e == t
}
function Ge(e) {
return ["disabled", "checked", "required", "readonly", "hidden", "open", "selected", "autofocus", "itemscope", "multiple", "novalidate", "allowfullscreen", "allowpaymentrequest", "formnovalidate", "autoplay", "controls", "loop", "muted", "playsinline", "default", "ismap", "reversed", "async", "defer", "nomodule"].includes(e)
}
function $e(e, t) {
var i;
return function() {
var r = this
, n = arguments
, o = function() {
i = null,
e.apply(r, n)
};
clearTimeout(i),
i = setTimeout(o, t)
}
}
function qe(e, t) {
let i;
return function() {
let r = this
, n = arguments;
i || (e.apply(r, n),
i = !0,
setTimeout((()=>i = !1), t))
}
}
var Ze = {}
, We = !1;
var Xe = {};
function He(e, t, i) {
let r = [];
for (; r.length; )
r.pop()();
let n = Object.entries(t).map((([e,t])=>({
name: e,
value: t
})))
, o = te(n);
n = n.map((e=>o.find((t=>t.name === e.name)) ? {
name: `x-bind:${e.name}`,
value: `"${e.value}"`
} : e)),
ee(e, n, i).map((e=>{
r.push(e.runCleanups),
e()
}
))
}
var Ye = {};
var Ke = {
get reactive() {
return r
},
get release() {
return o
},
get effect() {
return n
},
get raw() {
return s
},
version: "3.10.3",
flushAndStopDeferringMutations: function() {
M = !1,
I(A),
A = []
},
dontAutoEvaluateFunctions: function(e) {
let t = G;
G = !1,
e(),
G = t
},
disableEffectScheduling: function(e) {
p = !1,
e(),
p = !0
},
setReactivityEngine: function(e) {
r = e.reactive,
o = e.release,
n = t=>e.effect(t, {
scheduler: e=>{
p ? u(e) : e()
}
}),
s = e.raw
},
closestDataStack: D,
skipDuringClone: Ve,
addRootSelector: Ce,
addInitSelector: Me,
addScopeToNode: k,
deferMutations: function() {
M = !0
},
mapAttributes: ce,
evaluateLater: q,
setEvaluator: function(e) {
Z = e
},
mergeProxies: L,
findClosest: Ie,
closestRoot: Ae,
interceptor: O,
transition: Re,
setStyles: De,
mutateDom: C,
directive: Q,
throttle: qe,
debounce: $e,
evaluate: $,
initTree: ze,
nextTick: ye,
prefixed: K,
prefix: function(e) {
Y = e
},
plugin: function(e) {
e(Je)
},
magic: U,
store: function(e, t) {
if (We || (Ze = r(Ze),
We = !0),
void 0 === t)
return Ze[e];
Ze[e] = t,
"object" == typeof t && null !== t && t.hasOwnProperty("init") && "function" == typeof t.init && Ze[e].init(),
B(Ze[e])
},
start: function() {
var e;
document.body || be("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),
me(document, "alpine:init"),
me(document, "alpine:initializing"),
w(),
e = e=>ze(e, ve),
g.push(e),
y((e=>{
ve(e, (e=>x(e)))
}
)),
function(e) {
m.push(e)
}(((e,t)=>{
ee(e, t).forEach((e=>e()))
}
)),
Array.from(document.querySelectorAll(Se())).filter((e=>!Ae(e.parentElement, !0))).forEach((e=>{
ze(e)
}
)),
me(document, "alpine:initialized")
},
clone: function(e, t) {
t._x_dataStack || (t._x_dataStack = e._x_dataStack),
Ue = !0,
function(e) {
let t = n;
f(((e,i)=>{
let r = t(e);
return o(r),
()=>{}
}
)),
e(),
f(t)
}((()=>{
!function(e) {
let t = !1;
ze(e, ((e,i)=>{
ve(e, ((e,r)=>{
if (t && function(e) {
return Ee().some((t=>e.matches(t)))
}(e))
return r();
t = !0,
i(e, r)
}
))
}
))
}(t)
}
)),
Ue = !1
},
bound: function(e, t, i) {
if (e._x_bindings && void 0 !== e._x_bindings[t])
return e._x_bindings[t];
let r = e.getAttribute(t);
return null === r ? "function" == typeof i ? i() : i : Ge(t) ? !![t, "true"].includes(r) : "" === r || r
},
$data: z,
data: function(e, t) {
Ye[e] = t
},
bind: function(e, t) {
let i = "function" != typeof t ? ()=>t : t;
e instanceof Element ? He(e, i()) : Xe[e] = i
}
}
, Je = Ke;
function Qe(e, t) {
const i = Object.create(null)
, r = e.split(",");
for (let e = 0; e < r.length; e++)
i[r[e]] = !0;
return t ? e=>!!i[e.toLowerCase()] : e=>!!i[e]
}
var et, tt = Object.freeze({}), it = (Object.freeze([]),
Object.assign), rt = Object.prototype.hasOwnProperty, nt = (e,t)=>rt.call(e, t), ot = Array.isArray, st = e=>"[object Map]" === ut(e), at = e=>"symbol" == typeof e, lt = e=>null !== e && "object" == typeof e, ct = Object.prototype.toString, ut = e=>ct.call(e), ht = e=>ut(e).slice(8, -1), dt = e=>(e=>"string" == typeof e)(e) && "NaN" !== e && "-" !== e[0] && "" + parseInt(e, 10) === e, pt = e=>{
const t = Object.create(null);
return i=>t[i] || (t[i] = e(i))
}
, ft = /-(\w)/g, mt = (pt((e=>e.replace(ft, ((e,t)=>t ? t.toUpperCase() : "")))),
/\B([A-Z])/g), _t = (pt((e=>e.replace(mt, "-$1").toLowerCase())),
pt((e=>e.charAt(0).toUpperCase() + e.slice(1)))), gt = (pt((e=>e ? `on ${_t(e)}` : "")),
(e,t)=>e !== t && (e == e || t == t)), yt = new WeakMap, xt = [], vt = Symbol("iterate"), bt = Symbol("Map key iterate");
var wt = 0;
function Tt(e) {
const {deps: t} = e;
if (t.length) {
for (let i = 0; i < t.length; i++)
t[i].delete(e);
t.length = 0
}
}
var Et = !0
, St = [];
function Ct() {
const e = St.pop();
Et = void 0 === e || e
}
function Mt(e, t, i) {
if (!Et || void 0 === et)
return;
let r = yt.get(e);
r || yt.set(e, r = new Map);
let n = r.get(i);
n || r.set(i, n = new Set),
n.has(et) || (n.add(et),
et.deps.push(n),
et.options.onTrack && et.options.onTrack({
effect: et,
target: e,
type: t,
key: i
}))
}
function At(e, t, i, r, n, o) {
const s = yt.get(e);
if (!s)
return;
const a = new Set
, l = e=>{
e && e.forEach((e=>{
(e !== et || e.allowRecurse) && a.add(e)
}
))
}
;
if ("clear" === t)
s.forEach(l);
else if ("length" === i && ot(e))
s.forEach(((e,t)=>{
("length" === t || t >= r) && l(e)
}
));
else
switch (void 0 !== i && l(s.get(i)),
t) {
case "add":
ot(e) ? dt(i) && l(s.get("length")) : (l(s.get(vt)),
st(e) && l(s.get(bt)));
break;
case "delete":
ot(e) || (l(s.get(vt)),
st(e) && l(s.get(bt)));
break;
case "set":
st(e) && l(s.get(vt))
}
a.forEach((s=>{
s.options.onTrigger && s.options.onTrigger({
effect: s,
target: e,
key: i,
type: t,
newValue: r,
oldValue: n,
oldTarget: o
}),
s.options.scheduler ? s.options.scheduler(s) : s()
}
))
}
var It = Qe("__proto__,__v_isRef,__isVue")
, zt = new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(at))
, kt = Ot()
, Pt = Ot(!1, !0)
, Dt = Ot(!0)
, Lt = Ot(!0, !0)
, Bt = {};
function Ot(e=!1, t=!1) {
return function(i, r, n) {
if ("__v_isReactive" === r)
return !e;
if ("__v_isReadonly" === r)
return e;
if ("__v_raw" === r && n === (e ? t ? hi : ui : t ? ci : li).get(i))
return i;
const o = ot(i);
if (!e && o && nt(Bt, r))
return Reflect.get(Bt, r, n);
const s = Reflect.get(i, r, n);
if (at(r) ? zt.has(r) : It(r))
return s;
if (e || Mt(i, "get", r),
t)
return s;
if (_i(s)) {
return !o || !dt(r) ? s.value : s
}
return lt(s) ? e ? pi(s) : di(s) : s
}
}
function Rt(e=!1) {
return function(t, i, r, n) {
let o = t[i];
if (!e && (r = mi(r),
o = mi(o),
!ot(t) && _i(o) && !_i(r)))
return o.value = r,
!0;
const s = ot(t) && dt(i) ? Number(i) < t.length : nt(t, i)
, a = Reflect.set(t, i, r, n);
return t === mi(n) && (s ? gt(r, o) && At(t, "set", i, r, o) : At(t, "add", i, r)),
a
}
}
["includes", "indexOf", "lastIndexOf"].forEach((e=>{
const t = Array.prototype[e];
Bt[e] = function(...e) {
const i = mi(this);
for (let e = 0, t = this.length; e < t; e++)
Mt(i, "get", e + "");
const r = t.apply(i, e);
return -1 === r || !1 === r ? t.apply(i, e.map(mi)) : r
}
}
)),
["push", "pop", "shift", "unshift", "splice"].forEach((e=>{
const t = Array.prototype[e];
Bt[e] = function(...e) {
St.push(Et),
Et = !1;
const i = t.apply(this, e);
return Ct(),
i
}
}
));
var Ft = {
get: kt,
set: Rt(),
deleteProperty: function(e, t) {
const i = nt(e, t)
, r = e[t]
, n = Reflect.deleteProperty(e, t);
return n && i && At(e, "delete", t, void 0, r),
n
},
has: function(e, t) {
const i = Reflect.has(e, t);
return at(t) && zt.has(t) || Mt(e, "has", t),
i
},
ownKeys: function(e) {
return Mt(e, "iterate", ot(e) ? "length" : vt),
Reflect.ownKeys(e)
}
}
, Ut = {
get: Dt,
set: (e,t)=>(console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`, e),
!0),
deleteProperty: (e,t)=>(console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`, e),
!0)
}
, Vt = (it({}, Ft, {
get: Pt,
set: Rt(!0)
}),
it({}, Ut, {
get: Lt
}),
e=>lt(e) ? di(e) : e)
, jt = e=>lt(e) ? pi(e) : e
, Nt = e=>e
, Gt = e=>Reflect.getPrototypeOf(e);
function $t(e, t, i=!1, r=!1) {
const n = mi(e = e.__v_raw)
, o = mi(t);
t !== o && !i && Mt(n, "get", t),
!i && Mt(n, "get", o);
const {has: s} = Gt(n)
, a = r ? Nt : i ? jt : Vt;
return s.call(n, t) ? a(e.get(t)) : s.call(n, o) ? a(e.get(o)) : void (e !== n && e.get(t))
}
function qt(e, t=!1) {
const i = this.__v_raw
, r = mi(i)
, n = mi(e);
return e !== n && !t && Mt(r, "has", e),
!t && Mt(r, "has", n),
e === n ? i.has(e) : i.has(e) || i.has(n)
}
function Zt(e, t=!1) {
return e = e.__v_raw,
!t && Mt(mi(e), "iterate", vt),
Reflect.get(e, "size", e)
}
function Wt(e) {
e = mi(e);
const t = mi(this);
return Gt(t).has.call(t, e) || (t.add(e),
At(t, "add", e, e)),
this
}
function Xt(e, t) {
t = mi(t);
const i = mi(this)
, {has: r, get: n} = Gt(i);
let o = r.call(i, e);
o ? ai(i, r, e) : (e = mi(e),
o = r.call(i, e));
const s = n.call(i, e);
return i.set(e, t),
o ? gt(t, s) && At(i, "set", e, t, s) : At(i, "add", e, t),
this
}
function Ht(e) {
const t = mi(this)
, {has: i, get: r} = Gt(t);
let n = i.call(t, e);
n ? ai(t, i, e) : (e = mi(e),
n = i.call(t, e));
const o = r ? r.call(t, e) : void 0
, s = t.delete(e);
return n && At(t, "delete", e, void 0, o),
s
}
function Yt() {
const e = mi(this)
, t = 0 !== e.size
, i = st(e) ? new Map(e) : new Set(e)
, r = e.clear();
return t && At(e, "clear", void 0, void 0, i),
r
}
function Kt(e, t) {
return function(i, r) {
const n = this
, o = n.__v_raw
, s = mi(o)
, a = t ? Nt : e ? jt : Vt;
return !e && Mt(s, "iterate", vt),
o.forEach(((e,t)=>i.call(r, a(e), a(t), n)))
}
}
function Jt(e, t, i) {
return function(...r) {
const n = this.__v_raw
, o = mi(n)
, s = st(o)
, a = "entries" === e || e === Symbol.iterator && s
, l = "keys" === e && s
, c = n[e](...r)
, u = i ? Nt : t ? jt : Vt;
return !t && Mt(o, "iterate", l ? bt : vt),
{
next() {
const {value: e, done: t} = c.next();
return t ? {
value: e,
done: t
} : {
value: a ? [u(e[0]), u(e[1])] : u(e),
done: t
}
},
[Symbol.iterator]() {
return this
}
}
}
}
function Qt(e) {
return function(...t) {
{
const i = t[0] ? `on key "${t[0]}" ` : "";
console.warn(`${_t(e)} operation ${i}failed: target is readonly.`, mi(this))
}
return "delete" !== e && this
}
}
var ei = {
get(e) {
return $t(this, e)
},
get size() {
return Zt(this)
},
has: qt,
add: Wt,
set: Xt,
delete: Ht,
clear: Yt,
forEach: Kt(!1, !1)
}
, ti = {
get(e) {
return $t(this, e, !1, !0)
},
get size() {
return Zt(this)
},
has: qt,
add: Wt,
set: Xt,
delete: Ht,
clear: Yt,
forEach: Kt(!1, !0)
}
, ii = {
get(e) {
return $t(this, e, !0)
},
get size() {
return Zt(this, !0)
},
has(e) {
return qt.call(this, e, !0)
},
add: Qt("add"),
set: Qt("set"),
delete: Qt("delete"),
clear: Qt("clear"),
forEach: Kt(!0, !1)
}
, ri = {
get(e) {
return $t(this, e, !0, !0)
},
get size() {
return Zt(this, !0)
},
has(e) {
return qt.call(this, e, !0)
},
add: Qt("add"),
set: Qt("set"),
delete: Qt("delete"),
clear: Qt("clear"),
forEach: Kt(!0, !0)
};
function ni(e, t) {
const i = t ? e ? ri : ti : e ? ii : ei;
return (t,r,n)=>"__v_isReactive" === r ? !e : "__v_isReadonly" === r ? e : "__v_raw" === r ? t : Reflect.get(nt(i, r) && r in t ? i : t, r, n)
}
["keys", "values", "entries", Symbol.iterator].forEach((e=>{
ei[e] = Jt(e, !1, !1),
ii[e] = Jt(e, !0, !1),
ti[e] = Jt(e, !1, !0),
ri[e] = Jt(e, !0, !0)
}
));
var oi = {
get: ni(!1, !1)
}
, si = (ni(!1, !0),
{
get: ni(!0, !1)
});
ni(!0, !0);
function ai(e, t, i) {
const r = mi(i);
if (r !== i && t.call(e, r)) {
const t = ht(e);
console.warn(`Reactive ${t} contains both the raw and reactive versions of the same object ${"Map" === t ? " as keys" : ""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)
}
}
var li = new WeakMap
, ci = new WeakMap
, ui = new WeakMap
, hi = new WeakMap;
function di(e) {
return e && e.__v_isReadonly ? e : fi(e, !1, Ft, oi, li)
}
function pi(e) {
return fi(e, !0, Ut, si, ui)
}
function fi(e, t, i, r, n) {
if (!lt(e))
return console.warn(`value cannot be made reactive: ${String(e)}`),
e;
if (e.__v_raw && (!t || !e.__v_isReactive))
return e;
const o = n.get(e);
if (o)
return o;
const s = function(e) {
return e.__v_skip || !Object.isExtensible(e) ? 0 : function(e) {
switch (e) {
case "Object":
case "Array":
return 1;
case "Map":
case "Set":
case "WeakMap":
case "WeakSet":
return 2;
default:
return 0
}
}(ht(e))
}(e);
if (0 === s)
return e;
const a = new Proxy(e,2 === s ? r : i);
return n.set(e, a),
a
}
function mi(e) {
return e && mi(e.__v_raw) || e
}
function _i(e) {
return Boolean(e && !0 === e.__v_isRef)
}
U("nextTick", (()=>ye)),
U("dispatch", (e=>me.bind(me, e))),
U("watch", ((e,{evaluateLater: t, effect: i})=>(r,n)=>{
let o, s = t(r), a = !0, l = i((()=>s((e=>{
JSON.stringify(e),
a ? o = e : queueMicrotask((()=>{
n(e, o),
o = e
}
)),
a = !1
}
))));
e._x_effects.delete(l)
}
)),
U("store", (function() {
return Ze
}
)),
U("data", (e=>z(e))),
U("root", (e=>Ae(e))),
U("refs", (e=>(e._x_refs_proxy || (e._x_refs_proxy = L(function(e) {
let t = []
, i = e;
for (; i; )
i._x_refs && t.push(i._x_refs),
i = i.parentNode;
return t
}(e))),
e._x_refs_proxy)));
var gi = {};
function yi(e) {
return gi[e] || (gi[e] = 0),
++gi[e]
}
function xi(e, t, i) {
U(t, (t=>be(`You can't use [$ ${directiveName}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${i}`, t)))
}
U("id", (e=>(t,i=null)=>{
let r = function(e, t) {
return Ie(e, (e=>{
if (e._x_ids && e._x_ids[t])
return !0
}
))
}(e, t)
, n = r ? r._x_ids[t] : yi(t);
return i ? `${t}-${n}-${i}` : `${t}-${n}`
}
)),
U("el", (e=>e)),
xi("Focus", "focus", "focus"),
xi("Persist", "persist", "persist"),
Q("modelable", ((e,{expression: t},{effect: i, evaluateLater: r})=>{
let n = r(t)
, o = ()=>{
let e;
return n((t=>e = t)),
e
}
, s = r(`${t} = __placeholder`)
, a = e=>s((()=>{}
), {
scope: {
__placeholder: e
}
})
, l = o();
a(l),
queueMicrotask((()=>{
if (!e._x_model)
return;
e._x_removeModelListeners.default();
let t = e._x_model.get
, r = e._x_model.set;
i((()=>a(t()))),
i((()=>r(o())))
}
))
}
)),
Q("teleport", ((e,{expression: t},{cleanup: i})=>{
"template" !== e.tagName.toLowerCase() && be("x-teleport can only be used on a <template> tag", e);
let r = document.querySelector(t);
r || be(`Cannot find x-teleport element for selector: "${t}"`);
let n = e.content.cloneNode(!0).firstElementChild;
e._x_teleport = n,
n._x_teleportBack = e,
e._x_forwardEvents && e._x_forwardEvents.forEach((t=>{
n.addEventListener(t, (t=>{
t.stopPropagation(),
e.dispatchEvent(new t.constructor(t.type,t))
}
))
}
)),
k(n, {}, e),
C((()=>{
r.appendChild(n),
ze(n),
n._x_ignore = !0
}
)),
i((()=>n.remove()))
}
));
var vi = ()=>{}
;
function bi(e, t, i, r) {
let n = e
, o = e=>r(e)
, s = {}
, a = (e,t)=>i=>t(e, i);
if (i.includes("dot") && (t = t.replace(/-/g, ".")),
i.includes("camel") && (t = function(e) {
return e.toLowerCase().replace(/-(\w)/g, ((e,t)=>t.toUpperCase()))
}(t)),
i.includes("passive") && (s.passive = !0),
i.includes("capture") && (s.capture = !0),
i.includes("window") && (n = window),
i.includes("document") && (n = document),
i.includes("prevent") && (o = a(o, ((e,t)=>{
t.preventDefault(),
e(t)
}
))),
i.includes("stop") && (o = a(o, ((e,t)=>{
t.stopPropagation(),
e(t)
}
))),
i.includes("self") && (o = a(o, ((t,i)=>{
i.target === e && t(i)
}
))),
(i.includes("away") || i.includes("outside")) && (n = document,
o = a(o, ((t,i)=>{
e.contains(i.target) || !1 !== i.target.isConnected && (e.offsetWidth < 1 && e.offsetHeight < 1 || !1 !== e._x_isShown && t(i))
}
))),
i.includes("once") && (o = a(o, ((e,i)=>{
e(i),
n.removeEventListener(t, o, s)
}
))),
o = a(o, ((e,r)=>{
(function(e) {
return ["keydown", "keyup"].includes(e)
}
)(t) && function(e, t) {
let i = t.filter((e=>!["window", "document", "prevent", "stop", "once"].includes(e)));
if (i.includes("debounce")) {
let e = i.indexOf("debounce");
i.splice(e, wi((i[e + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1)
}
if (0 === i.length)
return !1;
if (1 === i.length && Ti(e.key).includes(i[0]))
return !1;
const r = ["ctrl", "shift", "alt", "meta", "cmd", "super"].filter((e=>i.includes(e)));
if (i = i.filter((e=>!r.includes(e))),
r.length > 0) {
if (r.filter((t=>("cmd" !== t && "super" !== t || (t = "meta"),
e[`${t}Key`]))).length === r.length && Ti(e.key).includes(i[0]))
return !1
}
return !0
}(r, i) || e(r)
}
)),
i.includes("debounce")) {
let e = i[i.indexOf("debounce") + 1] || "invalid-wait"
, t = wi(e.split("ms")[0]) ? Number(e.split("ms")[0]) : 250;
o = $e(o, t)
}
if (i.includes("throttle")) {
let e = i[i.indexOf("throttle") + 1] || "invalid-wait"
, t = wi(e.split("ms")[0]) ? Number(e.split("ms")[0]) : 250;
o = qe(o, t)
}
return n.addEventListener(t, o, s),
()=>{
n.removeEventListener(t, o, s)
}
}
function wi(e) {
return !Array.isArray(e) && !isNaN(e)
}
function Ti(e) {
if (!e)
return [];
e = e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase();
let t = {
ctrl: "control",
slash: "/",
space: "-",
spacebar: "-",
cmd: "meta",
esc: "escape",
up: "arrow-up",
down: "arrow-down",
left: "arrow-left",
right: "arrow-right",
period: ".",
equal: "="
};
return t[e] = e,
Object.keys(t).map((i=>{
if (t[i] === e)
return i
}
)).filter((e=>e))
}
function Ei(e) {
let t = e ? parseFloat(e) : null;
return i = t,
Array.isArray(i) || isNaN(i) ? e : t;
var i
}
function Si(e, t, i, r) {
let n = {};
if (/^\[.*\]$/.test(e.item) && Array.isArray(t)) {
e.item.replace("[", "").replace("]", "").split(",").map((e=>e.trim())).forEach(((e,i)=>{
n[e] = t[i]
}
))
} else if (/^\{.*\}$/.test(e.item) && !Array.isArray(t) && "object" == typeof t) {
e.item.replace("{", "").replace("}", "").split(",").map((e=>e.trim())).forEach((e=>{
n[e] = t[e]
}
))
} else
n[e.item] = t;
return e.index && (n[e.index] = i),
e.collection && (n[e.collection] = r),
n
}
function Ci() {}
function Mi(e, t, i) {
Q(t, (r=>be(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${i}`, r)))
}
vi.inline = (e,{modifiers: t},{cleanup: i})=>{
t.includes("self") ? e._x_ignoreSelf = !0 : e._x_ignore = !0,
i((()=>{
t.includes("self") ? delete e._x_ignoreSelf : delete e._x_ignore
}
))
}
,
Q("ignore", vi),
Q("effect", ((e,{expression: t},{effect: i})=>i(q(e, t)))),
Q("model", ((e,{modifiers: t, expression: i},{effect: r, cleanup: n})=>{
let o = q(e, i)
, s = q(e, `${i} = rightSideOfExpression($event, ${i})`);
var a = "select" === e.tagName.toLowerCase() || ["checkbox", "radio"].includes(e.type) || t.includes("lazy") ? "change" : "input";
let l = function(e, t, i) {
"radio" === e.type && C((()=>{
e.hasAttribute("name") || e.setAttribute("name", i)
}
));
return (i,r)=>C((()=>{
if (i instanceof CustomEvent && void 0 !== i.detail)
return i.detail || i.target.value;
if ("checkbox" === e.type) {
if (Array.isArray(r)) {
let e = t.includes("number") ? Ei(i.target.value) : i.target.value;
return i.target.checked ? r.concat([e]) : r.filter((t=>!(t == e)))
}
return i.target.checked
}
if ("select" === e.tagName.toLowerCase() && e.multiple)
return t.includes("number") ? Array.from(i.target.selectedOptions).map((e=>Ei(e.value || e.text))) : Array.from(i.target.selectedOptions).map((e=>e.value || e.text));
{
let e = i.target.value;
return t.includes("number") ? Ei(e) : t.includes("trim") ? e.trim() : e
}
}
))
}(e, t, i)
, c = bi(e, a, t, (e=>{
s((()=>{}
), {
scope: {
$event: e,
rightSideOfExpression: l
}
})
}
));
e._x_removeModelListeners || (e._x_removeModelListeners = {}),
e._x_removeModelListeners.default = c,
n((()=>e._x_removeModelListeners.default()));
let u = q(e, `${i} = __placeholder`);
e._x_model = {
get() {
let e;
return o((t=>e = t)),
e
},
set(e) {
u((()=>{}
), {
scope: {
__placeholder: e
}
})
}
},
e._x_forceModelUpdate = ()=>{
o((t=>{
void 0 === t && i.match(/\./) && (t = ""),
window.fromModel = !0,
C((()=>je(e, "value", t))),
delete window.fromModel
}
))
}
,
r((()=>{
t.includes("unintrusive") && document.activeElement.isSameNode(e) || e._x_forceModelUpdate()
}
))
}
)),
Q("cloak", (e=>queueMicrotask((()=>C((()=>e.removeAttribute(K("cloak")))))))),
Me((()=>`[${K("init")}]`)),
Q("init", Ve(((e,{expression: t},{evaluate: i})=>"string" == typeof t ? !!t.trim() && i(t, {}, !1) : i(t, {}, !1)))),
Q("text", ((e,{expression: t},{effect: i, evaluateLater: r})=>{
let n = r(t);
i((()=>{
n((t=>{
C((()=>{
e.textContent = t
}
))
}
))
}
))
}
)),
Q("html", ((e,{expression: t},{effect: i, evaluateLater: r})=>{
let n = r(t);
i((()=>{
n((t=>{
C((()=>{
e.innerHTML = t,
e._x_ignoreSelf = !0,
ze(e),
delete e._x_ignoreSelf
}
))
}
))
}
))
}
)),
ce(se(":", K("bind:"))),
Q("bind", ((e,{value: t, modifiers: i, expression: r, original: n},{effect: o})=>{
if (!t) {
let t = {};
return s = t,
Object.entries(Xe).forEach((([e,t])=>{
Object.defineProperty(s, e, {
get: ()=>(...e)=>t(...e)
})
}
)),
void q(e, r)((t=>{
He(e, t, n)
}
), {
scope: t
})
}
var s;
if ("key" === t)
return function(e, t) {
e._x_keyExpression = t
}(e, r);
let a = q(e, r);
o((()=>a((n=>{
void 0 === n && r.match(/\./) && (n = ""),
C((()=>je(e, t, n, i)))
}
))))
}
)),
Ce((()=>`[${K("data")}]`)),
Q("data", Ve(((e,{expression: t},{cleanup: i})=>{
t = "" === t ? "{}" : t;
let n = {};
V(n, e);
let o = {};
var s, a;
s = o,
a = n,
Object.entries(Ye).forEach((([e,t])=>{
Object.defineProperty(s, e, {
get: ()=>(...e)=>t.bind(a)(...e),
enumerable: !1
})
}
));
let l = $(e, t, {
scope: o
});
void 0 === l && (l = {}),
V(l, e);
let c = r(l);
B(c);
let u = k(e, c);
c.init && $(e, c.init),
i((()=>{
c.destroy && $(e, c.destroy),
u()
}
))
}
))),
Q("show", ((e,{modifiers: t, expression: i},{effect: r})=>{
let n = q(e, i);
e._x_doHide || (e._x_doHide = ()=>{
C((()=>{
e.style.setProperty("display", "none", t.includes("important") ? "important" : void 0)
}
))
}
),
e._x_doShow || (e._x_doShow = ()=>{
C((()=>{
1 === e.style.length && "none" === e.style.display ? e.removeAttribute("style") : e.style.removeProperty("display")
}
))
}
);
let o, s = ()=>{
e._x_doHide(),
e._x_isShown = !1
}
, a = ()=>{
e._x_doShow(),
e._x_isShown = !0
}
, l = ()=>setTimeout(a), c = Le((e=>e ? a() : s()), (t=>{
"function" == typeof e._x_toggleAndCascadeWithTransitions ? e._x_toggleAndCascadeWithTransitions(e, t, a, s) : t ? l() : s()
}
)), u = !0;
r((()=>n((e=>{
(u || e !== o) && (t.includes("immediate") && (e ? l() : s()),
c(e),
o = e,
u = !1)
}
))))
}
)),
Q("for", ((e,{expression: t},{effect: i, cleanup: n})=>{
let o = function(e) {
let t = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/
, i = /^\s*\(|\)\s*$/g
, r = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/
, n = e.match(r);
if (!n)
return;
let o = {};
o.items = n[2].trim();
let s = n[1].replace(i, "").trim()
, a = s.match(t);
a ? (o.item = s.replace(t, "").trim(),
o.index = a[1].trim(),
a[2] && (o.collection = a[2].trim())) : o.item = s;
return o
}(t)
, s = q(e, o.items)
, a = q(e, e._x_keyExpression || "index");
e._x_prevKeys = [],
e._x_lookup = {},
i((()=>function(e, t, i, n) {
let o = e=>"object" == typeof e && !Array.isArray(e)
, s = e;
i((i=>{
var a;
a = i,
!Array.isArray(a) && !isNaN(a) && i >= 0 && (i = Array.from(Array(i).keys(), (e=>e + 1))),
void 0 === i && (i = []);
let l = e._x_lookup
, c = e._x_prevKeys
, u = []
, d = [];
if (o(i))
i = Object.entries(i).map((([e,r])=>{
let o = Si(t, r, e, i);
n((e=>d.push(e)), {
scope: {
index: e,
...o
}
}),
u.push(o)
}
));
else
for (let e = 0; e < i.length; e++) {
let r = Si(t, i[e], e, i);
n((e=>d.push(e)), {
scope: {
index: e,
...r
}
}),
u.push(r)
}
let p = []
, f = []
, m = []
, _ = [];
for (let e = 0; e < c.length; e++) {
let t = c[e];
-1 === d.indexOf(t) && m.push(t)
}
c = c.filter((e=>!m.includes(e)));
let g = "template";
for (let e = 0; e < d.length; e++) {
let t = d[e]
, i = c.indexOf(t);
if (-1 === i)
c.splice(e, 0, t),
p.push([g, e]);
else if (i !== e) {
let t = c.splice(e, 1)[0]
, r = c.splice(i - 1, 1)[0];
c.splice(e, 0, r),
c.splice(i, 0, t),
f.push([t, r])
} else
_.push(t);
g = t
}
for (let e = 0; e < m.length; e++) {
let t = m[e];
l[t]._x_effects && l[t]._x_effects.forEach(h),
l[t].remove(),
l[t] = null,
delete l[t]
}
for (let e = 0; e < f.length; e++) {
let[t,i] = f[e]
, r = l[t]
, n = l[i]
, o = document.createElement("div");
C((()=>{
n.after(o),
r.after(n),
n._x_currentIfEl && n.after(n._x_currentIfEl),
o.before(r),
r._x_currentIfEl && r.after(r._x_currentIfEl),
o.remove()
}
)),
P(n, u[d.indexOf(i)])
}
for (let e = 0; e < p.length; e++) {
let[t,i] = p[e]
, n = "template" === t ? s : l[t];
n._x_currentIfEl && (n = n._x_currentIfEl);
let o = u[i]
, a = d[i]
, c = document.importNode(s.content, !0).firstElementChild;
k(c, r(o), s),
C((()=>{
n.after(c),
ze(c)
}
)),
"object" == typeof a && be("x-for key cannot be an object, it must be a string or an integer", s),
l[a] = c
}
for (let e = 0; e < _.length; e++)
P(l[_[e]], u[d.indexOf(_[e])]);
s._x_prevKeys = d
}
))
}(e, o, s, a))),
n((()=>{
Object.values(e._x_lookup).forEach((e=>e.remove())),
delete e._x_prevKeys,
delete e._x_lookup
}
))
}
)),
Ci.inline = (e,{expression: t},{cleanup: i})=>{
let r = Ae(e);
r._x_refs || (r._x_refs = {}),
r._x_refs[t] = e,
i((()=>delete r._x_refs[t]))
}
,
Q("ref", Ci),
Q("if", ((e,{expression: t},{effect: i, cleanup: r})=>{
let n = q(e, t);
i((()=>n((t=>{
t ? (()=>{
if (e._x_currentIfEl)
return e._x_currentIfEl;
let t = e.content.cloneNode(!0).firstElementChild;
k(t, {}, e),
C((()=>{
e.after(t),
ze(t)
}
)),
e._x_currentIfEl = t,
e._x_undoIf = ()=>{
ve(t, (e=>{
e._x_effects && e._x_effects.forEach(h)
}
)),
t.remove(),
delete e._x_currentIfEl
}
}
)() : e._x_undoIf && (e._x_undoIf(),
delete e._x_undoIf)
}
)))),
r((()=>e._x_undoIf && e._x_undoIf()))
}
)),
Q("id", ((e,{expression: t},{evaluate: i})=>{
i(t).forEach((t=>function(e, t) {
e._x_ids || (e._x_ids = {}),
e._x_ids[t] || (e._x_ids[t] = yi(t))
}(e, t)))
}
)),
ce(se("@", K("on:"))),
Q("on", Ve(((e,{value: t, modifiers: i, expression: r},{cleanup: n})=>{
let o = r ? q(e, r) : ()=>{}
;
"template" === e.tagName.toLowerCase() && (e._x_forwardEvents || (e._x_forwardEvents = []),
e._x_forwardEvents.includes(t) || e._x_forwardEvents.push(t));
let s = bi(e, t, i, (e=>{
o((()=>{}
), {
scope: {
$event: e
},
params: [e]
})
}
));
n((()=>s()))
}
))),
Mi("Collapse", "collapse", "collapse"),
Mi("Intersect", "intersect", "intersect"),
Mi("Focus", "trap", "focus"),
Mi("Mask", "mask", "mask"),
Je.setEvaluator(W),
Je.setReactivityEngine({
reactive: di,
effect: function(e, t=tt) {
(function(e) {
return e && !0 === e._isEffect
}
)(e) && (e = e.raw);
const i = function(e, t) {
const i = function() {
if (!i.active)
return e();
if (!xt.includes(i)) {
Tt(i);
try {
return St.push(Et),
Et = !0,
xt.push(i),
et = i,
e()
} finally {
xt.pop(),
Ct(),
et = xt[xt.length - 1]
}
}
};
return i.id = wt++,
i.allowRecurse = !!t.allowRecurse,
i._isEffect = !0,
i.active = !0,
i.raw = e,
i.deps = [],
i.options = t,
i
}(e, t);
return t.lazy || i(),
i
},
release: function(e) {
e.active && (Tt(e),
e.options.onStop && e.options.onStop(),
e.active = !1)
},
raw: mi
});
var Ai = Je;
function Ii(e, t, i) {
if (-1 === e.indexOf(t))
return i;
const r = e[e.indexOf(t) + 1];
if (!r)
return i;
if ("duration" === t) {
let e = r.match(/([0-9]+)ms/);
if (e)
return e[1]
}
if ("min" === t) {
let e = r.match(/([0-9]+)px/);
if (e)
return e[1]
}
return r
}
var zi = function(e) {
function t(t, {modifiers: i}) {
let r = Ii(i, "duration", 250) / 1e3
, n = Ii(i, "min", 0)
, o = !i.includes("min");
t._x_isShown || (t.style.height = `${n}px`),
!t._x_isShown && o && (t.hidden = !0),
t._x_isShown || (t.style.overflow = "hidden");
let s = (t,i)=>{
let r = e.setStyles(t, i);
return i.height ? ()=>{}
: r
}
, a = {
transitionProperty: "height",
transitionDuration: `${r}s`,
transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)"
};
t._x_transition = {
in(i=(()=>{}
), r=(()=>{}
)) {
o && (t.hidden = !1),
o && (t.style.display = null);
let s = t.getBoundingClientRect().height;
t.style.height = "auto";
let l = t.getBoundingClientRect().height;
s === l && (s = n),
e.transition(t, e.setStyles, {
during: a,
start: {
height: s + "px"
},
end: {
height: l + "px"
}
}, (()=>t._x_isShown = !0), (()=>{
t.style.height == `${l}px` && (t.style.overflow = null)
}
))
},
out(i=(()=>{}
), r=(()=>{}
)) {
let l = t.getBoundingClientRect().height;
e.transition(t, s, {
during: a,
start: {
height: l + "px"
},
end: {
height: n + "px"
}
}, (()=>t.style.overflow = "hidden"), (()=>{
t._x_isShown = !1,
t.style.height == `${n}px` && o && (t.style.display = "none",
t.hidden = !0)
}
))
}
}
}
e.directive("collapse", t),
t.inline = (e,{modifiers: t})=>{
t.includes("min") && (e._x_doShow = ()=>{}
,
e._x_doHide = ()=>{}
)
}
};
function ki(e) {
for (var t = 1; t < arguments.length; t++) {
var i = arguments[t];
for (var r in i)
e[r] = i[r]
}
return e
}
var Pi = {
read: function(e) {
return '"' === e[0] && (e = e.slice(1, -1)),
e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
},
write: function(e) {
return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)
}
};
var Di = function e(t, i) {
function r(e, r, n) {
if ("undefined" != typeof document) {
"number" == typeof (n = ki({}, i, n)).expires && (n.expires = new Date(Date.now() + 864e5 * n.expires)),
n.expires && (n.expires = n.expires.toUTCString()),
e = encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
var o = "";
for (var s in n)
n[s] && (o += "; " + s,
!0 !== n[s] && (o += "=" + n[s].split(";")[0]));
return document.cookie = e + "=" + t.write(r, e) + o
}
}
return Object.create({
set: r,
get: function(e) {
if ("undefined" != typeof document && (!arguments.length || e)) {
for (var i = document.cookie ? document.cookie.split("; ") : [], r = {}, n = 0; n < i.length; n++) {
var o = i[n].split("=")
, s = o.slice(1).join("=");
try {
var a = decodeURIComponent(o[0]);
if (r[a] = t.read(s, a),
e === a)
break
} catch (e) {}
}
return e ? r[e] : r
}
},
remove: function(e, t) {
r(e, "", ki({}, t, {
expires: -1
}))
},
withAttributes: function(t) {
return e(this.converter, ki({}, this.attributes, t))
},
withConverter: function(t) {
return e(ki({}, this.converter, t), this.attributes)
}
}, {
attributes: {
value: Object.freeze(i)
},
converter: {
value: Object.freeze(t)
}
})
}(Pi, {
path: "/"
});
const Li = Di;
function Bi(e) {
if (void 0 === e)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function Oi(e, t) {
e.prototype = Object.create(t.prototype),
e.prototype.constructor = e,
e.__proto__ = t
}
var Ri, Fi, Ui, Vi, ji, Ni, Gi, $i, qi, Zi, Wi, Xi, Hi, Yi, Ki, Ji = {
autoSleep: 120,
force3D: "auto",
nullTargetWarn: 1,
units: {
lineHeight: ""
}
}, Qi = {
duration: .5,
overwrite: !1,
delay: 0
}, er = 1e8, tr = 1e-8, ir = 2 * Math.PI, rr = ir / 4, nr = 0, or = Math.sqrt, sr = Math.cos, ar = Math.sin, lr = function(e) {
return "string" == typeof e
}, cr = function(e) {
return "function" == typeof e
}, ur = function(e) {
return "number" == typeof e
}, hr = function(e) {
return void 0 === e
}, dr = function(e) {
return "object" == typeof e
}, pr = function(e) {
return !1 !== e
}, fr = function() {
return "undefined" != typeof window
}, mr = function(e) {
return cr(e) || lr(e)
}, _r = "function" == typeof ArrayBuffer && ArrayBuffer.isView || function() {}
, gr = Array.isArray, yr = /(?:-?\.?\d|\.)+/gi, xr = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, vr = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, br = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, wr = /[+-]=-?[.\d]+/, Tr = /[^,'"\[\]\s]+/gi, Er = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, Sr = {}, Cr = {}, Mr = function(e) {
return (Cr = rn(e, Sr)) && ns
}, Ar = function(e, t) {
return console.warn("Invalid property", e, "set to", t, "Missing plugin? gsap.registerPlugin()")
}, Ir = function(e, t) {
return !t && console.warn(e)
}, zr = function(e, t) {
return e && (Sr[e] = t) && Cr && (Cr[e] = t) || Sr
}, kr = function() {
return 0
}, Pr = {
suppressEvents: !0,
isStart: !0,
kill: !1
}, Dr = {
suppressEvents: !0,
kill: !1
}, Lr = {
suppressEvents: !0
}, Br = {}, Or = [], Rr = {}, Fr = {}, Ur = {}, Vr = 30, jr = [], Nr = "", Gr = function(e) {
var t, i, r = e[0];
if (dr(r) || cr(r) || (e = [e]),
!(t = (r._gsap || {}).harness)) {
for (i = jr.length; i-- && !jr[i].targetTest(r); )
;
t = jr[i]
}
for (i = e.length; i--; )
e[i] && (e[i]._gsap || (e[i]._gsap = new xo(e[i],t))) || e.splice(i, 1);
return e
}, $r = function(e) {
return e._gsap || Gr(On(e))[0]._gsap
}, qr = function(e, t, i) {
return (i = e[t]) && cr(i) ? e[t]() : hr(i) && e.getAttribute && e.getAttribute(t) || i
}, Zr = function(e, t) {
return (e = e.split(",")).forEach(t) || e
}, Wr = function(e) {
return Math.round(1e5 * e) / 1e5 || 0
}, Xr = function(e) {
return Math.round(1e7 * e) / 1e7 || 0
}, Hr = function(e, t) {
var i = t.charAt(0)
, r = parseFloat(t.substr(2));
return e = parseFloat(e),
"+" === i ? e + r : "-" === i ? e - r : "*" === i ? e * r : e / r
}, Yr = function(e, t) {
for (var i = t.length, r = 0; e.indexOf(t[r]) < 0 && ++r < i; )
;
return r < i
}, Kr = function() {
var e, t, i = Or.length, r = Or.slice(0);
for (Rr = {},
Or.length = 0,
e = 0; e < i; e++)
(t = r[e]) && t._lazy && (t.render(t._lazy[0], t._lazy[1], !0)._lazy = 0)
}, Jr = function(e, t, i, r) {
Or.length && Kr(),
e.render(t, i, r || Fi && t < 0 && (e._initted || e._startAt)),
Or.length && Kr()
}, Qr = function(e) {
var t = parseFloat(e);
return (t || 0 === t) && (e + "").match(Tr).length < 2 ? t : lr(e) ? e.trim() : e
}, en = function(e) {
return e
}, tn = function(e, t) {
for (var i in t)
i in e || (e[i] = t[i]);
return e
}, rn = function(e, t) {
for (var i in t)
e[i] = t[i];
return e
}, nn = function e(t, i) {
for (var r in i)
"__proto__" !== r && "constructor" !== r && "prototype" !== r && (t[r] = dr(i[r]) ? e(t[r] || (t[r] = {}), i[r]) : i[r]);
return t
}, on = function(e, t) {
var i, r = {};
for (i in e)
i in t || (r[i] = e[i]);
return r
}, sn = function(e) {
var t, i = e.parent || Vi, r = e.keyframes ? (t = gr(e.keyframes),
function(e, i) {
for (var r in i)
r in e || "duration" === r && t || "ease" === r || (e[r] = i[r])
}
) : tn;
if (pr(e.inherit))
for (; i; )
r(e, i.vars.defaults),
i = i.parent || i._dp;
return e
}, an = function(e, t, i, r, n) {
void 0 === i && (i = "_first"),
void 0 === r && (r = "_last");
var o, s = e[r];
if (n)
for (o = t[n]; s && s[n] > o; )
s = s._prev;
return s ? (t._next = s._next,
s._next = t) : (t._next = e[i],
e[i] = t),
t._next ? t._next._prev = t : e[r] = t,
t._prev = s,
t.parent = t._dp = e,
t
}, ln = function(e, t, i, r) {
void 0 === i && (i = "_first"),
void 0 === r && (r = "_last");
var n = t._prev
, o = t._next;
n ? n._next = o : e[i] === t && (e[i] = o),
o ? o._prev = n : e[r] === t && (e[r] = n),
t._next = t._prev = t.parent = null
}, cn = function(e, t) {
e.parent && (!t || e.parent.autoRemoveChildren) && e.parent.remove(e),
e._act = 0
}, un = function(e, t) {
if (e && (!t || t._end > e._dur || t._start < 0))
for (var i = e; i; )
i._dirty = 1,
i = i.parent;
return e
}, hn = function(e) {
for (var t = e.parent; t && t.parent; )
t._dirty = 1,
t.totalDuration(),
t = t.parent;
return e
}, dn = function(e, t, i, r) {
return e._startAt && (Fi ? e._startAt.revert(Dr) : e.vars.immediateRender && !e.vars.autoRevert || e._startAt.render(t, !0, r))
}, pn = function e(t) {
return !t || t._ts && e(t.parent)
}, fn = function(e) {
return e._repeat ? mn(e._tTime, e = e.duration() + e._rDelay) * e : 0
}, mn = function(e, t) {
var i = Math.floor(e /= t);
return e && i === e ? i - 1 : i
}, _n = function(e, t) {
return (e - t._start) * t._ts + (t._ts >= 0 ? 0 : t._dirty ? t.totalDuration() : t._tDur)
}, gn = function(e) {
return e._end = Xr(e._start + (e._tDur / Math.abs(e._ts || e._rts || tr) || 0))
}, yn = function(e, t) {
var i = e._dp;
return i && i.smoothChildTiming && e._ts && (e._start = Xr(i._time - (e._ts > 0 ? t / e._ts : ((e._dirty ? e.totalDuration() : e._tDur) - t) / -e._ts)),
gn(e),
i._dirty || un(i, e)),
e
}, xn = function(e, t) {
var i;
if ((t._time || t._initted && !t._dur) && (i = _n(e.rawTime(), t),
(!t._dur || kn(0, t.totalDuration(), i) - t._tTime > tr) && t.render(i, !0)),
un(e, t)._dp && e._initted && e._time >= e._dur && e._ts) {
if (e._dur < e.duration())
for (i = e; i._dp; )
i.rawTime() >= 0 && i.totalTime(i._tTime),
i = i._dp;
e._zTime = -1e-8
}
}, vn = function(e, t, i, r) {
return t.parent && cn(t),
t._start = Xr((ur(i) ? i : i || e !== Vi ? An(e, i, t) : e._time) + t._delay),
t._end = Xr(t._start + (t.totalDuration() / Math.abs(t.timeScale()) || 0)),
an(e, t, "_first", "_last", e._sort ? "_start" : 0),
En(t) || (e._recent = t),
r || xn(e, t),
e._ts < 0 && yn(e, e._tTime),
e
}, bn = function(e, t) {
return (Sr.ScrollTrigger || Ar("scrollTrigger", t)) && Sr.ScrollTrigger.create(t, e)
}, wn = function(e, t, i, r, n) {
return Mo(e, t, n),
e._initted ? !i && e._pt && !Fi && (e._dur && !1 !== e.vars.lazy || !e._dur && e.vars.lazy) && qi !== oo.frame ? (Or.push(e),
e._lazy = [n, r],
1) : void 0 : 1
}, Tn = function e(t) {
var i = t.parent;
return i && i._ts && i._initted && !i._lock && (i.rawTime() < 0 || e(i))
}, En = function(e) {
var t = e.data;
return "isFromStart" === t || "isStart" === t
}, Sn = function(e, t, i, r) {
var n = e._repeat
, o = Xr(t) || 0
, s = e._tTime / e._tDur;
return s && !r && (e._time *= o / e._dur),
e._dur = o,
e._tDur = n ? n < 0 ? 1e10 : Xr(o * (n + 1) + e._rDelay * n) : o,
s > 0 && !r && yn(e, e._tTime = e._tDur * s),
e.parent && gn(e),
i || un(e.parent, e),
e
}, Cn = function(e) {
return e instanceof bo ? un(e) : Sn(e, e._dur)
}, Mn = {
_start: 0,
endTime: kr,
totalDuration: kr
}, An = function e(t, i, r) {
var n, o, s, a = t.labels, l = t._recent || Mn, c = t.duration() >= er ? l.endTime(!1) : t._dur;
return lr(i) && (isNaN(i) || i in a) ? (o = i.charAt(0),
s = "%" === i.substr(-1),
n = i.indexOf("="),
"<" === o || ">" === o ? (n >= 0 && (i = i.replace(/=/, "")),
("<" === o ? l._start : l.endTime(l._repeat >= 0)) + (parseFloat(i.substr(1)) || 0) * (s ? (n < 0 ? l : r).totalDuration() / 100 : 1)) : n < 0 ? (i in a || (a[i] = c),
a[i]) : (o = parseFloat(i.charAt(n - 1) + i.substr(n + 1)),
s && r && (o = o / 100 * (gr(r) ? r[0] : r).totalDuration()),
n > 1 ? e(t, i.substr(0, n - 1), r) + o : c + o)) : null == i ? c : +i
}, In = function(e, t, i) {
var r, n, o = ur(t[1]), s = (o ? 2 : 1) + (e < 2 ? 0 : 1), a = t[s];
if (o && (a.duration = t[1]),
a.parent = i,
e) {
for (r = a,
n = i; n && !("immediateRender"in r); )
r = n.vars.defaults || {},
n = pr(n.vars.inherit) && n.parent;
a.immediateRender = pr(r.immediateRender),
e < 2 ? a.runBackwards = 1 : a.startAt = t[s - 1]
}
return new Po(t[0],a,t[s + 1])
}, zn = function(e, t) {
return e || 0 === e ? t(e) : t
}, kn = function(e, t, i) {
return i < e ? e : i > t ? t : i
}, Pn = function(e, t) {
return lr(e) && (t = Er.exec(e)) ? t[1] : ""
}, Dn = [].slice, Ln = function(e, t) {
return e && dr(e) && "length"in e && (!t && !e.length || e.length - 1 in e && dr(e[0])) && !e.nodeType && e !== ji
}, Bn = function(e, t, i) {
return void 0 === i && (i = []),
e.forEach((function(e) {
var r;
return lr(e) && !t || Ln(e, 1) ? (r = i).push.apply(r, On(e)) : i.push(e)
}
)) || i
}, On = function(e, t, i) {
return Ui && !t && Ui.selector ? Ui.selector(e) : !lr(e) || i || !Ni && so() ? gr(e) ? Bn(e, i) : Ln(e) ? Dn.call(e, 0) : e ? [e] : [] : Dn.call((t || Gi).querySelectorAll(e), 0)
}, Rn = function(e) {
return e = On(e)[0] || Ir("Invalid scope") || {},
function(t) {
var i = e.current || e.nativeElement || e;
return On(t, i.querySelectorAll ? i : i === e ? Ir("Invalid scope") || Gi.createElement("div") : e)
}
}, Fn = function(e) {
return e.sort((function() {
return .5 - Math.random()
}
))
}, Un = function(e) {
if (cr(e))
return e;
var t = dr(e) ? e : {
each: e
}
, i = fo(t.ease)
, r = t.from || 0
, n = parseFloat(t.base) || 0
, o = {}
, s = r > 0 && r < 1
, a = isNaN(r) || s
, l = t.axis
, c = r
, u = r;
return lr(r) ? c = u = {
center: .5,
edges: .5,
end: 1
}[r] || 0 : !s && a && (c = r[0],
u = r[1]),
function(e, s, h) {
var d, p, f, m, _, g, y, x, v, b = (h || t).length, w = o[b];
if (!w) {
if (!(v = "auto" === t.grid ? 0 : (t.grid || [1, er])[1])) {
for (y = -er; y < (y = h[v++].getBoundingClientRect().left) && v < b; )
;
v--
}
for (w = o[b] = [],
d = a ? Math.min(v, b) * c - .5 : r % v,
p = v === er ? 0 : a ? b * u / v - .5 : r / v | 0,
y = 0,
x = er,
g = 0; g < b; g++)
f = g % v - d,
m = p - (g / v | 0),
w[g] = _ = l ? Math.abs("y" === l ? m : f) : or(f * f + m * m),
_ > y && (y = _),
_ < x && (x = _);
"random" === r && Fn(w),
w.max = y - x,
w.min = x,
w.v = b = (parseFloat(t.amount) || parseFloat(t.each) * (v > b ? b - 1 : l ? "y" === l ? b / v : v : Math.max(v, b / v)) || 0) * ("edges" === r ? -1 : 1),
w.b = b < 0 ? n - b : n,
w.u = Pn(t.amount || t.each) || 0,
i = i && b < 0 ? ho(i) : i
}
return b = (w[e] - w.min) / w.max || 0,
Xr(w.b + (i ? i(b) : b) * w.v) + w.u
}
}, Vn = function(e) {
var t = Math.pow(10, ((e + "").split(".")[1] || "").length);
return function(i) {
var r = Xr(Math.round(parseFloat(i) / e) * e * t);
return (r - r % 1) / t + (ur(i) ? 0 : Pn(i))
}
}, jn = function(e, t) {
var i, r, n = gr(e);
return !n && dr(e) && (i = n = e.radius || er,
e.values ? (e = On(e.values),
(r = !ur(e[0])) && (i *= i)) : e = Vn(e.increment)),
zn(t, n ? cr(e) ? function(t) {
return r = e(t),
Math.abs(r - t) <= i ? r : t
}
: function(t) {
for (var n, o, s = parseFloat(r ? t.x : t), a = parseFloat(r ? t.y : 0), l = er, c = 0, u = e.length; u--; )
(n = r ? (n = e[u].x - s) * n + (o = e[u].y - a) * o : Math.abs(e[u] - s)) < l && (l = n,
c = u);
return c = !i || l <= i ? e[c] : t,
r || c === t || ur(t) ? c : c + Pn(t)
}
: Vn(e))
}, Nn = function(e, t, i, r) {
return zn(gr(e) ? !t : !0 === i ? !!(i = 0) : !r, (function() {
return gr(e) ? e[~~(Math.random() * e.length)] : (i = i || 1e-5) && (r = i < 1 ? Math.pow(10, (i + "").length - 2) : 1) && Math.floor(Math.round((e - i / 2 + Math.random() * (t - e + .99 * i)) / i) * i * r) / r
}
))
}, Gn = function(e, t, i) {
return zn(i, (function(i) {
return e[~~t(i)]
}
))
}, $n = function(e) {
for (var t, i, r, n, o = 0, s = ""; ~(t = e.indexOf("random(", o)); )
r = e.indexOf(")", t),
n = "[" === e.charAt(t + 7),
i = e.substr(t + 7, r - t - 7).match(n ? Tr : yr),
s += e.substr(o, t - o) + Nn(n ? i : +i[0], n ? 0 : +i[1], +i[2] || 1e-5),
o = r + 1;
return s + e.substr(o, e.length - o)
}, qn = function(e, t, i, r, n) {
var o = t - e
, s = r - i;
return zn(n, (function(t) {
return i + ((t - e) / o * s || 0)
}
))
}, Zn = function(e, t, i) {
var r, n, o, s = e.labels, a = er;
for (r in s)
(n = s[r] - t) < 0 == !!i && n && a > (n = Math.abs(n)) && (o = r,
a = n);
return o
}, Wn = function(e, t, i) {
var r, n, o, s = e.vars, a = s[t], l = Ui, c = e._ctx;
if (a)
return r = s[t + "Params"],
n = s.callbackScope || e,
i && Or.length && Kr(),
c && (Ui = c),
o = r ? a.apply(n, r) : a.call(n),
Ui = l,
o
}, Xn = function(e) {
return cn(e),
e.scrollTrigger && e.scrollTrigger.kill(!!Fi),
e.progress() < 1 && Wn(e, "onInterrupt"),
e
}, Hn = function(e) {
var t = (e = !e.name && e.default || e).name
, i = cr(e)
, r = t && !i && e.init ? function() {
this._props = []
}
: e
, n = {
init: kr,
render: jo,
add: So,
kill: Go,
modifier: No,
rawVars: 0
}
, o = {
targetTest: 0,
get: 0,
getSetter: Ro,
aliases: {},
register: 0
};
if (so(),
e !== r) {
if (Fr[t])
return;
tn(r, tn(on(e, n), o)),
rn(r.prototype, rn(n, on(e, o))),
Fr[r.prop = t] = r,
e.targetTest && (jr.push(r),
Br[t] = 1),
t = ("css" === t ? "CSS" : t.charAt(0).toUpperCase() + t.substr(1)) + "Plugin"
}
zr(t, r),
e.register && e.register(ns, r, Zo)
}, Yn = 255, Kn = {
aqua: [0, Yn, Yn],
lime: [0, Yn, 0],
silver: [192, 192, 192],
black: [0, 0, 0],
maroon: [128, 0, 0],
teal: [0, 128, 128],
blue: [0, 0, Yn],
navy: [0, 0, 128],
white: [Yn, Yn, Yn],
olive: [128, 128, 0],
yellow: [Yn, Yn, 0],
orange: [Yn, 165, 0],
gray: [128, 128, 128],
purple: [128, 0, 128],
green: [0, 128, 0],
red: [Yn, 0, 0],
pink: [Yn, 192, 203],
cyan: [0, Yn, Yn],
transparent: [Yn, Yn, Yn, 0]
}, Jn = function(e, t, i) {
return (6 * (e += e < 0 ? 1 : e > 1 ? -1 : 0) < 1 ? t + (i - t) * e * 6 : e < .5 ? i : 3 * e < 2 ? t + (i - t) * (2 / 3 - e) * 6 : t) * Yn + .5 | 0
}, Qn = function(e, t, i) {
var r, n, o, s, a, l, c, u, h, d, p = e ? ur(e) ? [e >> 16, e >> 8 & Yn, e & Yn] : 0 : Kn.black;
if (!p) {
if ("," === e.substr(-1) && (e = e.substr(0, e.length - 1)),
Kn[e])
p = Kn[e];
else if ("#" === e.charAt(0)) {
if (e.length < 6 && (r = e.charAt(1),
n = e.charAt(2),
o = e.charAt(3),
e = "#" + r + r + n + n + o + o + (5 === e.length ? e.charAt(4) + e.charAt(4) : "")),
9 === e.length)
return [(p = parseInt(e.substr(1, 6), 16)) >> 16, p >> 8 & Yn, p & Yn, parseInt(e.substr(7), 16) / 255];
p = [(e = parseInt(e.substr(1), 16)) >> 16, e >> 8 & Yn, e & Yn]
} else if ("hsl" === e.substr(0, 3))
if (p = d = e.match(yr),
t) {
if (~e.indexOf("="))
return p = e.match(xr),
i && p.length < 4 && (p[3] = 1),
p
} else
s = +p[0] % 360 / 360,
a = +p[1] / 100,
r = 2 * (l = +p[2] / 100) - (n = l <= .5 ? l * (a + 1) : l + a - l * a),
p.length > 3 && (p[3] *= 1),
p[0] = Jn(s + 1 / 3, r, n),
p[1] = Jn(s, r, n),
p[2] = Jn(s - 1 / 3, r, n);
else
p = e.match(yr) || Kn.transparent;
p = p.map(Number)
}
return t && !d && (r = p[0] / Yn,
n = p[1] / Yn,
o = p[2] / Yn,
l = ((c = Math.max(r, n, o)) + (u = Math.min(r, n, o))) / 2,
c === u ? s = a = 0 : (h = c - u,
a = l > .5 ? h / (2 - c - u) : h / (c + u),
s = c === r ? (n - o) / h + (n < o ? 6 : 0) : c === n ? (o - r) / h + 2 : (r - n) / h + 4,
s *= 60),
p[0] = ~~(s + .5),
p[1] = ~~(100 * a + .5),
p[2] = ~~(100 * l + .5)),
i && p.length < 4 && (p[3] = 1),
p
}, eo = function(e) {
var t = []
, i = []
, r = -1;
return e.split(io).forEach((function(e) {
var n = e.match(vr) || [];
t.push.apply(t, n),
i.push(r += n.length + 1)
}
)),
t.c = i,
t
}, to = function(e, t, i) {
var r, n, o, s, a = "", l = (e + a).match(io), c = t ? "hsla(" : "rgba(", u = 0;
if (!l)
return e;
if (l = l.map((function(e) {
return (e = Qn(e, t, 1)) && c + (t ? e[0] + "," + e[1] + "%," + e[2] + "%," + e[3] : e.join(",")) + ")"
}
)),
i && (o = eo(e),
(r = i.c).join(a) !== o.c.join(a)))
for (s = (n = e.replace(io, "1").split(vr)).length - 1; u < s; u++)
a += n[u] + (~r.indexOf(u) ? l.shift() || c + "0,0,0,0)" : (o.length ? o : l.length ? l : i).shift());
if (!n)
for (s = (n = e.split(io)).length - 1; u < s; u++)
a += n[u] + l[u];
return a + n[s]
}, io = function() {
var e, t = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";
for (e in Kn)
t += "|" + e + "\\b";
return new RegExp(t + ")","gi")
}(), ro = /hsl[a]?\(/, no = function(e) {
var t, i = e.join(" ");
if (io.lastIndex = 0,
io.test(i))
return t = ro.test(i),
e[1] = to(e[1], t),
e[0] = to(e[0], t, eo(e[1])),
!0
}, oo = function() {
var e, t, i, r, n, o, s = Date.now, a = 500, l = 33, c = s(), u = c, h = 1e3 / 240, d = h, p = [], f = function i(f) {
var m, _, g, y, x = s() - u, v = !0 === f;
if (x > a && (c += x - l),
((m = (g = (u += x) - c) - d) > 0 || v) && (y = ++r.frame,
n = g - 1e3 * r.time,
r.time = g /= 1e3,
d += m + (m >= h ? 4 : h - m),
_ = 1),
v || (e = t(i)),
_)
for (o = 0; o < p.length; o++)
p[o](g, n, y, f)
};
return r = {
time: 0,
frame: 0,
tick: function() {
f(!0)
},
deltaRatio: function(e) {
return n / (1e3 / (e || 60))
},
wake: function() {
$i && (!Ni && fr() && (ji = Ni = window,
Gi = ji.document || {},
Sr.gsap = ns,
(ji.gsapVersions || (ji.gsapVersions = [])).push(ns.version),
Mr(Cr || ji.GreenSockGlobals || !ji.gsap && ji || {}),
i = ji.requestAnimationFrame),
e && r.sleep(),
t = i || function(e) {
return setTimeout(e, d - 1e3 * r.time + 1 | 0)
}
,
Wi = 1,
f(2))
},
sleep: function() {
(i ? ji.cancelAnimationFrame : clearTimeout)(e),
Wi = 0,
t = kr
},
lagSmoothing: function(e, t) {
a = e || 1e8,
l = Math.min(t, a, 0)
},
fps: function(e) {
h = 1e3 / (e || 240),
d = 1e3 * r.time + h
},
add: function(e, t, i) {
var n = t ? function(t, i, o, s) {
e(t, i, o, s),
r.remove(n)
}
: e;
return r.remove(e),
p[i ? "unshift" : "push"](n),
so(),
n
},
remove: function(e, t) {
~(t = p.indexOf(e)) && p.splice(t, 1) && o >= t && o--
},
_listeners: p
},
r
}(), so = function() {
return !Wi && oo.wake()
}, ao = {}, lo = /^[\d.\-M][\d.\-,\s]/, co = /["']/g, uo = function(e) {
for (var t, i, r, n = {}, o = e.substr(1, e.length - 3).split(":"), s = o[0], a = 1, l = o.length; a < l; a++)
i = o[a],
t = a !== l - 1 ? i.lastIndexOf(",") : i.length,
r = i.substr(0, t),
n[s] = isNaN(r) ? r.replace(co, "").trim() : +r,
s = i.substr(t + 1).trim();
return n
}, ho = function(e) {
return function(t) {
return 1 - e(1 - t)
}
}, po = function e(t, i) {
for (var r, n = t._first; n; )
n instanceof bo ? e(n, i) : !n.vars.yoyoEase || n._yoyo && n._repeat || n._yoyo === i || (n.timeline ? e(n.timeline, i) : (r = n._ease,
n._ease = n._yEase,
n._yEase = r,
n._yoyo = i)),
n = n._next
}, fo = function(e, t) {
return e && (cr(e) ? e : ao[e] || function(e) {
var t = (e + "").split("(")
, i = ao[t[0]];
return i && t.length > 1 && i.config ? i.config.apply(null, ~e.indexOf("{") ? [uo(t[1])] : function(e) {
var t = e.indexOf("(") + 1
, i = e.indexOf(")")
, r = e.indexOf("(", t);
return e.substring(t, ~r && r < i ? e.indexOf(")", i + 1) : i)
}(e).split(",").map(Qr)) : ao._CE && lo.test(e) ? ao._CE("", e) : i
}(e)) || t
}, mo = function(e, t, i, r) {
void 0 === i && (i = function(e) {
return 1 - t(1 - e)
}
),
void 0 === r && (r = function(e) {
return e < .5 ? t(2 * e) / 2 : 1 - t(2 * (1 - e)) / 2
}
);
var n, o = {
easeIn: t,
easeOut: i,
easeInOut: r
};
return Zr(e, (function(e) {
for (var t in ao[e] = Sr[e] = o,
ao[n = e.toLowerCase()] = i,
o)
ao[n + ("easeIn" === t ? ".in" : "easeOut" === t ? ".out" : ".inOut")] = ao[e + "." + t] = o[t]
}
)),
o
}, _o = function(e) {
return function(t) {
return t < .5 ? (1 - e(1 - 2 * t)) / 2 : .5 + e(2 * (t - .5)) / 2
}
}, go = function e(t, i, r) {
var n = i >= 1 ? i : 1
, o = (r || (t ? .3 : .45)) / (i < 1 ? i : 1)
, s = o / ir * (Math.asin(1 / n) || 0)
, a = function(e) {
return 1 === e ? 1 : n * Math.pow(2, -10 * e) * ar((e - s) * o) + 1
}
, l = "out" === t ? a : "in" === t ? function(e) {
return 1 - a(1 - e)
}
: _o(a);
return o = ir / o,
l.config = function(i, r) {
return e(t, i, r)
}
,
l
}, yo = function e(t, i) {
void 0 === i && (i = 1.70158);
var r = function(e) {
return e ? --e * e * ((i + 1) * e + i) + 1 : 0
}
, n = "out" === t ? r : "in" === t ? function(e) {
return 1 - r(1 - e)
}
: _o(r);
return n.config = function(i) {
return e(t, i)
}
,
n
};
Zr("Linear,Quad,Cubic,Quart,Quint,Strong", (function(e, t) {
var i = t < 5 ? t + 1 : t;
mo(e + ",Power" + (i - 1), t ? function(e) {
return Math.pow(e, i)
}
: function(e) {
return e
}
, (function(e) {
return 1 - Math.pow(1 - e, i)
}
), (function(e) {
return e < .5 ? Math.pow(2 * e, i) / 2 : 1 - Math.pow(2 * (1 - e), i) / 2
}
))
}
)),
ao.Linear.easeNone = ao.none = ao.Linear.easeIn,
mo("Elastic", go("in"), go("out"), go()),
Xi = 7.5625,
Yi = 1 / (Hi = 2.75),
mo("Bounce", (function(e) {
return 1 - Ki(1 - e)
}
), Ki = function(e) {
return e < Yi ? Xi * e * e : e < .7272727272727273 ? Xi * Math.pow(e - 1.5 / Hi, 2) + .75 : e < .9090909090909092 ? Xi * (e -= 2.25 / Hi) * e + .9375 : Xi * Math.pow(e - 2.625 / Hi, 2) + .984375
}
),
mo("Expo", (function(e) {
return e ? Math.pow(2, 10 * (e - 1)) : 0
}
)),
mo("Circ", (function(e) {
return -(or(1 - e * e) - 1)
}
)),
mo("Sine", (function(e) {
return 1 === e ? 1 : 1 - sr(e * rr)
}
)),
mo("Back", yo("in"), yo("out"), yo()),
ao.SteppedEase = ao.steps = Sr.SteppedEase = {
config: function(e, t) {
void 0 === e && (e = 1);
var i = 1 / e
, r = e + (t ? 0 : 1)
, n = t ? 1 : 0;
return function(e) {
return ((r * kn(0, .99999999, e) | 0) + n) * i
}
}
},
Qi.ease = ao["quad.out"],
Zr("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", (function(e) {
return Nr += e + "," + e + "Params,"
}
));
var xo = function(e, t) {
this.id = nr++,
e._gsap = this,
this.target = e,
this.harness = t,
this.get = t ? t.get : qr,
this.set = t ? t.getSetter : Ro
}
, vo = function() {
function e(e) {
this.vars = e,
this._delay = +e.delay || 0,
(this._repeat = e.repeat === 1 / 0 ? -2 : e.repeat || 0) && (this._rDelay = e.repeatDelay || 0,
this._yoyo = !!e.yoyo || !!e.yoyoEase),
this._ts = 1,
Sn(this, +e.duration, 1, 1),
this.data = e.data,
Ui && (this._ctx = Ui,
Ui.data.push(this)),
Wi || oo.wake()
}
var t = e.prototype;
return t.delay = function(e) {
return e || 0 === e ? (this.parent && this.parent.smoothChildTiming && this.startTime(this._start + e - this._delay),
this._delay = e,
this) : this._delay
}
,
t.duration = function(e) {
return arguments.length ? this.totalDuration(this._repeat > 0 ? e + (e + this._rDelay) * this._repeat : e) : this.totalDuration() && this._dur
}
,
t.totalDuration = function(e) {
return arguments.length ? (this._dirty = 0,
Sn(this, this._repeat < 0 ? e : (e - this._repeat * this._rDelay) / (this._repeat + 1))) : this._tDur
}
,
t.totalTime = function(e, t) {
if (so(),
!arguments.length)
return this._tTime;
var i = this._dp;
if (i && i.smoothChildTiming && this._ts) {
for (yn(this, e),
!i._dp || i.parent || xn(i, this); i && i.parent; )
i.parent._time !== i._start + (i._ts >= 0 ? i._tTime / i._ts : (i.totalDuration() - i._tTime) / -i._ts) && i.totalTime(i._tTime, !0),
i = i.parent;
!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && e < this._tDur || this._ts < 0 && e > 0 || !this._tDur && !e) && vn(this._dp, this, this._start - this._delay)
}
return (this._tTime !== e || !this._dur && !t || this._initted && Math.abs(this._zTime) === tr || !e && !this._initted && (this.add || this._ptLookup)) && (this._ts || (this._pTime = e),
Jr(this, e, t)),
this
}
,
t.time = function(e, t) {
return arguments.length ? this.totalTime(Math.min(this.totalDuration(), e + fn(this)) % (this._dur + this._rDelay) || (e ? this._dur : 0), t) : this._time
}
,
t.totalProgress = function(e, t) {
return arguments.length ? this.totalTime(this.totalDuration() * e, t) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio
}
,
t.progress = function(e, t) {
return arguments.length ? this.totalTime(this.duration() * (!this._yoyo || 1 & this.iteration() ? e : 1 - e) + fn(this), t) : this.duration() ? Math.min(1, this._time / this._dur) : this.ratio
}
,
t.iteration = function(e, t) {
var i = this.duration() + this._rDelay;
return arguments.length ? this.totalTime(this._time + (e - 1) * i, t) : this._repeat ? mn(this._tTime, i) + 1 : 1
}
,
t.timeScale = function(e) {
if (!arguments.length)
return -1e-8 === this._rts ? 0 : this._rts;
if (this._rts === e)
return this;
var t = this.parent && this._ts ? _n(this.parent._time, this) : this._tTime;
return this._rts = +e || 0,
this._ts = this._ps || -1e-8 === e ? 0 : this._rts,
this.totalTime(kn(-this._delay, this._tDur, t), !0),
gn(this),
hn(this)
}
,
t.paused = function(e) {
return arguments.length ? (this._ps !== e && (this._ps = e,
e ? (this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()),
this._ts = this._act = 0) : (so(),
this._ts = this._rts,
this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, 1 === this.progress() && Math.abs(this._zTime) !== tr && (this._tTime -= tr)))),
this) : this._ps
}
,
t.startTime = function(e) {
if (arguments.length) {
this._start = e;
var t = this.parent || this._dp;
return t && (t._sort || !this.parent) && vn(t, this, e - this._delay),
this
}
return this._start
}
,
t.endTime = function(e) {
return this._start + (pr(e) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1)
}
,
t.rawTime = function(e) {
var t = this.parent || this._dp;
return t ? e && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : this._ts ? _n(t.rawTime(e), this) : this._tTime : this._tTime
}
,
t.revert = function(e) {
void 0 === e && (e = Lr);
var t = Fi;
return Fi = e,
(this._initted || this._startAt) && (this.timeline && this.timeline.revert(e),
this.totalTime(-.01, e.suppressEvents)),
"nested" !== this.data && !1 !== e.kill && this.kill(),
Fi = t,
this
}
,
t.globalTime = function(e) {
for (var t = this, i = arguments.length ? e : t.rawTime(); t; )
i = t._start + i / (t._ts || 1),
t = t._dp;
return !this.parent && this.vars.immediateRender ? -1 : i
}
,
t.repeat = function(e) {
return arguments.length ? (this._repeat = e === 1 / 0 ? -2 : e,
Cn(this)) : -2 === this._repeat ? 1 / 0 : this._repeat
}
,
t.repeatDelay = function(e) {
if (arguments.length) {
var t = this._time;
return this._rDelay = e,
Cn(this),
t ? this.time(t) : this
}
return this._rDelay
}
,
t.yoyo = function(e) {
return arguments.length ? (this._yoyo = e,
this) : this._yoyo
}
,
t.seek = function(e, t) {
return this.totalTime(An(this, e), pr(t))
}
,
t.restart = function(e, t) {
return this.play().totalTime(e ? -this._delay : 0, pr(t))
}
,
t.play = function(e, t) {
return null != e && this.seek(e, t),
this.reversed(!1).paused(!1)
}
,
t.reverse = function(e, t) {
return null != e && this.seek(e || this.totalDuration(), t),
this.reversed(!0).paused(!1)
}
,
t.pause = function(e, t) {
return null != e && this.seek(e, t),
this.paused(!0)
}
,
t.resume = function() {
return this.paused(!1)
}
,
t.reversed = function(e) {
return arguments.length ? (!!e !== this.reversed() && this.timeScale(-this._rts || (e ? -1e-8 : 0)),
this) : this._rts < 0
}
,
t.invalidate = function() {
return this._initted = this._act = 0,
this._zTime = -1e-8,
this
}
,
t.isActive = function() {
var e, t = this.parent || this._dp, i = this._start;
return !(t && !(this._ts && this._initted && t.isActive() && (e = t.rawTime(!0)) >= i && e < this.endTime(!0) - tr))
}
,
t.eventCallback = function(e, t, i) {
var r = this.vars;
return arguments.length > 1 ? (t ? (r[e] = t,
i && (r[e + "Params"] = i),
"onUpdate" === e && (this._onUpdate = t)) : delete r[e],
this) : r[e]
}
,
t.then = function(e) {
var t = this;
return new Promise((function(i) {
var r = cr(e) ? e : en
, n = function() {
var e = t.then;
t.then = null,
cr(r) && (r = r(t)) && (r.then || r === t) && (t.then = e),
i(r),
t.then = e
};
t._initted && 1 === t.totalProgress() && t._ts >= 0 || !t._tTime && t._ts < 0 ? n() : t._prom = n
}
))
}
,
t.kill = function() {
Xn(this)
}
,
e
}();
tn(vo.prototype, {
_time: 0,
_start: 0,
_end: 0,
_tTime: 0,
_tDur: 0,
_dirty: 0,
_repeat: 0,
_yoyo: !1,
parent: null,
_initted: !1,
_rDelay: 0,
_ts: 1,
_dp: 0,
ratio: 0,
_zTime: -1e-8,
_prom: 0,
_ps: !1,
_rts: 1
});
var bo = function(e) {
function t(t, i) {
var r;
return void 0 === t && (t = {}),
(r = e.call(this, t) || this).labels = {},
r.smoothChildTiming = !!t.smoothChildTiming,
r.autoRemoveChildren = !!t.autoRemoveChildren,
r._sort = pr(t.sortChildren),
Vi && vn(t.parent || Vi, Bi(r), i),
t.reversed && r.reverse(),
t.paused && r.paused(!0),
t.scrollTrigger && bn(Bi(r), t.scrollTrigger),
r
}
Oi(t, e);
var i = t.prototype;
return i.to = function(e, t, i) {
return In(0, arguments, this),
this
}
,
i.from = function(e, t, i) {
return In(1, arguments, this),
this
}
,
i.fromTo = function(e, t, i, r) {
return In(2, arguments, this),
this
}
,
i.set = function(e, t, i) {
return t.duration = 0,
t.parent = this,
sn(t).repeatDelay || (t.repeat = 0),
t.immediateRender = !!t.immediateRender,
new Po(e,t,An(this, i),1),
this
}
,
i.call = function(e, t, i) {
return vn(this, Po.delayedCall(0, e, t), i)
}
,
i.staggerTo = function(e, t, i, r, n, o, s) {
return i.duration = t,
i.stagger = i.stagger || r,
i.onComplete = o,
i.onCompleteParams = s,
i.parent = this,
new Po(e,i,An(this, n)),
this
}
,
i.staggerFrom = function(e, t, i, r, n, o, s) {
return i.runBackwards = 1,
sn(i).immediateRender = pr(i.immediateRender),
this.staggerTo(e, t, i, r, n, o, s)
}
,
i.staggerFromTo = function(e, t, i, r, n, o, s, a) {
return r.startAt = i,
sn(r).immediateRender = pr(r.immediateRender),
this.staggerTo(e, t, r, n, o, s, a)
}
,
i.render = function(e, t, i) {
var r, n, o, s, a, l, c, u, h, d, p, f, m = this._time, _ = this._dirty ? this.totalDuration() : this._tDur, g = this._dur, y = e <= 0 ? 0 : Xr(e), x = this._zTime < 0 != e < 0 && (this._initted || !g);
if (this !== Vi && y > _ && e >= 0 && (y = _),
y !== this._tTime || i || x) {
if (m !== this._time && g && (y += this._time - m,
e += this._time - m),
r = y,
h = this._start,
l = !(u = this._ts),
x && (g || (m = this._zTime),
(e || !t) && (this._zTime = e)),
this._repeat) {
if (p = this._yoyo,
a = g + this._rDelay,
this._repeat < -1 && e < 0)
return this.totalTime(100 * a + e, t, i);
if (r = Xr(y % a),
y === _ ? (s = this._repeat,
r = g) : ((s = ~~(y / a)) && s === y / a && (r = g,
s--),
r > g && (r = g)),
d = mn(this._tTime, a),
!m && this._tTime && d !== s && (d = s),
p && 1 & s && (r = g - r,
f = 1),
s !== d && !this._lock) {
var v = p && 1 & d
, b = v === (p && 1 & s);
if (s < d && (v = !v),
m = v ? 0 : g,
this._lock = 1,
this.render(m || (f ? 0 : Xr(s * a)), t, !g)._lock = 0,
this._tTime = y,
!t && this.parent && Wn(this, "onRepeat"),
this.vars.repeatRefresh && !f && (this.invalidate()._lock = 1),
m && m !== this._time || l !== !this._ts || this.vars.onRepeat && !this.parent && !this._act)
return this;
if (g = this._dur,
_ = this._tDur,
b && (this._lock = 2,
m = v ? g : -1e-4,
this.render(m, !0),
this.vars.repeatRefresh && !f && this.invalidate()),
this._lock = 0,
!this._ts && !l)
return this;
po(this, f)
}
}
if (this._hasPause && !this._forcing && this._lock < 2 && (c = function(e, t, i) {
var r;
if (i > t)
for (r = e._first; r && r._start <= i; ) {
if ("isPause" === r.data && r._start > t)
return r;
r = r._next
}
else
for (r = e._last; r && r._start >= i; ) {
if ("isPause" === r.data && r._start < t)
return r;
r = r._prev
}
}(this, Xr(m), Xr(r)),
c && (y -= r - (r = c._start))),
this._tTime = y,
this._time = r,
this._act = !u,
this._initted || (this._onUpdate = this.vars.onUpdate,
this._initted = 1,
this._zTime = e,
m = 0),
!m && r && !t && (Wn(this, "onStart"),
this._tTime !== y))
return this;
if (r >= m && e >= 0)
for (n = this._first; n; ) {
if (o = n._next,
(n._act || r >= n._start) && n._ts && c !== n) {
if (n.parent !== this)
return this.render(e, t, i);
if (n.render(n._ts > 0 ? (r - n._start) * n._ts : (n._dirty ? n.totalDuration() : n._tDur) + (r - n._start) * n._ts, t, i),
r !== this._time || !this._ts && !l) {
c = 0,
o && (y += this._zTime = -1e-8);
break
}
}
n = o
}
else {
n = this._last;
for (var w = e < 0 ? e : r; n; ) {
if (o = n._prev,
(n._act || w <= n._end) && n._ts && c !== n) {
if (n.parent !== this)
return this.render(e, t, i);
if (n.render(n._ts > 0 ? (w - n._start) * n._ts : (n._dirty ? n.totalDuration() : n._tDur) + (w - n._start) * n._ts, t, i || Fi && (n._initted || n._startAt)),
r !== this._time || !this._ts && !l) {
c = 0,
o && (y += this._zTime = w ? -1e-8 : tr);
break
}
}
n = o
}
}
if (c && !t && (this.pause(),
c.render(r >= m ? 0 : -1e-8)._zTime = r >= m ? 1 : -1,
this._ts))
return this._start = h,
gn(this),
this.render(e, t, i);
this._onUpdate && !t && Wn(this, "onUpdate", !0),
(y === _ && this._tTime >= this.totalDuration() || !y && m) && (h !== this._start && Math.abs(u) === Math.abs(this._ts) || this._lock || ((e || !g) && (y === _ && this._ts > 0 || !y && this._ts < 0) && cn(this, 1),
t || e < 0 && !m || !y && !m && _ || (Wn(this, y === _ && e >= 0 ? "onComplete" : "onReverseComplete", !0),
this._prom && !(y < _ && this.timeScale() > 0) && this._prom())))
}
return this
}
,
i.add = function(e, t) {
var i = this;
if (ur(t) || (t = An(this, t, e)),
!(e instanceof vo)) {
if (gr(e))
return e.forEach((function(e) {
return i.add(e, t)
}
)),
this;
if (lr(e))
return this.addLabel(e, t);
if (!cr(e))
return this;
e = Po.delayedCall(0, e)
}
return this !== e ? vn(this, e, t) : this
}
,
i.getChildren = function(e, t, i, r) {
void 0 === e && (e = !0),
void 0 === t && (t = !0),
void 0 === i && (i = !0),
void 0 === r && (r = -er);
for (var n = [], o = this._first; o; )
o._start >= r && (o instanceof Po ? t && n.push(o) : (i && n.push(o),
e && n.push.apply(n, o.getChildren(!0, t, i)))),
o = o._next;
return n
}
,
i.getById = function(e) {
for (var t = this.getChildren(1, 1, 1), i = t.length; i--; )
if (t[i].vars.id === e)
return t[i]
}
,
i.remove = function(e) {
return lr(e) ? this.removeLabel(e) : cr(e) ? this.killTweensOf(e) : (ln(this, e),
e === this._recent && (this._recent = this._last),
un(this))
}
,
i.totalTime = function(t, i) {
return arguments.length ? (this._forcing = 1,
!this._dp && this._ts && (this._start = Xr(oo.time - (this._ts > 0 ? t / this._ts : (this.totalDuration() - t) / -this._ts))),
e.prototype.totalTime.call(this, t, i),
this._forcing = 0,
this) : this._tTime
}
,
i.addLabel = function(e, t) {
return this.labels[e] = An(this, t),
this
}
,
i.removeLabel = function(e) {
return delete this.labels[e],
this
}
,
i.addPause = function(e, t, i) {
var r = Po.delayedCall(0, t || kr, i);
return r.data = "isPause",
this._hasPause = 1,
vn(this, r, An(this, e))
}
,
i.removePause = function(e) {
var t = this._first;
for (e = An(this, e); t; )
t._start === e && "isPause" === t.data && cn(t),
t = t._next
}
,
i.killTweensOf = function(e, t, i) {
for (var r = this.getTweensOf(e, i), n = r.length; n--; )
wo !== r[n] && r[n].kill(e, t);
return this
}
,
i.getTweensOf = function(e, t) {
for (var i, r = [], n = On(e), o = this._first, s = ur(t); o; )
o instanceof Po ? Yr(o._targets, n) && (s ? (!wo || o._initted && o._ts) && o.globalTime(0) <= t && o.globalTime(o.totalDuration()) > t : !t || o.isActive()) && r.push(o) : (i = o.getTweensOf(n, t)).length && r.push.apply(r, i),
o = o._next;
return r
}
,
i.tweenTo = function(e, t) {
t = t || {};
var i, r = this, n = An(r, e), o = t, s = o.startAt, a = o.onStart, l = o.onStartParams, c = o.immediateRender, u = Po.to(r, tn({
ease: t.ease || "none",
lazy: !1,
immediateRender: !1,
time: n,
overwrite: "auto",
duration: t.duration || Math.abs((n - (s && "time"in s ? s.time : r._time)) / r.timeScale()) || tr,
onStart: function() {
if (r.pause(),
!i) {
var e = t.duration || Math.abs((n - (s && "time"in s ? s.time : r._time)) / r.timeScale());
u._dur !== e && Sn(u, e, 0, 1).render(u._time, !0, !0),
i = 1
}
a && a.apply(u, l || [])
}
}, t));
return c ? u.render(0) : u
}
,
i.tweenFromTo = function(e, t, i) {
return this.tweenTo(t, tn({
startAt: {
time: An(this, e)
}
}, i))
}
,
i.recent = function() {
return this._recent
}
,
i.nextLabel = function(e) {
return void 0 === e && (e = this._time),
Zn(this, An(this, e))
}
,
i.previousLabel = function(e) {
return void 0 === e && (e = this._time),
Zn(this, An(this, e), 1)
}
,
i.currentLabel = function(e) {
return arguments.length ? this.seek(e, !0) : this.previousLabel(this._time + tr)
}
,
i.shiftChildren = function(e, t, i) {
void 0 === i && (i = 0);
for (var r, n = this._first, o = this.labels; n; )
n._start >= i && (n._start += e,
n._end += e),
n = n._next;
if (t)
for (r in o)
o[r] >= i && (o[r] += e);
return un(this)
}
,
i.invalidate = function(t) {
var i = this._first;
for (this._lock = 0; i; )
i.invalidate(t),
i = i._next;
return e.prototype.invalidate.call(this, t)
}
,
i.clear = function(e) {
void 0 === e && (e = !0);
for (var t, i = this._first; i; )
t = i._next,
this.remove(i),
i = t;
return this._dp && (this._time = this._tTime = this._pTime = 0),
e && (this.labels = {}),
un(this)
}
,
i.totalDuration = function(e) {
var t, i, r, n = 0, o = this, s = o._last, a = er;
if (arguments.length)
return o.timeScale((o._repeat < 0 ? o.duration() : o.totalDuration()) / (o.reversed() ? -e : e));
if (o._dirty) {
for (r = o.parent; s; )
t = s._prev,
s._dirty && s.totalDuration(),
(i = s._start) > a && o._sort && s._ts && !o._lock ? (o._lock = 1,
vn(o, s, i - s._delay, 1)._lock = 0) : a = i,
i < 0 && s._ts && (n -= i,
(!r && !o._dp || r && r.smoothChildTiming) && (o._start += i / o._ts,
o._time -= i,
o._tTime -= i),
o.shiftChildren(-i, !1, -Infinity),
a = 0),
s._end > n && s._ts && (n = s._end),
s = t;
Sn(o, o === Vi && o._time > n ? o._time : n, 1, 1),
o._dirty = 0
}
return o._tDur
}
,
t.updateRoot = function(e) {
if (Vi._ts && (Jr(Vi, _n(e, Vi)),
qi = oo.frame),
oo.frame >= Vr) {
Vr += Ji.autoSleep || 120;
var t = Vi._first;
if ((!t || !t._ts) && Ji.autoSleep && oo._listeners.length < 2) {
for (; t && !t._ts; )
t = t._next;
t || oo.sleep()
}
}
}
,
t
}(vo);
tn(bo.prototype, {
_lock: 0,
_hasPause: 0,
_forcing: 0
});
var wo, To, Eo = function(e, t, i, r, n, o, s) {
var a, l, c, u, h, d, p, f, m = new Zo(this._pt,e,t,0,1,Vo,null,n), _ = 0, g = 0;
for (m.b = i,
m.e = r,
i += "",
(p = ~(r += "").indexOf("random(")) && (r = $n(r)),
o && (o(f = [i, r], e, t),
i = f[0],
r = f[1]),
l = i.match(br) || []; a = br.exec(r); )
u = a[0],
h = r.substring(_, a.index),
c ? c = (c + 1) % 5 : "rgba(" === h.substr(-5) && (c = 1),
u !== l[g++] && (d = parseFloat(l[g - 1]) || 0,
m._pt = {
_next: m._pt,
p: h || 1 === g ? h : ",",
s: d,
c: "=" === u.charAt(1) ? Hr(d, u) - d : parseFloat(u) - d,
m: c && c < 4 ? Math.round : 0
},
_ = br.lastIndex);
return m.c = _ < r.length ? r.substring(_, r.length) : "",
m.fp = s,
(wr.test(r) || p) && (m.e = 0),
this._pt = m,
m
}, So = function(e, t, i, r, n, o, s, a, l, c) {
cr(r) && (r = r(n || 0, e, o));
var u, h = e[t], d = "get" !== i ? i : cr(h) ? l ? e[t.indexOf("set") || !cr(e["get" + t.substr(3)]) ? t : "get" + t.substr(3)](l) : e[t]() : h, p = cr(h) ? l ? Bo : Lo : Do;
if (lr(r) && (~r.indexOf("random(") && (r = $n(r)),
"=" === r.charAt(1) && ((u = Hr(d, r) + (Pn(d) || 0)) || 0 === u) && (r = u)),
!c || d !== r || To)
return isNaN(d * r) || "" === r ? (!h && !(t in e) && Ar(t, r),
Eo.call(this, e, t, d, r, p, a || Ji.stringFilter, l)) : (u = new Zo(this._pt,e,t,+d || 0,r - (d || 0),"boolean" == typeof h ? Uo : Fo,0,p),
l && (u.fp = l),
s && u.modifier(s, this, e),
this._pt = u)
}, Co = function(e, t, i, r, n, o) {
var s, a, l, c;
if (Fr[e] && !1 !== (s = new Fr[e]).init(n, s.rawVars ? t[e] : function(e, t, i, r, n) {
if (cr(e) && (e = Io(e, n, t, i, r)),
!dr(e) || e.style && e.nodeType || gr(e) || _r(e))
return lr(e) ? Io(e, n, t, i, r) : e;
var o, s = {};
for (o in e)
s[o] = Io(e[o], n, t, i, r);
return s
}(t[e], r, n, o, i), i, r, o) && (i._pt = a = new Zo(i._pt,n,e,0,1,s.render,s,0,s.priority),
i !== Zi))
for (l = i._ptLookup[i._targets.indexOf(n)],
c = s._props.length; c--; )
l[s._props[c]] = a;
return s
}, Mo = function e(t, i, r) {
var n, o, s, a, l, c, u, h, d, p, f, m, _, g = t.vars, y = g.ease, x = g.startAt, v = g.immediateRender, b = g.lazy, w = g.onUpdate, T = g.onUpdateParams, E = g.callbackScope, S = g.runBackwards, C = g.yoyoEase, M = g.keyframes, A = g.autoRevert, I = t._dur, z = t._startAt, k = t._targets, P = t.parent, D = P && "nested" === P.data ? P.vars.targets : k, L = "auto" === t._overwrite && !Ri, B = t.timeline;
if (B && (!M || !y) && (y = "none"),
t._ease = fo(y, Qi.ease),
t._yEase = C ? ho(fo(!0 === C ? y : C, Qi.ease)) : 0,
C && t._yoyo && !t._repeat && (C = t._yEase,
t._yEase = t._ease,
t._ease = C),
t._from = !B && !!g.runBackwards,
!B || M && !g.stagger) {
if (m = (h = k[0] ? $r(k[0]).harness : 0) && g[h.prop],
n = on(g, Br),
z && (z._zTime < 0 && z.progress(1),
i < 0 && S && v && !A ? z.render(-1, !0) : z.revert(S && I ? Dr : Pr),
z._lazy = 0),
x) {
if (cn(t._startAt = Po.set(k, tn({
data: "isStart",
overwrite: !1,
parent: P,
immediateRender: !0,
lazy: pr(b),
startAt: null,
delay: 0,
onUpdate: w,
onUpdateParams: T,
callbackScope: E,
stagger: 0
}, x))),
t._startAt._dp = 0,
i < 0 && (Fi || !v && !A) && t._startAt.revert(Dr),
v && I && i <= 0 && r <= 0)
return void (i && (t._zTime = i))
} else if (S && I && !z)
if (i && (v = !1),
s = tn({
overwrite: !1,
data: "isFromStart",
lazy: v && pr(b),
immediateRender: v,
stagger: 0,
parent: P
}, n),
m && (s[h.prop] = m),
cn(t._startAt = Po.set(k, s)),
t._startAt._dp = 0,
i < 0 && (Fi ? t._startAt.revert(Dr) : t._startAt.render(-1, !0)),
t._zTime = i,
v) {
if (!i)
return
} else
e(t._startAt, tr, tr);
for (t._pt = t._ptCache = 0,
b = I && pr(b) || b && !I,
o = 0; o < k.length; o++) {
if (u = (l = k[o])._gsap || Gr(k)[o]._gsap,
t._ptLookup[o] = p = {},
Rr[u.id] && Or.length && Kr(),
f = D === k ? o : D.indexOf(l),
h && !1 !== (d = new h).init(l, m || n, t, f, D) && (t._pt = a = new Zo(t._pt,l,d.name,0,1,d.render,d,0,d.priority),
d._props.forEach((function(e) {
p[e] = a
}
)),
d.priority && (c = 1)),
!h || m)
for (s in n)
Fr[s] && (d = Co(s, n, t, f, l, D)) ? d.priority && (c = 1) : p[s] = a = So.call(t, l, s, "get", n[s], f, D, 0, g.stringFilter);
t._op && t._op[o] && t.kill(l, t._op[o]),
L && t._pt && (wo = t,
Vi.killTweensOf(l, p, t.globalTime(i)),
_ = !t.parent,
wo = 0),
t._pt && b && (Rr[u.id] = 1)
}
c && qo(t),
t._onInit && t._onInit(t)
}
t._onUpdate = w,
t._initted = (!t._op || t._pt) && !_,
M && i <= 0 && B.render(er, !0, !0)
}, Ao = function(e, t, i, r) {
var n, o, s = t.ease || r || "power1.inOut";
if (gr(t))
o = i[e] || (i[e] = []),
t.forEach((function(e, i) {
return o.push({
t: i / (t.length - 1) * 100,
v: e,
e: s
})
}
));
else
for (n in t)
o = i[n] || (i[n] = []),
"ease" === n || o.push({
t: parseFloat(e),
v: t[n],
e: s
})
}, Io = function(e, t, i, r, n) {
return cr(e) ? e.call(t, i, r, n) : lr(e) && ~e.indexOf("random(") ? $n(e) : e
}, zo = Nr + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", ko = {};
Zr(zo + ",id,stagger,delay,duration,paused,scrollTrigger", (function(e) {
return ko[e] = 1
}
));
var Po = function(e) {
function t(t, i, r, n) {
var o;
"number" == typeof i && (r.duration = i,
i = r,
r = null);
var s, a, l, c, u, h, d, p, f = (o = e.call(this, n ? i : sn(i)) || this).vars, m = f.duration, _ = f.delay, g = f.immediateRender, y = f.stagger, x = f.overwrite, v = f.keyframes, b = f.defaults, w = f.scrollTrigger, T = f.yoyoEase, E = i.parent || Vi, S = (gr(t) || _r(t) ? ur(t[0]) : "length"in i) ? [t] : On(t);
if (o._targets = S.length ? Gr(S) : Ir("GSAP target " + t + " not found. https://greensock.com", !Ji.nullTargetWarn) || [],
o._ptLookup = [],
o._overwrite = x,
v || y || mr(m) || mr(_)) {
if (i = o.vars,
(s = o.timeline = new bo({
data: "nested",
defaults: b || {},
targets: E && "nested" === E.data ? E.vars.targets : S
})).kill(),
s.parent = s._dp = Bi(o),
s._start = 0,
y || mr(m) || mr(_)) {
if (c = S.length,
d = y && Un(y),
dr(y))
for (u in y)
~zo.indexOf(u) && (p || (p = {}),
p[u] = y[u]);
for (a = 0; a < c; a++)
(l = on(i, ko)).stagger = 0,
T && (l.yoyoEase = T),
p && rn(l, p),
h = S[a],
l.duration = +Io(m, Bi(o), a, h, S),
l.delay = (+Io(_, Bi(o), a, h, S) || 0) - o._delay,
!y && 1 === c && l.delay && (o._delay = _ = l.delay,
o._start += _,
l.delay = 0),
s.to(h, l, d ? d(a, h, S) : 0),
s._ease = ao.none;
s.duration() ? m = _ = 0 : o.timeline = 0
} else if (v) {
sn(tn(s.vars.defaults, {
ease: "none"
})),
s._ease = fo(v.ease || i.ease || "none");
var C, M, A, I = 0;
if (gr(v))
v.forEach((function(e) {
return s.to(S, e, ">")
}
)),
s.duration();
else {
for (u in l = {},
v)
"ease" === u || "easeEach" === u || Ao(u, v[u], l, v.easeEach);
for (u in l)
for (C = l[u].sort((function(e, t) {
return e.t - t.t
}
)),
I = 0,
a = 0; a < C.length; a++)
(A = {
ease: (M = C[a]).e,
duration: (M.t - (a ? C[a - 1].t : 0)) / 100 * m
})[u] = M.v,
s.to(S, A, I),
I += A.duration;
s.duration() < m && s.to({}, {
duration: m - s.duration()
})
}
}
m || o.duration(m = s.duration())
} else
o.timeline = 0;
return !0 !== x || Ri || (wo = Bi(o),
Vi.killTweensOf(S),
wo = 0),
vn(E, Bi(o), r),
i.reversed && o.reverse(),
i.paused && o.paused(!0),
(g || !m && !v && o._start === Xr(E._time) && pr(g) && pn(Bi(o)) && "nested" !== E.data) && (o._tTime = -1e-8,
o.render(Math.max(0, -_) || 0)),
w && bn(Bi(o), w),
o
}
Oi(t, e);
var i = t.prototype;
return i.render = function(e, t, i) {
var r, n, o, s, a, l, c, u, h, d = this._time, p = this._tDur, f = this._dur, m = e < 0, _ = e > p - tr && !m ? p : e < tr ? 0 : e;
if (f) {
if (_ !== this._tTime || !e || i || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== m) {
if (r = _,
u = this.timeline,
this._repeat) {
if (s = f + this._rDelay,
this._repeat < -1 && m)
return this.totalTime(100 * s + e, t, i);
if (r = Xr(_ % s),
_ === p ? (o = this._repeat,
r = f) : ((o = ~~(_ / s)) && o === _ / s && (r = f,
o--),
r > f && (r = f)),
(l = this._yoyo && 1 & o) && (h = this._yEase,
r = f - r),
a = mn(this._tTime, s),
r === d && !i && this._initted)
return this._tTime = _,
this;
o !== a && (u && this._yEase && po(u, l),
!this.vars.repeatRefresh || l || this._lock || (this._lock = i = 1,
this.render(Xr(s * o), !0).invalidate()._lock = 0))
}
if (!this._initted) {
if (wn(this, m ? e : r, i, t, _))
return this._tTime = 0,
this;
if (d !== this._time)
return this;
if (f !== this._dur)
return this.render(e, t, i)
}
if (this._tTime = _,
this._time = r,
!this._act && this._ts && (this._act = 1,
this._lazy = 0),
this.ratio = c = (h || this._ease)(r / f),
this._from && (this.ratio = c = 1 - c),
r && !d && !t && (Wn(this, "onStart"),
this._tTime !== _))
return this;
for (n = this._pt; n; )
n.r(c, n.d),
n = n._next;
u && u.render(e < 0 ? e : !r && l ? -1e-8 : u._dur * u._ease(r / this._dur), t, i) || this._startAt && (this._zTime = e),
this._onUpdate && !t && (m && dn(this, e, 0, i),
Wn(this, "onUpdate")),
this._repeat && o !== a && this.vars.onRepeat && !t && this.parent && Wn(this, "onRepeat"),
_ !== this._tDur && _ || this._tTime !== _ || (m && !this._onUpdate && dn(this, e, 0, !0),
(e || !f) && (_ === this._tDur && this._ts > 0 || !_ && this._ts < 0) && cn(this, 1),
t || m && !d || !(_ || d || l) || (Wn(this, _ === p ? "onComplete" : "onReverseComplete", !0),
this._prom && !(_ < p && this.timeScale() > 0) && this._prom()))
}
} else
!function(e, t, i, r) {
var n, o, s, a = e.ratio, l = t < 0 || !t && (!e._start && Tn(e) && (e._initted || !En(e)) || (e._ts < 0 || e._dp._ts < 0) && !En(e)) ? 0 : 1, c = e._rDelay, u = 0;
if (c && e._repeat && (u = kn(0, e._tDur, t),
o = mn(u, c),
e._yoyo && 1 & o && (l = 1 - l),
o !== mn(e._tTime, c) && (a = 1 - l,
e.vars.repeatRefresh && e._initted && e.invalidate())),
l !== a || Fi || r || e._zTime === tr || !t && e._zTime) {
if (!e._initted && wn(e, t, r, i, u))
return;
for (s = e._zTime,
e._zTime = t || (i ? tr : 0),
i || (i = t && !s),
e.ratio = l,
e._from && (l = 1 - l),
e._time = 0,
e._tTime = u,
n = e._pt; n; )
n.r(l, n.d),
n = n._next;
t < 0 && dn(e, t, 0, !0),
e._onUpdate && !i && Wn(e, "onUpdate"),
u && e._repeat && !i && e.parent && Wn(e, "onRepeat"),
(t >= e._tDur || t < 0) && e.ratio === l && (l && cn(e, 1),
i || Fi || (Wn(e, l ? "onComplete" : "onReverseComplete", !0),
e._prom && e._prom()))
} else
e._zTime || (e._zTime = t)
}(this, e, t, i);
return this
}
,
i.targets = function() {
return this._targets
}
,
i.invalidate = function(t) {
return (!t || !this.vars.runBackwards) && (this._startAt = 0),
this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0,
this._ptLookup = [],
this.timeline && this.timeline.invalidate(t),
e.prototype.invalidate.call(this, t)
}
,
i.resetTo = function(e, t, i, r) {
Wi || oo.wake(),
this._ts || this.play();
var n = Math.min(this._dur, (this._dp._time - this._start) * this._ts);
return this._initted || Mo(this, n),
function(e, t, i, r, n, o, s) {
var a, l, c, u, h = (e._pt && e._ptCache || (e._ptCache = {}))[t];
if (!h)
for (h = e._ptCache[t] = [],
c = e._ptLookup,
u = e._targets.length; u--; ) {
if ((a = c[u][t]) && a.d && a.d._pt)
for (a = a.d._pt; a && a.p !== t && a.fp !== t; )
a = a._next;
if (!a)
return To = 1,
e.vars[t] = "+=0",
Mo(e, s),
To = 0,
1;
h.push(a)
}
for (u = h.length; u--; )
(a = (l = h[u])._pt || l).s = !r && 0 !== r || n ? a.s + (r || 0) + o * a.c : r,
a.c = i - a.s,
l.e && (l.e = Wr(i) + Pn(l.e)),
l.b && (l.b = a.s + Pn(l.b))
}(this, e, t, i, r, this._ease(n / this._dur), n) ? this.resetTo(e, t, i, r) : (yn(this, 0),
this.parent || an(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0),
this.render(0))
}
,
i.kill = function(e, t) {
if (void 0 === t && (t = "all"),
!(e || t && "all" !== t))
return this._lazy = this._pt = 0,
this.parent ? Xn(this) : this;
if (this.timeline) {
var i = this.timeline.totalDuration();
return this.timeline.killTweensOf(e, t, wo && !0 !== wo.vars.overwrite)._first || Xn(this),
this.parent && i !== this.timeline.totalDuration() && Sn(this, this._dur * this.timeline._tDur / i, 0, 1),
this
}
var r, n, o, s, a, l, c, u = this._targets, h = e ? On(e) : u, d = this._ptLookup, p = this._pt;
if ((!t || "all" === t) && function(e, t) {
for (var i = e.length, r = i === t.length; r && i-- && e[i] === t[i]; )
;
return i < 0
}(u, h))
return "all" === t && (this._pt = 0),
Xn(this);
for (r = this._op = this._op || [],
"all" !== t && (lr(t) && (a = {},
Zr(t, (function(e) {
return a[e] = 1
}
)),
t = a),
t = function(e, t) {
var i, r, n, o, s = e[0] ? $r(e[0]).harness : 0, a = s && s.aliases;
if (!a)
return t;
for (r in i = rn({}, t),
a)
if (r in i)
for (n = (o = a[r].split(",")).length; n--; )
i[o[n]] = i[r];
return i
}(u, t)),
c = u.length; c--; )
if (~h.indexOf(u[c]))
for (a in n = d[c],
"all" === t ? (r[c] = t,
s = n,
o = {}) : (o = r[c] = r[c] || {},
s = t),
s)
(l = n && n[a]) && ("kill"in l.d && !0 !== l.d.kill(a) || ln(this, l, "_pt"),
delete n[a]),
"all" !== o && (o[a] = 1);
return this._initted && !this._pt && p && Xn(this),
this
}
,
t.to = function(e, i) {
return new t(e,i,arguments[2])
}
,
t.from = function(e, t) {
return In(1, arguments)
}
,
t.delayedCall = function(e, i, r, n) {
return new t(i,0,{
immediateRender: !1,
lazy: !1,
overwrite: !1,
delay: e,
onComplete: i,
onReverseComplete: i,
onCompleteParams: r,
onReverseCompleteParams: r,
callbackScope: n
})
}
,
t.fromTo = function(e, t, i) {
return In(2, arguments)
}
,
t.set = function(e, i) {
return i.duration = 0,
i.repeatDelay || (i.repeat = 0),
new t(e,i)
}
,
t.killTweensOf = function(e, t, i) {
return Vi.killTweensOf(e, t, i)
}
,
t
}(vo);
tn(Po.prototype, {
_targets: [],
_lazy: 0,
_startAt: 0,
_op: 0,
_onInit: 0
}),
Zr("staggerTo,staggerFrom,staggerFromTo", (function(e) {
Po[e] = function() {
var t = new bo
, i = Dn.call(arguments, 0);
return i.splice("staggerFromTo" === e ? 5 : 4, 0, 0),
t[e].apply(t, i)
}
}
));
var Do = function(e, t, i) {
return e[t] = i
}
, Lo = function(e, t, i) {
return e[t](i)
}
, Bo = function(e, t, i, r) {
return e[t](r.fp, i)
}
, Oo = function(e, t, i) {
return e.setAttribute(t, i)
}
, Ro = function(e, t) {
return cr(e[t]) ? Lo : hr(e[t]) && e.setAttribute ? Oo : Do
}
, Fo = function(e, t) {
return t.set(t.t, t.p, Math.round(1e6 * (t.s + t.c * e)) / 1e6, t)
}
, Uo = function(e, t) {
return t.set(t.t, t.p, !!(t.s + t.c * e), t)
}
, Vo = function(e, t) {
var i = t._pt
, r = "";
if (!e && t.b)
r = t.b;
else if (1 === e && t.e)
r = t.e;
else {
for (; i; )
r = i.p + (i.m ? i.m(i.s + i.c * e) : Math.round(1e4 * (i.s + i.c * e)) / 1e4) + r,
i = i._next;
r += t.c
}
t.set(t.t, t.p, r, t)
}
, jo = function(e, t) {
for (var i = t._pt; i; )
i.r(e, i.d),
i = i._next
}
, No = function(e, t, i, r) {
for (var n, o = this._pt; o; )
n = o._next,
o.p === r && o.modifier(e, t, i),
o = n
}
, Go = function(e) {
for (var t, i, r = this._pt; r; )
i = r._next,
r.p === e && !r.op || r.op === e ? ln(this, r, "_pt") : r.dep || (t = 1),
r = i;
return !t
}
, $o = function(e, t, i, r) {
r.mSet(e, t, r.m.call(r.tween, i, r.mt), r)
}
, qo = function(e) {
for (var t, i, r, n, o = e._pt; o; ) {
for (t = o._next,
i = r; i && i.pr > o.pr; )
i = i._next;
(o._prev = i ? i._prev : n) ? o._prev._next = o : r = o,
(o._next = i) ? i._prev = o : n = o,
o = t
}
e._pt = r
}
, Zo = function() {
function e(e, t, i, r, n, o, s, a, l) {
this.t = t,
this.s = r,
this.c = n,
this.p = i,
this.r = o || Fo,
this.d = s || this,
this.set = a || Do,
this.pr = l || 0,
this._next = e,
e && (e._prev = this)
}
return e.prototype.modifier = function(e, t, i) {
this.mSet = this.mSet || this.set,
this.set = $o,
this.m = e,
this.mt = i,
this.tween = t
}
,
e
}();
Zr(Nr + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", (function(e) {
return Br[e] = 1
}
)),
Sr.TweenMax = Sr.TweenLite = Po,
Sr.TimelineLite = Sr.TimelineMax = bo,
Vi = new bo({
sortChildren: !1,
defaults: Qi,
autoRemoveChildren: !0,
id: "root",
smoothChildTiming: !0
}),
Ji.stringFilter = no;
var Wo = []
, Xo = {}
, Ho = []
, Yo = 0
, Ko = function(e) {
return (Xo[e] || Ho).map((function(e) {
return e()
}
))
}
, Jo = function() {
var e = Date.now()
, t = [];
e - Yo > 2 && (Ko("matchMediaInit"),
Wo.forEach((function(e) {
var i, r, n, o, s = e.queries, a = e.conditions;
for (r in s)
(i = ji.matchMedia(s[r]).matches) && (n = 1),
i !== a[r] && (a[r] = i,
o = 1);
o && (e.revert(),
n && t.push(e))
}
)),
Ko("matchMediaRevert"),
t.forEach((function(e) {
return e.onMatch(e)
}
)),
Yo = e,
Ko("matchMedia"))
}
, Qo = function() {
function e(e, t) {
this.selector = t && Rn(t),
this.data = [],
this._r = [],
this.isReverted = !1,
e && this.add(e)
}
var t = e.prototype;
return t.add = function(e, t, i) {
cr(e) && (i = t,
t = e,
e = cr);
var r = this
, n = function() {
var e, n = Ui, o = r.selector;
return n && n !== r && n.data.push(r),
i && (r.selector = Rn(i)),
Ui = r,
e = t.apply(r, arguments),
cr(e) && r._r.push(e),
Ui = n,
r.selector = o,
r.isReverted = !1,
e
};
return r.last = n,
e === cr ? n(r) : e ? r[e] = n : n
}
,
t.ignore = function(e) {
var t = Ui;
Ui = null,
e(this),
Ui = t
}
,
t.getTweens = function() {
var t = [];
return this.data.forEach((function(i) {
return i instanceof e ? t.push.apply(t, i.getTweens()) : i instanceof Po && !(i.parent && "nested" === i.parent.data) && t.push(i)
}
)),
t
}
,
t.clear = function() {
this._r.length = this.data.length = 0
}
,
t.kill = function(e, t) {
var i = this;
if (e) {
var r = this.getTweens();
this.data.forEach((function(e) {
"isFlip" === e.data && (e.revert(),
e.getChildren(!0, !0, !1).forEach((function(e) {
return r.splice(r.indexOf(e), 1)
}
)))
}
)),
r.map((function(e) {
return {
g: e.globalTime(0),
t: e
}
}
)).sort((function(e, t) {
return t.g - e.g || -1
}
)).forEach((function(t) {
return t.t.revert(e)
}
)),
this.data.forEach((function(t) {
return !(t instanceof vo) && t.revert && t.revert(e)
}
)),
this._r.forEach((function(t) {
return t(e, i)
}
)),
this.isReverted = !0
} else
this.data.forEach((function(e) {
return e.kill && e.kill()
}
));
if (this.clear(),
t) {
var n = Wo.indexOf(this);
~n && Wo.splice(n, 1)
}
}
,
t.revert = function(e) {
this.kill(e || {})
}
,
e
}()
, es = function() {
function e(e) {
this.contexts = [],
this.scope = e
}
var t = e.prototype;
return t.add = function(e, t, i) {
dr(e) || (e = {
matches: e
});
var r, n, o, s = new Qo(0,i || this.scope), a = s.conditions = {};
for (n in this.contexts.push(s),
t = s.add("onMatch", t),
s.queries = e,
e)
"all" === n ? o = 1 : (r = ji.matchMedia(e[n])) && (Wo.indexOf(s) < 0 && Wo.push(s),
(a[n] = r.matches) && (o = 1),
r.addListener ? r.addListener(Jo) : r.addEventListener("change", Jo));
return o && t(s),
this
}
,
t.revert = function(e) {
this.kill(e || {})
}
,
t.kill = function(e) {
this.contexts.forEach((function(t) {
return t.kill(e, !0)
}
))
}
,
e
}()
, ts = {
registerPlugin: function() {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
t[i] = arguments[i];
t.forEach((function(e) {
return Hn(e)
}
))
},
timeline: function(e) {
return new bo(e)
},
getTweensOf: function(e, t) {
return Vi.getTweensOf(e, t)
},
getProperty: function(e, t, i, r) {
lr(e) && (e = On(e)[0]);
var n = $r(e || {}).get
, o = i ? en : Qr;
return "native" === i && (i = ""),
e ? t ? o((Fr[t] && Fr[t].get || n)(e, t, i, r)) : function(t, i, r) {
return o((Fr[t] && Fr[t].get || n)(e, t, i, r))
}
: e
},
quickSetter: function(e, t, i) {
if ((e = On(e)).length > 1) {
var r = e.map((function(e) {
return ns.quickSetter(e, t, i)
}
))
, n = r.length;
return function(e) {
for (var t = n; t--; )
r[t](e)
}
}
e = e[0] || {};
var o = Fr[t]
, s = $r(e)
, a = s.harness && (s.harness.aliases || {})[t] || t
, l = o ? function(t) {
var r = new o;
Zi._pt = 0,
r.init(e, i ? t + i : t, Zi, 0, [e]),
r.render(1, r),
Zi._pt && jo(1, Zi)
}
: s.set(e, a);
return o ? l : function(t) {
return l(e, a, i ? t + i : t, s, 1)
}
},
quickTo: function(e, t, i) {
var r, n = ns.to(e, rn(((r = {})[t] = "+=0.1",
r.paused = !0,
r), i || {})), o = function(e, i, r) {
return n.resetTo(t, e, i, r)
};
return o.tween = n,
o
},
isTweening: function(e) {
return Vi.getTweensOf(e, !0).length > 0
},
defaults: function(e) {
return e && e.ease && (e.ease = fo(e.ease, Qi.ease)),
nn(Qi, e || {})
},
config: function(e) {
return nn(Ji, e || {})
},
registerEffect: function(e) {
var t = e.name
, i = e.effect
, r = e.plugins
, n = e.defaults
, o = e.extendTimeline;
(r || "").split(",").forEach((function(e) {
return e && !Fr[e] && !Sr[e] && Ir(t + " effect requires " + e + " plugin.")
}
)),
Ur[t] = function(e, t, r) {
return i(On(e), tn(t || {}, n), r)
}
,
o && (bo.prototype[t] = function(e, i, r) {
return this.add(Ur[t](e, dr(i) ? i : (r = i) && {}, this), r)
}
)
},
registerEase: function(e, t) {
ao[e] = fo(t)
},
parseEase: function(e, t) {
return arguments.length ? fo(e, t) : ao
},
getById: function(e) {
return Vi.getById(e)
},
exportRoot: function(e, t) {
void 0 === e && (e = {});
var i, r, n = new bo(e);
for (n.smoothChildTiming = pr(e.smoothChildTiming),
Vi.remove(n),
n._dp = 0,
n._time = n._tTime = Vi._time,
i = Vi._first; i; )
r = i._next,
!t && !i._dur && i instanceof Po && i.vars.onComplete === i._targets[0] || vn(n, i, i._start - i._delay),
i = r;
return vn(Vi, n, 0),
n
},
context: function(e, t) {
return e ? new Qo(e,t) : Ui
},
matchMedia: function(e) {
return new es(e)
},
matchMediaRefresh: function() {
return Wo.forEach((function(e) {
var t, i, r = e.conditions;
for (i in r)
r[i] && (r[i] = !1,
t = 1);
t && e.revert()
}
)) || Jo()
},
addEventListener: function(e, t) {
var i = Xo[e] || (Xo[e] = []);
~i.indexOf(t) || i.push(t)
},
removeEventListener: function(e, t) {
var i = Xo[e]
, r = i && i.indexOf(t);
r >= 0 && i.splice(r, 1)
},
utils: {
wrap: function e(t, i, r) {
var n = i - t;
return gr(t) ? Gn(t, e(0, t.length), i) : zn(r, (function(e) {
return (n + (e - t) % n) % n + t
}
))
},
wrapYoyo: function e(t, i, r) {
var n = i - t
, o = 2 * n;
return gr(t) ? Gn(t, e(0, t.length - 1), i) : zn(r, (function(e) {
return t + ((e = (o + (e - t) % o) % o || 0) > n ? o - e : e)
}
))
},
distribute: Un,
random: Nn,
snap: jn,
normalize: function(e, t, i) {
return qn(e, t, 0, 1, i)
},
getUnit: Pn,
clamp: function(e, t, i) {
return zn(i, (function(i) {
return kn(e, t, i)
}
))
},
splitColor: Qn,
toArray: On,
selector: Rn,
mapRange: qn,
pipe: function() {
for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
t[i] = arguments[i];
return function(e) {
return t.reduce((function(e, t) {
return t(e)
}
), e)
}
},
unitize: function(e, t) {
return function(i) {
return e(parseFloat(i)) + (t || Pn(i))
}
},
interpolate: function e(t, i, r, n) {
var o = isNaN(t + i) ? 0 : function(e) {
return (1 - e) * t + e * i
}
;
if (!o) {
var s, a, l, c, u, h = lr(t), d = {};
if (!0 === r && (n = 1) && (r = null),
h)
t = {
p: t
},
i = {
p: i
};
else if (gr(t) && !gr(i)) {
for (l = [],
c = t.length,
u = c - 2,
a = 1; a < c; a++)
l.push(e(t[a - 1], t[a]));
c--,
o = function(e) {
e *= c;
var t = Math.min(u, ~~e);
return l[t](e - t)
}
,
r = i
} else
n || (t = rn(gr(t) ? [] : {}, t));
if (!l) {
for (s in i)
So.call(d, t, s, "get", i[s]);
o = function(e) {
return jo(e, d) || (h ? t.p : t)
}
}
}
return zn(r, o)
},
shuffle: Fn
},
install: Mr,
effects: Ur,
ticker: oo,
updateRoot: bo.updateRoot,
plugins: Fr,
globalTimeline: Vi,
core: {
PropTween: Zo,
globals: zr,
Tween: Po,
Timeline: bo,
Animation: vo,
getCache: $r,
_removeLinkedListItem: ln,
reverting: function() {
return Fi
},
context: function(e) {
return e && Ui && (Ui.data.push(e),
e._ctx = Ui),
Ui
},
suppressOverwrites: function(e) {
return Ri = e
}
}
};
Zr("to,from,fromTo,delayedCall,set,killTweensOf", (function(e) {
return ts[e] = Po[e]
}
)),
oo.add(bo.updateRoot),
Zi = ts.to({}, {
duration: 0
});
var is = function(e, t) {
for (var i = e._pt; i && i.p !== t && i.op !== t && i.fp !== t; )
i = i._next;
return i
}
, rs = function(e, t) {
return {
name: e,
rawVars: 1,
init: function(e, i, r) {
r._onInit = function(e) {
var r, n;
if (lr(i) && (r = {},
Zr(i, (function(e) {
return r[e] = 1
}
)),
i = r),
t) {
for (n in r = {},
i)
r[n] = t(i[n]);
i = r
}
!function(e, t) {
var i, r, n, o = e._targets;
for (i in t)
for (r = o.length; r--; )
(n = e._ptLookup[r][i]) && (n = n.d) && (n._pt && (n = is(n, i)),
n && n.modifier && n.modifier(t[i], e, o[r], i))
}(e, i)
}
}
}
}
, ns = ts.registerPlugin({
name: "attr",
init: function(e, t, i, r, n) {
var o, s, a;
for (o in this.tween = i,
t)
a = e.getAttribute(o) || "",
(s = this.add(e, "setAttribute", (a || 0) + "", t[o], r, n, 0, 0, o)).op = o,
s.b = a,
this._props.push(o)
},
render: function(e, t) {
for (var i = t._pt; i; )
Fi ? i.set(i.t, i.p, i.b, i) : i.r(e, i.d),
i = i._next
}
}, {
name: "endArray",
init: function(e, t) {
for (var i = t.length; i--; )
this.add(e, i, e[i] || 0, t[i], 0, 0, 0, 0, 0, 1)
}
}, rs("roundProps", Vn), rs("modifiers"), rs("snap", jn)) || ts;
Po.version = bo.version = ns.version = "3.11.3",
$i = 1,
fr() && so();
ao.Power0,
ao.Power1,
ao.Power2,
ao.Power3,
ao.Power4,
ao.Linear,
ao.Quad,
ao.Cubic,
ao.Quart,
ao.Quint,
ao.Strong,
ao.Elastic,
ao.Back,
ao.SteppedEase,
ao.Bounce,
ao.Sine,
ao.Expo,
ao.Circ;
var os, ss, as, ls, cs, us, hs, ds, ps = {}, fs = 180 / Math.PI, ms = Math.PI / 180, _s = Math.atan2, gs = /([A-Z])/g, ys = /(left|right|width|margin|padding|x)/i, xs = /[\s,\(]\S/, vs = {
autoAlpha: "opacity,visibility",
scale: "scaleX,scaleY",
alpha: "opacity"
}, bs = function(e, t) {
return t.set(t.t, t.p, Math.round(1e4 * (t.s + t.c * e)) / 1e4 + t.u, t)
}, ws = function(e, t) {
return t.set(t.t, t.p, 1 === e ? t.e : Math.round(1e4 * (t.s + t.c * e)) / 1e4 + t.u, t)
}, Ts = function(e, t) {
return t.set(t.t, t.p, e ? Math.round(1e4 * (t.s + t.c * e)) / 1e4 + t.u : t.b, t)
}, Es = function(e, t) {
var i = t.s + t.c * e;
t.set(t.t, t.p, ~~(i + (i < 0 ? -.5 : .5)) + t.u, t)
}, Ss = function(e, t) {
return t.set(t.t, t.p, e ? t.e : t.b, t)
}, Cs = function(e, t) {
return t.set(t.t, t.p, 1 !== e ? t.b : t.e, t)
}, Ms = function(e, t, i) {
return e.style[t] = i
}, As = function(e, t, i) {
return e.style.setProperty(t, i)
}, Is = function(e, t, i) {
return e._gsap[t] = i
}, zs = function(e, t, i) {
return e._gsap.scaleX = e._gsap.scaleY = i
}, ks = function(e, t, i, r, n) {
var o = e._gsap;
o.scaleX = o.scaleY = i,
o.renderTransform(n, o)
}, Ps = function(e, t, i, r, n) {
var o = e._gsap;
o[t] = i,
o.renderTransform(n, o)
}, Ds = "transform", Ls = Ds + "Origin", Bs = function(e, t) {
var i = this
, r = this.target
, n = r.style;
if (e in ps) {
if (this.tfm = this.tfm || {},
"transform" !== e && (~(e = vs[e] || e).indexOf(",") ? e.split(",").forEach((function(e) {
return i.tfm[e] = Qs(r, e)
}
)) : this.tfm[e] = r._gsap.x ? r._gsap[e] : Qs(r, e)),
this.props.indexOf(Ds) >= 0)
return;
r._gsap.svg && (this.svgo = r.getAttribute("data-svg-origin"),
this.props.push(Ls, t, "")),
e = Ds
}
(n || t) && this.props.push(e, t, n[e])
}, Os = function(e) {
e.translate && (e.removeProperty("translate"),
e.removeProperty("scale"),
e.removeProperty("rotate"))
}, Rs = function() {
var e, t, i = this.props, r = this.target, n = r.style, o = r._gsap;
for (e = 0; e < i.length; e += 3)
i[e + 1] ? r[i[e]] = i[e + 2] : i[e + 2] ? n[i[e]] = i[e + 2] : n.removeProperty(i[e].replace(gs, "-$1").toLowerCase());
if (this.tfm) {
for (t in this.tfm)
o[t] = this.tfm[t];
o.svg && (o.renderTransform(),
r.setAttribute("data-svg-origin", this.svgo || "")),
!(e = hs()) || e.isStart || n[Ds] || (Os(n),
o.uncache = 1)
}
}, Fs = function(e, t) {
var i = {
target: e,
props: [],
revert: Rs,
save: Bs
};
return t && t.split(",").forEach((function(e) {
return i.save(e)
}
)),
i
}, Us = function(e, t) {
var i = ss.createElementNS ? ss.createElementNS((t || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), e) : ss.createElement(e);
return i.style ? i : ss.createElement(e)
}, Vs = function e(t, i, r) {
var n = getComputedStyle(t);
return n[i] || n.getPropertyValue(i.replace(gs, "-$1").toLowerCase()) || n.getPropertyValue(i) || !r && e(t, Ns(i) || i, 1) || ""
}, js = "O,Moz,ms,Ms,Webkit".split(","), Ns = function(e, t, i) {
var r = (t || cs).style
, n = 5;
if (e in r && !i)
return e;
for (e = e.charAt(0).toUpperCase() + e.substr(1); n-- && !(js[n] + e in r); )
;
return n < 0 ? null : (3 === n ? "ms" : n >= 0 ? js[n] : "") + e
}, Gs = function() {
"undefined" != typeof window && window.document && (os = window,
ss = os.document,
as = ss.documentElement,
cs = Us("div") || {
style: {}
},
Us("div"),
Ds = Ns(Ds),
Ls = Ds + "Origin",
cs.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0",
ds = !!Ns("perspective"),
hs = ns.core.reverting,
ls = 1)
}, $s = function e(t) {
var i, r = Us("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), n = this.parentNode, o = this.nextSibling, s = this.style.cssText;
if (as.appendChild(r),
r.appendChild(this),
this.style.display = "block",
t)
try {
i = this.getBBox(),
this._gsapBBox = this.getBBox,
this.getBBox = e
} catch (e) {}
else
this._gsapBBox && (i = this._gsapBBox());
return n && (o ? n.insertBefore(this, o) : n.appendChild(this)),
as.removeChild(r),
this.style.cssText = s,
i
}, qs = function(e, t) {
for (var i = t.length; i--; )
if (e.hasAttribute(t[i]))
return e.getAttribute(t[i])
}, Zs = function(e) {
var t;
try {
t = e.getBBox()
} catch (i) {
t = $s.call(e, !0)
}
return t && (t.width || t.height) || e.getBBox === $s || (t = $s.call(e, !0)),
!t || t.width || t.x || t.y ? t : {
x: +qs(e, ["x", "cx", "x1"]) || 0,
y: +qs(e, ["y", "cy", "y1"]) || 0,
width: 0,
height: 0
}
}, Ws = function(e) {
return !(!e.getCTM || e.parentNode && !e.ownerSVGElement || !Zs(e))
}, Xs = function(e, t) {
if (t) {
var i = e.style;
t in ps && t !== Ls && (t = Ds),
i.removeProperty ? ("ms" !== t.substr(0, 2) && "webkit" !== t.substr(0, 6) || (t = "-" + t),
i.removeProperty(t.replace(gs, "-$1").toLowerCase())) : i.removeAttribute(t)
}
}, Hs = function(e, t, i, r, n, o) {
var s = new Zo(e._pt,t,i,0,1,o ? Cs : Ss);
return e._pt = s,
s.b = r,
s.e = n,
e._props.push(i),
s
}, Ys = {
deg: 1,
rad: 1,
turn: 1
}, Ks = {
grid: 1,
flex: 1
}, Js = function e(t, i, r, n) {
var o, s, a, l, c = parseFloat(r) || 0, u = (r + "").trim().substr((c + "").length) || "px", h = cs.style, d = ys.test(i), p = "svg" === t.tagName.toLowerCase(), f = (p ? "client" : "offset") + (d ? "Width" : "Height"), m = 100, _ = "px" === n, g = "%" === n;
return n === u || !c || Ys[n] || Ys[u] ? c : ("px" !== u && !_ && (c = e(t, i, r, "px")),
l = t.getCTM && Ws(t),
!g && "%" !== u || !ps[i] && !~i.indexOf("adius") ? (h[d ? "width" : "height"] = m + (_ ? u : n),
s = ~i.indexOf("adius") || "em" === n && t.appendChild && !p ? t : t.parentNode,
l && (s = (t.ownerSVGElement || {}).parentNode),
s && s !== ss && s.appendChild || (s = ss.body),
(a = s._gsap) && g && a.width && d && a.time === oo.time && !a.uncache ? Wr(c / a.width * m) : ((g || "%" === u) && !Ks[Vs(s, "display")] && (h.position = Vs(t, "position")),
s === t && (h.position = "static"),
s.appendChild(cs),
o = cs[f],
s.removeChild(cs),
h.position = "absolute",
d && g && ((a = $r(s)).time = oo.time,
a.width = s[f]),
Wr(_ ? o * c / m : o && c ? m / o * c : 0))) : (o = l ? t.getBBox()[d ? "width" : "height"] : t[f],
Wr(g ? c / o * m : c / 100 * o)))
}, Qs = function(e, t, i, r) {
var n;
return ls || Gs(),
t in vs && "transform" !== t && ~(t = vs[t]).indexOf(",") && (t = t.split(",")[0]),
ps[t] && "transform" !== t ? (n = ha(e, r),
n = "transformOrigin" !== t ? n[t] : n.svg ? n.origin : da(Vs(e, Ls)) + " " + n.zOrigin + "px") : (!(n = e.style[t]) || "auto" === n || r || ~(n + "").indexOf("calc(")) && (n = na[t] && na[t](e, t, i) || Vs(e, t) || qr(e, t) || ("opacity" === t ? 1 : 0)),
i && !~(n + "").trim().indexOf(" ") ? Js(e, t, n, i) + i : n
}, ea = function(e, t, i, r) {
if (!i || "none" === i) {
var n = Ns(t, e, 1)
, o = n && Vs(e, n, 1);
o && o !== i ? (t = n,
i = o) : "borderColor" === t && (i = Vs(e, "borderTopColor"))
}
var s, a, l, c, u, h, d, p, f, m, _, g = new Zo(this._pt,e.style,t,0,1,Vo), y = 0, x = 0;
if (g.b = i,
g.e = r,
i += "",
"auto" === (r += "") && (e.style[t] = r,
r = Vs(e, t) || r,
e.style[t] = i),
no(s = [i, r]),
r = s[1],
l = (i = s[0]).match(vr) || [],
(r.match(vr) || []).length) {
for (; a = vr.exec(r); )
d = a[0],
f = r.substring(y, a.index),
u ? u = (u + 1) % 5 : "rgba(" !== f.substr(-5) && "hsla(" !== f.substr(-5) || (u = 1),
d !== (h = l[x++] || "") && (c = parseFloat(h) || 0,
_ = h.substr((c + "").length),
"=" === d.charAt(1) && (d = Hr(c, d) + _),
p = parseFloat(d),
m = d.substr((p + "").length),
y = vr.lastIndex - m.length,
m || (m = m || Ji.units[t] || _,
y === r.length && (r += m,
g.e += m)),
_ !== m && (c = Js(e, t, h, m) || 0),
g._pt = {
_next: g._pt,
p: f || 1 === x ? f : ",",
s: c,
c: p - c,
m: u && u < 4 || "zIndex" === t ? Math.round : 0
});
g.c = y < r.length ? r.substring(y, r.length) : ""
} else
g.r = "display" === t && "none" === r ? Cs : Ss;
return wr.test(r) && (g.e = 0),
this._pt = g,
g
}, ta = {
top: "0%",
bottom: "100%",
left: "0%",
right: "100%",
center: "50%"
}, ia = function(e) {
var t = e.split(" ")
, i = t[0]
, r = t[1] || "50%";
return "top" !== i && "bottom" !== i && "left" !== r && "right" !== r || (e = i,
i = r,
r = e),
t[0] = ta[i] || i,
t[1] = ta[r] || r,
t.join(" ")
}, ra = function(e, t) {
if (t.tween && t.tween._time === t.tween._dur) {
var i, r, n, o = t.t, s = o.style, a = t.u, l = o._gsap;
if ("all" === a || !0 === a)
s.cssText = "",
r = 1;
else
for (n = (a = a.split(",")).length; --n > -1; )
i = a[n],
ps[i] && (r = 1,
i = "transformOrigin" === i ? Ls : Ds),
Xs(o, i);
r && (Xs(o, Ds),
l && (l.svg && o.removeAttribute("transform"),
ha(o, 1),
l.uncache = 1,
Os(s)))
}
}, na = {
clearProps: function(e, t, i, r, n) {
if ("isFromStart" !== n.data) {
var o = e._pt = new Zo(e._pt,t,i,0,0,ra);
return o.u = r,
o.pr = -10,
o.tween = n,
e._props.push(i),
1
}
}
}, oa = [1, 0, 0, 1, 0, 0], sa = {}, aa = function(e) {
return "matrix(1, 0, 0, 1, 0, 0)" === e || "none" === e || !e
}, la = function(e) {
var t = Vs(e, Ds);
return aa(t) ? oa : t.substr(7).match(xr).map(Wr)
}, ca = function(e, t) {
var i, r, n, o, s = e._gsap || $r(e), a = e.style, l = la(e);
return s.svg && e.getAttribute("transform") ? "1,0,0,1,0,0" === (l = [(n = e.transform.baseVal.consolidate().matrix).a, n.b, n.c, n.d, n.e, n.f]).join(",") ? oa : l : (l !== oa || e.offsetParent || e === as || s.svg || (n = a.display,
a.display = "block",
(i = e.parentNode) && e.offsetParent || (o = 1,
r = e.nextElementSibling,
as.appendChild(e)),
l = la(e),
n ? a.display = n : Xs(e, "display"),
o && (r ? i.insertBefore(e, r) : i ? i.appendChild(e) : as.removeChild(e))),
t && l.length > 6 ? [l[0], l[1], l[4], l[5], l[12], l[13]] : l)
}, ua = function(e, t, i, r, n, o) {
var s, a, l, c = e._gsap, u = n || ca(e, !0), h = c.xOrigin || 0, d = c.yOrigin || 0, p = c.xOffset || 0, f = c.yOffset || 0, m = u[0], _ = u[1], g = u[2], y = u[3], x = u[4], v = u[5], b = t.split(" "), w = parseFloat(b[0]) || 0, T = parseFloat(b[1]) || 0;
i ? u !== oa && (a = m * y - _ * g) && (l = w * (-_ / a) + T * (m / a) - (m * v - _ * x) / a,
w = w * (y / a) + T * (-g / a) + (g * v - y * x) / a,
T = l) : (w = (s = Zs(e)).x + (~b[0].indexOf("%") ? w / 100 * s.width : w),
T = s.y + (~(b[1] || b[0]).indexOf("%") ? T / 100 * s.height : T)),
r || !1 !== r && c.smooth ? (x = w - h,
v = T - d,
c.xOffset = p + (x * m + v * g) - x,
c.yOffset = f + (x * _ + v * y) - v) : c.xOffset = c.yOffset = 0,
c.xOrigin = w,
c.yOrigin = T,
c.smooth = !!r,
c.origin = t,
c.originIsAbsolute = !!i,
e.style[Ls] = "0px 0px",
o && (Hs(o, c, "xOrigin", h, w),
Hs(o, c, "yOrigin", d, T),
Hs(o, c, "xOffset", p, c.xOffset),
Hs(o, c, "yOffset", f, c.yOffset)),
e.setAttribute("data-svg-origin", w + " " + T)
}, ha = function(e, t) {
var i = e._gsap || new xo(e);
if ("x"in i && !t && !i.uncache)
return i;
var r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E, S, C, M, A, I, z, k, P, D, L, B = e.style, O = i.scaleX < 0, R = "px", F = "deg", U = getComputedStyle(e), V = Vs(e, Ls) || "0";
return r = n = o = l = c = u = h = d = p = 0,
s = a = 1,
i.svg = !(!e.getCTM || !Ws(e)),
U.translate && ("none" === U.translate && "none" === U.scale && "none" === U.rotate || (B[Ds] = ("none" !== U.translate ? "translate3d(" + (U.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + ("none" !== U.rotate ? "rotate(" + U.rotate + ") " : "") + ("none" !== U.scale ? "scale(" + U.scale.split(" ").join(",") + ") " : "") + ("none" !== U[Ds] ? U[Ds] : "")),
B.scale = B.rotate = B.translate = "none"),
_ = ca(e, i.svg),
i.svg && (i.uncache ? (M = e.getBBox(),
V = i.xOrigin - M.x + "px " + (i.yOrigin - M.y) + "px",
C = "") : C = !t && e.getAttribute("data-svg-origin"),
ua(e, C || V, !!C || i.originIsAbsolute, !1 !== i.smooth, _)),
f = i.xOrigin || 0,
m = i.yOrigin || 0,
_ !== oa && (v = _[0],
b = _[1],
w = _[2],
T = _[3],
r = E = _[4],
n = S = _[5],
6 === _.length ? (s = Math.sqrt(v * v + b * b),
a = Math.sqrt(T * T + w * w),
l = v || b ? _s(b, v) * fs : 0,
(h = w || T ? _s(w, T) * fs + l : 0) && (a *= Math.abs(Math.cos(h * ms))),
i.svg && (r -= f - (f * v + m * w),
n -= m - (f * b + m * T))) : (L = _[6],
P = _[7],
I = _[8],
z = _[9],
k = _[10],
D = _[11],
r = _[12],
n = _[13],
o = _[14],
c = (g = _s(L, k)) * fs,
g && (C = E * (y = Math.cos(-g)) + I * (x = Math.sin(-g)),
M = S * y + z * x,
A = L * y + k * x,
I = E * -x + I * y,
z = S * -x + z * y,
k = L * -x + k * y,
D = P * -x + D * y,
E = C,
S = M,
L = A),
u = (g = _s(-w, k)) * fs,
g && (y = Math.cos(-g),
D = T * (x = Math.sin(-g)) + D * y,
v = C = v * y - I * x,
b = M = b * y - z * x,
w = A = w * y - k * x),
l = (g = _s(b, v)) * fs,
g && (C = v * (y = Math.cos(g)) + b * (x = Math.sin(g)),
M = E * y + S * x,
b = b * y - v * x,
S = S * y - E * x,
v = C,
E = M),
c && Math.abs(c) + Math.abs(l) > 359.9 && (c = l = 0,
u = 180 - u),
s = Wr(Math.sqrt(v * v + b * b + w * w)),
a = Wr(Math.sqrt(S * S + L * L)),
g = _s(E, S),
h = Math.abs(g) > 2e-4 ? g * fs : 0,
p = D ? 1 / (D < 0 ? -D : D) : 0),
i.svg && (C = e.getAttribute("transform"),
i.forceCSS = e.setAttribute("transform", "") || !aa(Vs(e, Ds)),
C && e.setAttribute("transform", C))),
Math.abs(h) > 90 && Math.abs(h) < 270 && (O ? (s *= -1,
h += l <= 0 ? 180 : -180,
l += l <= 0 ? 180 : -180) : (a *= -1,
h += h <= 0 ? 180 : -180)),
t = t || i.uncache,
i.x = r - ((i.xPercent = r && (!t && i.xPercent || (Math.round(e.offsetWidth / 2) === Math.round(-r) ? -50 : 0))) ? e.offsetWidth * i.xPercent / 100 : 0) + R,
i.y = n - ((i.yPercent = n && (!t && i.yPercent || (Math.round(e.offsetHeight / 2) === Math.round(-n) ? -50 : 0))) ? e.offsetHeight * i.yPercent / 100 : 0) + R,
i.z = o + R,
i.scaleX = Wr(s),
i.scaleY = Wr(a),
i.rotation = Wr(l) + F,
i.rotationX = Wr(c) + F,
i.rotationY = Wr(u) + F,
i.skewX = h + F,
i.skewY = d + F,
i.transformPerspective = p + R,
(i.zOrigin = parseFloat(V.split(" ")[2]) || 0) && (B[Ls] = da(V)),
i.xOffset = i.yOffset = 0,
i.force3D = Ji.force3D,
i.renderTransform = i.svg ? xa : ds ? ya : fa,
i.uncache = 0,
i
}, da = function(e) {
return (e = e.split(" "))[0] + " " + e[1]
}, pa = function(e, t, i) {
var r = Pn(t);
return Wr(parseFloat(t) + parseFloat(Js(e, "x", i + "px", r))) + r
}, fa = function(e, t) {
t.z = "0px",
t.rotationY = t.rotationX = "0deg",
t.force3D = 0,
ya(e, t)
}, ma = "0deg", _a = "0px", ga = ") ", ya = function(e, t) {
var i = t || this
, r = i.xPercent
, n = i.yPercent
, o = i.x
, s = i.y
, a = i.z
, l = i.rotation
, c = i.rotationY
, u = i.rotationX
, h = i.skewX
, d = i.skewY
, p = i.scaleX
, f = i.scaleY
, m = i.transformPerspective
, _ = i.force3D
, g = i.target
, y = i.zOrigin
, x = ""
, v = "auto" === _ && e && 1 !== e || !0 === _;
if (y && (u !== ma || c !== ma)) {
var b, w = parseFloat(c) * ms, T = Math.sin(w), E = Math.cos(w);
w = parseFloat(u) * ms,
b = Math.cos(w),
o = pa(g, o, T * b * -y),
s = pa(g, s, -Math.sin(w) * -y),
a = pa(g, a, E * b * -y + y)
}
m !== _a && (x += "perspective(" + m + ga),
(r || n) && (x += "translate(" + r + "%, " + n + "%) "),
(v || o !== _a || s !== _a || a !== _a) && (x += a !== _a || v ? "translate3d(" + o + ", " + s + ", " + a + ") " : "translate(" + o + ", " + s + ga),
l !== ma && (x += "rotate(" + l + ga),
c !== ma && (x += "rotateY(" + c + ga),
u !== ma && (x += "rotateX(" + u + ga),
h === ma && d === ma || (x += "skew(" + h + ", " + d + ga),
1 === p && 1 === f || (x += "scale(" + p + ", " + f + ga),
g.style[Ds] = x || "translate(0, 0)"
}, xa = function(e, t) {
var i, r, n, o, s, a = t || this, l = a.xPercent, c = a.yPercent, u = a.x, h = a.y, d = a.rotation, p = a.skewX, f = a.skewY, m = a.scaleX, _ = a.scaleY, g = a.target, y = a.xOrigin, x = a.yOrigin, v = a.xOffset, b = a.yOffset, w = a.forceCSS, T = parseFloat(u), E = parseFloat(h);
d = parseFloat(d),
p = parseFloat(p),
(f = parseFloat(f)) && (p += f = parseFloat(f),
d += f),
d || p ? (d *= ms,
p *= ms,
i = Math.cos(d) * m,
r = Math.sin(d) * m,
n = Math.sin(d - p) * -_,
o = Math.cos(d - p) * _,
p && (f *= ms,
s = Math.tan(p - f),
n *= s = Math.sqrt(1 + s * s),
o *= s,
f && (s = Math.tan(f),
i *= s = Math.sqrt(1 + s * s),
r *= s)),
i = Wr(i),
r = Wr(r),
n = Wr(n),
o = Wr(o)) : (i = m,
o = _,
r = n = 0),
(T && !~(u + "").indexOf("px") || E && !~(h + "").indexOf("px")) && (T = Js(g, "x", u, "px"),
E = Js(g, "y", h, "px")),
(y || x || v || b) && (T = Wr(T + y - (y * i + x * n) + v),
E = Wr(E + x - (y * r + x * o) + b)),
(l || c) && (s = g.getBBox(),
T = Wr(T + l / 100 * s.width),
E = Wr(E + c / 100 * s.height)),
s = "matrix(" + i + "," + r + "," + n + "," + o + "," + T + "," + E + ")",
g.setAttribute("transform", s),
w && (g.style[Ds] = s)
}, va = function(e, t, i, r, n) {
var o, s, a = 360, l = lr(n), c = parseFloat(n) * (l && ~n.indexOf("rad") ? fs : 1) - r, u = r + c + "deg";
return l && ("short" === (o = n.split("_")[1]) && (c %= a) !== c % 180 && (c += c < 0 ? a : -360),
"cw" === o && c < 0 ? c = (c + 36e9) % a - ~~(c / a) * a : "ccw" === o && c > 0 && (c = (c - 36e9) % a - ~~(c / a) * a)),
e._pt = s = new Zo(e._pt,t,i,r,c,ws),
s.e = u,
s.u = "deg",
e._props.push(i),
s
}, ba = function(e, t) {
for (var i in t)
e[i] = t[i];
return e
}, wa = function(e, t, i) {
var r, n, o, s, a, l, c, u = ba({}, i._gsap), h = i.style;
for (n in u.svg ? (o = i.getAttribute("transform"),
i.setAttribute("transform", ""),
h[Ds] = t,
r = ha(i, 1),
Xs(i, Ds),
i.setAttribute("transform", o)) : (o = getComputedStyle(i)[Ds],
h[Ds] = t,
r = ha(i, 1),
h[Ds] = o),
ps)
(o = u[n]) !== (s = r[n]) && "perspective,force3D,transformOrigin,svgOrigin".indexOf(n) < 0 && (a = Pn(o) !== (c = Pn(s)) ? Js(i, n, o, c) : parseFloat(o),
l = parseFloat(s),
e._pt = new Zo(e._pt,r,n,a,l - a,bs),
e._pt.u = c || 0,
e._props.push(n));
ba(r, u)
};
Zr("padding,margin,Width,Radius", (function(e, t) {
var i = "Top"
, r = "Right"
, n = "Bottom"
, o = "Left"
, s = (t < 3 ? [i, r, n, o] : [i + o, i + r, n + r, n + o]).map((function(i) {
return t < 2 ? e + i : "border" + i + e
}
));
na[t > 1 ? "border" + e : e] = function(e, t, i, r, n) {
var o, a;
if (arguments.length < 4)
return o = s.map((function(t) {
return Qs(e, t, i)
}
)),
5 === (a = o.join(" ")).split(o[0]).length ? o[0] : a;
o = (r + "").split(" "),
a = {},
s.forEach((function(e, t) {
return a[e] = o[t] = o[t] || o[(t - 1) / 2 | 0]
}
)),
e.init(t, a, n)
}
}
));
var Ta, Ea, Sa, Ca = {
name: "css",
register: Gs,
targetTest: function(e) {
return e.style && e.nodeType
},
init: function(e, t, i, r, n) {
var o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b = this._props, w = e.style, T = i.vars.startAt;
for (h in ls || Gs(),
this.styles = this.styles || Fs(e),
v = this.styles.props,
this.tween = i,
t)
if ("autoRound" !== h && (s = t[h],
!Fr[h] || !Co(h, t, i, r, e, n)))
if (c = typeof s,
u = na[h],
"function" === c && (c = typeof (s = s.call(i, r, e, n))),
"string" === c && ~s.indexOf("random(") && (s = $n(s)),
u)
u(this, e, h, s, i) && (x = 1);
else if ("--" === h.substr(0, 2))
o = (getComputedStyle(e).getPropertyValue(h) + "").trim(),
s += "",
io.lastIndex = 0,
io.test(o) || (d = Pn(o),
p = Pn(s)),
p ? d !== p && (o = Js(e, h, o, p) + p) : d && (s += d),
this.add(w, "setProperty", o, s, r, n, 0, 0, h),
b.push(h),
v.push(h, 0, w[h]);
else if ("undefined" !== c) {
if (T && h in T ? (o = "function" == typeof T[h] ? T[h].call(i, r, e, n) : T[h],
lr(o) && ~o.indexOf("random(") && (o = $n(o)),
Pn(o + "") || (o += Ji.units[h] || Pn(Qs(e, h)) || ""),
"=" === (o + "").charAt(1) && (o = Qs(e, h))) : o = Qs(e, h),
l = parseFloat(o),
(f = "string" === c && "=" === s.charAt(1) && s.substr(0, 2)) && (s = s.substr(2)),
a = parseFloat(s),
h in vs && ("autoAlpha" === h && (1 === l && "hidden" === Qs(e, "visibility") && a && (l = 0),
v.push("visibility", 0, w.visibility),
Hs(this, w, "visibility", l ? "inherit" : "hidden", a ? "inherit" : "hidden", !a)),
"scale" !== h && "transform" !== h && ~(h = vs[h]).indexOf(",") && (h = h.split(",")[0])),
m = h in ps)
if (this.styles.save(h),
_ || ((g = e._gsap).renderTransform && !t.parseTransform || ha(e, t.parseTransform),
y = !1 !== t.smoothOrigin && g.smooth,
(_ = this._pt = new Zo(this._pt,w,Ds,0,1,g.renderTransform,g,0,-1)).dep = 1),
"scale" === h)
this._pt = new Zo(this._pt,g,"scaleY",l,(f ? Hr(l, f + a) : a) - l || 0,bs),
this._pt.u = 0,
b.push("scaleY", h),
h += "X";
else {
if ("transformOrigin" === h) {
v.push(Ls, 0, w[Ls]),
s = ia(s),
g.svg ? ua(e, s, 0, y, 0, this) : ((p = parseFloat(s.split(" ")[2]) || 0) !== g.zOrigin && Hs(this, g, "zOrigin", g.zOrigin, p),
Hs(this, w, h, da(o), da(s)));
continue
}
if ("svgOrigin" === h) {
ua(e, s, 1, y, 0, this);
continue
}
if (h in sa) {
va(this, g, h, l, f ? Hr(l, f + s) : s);
continue
}
if ("smoothOrigin" === h) {
Hs(this, g, "smooth", g.smooth, s);
continue
}
if ("force3D" === h) {
g[h] = s;
continue
}
if ("transform" === h) {
wa(this, s, e);
continue
}
}
else
h in w || (h = Ns(h) || h);
if (m || (a || 0 === a) && (l || 0 === l) && !xs.test(s) && h in w)
a || (a = 0),
(d = (o + "").substr((l + "").length)) !== (p = Pn(s) || (h in Ji.units ? Ji.units[h] : d)) && (l = Js(e, h, o, p)),
this._pt = new Zo(this._pt,m ? g : w,h,l,(f ? Hr(l, f + a) : a) - l,m || "px" !== p && "zIndex" !== h || !1 === t.autoRound ? bs : Es),
this._pt.u = p || 0,
d !== p && "%" !== p && (this._pt.b = o,
this._pt.r = Ts);
else if (h in w)
ea.call(this, e, h, o, f ? f + s : s);
else {
if (!(h in e)) {
Ar(h, s);
continue
}
this.add(e, h, o || e[h], f ? f + s : s, r, n)
}
m || (h in w ? v.push(h, 0, w[h]) : v.push(h, 1, o || e[h])),
b.push(h)
}
x && qo(this)
},
render: function(e, t) {
if (t.tween._time || !hs())
for (var i = t._pt; i; )
i.r(e, i.d),
i = i._next;
else
t.styles.revert()
},
get: Qs,
aliases: vs,
getSetter: function(e, t, i) {
var r = vs[t];
return r && r.indexOf(",") < 0 && (t = r),
t in ps && t !== Ls && (e._gsap.x || Qs(e, "x")) ? i && us === i ? "scale" === t ? zs : Is : (us = i || {}) && ("scale" === t ? ks : Ps) : e.style && !hr(e.style[t]) ? Ms : ~t.indexOf("-") ? As : Ro(e, t)
},
core: {
_removeProperty: Xs,
_getMatrix: ca
}
};
ns.utils.checkPrefix = Ns,
ns.core.getStyleSaver = Fs,
Sa = Zr((Ta = "x,y,z,scale,scaleX,scaleY,xPercent,yPercent") + "," + (Ea = "rotation,rotationX,rotationY,skewX,skewY") + ",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", (function(e) {
ps[e] = 1
}
)),
Zr(Ea, (function(e) {
Ji.units[e] = "deg",
sa[e] = 1
}
)),
vs[Sa[13]] = Ta + "," + Ea,
Zr("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY", (function(e) {
var t = e.split(":");
vs[t[1]] = Sa[t[0]]
}
)),
Zr("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", (function(e) {
Ji.units[e] = "px"
}
)),
ns.registerPlugin(Ca);
var Ma = ns.registerPlugin(Ca) || ns;
Ma.core.Tween;
function Aa(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1,
r.configurable = !0,
"value"in r && (r.writable = !0),
Object.defineProperty(e, r.key, r)
}
}
var Ia, za, ka, Pa, Da, La, Ba, Oa, Ra, Fa, Ua, Va, ja = function() {
return Ia || "undefined" != typeof window && (Ia = window.gsap) && Ia.registerPlugin && Ia
}, Na = 1, Ga = [], $a = [], qa = [], Za = Date.now, Wa = function(e, t) {
return t
}, Xa = function(e, t) {
return ~qa.indexOf(e) && qa[qa.indexOf(e) + 1][t]
}, Ha = function(e) {
return !!~Fa.indexOf(e)
}, Ya = function(e, t, i, r, n) {
return e.addEventListener(t, i, {
passive: !r,
capture: !!n
})
}, Ka = function(e, t, i, r) {
return e.removeEventListener(t, i, !!r)
}, Ja = "scrollLeft", Qa = "scrollTop", el = function() {
return Ua && Ua.isPressed || $a.cache++
}, tl = function(e, t) {
var i = function i(r) {
if (r || 0 === r) {
Na && (ka.history.scrollRestoration = "manual");
var n = Ua && Ua.isPressed;
r = i.v = Math.round(r) || (Ua && Ua.iOS ? 1 : 0),
e(r),
i.cacheID = $a.cache,
n && Wa("ss", r)
} else
(t || $a.cache !== i.cacheID || Wa("ref")) && (i.cacheID = $a.cache,
i.v = e());
return i.v + i.offset
};
return i.offset = 0,
e && i
}, il = {
s: Ja,
p: "left",
p2: "Left",
os: "right",
os2: "Right",
d: "width",
d2: "Width",
a: "x",
sc: tl((function(e) {
return arguments.length ? ka.scrollTo(e, rl.sc()) : ka.pageXOffset || Pa.scrollLeft || Da.scrollLeft || La.scrollLeft || 0
}
))
}, rl = {
s: Qa,
p: "top",
p2: "Top",
os: "bottom",
os2: "Bottom",
d: "height",
d2: "Height",
a: "y",
op: il,
sc: tl((function(e) {
return arguments.length ? ka.scrollTo(il.sc(), e) : ka.pageYOffset || Pa.scrollTop || Da.scrollTop || La.scrollTop || 0
}
))
}, nl = function(e) {
return Ia.utils.toArray(e)[0] || ("string" == typeof e && !1 !== Ia.config().nullTargetWarn ? console.warn("Element not found:", e) : null)
}, ol = function(e, t) {
var i = t.s
, r = t.sc;
Ha(e) && (e = Pa.scrollingElement || Da);
var n = $a.indexOf(e)
, o = r === rl.sc ? 1 : 2;
!~n && (n = $a.push(e) - 1),
$a[n + o] || e.addEventListener("scroll", el);
var s = $a[n + o]
, a = s || ($a[n + o] = tl(Xa(e, i), !0) || (Ha(e) ? r : tl((function(t) {
return arguments.length ? e[i] = t : e[i]
}
))));
return a.target = e,
s || (a.smooth = "smooth" === Ia.getProperty(e, "scrollBehavior")),
a
}, sl = function(e, t, i) {
var r = e
, n = e
, o = Za()
, s = o
, a = t || 50
, l = Math.max(500, 3 * a)
, c = function(e, t) {
var l = Za();
t || l - o > a ? (n = r,
r = e,
s = o,
o = l) : i ? r += e : r = n + (e - n) / (l - s) * (o - s)
};
return {
update: c,
reset: function() {
n = r = i ? 0 : r,
s = o = 0
},
getVelocity: function(e) {
var t = s
, a = n
, u = Za();
return (e || 0 === e) && e !== r && c(e),
o === s || u - s > l ? 0 : (r + (i ? a : -a)) / ((i ? u : o) - t) * 1e3
}
}
}, al = function(e, t) {
return t && !e._gsapAllow && e.preventDefault(),
e.changedTouches ? e.changedTouches[0] : e
}, ll = function(e) {
var t = Math.max.apply(Math, e)
, i = Math.min.apply(Math, e);
return Math.abs(t) >= Math.abs(i) ? t : i
}, cl = function() {
(Ra = Ia.core.globals().ScrollTrigger) && Ra.core && function() {
var e = Ra.core
, t = e.bridge || {}
, i = e._scrollers
, r = e._proxies;
i.push.apply(i, $a),
r.push.apply(r, qa),
$a = i,
qa = r,
Wa = function(e, i) {
return t[e](i)
}
}()
}, ul = function(e) {
return (Ia = e || ja()) && "undefined" != typeof document && document.body && (ka = window,
Pa = document,
Da = Pa.documentElement,
La = Pa.body,
Fa = [ka, Pa, Da, La],
Ia.utils.clamp,
Oa = "onpointerenter"in La ? "pointer" : "mouse",
Ba = hl.isTouch = ka.matchMedia && ka.matchMedia("(hover: none), (pointer: coarse)").matches ? 1 : "ontouchstart"in ka || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 ? 2 : 0,
Va = hl.eventTypes = ("ontouchstart"in Da ? "touchstart,touchmove,touchcancel,touchend" : "onpointerdown"in Da ? "pointerdown,pointermove,pointercancel,pointerup" : "mousedown,mousemove,mouseup,mouseup").split(","),
setTimeout((function() {
return Na = 0
}
), 500),
cl(),
za = 1),
za
};
il.op = rl,
$a.cache = 0;
var hl = function() {
function e(e) {
this.init(e)
}
var t, i, r;
return e.prototype.init = function(e) {
za || ul(Ia) || console.warn("Please gsap.registerPlugin(Observer)"),
Ra || cl();
var t = e.tolerance
, i = e.dragMinimum
, r = e.type
, n = e.target
, o = e.lineHeight
, s = e.debounce
, a = e.preventDefault
, l = e.onStop
, c = e.onStopDelay
, u = e.ignore
, h = e.wheelSpeed
, d = e.event
, p = e.onDragStart
, f = e.onDragEnd
, m = e.onDrag
, _ = e.onPress
, g = e.onRelease
, y = e.onRight
, x = e.onLeft
, v = e.onUp
, b = e.onDown
, w = e.onChangeX
, T = e.onChangeY
, E = e.onChange
, S = e.onToggleX
, C = e.onToggleY
, M = e.onHover
, A = e.onHoverEnd
, I = e.onMove
, z = e.ignoreCheck
, k = e.isNormalizer
, P = e.onGestureStart
, D = e.onGestureEnd
, L = e.onWheel
, B = e.onEnable
, O = e.onDisable
, R = e.onClick
, F = e.scrollSpeed
, U = e.capture
, V = e.allowClicks
, j = e.lockAxis
, N = e.onLockAxis;
this.target = n = nl(n) || Da,
this.vars = e,
u && (u = Ia.utils.toArray(u)),
t = t || 1e-9,
i = i || 0,
h = h || 1,
F = F || 1,
r = r || "wheel,touch,pointer",
s = !1 !== s,
o || (o = parseFloat(ka.getComputedStyle(La).lineHeight) || 22);
var G, $, q, Z, W, X, H, Y = this, K = 0, J = 0, Q = ol(n, il), ee = ol(n, rl), te = Q(), ie = ee(), re = ~r.indexOf("touch") && !~r.indexOf("pointer") && "pointerdown" === Va[0], ne = Ha(n), oe = n.ownerDocument || Pa, se = [0, 0, 0], ae = [0, 0, 0], le = 0, ce = function() {
return le = Za()
}, ue = function(e, t) {
return (Y.event = e) && u && ~u.indexOf(e.target) || t && re && "touch" !== e.pointerType || z && z(e, t)
}, he = function() {
var e = Y.deltaX = ll(se)
, i = Y.deltaY = ll(ae)
, r = Math.abs(e) >= t
, n = Math.abs(i) >= t;
E && (r || n) && E(Y, e, i, se, ae),
r && (y && Y.deltaX > 0 && y(Y),
x && Y.deltaX < 0 && x(Y),
w && w(Y),
S && Y.deltaX < 0 != K < 0 && S(Y),
K = Y.deltaX,
se[0] = se[1] = se[2] = 0),
n && (b && Y.deltaY > 0 && b(Y),
v && Y.deltaY < 0 && v(Y),
T && T(Y),
C && Y.deltaY < 0 != J < 0 && C(Y),
J = Y.deltaY,
ae[0] = ae[1] = ae[2] = 0),
(Z || q) && (I && I(Y),
q && (m(Y),
q = !1),
Z = !1),
X && !(X = !1) && N && N(Y),
W && (L(Y),
W = !1),
G = 0
}, de = function(e, t, i) {
se[i] += e,
ae[i] += t,
Y._vx.update(e),
Y._vy.update(t),
s ? G || (G = requestAnimationFrame(he)) : he()
}, pe = function(e, t) {
j && !H && (Y.axis = H = Math.abs(e) > Math.abs(t) ? "x" : "y",
X = !0),
"y" !== H && (se[2] += e,
Y._vx.update(e, !0)),
"x" !== H && (ae[2] += t,
Y._vy.update(t, !0)),
s ? G || (G = requestAnimationFrame(he)) : he()
}, fe = function(e) {
if (!ue(e, 1)) {
var t = (e = al(e, a)).clientX
, r = e.clientY
, n = t - Y.x
, o = r - Y.y
, s = Y.isDragging;
Y.x = t,
Y.y = r,
(s || Math.abs(Y.startX - t) >= i || Math.abs(Y.startY - r) >= i) && (m && (q = !0),
s || (Y.isDragging = !0),
pe(n, o),
s || p && p(Y))
}
}, me = Y.onPress = function(e) {
ue(e, 1) || (Y.axis = H = null,
$.pause(),
Y.isPressed = !0,
e = al(e),
K = J = 0,
Y.startX = Y.x = e.clientX,
Y.startY = Y.y = e.clientY,
Y._vx.reset(),
Y._vy.reset(),
Ya(k ? n : oe, Va[1], fe, a, !0),
Y.deltaX = Y.deltaY = 0,
_ && _(Y))
}
, _e = function(e) {
if (!ue(e, 1)) {
Ka(k ? n : oe, Va[1], fe, !0);
var t = Y.isDragging && (Math.abs(Y.x - Y.startX) > 3 || Math.abs(Y.y - Y.startY) > 3)
, i = al(e);
t || (Y._vx.reset(),
Y._vy.reset(),
a && V && Ia.delayedCall(.08, (function() {
if (Za() - le > 300 && !e.defaultPrevented)
if (e.target.click)
e.target.click();
else if (oe.createEvent) {
var t = oe.createEvent("MouseEvents");
t.initMouseEvent("click", !0, !0, ka, 1, i.screenX, i.screenY, i.clientX, i.clientY, !1, !1, !1, !1, 0, null),
e.target.dispatchEvent(t)
}
}
))),
Y.isDragging = Y.isGesturing = Y.isPressed = !1,
l && !k && $.restart(!0),
f && t && f(Y),
g && g(Y, t)
}
}, ge = function(e) {
return e.touches && e.touches.length > 1 && (Y.isGesturing = !0) && P(e, Y.isDragging)
}, ye = function() {
return (Y.isGesturing = !1) || D(Y)
}, xe = function(e) {
if (!ue(e)) {
var t = Q()
, i = ee();
de((t - te) * F, (i - ie) * F, 1),
te = t,
ie = i,
l && $.restart(!0)
}
}, ve = function(e) {
if (!ue(e)) {
e = al(e, a),
L && (W = !0);
var t = (1 === e.deltaMode ? o : 2 === e.deltaMode ? ka.innerHeight : 1) * h;
de(e.deltaX * t, e.deltaY * t, 0),
l && !k && $.restart(!0)
}
}, be = function(e) {
if (!ue(e)) {
var t = e.clientX
, i = e.clientY
, r = t - Y.x
, n = i - Y.y;
Y.x = t,
Y.y = i,
Z = !0,
(r || n) && pe(r, n)
}
}, we = function(e) {
Y.event = e,
M(Y)
}, Te = function(e) {
Y.event = e,
A(Y)
}, Ee = function(e) {
return ue(e) || al(e, a) && R(Y)
};
$ = Y._dc = Ia.delayedCall(c || .25, (function() {
Y._vx.reset(),
Y._vy.reset(),
$.pause(),
l && l(Y)
}
)).pause(),
Y.deltaX = Y.deltaY = 0,
Y._vx = sl(0, 50, !0),
Y._vy = sl(0, 50, !0),
Y.scrollX = Q,
Y.scrollY = ee,
Y.isDragging = Y.isGesturing = Y.isPressed = !1,
Y.enable = function(e) {
return Y.isEnabled || (Ya(ne ? oe : n, "scroll", el),
r.indexOf("scroll") >= 0 && Ya(ne ? oe : n, "scroll", xe, a, U),
r.indexOf("wheel") >= 0 && Ya(n, "wheel", ve, a, U),
(r.indexOf("touch") >= 0 && Ba || r.indexOf("pointer") >= 0) && (Ya(n, Va[0], me, a, U),
Ya(oe, Va[2], _e),
Ya(oe, Va[3], _e),
V && Ya(n, "click", ce, !1, !0),
R && Ya(n, "click", Ee),
P && Ya(oe, "gesturestart", ge),
D && Ya(oe, "gestureend", ye),
M && Ya(n, Oa + "enter", we),
A && Ya(n, Oa + "leave", Te),
I && Ya(n, Oa + "move", be)),
Y.isEnabled = !0,
e && e.type && me(e),
B && B(Y)),
Y
}
,
Y.disable = function() {
Y.isEnabled && (Ga.filter((function(e) {
return e !== Y && Ha(e.target)
}
)).length || Ka(ne ? oe : n, "scroll", el),
Y.isPressed && (Y._vx.reset(),
Y._vy.reset(),
Ka(k ? n : oe, Va[1], fe, !0)),
Ka(ne ? oe : n, "scroll", xe, U),
Ka(n, "wheel", ve, U),
Ka(n, Va[0], me, U),
Ka(oe, Va[2], _e),
Ka(oe, Va[3], _e),
Ka(n, "click", ce, !0),
Ka(n, "click", Ee),
Ka(oe, "gesturestart", ge),
Ka(oe, "gestureend", ye),
Ka(n, Oa + "enter", we),
Ka(n, Oa + "leave", Te),
Ka(n, Oa + "move", be),
Y.isEnabled = Y.isPressed = Y.isDragging = !1,
O && O(Y))
}
,
Y.kill = function() {
Y.disable();
var e = Ga.indexOf(Y);
e >= 0 && Ga.splice(e, 1),
Ua === Y && (Ua = 0)
}
,
Ga.push(Y),
k && Ha(n) && (Ua = Y),
Y.enable(d)
}
,
t = e,
(i = [{
key: "velocityX",
get: function() {
return this._vx.getVelocity()
}
}, {
key: "velocityY",
get: function() {
return this._vy.getVelocity()
}
}]) && Aa(t.prototype, i),
r && Aa(t, r),
e
}();
hl.version = "3.11.3",
hl.create = function(e) {
return new hl(e)
}
,
hl.register = ul,
hl.getAll = function() {
return Ga.slice()
}
,
hl.getById = function(e) {
return Ga.filter((function(t) {
return t.vars.id === e
}
))[0]
}
,
ja() && Ia.registerPlugin(hl);
var dl, pl, fl, ml, _l, gl, yl, xl, vl, bl, wl, Tl, El, Sl, Cl, Ml, Al, Il, zl, kl, Pl, Dl, Ll, Bl, Ol, Rl, Fl, Ul, Vl, jl, Nl, Gl, $l, ql, Zl = 1, Wl = Date.now, Xl = Wl(), Hl = 0, Yl = 0, Kl = function() {
return Sl = 1
}, Jl = function() {
return Sl = 0
}, Ql = function(e) {
return e
}, ec = function(e) {
return Math.round(1e5 * e) / 1e5 || 0
}, tc = function() {
return "undefined" != typeof window
}, ic = function() {
return dl || tc() && (dl = window.gsap) && dl.registerPlugin && dl
}, rc = function(e) {
return !!~yl.indexOf(e)
}, nc = function(e) {
return Xa(e, "getBoundingClientRect") || (rc(e) ? function() {
return uu.width = fl.innerWidth,
uu.height = fl.innerHeight,
uu
}
: function() {
return Sc(e)
}
)
}, oc = function(e, t) {
var i = t.s
, r = t.d2
, n = t.d
, o = t.a;
return (i = "scroll" + r) && (o = Xa(e, i)) ? o() - nc(e)()[n] : rc(e) ? (_l[i] || gl[i]) - (fl["inner" + r] || _l["client" + r] || gl["client" + r]) : e[i] - e["offset" + r]
}, sc = function(e, t) {
for (var i = 0; i < zl.length; i += 3)
(!t || ~t.indexOf(zl[i + 1])) && e(zl[i], zl[i + 1], zl[i + 2])
}, ac = function(e) {
return "string" == typeof e
}, lc = function(e) {
return "function" == typeof e
}, cc = function(e) {
return "number" == typeof e
}, uc = function(e) {
return "object" == typeof e
}, hc = function(e, t, i) {
return e && e.progress(t ? 0 : 1) && i && e.pause()
}, dc = function(e, t) {
if (e.enabled) {
var i = t(e);
i && i.totalTime && (e.callbackAnimation = i)
}
}, pc = Math.abs, fc = "left", mc = "right", _c = "bottom", gc = "width", yc = "height", xc = "padding", vc = "margin", bc = "Width", wc = "px", Tc = function(e) {
return fl.getComputedStyle(e)
}, Ec = function(e, t) {
for (var i in t)
i in e || (e[i] = t[i]);
return e
}, Sc = function(e, t) {
var i = t && "matrix(1, 0, 0, 1, 0, 0)" !== Tc(e)[Cl] && dl.to(e, {
x: 0,
y: 0,
xPercent: 0,
yPercent: 0,
rotation: 0,
rotationX: 0,
rotationY: 0,
scale: 1,
skewX: 0,
skewY: 0
}).progress(1)
, r = e.getBoundingClientRect();
return i && i.progress(0).kill(),
r
}, Cc = function(e, t) {
var i = t.d2;
return e["offset" + i] || e["client" + i] || 0
}, Mc = function(e) {
var t, i = [], r = e.labels, n = e.duration();
for (t in r)
i.push(r[t] / n);
return i
}, Ac = function(e) {
var t = dl.utils.snap(e)
, i = Array.isArray(e) && e.slice(0).sort((function(e, t) {
return e - t
}
));
return i ? function(e, r, n) {
var o;
if (void 0 === n && (n = .001),
!r)
return t(e);
if (r > 0) {
for (e -= n,
o = 0; o < i.length; o++)
if (i[o] >= e)
return i[o];
return i[o - 1]
}
for (o = i.length,
e += n; o--; )
if (i[o] <= e)
return i[o];
return i[0]
}
: function(i, r, n) {
void 0 === n && (n = .001);
var o = t(i);
return !r || Math.abs(o - i) < n || o - i < 0 == r < 0 ? o : t(r < 0 ? i - e : i + e)
}
}, Ic = function(e, t, i, r) {
return i.split(",").forEach((function(i) {
return e(t, i, r)
}
))
}, zc = function(e, t, i, r, n) {
return e.addEventListener(t, i, {
passive: !r,
capture: !!n
})
}, kc = function(e, t, i, r) {
return e.removeEventListener(t, i, !!r)
}, Pc = function(e, t, i) {
return i && i.wheelHandler && e(t, "wheel", i)
}, Dc = {
startColor: "green",
endColor: "red",
indent: 0,
fontSize: "16px",
fontWeight: "normal"
}, Lc = {
toggleActions: "play",
anticipatePin: 0
}, Bc = {
top: 0,
left: 0,
center: .5,
bottom: 1,
right: 1
}, Oc = function(e, t) {
if (ac(e)) {
var i = e.indexOf("=")
, r = ~i ? +(e.charAt(i - 1) + 1) * parseFloat(e.substr(i + 1)) : 0;
~i && (e.indexOf("%") > i && (r *= t / 100),
e = e.substr(0, i - 1)),
e = r + (e in Bc ? Bc[e] * t : ~e.indexOf("%") ? parseFloat(e) * t / 100 : parseFloat(e) || 0)
}
return e
}, Rc = function(e, t, i, r, n, o, s, a) {
var l = n.startColor
, c = n.endColor
, u = n.fontSize
, h = n.indent
, d = n.fontWeight
, p = ml.createElement("div")
, f = rc(i) || "fixed" === Xa(i, "pinType")
, m = -1 !== e.indexOf("scroller")
, _ = f ? gl : i
, g = -1 !== e.indexOf("start")
, y = g ? l : c
, x = "border-color:" + y + ";font-size:" + u + ";color:" + y + ";font-weight:" + d + ";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";
return x += "position:" + ((m || a) && f ? "fixed;" : "absolute;"),
(m || a || !f) && (x += (r === rl ? mc : _c) + ":" + (o + parseFloat(h)) + "px;"),
s && (x += "box-sizing:border-box;text-align:left;width:" + s.offsetWidth + "px;"),
p._isStart = g,
p.setAttribute("class", "gsap-marker-" + e + (t ? " marker-" + t : "")),
p.style.cssText = x,
p.innerText = t || 0 === t ? e + "-" + t : e,
_.children[0] ? _.insertBefore(p, _.children[0]) : _.appendChild(p),
p._offset = p["offset" + r.op.d2],
Fc(p, 0, r, g),
p
}, Fc = function(e, t, i, r) {
var n = {
display: "block"
}
, o = i[r ? "os2" : "p2"]
, s = i[r ? "p2" : "os2"];
e._isFlipped = r,
n[i.a + "Percent"] = r ? -100 : 0,
n[i.a] = r ? "1px" : 0,
n["border" + o + bc] = 1,
n["border" + s + bc] = 0,
n[i.p] = t + "px",
dl.set(e, n)
}, Uc = [], Vc = {}, jc = function() {
return Wl() - Hl > 34 && (Nl || (Nl = requestAnimationFrame(ru)))
}, Nc = function() {
(!Ll || !Ll.isPressed || Ll.startX > gl.clientWidth) && ($a.cache++,
Ll ? Nl || (Nl = requestAnimationFrame(ru)) : ru(),
Hl || Xc("scrollStart"),
Hl = Wl())
}, Gc = function() {
Rl = fl.innerWidth,
Ol = fl.innerHeight
}, $c = function() {
$a.cache++,
!El && !Dl && !ml.fullscreenElement && !ml.webkitFullscreenElement && (!Bl || Rl !== fl.innerWidth || Math.abs(fl.innerHeight - Ol) > .25 * fl.innerHeight) && xl.restart(!0)
}, qc = {}, Zc = [], Wc = function e() {
return kc(mu, "scrollEnd", e) || eu(!0)
}, Xc = function(e) {
return qc[e] && qc[e].map((function(e) {
return e()
}
)) || Zc
}, Hc = [], Yc = function(e) {
for (var t = 0; t < Hc.length; t += 5)
(!e || Hc[t + 4] && Hc[t + 4].query === e) && (Hc[t].style.cssText = Hc[t + 1],
Hc[t].getBBox && Hc[t].setAttribute("transform", Hc[t + 2] || ""),
Hc[t + 3].uncache = 1)
}, Kc = function(e, t) {
var i;
for (Ml = 0; Ml < Uc.length; Ml++)
!(i = Uc[Ml]) || t && i._ctx !== t || (e ? i.kill(1) : i.revert(!0, !0));
t && Yc(t),
t || Xc("revert")
}, Jc = function(e, t) {
$a.cache++,
(t || !Gl) && $a.forEach((function(e) {
return lc(e) && e.cacheID++ && (e.rec = 0)
}
)),
ac(e) && (fl.history.scrollRestoration = Vl = e)
}, Qc = 0, eu = function(e, t) {
if (!Hl || e) {
Gl = mu.isRefreshing = !0,
$a.forEach((function(e) {
return lc(e) && e.cacheID++ && (e.rec = e())
}
));
var i = Xc("refreshInit");
kl && mu.sort(),
t || Kc(),
$a.forEach((function(e) {
lc(e) && (e.smooth && (e.target.style.scrollBehavior = "auto"),
e(0))
}
)),
Uc.slice(0).forEach((function(e) {
return e.refresh()
}
)),
Uc.forEach((function(e, t) {
if (e._subPinOffset && e.pin) {
var i = e.vars.horizontal ? "offsetWidth" : "offsetHeight"
, r = e.pin[i];
e.revert(!0, 1),
e.adjustPinSpacing(e.pin[i] - r),
e.revert(!1, 1)
}
}
)),
Uc.forEach((function(e) {
return "max" === e.vars.end && e.setPositions(e.start, Math.max(e.start + 1, oc(e.scroller, e._dir)))
}
)),
i.forEach((function(e) {
return e && e.render && e.render(-1)
}
)),
$a.forEach((function(e) {
lc(e) && (e.smooth && requestAnimationFrame((function() {
return e.target.style.scrollBehavior = "smooth"
}
)),
e.rec && e(e.rec))
}
)),
Jc(Vl, 1),
xl.pause(),
Qc++,
ru(2),
Uc.forEach((function(e) {
return lc(e.vars.onRefresh) && e.vars.onRefresh(e)
}
)),
Gl = mu.isRefreshing = !1,
Xc("refresh")
} else
zc(mu, "scrollEnd", Wc)
}, tu = 0, iu = 1, ru = function(e) {
if (!Gl || 2 === e) {
mu.isUpdating = !0,
ql && ql.update(0);
var t = Uc.length
, i = Wl()
, r = i - Xl >= 50
, n = t && Uc[0].scroll();
if (iu = tu > n ? -1 : 1,
tu = n,
r && (Hl && !Sl && i - Hl > 200 && (Hl = 0,
Xc("scrollEnd")),
wl = Xl,
Xl = i),
iu < 0) {
for (Ml = t; Ml-- > 0; )
Uc[Ml] && Uc[Ml].update(0, r);
iu = 1
} else
for (Ml = 0; Ml < t; Ml++)
Uc[Ml] && Uc[Ml].update(0, r);
mu.isUpdating = !1
}
Nl = 0
}, nu = [fc, "top", _c, mc, "marginBottom", "marginRight", "marginTop", "marginLeft", "display", "flexShrink", "float", "zIndex", "gridColumnStart", "gridColumnEnd", "gridRowStart", "gridRowEnd", "gridArea", "justifySelf", "alignSelf", "placeSelf", "order"], ou = nu.concat([gc, yc, "boxSizing", "maxWidth", "maxHeight", "position", vc, xc, "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"]), su = function(e, t, i, r) {
if (!e._gsap.swappedIn) {
for (var n, o = nu.length, s = t.style, a = e.style; o--; )
s[n = nu[o]] = i[n];
s.position = "absolute" === i.position ? "absolute" : "relative",
"inline" === i.display && (s.display = "inline-block"),
a.bottom = a.right = "auto",
s.flexBasis = i.flexBasis || "auto",
s.overflow = "visible",
s.boxSizing = "border-box",
s.width = Cc(e, il) + wc,
s.height = Cc(e, rl) + wc,
s.padding = a.margin = a.top = a.left = "0",
lu(r),
a.width = a.maxWidth = i.width,
a.height = a.maxHeight = i.height,
a.padding = i.padding,
e.parentNode !== t && (e.parentNode.insertBefore(t, e),
t.appendChild(e)),
e._gsap.swappedIn = !0
}
}, au = /([A-Z])/g, lu = function(e) {
if (e) {
var t, i, r = e.t.style, n = e.length, o = 0;
for ((e.t._gsap || dl.core.getCache(e.t)).uncache = 1; o < n; o += 2)
i = e[o + 1],
t = e[o],
i ? r[t] = i : r[t] && r.removeProperty(t.replace(au, "-$1").toLowerCase())
}
}, cu = function(e) {
for (var t = ou.length, i = e.style, r = [], n = 0; n < t; n++)
r.push(ou[n], i[ou[n]]);
return r.t = e,
r
}, uu = {
left: 0,
top: 0
}, hu = function(e, t, i, r, n, o, s, a, l, c, u, h, d) {
lc(e) && (e = e(a)),
ac(e) && "max" === e.substr(0, 3) && (e = h + ("=" === e.charAt(4) ? Oc("0" + e.substr(3), i) : 0));
var p, f, m, _ = d ? d.time() : 0;
if (d && d.seek(0),
cc(e))
s && Fc(s, i, r, !0);
else {
lc(t) && (t = t(a));
var g, y, x, v, b = (e || "0").split(" ");
m = nl(t) || gl,
(g = Sc(m) || {}) && (g.left || g.top) || "none" !== Tc(m).display || (v = m.style.display,
m.style.display = "block",
g = Sc(m),
v ? m.style.display = v : m.style.removeProperty("display")),
y = Oc(b[0], g[r.d]),
x = Oc(b[1] || "0", i),
e = g[r.p] - l[r.p] - c + y + n - x,
s && Fc(s, x, r, i - x < 20 || s._isStart && x > 20),
i -= i - x
}
if (o) {
var w = e + i
, T = o._isStart;
p = "scroll" + r.d2,
Fc(o, w, r, T && w > 20 || !T && (u ? Math.max(gl[p], _l[p]) : o.parentNode[p]) <= w + 1),
u && (l = Sc(s),
u && (o.style[r.op.p] = l[r.op.p] - r.op.m - o._offset + wc))
}
return d && m && (p = Sc(m),
d.seek(h),
f = Sc(m),
d._caScrollDist = p[r.p] - f[r.p],
e = e / d._caScrollDist * h),
d && d.seek(_),
d ? e : Math.round(e)
}, du = /(webkit|moz|length|cssText|inset)/i, pu = function(e, t, i, r) {
if (e.parentNode !== t) {
var n, o, s = e.style;
if (t === gl) {
for (n in e._stOrig = s.cssText,
o = Tc(e))
+n || du.test(n) || !o[n] || "string" != typeof s[n] || "0" === n || (s[n] = o[n]);
s.top = i,
s.left = r
} else
s.cssText = e._stOrig;
dl.core.getCache(e).uncache = 1,
t.appendChild(e)
}
}, fu = function(e, t) {
var i, r, n = ol(e, t), o = "_scroll" + t.p2, s = function t(s, a, l, c, u) {
var h = t.tween
, d = a.onComplete
, p = {};
return l = l || n(),
u = c && u || 0,
c = c || s - l,
h && h.kill(),
i = Math.round(l),
a[o] = s,
a.modifiers = p,
p[o] = function(e) {
return (e = Math.round(n())) !== i && e !== r && Math.abs(e - i) > 3 && Math.abs(e - r) > 3 ? (h.kill(),
t.tween = 0) : e = l + c * h.ratio + u * h.ratio * h.ratio,
r = i,
i = Math.round(e)
}
,
a.onComplete = function() {
t.tween = 0,
d && d.call(h)
}
,
h = t.tween = dl.to(e, a)
};
return e[o] = n,
n.wheelHandler = function() {
return s.tween && s.tween.kill() && (s.tween = 0)
}
,
zc(e, "wheel", n.wheelHandler),
s
}, mu = function() {
function e(t, i) {
pl || e.register(dl) || console.warn("Please gsap.registerPlugin(ScrollTrigger)"),
this.init(t, i)
}
return e.prototype.init = function(t, i) {
if (this.progress = this.start = 0,
this.vars && this.kill(!0, !0),
Yl) {
var r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E, S, C, M, A, I, z, k, P, D, L, B, O, R, F, U, V, j, N, G, $ = t = Ec(ac(t) || cc(t) || t.nodeType ? {
trigger: t
} : t, Lc), q = $.onUpdate, Z = $.toggleClass, W = $.id, X = $.onToggle, H = $.onRefresh, Y = $.scrub, K = $.trigger, J = $.pin, Q = $.pinSpacing, ee = $.invalidateOnRefresh, te = $.anticipatePin, ie = $.onScrubComplete, re = $.onSnapComplete, ne = $.once, oe = $.snap, se = $.pinReparent, ae = $.pinSpacer, le = $.containerAnimation, ce = $.fastScrollEnd, ue = $.preventOverlaps, he = t.horizontal || t.containerAnimation && !1 !== t.horizontal ? il : rl, de = !Y && 0 !== Y, pe = nl(t.scroller || fl), fe = dl.core.getCache(pe), me = rc(pe), _e = "fixed" === ("pinType"in t ? t.pinType : Xa(pe, "pinType") || me && "fixed"), ge = [t.onEnter, t.onLeave, t.onEnterBack, t.onLeaveBack], ye = de && t.toggleActions.split(" "), xe = "markers"in t ? t.markers : Lc.markers, ve = me ? 0 : parseFloat(Tc(pe)["border" + he.p2 + bc]) || 0, be = this, we = t.onRefreshInit && function() {
return t.onRefreshInit(be)
}
, Te = function(e, t, i) {
var r = i.d
, n = i.d2
, o = i.a;
return (o = Xa(e, "getBoundingClientRect")) ? function() {
return o()[r]
}
: function() {
return (t ? fl["inner" + n] : e["client" + n]) || 0
}
}(pe, me, he), Ee = function(e, t) {
return !t || ~qa.indexOf(e) ? nc(e) : function() {
return uu
}
}(pe, me), Se = 0, Ce = 0, Me = ol(pe, he);
if (Ul(be),
be._dir = he,
te *= 45,
be.scroller = pe,
be.scroll = le ? le.time.bind(le) : Me,
s = Me(),
be.vars = t,
i = i || t.animation,
"refreshPriority"in t && (kl = 1,
-9999 === t.refreshPriority && (ql = be)),
fe.tweenScroll = fe.tweenScroll || {
top: fu(pe, rl),
left: fu(pe, il)
},
be.tweenTo = r = fe.tweenScroll[he.p],
be.scrubDuration = function(e) {
(D = cc(e) && e) ? P ? P.duration(e) : P = dl.to(i, {
ease: "expo",
totalProgress: "+=0.001",
duration: D,
paused: !0,
onComplete: function() {
return ie && ie(be)
}
}) : (P && P.progress(1).kill(),
P = 0)
}
,
i && (i.vars.lazy = !1,
i._initted || !1 !== i.vars.immediateRender && !1 !== t.immediateRender && i.duration() && i.render(0, !0, !0),
be.animation = i.pause(),
i.scrollTrigger = be,
be.scrubDuration(Y),
z = 0,
W || (W = i.vars.id)),
Uc.push(be),
oe && (uc(oe) && !oe.push || (oe = {
snapTo: oe
}),
"scrollBehavior"in gl.style && dl.set(me ? [gl, _l] : pe, {
scrollBehavior: "auto"
}),
$a.forEach((function(e) {
return lc(e) && e.target === (me ? ml.scrollingElement || _l : pe) && (e.smooth = !1)
}
)),
o = lc(oe.snapTo) ? oe.snapTo : "labels" === oe.snapTo ? function(e) {
return function(t) {
return dl.utils.snap(Mc(e), t)
}
}(i) : "labelsDirectional" === oe.snapTo ? (j = i,
function(e, t) {
return Ac(Mc(j))(e, t.direction)
}
) : !1 !== oe.directional ? function(e, t) {
return Ac(oe.snapTo)(e, Wl() - Ce < 500 ? 0 : t.direction)
}
: dl.utils.snap(oe.snapTo),
L = oe.duration || {
min: .1,
max: 2
},
L = uc(L) ? bl(L.min, L.max) : bl(L, L),
B = dl.delayedCall(oe.delay || D / 2 || .1, (function() {
var e = Me()
, t = Wl() - Ce < 500
, n = r.tween;
if (!(t || Math.abs(be.getVelocity()) < 10) || n || Sl || Se === e)
be.isActive && Se !== e && B.restart(!0);
else {
var s = (e - l) / m
, a = i && !de ? i.totalProgress() : s
, u = t ? 0 : (a - k) / (Wl() - wl) * 1e3 || 0
, h = dl.utils.clamp(-s, 1 - s, pc(u / 2) * u / .185)
, d = s + (!1 === oe.inertia ? 0 : h)
, p = bl(0, 1, o(d, be))
, f = Math.round(l + p * m)
, _ = oe
, g = _.onStart
, y = _.onInterrupt
, x = _.onComplete;
if (e <= c && e >= l && f !== e) {
if (n && !n._initted && n.data <= pc(f - e))
return;
!1 === oe.inertia && (h = p - s),
r(f, {
duration: L(pc(.185 * Math.max(pc(d - a), pc(p - a)) / u / .05 || 0)),
ease: oe.ease || "power3",
data: pc(f - e),
onInterrupt: function() {
return B.restart(!0) && y && y(be)
},
onComplete: function() {
be.update(),
Se = Me(),
z = k = i && !de ? i.totalProgress() : be.progress,
re && re(be),
x && x(be)
}
}, e, h * m, f - e - h * m),
g && g(be, r.tween)
}
}
}
)).pause()),
W && (Vc[W] = be),
(V = (K = be.trigger = nl(K || J)) && K._gsap && K._gsap.stRevert) && (V = V(be)),
J = !0 === J ? K : nl(J),
ac(Z) && (Z = {
targets: K,
className: Z
}),
J && (!1 === Q || Q === vc || (Q = !(!Q && J.parentNode && J.parentNode.style && "flex" === Tc(J.parentNode).display) && xc),
be.pin = J,
(n = dl.core.getCache(J)).spacer ? _ = n.pinState : (ae && ((ae = nl(ae)) && !ae.nodeType && (ae = ae.current || ae.nativeElement),
n.spacerIsNative = !!ae,
ae && (n.spacerState = cu(ae))),
n.spacer = x = ae || ml.createElement("div"),
x.classList.add("pin-spacer"),
W && x.classList.add("pin-spacer-" + W),
n.pinState = _ = cu(J)),
!1 !== t.force3D && dl.set(J, {
force3D: !0
}),
be.spacer = x = n.spacer,
I = Tc(J),
S = I[Q + he.os2],
b = dl.getProperty(J),
w = dl.quickSetter(J, he.a, wc),
su(J, x, I),
y = cu(J)),
xe) {
f = uc(xe) ? Ec(xe, Dc) : Dc,
d = Rc("scroller-start", W, pe, he, f, 0),
p = Rc("scroller-end", W, pe, he, f, 0, d),
v = d["offset" + he.op.d2];
var Ae = nl(Xa(pe, "content") || pe);
u = this.markerStart = Rc("start", W, Ae, he, f, v, 0, le),
h = this.markerEnd = Rc("end", W, Ae, he, f, v, 0, le),
le && (U = dl.quickSetter([u, h], he.a, wc)),
_e || qa.length && !0 === Xa(pe, "fixedMarkers") || (G = Tc(N = me ? gl : pe).position,
N.style.position = "absolute" === G || "fixed" === G ? G : "relative",
dl.set([d, p], {
force3D: !0
}),
M = dl.quickSetter(d, he.a, wc),
A = dl.quickSetter(p, he.a, wc))
}
if (le) {
var Ie = le.vars.onUpdate
, ze = le.vars.onUpdateParams;
le.eventCallback("onUpdate", (function() {
be.update(0, 0, 1),
Ie && Ie.apply(ze || [])
}
))
}
be.previous = function() {
return Uc[Uc.indexOf(be) - 1]
}
,
be.next = function() {
return Uc[Uc.indexOf(be) + 1]
}
,
be.revert = function(e, t) {
if (!t)
return be.kill(!0);
var r = !1 !== e || !be.enabled
, n = El;
r !== be.isReverted && (r && (R = Math.max(Me(), be.scroll.rec || 0),
O = be.progress,
F = i && i.progress()),
u && [u, h, d, p].forEach((function(e) {
return e.style.display = r ? "none" : "block"
}
)),
r && (El = 1,
be.update(r)),
J && (r ? function(e, t, i) {
lu(i);
var r = e._gsap;
if (r.spacerIsNative)
lu(r.spacerState);
else if (e._gsap.swappedIn) {
var n = t.parentNode;
n && (n.insertBefore(e, t),
n.removeChild(t))
}
e._gsap.swappedIn = !1
}(J, x, _) : (!se || !be.isActive) && su(J, x, Tc(J), C)),
r || be.update(r),
El = n,
be.isReverted = r)
}
,
be.refresh = function(n, o) {
if (!El && be.enabled || o)
if (J && n && Hl)
zc(e, "scrollEnd", Wc);
else {
!Gl && we && we(be),
El = 1,
Ce = Wl(),
r.tween && (r.tween.kill(),
r.tween = 0),
P && P.pause(),
ee && i && i.revert({
kill: !1
}).invalidate(),
be.isReverted || be.revert(!0, !0),
be._subPinOffset = !1;
for (var f, v, w, S, M, A, I, z, k, D, L = Te(), U = Ee(), V = le ? le.duration() : oc(pe, he), j = 0, N = 0, G = t.end, $ = t.endTrigger || K, q = t.start || (0 !== t.start && K ? J ? "0 0" : "0 100%" : 0), Z = be.pinnedContainer = t.pinnedContainer && nl(t.pinnedContainer), W = K && Math.max(0, Uc.indexOf(be)) || 0, X = W; X--; )
(A = Uc[X]).end || A.refresh(0, 1) || (El = 1),
!(I = A.pin) || I !== K && I !== J || A.isReverted || (D || (D = []),
D.unshift(A),
A.revert(!0, !0)),
A !== Uc[X] && (W--,
X--);
for (lc(q) && (q = q(be)),
l = hu(q, K, L, he, Me(), u, d, be, U, ve, _e, V, le) || (J ? -.001 : 0),
lc(G) && (G = G(be)),
ac(G) && !G.indexOf("+=") && (~G.indexOf(" ") ? G = (ac(q) ? q.split(" ")[0] : "") + G : (j = Oc(G.substr(2), L),
G = ac(q) ? q : l + j,
$ = K)),
c = Math.max(l, hu(G || ($ ? "100% 0" : V), $, L, he, Me() + j, h, p, be, U, ve, _e, V, le)) || -.001,
m = c - l || (l -= .01) && .001,
j = 0,
X = W; X--; )
(I = (A = Uc[X]).pin) && A.start - A._pinPush <= l && !le && A.end > 0 && (f = A.end - A.start,
(I === K && A.start - A._pinPush < l || I === Z) && !cc(q) && (j += f * (1 - A.progress)),
I === J && (N += f));
if (l += j,
c += j,
be._pinPush = N,
u && j && ((f = {})[he.a] = "+=" + j,
Z && (f[he.p] = "-=" + Me()),
dl.set([u, h], f)),
J)
f = Tc(J),
S = he === rl,
w = Me(),
T = parseFloat(b(he.a)) + N,
!V && c > 1 && ((me ? gl : pe).style["overflow-" + he.a] = "scroll"),
su(J, x, f),
y = cu(J),
v = Sc(J, !0),
z = _e && ol(pe, S ? il : rl)(),
Q && ((C = [Q + he.os2, m + N + wc]).t = x,
(X = Q === xc ? Cc(J, he) + m + N : 0) && C.push(he.d, X + wc),
lu(C),
Z && Uc.forEach((function(e) {
e.pin === Z && !1 !== e.vars.pinSpacing && (e._subPinOffset = !0)
}
)),
_e && Me(R)),
_e && ((M = {
top: v.top + (S ? w - l : z) + wc,
left: v.left + (S ? z : w - l) + wc,
boxSizing: "border-box",
position: "fixed"
}).width = M.maxWidth = Math.ceil(v.width) + wc,
M.height = M.maxHeight = Math.ceil(v.height) + wc,
M.margin = M.marginTop = M.marginRight = M.marginBottom = M.marginLeft = "0",
M.padding = f.padding,
M.paddingTop = f.paddingTop,
M.paddingRight = f.paddingRight,
M.paddingBottom = f.paddingBottom,
M.paddingLeft = f.paddingLeft,
g = function(e, t, i) {
for (var r, n = [], o = e.length, s = i ? 8 : 0; s < o; s += 2)
r = e[s],
n.push(r, r in t ? t[r] : e[s + 1]);
return n.t = e.t,
n
}(_, M, se),
Gl && Me(0)),
i ? (k = i._initted,
Pl(1),
i.render(i.duration(), !0, !0),
E = b(he.a) - T + m + N,
m !== E && _e && g.splice(g.length - 2, 2),
i.render(0, !0, !0),
k || i.invalidate(!0),
i.parent || i.totalTime(i.totalTime()),
Pl(0)) : E = m;
else if (K && Me() && !le)
for (v = K.parentNode; v && v !== gl; )
v._pinOffset && (l -= v._pinOffset,
c -= v._pinOffset),
v = v.parentNode;
D && D.forEach((function(e) {
return e.revert(!1, !0)
}
)),
be.start = l,
be.end = c,
s = a = Gl ? R : Me(),
le || Gl || (s < R && Me(R),
be.scroll.rec = 0),
be.revert(!1, !0),
B && (Se = -1,
be.isActive && Me(l + m * O),
B.restart(!0)),
El = 0,
i && de && (i._initted || F) && i.progress() !== F && i.progress(F, !0).render(i.time(), !0, !0),
(O !== be.progress || le) && (i && !de && i.totalProgress(O, !0),
be.progress = (s - l) / m === O ? 0 : O),
J && Q && (x._pinOffset = Math.round(be.progress * E)),
H && !Gl && H(be)
}
}
,
be.getVelocity = function() {
return (Me() - a) / (Wl() - wl) * 1e3 || 0
}
,
be.endAnimation = function() {
hc(be.callbackAnimation),
i && (P ? P.progress(1) : i.paused() ? de || hc(i, be.direction < 0, 1) : hc(i, i.reversed()))
}
,
be.labelToScroll = function(e) {
return i && i.labels && (l || be.refresh() || l) + i.labels[e] / i.duration() * m || 0
}
,
be.getTrailing = function(e) {
var t = Uc.indexOf(be)
, i = be.direction > 0 ? Uc.slice(0, t).reverse() : Uc.slice(t + 1);
return (ac(e) ? i.filter((function(t) {
return t.vars.preventOverlaps === e
}
)) : i).filter((function(e) {
return be.direction > 0 ? e.end <= l : e.start >= c
}
))
}
,
be.update = function(e, t, n) {
if (!le || n || e) {
var o, u, h, p, f, _, v, b = Gl ? R : be.scroll(), C = e ? 0 : (b - l) / m, I = C < 0 ? 0 : C > 1 ? 1 : C || 0, D = be.progress;
if (t && (a = s,
s = le ? Me() : b,
oe && (k = z,
z = i && !de ? i.totalProgress() : I)),
te && !I && J && !El && !Zl && Hl && l < b + (b - a) / (Wl() - wl) * te && (I = 1e-4),
I !== D && be.enabled) {
if (p = (f = (o = be.isActive = !!I && I < 1) !== (!!D && D < 1)) || !!I != !!D,
be.direction = I > D ? 1 : -1,
be.progress = I,
p && !El && (u = I && !D ? 0 : 1 === I ? 1 : 1 === D ? 2 : 3,
de && (h = !f && "none" !== ye[u + 1] && ye[u + 1] || ye[u],
v = i && ("complete" === h || "reset" === h || h in i))),
ue && (f || v) && (v || Y || !i) && (lc(ue) ? ue(be) : be.getTrailing(ue).forEach((function(e) {
return e.endAnimation()
}
))),
de || (!P || El || Zl ? i && i.totalProgress(I, !!El) : ((le || ql && ql !== be) && P.render(P._dp._time - P._start),
P.resetTo ? P.resetTo("totalProgress", I, i._tTime / i._tDur) : (P.vars.totalProgress = I,
P.invalidate().restart()))),
J)
if (e && Q && (x.style[Q + he.os2] = S),
_e) {
if (p) {
if (_ = !e && I > D && c + 1 > b && b + 1 >= oc(pe, he),
se)
if (e || !o && !_)
pu(J, x);
else {
var L = Sc(J, !0)
, O = b - l;
pu(J, gl, L.top + (he === rl ? O : 0) + wc, L.left + (he === rl ? 0 : O) + wc)
}
lu(o || _ ? g : y),
E !== m && I < 1 && o || w(T + (1 !== I || _ ? 0 : E))
}
} else
w(ec(T + E * I));
oe && !r.tween && !El && !Zl && B.restart(!0),
Z && (f || ne && I && (I < 1 || !jl)) && vl(Z.targets).forEach((function(e) {
return e.classList[o || ne ? "add" : "remove"](Z.className)
}
)),
q && !de && !e && q(be),
p && !El ? (de && (v && ("complete" === h ? i.pause().totalProgress(1) : "reset" === h ? i.restart(!0).pause() : "restart" === h ? i.restart(!0) : i[h]()),
q && q(be)),
!f && jl || (X && f && dc(be, X),
ge[u] && dc(be, ge[u]),
ne && (1 === I ? be.kill(!1, 1) : ge[u] = 0),
f || ge[u = 1 === I ? 1 : 3] && dc(be, ge[u])),
ce && !o && Math.abs(be.getVelocity()) > (cc(ce) ? ce : 2500) && (hc(be.callbackAnimation),
P ? P.progress(1) : hc(i, "reverse" === h ? 1 : !I, 1))) : de && q && !El && q(be)
}
if (A) {
var F = le ? b / le.duration() * (le._caScrollDist || 0) : b;
M(F + (d._isFlipped ? 1 : 0)),
A(F)
}
U && U(-b / le.duration() * (le._caScrollDist || 0))
}
}
,
be.enable = function(t, i) {
be.enabled || (be.enabled = !0,
zc(pe, "resize", $c),
zc(me ? ml : pe, "scroll", Nc),
we && zc(e, "refreshInit", we),
!1 !== t && (be.progress = O = 0,
s = a = Se = Me()),
!1 !== i && be.refresh())
}
,
be.getTween = function(e) {
return e && r ? r.tween : P
}
,
be.setPositions = function(e, t) {
J && (T += e - l,
E += t - e - m,
Q === xc && be.adjustPinSpacing(t - e - m)),
be.start = l = e,
be.end = c = t,
m = t - e,
be.update()
}
,
be.adjustPinSpacing = function(e) {
if (C) {
var t = C.indexOf(he.d) + 1;
C[t] = parseFloat(C[t]) + e + wc,
C[1] = parseFloat(C[1]) + e + wc,
lu(C)
}
}
,
be.disable = function(t, i) {
if (be.enabled && (!1 !== t && be.revert(!0, !0),
be.enabled = be.isActive = !1,
i || P && P.pause(),
R = 0,
n && (n.uncache = 1),
we && kc(e, "refreshInit", we),
B && (B.pause(),
r.tween && r.tween.kill() && (r.tween = 0)),
!me)) {
for (var o = Uc.length; o--; )
if (Uc[o].scroller === pe && Uc[o] !== be)
return;
kc(pe, "resize", $c),
kc(pe, "scroll", Nc)
}
}
,
be.kill = function(e, r) {
be.disable(e, r),
P && !r && P.kill(),
W && delete Vc[W];
var o = Uc.indexOf(be);
o >= 0 && Uc.splice(o, 1),
o === Ml && iu > 0 && Ml--,
o = 0,
Uc.forEach((function(e) {
return e.scroller === be.scroller && (o = 1)
}
)),
o || Gl || (be.scroll.rec = 0),
i && (i.scrollTrigger = null,
e && i.revert({
kill: !1
}),
r || i.kill()),
u && [u, h, d, p].forEach((function(e) {
return e.parentNode && e.parentNode.removeChild(e)
}
)),
ql === be && (ql = 0),
J && (n && (n.uncache = 1),
o = 0,
Uc.forEach((function(e) {
return e.pin === J && o++
}
)),
o || (n.spacer = 0)),
t.onKill && t.onKill(be)
}
,
be.enable(!1, !1),
V && V(be),
i && i.add && !m ? dl.delayedCall(.01, (function() {
return l || c || be.refresh()
}
)) && (m = .01) && (l = c = 0) : be.refresh(),
J && function() {
if ($l !== Qc) {
var e = $l = Qc;
requestAnimationFrame((function() {
return e === Qc && eu(!0)
}
))
}
}()
} else
this.update = this.refresh = this.kill = Ql
}
,
e.register = function(t) {
return pl || (dl = t || ic(),
tc() && window.document && e.enable(),
pl = Yl),
pl
}
,
e.defaults = function(e) {
if (e)
for (var t in e)
Lc[t] = e[t];
return Lc
}
,
e.disable = function(e, t) {
Yl = 0,
Uc.forEach((function(i) {
return i[t ? "kill" : "disable"](e)
}
)),
kc(fl, "wheel", Nc),
kc(ml, "scroll", Nc),
clearInterval(Tl),
kc(ml, "touchcancel", Ql),
kc(gl, "touchstart", Ql),
Ic(kc, ml, "pointerdown,touchstart,mousedown", Kl),
Ic(kc, ml, "pointerup,touchend,mouseup", Jl),
xl.kill(),
sc(kc);
for (var i = 0; i < $a.length; i += 3)
Pc(kc, $a[i], $a[i + 1]),
Pc(kc, $a[i], $a[i + 2])
}
,
e.enable = function() {
if (fl = window,
ml = document,
_l = ml.documentElement,
gl = ml.body,
dl && (vl = dl.utils.toArray,
bl = dl.utils.clamp,
Ul = dl.core.context || Ql,
Pl = dl.core.suppressOverwrites || Ql,
Vl = fl.history.scrollRestoration || "auto",
dl.core.globals("ScrollTrigger", e),
gl)) {
Yl = 1,
hl.register(dl),
e.isTouch = hl.isTouch,
Fl = hl.isTouch && /(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),
zc(fl, "wheel", Nc),
yl = [fl, ml, _l, gl],
dl.matchMedia ? (e.matchMedia = function(e) {
var t, i = dl.matchMedia();
for (t in e)
i.add(t, e[t]);
return i
}
,
dl.addEventListener("matchMediaInit", (function() {
return Kc()
}
)),
dl.addEventListener("matchMediaRevert", (function() {
return Yc()
}
)),
dl.addEventListener("matchMedia", (function() {
eu(0, 1),
Xc("matchMedia")
}
)),
dl.matchMedia("(orientation: portrait)", (function() {
return Gc(),
Gc
}
))) : console.warn("Requires GSAP 3.11.0 or later"),
Gc(),
zc(ml, "scroll", Nc);
var t, i, r = gl.style, n = r.borderTopStyle, o = dl.core.Animation.prototype;
for (o.revert || Object.defineProperty(o, "revert", {
value: function() {
return this.time(-.01, !0)
}
}),
r.borderTopStyle = "solid",
t = Sc(gl),
rl.m = Math.round(t.top + rl.sc()) || 0,
il.m = Math.round(t.left + il.sc()) || 0,
n ? r.borderTopStyle = n : r.removeProperty("border-top-style"),
Tl = setInterval(jc, 250),
dl.delayedCall(.5, (function() {
return Zl = 0
}
)),
zc(ml, "touchcancel", Ql),
zc(gl, "touchstart", Ql),
Ic(zc, ml, "pointerdown,touchstart,mousedown", Kl),
Ic(zc, ml, "pointerup,touchend,mouseup", Jl),
Cl = dl.utils.checkPrefix("transform"),
ou.push(Cl),
pl = Wl(),
xl = dl.delayedCall(.2, eu).pause(),
zl = [ml, "visibilitychange", function() {
var e = fl.innerWidth
, t = fl.innerHeight;
ml.hidden ? (Al = e,
Il = t) : Al === e && Il === t || $c()
}
, ml, "DOMContentLoaded", eu, fl, "load", eu, fl, "resize", $c],
sc(zc),
Uc.forEach((function(e) {
return e.enable(0, 1)
}
)),
i = 0; i < $a.length; i += 3)
Pc(kc, $a[i], $a[i + 1]),
Pc(kc, $a[i], $a[i + 2])
}
}
,
e.config = function(t) {
"limitCallbacks"in t && (jl = !!t.limitCallbacks);
var i = t.syncInterval;
i && clearInterval(Tl) || (Tl = i) && setInterval(jc, i),
"ignoreMobileResize"in t && (Bl = 1 === e.isTouch && t.ignoreMobileResize),
"autoRefreshEvents"in t && (sc(kc) || sc(zc, t.autoRefreshEvents || "none"),
Dl = -1 === (t.autoRefreshEvents + "").indexOf("resize"))
}
,
e.scrollerProxy = function(e, t) {
var i = nl(e)
, r = $a.indexOf(i)
, n = rc(i);
~r && $a.splice(r, n ? 6 : 2),
t && (n ? qa.unshift(fl, t, gl, t, _l, t) : qa.unshift(i, t))
}
,
e.clearMatchMedia = function(e) {
Uc.forEach((function(t) {
return t._ctx && t._ctx.query === e && t._ctx.kill(!0, !0)
}
))
}
,
e.isInViewport = function(e, t, i) {
var r = (ac(e) ? nl(e) : e).getBoundingClientRect()
, n = r[i ? gc : yc] * t || 0;
return i ? r.right - n > 0 && r.left + n < fl.innerWidth : r.bottom - n > 0 && r.top + n < fl.innerHeight
}
,
e.positionInViewport = function(e, t, i) {
ac(e) && (e = nl(e));
var r = e.getBoundingClientRect()
, n = r[i ? gc : yc]
, o = null == t ? n / 2 : t in Bc ? Bc[t] * n : ~t.indexOf("%") ? parseFloat(t) * n / 100 : parseFloat(t) || 0;
return i ? (r.left + o) / fl.innerWidth : (r.top + o) / fl.innerHeight
}
,
e.killAll = function(e) {
if (Uc.forEach((function(e) {
return "ScrollSmoother" !== e.vars.id && e.kill()
}
)),
!0 !== e) {
var t = qc.killAll || [];
qc = {},
t.forEach((function(e) {
return e()
}
))
}
}
,
e
}();
mu.version = "3.11.3",
mu.saveStyles = function(e) {
return e ? vl(e).forEach((function(e) {
if (e && e.style) {
var t = Hc.indexOf(e);
t >= 0 && Hc.splice(t, 5),
Hc.push(e, e.style.cssText, e.getBBox && e.getAttribute("transform"), dl.core.getCache(e), Ul())
}
}
)) : Hc
}
,
mu.revert = function(e, t) {
return Kc(!e, t)
}
,
mu.create = function(e, t) {
return new mu(e,t)
}
,
mu.refresh = function(e) {
return e ? $c() : (pl || mu.register()) && eu(!0)
}
,
mu.update = ru,
mu.clearScrollMemory = Jc,
mu.maxScroll = function(e, t) {
return oc(e, t ? il : rl)
}
,
mu.getScrollFunc = function(e, t) {
return ol(nl(e), t ? il : rl)
}
,
mu.getById = function(e) {
return Vc[e]
}
,
mu.getAll = function() {
return Uc.filter((function(e) {
return "ScrollSmoother" !== e.vars.id
}
))
}
,
mu.isScrolling = function() {
return !!Hl
}
,
mu.snapDirectional = Ac,
mu.addEventListener = function(e, t) {
var i = qc[e] || (qc[e] = []);
~i.indexOf(t) || i.push(t)
}
,
mu.removeEventListener = function(e, t) {
var i = qc[e]
, r = i && i.indexOf(t);
r >= 0 && i.splice(r, 1)
}
,
mu.batch = function(e, t) {
var i, r = [], n = {}, o = t.interval || .016, s = t.batchMax || 1e9, a = function(e, t) {
var i = []
, r = []
, n = dl.delayedCall(o, (function() {
t(i, r),
i = [],
r = []
}
)).pause();
return function(e) {
i.length || n.restart(!0),
i.push(e.trigger),
r.push(e),
s <= i.length && n.progress(1)
}
};
for (i in t)
n[i] = "on" === i.substr(0, 2) && lc(t[i]) && "onRefreshInit" !== i ? a(0, t[i]) : t[i];
return lc(s) && (s = s(),
zc(mu, "refresh", (function() {
return s = t.batchMax()
}
))),
vl(e).forEach((function(e) {
var t = {};
for (i in n)
t[i] = n[i];
t.trigger = e,
r.push(mu.create(t))
}
)),
r
}
;
var _u, gu = function(e, t, i, r) {
return t > r ? e(r) : t < 0 && e(0),
i > r ? (r - t) / (i - t) : i < 0 ? t / (t - i) : 1
}, yu = function e(t, i) {
!0 === i ? t.style.removeProperty("touch-action") : t.style.touchAction = !0 === i ? "auto" : i ? "pan-" + i + (hl.isTouch ? " pinch-zoom" : "") : "none",
t === _l && e(gl, i)
}, xu = {
auto: 1,
scroll: 1
}, vu = function(e) {
var t, i = e.event, r = e.target, n = e.axis, o = (i.changedTouches ? i.changedTouches[0] : i).target, s = o._gsap || dl.core.getCache(o), a = Wl();
if (!s._isScrollT || a - s._isScrollT > 2e3) {
for (; o && o.scrollHeight <= o.clientHeight; )
o = o.parentNode;
s._isScroll = o && !rc(o) && o !== r && (xu[(t = Tc(o)).overflowY] || xu[t.overflowX]),
s._isScrollT = a
}
(s._isScroll || "x" === n) && (i.stopPropagation(),
i._gsapAllow = !0)
}, bu = function(e, t, i, r) {
return hl.create({
target: e,
capture: !0,
debounce: !1,
lockAxis: !0,
type: t,
onWheel: r = r && vu,
onPress: r,
onDrag: r,
onScroll: r,
onEnable: function() {
return i && zc(ml, hl.eventTypes[0], Tu, !1, !0)
},
onDisable: function() {
return kc(ml, hl.eventTypes[0], Tu, !0)
}
})
}, wu = /(input|label|select|textarea)/i, Tu = function(e) {
var t = wu.test(e.target.tagName);
(t || _u) && (e._gsapAllow = !0,
_u = t)
}, Eu = function(e) {
uc(e) || (e = {}),
e.preventDefault = e.isNormalizer = e.allowClicks = !0,
e.type || (e.type = "wheel,touch"),
e.debounce = !!e.debounce,
e.id = e.id || "normalizer";
var t, i, r, n, o, s, a, l, c = e, u = c.normalizeScrollX, h = c.momentum, d = c.allowNestedScroll, p = nl(e.target) || _l, f = dl.core.globals().ScrollSmoother, m = f && f.get(), _ = Fl && (e.content && nl(e.content) || m && !1 !== e.content && !m.smooth() && m.content()), g = ol(p, rl), y = ol(p, il), x = 1, v = (hl.isTouch && fl.visualViewport ? fl.visualViewport.scale * fl.visualViewport.width : fl.outerWidth) / fl.innerWidth, b = 0, w = lc(h) ? function() {
return h(t)
}
: function() {
return h || 2.8
}
, T = bu(p, e.type, !0, d), E = function() {
return n = !1
}, S = Ql, C = Ql, M = function() {
i = oc(p, rl),
C = bl(Fl ? 1 : 0, i),
u && (S = bl(0, oc(p, il))),
r = Qc
}, A = function() {
_._gsap.y = ec(parseFloat(_._gsap.y) + g.offset) + "px",
_.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + parseFloat(_._gsap.y) + ", 0, 1)",
g.offset = g.cacheID = 0
}, I = function() {
M(),
o.isActive() && o.vars.scrollY > i && (g() > i ? o.progress(1) && g(i) : o.resetTo("scrollY", i))
};
return _ && dl.set(_, {
y: "+=0"
}),
e.ignoreCheck = function(e) {
return Fl && "touchmove" === e.type && function() {
if (n) {
requestAnimationFrame(E);
var e = ec(t.deltaY / 2)
, i = C(g.v - e);
if (_ && i !== g.v + g.offset) {
g.offset = i - g.v;
var r = ec((parseFloat(_ && _._gsap.y) || 0) - g.offset);
_.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + r + ", 0, 1)",
_._gsap.y = r + "px",
g.cacheID = $a.cache,
ru()
}
return !0
}
g.offset && A(),
n = !0
}() || x > 1.05 && "touchstart" !== e.type || t.isGesturing || e.touches && e.touches.length > 1
}
,
e.onPress = function() {
var e = x;
x = ec((fl.visualViewport && fl.visualViewport.scale || 1) / v),
o.pause(),
e !== x && yu(p, x > 1.01 || !u && "x"),
s = y(),
a = g(),
M(),
r = Qc
}
,
e.onRelease = e.onGestureStart = function(e, t) {
if (g.offset && A(),
t) {
$a.cache++;
var r, n, s = w();
u && (n = (r = y()) + .05 * s * -e.velocityX / .227,
s *= gu(y, r, n, oc(p, il)),
o.vars.scrollX = S(n)),
n = (r = g()) + .05 * s * -e.velocityY / .227,
s *= gu(g, r, n, oc(p, rl)),
o.vars.scrollY = C(n),
o.invalidate().duration(s).play(.01),
(Fl && o.vars.scrollY >= i || r >= i - 1) && dl.to({}, {
onUpdate: I,
duration: s
})
} else
l.restart(!0)
}
,
e.onWheel = function() {
o._ts && o.pause(),
Wl() - b > 1e3 && (r = 0,
b = Wl())
}
,
e.onChange = function(e, t, i, n, o) {
if (Qc !== r && M(),
t && u && y(S(n[2] === t ? s + (e.startX - e.x) : y() + t - n[1])),
i) {
g.offset && A();
var l = o[2] === i
, c = l ? a + e.startY - e.y : g() + i - o[1]
, h = C(c);
l && c !== h && (a += h - c),
g(h)
}
(i || t) && ru()
}
,
e.onEnable = function() {
yu(p, !u && "x"),
mu.addEventListener("refresh", I),
zc(fl, "resize", I),
g.smooth && (g.target.style.scrollBehavior = "auto",
g.smooth = y.smooth = !1),
T.enable()
}
,
e.onDisable = function() {
yu(p, !0),
kc(fl, "resize", I),
mu.removeEventListener("refresh", I),
T.kill()
}
,
e.lockAxis = !1 !== e.lockAxis,
(t = new hl(e)).iOS = Fl,
Fl && !g() && g(1),
Fl && dl.ticker.add(Ql),
l = t._dc,
o = dl.to(t, {
ease: "power4",
paused: !0,
scrollX: u ? "+=0.1" : "+=0",
scrollY: "+=0.1",
onComplete: l.vars.onComplete
}),
t
};
mu.sort = function(e) {
return Uc.sort(e || function(e, t) {
return -1e6 * (e.vars.refreshPriority || 0) + e.start - (t.start + -1e6 * (t.vars.refreshPriority || 0))
}
)
}
,
mu.observe = function(e) {
return new hl(e)
}
,
mu.normalizeScroll = function(e) {
if (void 0 === e)
return Ll;
if (!0 === e && Ll)
return Ll.enable();
if (!1 === e)
return Ll && Ll.kill();
var t = e instanceof hl ? e : Eu(e);
return Ll && Ll.target === t.target && Ll.kill(),
rc(t.target) && (Ll = t),
t
}
,
mu.core = {
_getVelocityProp: sl,
_inputObserver: bu,
_scrollers: $a,
_proxies: qa,
bridge: {
ss: function() {
Hl || Xc("scrollStart"),
Hl = Wl()
},
ref: function() {
return El
}
}
},
ic() && dl.registerPlugin(mu),
Ma.registerPlugin(mu);
function Su(e) {
return null !== e && "object" == typeof e && "constructor"in e && e.constructor === Object
}
function Cu(e={}, t={}) {
Object.keys(t).forEach((i=>{
void 0 === e[i] ? e[i] = t[i] : Su(t[i]) && Su(e[i]) && Object.keys(t[i]).length > 0 && Cu(e[i], t[i])
}
))
}
const Mu = {
body: {},
addEventListener() {},
removeEventListener() {},
activeElement: {
blur() {},
nodeName: ""
},
querySelector: ()=>null,
querySelectorAll: ()=>[],
getElementById: ()=>null,
createEvent: ()=>({
initEvent() {}
}),
createElement: ()=>({
children: [],
childNodes: [],
style: {},
setAttribute() {},
getElementsByTagName: ()=>[]
}),
createElementNS: ()=>({}),
importNode: ()=>null,
location: {
hash: "",
host: "",
hostname: "",
href: "",
origin: "",
pathname: "",
protocol: "",
search: ""
}
};
function Au() {
const e = "undefined" != typeof document ? document : {};
return Cu(e, Mu),
e
}
const Iu = {
document: Mu,
navigator: {
userAgent: ""
},
location: {
hash: "",
host: "",
hostname: "",
href: "",
origin: "",
pathname: "",
protocol: "",
search: ""
},
history: {
replaceState() {},
pushState() {},
go() {},
back() {}
},
CustomEvent: function() {
return this
},
addEventListener() {},
removeEventListener() {},
getComputedStyle: ()=>({
getPropertyValue: ()=>""
}),
Image() {},
Date() {},
screen: {},
setTimeout() {},
clearTimeout() {},
matchMedia: ()=>({}),
requestAnimationFrame: e=>"undefined" == typeof setTimeout ? (e(),
null) : setTimeout(e, 0),
cancelAnimationFrame(e) {
"undefined" != typeof setTimeout && clearTimeout(e)
}
};
function zu() {
const e = "undefined" != typeof window ? window : {};
return Cu(e, Iu),
e
}
class ku extends Array {
constructor(e) {
"number" == typeof e ? super(e) : (super(...e || []),
function(e) {
const t = e.__proto__;
Object.defineProperty(e, "__proto__", {
get: ()=>t,
set(e) {
t.__proto__ = e
}
})
}(this))
}
}
function Pu(e=[]) {
const t = [];
return e.forEach((e=>{
Array.isArray(e) ? t.push(...Pu(e)) : t.push(e)
}
)),
t
}
function Du(e, t) {
return Array.prototype.filter.call(e, t)
}
function Lu(e, t) {
const i = zu()
, r = Au();
let n = [];
if (!t && e instanceof ku)
return e;
if (!e)
return new ku(n);
if ("string" == typeof e) {
const i = e.trim();
if (i.indexOf("<") >= 0 && i.indexOf(">") >= 0) {
let e = "div";
0 === i.indexOf("<li") && (e = "ul"),
0 === i.indexOf("<tr") && (e = "tbody"),
0 !== i.indexOf("<td") && 0 !== i.indexOf("<th") || (e = "tr"),
0 === i.indexOf("<tbody") && (e = "table"),
0 === i.indexOf("<option") && (e = "select");
const t = r.createElement(e);
t.innerHTML = i;
for (let e = 0; e < t.childNodes.length; e += 1)
n.push(t.childNodes[e])
} else
n = function(e, t) {
if ("string" != typeof e)
return [e];
const i = []
, r = t.querySelectorAll(e);
for (let e = 0; e < r.length; e += 1)
i.push(r[e]);
return i
}(e.trim(), t || r)
} else if (e.nodeType || e === i || e === r)
n.push(e);
else if (Array.isArray(e)) {
if (e instanceof ku)
return e;
n = e
}
return new ku(function(e) {
const t = [];
for (let i = 0; i < e.length; i += 1)
-1 === t.indexOf(e[i]) && t.push(e[i]);
return t
}(n))
}
Lu.fn = ku.prototype;
const Bu = "resize scroll".split(" ");
function Ou(e) {
return function(...t) {
if (void 0 === t[0]) {
for (let t = 0; t < this.length; t += 1)
Bu.indexOf(e) < 0 && (e in this[t] ? this[t][e]() : Lu(this[t]).trigger(e));
return this
}
return this.on(e, ...t)
}
}
Ou("click"),
Ou("blur"),
Ou("focus"),
Ou("focusin"),
Ou("focusout"),
Ou("keyup"),
Ou("keydown"),
Ou("keypress"),
Ou("submit"),
Ou("change"),
Ou("mousedown"),
Ou("mousemove"),
Ou("mouseup"),
Ou("mouseenter"),
Ou("mouseleave"),
Ou("mouseout"),
Ou("mouseover"),
Ou("touchstart"),
Ou("touchend"),
Ou("touchmove"),
Ou("resize"),
Ou("scroll");
const Ru = {
addClass: function(...e) {
const t = Pu(e.map((e=>e.split(" "))));
return this.forEach((e=>{
e.classList.add(...t)
}
)),
this
},
removeClass: function(...e) {
const t = Pu(e.map((e=>e.split(" "))));
return this.forEach((e=>{
e.classList.remove(...t)
}
)),
this
},
hasClass: function(...e) {
const t = Pu(e.map((e=>e.split(" "))));
return Du(this, (e=>t.filter((t=>e.classList.contains(t))).length > 0)).length > 0
},
toggleClass: function(...e) {
const t = Pu(e.map((e=>e.split(" "))));
this.forEach((e=>{
t.forEach((t=>{
e.classList.toggle(t)
}
))
}
))
},
attr: function(e, t) {
if (1 === arguments.length && "string" == typeof e)
return this[0] ? this[0].getAttribute(e) : void 0;
for (let i = 0; i < this.length; i += 1)
if (2 === arguments.length)
this[i].setAttribute(e, t);
else
for (const t in e)
this[i][t] = e[t],
this[i].setAttribute(t, e[t]);
return this
},
removeAttr: function(e) {
for (let t = 0; t < this.length; t += 1)
this[t].removeAttribute(e);
return this
},
transform: function(e) {
for (let t = 0; t < this.length; t += 1)
this[t].style.transform = e;
return this
},
transition: function(e) {
for (let t = 0; t < this.length; t += 1)
this[t].style.transitionDuration = "string" != typeof e ? `${e}ms` : e;
return this
},
on: function(...e) {
let[t,i,r,n] = e;
function o(e) {
const t = e.target;
if (!t)
return;
const n = e.target.dom7EventData || [];
if (n.indexOf(e) < 0 && n.unshift(e),
Lu(t).is(i))
r.apply(t, n);
else {
const e = Lu(t).parents();
for (let t = 0; t < e.length; t += 1)
Lu(e[t]).is(i) && r.apply(e[t], n)
}
}
function s(e) {
const t = e && e.target && e.target.dom7EventData || [];
t.indexOf(e) < 0 && t.unshift(e),
r.apply(this, t)
}
"function" == typeof e[1] && ([t,r,n] = e,
i = void 0),
n || (n = !1);
const a = t.split(" ");
let l;
for (let e = 0; e < this.length; e += 1) {
const t = this[e];
if (i)
for (l = 0; l < a.length; l += 1) {
const e = a[l];
t.dom7LiveListeners || (t.dom7LiveListeners = {}),
t.dom7LiveListeners[e] || (t.dom7LiveListeners[e] = []),
t.dom7LiveListeners[e].push({
listener: r,
proxyListener: o
}),
t.addEventListener(e, o, n)
}
else
for (l = 0; l < a.length; l += 1) {
const e = a[l];
t.dom7Listeners || (t.dom7Listeners = {}),
t.dom7Listeners[e] || (t.dom7Listeners[e] = []),
t.dom7Listeners[e].push({
listener: r,
proxyListener: s
}),
t.addEventListener(e, s, n)
}
}
return this
},
off: function(...e) {
let[t,i,r,n] = e;
"function" == typeof e[1] && ([t,r,n] = e,
i = void 0),
n || (n = !1);
const o = t.split(" ");
for (let e = 0; e < o.length; e += 1) {
const t = o[e];
for (let e = 0; e < this.length; e += 1) {
const o = this[e];
let s;
if (!i && o.dom7Listeners ? s = o.dom7Listeners[t] : i && o.dom7LiveListeners && (s = o.dom7LiveListeners[t]),
s && s.length)
for (let e = s.length - 1; e >= 0; e -= 1) {
const i = s[e];
r && i.listener === r || r && i.listener && i.listener.dom7proxy && i.listener.dom7proxy === r ? (o.removeEventListener(t, i.proxyListener, n),
s.splice(e, 1)) : r || (o.removeEventListener(t, i.proxyListener, n),
s.splice(e, 1))
}
}
}
return this
},
trigger: function(...e) {
const t = zu()
, i = e[0].split(" ")
, r = e[1];
for (let n = 0; n < i.length; n += 1) {
const o = i[n];
for (let i = 0; i < this.length; i += 1) {
const n = this[i];
if (t.CustomEvent) {
const i = new t.CustomEvent(o,{
detail: r,
bubbles: !0,
cancelable: !0
});
n.dom7EventData = e.filter(((e,t)=>t > 0)),
n.dispatchEvent(i),
n.dom7EventData = [],
delete n.dom7EventData
}
}
}
return this
},
transitionEnd: function(e) {
const t = this;
return e && t.on("transitionend", (function i(r) {
r.target === this && (e.call(this, r),
t.off("transitionend", i))
}
)),
this
},
outerWidth: function(e) {
if (this.length > 0) {
if (e) {
const e = this.styles();
return this[0].offsetWidth + parseFloat(e.getPropertyValue("margin-right")) + parseFloat(e.getPropertyValue("margin-left"))
}
return this[0].offsetWidth
}
return null
},
outerHeight: function(e) {
if (this.length > 0) {
if (e) {
const e = this.styles();
return this[0].offsetHeight + parseFloat(e.getPropertyValue("margin-top")) + parseFloat(e.getPropertyValue("margin-bottom"))
}
return this[0].offsetHeight
}
return null
},
styles: function() {
const e = zu();
return this[0] ? e.getComputedStyle(this[0], null) : {}
},
offset: function() {
if (this.length > 0) {
const e = zu()
, t = Au()
, i = this[0]
, r = i.getBoundingClientRect()
, n = t.body
, o = i.clientTop || n.clientTop || 0
, s = i.clientLeft || n.clientLeft || 0
, a = i === e ? e.scrollY : i.scrollTop
, l = i === e ? e.scrollX : i.scrollLeft;
return {
top: r.top + a - o,
left: r.left + l - s
}
}
return null
},
css: function(e, t) {
const i = zu();
let r;
if (1 === arguments.length) {
if ("string" != typeof e) {
for (r = 0; r < this.length; r += 1)
for (const t in e)
this[r].style[t] = e[t];
return this
}
if (this[0])
return i.getComputedStyle(this[0], null).getPropertyValue(e)
}
if (2 === arguments.length && "string" == typeof e) {
for (r = 0; r < this.length; r += 1)
this[r].style[e] = t;
return this
}
return this
},
each: function(e) {
return e ? (this.forEach(((t,i)=>{
e.apply(t, [t, i])
}
)),
this) : this
},
html: function(e) {
if (void 0 === e)
return this[0] ? this[0].innerHTML : null;
for (let t = 0; t < this.length; t += 1)
this[t].innerHTML = e;
return this
},
text: function(e) {
if (void 0 === e)
return this[0] ? this[0].textContent.trim() : null;
for (let t = 0; t < this.length; t += 1)
this[t].textContent = e;
return this
},
is: function(e) {
const t = zu()
, i = Au()
, r = this[0];
let n, o;
if (!r || void 0 === e)
return !1;
if ("string" == typeof e) {
if (r.matches)
return r.matches(e);
if (r.webkitMatchesSelector)
return r.webkitMatchesSelector(e);
if (r.msMatchesSelector)
return r.msMatchesSelector(e);
for (n = Lu(e),
o = 0; o < n.length; o += 1)
if (n[o] === r)
return !0;
return !1
}
if (e === i)
return r === i;
if (e === t)
return r === t;
if (e.nodeType || e instanceof ku) {
for (n = e.nodeType ? [e] : e,
o = 0; o < n.length; o += 1)
if (n[o] === r)
return !0;
return !1
}
return !1
},
index: function() {
let e, t = this[0];
if (t) {
for (e = 0; null !== (t = t.previousSibling); )
1 === t.nodeType && (e += 1);
return e
}
},
eq: function(e) {
if (void 0 === e)
return this;
const t = this.length;
if (e > t - 1)
return Lu([]);
if (e < 0) {
const i = t + e;
return Lu(i < 0 ? [] : [this[i]])
}
return Lu([this[e]])
},
append: function(...e) {
let t;
const i = Au();
for (let r = 0; r < e.length; r += 1) {
t = e[r];
for (let e = 0; e < this.length; e += 1)
if ("string" == typeof t) {
const r = i.createElement("div");
for (r.innerHTML = t; r.firstChild; )
this[e].appendChild(r.firstChild)
} else if (t instanceof ku)
for (let i = 0; i < t.length; i += 1)
this[e].appendChild(t[i]);
else
this[e].appendChild(t)
}
return this
},
prepend: function(e) {
const t = Au();
let i, r;
for (i = 0; i < this.length; i += 1)
if ("string" == typeof e) {
const n = t.createElement("div");
for (n.innerHTML = e,
r = n.childNodes.length - 1; r >= 0; r -= 1)
this[i].insertBefore(n.childNodes[r], this[i].childNodes[0])
} else if (e instanceof ku)
for (r = 0; r < e.length; r += 1)
this[i].insertBefore(e[r], this[i].childNodes[0]);
else
this[i].insertBefore(e, this[i].childNodes[0]);
return this
},
next: function(e) {
return this.length > 0 ? e ? this[0].nextElementSibling && Lu(this[0].nextElementSibling).is(e) ? Lu([this[0].nextElementSibling]) : Lu([]) : this[0].nextElementSibling ? Lu([this[0].nextElementSibling]) : Lu([]) : Lu([])
},
nextAll: function(e) {
const t = [];
let i = this[0];
if (!i)
return Lu([]);
for (; i.nextElementSibling; ) {
const r = i.nextElementSibling;
e ? Lu(r).is(e) && t.push(r) : t.push(r),
i = r
}
return Lu(t)
},
prev: function(e) {
if (this.length > 0) {
const t = this[0];
return e ? t.previousElementSibling && Lu(t.previousElementSibling).is(e) ? Lu([t.previousElementSibling]) : Lu([]) : t.previousElementSibling ? Lu([t.previousElementSibling]) : Lu([])
}
return Lu([])
},
prevAll: function(e) {
const t = [];
let i = this[0];
if (!i)
return Lu([]);
for (; i.previousElementSibling; ) {
const r = i.previousElementSibling;
e ? Lu(r).is(e) && t.push(r) : t.push(r),
i = r
}
return Lu(t)
},
parent: function(e) {
const t = [];
for (let i = 0; i < this.length; i += 1)
null !== this[i].parentNode && (e ? Lu(this[i].parentNode).is(e) && t.push(this[i].parentNode) : t.push(this[i].parentNode));
return Lu(t)
},
parents: function(e) {
const t = [];
for (let i = 0; i < this.length; i += 1) {
let r = this[i].parentNode;
for (; r; )
e ? Lu(r).is(e) && t.push(r) : t.push(r),
r = r.parentNode
}
return Lu(t)
},
closest: function(e) {
let t = this;
return void 0 === e ? Lu([]) : (t.is(e) || (t = t.parents(e).eq(0)),
t)
},
find: function(e) {
const t = [];
for (let i = 0; i < this.length; i += 1) {
const r = this[i].querySelectorAll(e);
for (let e = 0; e < r.length; e += 1)
t.push(r[e])
}
return Lu(t)
},
children: function(e) {
const t = [];
for (let i = 0; i < this.length; i += 1) {
const r = this[i].children;
for (let i = 0; i < r.length; i += 1)
e && !Lu(r[i]).is(e) || t.push(r[i])
}
return Lu(t)
},
filter: function(e) {
return Lu(Du(this, e))
},
remove: function() {
for (let e = 0; e < this.length; e += 1)
this[e].parentNode && this[e].parentNode.removeChild(this[e]);
return this
}
};
Object.keys(Ru).forEach((e=>{
Object.defineProperty(Lu.fn, e, {
value: Ru[e],
writable: !0
})
}
));
const Fu = Lu;
function Uu(e, t) {
return void 0 === t && (t = 0),
setTimeout(e, t)
}
function Vu() {
return Date.now()
}
function ju(e, t) {
void 0 === t && (t = "x");
const i = zu();
let r, n, o;
const s = function(e) {
const t = zu();
let i;
return t.getComputedStyle && (i = t.getComputedStyle(e, null)),
!i && e.currentStyle && (i = e.currentStyle),
i || (i = e.style),
i
}(e);
return i.WebKitCSSMatrix ? (n = s.transform || s.webkitTransform,
n.split(",").length > 6 && (n = n.split(", ").map((e=>e.replace(",", "."))).join(", ")),
o = new i.WebKitCSSMatrix("none" === n ? "" : n)) : (o = s.MozTransform || s.OTransform || s.MsTransform || s.msTransform || s.transform || s.getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,"),
r = o.toString().split(",")),
"x" === t && (n = i.WebKitCSSMatrix ? o.m41 : 16 === r.length ? parseFloat(r[12]) : parseFloat(r[4])),
"y" === t && (n = i.WebKitCSSMatrix ? o.m42 : 16 === r.length ? parseFloat(r[13]) : parseFloat(r[5])),
n || 0
}
function Nu(e) {
return "object" == typeof e && null !== e && e.constructor && "Object" === Object.prototype.toString.call(e).slice(8, -1)
}
function Gu(e) {
return "undefined" != typeof window && void 0 !== window.HTMLElement ? e instanceof HTMLElement : e && (1 === e.nodeType || 11 === e.nodeType)
}
function $u() {
const e = Object(arguments.length <= 0 ? void 0 : arguments[0])
, t = ["__proto__", "constructor", "prototype"];
for (let i = 1; i < arguments.length; i += 1) {
const r = i < 0 || arguments.length <= i ? void 0 : arguments[i];
if (null != r && !Gu(r)) {
const i = Object.keys(Object(r)).filter((e=>t.indexOf(e) < 0));
for (let t = 0, n = i.length; t < n; t += 1) {
const n = i[t]
, o = Object.getOwnPropertyDescriptor(r, n);
void 0 !== o && o.enumerable && (Nu(e[n]) && Nu(r[n]) ? r[n].__swiper__ ? e[n] = r[n] : $u(e[n], r[n]) : !Nu(e[n]) && Nu(r[n]) ? (e[n] = {},
r[n].__swiper__ ? e[n] = r[n] : $u(e[n], r[n])) : e[n] = r[n])
}
}
}
return e
}
function qu(e, t, i) {
e.style.setProperty(t, i)
}
function Zu(e) {
let {swiper: t, targetPosition: i, side: r} = e;
const n = zu()
, o = -t.translate;
let s, a = null;
const l = t.params.speed;
t.wrapperEl.style.scrollSnapType = "none",
n.cancelAnimationFrame(t.cssModeFrameID);
const c = i > o ? "next" : "prev"
, u = (e,t)=>"next" === c && e >= t || "prev" === c && e <= t
, h = ()=>{
s = (new Date).getTime(),
null === a && (a = s);
const e = Math.max(Math.min((s - a) / l, 1), 0)
, c = .5 - Math.cos(e * Math.PI) / 2;
let d = o + c * (i - o);
if (u(d, i) && (d = i),
t.wrapperEl.scrollTo({
[r]: d
}),
u(d, i))
return t.wrapperEl.style.overflow = "hidden",
t.wrapperEl.style.scrollSnapType = "",
setTimeout((()=>{
t.wrapperEl.style.overflow = "",
t.wrapperEl.scrollTo({
[r]: d
})
}
)),
void n.cancelAnimationFrame(t.cssModeFrameID);
t.cssModeFrameID = n.requestAnimationFrame(h)
}
;
h()
}
let Wu, Xu, Hu;
function Yu() {
return Wu || (Wu = function() {
const e = zu()
, t = Au();
return {
smoothScroll: t.documentElement && "scrollBehavior"in t.documentElement.style,
touch: !!("ontouchstart"in e || e.DocumentTouch && t instanceof e.DocumentTouch),
passiveListener: function() {
let t = !1;
try {
const i = Object.defineProperty({}, "passive", {
get() {
t = !0
}
});
e.addEventListener("testPassiveListener", null, i)
} catch (e) {}
return t
}(),
gestures: "ongesturestart"in e
}
}()),
Wu
}
function Ku(e) {
return void 0 === e && (e = {}),
Xu || (Xu = function(e) {
let {userAgent: t} = void 0 === e ? {} : e;
const i = Yu()
, r = zu()
, n = r.navigator.platform
, o = t || r.navigator.userAgent
, s = {
ios: !1,
android: !1
}
, a = r.screen.width
, l = r.screen.height
, c = o.match(/(Android);?[\s\/]+([\d.]+)?/);
let u = o.match(/(iPad).*OS\s([\d_]+)/);
const h = o.match(/(iPod)(.*OS\s([\d_]+))?/)
, d = !u && o.match(/(iPhone\sOS|iOS)\s([\d_]+)/)
, p = "Win32" === n;
let f = "MacIntel" === n;
return !u && f && i.touch && ["1024x1366", "1366x1024", "834x1194", "1194x834", "834x1112", "1112x834", "768x1024", "1024x768", "820x1180", "1180x820", "810x1080", "1080x810"].indexOf(`${a}x ${l}`) >= 0 && (u = o.match(/(Version)\/([\d.]+)/),
u || (u = [0, 1, "13_0_0"]),
f = !1),
c && !p && (s.os = "android",
s.android = !0),
(u || d || h) && (s.os = "ios",
s.ios = !0),
s
}(e)),
Xu
}
function Ju() {
return Hu || (Hu = function() {
const e = zu();
return {
isSafari: function() {
const t = e.navigator.userAgent.toLowerCase();
return t.indexOf("safari") >= 0 && t.indexOf("chrome") < 0 && t.indexOf("android") < 0
}(),
isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(e.navigator.userAgent)
}
}()),
Hu
}
const Qu = {
on(e, t, i) {
const r = this;
if (!r.eventsListeners || r.destroyed)
return r;
if ("function" != typeof t)
return r;
const n = i ? "unshift" : "push";
return e.split(" ").forEach((e=>{
r.eventsListeners[e] || (r.eventsListeners[e] = []),
r.eventsListeners[e][n](t)
}
)),
r
},
once(e, t, i) {
const r = this;
if (!r.eventsListeners || r.destroyed)
return r;
if ("function" != typeof t)
return r;
function n() {
r.off(e, n),
n.__emitterProxy && delete n.__emitterProxy;
for (var i = arguments.length, o = new Array(i), s = 0; s < i; s++)
o[s] = arguments[s];
t.apply(r, o)
}
return n.__emitterProxy = t,
r.on(e, n, i)
},
onAny(e, t) {
const i = this;
if (!i.eventsListeners || i.destroyed)
return i;
if ("function" != typeof e)
return i;
const r = t ? "unshift" : "push";
return i.eventsAnyListeners.indexOf(e) < 0 && i.eventsAnyListeners[r](e),
i
},
offAny(e) {
const t = this;
if (!t.eventsListeners || t.destroyed)
return t;
if (!t.eventsAnyListeners)
return t;
const i = t.eventsAnyListeners.indexOf(e);
return i >= 0 && t.eventsAnyListeners.splice(i, 1),
t
},
off(e, t) {
const i = this;
return !i.eventsListeners || i.destroyed ? i : i.eventsListeners ? (e.split(" ").forEach((e=>{
void 0 === t ? i.eventsListeners[e] = [] : i.eventsListeners[e] && i.eventsListeners[e].forEach(((r,n)=>{
(r === t || r.__emitterProxy && r.__emitterProxy === t) && i.eventsListeners[e].splice(n, 1)
}
))
}
)),
i) : i
},
emit() {
const e = this;
if (!e.eventsListeners || e.destroyed)
return e;
if (!e.eventsListeners)
return e;
let t, i, r;
for (var n = arguments.length, o = new Array(n), s = 0; s < n; s++)
o[s] = arguments[s];
"string" == typeof o[0] || Array.isArray(o[0]) ? (t = o[0],
i = o.slice(1, o.length),
r = e) : (t = o[0].events,
i = o[0].data,
r = o[0].context || e),
i.unshift(r);
return (Array.isArray(t) ? t : t.split(" ")).forEach((t=>{
e.eventsAnyListeners && e.eventsAnyListeners.length && e.eventsAnyListeners.forEach((e=>{
e.apply(r, [t, ...i])
}
)),
e.eventsListeners && e.eventsListeners[t] && e.eventsListeners[t].forEach((e=>{
e.apply(r, i)
}
))
}
)),
e
}
};
const eh = {
updateSize: function() {
const e = this;
let t, i;
const r = e.$el;
t = void 0 !== e.params.width && null !== e.params.width ? e.params.width : r[0].clientWidth,
i = void 0 !== e.params.height && null !== e.params.height ? e.params.height : r[0].clientHeight,
0 === t && e.isHorizontal() || 0 === i && e.isVertical() || (t = t - parseInt(r.css("padding-left") || 0, 10) - parseInt(r.css("padding-right") || 0, 10),
i = i - parseInt(r.css("padding-top") || 0, 10) - parseInt(r.css("padding-bottom") || 0, 10),
Number.isNaN(t) && (t = 0),
Number.isNaN(i) && (i = 0),
Object.assign(e, {
width: t,
height: i,
size: e.isHorizontal() ? t : i
}))
},
updateSlides: function() {
const e = this;
function t(t) {
return e.isHorizontal() ? t : {
width: "height",
"margin-top": "margin-left",
"margin-bottom ": "margin-right",
"margin-left": "margin-top",
"margin-right": "margin-bottom",
"padding-left": "padding-top",
"padding-right": "padding-bottom",
marginRight: "marginBottom"
}[t]
}
function i(e, i) {
return parseFloat(e.getPropertyValue(t(i)) || 0)
}
const r = e.params
, {$wrapperEl: n, size: o, rtlTranslate: s, wrongRTL: a} = e
, l = e.virtual && r.virtual.enabled
, c = l ? e.virtual.slides.length : e.slides.length
, u = n.children(`.${e.params.slideClass}`)
, h = l ? e.virtual.slides.length : u.length;
let d = [];
const p = []
, f = [];
let m = r.slidesOffsetBefore;
"function" == typeof m && (m = r.slidesOffsetBefore.call(e));
let _ = r.slidesOffsetAfter;
"function" == typeof _ && (_ = r.slidesOffsetAfter.call(e));
const g = e.snapGrid.length
, y = e.slidesGrid.length;
let x = r.spaceBetween
, v = -m
, b = 0
, w = 0;
if (void 0 === o)
return;
"string" == typeof x && x.indexOf("%") >= 0 && (x = parseFloat(x.replace("%", "")) / 100 * o),
e.virtualSize = -x,
s ? u.css({
marginLeft: "",
marginBottom: "",
marginTop: ""
}) : u.css({
marginRight: "",
marginBottom: "",
marginTop: ""
}),
r.centeredSlides && r.cssMode && (qu(e.wrapperEl, "--swiper-centered-offset-before", ""),
qu(e.wrapperEl, "--swiper-centered-offset-after", ""));
const T = r.grid && r.grid.rows > 1 && e.grid;
let E;
T && e.grid.initSlides(h);
const S = "auto" === r.slidesPerView && r.breakpoints && Object.keys(r.breakpoints).filter((e=>void 0 !== r.breakpoints[e].slidesPerView)).length > 0;
for (let n = 0; n < h; n += 1) {
E = 0;
const s = u.eq(n);
if (T && e.grid.updateSlide(n, s, h, t),
"none" !== s.css("display")) {
if ("auto" === r.slidesPerView) {
S && (u[n].style[t("width")] = "");
const o = getComputedStyle(s[0])
, a = s[0].style.transform
, l = s[0].style.webkitTransform;
if (a && (s[0].style.transform = "none"),
l && (s[0].style.webkitTransform = "none"),
r.roundLengths)
E = e.isHorizontal() ? s.outerWidth(!0) : s.outerHeight(!0);
else {
const e = i(o, "width")
, t = i(o, "padding-left")
, r = i(o, "padding-right")
, n = i(o, "margin-left")
, a = i(o, "margin-right")
, l = o.getPropertyValue("box-sizing");
if (l && "border-box" === l)
E = e + n + a;
else {
const {clientWidth: i, offsetWidth: o} = s[0];
E = e + t + r + n + a + (o - i)
}
}
a && (s[0].style.transform = a),
l && (s[0].style.webkitTransform = l),
r.roundLengths && (E = Math.floor(E))
} else
E = (o - (r.slidesPerView - 1) * x) / r.slidesPerView,
r.roundLengths && (E = Math.floor(E)),
u[n] && (u[n].style[t("width")] = `${E}px`);
u[n] && (u[n].swiperSlideSize = E),
f.push(E),
r.centeredSlides ? (v = v + E / 2 + b / 2 + x,
0 === b && 0 !== n && (v = v - o / 2 - x),
0 === n && (v = v - o / 2 - x),
Math.abs(v) < .001 && (v = 0),
r.roundLengths && (v = Math.floor(v)),
w % r.slidesPerGroup == 0 && d.push(v),
p.push(v)) : (r.roundLengths && (v = Math.floor(v)),
(w - Math.min(e.params.slidesPerGroupSkip, w)) % e.params.slidesPerGroup == 0 && d.push(v),
p.push(v),
v = v + E + x),
e.virtualSize += E + x,
b = E,
w += 1
}
}
if (e.virtualSize = Math.max(e.virtualSize, o) + _,
s && a && ("slide" === r.effect || "coverflow" === r.effect) && n.css({
width: `${e.virtualSize + r.spaceBetween}px`
}),
r.setWrapperSize && n.css({
[t("width")]: `${e.virtualSize + r.spaceBetween}px`
}),
T && e.grid.updateWrapperSize(E, d, t),
!r.centeredSlides) {
const t = [];
for (let i = 0; i < d.length; i += 1) {
let n = d[i];
r.roundLengths && (n = Math.floor(n)),
d[i] <= e.virtualSize - o && t.push(n)
}
d = t,
Math.floor(e.virtualSize - o) - Math.floor(d[d.length - 1]) > 1 && d.push(e.virtualSize - o)
}
if (0 === d.length && (d = [0]),
0 !== r.spaceBetween) {
const i = e.isHorizontal() && s ? "marginLeft" : t("marginRight");
u.filter(((e,t)=>!r.cssMode || t !== u.length - 1)).css({
[i]: `${x}px`
})
}
if (r.centeredSlides && r.centeredSlidesBounds) {
let e = 0;
f.forEach((t=>{
e += t + (r.spaceBetween ? r.spaceBetween : 0)
}
)),
e -= r.spaceBetween;
const t = e - o;
d = d.map((e=>e < 0 ? -m : e > t ? t + _ : e))
}
if (r.centerInsufficientSlides) {
let e = 0;
if (f.forEach((t=>{
e += t + (r.spaceBetween ? r.spaceBetween : 0)
}
)),
e -= r.spaceBetween,
e < o) {
const t = (o - e) / 2;
d.forEach(((e,i)=>{
d[i] = e - t
}
)),
p.forEach(((e,i)=>{
p[i] = e + t
}
))
}
}
if (Object.assign(e, {
slides: u,
snapGrid: d,
slidesGrid: p,
slidesSizesGrid: f
}),
r.centeredSlides && r.cssMode && !r.centeredSlidesBounds) {
qu(e.wrapperEl, "--swiper-centered-offset-before", -d[0] + "px"),
qu(e.wrapperEl, "--swiper-centered-offset-after", e.size / 2 - f[f.length - 1] / 2 + "px");
const t = -e.snapGrid[0]
, i = -e.slidesGrid[0];
e.snapGrid = e.snapGrid.map((e=>e + t)),
e.slidesGrid = e.slidesGrid.map((e=>e + i))
}
if (h !== c && e.emit("slidesLengthChange"),
d.length !== g && (e.params.watchOverflow && e.checkOverflow(),
e.emit("snapGridLengthChange")),
p.length !== y && e.emit("slidesGridLengthChange"),
r.watchSlidesProgress && e.updateSlidesOffset(),
!(l || r.cssMode || "slide" !== r.effect && "fade" !== r.effect)) {
const t = `${r.containerModifierClass}backface-hidden`
, i = e.$el.hasClass(t);
h <= r.maxBackfaceHiddenSlides ? i || e.$el.addClass(t) : i && e.$el.removeClass(t)
}
},
updateAutoHeight: function(e) {
const t = this
, i = []
, r = t.virtual && t.params.virtual.enabled;
let n, o = 0;
"number" == typeof e ? t.setTransition(e) : !0 === e && t.setTransition(t.params.speed);
const s = e=>r ? t.slides.filter((t=>parseInt(t.getAttribute("data-swiper-slide-index"), 10) === e))[0] : t.slides.eq(e)[0];
if ("auto" !== t.params.slidesPerView && t.params.slidesPerView > 1)
if (t.params.centeredSlides)
(t.visibleSlides || Fu([])).each((e=>{
i.push(e)
}
));
else
for (n = 0; n < Math.ceil(t.params.slidesPerView); n += 1) {
const e = t.activeIndex + n;
if (e > t.slides.length && !r)
break;
i.push(s(e))
}
else
i.push(s(t.activeIndex));
for (n = 0; n < i.length; n += 1)
if (void 0 !== i[n]) {
const e = i[n].offsetHeight;
o = e > o ? e : o
}
(o || 0 === o) && t.$wrapperEl.css("height", `${o}px`)
},
updateSlidesOffset: function() {
const e = this
, t = e.slides;
for (let i = 0; i < t.length; i += 1)
t[i].swiperSlideOffset = e.isHorizontal() ? t[i].offsetLeft : t[i].offsetTop
},
updateSlidesProgress: function(e) {
void 0 === e && (e = this && this.translate || 0);
const t = this
, i = t.params
, {slides: r, rtlTranslate: n, snapGrid: o} = t;
if (0 === r.length)
return;
void 0 === r[0].swiperSlideOffset && t.updateSlidesOffset();
let s = -e;
n && (s = e),
r.removeClass(i.slideVisibleClass),
t.visibleSlidesIndexes = [],
t.visibleSlides = [];
for (let e = 0; e < r.length; e += 1) {
const a = r[e];
let l = a.swiperSlideOffset;
i.cssMode && i.centeredSlides && (l -= r[0].swiperSlideOffset);
const c = (s + (i.centeredSlides ? t.minTranslate() : 0) - l) / (a.swiperSlideSize + i.spaceBetween)
, u = (s - o[0] + (i.centeredSlides ? t.minTranslate() : 0) - l) / (a.swiperSlideSize + i.spaceBetween)
, h = -(s - l)
, d = h + t.slidesSizesGrid[e];
(h >= 0 && h < t.size - 1 || d > 1 && d <= t.size || h <= 0 && d >= t.size) && (t.visibleSlides.push(a),
t.visibleSlidesIndexes.push(e),
r.eq(e).addClass(i.slideVisibleClass)),
a.progress = n ? -c : c,
a.originalProgress = n ? -u : u
}
t.visibleSlides = Fu(t.visibleSlides)
},
updateProgress: function(e) {
const t = this;
if (void 0 === e) {
const i = t.rtlTranslate ? -1 : 1;
e = t && t.translate && t.translate * i || 0
}
const i = t.params
, r = t.maxTranslate() - t.minTranslate();
let {progress: n, isBeginning: o, isEnd: s} = t;
const a = o
, l = s;
0 === r ? (n = 0,
o = !0,
s = !0) : (n = (e - t.minTranslate()) / r,
o = n <= 0,
s = n >= 1),
Object.assign(t, {
progress: n,
isBeginning: o,
isEnd: s
}),
(i.watchSlidesProgress || i.centeredSlides && i.autoHeight) && t.updateSlidesProgress(e),
o && !a && t.emit("reachBeginning toEdge"),
s && !l && t.emit("reachEnd toEdge"),
(a && !o || l && !s) && t.emit("fromEdge"),
t.emit("progress", n)
},
updateSlidesClasses: function() {
const e = this
, {slides: t, params: i, $wrapperEl: r, activeIndex: n, realIndex: o} = e
, s = e.virtual && i.virtual.enabled;
let a;
t.removeClass(`${i.slideActiveClass} ${i.slideNextClass} ${i.slidePrevClass} ${i.slideDuplicateActiveClass} ${i.slideDuplicateNextClass} ${i.slideDuplicatePrevClass}`),
a = s ? e.$wrapperEl.find(`.${i.slideClass}[data-swiper-slide-index="${n}"]`) : t.eq(n),
a.addClass(i.slideActiveClass),
i.loop && (a.hasClass(i.slideDuplicateClass) ? r.children(`.${i.slideClass}:not(.${i.slideDuplicateClass})[data-swiper-slide-index="${o}"]`).addClass(i.slideDuplicateActiveClass) : r.children(`.${i.slideClass}.${i.slideDuplicateClass}[data-swiper-slide-index="${o}"]`).addClass(i.slideDuplicateActiveClass));
let l = a.nextAll(`.${i.slideClass}`).eq(0).addClass(i.slideNextClass);
i.loop && 0 === l.length && (l = t.eq(0),
l.addClass(i.slideNextClass));
let c = a.prevAll(`.${i.slideClass}`).eq(0).addClass(i.slidePrevClass);
i.loop && 0 === c.length && (c = t.eq(-1),
c.addClass(i.slidePrevClass)),
i.loop && (l.hasClass(i.slideDuplicateClass) ? r.children(`.${i.slideClass}:not(.${i.slideDuplicateClass})[data-swiper-slide-index="${l.attr("data-swiper-slide-index")}"]`).addClass(i.slideDuplicateNextClass) : r.children(`.${i.slideClass}.${i.slideDuplicateClass}[data-swiper-slide-index="${l.attr("data-swiper-slide-index")}"]`).addClass(i.slideDuplicateNextClass),
c.hasClass(i.slideDuplicateClass) ? r.children(`.${i.slideClass}:not(.${i.slideDuplicateClass})[data-swiper-slide-index="${c.attr("data-swiper-slide-index")}"]`).addClass(i.slideDuplicatePrevClass) : r.children(`.${i.slideClass}.${i.slideDuplicateClass}[data-swiper-slide-index="${c.attr("data-swiper-slide-index")}"]`).addClass(i.slideDuplicatePrevClass)),
e.emitSlidesClasses()
},
updateActiveIndex: function(e) {
const t = this
, i = t.rtlTranslate ? t.translate : -t.translate
, {slidesGrid: r, snapGrid: n, params: o, activeIndex: s, realIndex: a, snapIndex: l} = t;
let c, u = e;
if (void 0 === u) {
for (let e = 0; e < r.length; e += 1)
void 0 !== r[e + 1] ? i >= r[e] && i < r[e + 1] - (r[e + 1] - r[e]) / 2 ? u = e : i >= r[e] && i < r[e + 1] && (u = e + 1) : i >= r[e] && (u = e);
o.normalizeSlideIndex && (u < 0 || void 0 === u) && (u = 0)
}
if (n.indexOf(i) >= 0)
c = n.indexOf(i);
else {
const e = Math.min(o.slidesPerGroupSkip, u);
c = e + Math.floor((u - e) / o.slidesPerGroup)
}
if (c >= n.length && (c = n.length - 1),
u === s)
return void (c !== l && (t.snapIndex = c,
t.emit("snapIndexChange")));
const h = parseInt(t.slides.eq(u).attr("data-swiper-slide-index") || u, 10);
Object.assign(t, {
snapIndex: c,
realIndex: h,
previousIndex: s,
activeIndex: u
}),
t.emit("activeIndexChange"),
t.emit("snapIndexChange"),
a !== h && t.emit("realIndexChange"),
(t.initialized || t.params.runCallbacksOnInit) && t.emit("slideChange")
},
updateClickedSlide: function(e) {
const t = this
, i = t.params
, r = Fu(e).closest(`.${i.slideClass}`)[0];
let n, o = !1;
if (r)
for (let e = 0; e < t.slides.length; e += 1)
if (t.slides[e] === r) {
o = !0,
n = e;
break
}
if (!r || !o)
return t.clickedSlide = void 0,
void (t.clickedIndex = void 0);
t.clickedSlide = r,
t.virtual && t.params.virtual.enabled ? t.clickedIndex = parseInt(Fu(r).attr("data-swiper-slide-index"), 10) : t.clickedIndex = n,
i.slideToClickedSlide && void 0 !== t.clickedIndex && t.clickedIndex !== t.activeIndex && t.slideToClickedSlide()
}
};
const th = {
getTranslate: function(e) {
void 0 === e && (e = this.isHorizontal() ? "x" : "y");
const {params: t, rtlTranslate: i, translate: r, $wrapperEl: n} = this;
if (t.virtualTranslate)
return i ? -r : r;
if (t.cssMode)
return r;
let o = ju(n[0], e);
return i && (o = -o),
o || 0
},
setTranslate: function(e, t) {
const i = this
, {rtlTranslate: r, params: n, $wrapperEl: o, wrapperEl: s, progress: a} = i;
let l, c = 0, u = 0;
i.isHorizontal() ? c = r ? -e : e : u = e,
n.roundLengths && (c = Math.floor(c),
u = Math.floor(u)),
n.cssMode ? s[i.isHorizontal() ? "scrollLeft" : "scrollTop"] = i.isHorizontal() ? -c : -u : n.virtualTranslate || o.transform(`translate3d(${c}px, ${u}px, 0px)`),
i.previousTranslate = i.translate,
i.translate = i.isHorizontal() ? c : u;
const h = i.maxTranslate() - i.minTranslate();
l = 0 === h ? 0 : (e - i.minTranslate()) / h,
l !== a && i.updateProgress(e),
i.emit("setTranslate", i.translate, t)
},
minTranslate: function() {
return -this.snapGrid[0]
},
maxTranslate: function() {
return -this.snapGrid[this.snapGrid.length - 1]
},
translateTo: function(e, t, i, r, n) {
void 0 === e && (e = 0),
void 0 === t && (t = this.params.speed),
void 0 === i && (i = !0),
void 0 === r && (r = !0);
const o = this
, {params: s, wrapperEl: a} = o;
if (o.animating && s.preventInteractionOnTransition)
return !1;
const l = o.minTranslate()
, c = o.maxTranslate();
let u;
if (u = r && e > l ? l : r && e < c ? c : e,
o.updateProgress(u),
s.cssMode) {
const e = o.isHorizontal();
if (0 === t)
a[e ? "scrollLeft" : "scrollTop"] = -u;
else {
if (!o.support.smoothScroll)
return Zu({
swiper: o,
targetPosition: -u,
side: e ? "left" : "top"
}),
!0;
a.scrollTo({
[e ? "left" : "top"]: -u,
behavior: "smooth"
})
}
return !0
}
return 0 === t ? (o.setTransition(0),
o.setTranslate(u),
i && (o.emit("beforeTransitionStart", t, n),
o.emit("transitionEnd"))) : (o.setTransition(t),
o.setTranslate(u),
i && (o.emit("beforeTransitionStart", t, n),
o.emit("transitionStart")),
o.animating || (o.animating = !0,
o.onTranslateToWrapperTransitionEnd || (o.onTranslateToWrapperTransitionEnd = function(e) {
o && !o.destroyed && e.target === this && (o.$wrapperEl[0].removeEventListener("transitionend", o.onTranslateToWrapperTransitionEnd),
o.$wrapperEl[0].removeEventListener("webkitTransitionEnd", o.onTranslateToWrapperTransitionEnd),
o.onTranslateToWrapperTransitionEnd = null,
delete o.onTranslateToWrapperTransitionEnd,
i && o.emit("transitionEnd"))
}
),
o.$wrapperEl[0].addEventListener("transitionend", o.onTranslateToWrapperTransitionEnd),
o.$wrapperEl[0].addEventListener("webkitTransitionEnd", o.onTranslateToWrapperTransitionEnd))),
!0
}
};
function ih(e) {
let {swiper: t, runCallbacks: i, direction: r, step: n} = e;
const {activeIndex: o, previousIndex: s} = t;
let a = r;
if (a || (a = o > s ? "next" : o < s ? "prev" : "reset"),
t.emit(`transition ${n}`),
i && o !== s) {
if ("reset" === a)
return void t.emit(`slideResetTransition ${n}`);
t.emit(`slideChangeTransition ${n}`),
"next" === a ? t.emit(`slideNextTransition ${n}`) : t.emit(`slidePrevTransition ${n}`)
}
}
const rh = {
slideTo: function(e, t, i, r, n) {
if (void 0 === e && (e = 0),
void 0 === t && (t = this.params.speed),
void 0 === i && (i = !0),
"number" != typeof e && "string" != typeof e)
throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof e}] given.`);
if ("string" == typeof e) {
const t = parseInt(e, 10);
if (!isFinite(t))
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${e}] given.`);
e = t
}
const o = this;
let s = e;
s < 0 && (s = 0);
const {params: a, snapGrid: l, slidesGrid: c, previousIndex: u, activeIndex: h, rtlTranslate: d, wrapperEl: p, enabled: f} = o;
if (o.animating && a.preventInteractionOnTransition || !f && !r && !n)
return !1;
const m = Math.min(o.params.slidesPerGroupSkip, s);
let _ = m + Math.floor((s - m) / o.params.slidesPerGroup);
_ >= l.length && (_ = l.length - 1),
(h || a.initialSlide || 0) === (u || 0) && i && o.emit("beforeSlideChangeStart");
const g = -l[_];
if (o.updateProgress(g),
a.normalizeSlideIndex)
for (let e = 0; e < c.length; e += 1) {
const t = -Math.floor(100 * g)
, i = Math.floor(100 * c[e])
, r = Math.floor(100 * c[e + 1]);
void 0 !== c[e + 1] ? t >= i && t < r - (r - i) / 2 ? s = e : t >= i && t < r && (s = e + 1) : t >= i && (s = e)
}
if (o.initialized && s !== h) {
if (!o.allowSlideNext && g < o.translate && g < o.minTranslate())
return !1;
if (!o.allowSlidePrev && g > o.translate && g > o.maxTranslate() && (h || 0) !== s)
return !1
}
let y;
if (y = s > h ? "next" : s < h ? "prev" : "reset",
d && -g === o.translate || !d && g === o.translate)
return o.updateActiveIndex(s),
a.autoHeight && o.updateAutoHeight(),
o.updateSlidesClasses(),
"slide" !== a.effect && o.setTranslate(g),
"reset" !== y && (o.transitionStart(i, y),
o.transitionEnd(i, y)),
!1;
if (a.cssMode) {
const e = o.isHorizontal()
, i = d ? g : -g;
if (0 === t) {
const t = o.virtual && o.params.virtual.enabled;
t && (o.wrapperEl.style.scrollSnapType = "none",
o._immediateVirtual = !0),
p[e ? "scrollLeft" : "scrollTop"] = i,
t && requestAnimationFrame((()=>{
o.wrapperEl.style.scrollSnapType = "",
o._swiperImmediateVirtual = !1
}
))
} else {
if (!o.support.smoothScroll)
return Zu({
swiper: o,
targetPosition: i,
side: e ? "left" : "top"
}),
!0;
p.scrollTo({
[e ? "left" : "top"]: i,
behavior: "smooth"
})
}
return !0
}
return o.setTransition(t),
o.setTranslate(g),
o.updateActiveIndex(s),
o.updateSlidesClasses(),
o.emit("beforeTransitionStart", t, r),
o.transitionStart(i, y),
0 === t ? o.transitionEnd(i, y) : o.animating || (o.animating = !0,
o.onSlideToWrapperTransitionEnd || (o.onSlideToWrapperTransitionEnd = function(e) {
o && !o.destroyed && e.target === this && (o.$wrapperEl[0].removeEventListener("transitionend", o.onSlideToWrapperTransitionEnd),
o.$wrapperEl[0].removeEventListener("webkitTransitionEnd", o.onSlideToWrapperTransitionEnd),
o.onSlideToWrapperTransitionEnd = null,
delete o.onSlideToWrapperTransitionEnd,
o.transitionEnd(i, y))
}
),
o.$wrapperEl[0].addEventListener("transitionend", o.onSlideToWrapperTransitionEnd),
o.$wrapperEl[0].addEventListener("webkitTransitionEnd", o.onSlideToWrapperTransitionEnd)),
!0
},
slideToLoop: function(e, t, i, r) {
if (void 0 === e && (e = 0),
void 0 === t && (t = this.params.speed),
void 0 === i && (i = !0),
"string" == typeof e) {
const t = parseInt(e, 10);
if (!isFinite(t))
throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${e}] given.`);
e = t
}
const n = this;
let o = e;
return n.params.loop && (o += n.loopedSlides),
n.slideTo(o, t, i, r)
},
slideNext: function(e, t, i) {
void 0 === e && (e = this.params.speed),
void 0 === t && (t = !0);
const r = this
, {animating: n, enabled: o, params: s} = r;
if (!o)
return r;
let a = s.slidesPerGroup;
"auto" === s.slidesPerView && 1 === s.slidesPerGroup && s.slidesPerGroupAuto && (a = Math.max(r.slidesPerViewDynamic("current", !0), 1));
const l = r.activeIndex < s.slidesPerGroupSkip ? 1 : a;
if (s.loop) {
if (n && s.loopPreventsSlide)
return !1;
r.loopFix(),
r._clientLeft = r.$wrapperEl[0].clientLeft
}
return s.rewind && r.isEnd ? r.slideTo(0, e, t, i) : r.slideTo(r.activeIndex + l, e, t, i)
},
slidePrev: function(e, t, i) {
void 0 === e && (e = this.params.speed),
void 0 === t && (t = !0);
const r = this
, {params: n, animating: o, snapGrid: s, slidesGrid: a, rtlTranslate: l, enabled: c} = r;
if (!c)
return r;
if (n.loop) {
if (o && n.loopPreventsSlide)
return !1;
r.loopFix(),
r._clientLeft = r.$wrapperEl[0].clientLeft
}
function u(e) {
return e < 0 ? -Math.floor(Math.abs(e)) : Math.floor(e)
}
const h = u(l ? r.translate : -r.translate)
, d = s.map((e=>u(e)));
let p = s[d.indexOf(h) - 1];
if (void 0 === p && n.cssMode) {
let e;
s.forEach(((t,i)=>{
h >= t && (e = i)
}
)),
void 0 !== e && (p = s[e > 0 ? e - 1 : e])
}
let f = 0;
if (void 0 !== p && (f = a.indexOf(p),
f < 0 && (f = r.activeIndex - 1),
"auto" === n.slidesPerView && 1 === n.slidesPerGroup && n.slidesPerGroupAuto && (f = f - r.slidesPerViewDynamic("previous", !0) + 1,
f = Math.max(f, 0))),
n.rewind && r.isBeginning) {
const n = r.params.virtual && r.params.virtual.enabled && r.virtual ? r.virtual.slides.length - 1 : r.slides.length - 1;
return r.slideTo(n, e, t, i)
}
return r.slideTo(f, e, t, i)
},
slideReset: function(e, t, i) {
return void 0 === e && (e = this.params.speed),
void 0 === t && (t = !0),
this.slideTo(this.activeIndex, e, t, i)
},
slideToClosest: function(e, t, i, r) {
void 0 === e && (e = this.params.speed),
void 0 === t && (t = !0),
void 0 === r && (r = .5);
const n = this;
let o = n.activeIndex;
const s = Math.min(n.params.slidesPerGroupSkip, o)
, a = s + Math.floor((o - s) / n.params.slidesPerGroup)
, l = n.rtlTranslate ? n.translate : -n.translate;
if (l >= n.snapGrid[a]) {
const e = n.snapGrid[a];
l - e > (n.snapGrid[a + 1] - e) * r && (o += n.params.slidesPerGroup)
} else {
const e = n.snapGrid[a - 1];
l - e <= (n.snapGrid[a] - e) * r && (o -= n.params.slidesPerGroup)
}
return o = Math.max(o, 0),
o = Math.min(o, n.slidesGrid.length - 1),
n.slideTo(o, e, t, i)
},
slideToClickedSlide: function() {
const e = this
, {params: t, $wrapperEl: i} = e
, r = "auto" === t.slidesPerView ? e.slidesPerViewDynamic() : t.slidesPerView;
let n, o = e.clickedIndex;
if (t.loop) {
if (e.animating)
return;
n = parseInt(Fu(e.clickedSlide).attr("data-swiper-slide-index"), 10),
t.centeredSlides ? o < e.loopedSlides - r / 2 || o > e.slides.length - e.loopedSlides + r / 2 ? (e.loopFix(),
o = i.children(`.${t.slideClass}[data-swiper-slide-index="${n}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),
Uu((()=>{
e.slideTo(o)
}
))) : e.slideTo(o) : o > e.slides.length - r ? (e.loopFix(),
o = i.children(`.${t.slideClass}[data-swiper-slide-index="${n}"]:not(.${t.slideDuplicateClass})`).eq(0).index(),
Uu((()=>{
e.slideTo(o)
}
))) : e.slideTo(o)
} else
e.slideTo(o)
}
};
const nh = {
loopCreate: function() {
const e = this
, t = Au()
, {params: i, $wrapperEl: r} = e
, n = r.children().length > 0 ? Fu(r.children()[0].parentNode) : r;
n.children(`.${i.slideClass}.${i.slideDuplicateClass}`).remove();
let o = n.children(`.${i.slideClass}`);
if (i.loopFillGroupWithBlank) {
const e = i.slidesPerGroup - o.length % i.slidesPerGroup;
if (e !== i.slidesPerGroup) {
for (let r = 0; r < e; r += 1) {
const e = Fu(t.createElement("div")).addClass(`${i.slideClass} ${i.slideBlankClass}`);
n.append(e)
}
o = n.children(`.${i.slideClass}`)
}
}
"auto" !== i.slidesPerView || i.loopedSlides || (i.loopedSlides = o.length),
e.loopedSlides = Math.ceil(parseFloat(i.loopedSlides || i.slidesPerView, 10)),
e.loopedSlides += i.loopAdditionalSlides,
e.loopedSlides > o.length && e.params.loopedSlidesLimit && (e.loopedSlides = o.length);
const s = []
, a = [];
o.each(((e,t)=>{
Fu(e).attr("data-swiper-slide-index", t)
}
));
for (let t = 0; t < e.loopedSlides; t += 1) {
const e = t - Math.floor(t / o.length) * o.length;
a.push(o.eq(e)[0]),
s.unshift(o.eq(o.length - e - 1)[0])
}
for (let e = 0; e < a.length; e += 1)
n.append(Fu(a[e].cloneNode(!0)).addClass(i.slideDuplicateClass));
for (let e = s.length - 1; e >= 0; e -= 1)
n.prepend(Fu(s[e].cloneNode(!0)).addClass(i.slideDuplicateClass))
},
loopFix: function() {
const e = this;
e.emit("beforeLoopFix");
const {activeIndex: t, slides: i, loopedSlides: r, allowSlidePrev: n, allowSlideNext: o, snapGrid: s, rtlTranslate: a} = e;
let l;
e.allowSlidePrev = !0,
e.allowSlideNext = !0;
const c = -s[t] - e.getTranslate();
if (t < r) {
l = i.length - 3 * r + t,
l += r;
e.slideTo(l, 0, !1, !0) && 0 !== c && e.setTranslate((a ? -e.translate : e.translate) - c)
} else if (t >= i.length - r) {
l = -i.length + t + r,
l += r;
e.slideTo(l, 0, !1, !0) && 0 !== c && e.setTranslate((a ? -e.translate : e.translate) - c)
}
e.allowSlidePrev = n,
e.allowSlideNext = o,
e.emit("loopFix")
},
loopDestroy: function() {
const {$wrapperEl: e, params: t, slides: i} = this;
e.children(`.${t.slideClass}.${t.slideDuplicateClass},.${t.slideClass}.${t.slideBlankClass}`).remove(),
i.removeAttr("data-swiper-slide-index")
}
};
function oh(e) {
const t = this
, i = Au()
, r = zu()
, n = t.touchEventsData
, {params: o, touches: s, enabled: a} = t;
if (!a)
return;
if (t.animating && o.preventInteractionOnTransition)
return;
!t.animating && o.cssMode && o.loop && t.loopFix();
let l = e;
l.originalEvent && (l = l.originalEvent);
let c = Fu(l.target);
if ("wrapper" === o.touchEventsTarget && !c.closest(t.wrapperEl).length)
return;
if (n.isTouchEvent = "touchstart" === l.type,
!n.isTouchEvent && "which"in l && 3 === l.which)
return;
if (!n.isTouchEvent && "button"in l && l.button > 0)
return;
if (n.isTouched && n.isMoved)
return;
!!o.noSwipingClass && "" !== o.noSwipingClass && l.target && l.target.shadowRoot && e.path && e.path[0] && (c = Fu(e.path[0]));
const u = o.noSwipingSelector ? o.noSwipingSelector : `.${o.noSwipingClass}`
, h = !(!l.target || !l.target.shadowRoot);
if (o.noSwiping && (h ? function(e, t) {
return void 0 === t && (t = this),
function t(i) {
if (!i || i === Au() || i === zu())
return null;
i.assignedSlot && (i = i.assignedSlot);
const r = i.closest(e);
return r || i.getRootNode ? r || t(i.getRootNode().host) : null
}(t)
}(u, c[0]) : c.closest(u)[0]))
return void (t.allowClick = !0);
if (o.swipeHandler && !c.closest(o.swipeHandler)[0])
return;
s.currentX = "touchstart" === l.type ? l.targetTouches[0].pageX : l.pageX,
s.currentY = "touchstart" === l.type ? l.targetTouches[0].pageY : l.pageY;
const d = s.currentX
, p = s.currentY
, f = o.edgeSwipeDetection || o.iOSEdgeSwipeDetection
, m = o.edgeSwipeThreshold || o.iOSEdgeSwipeThreshold;
if (f && (d <= m || d >= r.innerWidth - m)) {
if ("prevent" !== f)
return;
e.preventDefault()
}
if (Object.assign(n, {
isTouched: !0,
isMoved: !1,
allowTouchCallbacks: !0,
isScrolling: void 0,
startMoving: void 0
}),
s.startX = d,
s.startY = p,
n.touchStartTime = Vu(),
t.allowClick = !0,
t.updateSize(),
t.swipeDirection = void 0,
o.threshold > 0 && (n.allowThresholdMove = !1),
"touchstart" !== l.type) {
let e = !0;
c.is(n.focusableElements) && (e = !1,
"SELECT" === c[0].nodeName && (n.isTouched = !1)),
i.activeElement && Fu(i.activeElement).is(n.focusableElements) && i.activeElement !== c[0] && i.activeElement.blur();
const r = e && t.allowTouchMove && o.touchStartPreventDefault;
!o.touchStartForcePreventDefault && !r || c[0].isContentEditable || l.preventDefault()
}
t.params.freeMode && t.params.freeMode.enabled && t.freeMode && t.animating && !o.cssMode && t.freeMode.onTouchStart(),
t.emit("touchStart", l)
}
function sh(e) {
const t = Au()
, i = this
, r = i.touchEventsData
, {params: n, touches: o, rtlTranslate: s, enabled: a} = i;
if (!a)
return;
let l = e;
if (l.originalEvent && (l = l.originalEvent),
!r.isTouched)
return void (r.startMoving && r.isScrolling && i.emit("touchMoveOpposite", l));
if (r.isTouchEvent && "touchmove" !== l.type)
return;
const c = "touchmove" === l.type && l.targetTouches && (l.targetTouches[0] || l.changedTouches[0])
, u = "touchmove" === l.type ? c.pageX : l.pageX
, h = "touchmove" === l.type ? c.pageY : l.pageY;
if (l.preventedByNestedSwiper)
return o.startX = u,
void (o.startY = h);
if (!i.allowTouchMove)
return Fu(l.target).is(r.focusableElements) || (i.allowClick = !1),
void (r.isTouched && (Object.assign(o, {
startX: u,
startY: h,
currentX: u,
currentY: h
}),
r.touchStartTime = Vu()));
if (r.isTouchEvent && n.touchReleaseOnEdges && !n.loop)
if (i.isVertical()) {
if (h < o.startY && i.translate <= i.maxTranslate() || h > o.startY && i.translate >= i.minTranslate())
return r.isTouched = !1,
void (r.isMoved = !1)
} else if (u < o.startX && i.translate <= i.maxTranslate() || u > o.startX && i.translate >= i.minTranslate())
return;
if (r.isTouchEvent && t.activeElement && l.target === t.activeElement && Fu(l.target).is(r.focusableElements))
return r.isMoved = !0,
void (i.allowClick = !1);
if (r.allowTouchCallbacks && i.emit("touchMove", l),
l.targetTouches && l.targetTouches.length > 1)
return;
o.currentX = u,
o.currentY = h;
const d = o.currentX - o.startX
, p = o.currentY - o.startY;
if (i.params.threshold && Math.sqrt(d ** 2 + p ** 2) < i.params.threshold)
return;
if (void 0 === r.isScrolling) {
let e;
i.isHorizontal() && o.currentY === o.startY || i.isVertical() && o.currentX === o.startX ? r.isScrolling = !1 : d * d + p * p >= 25 && (e = 180 * Math.atan2(Math.abs(p), Math.abs(d)) / Math.PI,
r.isScrolling = i.isHorizontal() ? e > n.touchAngle : 90 - e > n.touchAngle)
}
if (r.isScrolling && i.emit("touchMoveOpposite", l),
void 0 === r.startMoving && (o.currentX === o.startX && o.currentY === o.startY || (r.startMoving = !0)),
r.isScrolling)
return void (r.isTouched = !1);
if (!r.startMoving)
return;
i.allowClick = !1,
!n.cssMode && l.cancelable && l.preventDefault(),
n.touchMoveStopPropagation && !n.nested && l.stopPropagation(),
r.isMoved || (n.loop && !n.cssMode && i.loopFix(),
r.startTranslate = i.getTranslate(),
i.setTransition(0),
i.animating && i.$wrapperEl.trigger("webkitTransitionEnd transitionend"),
r.allowMomentumBounce = !1,
!n.grabCursor || !0 !== i.allowSlideNext && !0 !== i.allowSlidePrev || i.setGrabCursor(!0),
i.emit("sliderFirstMove", l)),
i.emit("sliderMove", l),
r.isMoved = !0;
let f = i.isHorizontal() ? d : p;
o.diff = f,
f *= n.touchRatio,
s && (f = -f),
i.swipeDirection = f > 0 ? "prev" : "next",
r.currentTranslate = f + r.startTranslate;
let m = !0
, _ = n.resistanceRatio;
if (n.touchReleaseOnEdges && (_ = 0),
f > 0 && r.currentTranslate > i.minTranslate() ? (m = !1,
n.resistance && (r.currentTranslate = i.minTranslate() - 1 + (-i.minTranslate() + r.startTranslate + f) ** _)) : f < 0 && r.currentTranslate < i.maxTranslate() && (m = !1,
n.resistance && (r.currentTranslate = i.maxTranslate() + 1 - (i.maxTranslate() - r.startTranslate - f) ** _)),
m && (l.preventedByNestedSwiper = !0),
!i.allowSlideNext && "next" === i.swipeDirection && r.currentTranslate < r.startTranslate && (r.currentTranslate = r.startTranslate),
!i.allowSlidePrev && "prev" === i.swipeDirection && r.currentTranslate > r.startTranslate && (r.currentTranslate = r.startTranslate),
i.allowSlidePrev || i.allowSlideNext || (r.currentTranslate = r.startTranslate),
n.threshold > 0) {
if (!(Math.abs(f) > n.threshold || r.allowThresholdMove))
return void (r.currentTranslate = r.startTranslate);
if (!r.allowThresholdMove)
return r.allowThresholdMove = !0,
o.startX = o.currentX,
o.startY = o.currentY,
r.currentTranslate = r.startTranslate,
void (o.diff = i.isHorizontal() ? o.currentX - o.startX : o.currentY - o.startY)
}
n.followFinger && !n.cssMode && ((n.freeMode && n.freeMode.enabled && i.freeMode || n.watchSlidesProgress) && (i.updateActiveIndex(),
i.updateSlidesClasses()),
i.params.freeMode && n.freeMode.enabled && i.freeMode && i.freeMode.onTouchMove(),
i.updateProgress(r.currentTranslate),
i.setTranslate(r.currentTranslate))
}
function ah(e) {
const t = this
, i = t.touchEventsData
, {params: r, touches: n, rtlTranslate: o, slidesGrid: s, enabled: a} = t;
if (!a)
return;
let l = e;
if (l.originalEvent && (l = l.originalEvent),
i.allowTouchCallbacks && t.emit("touchEnd", l),
i.allowTouchCallbacks = !1,
!i.isTouched)
return i.isMoved && r.grabCursor && t.setGrabCursor(!1),
i.isMoved = !1,
void (i.startMoving = !1);
r.grabCursor && i.isMoved && i.isTouched && (!0 === t.allowSlideNext || !0 === t.allowSlidePrev) && t.setGrabCursor(!1);
const c = Vu()
, u = c - i.touchStartTime;
if (t.allowClick) {
const e = l.path || l.composedPath && l.composedPath();
t.updateClickedSlide(e && e[0] || l.target),
t.emit("tap click", l),
u < 300 && c - i.lastClickTime < 300 && t.emit("doubleTap doubleClick", l)
}
if (i.lastClickTime = Vu(),
Uu((()=>{
t.destroyed || (t.allowClick = !0)
}
)),
!i.isTouched || !i.isMoved || !t.swipeDirection || 0 === n.diff || i.currentTranslate === i.startTranslate)
return i.isTouched = !1,
i.isMoved = !1,
void (i.startMoving = !1);
let h;
if (i.isTouched = !1,
i.isMoved = !1,
i.startMoving = !1,
h = r.followFinger ? o ? t.translate : -t.translate : -i.currentTranslate,
r.cssMode)
return;
if (t.params.freeMode && r.freeMode.enabled)
return void t.freeMode.onTouchEnd({
currentPos: h
});
let d = 0
, p = t.slidesSizesGrid[0];
for (let e = 0; e < s.length; e += e < r.slidesPerGroupSkip ? 1 : r.slidesPerGroup) {
const t = e < r.slidesPerGroupSkip - 1 ? 1 : r.slidesPerGroup;
void 0 !== s[e + t] ? h >= s[e] && h < s[e + t] && (d = e,
p = s[e + t] - s[e]) : h >= s[e] && (d = e,
p = s[s.length - 1] - s[s.length - 2])
}
let f = null
, m = null;
r.rewind && (t.isBeginning ? m = t.params.virtual && t.params.virtual.enabled && t.virtual ? t.virtual.slides.length - 1 : t.slides.length - 1 : t.isEnd && (f = 0));
const _ = (h - s[d]) / p
, g = d < r.slidesPerGroupSkip - 1 ? 1 : r.slidesPerGroup;
if (u > r.longSwipesMs) {
if (!r.longSwipes)
return void t.slideTo(t.activeIndex);
"next" === t.swipeDirection && (_ >= r.longSwipesRatio ? t.slideTo(r.rewind && t.isEnd ? f : d + g) : t.slideTo(d)),
"prev" === t.swipeDirection && (_ > 1 - r.longSwipesRatio ? t.slideTo(d + g) : null !== m && _ < 0 && Math.abs(_) > r.longSwipesRatio ? t.slideTo(m) : t.slideTo(d))
} else {
if (!r.shortSwipes)
return void t.slideTo(t.activeIndex);
t.navigation && (l.target === t.navigation.nextEl || l.target === t.navigation.prevEl) ? l.target === t.navigation.nextEl ? t.slideTo(d + g) : t.slideTo(d) : ("next" === t.swipeDirection && t.slideTo(null !== f ? f : d + g),
"prev" === t.swipeDirection && t.slideTo(null !== m ? m : d))
}
}
function lh() {
const e = this
, {params: t, el: i} = e;
if (i && 0 === i.offsetWidth)
return;
t.breakpoints && e.setBreakpoint();
const {allowSlideNext: r, allowSlidePrev: n, snapGrid: o} = e;
e.allowSlideNext = !0,
e.allowSlidePrev = !0,
e.updateSize(),
e.updateSlides(),
e.updateSlidesClasses(),
("auto" === t.slidesPerView || t.slidesPerView > 1) && e.isEnd && !e.isBeginning && !e.params.centeredSlides ? e.slideTo(e.slides.length - 1, 0, !1, !0) : e.slideTo(e.activeIndex, 0, !1, !0),
e.autoplay && e.autoplay.running && e.autoplay.paused && e.autoplay.run(),
e.allowSlidePrev = n,
e.allowSlideNext = r,
e.params.watchOverflow && o !== e.snapGrid && e.checkOverflow()
}
function ch(e) {
const t = this;
t.enabled && (t.allowClick || (t.params.preventClicks && e.preventDefault(),
t.params.preventClicksPropagation && t.animating && (e.stopPropagation(),
e.stopImmediatePropagation())))
}
function uh() {
const e = this
, {wrapperEl: t, rtlTranslate: i, enabled: r} = e;
if (!r)
return;
let n;
e.previousTranslate = e.translate,
e.isHorizontal() ? e.translate = -t.scrollLeft : e.translate = -t.scrollTop,
0 === e.translate && (e.translate = 0),
e.updateActiveIndex(),
e.updateSlidesClasses();
const o = e.maxTranslate() - e.minTranslate();
n = 0 === o ? 0 : (e.translate - e.minTranslate()) / o,
n !== e.progress && e.updateProgress(i ? -e.translate : e.translate),
e.emit("setTranslate", e.translate, !1)
}
let hh = !1;
function dh() {}
const ph = (e,t)=>{
const i = Au()
, {params: r, touchEvents: n, el: o, wrapperEl: s, device: a, support: l} = e
, c = !!r.nested
, u = "on" === t ? "addEventListener" : "removeEventListener"
, h = t;
if (l.touch) {
const t = !("touchstart" !== n.start || !l.passiveListener || !r.passiveListeners) && {
passive: !0,
capture: !1
};
o[u](n.start, e.onTouchStart, t),
o[u](n.move, e.onTouchMove, l.passiveListener ? {
passive: !1,
capture: c
} : c),
o[u](n.end, e.onTouchEnd, t),
n.cancel && o[u](n.cancel, e.onTouchEnd, t)
} else
o[u](n.start, e.onTouchStart, !1),
i[u](n.move, e.onTouchMove, c),
i[u](n.end, e.onTouchEnd, !1);
(r.preventClicks || r.preventClicksPropagation) && o[u]("click", e.onClick, !0),
r.cssMode && s[u]("scroll", e.onScroll),
r.updateOnWindowResize ? e[h](a.ios || a.android ? "resize orientationchange observerUpdate" : "resize observerUpdate", lh, !0) : e[h]("observerUpdate", lh, !0)
}
;
const fh = {
attachEvents: function() {
const e = this
, t = Au()
, {params: i, support: r} = e;
e.onTouchStart = oh.bind(e),
e.onTouchMove = sh.bind(e),
e.onTouchEnd = ah.bind(e),
i.cssMode && (e.onScroll = uh.bind(e)),
e.onClick = ch.bind(e),
r.touch && !hh && (t.addEventListener("touchstart", dh),
hh = !0),
ph(e, "on")
},
detachEvents: function() {
ph(this, "off")
}
}
, mh = (e,t)=>e.grid && t.grid && t.grid.rows > 1;
const _h = {
setBreakpoint: function() {
const e = this
, {activeIndex: t, initialized: i, loopedSlides: r=0, params: n, $el: o} = e
, s = n.breakpoints;
if (!s || s && 0 === Object.keys(s).length)
return;
const a = e.getBreakpoint(s, e.params.breakpointsBase, e.el);
if (!a || e.currentBreakpoint === a)
return;
const l = (a in s ? s[a] : void 0) || e.originalParams
, c = mh(e, n)
, u = mh(e, l)
, h = n.enabled;
c && !u ? (o.removeClass(`${n.containerModifierClass}grid ${n.containerModifierClass}grid-column`),
e.emitContainerClasses()) : !c && u && (o.addClass(`${n.containerModifierClass}grid`),
(l.grid.fill && "column" === l.grid.fill || !l.grid.fill && "column" === n.grid.fill) && o.addClass(`${n.containerModifierClass}grid-column`),
e.emitContainerClasses()),
["navigation", "pagination", "scrollbar"].forEach((t=>{
const i = n[t] && n[t].enabled
, r = l[t] && l[t].enabled;
i && !r && e[t].disable(),
!i && r && e[t].enable()
}
));
const d = l.direction && l.direction !== n.direction
, p = n.loop && (l.slidesPerView !== n.slidesPerView || d);
d && i && e.changeDirection(),
$u(e.params, l);
const f = e.params.enabled;
Object.assign(e, {
allowTouchMove: e.params.allowTouchMove,
allowSlideNext: e.params.allowSlideNext,
allowSlidePrev: e.params.allowSlidePrev
}),
h && !f ? e.disable() : !h && f && e.enable(),
e.currentBreakpoint = a,
e.emit("_beforeBreakpoint", l),
p && i && (e.loopDestroy(),
e.loopCreate(),
e.updateSlides(),
e.slideTo(t - r + e.loopedSlides, 0, !1)),
e.emit("breakpoint", l)
},
getBreakpoint: function(e, t, i) {
if (void 0 === t && (t = "window"),
!e || "container" === t && !i)
return;
let r = !1;
const n = zu()
, o = "window" === t ? n.innerHeight : i.clientHeight
, s = Object.keys(e).map((e=>{
if ("string" == typeof e && 0 === e.indexOf("@")) {
const t = parseFloat(e.substr(1));
return {
value: o * t,
point: e
}
}
return {
value: e,
point: e
}
}
));
s.sort(((e,t)=>parseInt(e.value, 10) - parseInt(t.value, 10)));
for (let e = 0; e < s.length; e += 1) {
const {point: o, value: a} = s[e];
"window" === t ? n.matchMedia(`(min-width: ${a}px)`).matches && (r = o) : a <= i.clientWidth && (r = o)
}
return r || "max"
}
};
const gh = {
addClasses: function() {
const e = this
, {classNames: t, params: i, rtl: r, $el: n, device: o, support: s} = e
, a = function(e, t) {
const i = [];
return e.forEach((e=>{
"object" == typeof e ? Object.keys(e).forEach((r=>{
e[r] && i.push(t + r)
}
)) : "string" == typeof e && i.push(t + e)
}
)),
i
}(["initialized", i.direction, {
"pointer-events": !s.touch
}, {
"free-mode": e.params.freeMode && i.freeMode.enabled
}, {
autoheight: i.autoHeight
}, {
rtl: r
}, {
grid: i.grid && i.grid.rows > 1
}, {
"grid-column": i.grid && i.grid.rows > 1 && "column" === i.grid.fill
}, {
android: o.android
}, {
ios: o.ios
}, {
"css-mode": i.cssMode
}, {
centered: i.cssMode && i.centeredSlides
}, {
"watch-progress": i.watchSlidesProgress
}], i.containerModifierClass);
t.push(...a),
n.addClass([...t].join(" ")),
e.emitContainerClasses()
},
removeClasses: function() {
const {$el: e, classNames: t} = this;
e.removeClass(t.join(" ")),
this.emitContainerClasses()
}
};
const yh = {
init: !0,
direction: "horizontal",
touchEventsTarget: "wrapper",
initialSlide: 0,
speed: 300,
cssMode: !1,
updateOnWindowResize: !0,
resizeObserver: !0,
nested: !1,
createElements: !1,
enabled: !0,
focusableElements: "input, select, option, textarea, button, video, label",
width: null,
height: null,
preventInteractionOnTransition: !1,
userAgent: null,
url: null,
edgeSwipeDetection: !1,
edgeSwipeThreshold: 20,
autoHeight: !1,
setWrapperSize: !1,
virtualTranslate: !1,
effect: "slide",
breakpoints: void 0,
breakpointsBase: "window",
spaceBetween: 0,
slidesPerView: 1,
slidesPerGroup: 1,
slidesPerGroupSkip: 0,
slidesPerGroupAuto: !1,
centeredSlides: !1,
centeredSlidesBounds: !1,
slidesOffsetBefore: 0,
slidesOffsetAfter: 0,
normalizeSlideIndex: !0,
centerInsufficientSlides: !1,
watchOverflow: !0,
roundLengths: !1,
touchRatio: 1,
touchAngle: 45,
simulateTouch: !0,
shortSwipes: !0,
longSwipes: !0,
longSwipesRatio: .5,
longSwipesMs: 300,
followFinger: !0,
allowTouchMove: !0,
threshold: 0,
touchMoveStopPropagation: !1,
touchStartPreventDefault: !0,
touchStartForcePreventDefault: !1,
touchReleaseOnEdges: !1,
uniqueNavElements: !0,
resistance: !0,
resistanceRatio: .85,
watchSlidesProgress: !1,
grabCursor: !1,
preventClicks: !0,
preventClicksPropagation: !0,
slideToClickedSlide: !1,
preloadImages: !0,
updateOnImagesReady: !0,
loop: !1,
loopAdditionalSlides: 0,
loopedSlides: null,
loopedSlidesLimit: !0,
loopFillGroupWithBlank: !1,
loopPreventsSlide: !0,
rewind: !1,
allowSlidePrev: !0,
allowSlideNext: !0,
swipeHandler: null,
noSwiping: !0,
noSwipingClass: "swiper-no-swiping",
noSwipingSelector: null,
passiveListeners: !0,
maxBackfaceHiddenSlides: 10,
containerModifierClass: "swiper-",
slideClass: "swiper-slide",
slideBlankClass: "swiper-slide-invisible-blank",
slideActiveClass: "swiper-slide-active",
slideDuplicateActiveClass: "swiper-slide-duplicate-active",
slideVisibleClass: "swiper-slide-visible",
slideDuplicateClass: "swiper-slide-duplicate",
slideNextClass: "swiper-slide-next",
slideDuplicateNextClass: "swiper-slide-duplicate-next",
slidePrevClass: "swiper-slide-prev",
slideDuplicatePrevClass: "swiper-slide-duplicate-prev",
wrapperClass: "swiper-wrapper",
runCallbacksOnInit: !0,
_emitClasses: !1
};
function xh(e, t) {
return function(i) {
void 0 === i && (i = {});
const r = Object.keys(i)[0]
, n = i[r];
"object" == typeof n && null !== n ? (["navigation", "pagination", "scrollbar"].indexOf(r) >= 0 && !0 === e[r] && (e[r] = {
auto: !0
}),
r in e && "enabled"in n ? (!0 === e[r] && (e[r] = {
enabled: !0
}),
"object" != typeof e[r] || "enabled"in e[r] || (e[r].enabled = !0),
e[r] || (e[r] = {
enabled: !1
}),
$u(t, i)) : $u(t, i)) : $u(t, i)
}
}
const vh = {
eventsEmitter: Qu,
update: eh,
translate: th,
transition: {
setTransition: function(e, t) {
const i = this;
i.params.cssMode || i.$wrapperEl.transition(e),
i.emit("setTransition", e, t)
},
transitionStart: function(e, t) {
void 0 === e && (e = !0);
const i = this
, {params: r} = i;
r.cssMode || (r.autoHeight && i.updateAutoHeight(),
ih({
swiper: i,
runCallbacks: e,
direction: t,
step: "Start"
}))
},
transitionEnd: function(e, t) {
void 0 === e && (e = !0);
const i = this
, {params: r} = i;
i.animating = !1,
r.cssMode || (i.setTransition(0),
ih({
swiper: i,
runCallbacks: e,
direction: t,
step: "End"
}))
}
},
slide: rh,
loop: nh,
grabCursor: {
setGrabCursor: function(e) {
const t = this;
if (t.support.touch || !t.params.simulateTouch || t.params.watchOverflow && t.isLocked || t.params.cssMode)
return;
const i = "container" === t.params.touchEventsTarget ? t.el : t.wrapperEl;
i.style.cursor = "move",
i.style.cursor = e ? "grabbing" : "grab"
},
unsetGrabCursor: function() {
const e = this;
e.support.touch || e.params.watchOverflow && e.isLocked || e.params.cssMode || (e["container" === e.params.touchEventsTarget ? "el" : "wrapperEl"].style.cursor = "")
}
},
events: fh,
breakpoints: _h,
checkOverflow: {
checkOverflow: function() {
const e = this
, {isLocked: t, params: i} = e
, {slidesOffsetBefore: r} = i;
if (r) {
const t = e.slides.length - 1
, i = e.slidesGrid[t] + e.slidesSizesGrid[t] + 2 * r;
e.isLocked = e.size > i
} else
e.isLocked = 1 === e.snapGrid.length;
!0 === i.allowSlideNext && (e.allowSlideNext = !e.isLocked),
!0 === i.allowSlidePrev && (e.allowSlidePrev = !e.isLocked),
t && t !== e.isLocked && (e.isEnd = !1),
t !== e.isLocked && e.emit(e.isLocked ? "lock" : "unlock")
}
},
classes: gh,
images: {
loadImage: function(e, t, i, r, n, o) {
const s = zu();
let a;
function l() {
o && o()
}
Fu(e).parent("picture")[0] || e.complete && n ? l() : t ? (a = new s.Image,
a.onload = l,
a.onerror = l,
r && (a.sizes = r),
i && (a.srcset = i),
t && (a.src = t)) : l()
},
preloadImages: function() {
const e = this;
function t() {
null != e && e && !e.destroyed && (void 0 !== e.imagesLoaded && (e.imagesLoaded += 1),
e.imagesLoaded === e.imagesToLoad.length && (e.params.updateOnImagesReady && e.update(),
e.emit("imagesReady")))
}
e.imagesToLoad = e.$el.find("img");
for (let i = 0; i < e.imagesToLoad.length; i += 1) {
const r = e.imagesToLoad[i];
e.loadImage(r, r.currentSrc || r.getAttribute("src"), r.srcset || r.getAttribute("srcset"), r.sizes || r.getAttribute("sizes"), !0, t)
}
}
}
}
, bh = {};
class wh {
constructor() {
let e, t;
for (var i = arguments.length, r = new Array(i), n = 0; n < i; n++)
r[n] = arguments[n];
if (1 === r.length && r[0].constructor && "Object" === Object.prototype.toString.call(r[0]).slice(8, -1) ? t = r[0] : [e,t] = r,
t || (t = {}),
t = $u({}, t),
e && !t.el && (t.el = e),
t.el && Fu(t.el).length > 1) {
const e = [];
return Fu(t.el).each((i=>{
const r = $u({}, t, {
el: i
});
e.push(new wh(r))
}
)),
e
}
const o = this;
o.__swiper__ = !0,
o.support = Yu(),
o.device = Ku({
userAgent: t.userAgent
}),
o.browser = Ju(),
o.eventsListeners = {},
o.eventsAnyListeners = [],
o.modules = [...o.__modules__],
t.modules && Array.isArray(t.modules) && o.modules.push(...t.modules);
const s = {};
o.modules.forEach((e=>{
e({
swiper: o,
extendParams: xh(t, s),
on: o.on.bind(o),
once: o.once.bind(o),
off: o.off.bind(o),
emit: o.emit.bind(o)
})
}
));
const a = $u({}, yh, s);
return o.params = $u({}, a, bh, t),
o.originalParams = $u({}, o.params),
o.passedParams = $u({}, t),
o.params && o.params.on && Object.keys(o.params.on).forEach((e=>{
o.on(e, o.params.on[e])
}
)),
o.params && o.params.onAny && o.onAny(o.params.onAny),
o.$ = Fu,
Object.assign(o, {
enabled: o.params.enabled,
el: e,
classNames: [],
slides: Fu(),
slidesGrid: [],
snapGrid: [],
slidesSizesGrid: [],
isHorizontal: ()=>"horizontal" === o.params.direction,
isVertical: ()=>"vertical" === o.params.direction,
activeIndex: 0,
realIndex: 0,
isBeginning: !0,
isEnd: !1,
translate: 0,
previousTranslate: 0,
progress: 0,
velocity: 0,
animating: !1,
allowSlideNext: o.params.allowSlideNext,
allowSlidePrev: o.params.allowSlidePrev,
touchEvents: function() {
const e = ["touchstart", "touchmove", "touchend", "touchcancel"]
, t = ["pointerdown", "pointermove", "pointerup"];
return o.touchEventsTouch = {
start: e[0],
move: e[1],
end: e[2],
cancel: e[3]
},
o.touchEventsDesktop = {
start: t[0],
move: t[1],
end: t[2]
},
o.support.touch || !o.params.simulateTouch ? o.touchEventsTouch : o.touchEventsDesktop
}(),
touchEventsData: {
isTouched: void 0,
isMoved: void 0,
allowTouchCallbacks: void 0,
touchStartTime: void 0,
isScrolling: void 0,
currentTranslate: void 0,
startTranslate: void 0,
allowThresholdMove: void 0,
focusableElements: o.params.focusableElements,
lastClickTime: Vu(),
clickTimeout: void 0,
velocities: [],
allowMomentumBounce: void 0,
isTouchEvent: void 0,
startMoving: void 0
},
allowClick: !0,
allowTouchMove: o.params.allowTouchMove,
touches: {
startX: 0,
startY: 0,
currentX: 0,
currentY: 0,
diff: 0
},
imagesToLoad: [],
imagesLoaded: 0
}),
o.emit("_swiper"),
o.params.init && o.init(),
o
}
enable() {
const e = this;
e.enabled || (e.enabled = !0,
e.params.grabCursor && e.setGrabCursor(),
e.emit("enable"))
}
disable() {
const e = this;
e.enabled && (e.enabled = !1,
e.params.grabCursor && e.unsetGrabCursor(),
e.emit("disable"))
}
setProgress(e, t) {
const i = this;
e = Math.min(Math.max(e, 0), 1);
const r = i.minTranslate()
, n = (i.maxTranslate() - r) * e + r;
i.translateTo(n, void 0 === t ? 0 : t),
i.updateActiveIndex(),
i.updateSlidesClasses()
}
emitContainerClasses() {
const e = this;
if (!e.params._emitClasses || !e.el)
return;
const t = e.el.className.split(" ").filter((t=>0 === t.indexOf("swiper") || 0 === t.indexOf(e.params.containerModifierClass)));
e.emit("_containerClasses", t.join(" "))
}
getSlideClasses(e) {
const t = this;
return t.destroyed ? "" : e.className.split(" ").filter((e=>0 === e.indexOf("swiper-slide") || 0 === e.indexOf(t.params.slideClass))).join(" ")
}
emitSlidesClasses() {
const e = this;
if (!e.params._emitClasses || !e.el)
return;
const t = [];
e.slides.each((i=>{
const r = e.getSlideClasses(i);
t.push({
slideEl: i,
classNames: r
}),
e.emit("_slideClass", i, r)
}
)),
e.emit("_slideClasses", t)
}
slidesPerViewDynamic(e, t) {
void 0 === e && (e = "current"),
void 0 === t && (t = !1);
const {params: i, slides: r, slidesGrid: n, slidesSizesGrid: o, size: s, activeIndex: a} = this;
let l = 1;
if (i.centeredSlides) {
let e, t = r[a].swiperSlideSize;
for (let i = a + 1; i < r.length; i += 1)
r[i] && !e && (t += r[i].swiperSlideSize,
l += 1,
t > s && (e = !0));
for (let i = a - 1; i >= 0; i -= 1)
r[i] && !e && (t += r[i].swiperSlideSize,
l += 1,
t > s && (e = !0))
} else if ("current" === e)
for (let e = a + 1; e < r.length; e += 1) {
(t ? n[e] + o[e] - n[a] < s : n[e] - n[a] < s) && (l += 1)
}
else
for (let e = a - 1; e >= 0; e -= 1) {
n[a] - n[e] < s && (l += 1)
}
return l
}
update() {
const e = this;
if (!e || e.destroyed)
return;
const {snapGrid: t, params: i} = e;
function r() {
const t = e.rtlTranslate ? -1 * e.translate : e.translate
, i = Math.min(Math.max(t, e.maxTranslate()), e.minTranslate());
e.setTranslate(i),
e.updateActiveIndex(),
e.updateSlidesClasses()
}
let n;
i.breakpoints && e.setBreakpoint(),
e.updateSize(),
e.updateSlides(),
e.updateProgress(),
e.updateSlidesClasses(),
e.params.freeMode && e.params.freeMode.enabled ? (r(),
e.params.autoHeight && e.updateAutoHeight()) : (n = ("auto" === e.params.slidesPerView || e.params.slidesPerView > 1) && e.isEnd && !e.params.centeredSlides ? e.slideTo(e.slides.length - 1, 0, !1, !0) : e.slideTo(e.activeIndex, 0, !1, !0),
n || r()),
i.watchOverflow && t !== e.snapGrid && e.checkOverflow(),
e.emit("update")
}
changeDirection(e, t) {
void 0 === t && (t = !0);
const i = this
, r = i.params.direction;
return e || (e = "horizontal" === r ? "vertical" : "horizontal"),
e === r || "horizontal" !== e && "vertical" !== e || (i.$el.removeClass(`${i.params.containerModifierClass}${r}`).addClass(`${i.params.containerModifierClass}${e}`),
i.emitContainerClasses(),
i.params.direction = e,
i.slides.each((t=>{
"vertical" === e ? t.style.width = "" : t.style.height = ""
}
)),
i.emit("changeDirection"),
t && i.update()),
i
}
changeLanguageDirection(e) {
const t = this;
t.rtl && "rtl" === e || !t.rtl && "ltr" === e || (t.rtl = "rtl" === e,
t.rtlTranslate = "horizontal" === t.params.direction && t.rtl,
t.rtl ? (t.$el.addClass(`${t.params.containerModifierClass}rtl`),
t.el.dir = "rtl") : (t.$el.removeClass(`${t.params.containerModifierClass}rtl`),
t.el.dir = "ltr"),
t.update())
}
mount(e) {
const t = this;
if (t.mounted)
return !0;
const i = Fu(e || t.params.el);
if (!(e = i[0]))
return !1;
e.swiper = t;
const r = ()=>`.${(t.params.wrapperClass || "").trim().split(" ").join(".")}`;
let n = (()=>{
if (e && e.shadowRoot && e.shadowRoot.querySelector) {
const t = Fu(e.shadowRoot.querySelector(r()));
return t.children = e=>i.children(e),
t
}
return i.children ? i.children(r()) : Fu(i).children(r())
}
)();
if (0 === n.length && t.params.createElements) {
const e = Au().createElement("div");
n = Fu(e),
e.className = t.params.wrapperClass,
i.append(e),
i.children(`.${t.params.slideClass}`).each((e=>{
n.append(e)
}
))
}
return Object.assign(t, {
$el: i,
el: e,
$wrapperEl: n,
wrapperEl: n[0],
mounted: !0,
rtl: "rtl" === e.dir.toLowerCase() || "rtl" === i.css("direction"),
rtlTranslate: "horizontal" === t.params.direction && ("rtl" === e.dir.toLowerCase() || "rtl" === i.css("direction")),
wrongRTL: "-webkit-box" === n.css("display")
}),
!0
}
init(e) {
const t = this;
if (t.initialized)
return t;
return !1 === t.mount(e) || (t.emit("beforeInit"),
t.params.breakpoints && t.setBreakpoint(),
t.addClasses(),
t.params.loop && t.loopCreate(),
t.updateSize(),
t.updateSlides(),
t.params.watchOverflow && t.checkOverflow(),
t.params.grabCursor && t.enabled && t.setGrabCursor(),
t.params.preloadImages && t.preloadImages(),
t.params.loop ? t.slideTo(t.params.initialSlide + t.loopedSlides, 0, t.params.runCallbacksOnInit, !1, !0) : t.slideTo(t.params.initialSlide, 0, t.params.runCallbacksOnInit, !1, !0),
t.attachEvents(),
t.initialized = !0,
t.emit("init"),
t.emit("afterInit")),
t
}
destroy(e, t) {
void 0 === e && (e = !0),
void 0 === t && (t = !0);
const i = this
, {params: r, $el: n, $wrapperEl: o, slides: s} = i;
return void 0 === i.params || i.destroyed || (i.emit("beforeDestroy"),
i.initialized = !1,
i.detachEvents(),
r.loop && i.loopDestroy(),
t && (i.removeClasses(),
n.removeAttr("style"),
o.removeAttr("style"),
s && s.length && s.removeClass([r.slideVisibleClass, r.slideActiveClass, r.slideNextClass, r.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index")),
i.emit("destroy"),
Object.keys(i.eventsListeners).forEach((e=>{
i.off(e)
}
)),
!1 !== e && (i.$el[0].swiper = null,
function(e) {
const t = e;
Object.keys(t).forEach((e=>{
try {
t[e] = null
} catch (e) {}
try {
delete t[e]
} catch (e) {}
}
))
}(i)),
i.destroyed = !0),
null
}
static extendDefaults(e) {
$u(bh, e)
}
static get extendedDefaults() {
return bh
}
static get defaults() {
return yh
}
static installModule(e) {
wh.prototype.__modules__ || (wh.prototype.__modules__ = []);
const t = wh.prototype.__modules__;
"function" == typeof e && t.indexOf(e) < 0 && t.push(e)
}
static use(e) {
return Array.isArray(e) ? (e.forEach((e=>wh.installModule(e))),
wh) : (wh.installModule(e),
wh)
}
}
Object.keys(vh).forEach((e=>{
Object.keys(vh[e]).forEach((t=>{
wh.prototype[t] = vh[e][t]
}
))
}
)),
wh.use([function(e) {
let {swiper: t, on: i, emit: r} = e;
const n = zu();
let o = null
, s = null;
const a = ()=>{
t && !t.destroyed && t.initialized && (r("beforeResize"),
r("resize"))
}
, l = ()=>{
t && !t.destroyed && t.initialized && r("orientationchange")
}
;
i("init", (()=>{
t.params.resizeObserver && void 0 !== n.ResizeObserver ? t && !t.destroyed && t.initialized && (o = new ResizeObserver((e=>{
s = n.requestAnimationFrame((()=>{
const {width: i, height: r} = t;
let n = i
, o = r;
e.forEach((e=>{
let {contentBoxSize: i, contentRect: r, target: s} = e;
s && s !== t.el || (n = r ? r.width : (i[0] || i).inlineSize,
o = r ? r.height : (i[0] || i).blockSize)
}
)),
n === i && o === r || a()
}
))
}
)),
o.observe(t.el)) : (n.addEventListener("resize", a),
n.addEventListener("orientationchange", l))
}
)),
i("destroy", (()=>{
s && n.cancelAnimationFrame(s),
o && o.unobserve && t.el && (o.unobserve(t.el),
o = null),
n.removeEventListener("resize", a),
n.removeEventListener("orientationchange", l)
}
))
}
, function(e) {
let {swiper: t, extendParams: i, on: r, emit: n} = e;
const o = []
, s = zu()
, a = function(e, t) {
void 0 === t && (t = {});
const i = new (s.MutationObserver || s.WebkitMutationObserver)((e=>{
if (1 === e.length)
return void n("observerUpdate", e[0]);
const t = function() {
n("observerUpdate", e[0])
};
s.requestAnimationFrame ? s.requestAnimationFrame(t) : s.setTimeout(t, 0)
}
));
i.observe(e, {
attributes: void 0 === t.attributes || t.attributes,
childList: void 0 === t.childList || t.childList,
characterData: void 0 === t.characterData || t.characterData
}),
o.push(i)
};
i({
observer: !1,
observeParents: !1,
observeSlideChildren: !1
}),
r("init", (()=>{
if (t.params.observer) {
if (t.params.observeParents) {
const e = t.$el.parents();
for (let t = 0; t < e.length; t += 1)
a(e[t])
}
a(t.$el[0], {
childList: t.params.observeSlideChildren
}),
a(t.$wrapperEl[0], {
attributes: !1
})
}
}
)),
r("destroy", (()=>{
o.forEach((e=>{
e.disconnect()
}
)),
o.splice(0, o.length)
}
))
}
]);
const Th = wh;
function Eh(e, t, i, r) {
const n = Au();
return e.params.createElements && Object.keys(r).forEach((o=>{
if (!i[o] && !0 === i.auto) {
let s = e.$el.children(`.${r[o]}`)[0];
s || (s = n.createElement("div"),
s.className = r[o],
e.$el.append(s)),
i[o] = s,
t[o] = s
}
}
)),
i
}
function Sh(e) {
let {swiper: t, extendParams: i, on: r, emit: n} = e;
function o(e) {
let i;
return e && (i = Fu(e),
t.params.uniqueNavElements && "string" == typeof e && i.length > 1 && 1 === t.$el.find(e).length && (i = t.$el.find(e))),
i
}
function s(e, i) {
const r = t.params.navigation;
e && e.length > 0 && (e[i ? "addClass" : "removeClass"](r.disabledClass),
e[0] && "BUTTON" === e[0].tagName && (e[0].disabled = i),
t.params.watchOverflow && t.enabled && e[t.isLocked ? "addClass" : "removeClass"](r.lockClass))
}
function a() {
if (t.params.loop)
return;
const {$nextEl: e, $prevEl: i} = t.navigation;
s(i, t.isBeginning && !t.params.rewind),
s(e, t.isEnd && !t.params.rewind)
}
function l(e) {
e.preventDefault(),
(!t.isBeginning || t.params.loop || t.params.rewind) && (t.slidePrev(),
n("navigationPrev"))
}
function c(e) {
e.preventDefault(),
(!t.isEnd || t.params.loop || t.params.rewind) && (t.slideNext(),
n("navigationNext"))
}
function u() {
const e = t.params.navigation;
if (t.params.navigation = Eh(t, t.originalParams.navigation, t.params.navigation, {
nextEl: "swiper-button-next",
prevEl: "swiper-button-prev"
}),
!e.nextEl && !e.prevEl)
return;
const i = o(e.nextEl)
, r = o(e.prevEl);
i && i.length > 0 && i.on("click", c),
r && r.length > 0 && r.on("click", l),
Object.assign(t.navigation, {
$nextEl: i,
nextEl: i && i[0],
$prevEl: r,
prevEl: r && r[0]
}),
t.enabled || (i && i.addClass(e.lockClass),
r && r.addClass(e.lockClass))
}
function h() {
const {$nextEl: e, $prevEl: i} = t.navigation;
e && e.length && (e.off("click", c),
e.removeClass(t.params.navigation.disabledClass)),
i && i.length && (i.off("click", l),
i.removeClass(t.params.navigation.disabledClass))
}
i({
navigation: {
nextEl: null,
prevEl: null,
hideOnClick: !1,
disabledClass: "swiper-button-disabled",
hiddenClass: "swiper-button-hidden",
lockClass: "swiper-button-lock",
navigationDisabledClass: "swiper-navigation-disabled"
}
}),
t.navigation = {
nextEl: null,
$nextEl: null,
prevEl: null,
$prevEl: null
},
r("init", (()=>{
!1 === t.params.navigation.enabled ? d() : (u(),
a())
}
)),
r("toEdge fromEdge lock unlock", (()=>{
a()
}
)),
r("destroy", (()=>{
h()
}
)),
r("enable disable", (()=>{
const {$nextEl: e, $prevEl: i} = t.navigation;
e && e[t.enabled ? "removeClass" : "addClass"](t.params.navigation.lockClass),
i && i[t.enabled ? "removeClass" : "addClass"](t.params.navigation.lockClass)
}
)),
r("click", ((e,i)=>{
const {$nextEl: r, $prevEl: o} = t.navigation
, s = i.target;
if (t.params.navigation.hideOnClick && !Fu(s).is(o) && !Fu(s).is(r)) {
if (t.pagination && t.params.pagination && t.params.pagination.clickable && (t.pagination.el === s || t.pagination.el.contains(s)))
return;
let e;
r ? e = r.hasClass(t.params.navigation.hiddenClass) : o && (e = o.hasClass(t.params.navigation.hiddenClass)),
n(!0 === e ? "navigationShow" : "navigationHide"),
r && r.toggleClass(t.params.navigation.hiddenClass),
o && o.toggleClass(t.params.navigation.hiddenClass)
}
}
));
const d = ()=>{
t.$el.addClass(t.params.navigation.navigationDisabledClass),
h()
}
;
Object.assign(t.navigation, {
enable: ()=>{
t.$el.removeClass(t.params.navigation.navigationDisabledClass),
u(),
a()
}
,
disable: d,
update: a,
init: u,
destroy: h
})
}
function Ch(e) {
return void 0 === e && (e = ""),
`.${e.trim().replace(/([\.:!\/])/g, "\\$1").replace(/ /g, ".")}`
}
function Mh(e) {
let {swiper: t, extendParams: i, on: r, emit: n} = e;
const o = "swiper-pagination";
let s;
i({
pagination: {
el: null,
bulletElement: "span",
clickable: !1,
hideOnClick: !1,
renderBullet: null,
renderProgressbar: null,
renderFraction: null,
renderCustom: null,
progressbarOpposite: !1,
type: "bullets",
dynamicBullets: !1,
dynamicMainBullets: 1,
formatFractionCurrent: e=>e,
formatFractionTotal: e=>e,
bulletClass: `${o}-bullet`,
bulletActiveClass: `${o}-bullet-active`,
modifierClass: `${o}-`,
currentClass: `${o}-current`,
totalClass: `${o}-total`,
hiddenClass: `${o}-hidden`,
progressbarFillClass: `${o}-progressbar-fill`,
progressbarOppositeClass: `${o}-progressbar-opposite`,
clickableClass: `${o}-clickable`,
lockClass: `${o}-lock`,
horizontalClass: `${o}-horizontal`,
verticalClass: `${o}-vertical`,
paginationDisabledClass: `${o}-disabled`
}
}),
t.pagination = {
el: null,
$el: null,
bullets: []
};
let a = 0;
function l() {
return !t.params.pagination.el || !t.pagination.el || !t.pagination.$el || 0 === t.pagination.$el.length
}
function c(e, i) {
const {bulletActiveClass: r} = t.params.pagination;
e[i]().addClass(`${r}-${i}`)[i]().addClass(`${r}-${i}-${i}`)
}
function u() {
const e = t.rtl
, i = t.params.pagination;
if (l())
return;
const r = t.virtual && t.params.virtual.enabled ? t.virtual.slides.length : t.slides.length
, o = t.pagination.$el;
let u;
const h = t.params.loop ? Math.ceil((r - 2 * t.loopedSlides) / t.params.slidesPerGroup) : t.snapGrid.length;
if (t.params.loop ? (u = Math.ceil((t.activeIndex - t.loopedSlides) / t.params.slidesPerGroup),
u > r - 1 - 2 * t.loopedSlides && (u -= r - 2 * t.loopedSlides),
u > h - 1 && (u -= h),
u < 0 && "bullets" !== t.params.paginationType && (u = h + u)) : u = void 0 !== t.snapIndex ? t.snapIndex : t.activeIndex || 0,
"bullets" === i.type && t.pagination.bullets && t.pagination.bullets.length > 0) {
const r = t.pagination.bullets;
let n, l, h;
if (i.dynamicBullets && (s = r.eq(0)[t.isHorizontal() ? "outerWidth" : "outerHeight"](!0),
o.css(t.isHorizontal() ? "width" : "height", s * (i.dynamicMainBullets + 4) + "px"),
i.dynamicMainBullets > 1 && void 0 !== t.previousIndex && (a += u - (t.previousIndex - t.loopedSlides || 0),
a > i.dynamicMainBullets - 1 ? a = i.dynamicMainBullets - 1 : a < 0 && (a = 0)),
n = Math.max(u - a, 0),
l = n + (Math.min(r.length, i.dynamicMainBullets) - 1),
h = (l + n) / 2),
r.removeClass(["", "-next", "-next-next", "-prev", "-prev-prev", "-main"].map((e=>`${i.bulletActiveClass}${e}`)).join(" ")),
o.length > 1)
r.each((e=>{
const t = Fu(e)
, r = t.index();
r === u && t.addClass(i.bulletActiveClass),
i.dynamicBullets && (r >= n && r <= l && t.addClass(`${i.bulletActiveClass}-main`),
r === n && c(t, "prev"),
r === l && c(t, "next"))
}
));
else {
const e = r.eq(u)
, o = e.index();
if (e.addClass(i.bulletActiveClass),
i.dynamicBullets) {
const e = r.eq(n)
, s = r.eq(l);
for (let e = n; e <= l; e += 1)
r.eq(e).addClass(`${i.bulletActiveClass}-main`);
if (t.params.loop)
if (o >= r.length) {
for (let e = i.dynamicMainBullets; e >= 0; e -= 1)
r.eq(r.length - e).addClass(`${i.bulletActiveClass}-main`);
r.eq(r.length - i.dynamicMainBullets - 1).addClass(`${i.bulletActiveClass}-prev`)
} else
c(e, "prev"),
c(s, "next");
else
c(e, "prev"),
c(s, "next")
}
}
if (i.dynamicBullets) {
const n = Math.min(r.length, i.dynamicMainBullets + 4)
, o = (s * n - s) / 2 - h * s
, a = e ? "right" : "left";
r.css(t.isHorizontal() ? a : "top", `${o}px`)
}
}
if ("fraction" === i.type && (o.find(Ch(i.currentClass)).text(i.formatFractionCurrent(u + 1)),
o.find(Ch(i.totalClass)).text(i.formatFractionTotal(h))),
"progressbar" === i.type) {
let e;
e = i.progressbarOpposite ? t.isHorizontal() ? "vertical" : "horizontal" : t.isHorizontal() ? "horizontal" : "vertical";
const r = (u + 1) / h;
let n = 1
, s = 1;
"horizontal" === e ? n = r : s = r,
o.find(Ch(i.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${n}) scaleY(${s})`).transition(t.params.speed)
}
"custom" === i.type && i.renderCustom ? (o.html(i.renderCustom(t, u + 1, h)),
n("paginationRender", o[0])) : n("paginationUpdate", o[0]),
t.params.watchOverflow && t.enabled && o[t.isLocked ? "addClass" : "removeClass"](i.lockClass)
}
function h() {
const e = t.params.pagination;
if (l())
return;
const i = t.virtual && t.params.virtual.enabled ? t.virtual.slides.length : t.slides.length
, r = t.pagination.$el;
let o = "";
if ("bullets" === e.type) {
let n = t.params.loop ? Math.ceil((i - 2 * t.loopedSlides) / t.params.slidesPerGroup) : t.snapGrid.length;
t.params.freeMode && t.params.freeMode.enabled && !t.params.loop && n > i && (n = i);
for (let i = 0; i < n; i += 1)
e.renderBullet ? o += e.renderBullet.call(t, i, e.bulletClass) : o += `<${e.bulletElement} class="${e.bulletClass}"></${e.bulletElement}>`;
r.html(o),
t.pagination.bullets = r.find(Ch(e.bulletClass))
}
"fraction" === e.type && (o = e.renderFraction ? e.renderFraction.call(t, e.currentClass, e.totalClass) : `<span class="${e.currentClass}"></span> / <span class="${e.totalClass}"></span>`,
r.html(o)),
"progressbar" === e.type && (o = e.renderProgressbar ? e.renderProgressbar.call(t, e.progressbarFillClass) : `<span class="${e.progressbarFillClass}"></span>`,
r.html(o)),
"custom" !== e.type && n("paginationRender", t.pagination.$el[0])
}
function d() {
t.params.pagination = Eh(t, t.originalParams.pagination, t.params.pagination, {
el: "swiper-pagination"
});
const e = t.params.pagination;
if (!e.el)
return;
let i = Fu(e.el);
0 !== i.length && (t.params.uniqueNavElements && "string" == typeof e.el && i.length > 1 && (i = t.$el.find(e.el),
i.length > 1 && (i = i.filter((e=>Fu(e).parents(".swiper")[0] === t.el)))),
"bullets" === e.type && e.clickable && i.addClass(e.clickableClass),
i.addClass(e.modifierClass + e.type),
i.addClass(t.isHorizontal() ? e.horizontalClass : e.verticalClass),
"bullets" === e.type && e.dynamicBullets && (i.addClass(`${e.modifierClass}${e.type}-dynamic`),
a = 0,
e.dynamicMainBullets < 1 && (e.dynamicMainBullets = 1)),
"progressbar" === e.type && e.progressbarOpposite && i.addClass(e.progressbarOppositeClass),
e.clickable && i.on("click", Ch(e.bulletClass), (function(e) {
e.preventDefault();
let i = Fu(this).index() * t.params.slidesPerGroup;
t.params.loop && (i += t.loopedSlides),
t.slideTo(i)
}
)),
Object.assign(t.pagination, {
$el: i,
el: i[0]
}),
t.enabled || i.addClass(e.lockClass))
}
function p() {
const e = t.params.pagination;
if (l())
return;
const i = t.pagination.$el;
i.removeClass(e.hiddenClass),
i.removeClass(e.modifierClass + e.type),
i.removeClass(t.isHorizontal() ? e.horizontalClass : e.verticalClass),
t.pagination.bullets && t.pagination.bullets.removeClass && t.pagination.bullets.removeClass(e.bulletActiveClass),
e.clickable && i.off("click", Ch(e.bulletClass))
}
r("init", (()=>{
!1 === t.params.pagination.enabled ? f() : (d(),
h(),
u())
}
)),
r("activeIndexChange", (()=>{
(t.params.loop || void 0 === t.snapIndex) && u()
}
)),
r("snapIndexChange", (()=>{
t.params.loop || u()
}
)),
r("slidesLengthChange", (()=>{
t.params.loop && (h(),
u())
}
)),
r("snapGridLengthChange", (()=>{
t.params.loop || (h(),
u())
}
)),
r("destroy", (()=>{
p()
}
)),
r("enable disable", (()=>{
const {$el: e} = t.pagination;
e && e[t.enabled ? "removeClass" : "addClass"](t.params.pagination.lockClass)
}
)),
r("lock unlock", (()=>{
u()
}
)),
r("click", ((e,i)=>{
const r = i.target
, {$el: o} = t.pagination;
if (t.params.pagination.el && t.params.pagination.hideOnClick && o && o.length > 0 && !Fu(r).hasClass(t.params.pagination.bulletClass)) {
if (t.navigation && (t.navigation.nextEl && r === t.navigation.nextEl || t.navigation.prevEl && r === t.navigation.prevEl))
return;
const e = o.hasClass(t.params.pagination.hiddenClass);
n(!0 === e ? "paginationShow" : "paginationHide"),
o.toggleClass(t.params.pagination.hiddenClass)
}
}
));
const f = ()=>{
t.$el.addClass(t.params.pagination.paginationDisabledClass),
t.pagination.$el && t.pagination.$el.addClass(t.params.pagination.paginationDisabledClass),
p()
}
;
Object.assign(t.pagination, {
enable: ()=>{
t.$el.removeClass(t.params.pagination.paginationDisabledClass),
t.pagination.$el && t.pagination.$el.removeClass(t.params.pagination.paginationDisabledClass),
d(),
h(),
u()
}
,
disable: f,
render: h,
update: u,
init: d,
destroy: p
})
}
function Ah(e) {
let t, {swiper: i, extendParams: r, on: n, emit: o} = e;
function s() {
if (!i.size)
return i.autoplay.running = !1,
void (i.autoplay.paused = !1);
const e = i.slides.eq(i.activeIndex);
let r = i.params.autoplay.delay;
e.attr("data-swiper-autoplay") && (r = e.attr("data-swiper-autoplay") || i.params.autoplay.delay),
clearTimeout(t),
t = Uu((()=>{
let e;
i.params.autoplay.reverseDirection ? i.params.loop ? (i.loopFix(),
e = i.slidePrev(i.params.speed, !0, !0),
o("autoplay")) : i.isBeginning ? i.params.autoplay.stopOnLastSlide ? l() : (e = i.slideTo(i.slides.length - 1, i.params.speed, !0, !0),
o("autoplay")) : (e = i.slidePrev(i.params.speed, !0, !0),
o("autoplay")) : i.params.loop ? (i.loopFix(),
e = i.slideNext(i.params.speed, !0, !0),
o("autoplay")) : i.isEnd ? i.params.autoplay.stopOnLastSlide ? l() : (e = i.slideTo(0, i.params.speed, !0, !0),
o("autoplay")) : (e = i.slideNext(i.params.speed, !0, !0),
o("autoplay")),
(i.params.cssMode && i.autoplay.running || !1 === e) && s()
}
), r)
}
function a() {
return void 0 === t && (!i.autoplay.running && (i.autoplay.running = !0,
o("autoplayStart"),
s(),
!0))
}
function l() {
return !!i.autoplay.running && (void 0 !== t && (t && (clearTimeout(t),
t = void 0),
i.autoplay.running = !1,
o("autoplayStop"),
!0))
}
function c(e) {
i.autoplay.running && (i.autoplay.paused || (t && clearTimeout(t),
i.autoplay.paused = !0,
0 !== e && i.params.autoplay.waitForTransition ? ["transitionend", "webkitTransitionEnd"].forEach((e=>{
i.$wrapperEl[0].addEventListener(e, h)
}
)) : (i.autoplay.paused = !1,
s())))
}
function u() {
const e = Au();
"hidden" === e.visibilityState && i.autoplay.running && c(),
"visible" === e.visibilityState && i.autoplay.paused && (s(),
i.autoplay.paused = !1)
}
function h(e) {
i && !i.destroyed && i.$wrapperEl && e.target === i.$wrapperEl[0] && (["transitionend", "webkitTransitionEnd"].forEach((e=>{
i.$wrapperEl[0].removeEventListener(e, h)
}
)),
i.autoplay.paused = !1,
i.autoplay.running ? s() : l())
}
function d() {
i.params.autoplay.disableOnInteraction ? l() : (o("autoplayPause"),
c()),
["transitionend", "webkitTransitionEnd"].forEach((e=>{
i.$wrapperEl[0].removeEventListener(e, h)
}
))
}
function p() {
i.params.autoplay.disableOnInteraction || (i.autoplay.paused = !1,
o("autoplayResume"),
s())
}
i.autoplay = {
running: !1,
paused: !1
},
r({
autoplay: {
enabled: !1,
delay: 3e3,
waitForTransition: !0,
disableOnInteraction: !0,
stopOnLastSlide: !1,
reverseDirection: !1,
pauseOnMouseEnter: !1
}
}),
n("init", (()=>{
if (i.params.autoplay.enabled) {
a();
Au().addEventListener("visibilitychange", u),
i.params.autoplay.pauseOnMouseEnter && (i.$el.on("mouseenter", d),
i.$el.on("mouseleave", p))
}
}
)),
n("beforeTransitionStart", ((e,t,r)=>{
i.autoplay.running && (r || !i.params.autoplay.disableOnInteraction ? i.autoplay.pause(t) : l())
}
)),
n("sliderFirstMove", (()=>{
i.autoplay.running && (i.params.autoplay.disableOnInteraction ? l() : c())
}
)),
n("touchEnd", (()=>{
i.params.cssMode && i.autoplay.paused && !i.params.autoplay.disableOnInteraction && s()
}
)),
n("destroy", (()=>{
i.$el.off("mouseenter", d),
i.$el.off("mouseleave", p),
i.autoplay.running && l();
Au().removeEventListener("visibilitychange", u)
}
)),
Object.assign(i.autoplay, {
pause: c,
run: s,
start: a,
stop: l
})
}
function Ih(e, t) {
return e.transformEl ? t.find(e.transformEl).css({
"backface-visibility": "hidden",
"-webkit-backface-visibility": "hidden"
}) : t
}
function zh(e) {
let {swiper: t, extendParams: i, on: r} = e;
i({
fadeEffect: {
crossFade: !1,
transformEl: null
}
});
!function(e) {
const {effect: t, swiper: i, on: r, setTranslate: n, setTransition: o, overwriteParams: s, perspective: a, recreateShadows: l, getEffectParams: c} = e;
let u;
r("beforeInit", (()=>{
if (i.params.effect !== t)
return;
i.classNames.push(`${i.params.containerModifierClass}${t}`),
a && a() && i.classNames.push(`${i.params.containerModifierClass}3d`);
const e = s ? s() : {};
Object.assign(i.params, e),
Object.assign(i.originalParams, e)
}
)),
r("setTranslate", (()=>{
i.params.effect === t && n()
}
)),
r("setTransition", ((e,r)=>{
i.params.effect === t && o(r)
}
)),
r("transitionEnd", (()=>{
if (i.params.effect === t && l) {
if (!c || !c().slideShadows)
return;
i.slides.each((e=>{
i.$(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").remove()
}
)),
l()
}
}
)),
r("virtualUpdate", (()=>{
i.params.effect === t && (i.slides.length || (u = !0),
requestAnimationFrame((()=>{
u && i.slides && i.slides.length && (n(),
u = !1)
}
)))
}
))
}({
effect: "fade",
swiper: t,
on: r,
setTranslate: ()=>{
const {slides: e} = t
, i = t.params.fadeEffect;
for (let r = 0; r < e.length; r += 1) {
const e = t.slides.eq(r);
let n = -e[0].swiperSlideOffset;
t.params.virtualTranslate || (n -= t.translate);
let o = 0;
t.isHorizontal() || (o = n,
n = 0);
const s = t.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(e[0].progress), 0) : 1 + Math.min(Math.max(e[0].progress, -1), 0);
Ih(i, e).css({
opacity: s
}).transform(`translate3d(${n}px, ${o}px, 0px)`)
}
}
,
setTransition: e=>{
const {transformEl: i} = t.params.fadeEffect;
(i ? t.slides.find(i) : t.slides).transition(e),
function(e) {
let {swiper: t, duration: i, transformEl: r, allSlides: n} = e;
const {slides: o, activeIndex: s, $wrapperEl: a} = t;
if (t.params.virtualTranslate && 0 !== i) {
let e, i = !1;
e = n ? r ? o.find(r) : o : r ? o.eq(s).find(r) : o.eq(s),
e.transitionEnd((()=>{
if (i)
return;
if (!t || t.destroyed)
return;
i = !0,
t.animating = !1;
const e = ["webkitTransitionEnd", "transitionend"];
for (let t = 0; t < e.length; t += 1)
a.trigger(e[t])
}
))
}
}({
swiper: t,
duration: e,
transformEl: i,
allSlides: !0
})
}
,
overwriteParams: ()=>({
slidesPerView: 1,
slidesPerGroup: 1,
watchSlidesProgress: !0,
spaceBetween: 0,
virtualTranslate: !t.params.cssMode
})
})
}
var kh = i(158)
, Ph = i.n(kh);
Ai.plugin(zi),
Ma.utils.toArray(".gs-fade-in").forEach((function(e, t) {
var i, r, n, o = null !== (i = e.dataset.gsapY) && void 0 !== i ? i : 0, s = null !== (r = e.dataset.gsapDelay) && void 0 !== r ? r : 0, a = null !== (n = e.dataset.gsapDuration) && void 0 !== n ? n : 1.5;
Ma.from(e, {
scrollTrigger: e,
autoAlpha: 0,
y: o,
duration: a,
delay: s
})
}
)),
Ma.utils.toArray(".gs-class").forEach((function(e, t) {
var i = e.dataset.gsapClass;
mu.create({
trigger: e,
toggleClass: {
targets: e,
className: i
}
})
}
)),
Ma.utils.toArray(".gs-line").forEach((function(e, t) {
Ma.from(e, {
scrollTrigger: {
trigger: e.closest(".gs-trigger")
},
scaleX: 0,
duration: 1.5
})
}
)),
Ma.utils.toArray(".gs-tagline").forEach((function(e, t) {
Ma.from(e, {
scrollTrigger: {
trigger: e.closest(".gs-trigger"),
start: "top center",
end: "bottom bottom",
scrub: 2
},
y: 400
})
}
)),
Ma.utils.toArray(".gs-plant").forEach((function(e, t) {
Ma.from(e, {
scrollTrigger: {
start: "top center",
end: "bottom bottom",
scrub: 2
},
y: 400
})
}
)),
Ai.data("swiper", (function() {
return {
init: function() {
var e, t = this.$el.querySelector("[data-swiper-navigation-prev]"), i = this.$el.querySelector("[data-swiper-navigation-next]"), r = this.$el.querySelector("[data-swiper-pagination]"), n = null !== (e = this.$el.getAttribute("data-swiper-auto-height")) && void 0 !== e && e;
new Th(this.$el.querySelector(".swiper"),{
modules: [Sh, Mh, zh, Ah],
effect: "fade",
autoHeight: !1,
breakpoints: {
767: {
autoHeight: n
}
},
autoplay: {
delay: 5e3
},
fadeEffect: {
crossFade: !0
},
pagination: {
el: r,
clickable: !0,
bulletClass: "inline-block w-4 h-4 mx-4 border-none bg-white rounded-none transition-colors duration-300 hover:bg-blue-light hover:cursor-pointer",
bulletActiveClass: "bg-blue-light"
},
navigation: {
prevEl: t,
nextEl: i,
disabledClass: "opacity-50"
}
})
}
}
}
)),
Ai.data("mapbox", (function() {
return {
container: "mapBox",
token: "pk.eyJ1Ijoicm9iZG92ZSIsImEiOiJjbDllZHlwbHIyYTh6M29sbTRvMnd4MjFvIn0.CMzFJZafoFN9GwvWNpYl0A",
lat: "",
lng: "",
zoom: 15,
marker: null,
init: function() {
this.lat = this.$el.getAttribute("data-lat"),
this.lng = this.$el.getAttribute("data-lng"),
Ph().accessToken = this.token;
var e = new (Ph().Map)({
container: this.container,
style: "mapbox://styles/mapbox/dark-v10",
center: [this.lng, this.lat],
zoom: this.zoom
});
this.marker = new (Ph().Marker)({
draggable: !1,
element: document.getElementById("markerImg"),
anchor: "center"
}).setLngLat([this.lng, this.lat]).addTo(e)
}
}
}
)),
window.Alpine = Ai,
window.Cookies = Li,
Ai.data("body", (function() {
return {
contactOpen: !1,
menuOpen: !1,
pageLeave: !1,
pageTop: !0,
lastPos: window.scrollY + 0,
headerVisible: !0,
init: function() {
document.querySelectorAll('[href="#next"]').forEach((function(e) {
e.addEventListener("click", (function(t) {
t.preventDefault(),
e.closest("section").nextElementSibling.scrollIntoView()
}
), !1)
}
))
},
scroll: function() {
this.headerVisible = window.scrollY < 1 || this.lastPos > window.scrollY,
this.lastPos = window.scrollY,
this.pageTop = !(window.scrollY > 100)
}
}
}
)),
Ai.start();
document.body.addEventListener("focus", (function(e) {
var t = e.target.nodeName.toLowerCase();
"input" != t && "textarea" != t || document.querySelector(".grecaptcha-badge").classList.add("isVisible")
}
), !0)
}
,
158: function(e, t, i) {
var r = i(155);
e.exports = function() {
"use strict";
var e, t, i;
function n(r, n) {
if (e)
if (t) {
var o = "self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; (" + e + ")(sharedChunk); (" + t + ")(sharedChunk); self.onerror = null;"
, s = {};
e(s),
i = n(s),
"undefined" != typeof window && window && window.URL && window.URL.createObjectURL && (i.workerUrl = window.URL.createObjectURL(new Blob([o],{
type: "text/javascript"
})))
} else
t = n;
else
e = n
}
return n(["exports"], (function(e) {
var t = "undefined" != typeof self ? self : {}
, i = n;
function n(e, t, i, r) {
this.cx = 3 * e,
this.bx = 3 * (i - e) - this.cx,
this.ax = 1 - this.cx - this.bx,
this.cy = 3 * t,
this.by = 3 * (r - t) - this.cy,
this.ay = 1 - this.cy - this.by,
this.p1x = e,
this.p1y = r,
this.p2x = i,
this.p2y = r
}
n.prototype.sampleCurveX = function(e) {
return ((this.ax * e + this.bx) * e + this.cx) * e
}
,
n.prototype.sampleCurveY = function(e) {
return ((this.ay * e + this.by) * e + this.cy) * e
}
,
n.prototype.sampleCurveDerivativeX = function(e) {
return (3 * this.ax * e + 2 * this.bx) * e + this.cx
}
,
n.prototype.solveCurveX = function(e, t) {
var i, r, n, o, s;
for (void 0 === t && (t = 1e-6),
n = e,
s = 0; s < 8; s++) {
if (o = this.sampleCurveX(n) - e,
Math.abs(o) < t)
return n;
var a = this.sampleCurveDerivativeX(n);
if (Math.abs(a) < 1e-6)
break;
n -= o / a
}
if ((n = e) < (i = 0))
return i;
if (n > (r = 1))
return r;
for (; i < r; ) {
if (o = this.sampleCurveX(n),
Math.abs(o - e) < t)
return n;
e > o ? i = n : r = n,
n = .5 * (r - i) + i
}
return n
}
,
n.prototype.solve = function(e, t) {
return this.sampleCurveY(this.solveCurveX(e, t))
}
;
var o = s;
function s(e, t) {
this.x = e,
this.y = t
}
s.prototype = {
clone: function() {
return new s(this.x,this.y)
},
add: function(e) {
return this.clone()._add(e)
},
sub: function(e) {
return this.clone()._sub(e)
},
multByPoint: function(e) {
return this.clone()._multByPoint(e)
},
divByPoint: function(e) {
return this.clone()._divByPoint(e)
},
mult: function(e) {
return this.clone()._mult(e)
},
div: function(e) {
return this.clone()._div(e)
},
rotate: function(e) {
return this.clone()._rotate(e)
},
rotateAround: function(e, t) {
return this.clone()._rotateAround(e, t)
},
matMult: function(e) {
return this.clone()._matMult(e)
},
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(e) {
return this.x === e.x && this.y === e.y
},
dist: function(e) {
return Math.sqrt(this.distSqr(e))
},
distSqr: function(e) {
var t = e.x - this.x
, i = e.y - this.y;
return t * t + i * i
},
angle: function() {
return Math.atan2(this.y, this.x)
},
angleTo: function(e) {
return Math.atan2(this.y - e.y, this.x - e.x)
},
angleWith: function(e) {
return this.angleWithSep(e.x, e.y)
},
angleWithSep: function(e, t) {
return Math.atan2(this.x * t - this.y * e, this.x * e + this.y * t)
},
_matMult: function(e) {
var t = e[2] * this.x + e[3] * this.y;
return this.x = e[0] * this.x + e[1] * this.y,
this.y = t,
this
},
_add: function(e) {
return this.x += e.x,
this.y += e.y,
this
},
_sub: function(e) {
return this.x -= e.x,
this.y -= e.y,
this
},
_mult: function(e) {
return this.x *= e,
this.y *= e,
this
},
_div: function(e) {
return this.x /= e,
this.y /= e,
this
},
_multByPoint: function(e) {
return this.x *= e.x,
this.y *= e.y,
this
},
_divByPoint: function(e) {
return this.x /= e.x,
this.y /= e.y,
this
},
_unit: function() {
return this._div(this.mag()),
this
},
_perp: function() {
var e = this.y;
return this.y = this.x,
this.x = -e,
this
},
_rotate: function(e) {
var t = Math.cos(e)
, i = Math.sin(e)
, r = i * this.x + t * this.y;
return this.x = t * this.x - i * this.y,
this.y = r,
this
},
_rotateAround: function(e, t) {
var i = Math.cos(e)
, r = Math.sin(e)
, n = t.y + r * (this.x - t.x) + i * (this.y - t.y);
return this.x = t.x + i * (this.x - t.x) - r * (this.y - t.y),
this.y = n,
this
},
_round: function() {
return this.x = Math.round(this.x),
this.y = Math.round(this.y),
this
}
},
s.convert = function(e) {
return e instanceof s ? e : Array.isArray(e) ? new s(e[0],e[1]) : e
}
;
const a = Math.PI / 180
, l = 180 / Math.PI;
function c(e) {
return e * a
}
function u(e) {
return e * l
}
const h = [[0, 0], [1, 0], [1, 1], [0, 1]];
function d(e) {
if (e <= 0)
return 0;
if (e >= 1)
return 1;
const t = e * e
, i = t * e;
return 4 * (e < .5 ? i : 3 * (e - t) + i - .75)
}
function p(e, t, r, n) {
const o = new i(e,t,r,n);
return function(e) {
return o.solve(e)
}
}
const f = p(.25, .1, .25, 1);
function m(e, t, i) {
return Math.min(i, Math.max(t, e))
}
function _(e, t, i) {
return (i = m((i - e) / (t - e), 0, 1)) * i * (3 - 2 * i)
}
function g(e, t, i) {
const r = i - t
, n = ((e - t) % r + r) % r + t;
return n === t ? i : n
}
function y(e, t, i) {
if (!e.length)
return i(null, []);
let r = e.length;
const n = new Array(e.length);
let o = null;
e.forEach(((e,s)=>{
t(e, ((e,t)=>{
e && (o = e),
n[s] = t,
0 == --r && i(o, n)
}
))
}
))
}
function x(e) {
const t = [];
for (const i in e)
t.push(e[i]);
return t
}
function v(e, ...t) {
for (const i of t)
for (const t in i)
e[t] = i[t];
return e
}
let b = 1;
function w() {
return b++
}
function T() {
return function e(t) {
return t ? (t ^ Math.random() * (16 >> t / 4)).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, e)
}()
}
function E(e) {
return e <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log(e) / Math.LN2))
}
function S(e) {
return !!e && /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)
}
function C(e, t) {
e.forEach((e=>{
t[e] && (t[e] = t[e].bind(t))
}
))
}
function M(e, t) {
return -1 !== e.indexOf(t, e.length - t.length)
}
function A(e, t, i) {
const r = {};
for (const n in e)
r[n] = t.call(i || this, e[n], n, e);
return r
}
function I(e, t, i) {
const r = {};
for (const n in e)
t.call(i || this, e[n], n, e) && (r[n] = e[n]);
return r
}
function z(e) {
return Array.isArray(e) ? e.map(z) : "object" == typeof e && e ? A(e, z) : e
}
const k = {};
function P(e) {
k[e] || ("undefined" != typeof console && console.warn(e),
k[e] = !0)
}
function D(e, t, i) {
return (i.y - e.y) * (t.x - e.x) > (t.y - e.y) * (i.x - e.x)
}
function L(e) {
let t = 0;
for (let i, r, n = 0, o = e.length, s = o - 1; n < o; s = n++)
i = e[n],
r = e[s],
t += (r.x - i.x) * (i.y + r.y);
return t
}
function B() {
return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope
}
function O(e) {
const t = {};
if (e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, ((e,i,r,n)=>{
const o = r || n;
return t[i] = !o || o.toLowerCase(),
""
}
)),
t["max-age"]) {
const e = parseInt(t["max-age"], 10);
isNaN(e) ? delete t["max-age"] : t["max-age"] = e
}
return t
}
let R = null;
function F(e) {
if (null == R) {
const t = e.navigator ? e.navigator.userAgent : null;
R = !!e.safari || !(!t || !(/\b(iPad|iPhone|iPod)\b/.test(t) || t.match("Safari") && !t.match("Chrome")))
}
return R
}
function U(e) {
try {
const i = t[e];
return i.setItem("_mapbox_test_", 1),
i.removeItem("_mapbox_test_"),
!0
} catch (e) {
return !1
}
}
function V(e, t) {
return [e[4 * t], e[4 * t + 1], e[4 * t + 2], e[4 * t + 3]]
}
const j = t.performance;
function N(e) {
const t = e ? e.url.toString() : void 0;
return j.getEntriesByName(t)
}
var G = "2.10.0";
let $, q, Z, W;
const X = {
now: ()=>void 0 !== Z ? Z : t.performance.now(),
setNow(e) {
Z = e
},
restoreNow() {
Z = void 0
},
frame(e) {
const i = t.requestAnimationFrame(e);
return {
cancel: ()=>t.cancelAnimationFrame(i)
}
},
getImageData(e, i=0) {
const {width: r, height: n} = e;
W || (W = t.document.createElement("canvas"));
const o = W.getContext("2d");
if (!o)
throw new Error("failed to create canvas 2d context");
return (r > W.width || n > W.height) && (W.width = r,
W.height = n),
o.clearRect(-i, -i, r + 2 * i, n + 2 * i),
o.drawImage(e, 0, 0, r, n),
o.getImageData(-i, -i, r + 2 * i, n + 2 * i)
},
resolveURL: e=>($ || ($ = t.document.createElement("a")),
$.href = e,
$.href),
get devicePixelRatio() {
return t.devicePixelRatio
},
get prefersReducedMotion() {
return !!t.matchMedia && (null == q && (q = t.matchMedia("(prefers-reduced-motion: reduce)")),
q.matches)
}
};
let H;
const Y = {
API_URL: "https://api.mapbox.com",
get API_URL_REGEX() {
if (null == H) {
const e = /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;
try {
H = null != r.env.API_URL_REGEX ? new RegExp(r.env.API_URL_REGEX) : e
} catch (t) {
H = e
}
}
return H
},
get EVENTS_URL() {
return this.API_URL ? 0 === this.API_URL.indexOf("https://api.mapbox.cn") ? "https://events.mapbox.cn/events/v2" : 0 === this.API_URL.indexOf("https://api.mapbox.com") ? "https://events.mapbox.com/events/v2" : null : null
},
SESSION_PATH: "/map-sessions/v1",
FEEDBACK_URL: "https://apps.mapbox.com/feedback",
TILE_URL_VERSION: "v4",
RASTER_URL_PREFIX: "raster/v1",
REQUIRE_ACCESS_TOKEN: !0,
ACCESS_TOKEN: null,
MAX_PARALLEL_IMAGE_REQUESTS: 16
}
, K = {
supported: !1,
testSupport: function(e) {
!ee && Q && (te ? ie(e) : J = e)
}
};
let J, Q, ee = !1, te = !1;
function ie(e) {
const t = e.createTexture();
e.bindTexture(e.TEXTURE_2D, t);
try {
if (e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, e.RGBA, e.UNSIGNED_BYTE, Q),
e.isContextLost())
return;
K.supported = !0
} catch (e) {}
e.deleteTexture(t),
ee = !0
}
t.document && (Q = t.document.createElement("img"),
Q.onload = function() {
J && ie(J),
J = null,
te = !0
}
,
Q.onerror = function() {
ee = !0,
J = null
}
,
Q.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");
const re = "01"
, ne = "NO_ACCESS_TOKEN";
function oe(e) {
return 0 === e.indexOf("mapbox:")
}
function se(e) {
return Y.API_URL_REGEX.test(e)
}
const ae = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;
function le(e) {
const t = e.match(ae);
if (!t)
throw new Error("Unable to parse URL object");
return {
protocol: t[1],
authority: t[2],
path: t[3] || "/",
params: t[4] ? t[4].split("&") : []
}
}
function ce(e) {
const t = e.params.length ? `?${e.params.join("&")}` : "";
return `${e.protocol}://${e.authority}${e.path}${t}`
}
function ue(e) {
if (!e)
return null;
const i = e.split(".");
if (!i || 3 !== i.length)
return null;
try {
return JSON.parse(decodeURIComponent(t.atob(i[1]).split("").map((e=>"%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2))).join("")))
} catch (e) {
return null
}
}
class he {
constructor(e) {
this.type = e,
this.anonId = null,
this.eventData = {},
this.queue = [],
this.pendingRequest = null
}
getStorageKey(e) {
const i = ue(Y.ACCESS_TOKEN);
let r = "";
return r = i && i.u ? t.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g, ((e,t)=>String.fromCharCode(Number("0x" + t))))) : Y.ACCESS_TOKEN || "",
e ? `mapbox.eventData.${e}:${r}` : `mapbox.eventData:${r}`
}
fetchEventData() {
const e = U("localStorage")
, i = this.getStorageKey()
, r = this.getStorageKey("uuid");
if (e)
try {
const e = t.localStorage.getItem(i);
e && (this.eventData = JSON.parse(e));
const n = t.localStorage.getItem(r);
n && (this.anonId = n)
} catch (e) {
P("Unable to read from LocalStorage")
}
}
saveEventData() {
const e = U("localStorage")
, i = this.getStorageKey()
, r = this.getStorageKey("uuid");
if (e)
try {
t.localStorage.setItem(r, this.anonId),
Object.keys(this.eventData).length >= 1 && t.localStorage.setItem(i, JSON.stringify(this.eventData))
} catch (e) {
P("Unable to write to LocalStorage")
}
}
processRequests(e) {}
postEvent(e, t, i, r) {
if (!Y.EVENTS_URL)
return;
const n = le(Y.EVENTS_URL);
n.params.push(`access_token=${r || Y.ACCESS_TOKEN || ""}`);
const o = {
event: this.type,
created: new Date(e).toISOString(),
sdkIdentifier: "mapbox-gl-js",
sdkVersion: G,
skuId: re,
userId: this.anonId
}
, s = t ? v(o, t) : o
, a = {
url: ce(n),
headers: {
"Content-Type": "text/plain"
},
body: JSON.stringify([s])
};
this.pendingRequest = Le(a, (e=>{
this.pendingRequest = null,
i(e),
this.saveEventData(),
this.processRequests(r)
}
))
}
queueRequest(e, t) {
this.queue.push(e),
this.processRequests(t)
}
}
const de = new class extends he {
constructor(e) {
super("appUserTurnstile"),
this._customAccessToken = e
}
postTurnstileEvent(e, t) {
Y.EVENTS_URL && Y.ACCESS_TOKEN && Array.isArray(e) && e.some((e=>oe(e) || se(e))) && this.queueRequest(Date.now(), t)
}
processRequests(e) {
if (this.pendingRequest || 0 === this.queue.length)
return;
this.anonId && this.eventData.lastSuccess && this.eventData.tokenU || this.fetchEventData();
const t = ue(Y.ACCESS_TOKEN)
, i = t ? t.u : Y.ACCESS_TOKEN;
let r = i !== this.eventData.tokenU;
S(this.anonId) || (this.anonId = T(),
r = !0);
const n = this.queue.shift();
if (this.eventData.lastSuccess) {
const e = new Date(this.eventData.lastSuccess)
, t = new Date(n)
, i = (n - this.eventData.lastSuccess) / 864e5;
r = r || i >= 1 || i < -1 || e.getDate() !== t.getDate()
} else
r = !0;
r ? this.postEvent(n, {
"enabled.telemetry": !1
}, (e=>{
e || (this.eventData.lastSuccess = n,
this.eventData.tokenU = i)
}
), e) : this.processRequests()
}
}
, pe = de.postTurnstileEvent.bind(de)
, fe = new class extends he {
constructor() {
super("map.load"),
this.success = {},
this.skuToken = ""
}
postMapLoadEvent(e, t, i, r) {
this.skuToken = t,
this.errorCb = r,
Y.EVENTS_URL && (i || Y.ACCESS_TOKEN ? this.queueRequest({
id: e,
timestamp: Date.now()
}, i) : this.errorCb(new Error(ne)))
}
processRequests(e) {
if (this.pendingRequest || 0 === this.queue.length)
return;
const {id: t, timestamp: i} = this.queue.shift();
t && this.success[t] || (this.anonId || this.fetchEventData(),
S(this.anonId) || (this.anonId = T()),
this.postEvent(i, {
skuToken: this.skuToken
}, (e=>{
e ? this.errorCb(e) : t && (this.success[t] = !0)
}
), e))
}
}
, me = fe.postMapLoadEvent.bind(fe)
, _e = new class extends he {
constructor() {
super("map.auth"),
this.success = {},
this.skuToken = ""
}
getSession(e, t, i, r) {
if (!Y.API_URL || !Y.SESSION_PATH)
return;
const n = le(Y.API_URL + Y.SESSION_PATH);
n.params.push(`sku=${t || ""}`),
n.params.push(`access_token=${r || Y.ACCESS_TOKEN || ""}`);
const o = {
url: ce(n),
headers: {
"Content-Type": "text/plain"
}
};
this.pendingRequest = Be(o, (e=>{
this.pendingRequest = null,
i(e),
this.saveEventData(),
this.processRequests(r)
}
))
}
getSessionAPI(e, t, i, r) {
this.skuToken = t,
this.errorCb = r,
Y.SESSION_PATH && Y.API_URL && (i || Y.ACCESS_TOKEN ? this.queueRequest({
id: e,
timestamp: Date.now()
}, i) : this.errorCb(new Error(ne)))
}
processRequests(e) {
if (this.pendingRequest || 0 === this.queue.length)
return;
const {id: t, timestamp: i} = this.queue.shift();
t && this.success[t] || this.getSession(i, this.skuToken, (e=>{
e ? this.errorCb(e) : t && (this.success[t] = !0)
}
), e)
}
}
, ge = _e.getSessionAPI.bind(_e)
, ye = new Set;
let xe, ve = 500, be = 50, we = {};
function Te(e) {
const t = Ce(e);
let i, r;
t && t.forEach((e=>{
const t = e.split("=");
"language" === t[0] ? i = t[1] : "worldview" === t[0] && (r = t[1])
}
));
let n = "mapbox-tiles";
return i && (n += `-${i}`),
r && (n += `-${r}`),
n
}
function Ee() {
try {
return t.caches
} catch (e) {}
}
function Se(e) {
const t = Ee();
t && !we[e] && (we[e] = t.open(e))
}
function Ce(e) {
const t = e.indexOf("?");
return t > 0 ? e.slice(t + 1).split("&") : []
}
function Me(e) {
const t = e.indexOf("?");
if (t < 0)
return e;
const i = Ce(e).filter((e=>{
const t = e.split("=");
return "language" === t[0] || "worldview" === t[0]
}
));
return i.length ? `${e.slice(0, t)}?${i.join("&")}` : e.slice(0, t)
}
let Ae = 1 / 0;
const Ie = {
Unknown: "Unknown",
Style: "Style",
Source: "Source",
Tile: "Tile",
Glyphs: "Glyphs",
SpriteImage: "SpriteImage",
SpriteJSON: "SpriteJSON",
Image: "Image"
};
"function" == typeof Object.freeze && Object.freeze(Ie);
class ze extends Error {
constructor(e, t, i) {
401 === t && se(i) && (e += ": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),
super(e),
this.status = t,
this.url = i
}
toString() {
return `${this.name}: ${this.message} (${this.status}): ${this.url}`
}
}
const ke = B() ? ()=>self.worker && self.worker.referrer : ()=>("blob:" === t.location.protocol ? t.parent : t).location.href
, Pe = function(e, i) {
if (!(/^file:/.test(r = e.url) || /^file:/.test(ke()) && !/^\w+:/.test(r))) {
if (t.fetch && t.Request && t.AbortController && t.Request.prototype.hasOwnProperty("signal"))
return function(e, i) {
const r = new t.AbortController
, n = new t.Request(e.url,{
method: e.method || "GET",
body: e.body,
credentials: e.credentials,
headers: e.headers,
referrer: ke(),
signal: r.signal
});
let o = !1
, s = !1;
const a = (l = n.url).indexOf("sku=") > 0 && se(l);
var l;
"json" === e.type && n.headers.set("Accept", "application/json");
const c = (r,o,l)=>{
if (s)
return;
if (r && "SecurityError" !== r.message && P(r),
o && l)
return u(o);
const c = Date.now();
t.fetch(n).then((t=>{
if (t.ok) {
const e = a ? t.clone() : null;
return u(t, e, c)
}
return i(new ze(t.statusText,t.status,e.url))
}
)).catch((e=>{
20 !== e.code && i(new Error(e.message))
}
))
}
, u = (r,a,l)=>{
("arrayBuffer" === e.type ? r.arrayBuffer() : "json" === e.type ? r.json() : r.text()).then((e=>{
s || (a && l && function(e, i, r) {
const n = Te(e.url);
if (Se(n),
!we[n])
return;
const o = {
status: i.status,
statusText: i.statusText,
headers: new t.Headers
};
i.headers.forEach(((e,t)=>o.headers.set(t, e)));
const s = O(i.headers.get("Cache-Control") || "");
if (s["no-store"])
return;
s["max-age"] && o.headers.set("Expires", new Date(r + 1e3 * s["max-age"]).toUTCString());
const a = o.headers.get("Expires");
a && (new Date(a).getTime() - r < 42e4 || function(e, t) {
if (void 0 === xe)
try {
new Response(new ReadableStream),
xe = !0
} catch (e) {
xe = !1
}
xe ? t(e.body) : e.blob().then(t)
}(i, (i=>{
const r = new t.Response(i,o);
Se(n),
we[n] && we[n].then((t=>t.put(Me(e.url), r))).catch((e=>P(e.message)))
}
)))
}(n, a, l),
o = !0,
i(null, e, r.headers.get("Cache-Control"), r.headers.get("Expires")))
}
)).catch((e=>{
s || i(new Error(e.message))
}
))
}
;
return a ? function(e, t) {
const i = Te(e.url);
if (Se(i),
!we[i])
return t(null);
const r = Me(e.url);
we[i].then((e=>{
e.match(r).then((i=>{
const n = function(e) {
if (!e)
return !1;
const t = new Date(e.headers.get("Expires") || 0)
, i = O(e.headers.get("Cache-Control") || "");
return t > Date.now() && !i["no-cache"]
}(i);
e.delete(r),
n && e.put(r, i.clone()),
t(null, i, n)
}
)).catch(t)
}
)).catch(t)
}(n, c) : c(null, null),
{
cancel: ()=>{
s = !0,
o || r.abort()
}
}
}(e, i);
if (B() && self.worker && self.worker.actor)
return self.worker.actor.send("getResource", e, i, void 0, !0)
}
var r;
return function(e, i) {
const r = new t.XMLHttpRequest;
r.open(e.method || "GET", e.url, !0),
"arrayBuffer" === e.type && (r.responseType = "arraybuffer");
for (const t in e.headers)
r.setRequestHeader(t, e.headers[t]);
return "json" === e.type && (r.responseType = "text",
r.setRequestHeader("Accept", "application/json")),
r.withCredentials = "include" === e.credentials,
r.onerror = ()=>{
i(new Error(r.statusText))
}
,
r.onload = ()=>{
if ((r.status >= 200 && r.status < 300 || 0 === r.status) && null !== r.response) {
let t = r.response;
if ("json" === e.type)
try {
t = JSON.parse(r.response)
} catch (e) {
return i(e)
}
i(null, t, r.getResponseHeader("Cache-Control"), r.getResponseHeader("Expires"))
} else
i(new ze(r.statusText,r.status,e.url))
}
,
r.send(e.body),
{
cancel: ()=>r.abort()
}
}(e, i)
}
, De = function(e, t) {
return Pe(v(e, {
type: "arrayBuffer"
}), t)
}
, Le = function(e, t) {
return Pe(v(e, {
method: "POST"
}), t)
}
, Be = function(e, t) {
return Pe(v(e, {
method: "GET"
}), t)
};
function Oe(e) {
const i = t.document.createElement("a");
return i.href = e,
i.protocol === t.document.location.protocol && i.host === t.document.location.host
}
const Re = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";
let Fe, Ue;
Fe = [],
Ue = 0;
const Ve = function(e, i) {
if (K.supported && (e.headers || (e.headers = {}),
e.headers.accept = "image/webp,*/*"),
Ue >= Y.MAX_PARALLEL_IMAGE_REQUESTS) {
const t = {
requestParameters: e,
callback: i,
cancelled: !1,
cancel() {
this.cancelled = !0
}
};
return Fe.push(t),
t
}
Ue++;
let r = !1;
const n = ()=>{
if (!r)
for (r = !0,
Ue--; Fe.length && Ue < Y.MAX_PARALLEL_IMAGE_REQUESTS; ) {
const e = Fe.shift()
, {requestParameters: t, callback: i, cancelled: r} = e;
r || (e.cancel = Ve(t, i).cancel)
}
}
, o = De(e, ((e,r,o,s)=>{
n(),
e ? i(e) : r && (t.createImageBitmap ? function(e, i) {
const r = new t.Blob([new Uint8Array(e)],{
type: "image/png"
});
t.createImageBitmap(r).then((e=>{
i(null, e)
}
)).catch((e=>{
i(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))
}
))
}(r, ((e,t)=>i(e, t, o, s))) : function(e, i) {
const r = new t.Image
, n = t.URL;
r.onload = ()=>{
i(null, r),
n.revokeObjectURL(r.src),
r.onload = null,
t.requestAnimationFrame((()=>{
r.src = Re
}
))
}
,
r.onerror = ()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));
const o = new t.Blob([new Uint8Array(e)],{
type: "image/png"
});
r.src = e.byteLength ? n.createObjectURL(o) : Re
}(r, ((e,t)=>i(e, t, o, s))))
}
));
return {
cancel: ()=>{
o.cancel(),
n()
}
}
};
function je(e, t, i) {
i[e] && -1 !== i[e].indexOf(t) || (i[e] = i[e] || [],
i[e].push(t))
}
function Ne(e, t, i) {
if (i && i[e]) {
const r = i[e].indexOf(t);
-1 !== r && i[e].splice(r, 1)
}
}
class Ge {
constructor(e, t={}) {
v(this, t),
this.type = e
}
}
class $e extends Ge {
constructor(e, t={}) {
super("error", v({
error: e
}, t))
}
}
class qe {
on(e, t) {
return this._listeners = this._listeners || {},
je(e, t, this._listeners),
this
}
off(e, t) {
return Ne(e, t, this._listeners),
Ne(e, t, this._oneTimeListeners),
this
}
once(e, t) {
return t ? (this._oneTimeListeners = this._oneTimeListeners || {},
je(e, t, this._oneTimeListeners),
this) : new Promise((t=>this.once(e, t)))
}
fire(e, t) {
"string" == typeof e && (e = new Ge(e,t || {}));
const i = e.type;
if (this.listens(i)) {
e.target = this;
const t = this._listeners && this._listeners[i] ? this._listeners[i].slice() : [];
for (const i of t)
i.call(this, e);
const r = this._oneTimeListeners && this._oneTimeListeners[i] ? this._oneTimeListeners[i].slice() : [];
for (const t of r)
Ne(i, t, this._oneTimeListeners),
t.call(this, e);
const n = this._eventedParent;
n && (v(e, "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData),
n.fire(e))
} else
e instanceof $e && console.error(e.error);
return this
}
listens(e) {
return !!(this._listeners && this._listeners[e] && this._listeners[e].length > 0 || this._oneTimeListeners && this._oneTimeListeners[e] && this._oneTimeListeners[e].length > 0 || this._eventedParent && this._eventedParent.listens(e))
}
setEventedParent(e, t) {
return this._eventedParent = e,
this._eventedParentData = t,
this
}
}
var Ze = JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"cross-faded"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"cross-faded":{"type":"property-type"},"cross-faded-data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');
function We(e, ...t) {
for (const i of t)
for (const t in i)
e[t] = i[t];
return e
}
function Xe(e) {
return e instanceof Number || e instanceof String || e instanceof Boolean ? e.valueOf() : e
}
function He(e) {
if (Array.isArray(e))
return e.map(He);
if (e instanceof Object && !(e instanceof Number || e instanceof String || e instanceof Boolean)) {
const t = {};
for (const i in e)
t[i] = He(e[i]);
return t
}
return Xe(e)
}
class Ye extends Error {
constructor(e, t) {
super(t),
this.message = t,
this.key = e
}
}
var Ke = Ye;
class Je {
constructor(e, t=[]) {
this.parent = e,
this.bindings = {};
for (const [e,i] of t)
this.bindings[e] = i
}
concat(e) {
return new Je(this,e)
}
get(e) {
if (this.bindings[e])
return this.bindings[e];
if (this.parent)
return this.parent.get(e);
throw new Error(`${e} not found in scope.`)
}
has(e) {
return !!this.bindings[e] || !!this.parent && this.parent.has(e)
}
}
var Qe = Je;
const et = {
kind: "null"
}
, tt = {
kind: "number"
}
, it = {
kind: "string"
}
, rt = {
kind: "boolean"
}
, nt = {
kind: "color"
}
, ot = {
kind: "object"
}
, st = {
kind: "value"
}
, at = {
kind: "collator"
}
, lt = {
kind: "formatted"
}
, ct = {
kind: "resolvedImage"
};
function ut(e, t) {
return {
kind: "array",
itemType: e,
N: t
}
}
function ht(e) {
if ("array" === e.kind) {
const t = ht(e.itemType);
return "number" == typeof e.N ? `array<${t}, ${e.N}>` : "value" === e.itemType.kind ? "array" : `array<${t}>`
}
return e.kind
}
const dt = [et, tt, it, rt, nt, lt, ot, ut(st), ct];
function pt(e, t) {
if ("error" === t.kind)
return null;
if ("array" === e.kind) {
if ("array" === t.kind && (0 === t.N && "value" === t.itemType.kind || !pt(e.itemType, t.itemType)) && ("number" != typeof e.N || e.N === t.N))
return null
} else {
if (e.kind === t.kind)
return null;
if ("value" === e.kind)
for (const e of dt)
if (!pt(e, t))
return null
}
return `Expected ${ht(e)} but found ${ht(t)} instead.`
}
function ft(e, t) {
return t.some((t=>t.kind === e.kind))
}
function mt(e, t) {
return t.some((t=>"null" === t ? null === e : "array" === t ? Array.isArray(e) : "object" === t ? e && !Array.isArray(e) && "object" == typeof e : t === typeof e))
}
function _t(e) {
var t = {
exports: {}
};
return e(t, t.exports),
t.exports
}
var gt = _t((function(e, t) {
var i = {
transparent: [0, 0, 0, 0],
aliceblue: [240, 248, 255, 1],
antiquewhite: [250, 235, 215, 1],
aqua: [0, 255, 255, 1],
aquamarine: [127, 255, 212, 1],
azure: [240, 255, 255, 1],
beige: [245, 245, 220, 1],
bisque: [255, 228, 196, 1],
black: [0, 0, 0, 1],
blanchedalmond: [255, 235, 205, 1],
blue: [0, 0, 255, 1],
blueviolet: [138, 43, 226, 1],
brown: [165, 42, 42, 1],
burlywood: [222, 184, 135, 1],
cadetblue: [95, 158, 160, 1],
chartreuse: [127, 255, 0, 1],
chocolate: [210, 105, 30, 1],
coral: [255, 127, 80, 1],
cornflowerblue: [100, 149, 237, 1],
cornsilk: [255, 248, 220, 1],
crimson: [220, 20, 60, 1],
cyan: [0, 255, 255, 1],
darkblue: [0, 0, 139, 1],
darkcyan: [0, 139, 139, 1],
darkgoldenrod: [184, 134, 11, 1],
darkgray: [169, 169, 169, 1],
darkgreen: [0, 100, 0, 1],
darkgrey: [169, 169, 169, 1],
darkkhaki: [189, 183, 107, 1],
darkmagenta: [139, 0, 139, 1],
darkolivegreen: [85, 107, 47, 1],
darkorange: [255, 140, 0, 1],
darkorchid: [153, 50, 204, 1],
darkred: [139, 0, 0, 1],
darksalmon: [233, 150, 122, 1],
darkseagreen: [143, 188, 143, 1],
darkslateblue: [72, 61, 139, 1],
darkslategray: [47, 79, 79, 1],
darkslategrey: [47, 79, 79, 1],
darkturquoise: [0, 206, 209, 1],
darkviolet: [148, 0, 211, 1],
deeppink: [255, 20, 147, 1],
deepskyblue: [0, 191, 255, 1],
dimgray: [105, 105, 105, 1],
dimgrey: [105, 105, 105, 1],
dodgerblue: [30, 144, 255, 1],
firebrick: [178, 34, 34, 1],
floralwhite: [255, 250, 240, 1],
forestgreen: [34, 139, 34, 1],
fuchsia: [255, 0, 255, 1],
gainsboro: [220, 220, 220, 1],
ghostwhite: [248, 248, 255, 1],
gold: [255, 215, 0, 1],
goldenrod: [218, 165, 32, 1],
gray: [128, 128, 128, 1],
green: [0, 128, 0, 1],
greenyellow: [173, 255, 47, 1],
grey: [128, 128, 128, 1],
honeydew: [240, 255, 240, 1],
hotpink: [255, 105, 180, 1],
indianred: [205, 92, 92, 1],
indigo: [75, 0, 130, 1],
ivory: [255, 255, 240, 1],
khaki: [240, 230, 140, 1],
lavender: [230, 230, 250, 1],
lavenderblush: [255, 240, 245, 1],
lawngreen: [124, 252, 0, 1],
lemonchiffon: [255, 250, 205, 1],
lightblue: [173, 216, 230, 1],
lightcoral: [240, 128, 128, 1],
lightcyan: [224, 255, 255, 1],
lightgoldenrodyellow: [250, 250, 210, 1],
lightgray: [211, 211, 211, 1],
lightgreen: [144, 238, 144, 1],
lightgrey: [211, 211, 211, 1],
lightpink: [255, 182, 193, 1],
lightsalmon: [255, 160, 122, 1],
lightseagreen: [32, 178, 170, 1],
lightskyblue: [135, 206, 250, 1],
lightslategray: [119, 136, 153, 1],
lightslategrey: [119, 136, 153, 1],
lightsteelblue: [176, 196, 222, 1],
lightyellow: [255, 255, 224, 1],
lime: [0, 255, 0, 1],
limegreen: [50, 205, 50, 1],
linen: [250, 240, 230, 1],
magenta: [255, 0, 255, 1],
maroon: [128, 0, 0, 1],
mediumaquamarine: [102, 205, 170, 1],
mediumblue: [0, 0, 205, 1],
mediumorchid: [186, 85, 211, 1],
mediumpurple: [147, 112, 219, 1],
mediumseagreen: [60, 179, 113, 1],
mediumslateblue: [123, 104, 238, 1],
mediumspringgreen: [0, 250, 154, 1],
mediumturquoise: [72, 209, 204, 1],
mediumvioletred: [199, 21, 133, 1],
midnightblue: [25, 25, 112, 1],
mintcream: [245, 255, 250, 1],
mistyrose: [255, 228, 225, 1],
moccasin: [255, 228, 181, 1],
navajowhite: [255, 222, 173, 1],
navy: [0, 0, 128, 1],
oldlace: [253, 245, 230, 1],
olive: [128, 128, 0, 1],
olivedrab: [107, 142, 35, 1],
orange: [255, 165, 0, 1],
orangered: [255, 69, 0, 1],
orchid: [218, 112, 214, 1],
palegoldenrod: [238, 232, 170, 1],
palegreen: [152, 251, 152, 1],
paleturquoise: [175, 238, 238, 1],
palevioletred: [219, 112, 147, 1],
papayawhip: [255, 239, 213, 1],
peachpuff: [255, 218, 185, 1],
peru: [205, 133, 63, 1],
pink: [255, 192, 203, 1],
plum: [221, 160, 221, 1],
powderblue: [176, 224, 230, 1],
purple: [128, 0, 128, 1],
rebeccapurple: [102, 51, 153, 1],
red: [255, 0, 0, 1],
rosybrown: [188, 143, 143, 1],
royalblue: [65, 105, 225, 1],
saddlebrown: [139, 69, 19, 1],
salmon: [250, 128, 114, 1],
sandybrown: [244, 164, 96, 1],
seagreen: [46, 139, 87, 1],
seashell: [255, 245, 238, 1],
sienna: [160, 82, 45, 1],
silver: [192, 192, 192, 1],
skyblue: [135, 206, 235, 1],
slateblue: [106, 90, 205, 1],
slategray: [112, 128, 144, 1],
slategrey: [112, 128, 144, 1],
snow: [255, 250, 250, 1],
springgreen: [0, 255, 127, 1],
steelblue: [70, 130, 180, 1],
tan: [210, 180, 140, 1],
teal: [0, 128, 128, 1],
thistle: [216, 191, 216, 1],
tomato: [255, 99, 71, 1],
turquoise: [64, 224, 208, 1],
violet: [238, 130, 238, 1],
wheat: [245, 222, 179, 1],
white: [255, 255, 255, 1],
whitesmoke: [245, 245, 245, 1],
yellow: [255, 255, 0, 1],
yellowgreen: [154, 205, 50, 1]
};
function r(e) {
return (e = Math.round(e)) < 0 ? 0 : e > 255 ? 255 : e
}
function n(e) {
return r("%" === e[e.length - 1] ? parseFloat(e) / 100 * 255 : parseInt(e))
}
function o(e) {
return (t = "%" === e[e.length - 1] ? parseFloat(e) / 100 : parseFloat(e)) < 0 ? 0 : t > 1 ? 1 : t;
var t
}
function s(e, t, i) {
return i < 0 ? i += 1 : i > 1 && (i -= 1),
6 * i < 1 ? e + (t - e) * i * 6 : 2 * i < 1 ? t : 3 * i < 2 ? e + (t - e) * (2 / 3 - i) * 6 : e
}
try {
t.parseCSSColor = function(e) {
var t, a = e.replace(/ /g, "").toLowerCase();
if (a in i)
return i[a].slice();
if ("#" === a[0])
return 4 === a.length ? (t = parseInt(a.substr(1), 16)) >= 0 && t <= 4095 ? [(3840 & t) >> 4 | (3840 & t) >> 8, 240 & t | (240 & t) >> 4, 15 & t | (15 & t) << 4, 1] : null : 7 === a.length && (t = parseInt(a.substr(1), 16)) >= 0 && t <= 16777215 ? [(16711680 & t) >> 16, (65280 & t) >> 8, 255 & t, 1] : null;
var l = a.indexOf("(")
, c = a.indexOf(")");
if (-1 !== l && c + 1 === a.length) {
var u = a.substr(0, l)
, h = a.substr(l + 1, c - (l + 1)).split(",")
, d = 1;
switch (u) {
case "rgba":
if (4 !== h.length)
return null;
d = o(h.pop());
case "rgb":
return 3 !== h.length ? null : [n(h[0]), n(h[1]), n(h[2]), d];
case "hsla":
if (4 !== h.length)
return null;
d = o(h.pop());
case "hsl":
if (3 !== h.length)
return null;
var p = (parseFloat(h[0]) % 360 + 360) % 360 / 360
, f = o(h[1])
, m = o(h[2])
, _ = m <= .5 ? m * (f + 1) : m + f - m * f
, g = 2 * m - _;
return [r(255 * s(g, _, p + 1 / 3)), r(255 * s(g, _, p)), r(255 * s(g, _, p - 1 / 3)), d];
default:
return null
}
}
return null
}
} catch (e) {}
}
));
class yt {
constructor(e, t, i, r=1) {
this.r = e,
this.g = t,
this.b = i,
this.a = r
}
static parse(e) {
if (!e)
return;
if (e instanceof yt)
return e;
if ("string" != typeof e)
return;
const t = gt.parseCSSColor(e);
return t ? new yt(t[0] / 255 * t[3],t[1] / 255 * t[3],t[2] / 255 * t[3],t[3]) : void 0
}
toString() {
const [e,t,i,r] = this.toArray();
return `rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${r})`
}
toArray() {
const {r: e, g: t, b: i, a: r} = this;
return 0 === r ? [0, 0, 0, 0] : [255 * e / r, 255 * t / r, 255 * i / r, r]
}
toArray01() {
const {r: e, g: t, b: i, a: r} = this;
return 0 === r ? [0, 0, 0, 0] : [e / r, t / r, i / r, r]
}
toArray01PremultipliedAlpha() {
const {r: e, g: t, b: i, a: r} = this;
return [e, t, i, r]
}
}
yt.black = new yt(0,0,0,1),
yt.white = new yt(1,1,1,1),
yt.transparent = new yt(0,0,0,0),
yt.red = new yt(1,0,0,1),
yt.blue = new yt(0,0,1,1);
var xt = yt;
class vt {
constructor(e, t, i) {
this.sensitivity = e ? t ? "variant" : "case" : t ? "accent" : "base",
this.locale = i,
this.collator = new Intl.Collator(this.locale ? this.locale : [],{
sensitivity: this.sensitivity,
usage: "search"
})
}
compare(e, t) {
return this.collator.compare(e, t)
}
resolvedLocale() {
return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale
}
}
class bt {
constructor(e, t, i, r, n) {
this.text = e.normalize ? e.normalize() : e,
this.image = t,
this.scale = i,
this.fontStack = r,
this.textColor = n
}
}
class wt {
constructor(e) {
this.sections = e
}
static fromString(e) {
return new wt([new bt(e,null,null,null,null)])
}
isEmpty() {
return 0 === this.sections.length || !this.sections.some((e=>0 !== e.text.length || e.image && 0 !== e.image.name.length))
}
static factory(e) {
return e instanceof wt ? e : wt.fromString(e)
}
toString() {
return 0 === this.sections.length ? "" : this.sections.map((e=>e.text)).join("")
}
serialize() {
const e = ["format"];
for (const t of this.sections) {
if (t.image) {
e.push(["image", t.image.name]);
continue
}
e.push(t.text);
const i = {};
t.fontStack && (i["text-font"] = ["literal", t.fontStack.split(",")]),
t.scale && (i["font-scale"] = t.scale),
t.textColor && (i["text-color"] = ["rgba"].concat(t.textColor.toArray())),
e.push(i)
}
return e
}
}
class Tt {
constructor(e) {
this.name = e.name,
this.available = e.available
}
toString() {
return this.name
}
static fromString(e) {
return e ? new Tt({
name: e,
available: !1
}) : null
}
serialize() {
return ["image", this.name]
}
}
function Et(e, t, i, r) {
return "number" == typeof e && e >= 0 && e <= 255 && "number" == typeof t && t >= 0 && t <= 255 && "number" == typeof i && i >= 0 && i <= 255 ? void 0 === r || "number" == typeof r && r >= 0 && r <= 1 ? null : `Invalid rgba value [${[e, t, i, r].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${("number" == typeof r ? [e, t, i, r] : [e, t, i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`
}
function St(e) {
if (null === e)
return !0;
if ("string" == typeof e)
return !0;
if ("boolean" == typeof e)
return !0;
if ("number" == typeof e)
return !0;
if (e instanceof xt)
return !0;
if (e instanceof vt)
return !0;
if (e instanceof wt)
return !0;
if (e instanceof Tt)
return !0;
if (Array.isArray(e)) {
for (const t of e)
if (!St(t))
return !1;
return !0
}
if ("object" == typeof e) {
for (const t in e)
if (!St(e[t]))
return !1;
return !0
}
return !1
}
function Ct(e) {
if (null === e)
return et;
if ("string" == typeof e)
return it;
if ("boolean" == typeof e)
return rt;
if ("number" == typeof e)
return tt;
if (e instanceof xt)
return nt;
if (e instanceof vt)
return at;
if (e instanceof wt)
return lt;
if (e instanceof Tt)
return ct;
if (Array.isArray(e)) {
const t = e.length;
let i;
for (const t of e) {
const e = Ct(t);
if (i) {
if (i === e)
continue;
i = st;
break
}
i = e
}
return ut(i || st, t)
}
return ot
}
function Mt(e) {
const t = typeof e;
return null === e ? "" : "string" === t || "number" === t || "boolean" === t ? String(e) : e instanceof xt || e instanceof wt || e instanceof Tt ? e.toString() : JSON.stringify(e)
}
class At {
constructor(e, t) {
this.type = e,
this.value = t
}
static parse(e, t) {
if (2 !== e.length)
return t.error(`'literal' expression requires exactly one argument, but found ${e.length - 1} instead.`);
if (!St(e[1]))
return t.error("invalid value");
const i = e[1];
let r = Ct(i);
const n = t.expectedType;
return "array" !== r.kind || 0 !== r.N || !n || "array" !== n.kind || "number" == typeof n.N && 0 !== n.N || (r = n),
new At(r,i)
}
evaluate() {
return this.value
}
eachChild() {}
outputDefined() {
return !0
}
serialize() {
return "array" === this.type.kind || "object" === this.type.kind ? ["literal", this.value] : this.value instanceof xt ? ["rgba"].concat(this.value.toArray()) : this.value instanceof wt ? this.value.serialize() : this.value
}
}
var It = At
, zt = class {
constructor(e) {
this.name = "ExpressionEvaluationError",
this.message = e
}
toJSON() {
return this.message
}
}
;
const kt = {
string: it,
number: tt,
boolean: rt,
object: ot
};
class Pt {
constructor(e, t) {
this.type = e,
this.args = t
}
static parse(e, t) {
if (e.length < 2)
return t.error("Expected at least one argument.");
let i, r = 1;
const n = e[0];
if ("array" === n) {
let n, o;
if (e.length > 2) {
const i = e[1];
if ("string" != typeof i || !(i in kt) || "object" === i)
return t.error('The item type argument of "array" must be one of string, number, boolean', 1);
n = kt[i],
r++
} else
n = st;
if (e.length > 3) {
if (null !== e[2] && ("number" != typeof e[2] || e[2] < 0 || e[2] !== Math.floor(e[2])))
return t.error('The length argument to "array" must be a positive integer literal', 2);
o = e[2],
r++
}
i = ut(n, o)
} else
i = kt[n];
const o = [];
for (; r < e.length; r++) {
const i = t.parse(e[r], r, st);
if (!i)
return null;
o.push(i)
}
return new Pt(i,o)
}
evaluate(e) {
for (let t = 0; t < this.args.length; t++) {
const i = this.args[t].evaluate(e);
if (!pt(this.type, Ct(i)))
return i;
if (t === this.args.length - 1)
throw new zt(`Expected value to be of type ${ht(this.type)}, but found ${ht(Ct(i))} instead.`)
}
return null
}
eachChild(e) {
this.args.forEach(e)
}
outputDefined() {
return this.args.every((e=>e.outputDefined()))
}
serialize() {
const e = this.type
, t = [e.kind];
if ("array" === e.kind) {
const i = e.itemType;
if ("string" === i.kind || "number" === i.kind || "boolean" === i.kind) {
t.push(i.kind);
const r = e.N;
("number" == typeof r || this.args.length > 1) && t.push(r)
}
}
return t.concat(this.args.map((e=>e.serialize())))
}
}
var Dt = Pt;
class Lt {
constructor(e) {
this.type = lt,
this.sections = e
}
static parse(e, t) {
if (e.length < 2)
return t.error("Expected at least one argument.");
const i = e[1];
if (!Array.isArray(i) && "object" == typeof i)
return t.error("First argument must be an image or text section.");
const r = [];
let n = !1;
for (let i = 1; i <= e.length - 1; ++i) {
const o = e[i];
if (n && "object" == typeof o && !Array.isArray(o)) {
n = !1;
let e = null;
if (o["font-scale"] && (e = t.parse(o["font-scale"], 1, tt),
!e))
return null;
let i = null;
if (o["text-font"] && (i = t.parse(o["text-font"], 1, ut(it)),
!i))
return null;
let s = null;
if (o["text-color"] && (s = t.parse(o["text-color"], 1, nt),
!s))
return null;
const a = r[r.length - 1];
a.scale = e,
a.font = i,
a.textColor = s
} else {
const o = t.parse(e[i], 1, st);
if (!o)
return null;
const s = o.type.kind;
if ("string" !== s && "value" !== s && "null" !== s && "resolvedImage" !== s)
return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");
n = !0,
r.push({
content: o,
scale: null,
font: null,
textColor: null
})
}
}
return new Lt(r)
}
evaluate(e) {
return new wt(this.sections.map((t=>{
const i = t.content.evaluate(e);
return Ct(i) === ct ? new bt("",i,null,null,null) : new bt(Mt(i),null,t.scale ? t.scale.evaluate(e) : null,t.font ? t.font.evaluate(e).join(",") : null,t.textColor ? t.textColor.evaluate(e) : null)
}
)))
}
eachChild(e) {
for (const t of this.sections)
e(t.content),
t.scale && e(t.scale),
t.font && e(t.font),
t.textColor && e(t.textColor)
}
outputDefined() {
return !1
}
serialize() {
const e = ["format"];
for (const t of this.sections) {
e.push(t.content.serialize());
const i = {};
t.scale && (i["font-scale"] = t.scale.serialize()),
t.font && (i["text-font"] = t.font.serialize()),
t.textColor && (i["text-color"] = t.textColor.serialize()),
e.push(i)
}
return e
}
}
class Bt {
constructor(e) {
this.type = ct,
this.input = e
}
static parse(e, t) {
if (2 !== e.length)
return t.error("Expected two arguments.");
const i = t.parse(e[1], 1, it);
return i ? new Bt(i) : t.error("No image name provided.")
}
evaluate(e) {
const t = this.input.evaluate(e)
, i = Tt.fromString(t);
return i && e.availableImages && (i.available = e.availableImages.indexOf(t) > -1),
i
}
eachChild(e) {
e(this.input)
}
outputDefined() {
return !1
}
serialize() {
return ["image", this.input.serialize()]
}
}
const Ot = {
"to-boolean": rt,
"to-color": nt,
"to-number": tt,
"to-string": it
};
class Rt {
constructor(e, t) {
this.type = e,
this.args = t
}
static parse(e, t) {
if (e.length < 2)
return t.error("Expected at least one argument.");
const i = e[0];
if (("to-boolean" === i || "to-string" === i) && 2 !== e.length)
return t.error("Expected one argument.");
const r = Ot[i]
, n = [];
for (let i = 1; i < e.length; i++) {
const r = t.parse(e[i], i, st);
if (!r)
return null;
n.push(r)
}
return new Rt(r,n)
}
evaluate(e) {
if ("boolean" === this.type.kind)
return Boolean(this.args[0].evaluate(e));
if ("color" === this.type.kind) {
let t, i;
for (const r of this.args) {
if (t = r.evaluate(e),
i = null,
t instanceof xt)
return t;
if ("string" == typeof t) {
const i = e.parseColor(t);
if (i)
return i
} else if (Array.isArray(t) && (i = t.length < 3 || t.length > 4 ? `Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.` : Et(t[0], t[1], t[2], t[3]),
!i))
return new xt(t[0] / 255,t[1] / 255,t[2] / 255,t[3])
}
throw new zt(i || `Could not parse color from value '${"string" == typeof t ? t : String(JSON.stringify(t))}'`)
}
if ("number" === this.type.kind) {
let t = null;
for (const i of this.args) {
if (t = i.evaluate(e),
null === t)
return 0;
const r = Number(t);
if (!isNaN(r))
return r
}
throw new zt(`Could not convert ${JSON.stringify(t)} to number.`)
}
return "formatted" === this.type.kind ? wt.fromString(Mt(this.args[0].evaluate(e))) : "resolvedImage" === this.type.kind ? Tt.fromString(Mt(this.args[0].evaluate(e))) : Mt(this.args[0].evaluate(e))
}
eachChild(e) {
this.args.forEach(e)
}
outputDefined() {
return this.args.every((e=>e.outputDefined()))
}
serialize() {
if ("formatted" === this.type.kind)
return new Lt([{
content: this.args[0],
scale: null,
font: null,
textColor: null
}]).serialize();
if ("resolvedImage" === this.type.kind)
return new Bt(this.args[0]).serialize();
const e = [`to-${this.type.kind}`];
return this.eachChild((t=>{
e.push(t.serialize())
}
)),
e
}
}
var Ft = Rt;
const Ut = ["Unknown", "Point", "LineString", "Polygon"];
var Vt = class {
constructor() {
this.globals = null,
this.feature = null,
this.featureState = null,
this.formattedSection = null,
this._parseColorCache = {},
this.availableImages = null,
this.canonical = null,
this.featureTileCoord = null,
this.featureDistanceData = null
}
id() {
return this.feature && void 0 !== this.feature.id ? this.feature.id : null
}
geometryType() {
return this.feature ? "number" == typeof this.feature.type ? Ut[this.feature.type] : this.feature.type : null
}
geometry() {
return this.feature && "geometry"in this.feature ? this.feature.geometry : null
}
canonicalID() {
return this.canonical
}
properties() {
return this.feature && this.feature.properties || {}
}
distanceFromCenter() {
if (this.featureTileCoord && this.featureDistanceData) {
const e = this.featureDistanceData.center
, t = this.featureDistanceData.scale
, {x: i, y: r} = this.featureTileCoord;
return this.featureDistanceData.bearing[0] * (i * t - e[0]) + this.featureDistanceData.bearing[1] * (r * t - e[1])
}
return 0
}
parseColor(e) {
let t = this._parseColorCache[e];
return t || (t = this._parseColorCache[e] = xt.parse(e)),
t
}
}
;
class jt {
constructor(e, t, i, r) {
this.name = e,
this.type = t,
this._evaluate = i,
this.args = r
}
evaluate(e) {
return this._evaluate(e, this.args)
}
eachChild(e) {
this.args.forEach(e)
}
outputDefined() {
return !1
}
serialize() {
return [this.name].concat(this.args.map((e=>e.serialize())))
}
static parse(e, t) {
const i = e[0]
, r = jt.definitions[i];
if (!r)
return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`, 0);
const n = Array.isArray(r) ? r[0] : r.type
, o = Array.isArray(r) ? [[r[1], r[2]]] : r.overloads
, s = o.filter((([t])=>!Array.isArray(t) || t.length === e.length - 1));
let a = null;
for (const [r,o] of s) {
a = new fi(t.registry,t.path,null,t.scope);
const s = [];
let l = !1;
for (let t = 1; t < e.length; t++) {
const i = e[t]
, n = Array.isArray(r) ? r[t - 1] : r.type
, o = a.parse(i, 1 + s.length, n);
if (!o) {
l = !0;
break
}
s.push(o)
}
if (!l)
if (Array.isArray(r) && r.length !== s.length)
a.error(`Expected ${r.length} arguments, but found ${s.length} instead.`);
else {
for (let e = 0; e < s.length; e++) {
const t = Array.isArray(r) ? r[e] : r.type
, i = s[e];
a.concat(e + 1).checkSubtype(t, i.type)
}
if (0 === a.errors.length)
return new jt(i,n,o,s)
}
}
if (1 === s.length)
t.errors.push(...a.errors);
else {
const i = (s.length ? s : o).map((([e])=>{
return t = e,
Array.isArray(t) ? `(${t.map(ht).join(", ")})` : `(${ht(t.type)}...)`;
var t
}
)).join(" | ")
, r = [];
for (let i = 1; i < e.length; i++) {
const n = t.parse(e[i], 1 + r.length);
if (!n)
return null;
r.push(ht(n.type))
}
t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)
}
return null
}
static register(e, t) {
jt.definitions = t;
for (const i in t)
e[i] = jt
}
}
var Nt = jt;
class Gt {
constructor(e, t, i) {
this.type = at,
this.locale = i,
this.caseSensitive = e,
this.diacriticSensitive = t
}
static parse(e, t) {
if (2 !== e.length)
return t.error("Expected one argument.");
const i = e[1];
if ("object" != typeof i || Array.isArray(i))
return t.error("Collator options argument must be an object.");
const r = t.parse(void 0 !== i["case-sensitive"] && i["case-sensitive"], 1, rt);
if (!r)
return null;
const n = t.parse(void 0 !== i["diacritic-sensitive"] && i["diacritic-sensitive"], 1, rt);
if (!n)
return null;
let o = null;
return i.locale && (o = t.parse(i.locale, 1, it),
!o) ? null : new Gt(r,n,o)
}
evaluate(e) {
return new vt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale ? this.locale.evaluate(e) : null)
}
eachChild(e) {
e(this.caseSensitive),
e(this.diacriticSensitive),
this.locale && e(this.locale)
}
outputDefined() {
return !1
}
serialize() {
const e = {};
return e["case-sensitive"] = this.caseSensitive.serialize(),
e["diacritic-sensitive"] = this.diacriticSensitive.serialize(),
this.locale && (e.locale = this.locale.serialize()),
["collator", e]
}
}
const $t = 8192;
function qt(e, t) {
e[0] = Math.min(e[0], t[0]),
e[1] = Math.min(e[1], t[1]),
e[2] = Math.max(e[2], t[0]),
e[3] = Math.max(e[3], t[1])
}
function Zt(e, t) {
return !(e[0] <= t[0] || e[2] >= t[2] || e[1] <= t[1] || e[3] >= t[3])
}
function Wt(e, t) {
const i = (180 + e[0]) / 360
, r = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + e[1] * Math.PI / 360))) / 360
, n = Math.pow(2, t.z);
return [Math.round(i * n * $t), Math.round(r * n * $t)]
}
function Xt(e, t, i) {
const r = e[0] - t[0]
, n = e[1] - t[1]
, o = e[0] - i[0]
, s = e[1] - i[1];
return r * s - o * n == 0 && r * o <= 0 && n * s <= 0
}
function Ht(e, t) {
let i = !1;
for (let s = 0, a = t.length; s < a; s++) {
const a = t[s];
for (let t = 0, s = a.length; t < s - 1; t++) {
if (Xt(e, a[t], a[t + 1]))
return !1;
(n = a[t])[1] > (r = e)[1] != (o = a[t + 1])[1] > r[1] && r[0] < (o[0] - n[0]) * (r[1] - n[1]) / (o[1] - n[1]) + n[0] && (i = !i)
}
}
var r, n, o;
return i
}
function Yt(e, t) {
for (let i = 0; i < t.length; i++)
if (Ht(e, t[i]))
return !0;
return !1
}
function Kt(e, t, i, r) {
const n = r[0] - i[0]
, o = r[1] - i[1]
, s = (e[0] - i[0]) * o - n * (e[1] - i[1])
, a = (t[0] - i[0]) * o - n * (t[1] - i[1]);
return s > 0 && a < 0 || s < 0 && a > 0
}
function Jt(e, t, i) {
for (const c of i)
for (let i = 0; i < c.length - 1; ++i)
if (0 != (a = [(s = c[i + 1])[0] - (o = c[i])[0], s[1] - o[1]])[0] * (l = [(n = t)[0] - (r = e)[0], n[1] - r[1]])[1] - a[1] * l[0] && Kt(r, n, o, s) && Kt(o, s, r, n))
return !0;
var r, n, o, s, a, l;
return !1
}
function Qt(e, t) {
for (let i = 0; i < e.length; ++i)
if (!Ht(e[i], t))
return !1;
for (let i = 0; i < e.length - 1; ++i)
if (Jt(e[i], e[i + 1], t))
return !1;
return !0
}
function ei(e, t) {
for (let i = 0; i < t.length; i++)
if (Qt(e, t[i]))
return !0;
return !1
}
function ti(e, t, i) {
const r = [];
for (let n = 0; n < e.length; n++) {
const o = [];
for (let r = 0; r < e[n].length; r++) {
const s = Wt(e[n][r], i);
qt(t, s),
o.push(s)
}
r.push(o)
}
return r
}
function ii(e, t, i) {
const r = [];
for (let n = 0; n < e.length; n++) {
const o = ti(e[n], t, i);
r.push(o)
}
return r
}
function ri(e, t, i, r) {
if (e[0] < i[0] || e[0] > i[2]) {
const t = .5 * r;
let n = e[0] - i[0] > t ? -r : i[0] - e[0] > t ? r : 0;
0 === n && (n = e[0] - i[2] > t ? -r : i[2] - e[0] > t ? r : 0),
e[0] += n
}
qt(t, e)
}
function ni(e, t, i, r) {
const n = Math.pow(2, r.z) * $t
, o = [r.x * $t, r.y * $t]
, s = [];
if (!e)
return s;
for (const r of e)
for (const e of r) {
const r = [e.x + o[0], e.y + o[1]];
ri(r, t, i, n),
s.push(r)
}
return s
}
function oi(e, t, i, r) {
const n = Math.pow(2, r.z) * $t
, o = [r.x * $t, r.y * $t]
, s = [];
if (!e)
return s;
for (const i of e) {
const e = [];
for (const r of i) {
const i = [r.x + o[0], r.y + o[1]];
qt(t, i),
e.push(i)
}
s.push(e)
}
if (t[2] - t[0] <= n / 2) {
(a = t)[0] = a[1] = 1 / 0,
a[2] = a[3] = -1 / 0;
for (const e of s)
for (const r of e)
ri(r, t, i, n)
}
var a;
return s
}
class si {
constructor(e, t) {
this.type = rt,
this.geojson = e,
this.geometries = t
}
static parse(e, t) {
if (2 !== e.length)
return t.error(`'within' expression requires exactly one argument, but found ${e.length - 1} instead.`);
if (St(e[1])) {
const t = e[1];
if ("FeatureCollection" === t.type)
for (let e = 0; e < t.features.length; ++e) {
const i = t.features[e].geometry.type;
if ("Polygon" === i || "MultiPolygon" === i)
return new si(t,t.features[e].geometry)
}
else if ("Feature" === t.type) {
const e = t.geometry.type;
if ("Polygon" === e || "MultiPolygon" === e)
return new si(t,t.geometry)
} else if ("Polygon" === t.type || "MultiPolygon" === t.type)
return new si(t,t)
}
return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")
}
evaluate(e) {
if (null != e.geometry() && null != e.canonicalID()) {
if ("Point" === e.geometryType())
return function(e, t) {
const i = [1 / 0, 1 / 0, -1 / 0, -1 / 0]
, r = [1 / 0, 1 / 0, -1 / 0, -1 / 0]
, n = e.canonicalID();
if (!n)
return !1;
if ("Polygon" === t.type) {
const o = ti(t.coordinates, r, n)
, s = ni(e.geometry(), i, r, n);
if (!Zt(i, r))
return !1;
for (const e of s)
if (!Ht(e, o))
return !1
}
if ("MultiPolygon" === t.type) {
const o = ii(t.coordinates, r, n)
, s = ni(e.geometry(), i, r, n);
if (!Zt(i, r))
return !1;
for (const e of s)
if (!Yt(e, o))
return !1
}
return !0
}(e, this.geometries);
if ("LineString" === e.geometryType())
return function(e, t) {
const i = [1 / 0, 1 / 0, -1 / 0, -1 / 0]
, r = [1 / 0, 1 / 0, -1 / 0, -1 / 0]
, n = e.canonicalID();
if (!n)
return !1;
if ("Polygon" === t.type) {
const o = ti(t.coordinates, r, n)
, s = oi(e.geometry(), i, r, n);
if (!Zt(i, r))
return !1;
for (const e of s)
if (!Qt(e, o))
return !1
}
if ("MultiPolygon" === t.type) {
const o = ii(t.coordinates, r, n)
, s = oi(e.geometry(), i, r, n);
if (!Zt(i, r))
return !1;
for (const e of s)
if (!ei(e, o))
return !1
}
return !0
}(e, this.geometries)
}
return !1
}
eachChild() {}
outputDefined() {
return !0
}
serialize() {
return ["within", this.geojson]
}
}
var ai = si;
function li(e) {
if (e instanceof Nt) {
if ("get" === e.name && 1 === e.args.length)
return !1;
if ("feature-state" === e.name)
return !1;
if ("has" === e.name && 1 === e.args.length)
return !1;
if ("properties" === e.name || "geometry-type" === e.name || "id" === e.name)
return !1;
if (/^filter-/.test(e.name))
return !1
}
if (e instanceof ai)
return !1;
let t = !0;
return e.eachChild((e=>{
t && !li(e) && (t = !1)
}
)),
t
}
function ci(e) {
if (e instanceof Nt && "feature-state" === e.name)
return !1;
let t = !0;
return e.eachChild((e=>{
t && !ci(e) && (t = !1)
}
)),
t
}
function ui(e, t) {
if (e instanceof Nt && t.indexOf(e.name) >= 0)
return !1;
let i = !0;
return e.eachChild((e=>{
i && !ui(e, t) && (i = !1)
}
)),
i
}
class hi {
constructor(e, t) {
this.type = t.type,
this.name = e,
this.boundExpression = t
}
static parse(e, t) {
if (2 !== e.length || "string" != typeof e[1])
return t.error("'var' expression requires exactly one string literal argument.");
const i = e[1];
return t.scope.has(i) ? new hi(i,t.scope.get(i)) : t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`, 1)
}
evaluate(e) {
return this.boundExpression.evaluate(e)
}
eachChild() {}
outputDefined() {
return !1
}
serialize() {
return ["var", this.name]
}
}
var di = hi;
class pi {
constructor(e, t=[], i, r=new Qe, n=[]) {
this.registry = e,
this.path = t,
this.key = t.map((e=>`[${e}]`)).join(""),
this.scope = r,
this.errors = n,
this.expectedType = i
}
parse(e, t, i, r, n={}) {
return t ? this.concat(t, i, r)._parse(e, n) : this._parse(e, n)
}
_parse(e, t) {
function i(e, t, i) {
return "assert" === i ? new Dt(t,[e]) : "coerce" === i ? new Ft(t,[e]) : e
}
if (null !== e && "string" != typeof e && "boolean" != typeof e && "number" != typeof e || (e = ["literal", e]),
Array.isArray(e)) {
if (0 === e.length)
return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');
const r = e[0];
if ("string" != typeof r)
return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`, 0),
null;
const n = this.registry[r];
if (n) {
let r = n.parse(e, this);
if (!r)
return null;
if (this.expectedType) {
const e = this.expectedType
, n = r.type;
if ("string" !== e.kind && "number" !== e.kind && "boolean" !== e.kind && "object" !== e.kind && "array" !== e.kind || "value" !== n.kind)
if ("color" !== e.kind && "formatted" !== e.kind && "resolvedImage" !== e.kind || "value" !== n.kind && "string" !== n.kind) {
if (this.checkSubtype(e, n))
return null
} else
r = i(r, e, t.typeAnnotation || "coerce");
else
r = i(r, e, t.typeAnnotation || "assert")
}
if (!(r instanceof It) && "resolvedImage" !== r.type.kind && mi(r)) {
const t = new Vt;
try {
r = new It(r.type,r.evaluate(t))
} catch (e) {
return this.error(e.message),
null
}
}
return r
}
return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`, 0)
}
return this.error(void 0 === e ? "'undefined' value invalid. Use null instead." : "object" == typeof e ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof e} instead.`)
}
concat(e, t, i) {
const r = "number" == typeof e ? this.path.concat(e) : this.path
, n = i ? this.scope.concat(i) : this.scope;
return new pi(this.registry,r,t || null,n,this.errors)
}
error(e, ...t) {
const i = `${this.key}${t.map((e=>`[${e}]`)).join("")}`;
this.errors.push(new Ke(i,e))
}
checkSubtype(e, t) {
const i = pt(e, t);
return i && this.error(i),
i
}
}
var fi = pi;
function mi(e) {
if (e instanceof di)
return mi(e.boundExpression);
if (e instanceof Nt && "error" === e.name)
return !1;
if (e instanceof Gt)
return !1;
if (e instanceof ai)
return !1;
const t = e instanceof Ft || e instanceof Dt;
let i = !0;
return e.eachChild((e=>{
i = t ? i && mi(e) : i && e instanceof It
}
)),
!!i && li(e) && ui(e, ["zoom", "heatmap-density", "line-progress", "sky-radial-progress", "accumulated", "is-supported-script", "pitch", "distance-from-center"])
}
function _i(e, t) {
const i = e.length - 1;
let r, n, o = 0, s = i, a = 0;
for (; o <= s; )
if (a = Math.floor((o + s) / 2),
r = e[a],
n = e[a + 1],
r <= t) {
if (a === i || t < n)
return a;
o = a + 1
} else {
if (!(r > t))
throw new zt("Input is not a number.");
s = a - 1
}
return 0
}
class gi {
constructor(e, t, i) {
this.type = e,
this.input = t,
this.labels = [],
this.outputs = [];
for (const [e,t] of i)
this.labels.push(e),
this.outputs.push(t)
}
static parse(e, t) {
if (e.length - 1 < 4)
return t.error(`Expected at least 4 arguments, but found only ${e.length - 1}.`);
if ((e.length - 1) % 2 != 0)
return t.error("Expected an even number of arguments.");
const i = t.parse(e[1], 1, tt);
if (!i)
return null;
const r = [];
let n = null;
t.expectedType && "value" !== t.expectedType.kind && (n = t.expectedType);
for (let i = 1; i < e.length; i += 2) {
const o = 1 === i ? -1 / 0 : e[i]
, s = e[i + 1]
, a = i
, l = i + 1;
if ("number" != typeof o)
return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', a);
if (r.length && r[r.length - 1][0] >= o)
return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', a);
const c = t.parse(s, l, n);
if (!c)
return null;
n = n || c.type,
r.push([o, c])
}
return new gi(n,i,r)
}
evaluate(e) {
const t = this.labels
, i = this.outputs;
if (1 === t.length)
return i[0].evaluate(e);
const r = this.input.evaluate(e);
if (r <= t[0])
return i[0].evaluate(e);
const n = t.length;
return r >= t[n - 1] ? i[n - 1].evaluate(e) : i[_i(t, r)].evaluate(e)
}
eachChild(e) {
e(this.input);
for (const t of this.outputs)
e(t)
}
outputDefined() {
return this.outputs.every((e=>e.outputDefined()))
}
serialize() {
const e = ["step", this.input.serialize()];
for (let t = 0; t < this.labels.length; t++)
t > 0 && e.push(this.labels[t]),
e.push(this.outputs[t].serialize());
return e
}
}
var yi = gi;
function xi(e, t, i) {
return e * (1 - i) + t * i
}
function vi(e, t, i) {
return e.map(((e,r)=>xi(e, t[r], i)))
}
var bi = Object.freeze({
__proto__: null,
number: xi,
color: function(e, t, i) {
return new xt(xi(e.r, t.r, i),xi(e.g, t.g, i),xi(e.b, t.b, i),xi(e.a, t.a, i))
},
array: vi
});
const wi = .95047
, Ti = 1.08883
, Ei = 4 / 29
, Si = 6 / 29
, Ci = 3 * Si * Si
, Mi = Math.PI / 180
, Ai = 180 / Math.PI;
function Ii(e) {
return e > .008856451679035631 ? Math.pow(e, 1 / 3) : e / Ci + Ei
}
function zi(e) {
return e > Si ? e * e * e : Ci * (e - Ei)
}
function ki(e) {
return 255 * (e <= .0031308 ? 12.92 * e : 1.055 * Math.pow(e, 1 / 2.4) - .055)
}
function Pi(e) {
return (e /= 255) <= .04045 ? e / 12.92 : Math.pow((e + .055) / 1.055, 2.4)
}
function Di(e) {
const t = Pi(e.r)
, i = Pi(e.g)
, r = Pi(e.b)
, n = Ii((.4124564 * t + .3575761 * i + .1804375 * r) / wi)
, o = Ii((.2126729 * t + .7151522 * i + .072175 * r) / 1);
return {
l: 116 * o - 16,
a: 500 * (n - o),
b: 200 * (o - Ii((.0193339 * t + .119192 * i + .9503041 * r) / Ti)),
alpha: e.a
}
}
function Li(e) {
let t = (e.l + 16) / 116
, i = isNaN(e.a) ? t : t + e.a / 500
, r = isNaN(e.b) ? t : t - e.b / 200;
return t = 1 * zi(t),
i = wi * zi(i),
r = Ti * zi(r),
new xt(ki(3.2404542 * i - 1.5371385 * t - .4985314 * r),ki(-.969266 * i + 1.8760108 * t + .041556 * r),ki(.0556434 * i - .2040259 * t + 1.0572252 * r),e.alpha)
}
function Bi(e, t, i) {
const r = t - e;
return e + i * (r > 180 || r < -180 ? r - 360 * Math.round(r / 360) : r)
}
const Oi = {
forward: Di,
reverse: Li,
interpolate: function(e, t, i) {
return {
l: xi(e.l, t.l, i),
a: xi(e.a, t.a, i),
b: xi(e.b, t.b, i),
alpha: xi(e.alpha, t.alpha, i)
}
}
}
, Ri = {
forward: function(e) {
const {l: t, a: i, b: r} = Di(e)
, n = Math.atan2(r, i) * Ai;
return {
h: n < 0 ? n + 360 : n,
c: Math.sqrt(i * i + r * r),
l: t,
alpha: e.a
}
},
reverse: function(e) {
const t = e.h * Mi
, i = e.c;
return Li({
l: e.l,
a: Math.cos(t) * i,
b: Math.sin(t) * i,
alpha: e.alpha
})
},
interpolate: function(e, t, i) {
return {
h: Bi(e.h, t.h, i),
c: xi(e.c, t.c, i),
l: xi(e.l, t.l, i),
alpha: xi(e.alpha, t.alpha, i)
}
}
};
var Fi = Object.freeze({
__proto__: null,
lab: Oi,
hcl: Ri
});
class Ui {
constructor(e, t, i, r, n) {
this.type = e,
this.operator = t,
this.interpolation = i,
this.input = r,
this.labels = [],
this.outputs = [];
for (const [e,t] of n)
this.labels.push(e),
this.outputs.push(t)
}
static interpolationFactor(e, t, r, n) {
let o = 0;
if ("exponential" === e.name)
o = Vi(t, e.base, r, n);
else if ("linear" === e.name)
o = Vi(t, 1, r, n);
else if ("cubic-bezier" === e.name) {
const s = e.controlPoints;
o = new i(s[0],s[1],s[2],s[3]).solve(Vi(t, 1, r, n))
}
return o
}
static parse(e, t) {
let[i,r,n,...o] = e;
if (!Array.isArray(r) || 0 === r.length)
return t.error("Expected an interpolation type expression.", 1);
if ("linear" === r[0])
r = {
name: "linear"
};
else if ("exponential" === r[0]) {
const e = r[1];
if ("number" != typeof e)
return t.error("Exponential interpolation requires a numeric base.", 1, 1);
r = {
name: "exponential",
base: e
}
} else {
if ("cubic-bezier" !== r[0])
return t.error(`Unknown interpolation type ${String(r[0])}`, 1, 0);
{
const e = r.slice(1);
if (4 !== e.length || e.some((e=>"number" != typeof e || e < 0 || e > 1)))
return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1);
r = {
name: "cubic-bezier",
controlPoints: e
}
}
}
if (e.length - 1 < 4)
return t.error(`Expected at least 4 arguments, but found only ${e.length - 1}.`);
if ((e.length - 1) % 2 != 0)
return t.error("Expected an even number of arguments.");
if (n = t.parse(n, 2, tt),
!n)
return null;
const s = [];
let a = null;
"interpolate-hcl" === i || "interpolate-lab" === i ? a = nt : t.expectedType && "value" !== t.expectedType.kind && (a = t.expectedType);
for (let e = 0; e < o.length; e += 2) {
const i = o[e]
, r = o[e + 1]
, n = e + 3
, l = e + 4;
if ("number" != typeof i)
return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', n);
if (s.length && s[s.length - 1][0] >= i)
return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', n);
const c = t.parse(r, l, a);
if (!c)
return null;
a = a || c.type,
s.push([i, c])
}
return "number" === a.kind || "color" === a.kind || "array" === a.kind && "number" === a.itemType.kind && "number" == typeof a.N ? new Ui(a,i,r,n,s) : t.error(`Type ${ht(a)} is not interpolatable.`)
}
evaluate(e) {
const t = this.labels
, i = this.outputs;
if (1 === t.length)
return i[0].evaluate(e);
const r = this.input.evaluate(e);
if (r <= t[0])
return i[0].evaluate(e);
const n = t.length;
if (r >= t[n - 1])
return i[n - 1].evaluate(e);
const o = _i(t, r)
, s = Ui.interpolationFactor(this.interpolation, r, t[o], t[o + 1])
, a = i[o].evaluate(e)
, l = i[o + 1].evaluate(e);
return "interpolate" === this.operator ? bi[this.type.kind.toLowerCase()](a, l, s) : "interpolate-hcl" === this.operator ? Ri.reverse(Ri.interpolate(Ri.forward(a), Ri.forward(l), s)) : Oi.reverse(Oi.interpolate(Oi.forward(a), Oi.forward(l), s))
}
eachChild(e) {
e(this.input);
for (const t of this.outputs)
e(t)
}
outputDefined() {
return this.outputs.every((e=>e.outputDefined()))
}
serialize() {
let e;
e = "linear" === this.interpolation.name ? ["linear"] : "exponential" === this.interpolation.name ? 1 === this.interpolation.base ? ["linear"] : ["exponential", this.interpolation.base] : ["cubic-bezier"].concat(this.interpolation.controlPoints);
const t = [this.operator, e, this.input.serialize()];
for (let e = 0; e < this.labels.length; e++)
t.push(this.labels[e], this.outputs[e].serialize());
return t
}
}
function Vi(e, t, i, r) {
const n = r - i
, o = e - i;
return 0 === n ? 0 : 1 === t ? o / n : (Math.pow(t, o) - 1) / (Math.pow(t, n) - 1)
}
var ji = Ui;
class Ni {
constructor(e, t) {
this.type = e,
this.args = t
}
static parse(e, t) {
if (e.length < 2)
return t.error("Expectected at least one argument.");
let i = null;
const r = t.expectedType;
r && "value" !== r.kind && (i = r);
const n = [];
for (const r of e.slice(1)) {
const e = t.parse(r, 1 + n.length, i, void 0, {
typeAnnotation: "omit"
});
if (!e)
return null;
i = i || e.type,
n.push(e)
}
const o = r && n.some((e=>pt(r, e.type)));
return new Ni(o ? st : i,n)
}
evaluate(e) {
let t, i = null, r = 0;
for (const n of this.args) {
if (r++,
i = n.evaluate(e),
i && i instanceof Tt && !i.available && (t || (t = i),
i = null,
r === this.args.length))
return t;
if (null !== i)
break
}
return i
}
eachChild(e) {
this.args.forEach(e)
}
outputDefined() {
return this.args.every((e=>e.outputDefined()))
}
serialize() {
const e = ["coalesce"];
return this.eachChild((t=>{
e.push(t.serialize())
}
)),
e
}
}
var Gi = Ni;
class $i {
constructor(e, t) {
this.type = t.type,
this.bindings = [].concat(e),
this.result = t
}
evaluate(e) {
return this.result.evaluate(e)
}
eachChild(e) {
for (const t of this.bindings)
e(t[1]);
e(this.result)
}
static parse(e, t) {
if (e.length < 4)
return t.error(`Expected at least 3 arguments, but found ${e.length - 1} instead.`);
const i = [];
for (let r = 1; r < e.length - 1; r += 2) {
const n = e[r];
if ("string" != typeof n)
return t.error(`Expected string, but found ${typeof n} instead.`, r);
if (/[^a-zA-Z0-9_]/.test(n))
return t.error("Variable names must contain only alphanumeric characters or '_'.", r);
const o = t.parse(e[r + 1], r + 1);
if (!o)
return null;
i.push([n, o])
}
const r = t.parse(e[e.length - 1], e.length - 1, t.expectedType, i);
return r ? new $i(i,r) : null
}
outputDefined() {
return this.result.outputDefined()
}
serialize() {
const e = ["let"];
for (const [t,i] of this.bindings)
e.push(t, i.serialize());
return e.push(this.result.serialize()),
e
}
}
var qi = $i;
class Zi {
constructor(e, t, i) {
this.type = e,
this.index = t,
this.input = i
}
static parse(e, t) {
if (3 !== e.length)
return t.error(`Expected 2 arguments, but found ${e.length - 1} instead.`);
const i = t.parse(e[1], 1, tt)
, r = t.parse(e[2], 2, ut(t.expectedType || st));
return i && r ? new Zi(r.type.itemType,i,r) : null
}
evaluate(e) {
const t = this.index.evaluate(e)
, i = this.input.evaluate(e);
if (t < 0)
throw new zt(`Array index out of bounds: ${t} < 0.`);
if (t >= i.length)
throw new zt(`Array index out of bounds: ${t} > ${i.length - 1}.`);
if (t !== Math.floor(t))
throw new zt(`Array index must be an integer, but found ${t} instead.`);
return i[t]
}
eachChild(e) {
e(this.index),
e(this.input)
}
outputDefined() {
return !1
}
serialize() {
return ["at", this.index.serialize(), this.input.serialize()]
}
}
var Wi = Zi;
class Xi {
constructor(e, t) {
this.type = rt,
this.needle = e,
this.haystack = t
}
static parse(e, t) {
if (3 !== e.length)
return t.error(`Expected 2 arguments, but found ${e.length - 1} instead.`);
const i = t.parse(e[1], 1, st)
, r = t.parse(e[2], 2, st);
return i && r ? ft(i.type, [rt, it, tt, et, st]) ? new Xi(i,r) : t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ht(i.type)} instead`) : null
}
evaluate(e) {
const t = this.needle.evaluate(e)
, i = this.haystack.evaluate(e);
if (null == i)
return !1;
if (!mt(t, ["boolean", "string", "number", "null"]))
throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${ht(Ct(t))} instead.`);
if (!mt(i, ["string", "array"]))
throw new zt(`Expected second argument to be of type array or string, but found ${ht(Ct(i))} instead.`);
return i.indexOf(t) >= 0
}
eachChild(e) {
e(this.needle),
e(this.haystack)
}
outputDefined() {
return !0
}
serialize() {
return ["in", this.needle.serialize(), this.haystack.serialize()]
}
}
var Hi = Xi;
class Yi {
constructor(e, t, i) {
this.type = tt,
this.needle = e,
this.haystack = t,
this.fromIndex = i
}
static parse(e, t) {
if (e.length <= 2 || e.length >= 5)
return t.error(`Expected 3 or 4 arguments, but found ${e.length - 1} instead.`);
const i = t.parse(e[1], 1, st)
, r = t.parse(e[2], 2, st);
if (!i || !r)
return null;
if (!ft(i.type, [rt, it, tt, et, st]))
return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${ht(i.type)} instead`);
if (4 === e.length) {
const n = t.parse(e[3], 3, tt);
return n ? new Yi(i,r,n) : null
}
return new Yi(i,r)
}
evaluate(e) {
const t = this.needle.evaluate(e)
, i = this.haystack.evaluate(e);
if (!mt(t, ["boolean", "string", "number", "null"]))
throw new zt(`Expected first argument to be of type boolean, string, number or null, but found ${ht(Ct(t))} instead.`);
if (!mt(i, ["string", "array"]))
throw new zt(`Expected second argument to be of type array or string, but found ${ht(Ct(i))} instead.`);
if (this.fromIndex) {
const r = this.fromIndex.evaluate(e);
return i.indexOf(t, r)
}
return i.indexOf(t)
}
eachChild(e) {
e(this.needle),
e(this.haystack),
this.fromIndex && e(this.fromIndex)
}
outputDefined() {
return !1
}
serialize() {
if (null != this.fromIndex && void 0 !== this.fromIndex) {
const e = this.fromIndex.serialize();
return ["index-of", this.needle.serialize(), this.haystack.serialize(), e]
}
return ["index-of", this.needle.serialize(), this.haystack.serialize()]
}
}
var Ki = Yi;
class Ji {
constructor(e, t, i, r, n, o) {
this.inputType = e,
this.type = t,
this.input = i,
this.cases = r,
this.outputs = n,
this.otherwise = o
}
static parse(e, t) {
if (e.length < 5)
return t.error(`Expected at least 4 arguments, but found only ${e.length - 1}.`);
if (e.length % 2 != 1)
return t.error("Expected an even number of arguments.");
let i, r;
t.expectedType && "value" !== t.expectedType.kind && (r = t.expectedType);
const n = {}
, o = [];
for (let s = 2; s < e.length - 1; s += 2) {
let a = e[s];
const l = e[s + 1];
Array.isArray(a) || (a = [a]);
const c = t.concat(s);
if (0 === a.length)
return c.error("Expected at least one branch label.");
for (const e of a) {
if ("number" != typeof e && "string" != typeof e)
return c.error("Branch labels must be numbers or strings.");
if ("number" == typeof e && Math.abs(e) > Number.MAX_SAFE_INTEGER)
return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
if ("number" == typeof e && Math.floor(e) !== e)
return c.error("Numeric branch labels must be integer values.");
if (i) {
if (c.checkSubtype(i, Ct(e)))
return null
} else
i = Ct(e);
if (void 0 !== n[String(e)])
return c.error("Branch labels must be unique.");
n[String(e)] = o.length
}
const u = t.parse(l, s, r);
if (!u)
return null;
r = r || u.type,
o.push(u)
}
const s = t.parse(e[1], 1, st);
if (!s)
return null;
const a = t.parse(e[e.length - 1], e.length - 1, r);
return a ? "value" !== s.type.kind && t.concat(1).checkSubtype(i, s.type) ? null : new Ji(i,r,s,n,o,a) : null
}
evaluate(e) {
const t = this.input.evaluate(e);
return (Ct(t) === this.inputType && this.outputs[this.cases[t]] || this.otherwise).evaluate(e)
}
eachChild(e) {
e(this.input),
this.outputs.forEach(e),
e(this.otherwise)
}
outputDefined() {
return this.outputs.every((e=>e.outputDefined())) && this.otherwise.outputDefined()
}
serialize() {
const e = ["match", this.input.serialize()]
, t = Object.keys(this.cases).sort()
, i = []
, r = {};
for (const e of t) {
const t = r[this.cases[e]];
void 0 === t ? (r[this.cases[e]] = i.length,
i.push([this.cases[e], [e]])) : i[t][1].push(e)
}
const n = e=>"number" === this.inputType.kind ? Number(e) : e;
for (const [t,r] of i)
e.push(1 === r.length ? n(r[0]) : r.map(n)),
e.push(this.outputs[t].serialize());
return e.push(this.otherwise.serialize()),
e
}
}
var Qi = Ji;
class er {
constructor(e, t, i) {
this.type = e,
this.branches = t,
this.otherwise = i
}
static parse(e, t) {
if (e.length < 4)
return t.error(`Expected at least 3 arguments, but found only ${e.length - 1}.`);
if (e.length % 2 != 0)
return t.error("Expected an odd number of arguments.");
let i;
t.expectedType && "value" !== t.expectedType.kind && (i = t.expectedType);
const r = [];
for (let n = 1; n < e.length - 1; n += 2) {
const o = t.parse(e[n], n, rt);
if (!o)
return null;
const s = t.parse(e[n + 1], n + 1, i);
if (!s)
return null;
r.push([o, s]),
i = i || s.type
}
const n = t.parse(e[e.length - 1], e.length - 1, i);
return n ? new er(i,r,n) : null
}
evaluate(e) {
for (const [t,i] of this.branches)
if (t.evaluate(e))
return i.evaluate(e);
return this.otherwise.evaluate(e)
}
eachChild(e) {
for (const [t,i] of this.branches)
e(t),
e(i);
e(this.otherwise)
}
outputDefined() {
return this.branches.every((([e,t])=>t.outputDefined())) && this.otherwise.outputDefined()
}
serialize() {
const e = ["case"];
return this.eachChild((t=>{
e.push(t.serialize())
}
)),
e
}
}
var tr = er;
class ir {
constructor(e, t, i, r) {
this.type = e,
this.input = t,
this.beginIndex = i,
this.endIndex = r
}
static parse(e, t) {
if (e.length <= 2 || e.length >= 5)
return t.error(`Expected 3 or 4 arguments, but found ${e.length - 1} instead.`);
const i = t.parse(e[1], 1, st)
, r = t.parse(e[2], 2, tt);
if (!i || !r)
return null;
if (!ft(i.type, [ut(st), it, st]))
return t.error(`Expected first argument to be of type array or string, but found ${ht(i.type)} instead`);
if (4 === e.length) {
const n = t.parse(e[3], 3, tt);
return n ? new ir(i.type,i,r,n) : null
}
return new ir(i.type,i,r)
}
evaluate(e) {
const t = this.input.evaluate(e)
, i = this.beginIndex.evaluate(e);
if (!mt(t, ["string", "array"]))
throw new zt(`Expected first argument to be of type array or string, but found ${ht(Ct(t))} instead.`);
if (this.endIndex) {
const r = this.endIndex.evaluate(e);
return t.slice(i, r)
}
return t.slice(i)
}
eachChild(e) {
e(this.input),
e(this.beginIndex),
this.endIndex && e(this.endIndex)
}
outputDefined() {
return !1
}
serialize() {
if (null != this.endIndex && void 0 !== this.endIndex) {
const e = this.endIndex.serialize();
return ["slice", this.input.serialize(), this.beginIndex.serialize(), e]
}
return ["slice", this.input.serialize(), this.beginIndex.serialize()]
}
}
var rr = ir;
function nr(e, t) {
return "==" === e || "!=" === e ? "boolean" === t.kind || "string" === t.kind || "number" === t.kind || "null" === t.kind || "value" === t.kind : "string" === t.kind || "number" === t.kind || "value" === t.kind
}
function or(e, t, i, r) {
return 0 === r.compare(t, i)
}
function sr(e, t, i) {
const r = "==" !== e && "!=" !== e;
return class n {
constructor(e, t, i) {
this.type = rt,
this.lhs = e,
this.rhs = t,
this.collator = i,
this.hasUntypedArgument = "value" === e.type.kind || "value" === t.type.kind
}
static parse(e, t) {
if (3 !== e.length && 4 !== e.length)
return t.error("Expected two or three arguments.");
const i = e[0];
let o = t.parse(e[1], 1, st);
if (!o)
return null;
if (!nr(i, o.type))
return t.concat(1).error(`"${i}" comparisons are not supported for type '${ht(o.type)}'.`);
let s = t.parse(e[2], 2, st);
if (!s)
return null;
if (!nr(i, s.type))
return t.concat(2).error(`"${i}" comparisons are not supported for type '${ht(s.type)}'.`);
if (o.type.kind !== s.type.kind && "value" !== o.type.kind && "value" !== s.type.kind)
return t.error(`Cannot compare types '${ht(o.type)}' and '${ht(s.type)}'.`);
r && ("value" === o.type.kind && "value" !== s.type.kind ? o = new Dt(s.type,[o]) : "value" !== o.type.kind && "value" === s.type.kind && (s = new Dt(o.type,[s])));
let a = null;
if (4 === e.length) {
if ("string" !== o.type.kind && "string" !== s.type.kind && "value" !== o.type.kind && "value" !== s.type.kind)
return t.error("Cannot use collator to compare non-string types.");
if (a = t.parse(e[3], 3, at),
!a)
return null
}
return new n(o,s,a)
}
evaluate(n) {
const o = this.lhs.evaluate(n)
, s = this.rhs.evaluate(n);
if (r && this.hasUntypedArgument) {
const t = Ct(o)
, i = Ct(s);
if (t.kind !== i.kind || "string" !== t.kind && "number" !== t.kind)
throw new zt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)
}
if (this.collator && !r && this.hasUntypedArgument) {
const e = Ct(o)
, i = Ct(s);
if ("string" !== e.kind || "string" !== i.kind)
return t(n, o, s)
}
return this.collator ? i(n, o, s, this.collator.evaluate(n)) : t(n, o, s)
}
eachChild(e) {
e(this.lhs),
e(this.rhs),
this.collator && e(this.collator)
}
outputDefined() {
return !0
}
serialize() {
const t = [e];
return this.eachChild((e=>{
t.push(e.serialize())
}
)),
t
}
}
}
const ar = sr("==", (function(e, t, i) {
return t === i
}
), or)
, lr = sr("!=", (function(e, t, i) {
return t !== i
}
), (function(e, t, i, r) {
return !or(0, t, i, r)
}
))
, cr = sr("<", (function(e, t, i) {
return t < i
}
), (function(e, t, i, r) {
return r.compare(t, i) < 0
}
))
, ur = sr(">", (function(e, t, i) {
return t > i
}
), (function(e, t, i, r) {
return r.compare(t, i) > 0
}
))
, hr = sr("<=", (function(e, t, i) {
return t <= i
}
), (function(e, t, i, r) {
return r.compare(t, i) <= 0
}
))
, dr = sr(">=", (function(e, t, i) {
return t >= i
}
), (function(e, t, i, r) {
return r.compare(t, i) >= 0
}
));
class pr {
constructor(e, t, i, r, n, o) {
this.type = it,
this.number = e,
this.locale = t,
this.currency = i,
this.unit = r,
this.minFractionDigits = n,
this.maxFractionDigits = o
}
static parse(e, t) {
if (3 !== e.length)
return t.error("Expected two arguments.");
const i = t.parse(e[1], 1, tt);
if (!i)
return null;
const r = e[2];
if ("object" != typeof r || Array.isArray(r))
return t.error("NumberFormat options argument must be an object.");
let n = null;
if (r.locale && (n = t.parse(r.locale, 1, it),
!n))
return null;
let o = null;
if (r.currency && (o = t.parse(r.currency, 1, it),
!o))
return null;
let s = null;
if (r.unit && (s = t.parse(r.unit, 1, it),
!s))
return null;
let a = null;
if (r["min-fraction-digits"] && (a = t.parse(r["min-fraction-digits"], 1, tt),
!a))
return null;
let l = null;
return r["max-fraction-digits"] && (l = t.parse(r["max-fraction-digits"], 1, tt),
!l) ? null : new pr(i,n,o,s,a,l)
}
evaluate(e) {
return new Intl.NumberFormat(this.locale ? this.locale.evaluate(e) : [],{
style: (this.currency ? "currency" : this.unit && "unit") || "decimal",
currency: this.currency ? this.currency.evaluate(e) : void 0,
unit: this.unit ? this.unit.evaluate(e) : void 0,
minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(e) : void 0,
maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(e) : void 0
}).format(this.number.evaluate(e))
}
eachChild(e) {
e(this.number),
this.locale && e(this.locale),
this.currency && e(this.currency),
this.unit && e(this.unit),
this.minFractionDigits && e(this.minFractionDigits),
this.maxFractionDigits && e(this.maxFractionDigits)
}
outputDefined() {
return !1
}
serialize() {
const e = {};
return this.locale && (e.locale = this.locale.serialize()),
this.currency && (e.currency = this.currency.serialize()),
this.unit && (e.unit = this.unit.serialize()),
this.minFractionDigits && (e["min-fraction-digits"] = this.minFractionDigits.serialize()),
this.maxFractionDigits && (e["max-fraction-digits"] = this.maxFractionDigits.serialize()),
["number-format", this.number.serialize(), e]
}
}
class fr {
constructor(e) {
this.type = tt,
this.input = e
}
static parse(e, t) {
if (2 !== e.length)
return t.error(`Expected 1 argument, but found ${e.length - 1} instead.`);
const i = t.parse(e[1], 1);
return i ? "array" !== i.type.kind && "string" !== i.type.kind && "value" !== i.type.kind ? t.error(`Expected argument of type string or array, but found ${ht(i.type)} instead.`) : new fr(i) : null
}
evaluate(e) {
const t = this.input.evaluate(e);
if ("string" == typeof t)
return t.length;
if (Array.isArray(t))
return t.length;
throw new zt(`Expected value to be of type string or array, but found ${ht(Ct(t))} instead.`)
}
eachChild(e) {
e(this.input)
}
outputDefined() {
return !1
}
serialize() {
const e = ["length"];
return this.eachChild((t=>{
e.push(t.serialize())
}
)),
e
}
}
const mr = {
"==": ar,
"!=": lr,
">": ur,
"<": cr,
">=": dr,
"<=": hr,
array: Dt,
at: Wi,
boolean: Dt,
case: tr,
coalesce: Gi,
collator: Gt,
format: Lt,
image: Bt,
in: Hi,
"index-of": Ki,
interpolate: ji,
"interpolate-hcl": ji,
"interpolate-lab": ji,
length: fr,
let: qi,
literal: It,
match: Qi,
number: Dt,
"number-format": pr,
object: Dt,
slice: rr,
step: yi,
string: Dt,
"to-boolean": Ft,
"to-color": Ft,
"to-number": Ft,
"to-string": Ft,
var: di,
within: ai
};
function _r(e, [t,i,r,n]) {
t = t.evaluate(e),
i = i.evaluate(e),
r = r.evaluate(e);
const o = n ? n.evaluate(e) : 1
, s = Et(t, i, r, o);
if (s)
throw new zt(s);
return new xt(t / 255 * o,i / 255 * o,r / 255 * o,o)
}
function gr(e, t) {
return e in t
}
function yr(e, t) {
const i = t[e];
return void 0 === i ? null : i
}
function xr(e) {
return {
type: e
}
}
Nt.register(mr, {
error: [{
kind: "error"
}, [it], (e,[t])=>{
throw new zt(t.evaluate(e))
}
],
typeof: [it, [st], (e,[t])=>ht(Ct(t.evaluate(e)))],
"to-rgba": [ut(tt, 4), [nt], (e,[t])=>t.evaluate(e).toArray()],
rgb: [nt, [tt, tt, tt], _r],
rgba: [nt, [tt, tt, tt, tt], _r],
has: {
type: rt,
overloads: [[[it], (e,[t])=>gr(t.evaluate(e), e.properties())], [[it, ot], (e,[t,i])=>gr(t.evaluate(e), i.evaluate(e))]]
},
get: {
type: st,
overloads: [[[it], (e,[t])=>yr(t.evaluate(e), e.properties())], [[it, ot], (e,[t,i])=>yr(t.evaluate(e), i.evaluate(e))]]
},
"feature-state": [st, [it], (e,[t])=>yr(t.evaluate(e), e.featureState || {})],
properties: [ot, [], e=>e.properties()],
"geometry-type": [it, [], e=>e.geometryType()],
id: [st, [], e=>e.id()],
zoom: [tt, [], e=>e.globals.zoom],
pitch: [tt, [], e=>e.globals.pitch || 0],
"distance-from-center": [tt, [], e=>e.distanceFromCenter()],
"heatmap-density": [tt, [], e=>e.globals.heatmapDensity || 0],
"line-progress": [tt, [], e=>e.globals.lineProgress || 0],
"sky-radial-progress": [tt, [], e=>e.globals.skyRadialProgress || 0],
accumulated: [st, [], e=>void 0 === e.globals.accumulated ? null : e.globals.accumulated],
"+": [tt, xr(tt), (e,t)=>{
let i = 0;
for (const r of t)
i += r.evaluate(e);
return i
}
],
"*": [tt, xr(tt), (e,t)=>{
let i = 1;
for (const r of t)
i *= r.evaluate(e);
return i
}
],
"-": {
type: tt,
overloads: [[[tt, tt], (e,[t,i])=>t.evaluate(e) - i.evaluate(e)], [[tt], (e,[t])=>-t.evaluate(e)]]
},
"/": [tt, [tt, tt], (e,[t,i])=>t.evaluate(e) / i.evaluate(e)],
"%": [tt, [tt, tt], (e,[t,i])=>t.evaluate(e) % i.evaluate(e)],
ln2: [tt, [], ()=>Math.LN2],
pi: [tt, [], ()=>Math.PI],
e: [tt, [], ()=>Math.E],
"^": [tt, [tt, tt], (e,[t,i])=>Math.pow(t.evaluate(e), i.evaluate(e))],
sqrt: [tt, [tt], (e,[t])=>Math.sqrt(t.evaluate(e))],
log10: [tt, [tt], (e,[t])=>Math.log(t.evaluate(e)) / Math.LN10],
ln: [tt, [tt], (e,[t])=>Math.log(t.evaluate(e))],
log2: [tt, [tt], (e,[t])=>Math.log(t.evaluate(e)) / Math.LN2],
sin: [tt, [tt], (e,[t])=>Math.sin(t.evaluate(e))],
cos: [tt, [tt], (e,[t])=>Math.cos(t.evaluate(e))],
tan: [tt, [tt], (e,[t])=>Math.tan(t.evaluate(e))],
asin: [tt, [tt], (e,[t])=>Math.asin(t.evaluate(e))],
acos: [tt, [tt], (e,[t])=>Math.acos(t.evaluate(e))],
atan: [tt, [tt], (e,[t])=>Math.atan(t.evaluate(e))],
min: [tt, xr(tt), (e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],
max: [tt, xr(tt), (e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],
abs: [tt, [tt], (e,[t])=>Math.abs(t.evaluate(e))],
round: [tt, [tt], (e,[t])=>{
const i = t.evaluate(e);
return i < 0 ? -Math.round(-i) : Math.round(i)
}
],
floor: [tt, [tt], (e,[t])=>Math.floor(t.evaluate(e))],
ceil: [tt, [tt], (e,[t])=>Math.ceil(t.evaluate(e))],
"filter-==": [rt, [it, st], (e,[t,i])=>e.properties()[t.value] === i.value],
"filter-id-==": [rt, [st], (e,[t])=>e.id() === t.value],
"filter-type-==": [rt, [it], (e,[t])=>e.geometryType() === t.value],
"filter-<": [rt, [it, st], (e,[t,i])=>{
const r = e.properties()[t.value]
, n = i.value;
return typeof r == typeof n && r < n
}
],
"filter-id-<": [rt, [st], (e,[t])=>{
const i = e.id()
, r = t.value;
return typeof i == typeof r && i < r
}
],
"filter->": [rt, [it, st], (e,[t,i])=>{
const r = e.properties()[t.value]
, n = i.value;
return typeof r == typeof n && r > n
}
],
"filter-id->": [rt, [st], (e,[t])=>{
const i = e.id()
, r = t.value;
return typeof i == typeof r && i > r
}
],
"filter-<=": [rt, [it, st], (e,[t,i])=>{
const r = e.properties()[t.value]
, n = i.value;
return typeof r == typeof n && r <= n
}
],
"filter-id-<=": [rt, [st], (e,[t])=>{
const i = e.id()
, r = t.value;
return typeof i == typeof r && i <= r
}
],
"filter->=": [rt, [it, st], (e,[t,i])=>{
const r = e.properties()[t.value]
, n = i.value;
return typeof r == typeof n && r >= n
}
],
"filter-id->=": [rt, [st], (e,[t])=>{
const i = e.id()
, r = t.value;
return typeof i == typeof r && i >= r
}
],
"filter-has": [rt, [st], (e,[t])=>t.value in e.properties()],
"filter-has-id": [rt, [], e=>null !== e.id() && void 0 !== e.id()],
"filter-type-in": [rt, [ut(it)], (e,[t])=>t.value.indexOf(e.geometryType()) >= 0],
"filter-id-in": [rt, [ut(st)], (e,[t])=>t.value.indexOf(e.id()) >= 0],
"filter-in-small": [rt, [it, ut(st)], (e,[t,i])=>i.value.indexOf(e.properties()[t.value]) >= 0],
"filter-in-large": [rt, [it, ut(st)], (e,[t,i])=>function(e, t, i, r) {
for (; i <= r; ) {
const n = i + r >> 1;
if (t[n] === e)
return !0;
t[n] > e ? r = n - 1 : i = n + 1
}
return !1
}(e.properties()[t.value], i.value, 0, i.value.length - 1)],
all: {
type: rt,
overloads: [[[rt, rt], (e,[t,i])=>t.evaluate(e) && i.evaluate(e)], [xr(rt), (e,t)=>{
for (const i of t)
if (!i.evaluate(e))
return !1;
return !0
}
]]
},
any: {
type: rt,
overloads: [[[rt, rt], (e,[t,i])=>t.evaluate(e) || i.evaluate(e)], [xr(rt), (e,t)=>{
for (const i of t)
if (i.evaluate(e))
return !0;
return !1
}
]]
},
"!": [rt, [rt], (e,[t])=>!t.evaluate(e)],
"is-supported-script": [rt, [it], (e,[t])=>{
const i = e.globals && e.globals.isSupportedScript;
return !i || i(t.evaluate(e))
}
],
upcase: [it, [it], (e,[t])=>t.evaluate(e).toUpperCase()],
downcase: [it, [it], (e,[t])=>t.evaluate(e).toLowerCase()],
concat: [it, xr(st), (e,t)=>t.map((t=>Mt(t.evaluate(e)))).join("")],
"resolved-locale": [it, [at], (e,[t])=>t.evaluate(e).resolvedLocale()]
});
var vr = mr;
function br(e) {
return {
result: "success",
value: e
}
}
function wr(e) {
return {
result: "error",
value: e
}
}
function Tr(e) {
return "data-driven" === e["property-type"] || "cross-faded-data-driven" === e["property-type"]
}
function Er(e) {
return !!e.expression && e.expression.parameters.indexOf("zoom") > -1
}
function Sr(e) {
return !!e.expression && e.expression.interpolated
}
function Cr(e) {
return e instanceof Number ? "number" : e instanceof String ? "string" : e instanceof Boolean ? "boolean" : Array.isArray(e) ? "array" : null === e ? "null" : typeof e
}
function Mr(e) {
return "object" == typeof e && null !== e && !Array.isArray(e)
}
function Ar(e) {
return e
}
function Ir(e, t) {
const i = "color" === t.type
, r = e.stops && "object" == typeof e.stops[0][0]
, n = r || !(r || void 0 !== e.property)
, o = e.type || (Sr(t) ? "exponential" : "interval");
if (i && ((e = We({}, e)).stops && (e.stops = e.stops.map((e=>[e[0], xt.parse(e[1])]))),
e.default = xt.parse(e.default ? e.default : t.default)),
e.colorSpace && "rgb" !== e.colorSpace && !Fi[e.colorSpace])
throw new Error(`Unknown color space: ${e.colorSpace}`);
let s, a, l;
if ("exponential" === o)
s = Dr;
else if ("interval" === o)
s = Pr;
else if ("categorical" === o) {
s = kr,
a = Object.create(null);
for (const t of e.stops)
a[t[0]] = t[1];
l = typeof e.stops[0][0]
} else {
if ("identity" !== o)
throw new Error(`Unknown function type "${o}"`);
s = Lr
}
if (r) {
const i = {}
, r = [];
for (let t = 0; t < e.stops.length; t++) {
const n = e.stops[t]
, o = n[0].zoom;
void 0 === i[o] && (i[o] = {
zoom: o,
type: e.type,
property: e.property,
default: e.default,
stops: []
},
r.push(o)),
i[o].stops.push([n[0].value, n[1]])
}
const n = [];
for (const e of r)
n.push([i[e].zoom, Ir(i[e], t)]);
const o = {
name: "linear"
};
return {
kind: "composite",
interpolationType: o,
interpolationFactor: ji.interpolationFactor.bind(void 0, o),
zoomStops: n.map((e=>e[0])),
evaluate: ({zoom: i},r)=>Dr({
stops: n,
base: e.base
}, t, i).evaluate(i, r)
}
}
if (n) {
const i = "exponential" === o ? {
name: "exponential",
base: void 0 !== e.base ? e.base : 1
} : null;
return {
kind: "camera",
interpolationType: i,
interpolationFactor: ji.interpolationFactor.bind(void 0, i),
zoomStops: e.stops.map((e=>e[0])),
evaluate: ({zoom: i})=>s(e, t, i, a, l)
}
}
return {
kind: "source",
evaluate(i, r) {
const n = r && r.properties ? r.properties[e.property] : void 0;
return void 0 === n ? zr(e.default, t.default) : s(e, t, n, a, l)
}
}
}
function zr(e, t, i) {
return void 0 !== e ? e : void 0 !== t ? t : void 0 !== i ? i : void 0
}
function kr(e, t, i, r, n) {
return zr(typeof i === n ? r[i] : void 0, e.default, t.default)
}
function Pr(e, t, i) {
if ("number" !== Cr(i))
return zr(e.default, t.default);
const r = e.stops.length;
if (1 === r)
return e.stops[0][1];
if (i <= e.stops[0][0])
return e.stops[0][1];
if (i >= e.stops[r - 1][0])
return e.stops[r - 1][1];
const n = _i(e.stops.map((e=>e[0])), i);
return e.stops[n][1]
}
function Dr(e, t, i) {
const r = void 0 !== e.base ? e.base : 1;
if ("number" !== Cr(i))
return zr(e.default, t.default);
const n = e.stops.length;
if (1 === n)
return e.stops[0][1];
if (i <= e.stops[0][0])
return e.stops[0][1];
if (i >= e.stops[n - 1][0])
return e.stops[n - 1][1];
const o = _i(e.stops.map((e=>e[0])), i)
, s = function(e, t, i, r) {
const n = r - i
, o = e - i;
return 0 === n ? 0 : 1 === t ? o / n : (Math.pow(t, o) - 1) / (Math.pow(t, n) - 1)
}(i, r, e.stops[o][0], e.stops[o + 1][0])
, a = e.stops[o][1]
, l = e.stops[o + 1][1];
let c = bi[t.type] || Ar;
if (e.colorSpace && "rgb" !== e.colorSpace) {
const t = Fi[e.colorSpace];
c = (e,i)=>t.reverse(t.interpolate(t.forward(e), t.forward(i), s))
}
return "function" == typeof a.evaluate ? {
evaluate(...e) {
const t = a.evaluate.apply(void 0, e)
, i = l.evaluate.apply(void 0, e);
if (void 0 !== t && void 0 !== i)
return c(t, i, s)
}
} : c(a, l, s)
}
function Lr(e, t, i) {
return "color" === t.type ? i = xt.parse(i) : "formatted" === t.type ? i = wt.fromString(i.toString()) : "resolvedImage" === t.type ? i = Tt.fromString(i.toString()) : Cr(i) === t.type || "enum" === t.type && t.values[i] || (i = void 0),
zr(i, e.default, t.default)
}
class Br {
constructor(e, t) {
this.expression = e,
this._warningHistory = {},
this._evaluator = new Vt,
this._defaultValue = t ? function(e) {
return "color" === e.type && (Mr(e.default) || Array.isArray(e.default)) ? new xt(0,0,0,0) : "color" === e.type ? xt.parse(e.default) || null : void 0 === e.default ? null : e.default
}(t) : null,
this._enumValues = t && "enum" === t.type ? t.values : null
}
evaluateWithoutErrorHandling(e, t, i, r, n, o, s, a) {
return this._evaluator.globals = e,
this._evaluator.feature = t,
this._evaluator.featureState = i,
this._evaluator.canonical = r || null,
this._evaluator.availableImages = n || null,
this._evaluator.formattedSection = o,
this._evaluator.featureTileCoord = s || null,
this._evaluator.featureDistanceData = a || null,
this.expression.evaluate(this._evaluator)
}
evaluate(e, t, i, r, n, o, s, a) {
this._evaluator.globals = e,
this._evaluator.feature = t || null,
this._evaluator.featureState = i || null,
this._evaluator.canonical = r || null,
this._evaluator.availableImages = n || null,
this._evaluator.formattedSection = o || null,
this._evaluator.featureTileCoord = s || null,
this._evaluator.featureDistanceData = a || null;
try {
const e = this.expression.evaluate(this._evaluator);
if (null == e || "number" == typeof e && e != e)
return this._defaultValue;
if (this._enumValues && !(e in this._enumValues))
throw new zt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);
return e
} catch (e) {
return this._warningHistory[e.message] || (this._warningHistory[e.message] = !0,
"undefined" != typeof console && console.warn(e.message)),
this._defaultValue
}
}
}
function Or(e) {
return Array.isArray(e) && e.length > 0 && "string" == typeof e[0] && e[0]in vr
}
function Rr(e, t) {
const i = new fi(vr,[],t ? function(e) {
const t = {
color: nt,
string: it,
number: tt,
enum: it,
boolean: rt,
formatted: lt,
resolvedImage: ct
};
return "array" === e.type ? ut(t[e.value] || st, e.length) : t[e.type]
}(t) : void 0)
, r = i.parse(e, void 0, void 0, void 0, t && "string" === t.type ? {
typeAnnotation: "coerce"
} : void 0);
return r ? br(new Br(r,t)) : wr(i.errors)
}
class Fr {
constructor(e, t) {
this.kind = e,
this._styleExpression = t,
this.isStateDependent = "constant" !== e && !ci(t.expression)
}
evaluateWithoutErrorHandling(e, t, i, r, n, o) {
return this._styleExpression.evaluateWithoutErrorHandling(e, t, i, r, n, o)
}
evaluate(e, t, i, r, n, o) {
return this._styleExpression.evaluate(e, t, i, r, n, o)
}
}
class Ur {
constructor(e, t, i, r) {
this.kind = e,
this.zoomStops = i,
this._styleExpression = t,
this.isStateDependent = "camera" !== e && !ci(t.expression),
this.interpolationType = r
}
evaluateWithoutErrorHandling(e, t, i, r, n, o) {
return this._styleExpression.evaluateWithoutErrorHandling(e, t, i, r, n, o)
}
evaluate(e, t, i, r, n, o) {
return this._styleExpression.evaluate(e, t, i, r, n, o)
}
interpolationFactor(e, t, i) {
return this.interpolationType ? ji.interpolationFactor(this.interpolationType, e, t, i) : 0
}
}
function Vr(e, t) {
if ("error" === (e = Rr(e, t)).result)
return e;
const i = e.value.expression
, r = li(i);
if (!r && !Tr(t))
return wr([new Ke("","data expressions not supported")]);
const n = ui(i, ["zoom", "pitch", "distance-from-center"]);
if (!n && !Er(t))
return wr([new Ke("","zoom expressions not supported")]);
const o = Nr(i);
return o || n ? o instanceof Ke ? wr([o]) : o instanceof ji && !Sr(t) ? wr([new Ke("",'"interpolate" expressions cannot be used with this property')]) : br(o ? new Ur(r ? "camera" : "composite",e.value,o.labels,o instanceof ji ? o.interpolation : void 0) : new Fr(r ? "constant" : "source",e.value)) : wr([new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])
}
class jr {
constructor(e, t) {
this._parameters = e,
this._specification = t,
We(this, Ir(this._parameters, this._specification))
}
static deserialize(e) {
return new jr(e._parameters,e._specification)
}
static serialize(e) {
return {
_parameters: e._parameters,
_specification: e._specification
}
}
}
function Nr(e) {
let t = null;
if (e instanceof qi)
t = Nr(e.result);
else if (e instanceof Gi) {
for (const i of e.args)
if (t = Nr(i),
t)
break
} else
(e instanceof yi || e instanceof ji) && e.input instanceof Nt && "zoom" === e.input.name && (t = e);
return t instanceof Ke || e.eachChild((e=>{
const i = Nr(e);
i instanceof Ke ? t = i : !t && i ? t = new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : t && i && t !== i && (t = new Ke("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))
}
)),
t
}
class Gr {
constructor(e, t, i, r) {
this.message = (e ? `${e}: ` : "") + i,
r && (this.identifier = r),
null != t && t.__line__ && (this.line = t.__line__)
}
}
function $r(e) {
const t = e.key
, i = e.value
, r = e.valueSpec || {}
, n = e.objectElementValidators || {}
, o = e.style
, s = e.styleSpec;
let a = [];
const l = Cr(i);
if ("object" !== l)
return [new Gr(t,i,`object expected, ${l} found`)];
for (const e in i) {
const l = e.split(".")[0]
, c = r[l] || r["*"];
let u;
n[l] ? u = n[l] : r[l] ? u = En : n["*"] ? u = n["*"] : r["*"] && (u = En),
u ? a = a.concat(u({
key: (t ? `${t}.` : t) + e,
value: i[e],
valueSpec: c,
style: o,
styleSpec: s,
object: i,
objectKey: e
}, i)) : a.push(new Gr(t,i[e],`unknown property "${e}"`))
}
for (const e in r)
n[e] || r[e].required && void 0 === r[e].default && void 0 === i[e] && a.push(new Gr(t,i,`missing required property "${e}"`));
return a
}
function qr(e) {
const t = e.value
, i = e.valueSpec
, r = e.style
, n = e.styleSpec
, o = e.key
, s = e.arrayElementValidator || En;
if ("array" !== Cr(t))
return [new Gr(o,t,`array expected, ${Cr(t)} found`)];
if (i.length && t.length !== i.length)
return [new Gr(o,t,`array length ${i.length} expected, length ${t.length} found`)];
if (i["min-length"] && t.length < i["min-length"])
return [new Gr(o,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];
let a = {
type: i.value,
values: i.values,
minimum: i.minimum,
maximum: i.maximum,
function: void 0
};
n.$version < 7 && (a.function = i.function),
"object" === Cr(i.value) && (a = i.value);
let l = [];
for (let e = 0; e < t.length; e++)
l = l.concat(s({
array: t,
arrayIndex: e,
value: t[e],
valueSpec: a,
style: r,
styleSpec: n,
key: `${o}[${e}]`
}));
return l
}
function Zr(e) {
const t = e.key
, i = e.value
, r = e.valueSpec;
let n = Cr(i);
if ("number" === n && i != i && (n = "NaN"),
"number" !== n)
return [new Gr(t,i,`number expected, ${n} found`)];
if ("minimum"in r) {
let n = r.minimum;
if ("array" === Cr(r.minimum) && (n = r.minimum[e.arrayIndex]),
i < n)
return [new Gr(t,i,`${i} is less than the minimum value ${n}`)]
}
if ("maximum"in r) {
let n = r.maximum;
if ("array" === Cr(r.maximum) && (n = r.maximum[e.arrayIndex]),
i > n)
return [new Gr(t,i,`${i} is greater than the maximum value ${n}`)]
}
return []
}
function Wr(e) {
const t = e.valueSpec
, i = Xe(e.value.type);
let r, n, o, s = {};
const a = "categorical" !== i && void 0 === e.value.property
, l = !a
, c = "array" === Cr(e.value.stops) && "array" === Cr(e.value.stops[0]) && "object" === Cr(e.value.stops[0][0])
, u = $r({
key: e.key,
value: e.value,
valueSpec: e.styleSpec.function,
style: e.style,
styleSpec: e.styleSpec,
objectElementValidators: {
stops: function(e) {
if ("identity" === i)
return [new Gr(e.key,e.value,'identity function may not have a "stops" property')];
let t = [];
const r = e.value;
return t = t.concat(qr({
key: e.key,
value: r,
valueSpec: e.valueSpec,
style: e.style,
styleSpec: e.styleSpec,
arrayElementValidator: h
})),
"array" === Cr(r) && 0 === r.length && t.push(new Gr(e.key,r,"array must have at least one stop")),
t
},
default: function(e) {
return En({
key: e.key,
value: e.value,
valueSpec: t,
style: e.style,
styleSpec: e.styleSpec
})
}
}
});
return "identity" === i && a && u.push(new Gr(e.key,e.value,'missing required property "property"')),
"identity" === i || e.value.stops || u.push(new Gr(e.key,e.value,'missing required property "stops"')),
"exponential" === i && e.valueSpec.expression && !Sr(e.valueSpec) && u.push(new Gr(e.key,e.value,"exponential functions not supported")),
e.styleSpec.$version >= 8 && (l && !Tr(e.valueSpec) ? u.push(new Gr(e.key,e.value,"property functions not supported")) : a && !Er(e.valueSpec) && u.push(new Gr(e.key,e.value,"zoom functions not supported"))),
"categorical" !== i && !c || void 0 !== e.value.property || u.push(new Gr(e.key,e.value,'"property" property is required')),
u;
function h(e) {
let i = [];
const r = e.value
, a = e.key;
if ("array" !== Cr(r))
return [new Gr(a,r,`array expected, ${Cr(r)} found`)];
if (2 !== r.length)
return [new Gr(a,r,`array length 2 expected, length ${r.length} found`)];
if (c) {
if ("object" !== Cr(r[0]))
return [new Gr(a,r,`object expected, ${Cr(r[0])} found`)];
if (void 0 === r[0].zoom)
return [new Gr(a,r,"object stop key must have zoom")];
if (void 0 === r[0].value)
return [new Gr(a,r,"object stop key must have value")];
const t = Xe(r[0].zoom);
if ("number" != typeof t)
return [new Gr(a,r[0].zoom,"stop zoom values must be numbers")];
if (o && o > t)
return [new Gr(a,r[0].zoom,"stop zoom values must appear in ascending order")];
t !== o && (o = t,
n = void 0,
s = {}),
i = i.concat($r({
key: `${a}[0]`,
value: r[0],
valueSpec: {
zoom: {}
},
style: e.style,
styleSpec: e.styleSpec,
objectElementValidators: {
zoom: Zr,
value: d
}
}))
} else
i = i.concat(d({
key: `${a}[0]`,
value: r[0],
valueSpec: {},
style: e.style,
styleSpec: e.styleSpec
}, r));
return Or(He(r[1])) ? i.concat([new Gr(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]) : i.concat(En({
key: `${a}[1]`,
value: r[1],
valueSpec: t,
style: e.style,
styleSpec: e.styleSpec
}))
}
function d(e, o) {
const a = Cr(e.value)
, l = Xe(e.value)
, c = null !== e.value ? e.value : o;
if (r) {
if (a !== r)
return [new Gr(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]
} else
r = a;
if ("number" !== a && "string" !== a && "boolean" !== a && "number" != typeof l && "string" != typeof l && "boolean" != typeof l)
return [new Gr(e.key,c,"stop domain value must be a number, string, or boolean")];
if ("number" !== a && "categorical" !== i) {
let r = `number expected, ${a} found`;
return Tr(t) && void 0 === i && (r += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),
[new Gr(e.key,c,r)]
}
return "categorical" !== i || "number" !== a || "number" == typeof l && isFinite(l) && Math.floor(l) === l ? "categorical" !== i && "number" === a && "number" == typeof l && "number" == typeof n && void 0 !== n && l < n ? [new Gr(e.key,c,"stop domain values must appear in ascending order")] : (n = l,
"categorical" === i && l in s ? [new Gr(e.key,c,"stop domain values must be unique")] : (s[l] = !0,
[])) : [new Gr(e.key,c,`integer expected, found ${String(l)}`)]
}
}
function Xr(e) {
const t = ("property" === e.expressionContext ? Vr : Rr)(He(e.value), e.valueSpec);
if ("error" === t.result)
return t.value.map((t=>new Gr(`${e.key}${t.key}`,e.value,t.message)));
const i = t.value.expression || t.value._styleExpression.expression;
if ("property" === e.expressionContext && "text-font" === e.propertyKey && !i.outputDefined())
return [new Gr(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];
if ("property" === e.expressionContext && "layout" === e.propertyType && !ci(i))
return [new Gr(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];
if ("filter" === e.expressionContext)
return Hr(i, e);
if (e.expressionContext && 0 === e.expressionContext.indexOf("cluster")) {
if (!ui(i, ["zoom", "feature-state"]))
return [new Gr(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];
if ("cluster-initial" === e.expressionContext && !li(i))
return [new Gr(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]
}
return []
}
function Hr(e, t) {
const i = new Set(["zoom", "feature-state", "pitch", "distance-from-center"]);
if (t.valueSpec && t.valueSpec.expression)
for (const e of t.valueSpec.expression.parameters)
i.delete(e);
if (0 === i.size)
return [];
const r = [];
return e instanceof Nt && i.has(e.name) ? [new Gr(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)] : (e.eachChild((e=>{
r.push(...Hr(e, t))
}
)),
r)
}
function Yr(e) {
const t = e.key
, i = e.value
, r = e.valueSpec
, n = [];
return Array.isArray(r.values) ? -1 === r.values.indexOf(Xe(i)) && n.push(new Gr(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)) : -1 === Object.keys(r.values).indexOf(Xe(i)) && n.push(new Gr(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),
n
}
function Kr(e) {
if (!0 === e || !1 === e)
return !0;
if (!Array.isArray(e) || 0 === e.length)
return !1;
switch (e[0]) {
case "has":
return e.length >= 2 && "$id" !== e[1] && "$type" !== e[1];
case "in":
return e.length >= 3 && ("string" != typeof e[1] || Array.isArray(e[2]));
case "!in":
case "!has":
case "none":
return !1;
case "==":
case "!=":
case ">":
case ">=":
case "<":
case "<=":
return 3 !== e.length || Array.isArray(e[1]) || Array.isArray(e[2]);
case "any":
case "all":
for (const t of e.slice(1))
if (!Kr(t) && "boolean" != typeof t)
return !1;
return !0;
default:
return !0
}
}
function Jr(e, t="fill") {
if (null == e)
return {
filter: ()=>!0,
needGeometry: !1,
needFeature: !1
};
Kr(e) || (e = sn(e));
const i = e;
let r = !0;
try {
r = function(e) {
if (!tn(e))
return e;
let t = He(e);
return en(t),
t = Qr(t),
t
}(i)
} catch (e) {
console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n ${JSON.stringify(i, null, 2)}\n `)
}
const n = Ze[`filter_ ${t}`]
, o = Rr(r, n);
let s = null;
if ("error" === o.result)
throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));
s = (e,t,i)=>o.value.evaluate(e, t, {}, i);
let a = null
, l = null;
if (r !== i) {
const e = Rr(i, n);
if ("error" === e.result)
throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));
a = (t,i,r,n,o)=>e.value.evaluate(t, i, {}, r, void 0, void 0, n, o),
l = !li(e.value.expression)
}
return {
filter: s,
dynamicFilter: a || void 0,
needGeometry: on(r),
needFeature: !!l
}
}
function Qr(e) {
if (!Array.isArray(e))
return e;
const t = function(e) {
if (rn.has(e[0]))
for (let t = 1; t < e.length; t++)
if (tn(e[t]))
return !0;
return e
}(e);
return !0 === t ? t : t.map((e=>Qr(e)))
}
function en(e) {
let t = !1;
const i = [];
if ("case" === e[0]) {
for (let r = 1; r < e.length - 1; r += 2)
t = t || tn(e[r]),
i.push(e[r + 1]);
i.push(e[e.length - 1])
} else if ("match" === e[0]) {
t = t || tn(e[1]);
for (let t = 2; t < e.length - 1; t += 2)
i.push(e[t + 1]);
i.push(e[e.length - 1])
} else if ("step" === e[0]) {
t = t || tn(e[1]);
for (let t = 1; t < e.length - 1; t += 2)
i.push(e[t + 1])
}
t && (e.length = 0,
e.push("any", ...i));
for (let t = 1; t < e.length; t++)
en(e[t])
}
function tn(e) {
if (!Array.isArray(e))
return !1;
if ("pitch" === (t = e[0]) || "distance-from-center" === t)
return !0;
var t;
for (let t = 1; t < e.length; t++)
if (tn(e[t]))
return !0;
return !1
}
const rn = new Set(["in", "==", "!=", ">", ">=", "<", "<=", "to-boolean"]);
function nn(e, t) {
return e < t ? -1 : e > t ? 1 : 0
}
function on(e) {
if (!Array.isArray(e))
return !1;
if ("within" === e[0])
return !0;
for (let t = 1; t < e.length; t++)
if (on(e[t]))
return !0;
return !1
}
function sn(e) {
if (!e)
return !0;
const t = e[0];
return e.length <= 1 ? "any" !== t : "==" === t ? an(e[1], e[2], "==") : "!=" === t ? un(an(e[1], e[2], "==")) : "<" === t || ">" === t || "<=" === t || ">=" === t ? an(e[1], e[2], t) : "any" === t ? (i = e.slice(1),
["any"].concat(i.map(sn))) : "all" === t ? ["all"].concat(e.slice(1).map(sn)) : "none" === t ? ["all"].concat(e.slice(1).map(sn).map(un)) : "in" === t ? ln(e[1], e.slice(2)) : "!in" === t ? un(ln(e[1], e.slice(2))) : "has" === t ? cn(e[1]) : "!has" === t ? un(cn(e[1])) : "within" !== t || e;
var i
}
function an(e, t, i) {
switch (e) {
case "$type":
return [`filter-type-${i}`, t];
case "$id":
return [`filter-id-${i}`, t];
default:
return [`filter-${i}`, e, t]
}
}
function ln(e, t) {
if (0 === t.length)
return !1;
switch (e) {
case "$type":
return ["filter-type-in", ["literal", t]];
case "$id":
return ["filter-id-in", ["literal", t]];
default:
return t.length > 200 && !t.some((e=>typeof e != typeof t[0])) ? ["filter-in-large", e, ["literal", t.sort(nn)]] : ["filter-in-small", e, ["literal", t]]
}
}
function cn(e) {
switch (e) {
case "$type":
return !0;
case "$id":
return ["filter-has-id"];
default:
return ["filter-has", e]
}
}
function un(e) {
return ["!", e]
}
function hn(e) {
return Kr(He(e.value)) ? Xr(We({}, e, {
expressionContext: "filter",
valueSpec: e.styleSpec[`filter_ ${e.layerType || "fill"}`]
})) : dn(e)
}
function dn(e) {
const t = e.value
, i = e.key;
if ("array" !== Cr(t))
return [new Gr(i,t,`array expected, ${Cr(t)} found`)];
const r = e.styleSpec;
let n, o = [];
if (t.length < 1)
return [new Gr(i,t,"filter array must have at least 1 element")];
switch (o = o.concat(Yr({
key: `${i}[0]`,
value: t[0],
valueSpec: r.filter_operator,
style: e.style,
styleSpec: e.styleSpec
})),
Xe(t[0])) {
case "<":
case "<=":
case ">":
case ">=":
t.length >= 2 && "$type" === Xe(t[1]) && o.push(new Gr(i,t,`"$type" cannot be use with operator "${t[0]}"`));
case "==":
case "!=":
3 !== t.length && o.push(new Gr(i,t,`filter array for operator "${t[0]}" must have 3 elements`));
case "in":
case "!in":
t.length >= 2 && (n = Cr(t[1]),
"string" !== n && o.push(new Gr(`${i}[1]`,t[1],`string expected, ${n} found`)));
for (let s = 2; s < t.length; s++)
n = Cr(t[s]),
"$type" === Xe(t[1]) ? o = o.concat(Yr({
key: `${i}[${s}]`,
value: t[s],
valueSpec: r.geometry_type,
style: e.style,
styleSpec: e.styleSpec
})) : "string" !== n && "number" !== n && "boolean" !== n && o.push(new Gr(`${i}[${s}]`,t[s],`string, number, or boolean expected, ${n} found`));
break;
case "any":
case "all":
case "none":
for (let r = 1; r < t.length; r++)
o = o.concat(dn({
key: `${i}[${r}]`,
value: t[r],
style: e.style,
styleSpec: e.styleSpec
}));
break;
case "has":
case "!has":
n = Cr(t[1]),
2 !== t.length ? o.push(new Gr(i,t,`filter array for "${t[0]}" operator must have 2 elements`)) : "string" !== n && o.push(new Gr(`${i}[1]`,t[1],`string expected, ${n} found`));
break;
case "within":
n = Cr(t[1]),
2 !== t.length ? o.push(new Gr(i,t,`filter array for "${t[0]}" operator must have 2 elements`)) : "object" !== n && o.push(new Gr(`${i}[1]`,t[1],`object expected, ${n} found`))
}
return o
}
function pn(e, t) {
const i = e.key
, r = e.style
, n = e.styleSpec
, o = e.value
, s = e.objectKey
, a = n[`${t}_ ${e.layerType}`];
if (!a)
return [];
const l = s.match(/^(.*)-transition$/);
if ("paint" === t && l && a[l[1]] && a[l[1]].transition)
return En({
key: i,
value: o,
valueSpec: n.transition,
style: r,
styleSpec: n
});
const c = e.valueSpec || a[s];
if (!c)
return [new Gr(i,o,`unknown property "${s}"`)];
let u;
if ("string" === Cr(o) && Tr(c) && !c.tokens && (u = /^{([^}]+)}$/.exec(o)))
return [new Gr(i,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(u[1])} }\`.`)];
const h = [];
return "symbol" === e.layerType && ("text-field" === s && r && !r.glyphs && h.push(new Gr(i,o,'use of "text-field" requires a style "glyphs" property')),
"text-font" === s && Mr(He(o)) && "identity" === Xe(o.type) && h.push(new Gr(i,o,'"text-font" does not support identity functions'))),
h.concat(En({
key: e.key,
value: o,
valueSpec: c,
style: r,
styleSpec: n,
expressionContext: "property",
propertyType: t,
propertyKey: s
}))
}
function fn(e) {
return pn(e, "paint")
}
function mn(e) {
return pn(e, "layout")
}
function _n(e) {
let t = [];
const i = e.value
, r = e.key
, n = e.style
, o = e.styleSpec;
i.type || i.ref || t.push(new Gr(r,i,'either "type" or "ref" is required'));
let s = Xe(i.type);
const a = Xe(i.ref);
if (i.id) {
const o = Xe(i.id);
for (let s = 0; s < e.arrayIndex; s++) {
const e = n.layers[s];
Xe(e.id) === o && t.push(new Gr(r,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))
}
}
if ("ref"in i) {
let e;
["type", "source", "source-layer", "filter", "layout"].forEach((e=>{
e in i && t.push(new Gr(r,i[e],`"${e}" is prohibited for ref layers`))
}
)),
n.layers.forEach((t=>{
Xe(t.id) === a && (e = t)
}
)),
e ? e.ref ? t.push(new Gr(r,i.ref,"ref cannot reference another ref layer")) : s = Xe(e.type) : "string" == typeof a && t.push(new Gr(r,i.ref,`ref layer "${a}" not found`))
} else if ("background" !== s && "sky" !== s)
if (i.source) {
const e = n.sources && n.sources[i.source]
, o = e && Xe(e.type);
e ? "vector" === o && "raster" === s ? t.push(new Gr(r,i.source,`layer "${i.id}" requires a raster source`)) : "raster" === o && "raster" !== s ? t.push(new Gr(r,i.source,`layer "${i.id}" requires a vector source`)) : "vector" !== o || i["source-layer"] ? "raster-dem" === o && "hillshade" !== s ? t.push(new Gr(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")) : "line" !== s || !i.paint || !i.paint["line-gradient"] && !i.paint["line-trim-offset"] || "geojson" === o && e.lineMetrics || t.push(new Gr(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)) : t.push(new Gr(r,i,`layer "${i.id}" must specify a "source-layer"`)) : t.push(new Gr(r,i.source,`source "${i.source}" not found`))
} else
t.push(new Gr(r,i,'missing required property "source"'));
return t = t.concat($r({
key: r,
value: i,
valueSpec: o.layer,
style: e.style,
styleSpec: e.styleSpec,
objectElementValidators: {
"*": ()=>[],
type: ()=>En({
key: `${r}.type`,
value: i.type,
valueSpec: o.layer.type,
style: e.style,
styleSpec: e.styleSpec,
object: i,
objectKey: "type"
}),
filter: e=>hn(We({
layerType: s
}, e)),
layout: e=>$r({
layer: i,
key: e.key,
value: e.value,
valueSpec: {},
style: e.style,
styleSpec: e.styleSpec,
objectElementValidators: {
"*": e=>mn(We({
layerType: s
}, e))
}
}),
paint: e=>$r({
layer: i,
key: e.key,
value: e.value,
valueSpec: {},
style: e.style,
styleSpec: e.styleSpec,
objectElementValidators: {
"*": e=>fn(We({
layerType: s
}, e))
}
})
}
})),
t
}
function gn(e) {
const t = e.value
, i = e.key
, r = Cr(t);
return "string" !== r ? [new Gr(i,t,`string expected, ${r} found`)] : []
}
const yn = {
promoteId: function({key: e, value: t}) {
if ("string" === Cr(t))
return gn({
key: e,
value: t
});
{
const i = [];
for (const r in t)
i.push(...gn({
key: `${e}.${r}`,
value: t[r]
}));
return i
}
}
};
function xn(e) {
const t = e.value
, i = e.key
, r = e.styleSpec
, n = e.style;
if (!t.type)
return [new Gr(i,t,'"type" is required')];
const o = Xe(t.type);
let s;
switch (o) {
case "vector":
case "raster":
case "raster-dem":
return s = $r({
key: i,
value: t,
valueSpec: r[`source_ ${o.replace("-", "_")}`],
style: e.style,
styleSpec: r,
objectElementValidators: yn
}),
s;
case "geojson":
if (s = $r({
key: i,
value: t,
valueSpec: r.source_geojson,
style: n,
styleSpec: r,
objectElementValidators: yn
}),
t.cluster)
for (const e in t.clusterProperties) {
const [r,n] = t.clusterProperties[e]
, o = "string" == typeof r ? [r, ["accumulated"], ["get", e]] : r;
s.push(...Xr({
key: `${i}.${e}.map`,
value: n,
expressionContext: "cluster-map"
})),
s.push(...Xr({
key: `${i}.${e}.reduce`,
value: o,
expressionContext: "cluster-reduce"
}))
}
return s;
case "video":
return $r({
key: i,
value: t,
valueSpec: r.source_video,
style: n,
styleSpec: r
});
case "image":
return $r({
key: i,
value: t,
valueSpec: r.source_image,
style: n,
styleSpec: r
});
case "canvas":
return [new Gr(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];
default:
return Yr({
key: `${i}.type`,
value: t.type,
valueSpec: {
values: ["vector", "raster", "raster-dem", "geojson", "video", "image"]
},
style: n,
styleSpec: r
})
}
}
function vn(e) {
const t = e.value
, i = e.styleSpec
, r = i.light
, n = e.style;
let o = [];
const s = Cr(t);
if (void 0 === t)
return o;
if ("object" !== s)
return o = o.concat([new Gr("light",t,`object expected, ${s} found`)]),
o;
for (const e in t) {
const s = e.match(/^(.*)-transition$/);
o = o.concat(s && r[s[1]] && r[s[1]].transition ? En({
key: e,
value: t[e],
valueSpec: i.transition,
style: n,
styleSpec: i
}) : r[e] ? En({
key: e,
value: t[e],
valueSpec: r[e],
style: n,
styleSpec: i
}) : [new Gr(e,t[e],`unknown property "${e}"`)])
}
return o
}
function bn(e) {
const t = e.value
, i = e.key
, r = e.style
, n = e.styleSpec
, o = n.terrain;
let s = [];
const a = Cr(t);
if (void 0 === t)
return s;
if ("object" !== a)
return s = s.concat([new Gr("terrain",t,`object expected, ${a} found`)]),
s;
for (const e in t) {
const i = e.match(/^(.*)-transition$/);
s = s.concat(i && o[i[1]] && o[i[1]].transition ? En({
key: e,
value: t[e],
valueSpec: n.transition,
style: r,
styleSpec: n
}) : o[e] ? En({
key: e,
value: t[e],
valueSpec: o[e],
style: r,
styleSpec: n
}) : [new Gr(e,t[e],`unknown property "${e}"`)])
}
if (t.source) {
const e = r.sources && r.sources[t.source]
, n = e && Xe(e.type);
e ? "raster-dem" !== n && s.push(new Gr(i,t.source,`terrain cannot be used with a source of type ${String(n)}, it only be used with a "raster-dem" source type`)) : s.push(new Gr(i,t.source,`source "${t.source}" not found`))
} else
s.push(new Gr(i,t,'terrain is missing required property "source"'));
return s
}
function wn(e) {
const t = e.value
, i = e.style
, r = e.styleSpec
, n = r.fog;
let o = [];
const s = Cr(t);
if (void 0 === t)
return o;
if ("object" !== s)
return o = o.concat([new Gr("fog",t,`object expected, ${s} found`)]),
o;
for (const e in t) {
const s = e.match(/^(.*)-transition$/);
o = o.concat(s && n[s[1]] && n[s[1]].transition ? En({
key: e,
value: t[e],
valueSpec: r.transition,
style: i,
styleSpec: r
}) : n[e] ? En({
key: e,
value: t[e],
valueSpec: n[e],
style: i,
styleSpec: r
}) : [new Gr(e,t[e],`unknown property "${e}"`)])
}
return o
}
const Tn = {
"*": ()=>[],
array: qr,
boolean: function(e) {
const t = e.value
, i = e.key
, r = Cr(t);
return "boolean" !== r ? [new Gr(i,t,`boolean expected, ${r} found`)] : []
},
number: Zr,
color: function(e) {
const t = e.key
, i = e.value
, r = Cr(i);
return "string" !== r ? [new Gr(t,i,`color expected, ${r} found`)] : null === gt.parseCSSColor(i) ? [new Gr(t,i,`color expected, "${i}" found`)] : []
},
enum: Yr,
filter: hn,
function: Wr,
layer: _n,
object: $r,
source: xn,
light: vn,
terrain: bn,
fog: wn,
string: gn,
formatted: function(e) {
return 0 === gn(e).length ? [] : Xr(e)
},
resolvedImage: function(e) {
return 0 === gn(e).length ? [] : Xr(e)
},
projection: function(e) {
const t = e.value
, i = e.styleSpec
, r = i.projection
, n = e.style;
let o = [];
const s = Cr(t);
if ("object" === s)
for (const e in t)
o = o.concat(En({
key: e,
value: t[e],
valueSpec: r[e],
style: n,
styleSpec: i
}));
else
"string" !== s && (o = o.concat([new Gr("projection",t,`object or string expected, ${s} found`)]));
return o
}
};
function En(e) {
const t = e.value
, i = e.valueSpec
, r = e.styleSpec;
return i.expression && Mr(Xe(t)) ? Wr(e) : i.expression && Or(He(t)) ? Xr(e) : i.type && Tn[i.type] ? Tn[i.type](e) : $r(We({}, e, {
valueSpec: i.type ? r[i.type] : i
}))
}
function Sn(e) {
const t = e.value
, i = e.key
, r = gn(e);
return r.length || (-1 === t.indexOf("{fontstack}") && r.push(new Gr(i,t,'"glyphs" url must include a "{fontstack}" token')),
-1 === t.indexOf("{range}") && r.push(new Gr(i,t,'"glyphs" url must include a "{range}" token'))),
r
}
function Cn(e, t=Ze) {
return In(En({
key: "",
value: e,
valueSpec: t.$root,
styleSpec: t,
style: e,
objectElementValidators: {
glyphs: Sn,
"*": ()=>[]
}
}))
}
const Mn = e=>In(fn(e))
, An = e=>In(mn(e));
function In(e) {
return e.slice().sort(((e,t)=>e.line && t.line ? e.line - t.line : 0))
}
function zn(e, t) {
let i = !1;
if (t && t.length)
for (const r of t)
e.fire(new $e(new Error(r.message))),
i = !0;
return i
}
var kn = Pn;
function Pn(e, t, i) {
var r = this.cells = [];
if (e instanceof ArrayBuffer) {
this.arrayBuffer = e;
var n = new Int32Array(this.arrayBuffer);
e = n[0],
this.d = (t = n[1]) + 2 * (i = n[2]);
for (var o = 0; o < this.d * this.d; o++) {
var s = n[3 + o]
, a = n[3 + o + 1];
r.push(s === a ? null : n.subarray(s, a))
}
var l = n[3 + r.length + 1];
this.keys = n.subarray(n[3 + r.length], l),
this.bboxes = n.subarray(l),
this.insert = this._insertReadonly
} else {
this.d = t + 2 * i;
for (var c = 0; c < this.d * this.d; c++)
r.push([]);
this.keys = [],
this.bboxes = []
}
this.n = t,
this.extent = e,
this.padding = i,
this.scale = t / e,
this.uid = 0;
var u = i / t * e;
this.min = -u,
this.max = e + u
}
Pn.prototype.insert = function(e, t, i, r, n) {
this._forEachCell(t, i, r, n, this._insertCell, this.uid++),
this.keys.push(e),
this.bboxes.push(t),
this.bboxes.push(i),
this.bboxes.push(r),
this.bboxes.push(n)
}
,
Pn.prototype._insertReadonly = function() {
throw "Cannot insert into a GridIndex created from an ArrayBuffer."
}
,
Pn.prototype._insertCell = function(e, t, i, r, n, o) {
this.cells[n].push(o)
}
,
Pn.prototype.query = function(e, t, i, r, n) {
var o = this.min
, s = this.max;
if (e <= o && t <= o && s <= i && s <= r && !n)
return Array.prototype.slice.call(this.keys);
var a = [];
return this._forEachCell(e, t, i, r, this._queryCell, a, {}, n),
a
}
,
Pn.prototype._queryCell = function(e, t, i, r, n, o, s, a) {
var l = this.cells[n];
if (null !== l)
for (var c = this.keys, u = this.bboxes, h = 0; h < l.length; h++) {
var d = l[h];
if (void 0 === s[d]) {
var p = 4 * d;
(a ? a(u[p + 0], u[p + 1], u[p + 2], u[p + 3]) : e <= u[p + 2] && t <= u[p + 3] && i >= u[p + 0] && r >= u[p + 1]) ? (s[d] = !0,
o.push(c[d])) : s[d] = !1
}
}
}
,
Pn.prototype._forEachCell = function(e, t, i, r, n, o, s, a) {
for (var l = this._convertToCellCoord(e), c = this._convertToCellCoord(t), u = this._convertToCellCoord(i), h = this._convertToCellCoord(r), d = l; d <= u; d++)
for (var p = c; p <= h; p++) {
var f = this.d * p + d;
if ((!a || a(this._convertFromCellCoord(d), this._convertFromCellCoord(p), this._convertFromCellCoord(d + 1), this._convertFromCellCoord(p + 1))) && n.call(this, e, t, i, r, f, o, s, a))
return
}
}
,
Pn.prototype._convertFromCellCoord = function(e) {
return (e - this.padding) / this.scale
}
,
Pn.prototype._convertToCellCoord = function(e) {
return Math.max(0, Math.min(this.d - 1, Math.floor(e * this.scale) + this.padding))
}
,
Pn.prototype.toArrayBuffer = function() {
if (this.arrayBuffer)
return this.arrayBuffer;
for (var e = this.cells, t = 3 + this.cells.length + 1 + 1, i = 0, r = 0; r < this.cells.length; r++)
i += this.cells[r].length;
var n = new Int32Array(t + i + this.keys.length + this.bboxes.length);
n[0] = this.extent,
n[1] = this.n,
n[2] = this.padding;
for (var o = t, s = 0; s < e.length; s++) {
var a = e[s];
n[3 + s] = o,
n.set(a, o),
o += a.length
}
return n[3 + e.length] = o,
n.set(this.keys, o),
n[3 + e.length + 1] = o += this.keys.length,
n.set(this.bboxes, o),
o += this.bboxes.length,
n.buffer
}
;
const Dn = {};
function Ln(e, t, i={}) {
Object.defineProperty(e, "_classRegistryKey", {
value: t,
writeable: !1
}),
Dn[t] = {
klass: e,
omit: i.omit || []
}
}
Ln(Object, "Object"),
kn.serialize = function(e, t) {
const i = e.toArrayBuffer();
return t && t.push(i),
{
buffer: i
}
}
,
kn.deserialize = function(e) {
return new kn(e.buffer)
}
,
Object.defineProperty(kn, "name", {
value: "Grid"
}),
Ln(kn, "Grid"),
Ln(xt, "Color"),
Ln(Error, "Error"),
Ln(ze, "AJAXError"),
Ln(Tt, "ResolvedImage"),
Ln(jr, "StylePropertyFunction"),
Ln(Br, "StyleExpression", {
omit: ["_evaluator"]
}),
Ln(Ur, "ZoomDependentExpression"),
Ln(Fr, "ZoomConstantExpression"),
Ln(Nt, "CompoundExpression", {
omit: ["_evaluate"]
});
for (const e in vr)
Dn[vr[e]._classRegistryKey] || Ln(vr[e], `Expression ${e}`);
function Bn(e) {
return e && "undefined" != typeof ArrayBuffer && (e instanceof ArrayBuffer || e.constructor && "ArrayBuffer" === e.constructor.name)
}
function On(e) {
return t.ImageBitmap && e instanceof t.ImageBitmap
}
function Rn(e, i) {
if (null == e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || e instanceof Boolean || e instanceof Number || e instanceof String || e instanceof Date || e instanceof RegExp)
return e;
if (Bn(e) || On(e))
return i && i.push(e),
e;
if (ArrayBuffer.isView(e)) {
const t = e;
return i && i.push(t.buffer),
t
}
if (e instanceof t.ImageData)
return i && i.push(e.data.buffer),
e;
if (Array.isArray(e)) {
const t = [];
for (const r of e)
t.push(Rn(r, i));
return t
}
if ("object" == typeof e) {
const t = e.constructor
, r = t._classRegistryKey;
if (!r)
throw new Error(`can't serialize object of unregistered class ${r}`);
const n = t.serialize ? t.serialize(e, i) : {};
if (!t.serialize) {
for (const t in e)
e.hasOwnProperty(t) && (Dn[r].omit.indexOf(t) >= 0 || (n[t] = Rn(e[t], i)));
e instanceof Error && (n.message = e.message)
}
if (n.$name)
throw new Error("$name property is reserved for worker serialization logic.");
return "Object" !== r && (n.$name = r),
n
}
throw new Error("can't serialize object of type " + typeof e)
}
function Fn(e) {
if (null == e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || e instanceof Boolean || e instanceof Number || e instanceof String || e instanceof Date || e instanceof RegExp || Bn(e) || On(e) || ArrayBuffer.isView(e) || e instanceof t.ImageData)
return e;
if (Array.isArray(e))
return e.map(Fn);
if ("object" == typeof e) {
const t = e.$name || "Object"
, {klass: i} = Dn[t];
if (!i)
throw new Error(`can't deserialize unregistered class ${t}`);
if (i.deserialize)
return i.deserialize(e);
const r = Object.create(i.prototype);
for (const t of Object.keys(e))
"$name" !== t && (r[t] = Fn(e[t]));
return r
}
throw new Error("can't deserialize object of type " + typeof e)
}
class Un {
constructor() {
this.first = !0
}
update(e, t) {
const i = Math.floor(e);
return this.first ? (this.first = !1,
this.lastIntegerZoom = i,
this.lastIntegerZoomTime = 0,
this.lastZoom = e,
this.lastFloorZoom = i,
!0) : (this.lastFloorZoom > i ? (this.lastIntegerZoom = i + 1,
this.lastIntegerZoomTime = t) : this.lastFloorZoom < i && (this.lastIntegerZoom = i,
this.lastIntegerZoomTime = t),
e !== this.lastZoom && (this.lastZoom = e,
this.lastFloorZoom = i,
!0))
}
}
const Vn = e=>e >= 1536 && e <= 1791
, jn = e=>e >= 1872 && e <= 1919
, Nn = e=>e >= 2208 && e <= 2303
, Gn = e=>e >= 11904 && e <= 12031
, $n = e=>e >= 12032 && e <= 12255
, qn = e=>e >= 12272 && e <= 12287
, Zn = e=>e >= 12288 && e <= 12351
, Wn = e=>e >= 12352 && e <= 12447
, Xn = e=>e >= 12448 && e <= 12543
, Hn = e=>e >= 12544 && e <= 12591
, Yn = e=>e >= 12704 && e <= 12735
, Kn = e=>e >= 12736 && e <= 12783
, Jn = e=>e >= 12784 && e <= 12799
, Qn = e=>e >= 12800 && e <= 13055
, eo = e=>e >= 13056 && e <= 13311
, to = e=>e >= 13312 && e <= 19903
, io = e=>e >= 19968 && e <= 40959
, ro = e=>e >= 40960 && e <= 42127
, no = e=>e >= 42128 && e <= 42191
, oo = e=>e >= 44032 && e <= 55215
, so = e=>e >= 63744 && e <= 64255
, ao = e=>e >= 64336 && e <= 65023
, lo = e=>e >= 65040 && e <= 65055
, co = e=>e >= 65072 && e <= 65103
, uo = e=>e >= 65104 && e <= 65135
, ho = e=>e >= 65136 && e <= 65279
, po = e=>e >= 65280 && e <= 65519;
function fo(e) {
for (const t of e)
if (go(t.charCodeAt(0)))
return !0;
return !1
}
function mo(e) {
for (const t of e)
if (!_o(t.charCodeAt(0)))
return !1;
return !0
}
function _o(e) {
return !(Vn(e) || jn(e) || Nn(e) || ao(e) || ho(e))
}
function go(e) {
return !(746 !== e && 747 !== e && (e < 4352 || !(Yn(e) || Hn(e) || co(e) && !(e >= 65097 && e <= 65103) || so(e) || eo(e) || Gn(e) || Kn(e) || !(!Zn(e) || e >= 12296 && e <= 12305 || e >= 12308 && e <= 12319 || 12336 === e) || to(e) || io(e) || Qn(e) || (e=>e >= 12592 && e <= 12687)(e) || (e=>e >= 43360 && e <= 43391)(e) || (e=>e >= 55216 && e <= 55295)(e) || (e=>e >= 4352 && e <= 4607)(e) || oo(e) || Wn(e) || qn(e) || (e=>e >= 12688 && e <= 12703)(e) || $n(e) || Jn(e) || Xn(e) && 12540 !== e || !(!po(e) || 65288 === e || 65289 === e || 65293 === e || e >= 65306 && e <= 65310 || 65339 === e || 65341 === e || 65343 === e || e >= 65371 && e <= 65503 || 65507 === e || e >= 65512 && e <= 65519) || !(!uo(e) || e >= 65112 && e <= 65118 || e >= 65123 && e <= 65126) || (e=>e >= 5120 && e <= 5759)(e) || (e=>e >= 6320 && e <= 6399)(e) || lo(e) || (e=>e >= 19904 && e <= 19967)(e) || ro(e) || no(e))))
}
function yo(e) {
return !(go(e) || function(e) {
return !!((e=>e >= 128 && e <= 255)(e) && (167 === e || 169 === e || 174 === e || 177 === e || 188 === e || 189 === e || 190 === e || 215 === e || 247 === e) || (e=>e >= 8192 && e <= 8303)(e) && (8214 === e || 8224 === e || 8225 === e || 8240 === e || 8241 === e || 8251 === e || 8252 === e || 8258 === e || 8263 === e || 8264 === e || 8265 === e || 8273 === e) || (e=>e >= 8448 && e <= 8527)(e) || (e=>e >= 8528 && e <= 8591)(e) || (e=>e >= 8960 && e <= 9215)(e) && (e >= 8960 && e <= 8967 || e >= 8972 && e <= 8991 || e >= 8996 && e <= 9e3 || 9003 === e || e >= 9085 && e <= 9114 || e >= 9150 && e <= 9165 || 9167 === e || e >= 9169 && e <= 9179 || e >= 9186 && e <= 9215) || (e=>e >= 9216 && e <= 9279)(e) && 9251 !== e || (e=>e >= 9280 && e <= 9311)(e) || (e=>e >= 9312 && e <= 9471)(e) || (e=>e >= 9632 && e <= 9727)(e) || (e=>e >= 9728 && e <= 9983)(e) && !(e >= 9754 && e <= 9759) || (e=>e >= 11008 && e <= 11263)(e) && (e >= 11026 && e <= 11055 || e >= 11088 && e <= 11097 || e >= 11192 && e <= 11243) || Zn(e) || Xn(e) || (e=>e >= 57344 && e <= 63743)(e) || co(e) || uo(e) || po(e) || 8734 === e || 8756 === e || 8757 === e || e >= 9984 && e <= 10087 || e >= 10102 && e <= 10131 || 65532 === e || 65533 === e)
}(e))
}
function xo(e) {
return e >= 1424 && e <= 2303 || ao(e) || ho(e)
}
function vo(e, t) {
return !(!t && xo(e) || e >= 2304 && e <= 3583 || e >= 3840 && e <= 4255 || (e=>e >= 6016 && e <= 6143)(e))
}
function bo(e) {
for (const t of e)
if (xo(t.charCodeAt(0)))
return !0;
return !1
}
const wo = "deferred"
, To = "loading"
, Eo = "loaded";
let So = null
, Co = "unavailable"
, Mo = null;
const Ao = function(e) {
e && "string" == typeof e && e.indexOf("NetworkError") > -1 && (Co = "error"),
So && So(e)
};
function Io() {
zo.fire(new Ge("pluginStateChange",{
pluginStatus: Co,
pluginURL: Mo
}))
}
const zo = new qe
, ko = function() {
return Co
}
, Po = function() {
if (Co !== wo || !Mo)
throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");
Co = To,
Io(),
Mo && De({
url: Mo
}, (e=>{
e ? Ao(e) : (Co = Eo,
Io())
}
))
}
, Do = {
applyArabicShaping: null,
processBidirectionalText: null,
processStyledBidirectionalText: null,
isLoaded: ()=>Co === Eo || null != Do.applyArabicShaping,
isLoading: ()=>Co === To,
setState(e) {
Co = e.pluginStatus,
Mo = e.pluginURL
},
isParsed: ()=>null != Do.applyArabicShaping && null != Do.processBidirectionalText && null != Do.processStyledBidirectionalText,
getPluginURL: ()=>Mo
};
class Lo {
constructor(e, t) {
this.zoom = e,
t ? (this.now = t.now,
this.fadeDuration = t.fadeDuration,
this.zoomHistory = t.zoomHistory,
this.transition = t.transition,
this.pitch = t.pitch) : (this.now = 0,
this.fadeDuration = 0,
this.zoomHistory = new Un,
this.transition = {},
this.pitch = 0)
}
isSupportedScript(e) {
return function(e, t) {
for (const i of e)
if (!vo(i.charCodeAt(0), t))
return !1;
return !0
}(e, Do.isLoaded())
}
crossFadingFactor() {
return 0 === this.fadeDuration ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1)
}
getCrossfadeParameters() {
const e = this.zoom
, t = e - Math.floor(e)
, i = this.crossFadingFactor();
return e > this.zoomHistory.lastIntegerZoom ? {
fromScale: 2,
toScale: 1,
t: t + (1 - t) * i
} : {
fromScale: .5,
toScale: 1,
t: 1 - (1 - i) * t
}
}
}
class Bo {
constructor(e, t) {
this.property = e,
this.value = t,
this.expression = function(e, t) {
if (Mr(e))
return new jr(e,t);
if (Or(e)) {
const i = Vr(e, t);
if ("error" === i.result)
throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));
return i.value
}
{
let i = e;
return "string" == typeof e && "color" === t.type && (i = xt.parse(e)),
{
kind: "constant",
evaluate: ()=>i
}
}
}(void 0 === t ? e.specification.default : t, e.specification)
}
isDataDriven() {
return "source" === this.expression.kind || "composite" === this.expression.kind
}
possiblyEvaluate(e, t, i) {
return this.property.possiblyEvaluate(this, e, t, i)
}
}
class Oo {
constructor(e) {
this.property = e,
this.value = new Bo(e,void 0)
}
transitioned(e, t) {
return new Fo(this.property,this.value,t,v({}, e.transition, this.transition),e.now)
}
untransitioned() {
return new Fo(this.property,this.value,null,{},0)
}
}
class Ro {
constructor(e) {
this._properties = e,
this._values = Object.create(e.defaultTransitionablePropertyValues)
}
getValue(e) {
return z(this._values[e].value.value)
}
setValue(e, t) {
this._values.hasOwnProperty(e) || (this._values[e] = new Oo(this._values[e].property)),
this._values[e].value = new Bo(this._values[e].property,null === t ? void 0 : z(t))
}
getTransition(e) {
return z(this._values[e].transition)
}
setTransition(e, t) {
this._values.hasOwnProperty(e) || (this._values[e] = new Oo(this._values[e].property)),
this._values[e].transition = z(t) || void 0
}
serialize() {
const e = {};
for (const t of Object.keys(this._values)) {
const i = this.getValue(t);
void 0 !== i && (e[t] = i);
const r = this.getTransition(t);
void 0 !== r && (e[`${t}-transition`] = r)
}
return e
}
transitioned(e, t) {
const i = new Uo(this._properties);
for (const r of Object.keys(this._values))
i._values[r] = this._values[r].transitioned(e, t._values[r]);
return i
}
untransitioned() {
const e = new Uo(this._properties);
for (const t of Object.keys(this._values))
e._values[t] = this._values[t].untransitioned();
return e
}
}
class Fo {
constructor(e, t, i, r, n) {
const o = r.delay || 0
, s = r.duration || 0;
n = n || 0,
this.property = e,
this.value = t,
this.begin = n + o,
this.end = this.begin + s,
e.specification.transition && (r.delay || r.duration) && (this.prior = i)
}
possiblyEvaluate(e, t, i) {
const r = e.now || 0
, n = this.value.possiblyEvaluate(e, t, i)
, o = this.prior;
if (o) {
if (r > this.end)
return this.prior = null,
n;
if (this.value.isDataDriven())
return this.prior = null,
n;
if (r < this.begin)
return o.possiblyEvaluate(e, t, i);
{
const s = (r - this.begin) / (this.end - this.begin);
return this.property.interpolate(o.possiblyEvaluate(e, t, i), n, d(s))
}
}
return n
}
}
class Uo {
constructor(e) {
this._properties = e,
this._values = Object.create(e.defaultTransitioningPropertyValues)
}
possiblyEvaluate(e, t, i) {
const r = new No(this._properties);
for (const n of Object.keys(this._values))
r._values[n] = this._values[n].possiblyEvaluate(e, t, i);
return r
}
hasTransition() {
for (const e of Object.keys(this._values))
if (this._values[e].prior)
return !0;
return !1
}
}
class Vo {
constructor(e) {
this._properties = e,
this._values = Object.create(e.defaultPropertyValues)
}
getValue(e) {
return z(this._values[e].value)
}
setValue(e, t) {
this._values[e] = new Bo(this._values[e].property,null === t ? void 0 : z(t))
}
serialize() {
const e = {};
for (const t of Object.keys(this._values)) {
const i = this.getValue(t);
void 0 !== i && (e[t] = i)
}
return e
}
possiblyEvaluate(e, t, i) {
const r = new No(this._properties);
for (const n of Object.keys(this._values))
r._values[n] = this._values[n].possiblyEvaluate(e, t, i);
return r
}
}
class jo {
constructor(e, t, i) {
this.property = e,
this.value = t,
this.parameters = i
}
isConstant() {
return "constant" === this.value.kind
}
constantOr(e) {
return "constant" === this.value.kind ? this.value.value : e
}
evaluate(e, t, i, r) {
return this.property.evaluate(this.value, this.parameters, e, t, i, r)
}
}
class No {
constructor(e) {
this._properties = e,
this._values = Object.create(e.defaultPossiblyEvaluatedValues)
}
get(e) {
return this._values[e]
}
}
class Go {
constructor(e) {
this.specification = e
}
possiblyEvaluate(e, t) {
return e.expression.evaluate(t)
}
interpolate(e, t, i) {
const r = bi[this.specification.type];
return r ? r(e, t, i) : e
}
}
class $o {
constructor(e, t) {
this.specification = e,
this.overrides = t
}
possiblyEvaluate(e, t, i, r) {
return new jo(this,"constant" === e.expression.kind || "camera" === e.expression.kind ? {
kind: "constant",
value: e.expression.evaluate(t, null, {}, i, r)
} : e.expression,t)
}
interpolate(e, t, i) {
if ("constant" !== e.value.kind || "constant" !== t.value.kind)
return e;
if (void 0 === e.value.value || void 0 === t.value.value)
return new jo(this,{
kind: "constant",
value: void 0
},e.parameters);
const r = bi[this.specification.type];
return r ? new jo(this,{
kind: "constant",
value: r(e.value.value, t.value.value, i)
},e.parameters) : e
}
evaluate(e, t, i, r, n, o) {
return "constant" === e.kind ? e.value : e.evaluate(t, i, r, n, o)
}
}
class qo extends $o {
possiblyEvaluate(e, t, i, r) {
if (void 0 === e.value)
return new jo(this,{
kind: "constant",
value: void 0
},t);
if ("constant" === e.expression.kind) {
const n = e.expression.evaluate(t, null, {}, i, r)
, o = "resolvedImage" === e.property.specification.type && "string" != typeof n ? n.name : n
, s = this._calculate(o, o, o, t);
return new jo(this,{
kind: "constant",
value: s
},t)
}
if ("camera" === e.expression.kind) {
const i = this._calculate(e.expression.evaluate({
zoom: t.zoom - 1
}), e.expression.evaluate({
zoom: t.zoom
}), e.expression.evaluate({
zoom: t.zoom + 1
}), t);
return new jo(this,{
kind: "constant",
value: i
},t)
}
return new jo(this,e.expression,t)
}
evaluate(e, t, i, r, n, o) {
if ("source" === e.kind) {
const s = e.evaluate(t, i, r, n, o);
return this._calculate(s, s, s, t)
}
return "composite" === e.kind ? this._calculate(e.evaluate({
zoom: Math.floor(t.zoom) - 1
}, i, r), e.evaluate({
zoom: Math.floor(t.zoom)
}, i, r), e.evaluate({
zoom: Math.floor(t.zoom) + 1
}, i, r), t) : e.value
}
_calculate(e, t, i, r) {
return r.zoom > r.zoomHistory.lastIntegerZoom ? {
from: e,
to: t,
other: i
} : {
from: i,
to: t,
other: e
}
}
interpolate(e) {
return e
}
}
class Zo {
constructor(e) {
this.specification = e
}
possiblyEvaluate(e, t, i, r) {
if (void 0 !== e.value) {
if ("constant" === e.expression.kind) {
const n = e.expression.evaluate(t, null, {}, i, r);
return this._calculate(n, n, n, t)
}
return this._calculate(e.expression.evaluate(new Lo(Math.floor(t.zoom - 1),t)), e.expression.evaluate(new Lo(Math.floor(t.zoom),t)), e.expression.evaluate(new Lo(Math.floor(t.zoom + 1),t)), t)
}
}
_calculate(e, t, i, r) {
return r.zoom > r.zoomHistory.lastIntegerZoom ? {
from: e,
to: t
} : {
from: i,
to: t
}
}
interpolate(e) {
return e
}
}
class Wo {
constructor(e) {
this.specification = e
}
possiblyEvaluate(e, t, i, r) {
return !!e.expression.evaluate(t, null, {}, i, r)
}
interpolate() {
return !1
}
}
class Xo {
constructor(e) {
this.properties = e,
this.defaultPropertyValues = {},
this.defaultTransitionablePropertyValues = {},
this.defaultTransitioningPropertyValues = {},
this.defaultPossiblyEvaluatedValues = {},
this.overridableProperties = [];
const t = new Lo(0,{});
for (const i in e) {
const r = e[i];
r.specification.overridable && this.overridableProperties.push(i);
const n = this.defaultPropertyValues[i] = new Bo(r,void 0)
, o = this.defaultTransitionablePropertyValues[i] = new Oo(r);
this.defaultTransitioningPropertyValues[i] = o.untransitioned(),
this.defaultPossiblyEvaluatedValues[i] = n.possiblyEvaluate(t)
}
}
}
function Ho(e, t) {
return 256 * (e = m(Math.floor(e), 0, 255)) + m(Math.floor(t), 0, 255)
}
Ln($o, "DataDrivenProperty"),
Ln(Go, "DataConstantProperty"),
Ln(qo, "CrossFadedDataDrivenProperty"),
Ln(Zo, "CrossFadedProperty"),
Ln(Wo, "ColorRampProperty");
const Yo = {
Int8: Int8Array,
Uint8: Uint8Array,
Int16: Int16Array,
Uint16: Uint16Array,
Int32: Int32Array,
Uint32: Uint32Array,
Float32: Float32Array
};
class Ko {
constructor(e, t) {
this._structArray = e,
this._pos1 = t * this.size,
this._pos2 = this._pos1 / 2,
this._pos4 = this._pos1 / 4,
this._pos8 = this._pos1 / 8
}
}
class Jo {
constructor() {
this.isTransferred = !1,
this.capacity = -1,
this.resize(0)
}
static serialize(e, t) {
return e._trim(),
t && (e.isTransferred = !0,
t.push(e.arrayBuffer)),
{
length: e.length,
arrayBuffer: e.arrayBuffer
}
}
static deserialize(e) {
const t = Object.create(this.prototype);
return t.arrayBuffer = e.arrayBuffer,
t.length = e.length,
t.capacity = e.arrayBuffer.byteLength / t.bytesPerElement,
t._refreshViews(),
t
}
_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(e) {
this.reserve(e),
this.length = e
}
reserve(e) {
if (e > this.capacity) {
this.capacity = Math.max(e, Math.floor(5 * this.capacity), 128),
this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement);
const t = this.uint8;
this._refreshViews(),
t && this.uint8.set(t)
}
}
_refreshViews() {
throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")
}
destroy() {
this.int8 = this.uint8 = this.int16 = this.uint16 = this.int32 = this.uint32 = this.float32 = null,
this.arrayBuffer = null
}
}
function Qo(e, t=1) {
let i = 0
, r = 0;
return {
members: e.map((e=>{
const n = Yo[e.type].BYTES_PER_ELEMENT
, o = i = es(i, Math.max(t, n))
, s = e.components || 1;
return r = Math.max(r, n),
i += n * s,
{
name: e.name,
type: e.type,
components: s,
offset: o
}
}
)),
size: es(i, Math.max(r, t)),
alignment: t
}
}
function es(e, t) {
return Math.ceil(e / t) * t
}
class ts extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t) {
const i = this.length;
return this.resize(i + 1),
this.emplace(i, e, t)
}
emplace(e, t, i) {
const r = 2 * e;
return this.int16[r + 0] = t,
this.int16[r + 1] = i,
e
}
}
ts.prototype.bytesPerElement = 4,
Ln(ts, "StructArrayLayout2i4");
class is extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t, i) {
const r = this.length;
return this.resize(r + 1),
this.emplace(r, e, t, i)
}
emplace(e, t, i, r) {
const n = 3 * e;
return this.int16[n + 0] = t,
this.int16[n + 1] = i,
this.int16[n + 2] = r,
e
}
}
is.prototype.bytesPerElement = 6,
Ln(is, "StructArrayLayout3i6");
class rs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r) {
const n = this.length;
return this.resize(n + 1),
this.emplace(n, e, t, i, r)
}
emplace(e, t, i, r, n) {
const o = 4 * e;
return this.int16[o + 0] = t,
this.int16[o + 1] = i,
this.int16[o + 2] = r,
this.int16[o + 3] = n,
e
}
}
rs.prototype.bytesPerElement = 8,
Ln(rs, "StructArrayLayout4i8");
class ns extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s) {
const a = this.length;
return this.resize(a + 1),
this.emplace(a, e, t, i, r, n, o, s)
}
emplace(e, t, i, r, n, o, s, a) {
const l = 6 * e
, c = 12 * e
, u = 3 * e;
return this.int16[l + 0] = t,
this.int16[l + 1] = i,
this.uint8[c + 4] = r,
this.uint8[c + 5] = n,
this.uint8[c + 6] = o,
this.uint8[c + 7] = s,
this.float32[u + 2] = a,
e
}
}
ns.prototype.bytesPerElement = 12,
Ln(ns, "StructArrayLayout2i4ub1f12");
class os extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r) {
const n = this.length;
return this.resize(n + 1),
this.emplace(n, e, t, i, r)
}
emplace(e, t, i, r, n) {
const o = 4 * e;
return this.float32[o + 0] = t,
this.float32[o + 1] = i,
this.float32[o + 2] = r,
this.float32[o + 3] = n,
e
}
}
os.prototype.bytesPerElement = 16,
Ln(os, "StructArrayLayout4f16");
class ss extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a, l, c) {
const u = this.length;
return this.resize(u + 1),
this.emplace(u, e, t, i, r, n, o, s, a, l, c)
}
emplace(e, t, i, r, n, o, s, a, l, c, u) {
const h = 10 * e;
return this.uint16[h + 0] = t,
this.uint16[h + 1] = i,
this.uint16[h + 2] = r,
this.uint16[h + 3] = n,
this.uint16[h + 4] = o,
this.uint16[h + 5] = s,
this.uint16[h + 6] = a,
this.uint16[h + 7] = l,
this.uint16[h + 8] = c,
this.uint16[h + 9] = u,
e
}
}
ss.prototype.bytesPerElement = 20,
Ln(ss, "StructArrayLayout10ui20");
class as extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a) {
const l = this.length;
return this.resize(l + 1),
this.emplace(l, e, t, i, r, n, o, s, a)
}
emplace(e, t, i, r, n, o, s, a, l) {
const c = 8 * e;
return this.uint16[c + 0] = t,
this.uint16[c + 1] = i,
this.uint16[c + 2] = r,
this.uint16[c + 3] = n,
this.uint16[c + 4] = o,
this.uint16[c + 5] = s,
this.uint16[c + 6] = a,
this.uint16[c + 7] = l,
e
}
}
as.prototype.bytesPerElement = 16,
Ln(as, "StructArrayLayout8ui16");
class ls extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o) {
const s = this.length;
return this.resize(s + 1),
this.emplace(s, e, t, i, r, n, o)
}
emplace(e, t, i, r, n, o, s) {
const a = 6 * e;
return this.int16[a + 0] = t,
this.int16[a + 1] = i,
this.int16[a + 2] = r,
this.int16[a + 3] = n,
this.int16[a + 4] = o,
this.int16[a + 5] = s,
e
}
}
ls.prototype.bytesPerElement = 12,
Ln(ls, "StructArrayLayout6i12");
class cs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a, l, c, u, h) {
const d = this.length;
return this.resize(d + 1),
this.emplace(d, e, t, i, r, n, o, s, a, l, c, u, h)
}
emplace(e, t, i, r, n, o, s, a, l, c, u, h, d) {
const p = 12 * e;
return this.int16[p + 0] = t,
this.int16[p + 1] = i,
this.int16[p + 2] = r,
this.int16[p + 3] = n,
this.uint16[p + 4] = o,
this.uint16[p + 5] = s,
this.uint16[p + 6] = a,
this.uint16[p + 7] = l,
this.int16[p + 8] = c,
this.int16[p + 9] = u,
this.int16[p + 10] = h,
this.int16[p + 11] = d,
e
}
}
cs.prototype.bytesPerElement = 24,
Ln(cs, "StructArrayLayout4i4ui4i24");
class us extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o) {
const s = this.length;
return this.resize(s + 1),
this.emplace(s, e, t, i, r, n, o)
}
emplace(e, t, i, r, n, o, s) {
const a = 10 * e
, l = 5 * e;
return this.int16[a + 0] = t,
this.int16[a + 1] = i,
this.int16[a + 2] = r,
this.float32[l + 2] = n,
this.float32[l + 3] = o,
this.float32[l + 4] = s,
e
}
}
us.prototype.bytesPerElement = 20,
Ln(us, "StructArrayLayout3i3f20");
class hs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint32 = new Uint32Array(this.arrayBuffer)
}
emplaceBack(e) {
const t = this.length;
return this.resize(t + 1),
this.emplace(t, e)
}
emplace(e, t) {
return this.uint32[1 * e + 0] = t,
e
}
}
hs.prototype.bytesPerElement = 4,
Ln(hs, "StructArrayLayout1ul4");
class ds extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer),
this.uint32 = new Uint32Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a, l, c, u, h, d) {
const p = this.length;
return this.resize(p + 1),
this.emplace(p, e, t, i, r, n, o, s, a, l, c, u, h, d)
}
emplace(e, t, i, r, n, o, s, a, l, c, u, h, d, p) {
const f = 20 * e
, m = 10 * e;
return this.int16[f + 0] = t,
this.int16[f + 1] = i,
this.int16[f + 2] = r,
this.int16[f + 3] = n,
this.int16[f + 4] = o,
this.float32[m + 3] = s,
this.float32[m + 4] = a,
this.float32[m + 5] = l,
this.float32[m + 6] = c,
this.int16[f + 14] = u,
this.uint32[m + 8] = h,
this.uint16[f + 18] = d,
this.uint16[f + 19] = p,
e
}
}
ds.prototype.bytesPerElement = 40,
Ln(ds, "StructArrayLayout5i4f1i1ul2ui40");
class ps extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s) {
const a = this.length;
return this.resize(a + 1),
this.emplace(a, e, t, i, r, n, o, s)
}
emplace(e, t, i, r, n, o, s, a) {
const l = 8 * e;
return this.int16[l + 0] = t,
this.int16[l + 1] = i,
this.int16[l + 2] = r,
this.int16[l + 4] = n,
this.int16[l + 5] = o,
this.int16[l + 6] = s,
this.int16[l + 7] = a,
e
}
}
ps.prototype.bytesPerElement = 16,
Ln(ps, "StructArrayLayout3i2i2i16");
class fs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n) {
const o = this.length;
return this.resize(o + 1),
this.emplace(o, e, t, i, r, n)
}
emplace(e, t, i, r, n, o) {
const s = 4 * e
, a = 8 * e;
return this.float32[s + 0] = t,
this.float32[s + 1] = i,
this.float32[s + 2] = r,
this.int16[a + 6] = n,
this.int16[a + 7] = o,
e
}
}
fs.prototype.bytesPerElement = 16,
Ln(fs, "StructArrayLayout2f1f2i16");
class ms extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r) {
const n = this.length;
return this.resize(n + 1),
this.emplace(n, e, t, i, r)
}
emplace(e, t, i, r, n) {
const o = 12 * e
, s = 3 * e;
return this.uint8[o + 0] = t,
this.uint8[o + 1] = i,
this.float32[s + 1] = r,
this.float32[s + 2] = n,
e
}
}
ms.prototype.bytesPerElement = 12,
Ln(ms, "StructArrayLayout2ub2f12");
class _s extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i) {
const r = this.length;
return this.resize(r + 1),
this.emplace(r, e, t, i)
}
emplace(e, t, i, r) {
const n = 3 * e;
return this.float32[n + 0] = t,
this.float32[n + 1] = i,
this.float32[n + 2] = r,
e
}
}
_s.prototype.bytesPerElement = 12,
Ln(_s, "StructArrayLayout3f12");
class gs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i) {
const r = this.length;
return this.resize(r + 1),
this.emplace(r, e, t, i)
}
emplace(e, t, i, r) {
const n = 3 * e;
return this.uint16[n + 0] = t,
this.uint16[n + 1] = i,
this.uint16[n + 2] = r,
e
}
}
gs.prototype.bytesPerElement = 6,
Ln(gs, "StructArrayLayout3ui6");
class ys extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer),
this.uint32 = new Uint32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v) {
const b = this.length;
return this.resize(b + 1),
this.emplace(b, e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v)
}
emplace(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b) {
const w = 30 * e
, T = 15 * e
, E = 60 * e;
return this.int16[w + 0] = t,
this.int16[w + 1] = i,
this.int16[w + 2] = r,
this.float32[T + 2] = n,
this.float32[T + 3] = o,
this.uint16[w + 8] = s,
this.uint16[w + 9] = a,
this.uint32[T + 5] = l,
this.uint32[T + 6] = c,
this.uint32[T + 7] = u,
this.uint16[w + 16] = h,
this.uint16[w + 17] = d,
this.uint16[w + 18] = p,
this.float32[T + 10] = f,
this.float32[T + 11] = m,
this.uint8[E + 48] = _,
this.uint8[E + 49] = g,
this.uint8[E + 50] = y,
this.uint32[T + 13] = x,
this.int16[w + 28] = v,
this.uint8[E + 58] = b,
e
}
}
ys.prototype.bytesPerElement = 60,
Ln(ys, "StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");
class xs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.int16 = new Int16Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer),
this.uint32 = new Uint32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E, S, C, M, A, I) {
const z = this.length;
return this.resize(z + 1),
this.emplace(z, e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E, S, C, M, A, I)
}
emplace(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E, S, C, M, A, I, z) {
const k = 38 * e
, P = 19 * e;
return this.int16[k + 0] = t,
this.int16[k + 1] = i,
this.int16[k + 2] = r,
this.float32[P + 2] = n,
this.float32[P + 3] = o,
this.int16[k + 8] = s,
this.int16[k + 9] = a,
this.int16[k + 10] = l,
this.int16[k + 11] = c,
this.int16[k + 12] = u,
this.int16[k + 13] = h,
this.uint16[k + 14] = d,
this.uint16[k + 15] = p,
this.uint16[k + 16] = f,
this.uint16[k + 17] = m,
this.uint16[k + 18] = _,
this.uint16[k + 19] = g,
this.uint16[k + 20] = y,
this.uint16[k + 21] = x,
this.uint16[k + 22] = v,
this.uint16[k + 23] = b,
this.uint16[k + 24] = w,
this.uint16[k + 25] = T,
this.uint16[k + 26] = E,
this.uint16[k + 27] = S,
this.uint16[k + 28] = C,
this.uint32[P + 15] = M,
this.float32[P + 16] = A,
this.float32[P + 17] = I,
this.float32[P + 18] = z,
e
}
}
xs.prototype.bytesPerElement = 76,
Ln(xs, "StructArrayLayout3i2f6i15ui1ul3f76");
class vs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e) {
const t = this.length;
return this.resize(t + 1),
this.emplace(t, e)
}
emplace(e, t) {
return this.float32[1 * e + 0] = t,
e
}
}
vs.prototype.bytesPerElement = 4,
Ln(vs, "StructArrayLayout1f4");
class bs extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r, n) {
const o = this.length;
return this.resize(o + 1),
this.emplace(o, e, t, i, r, n)
}
emplace(e, t, i, r, n, o) {
const s = 5 * e;
return this.float32[s + 0] = t,
this.float32[s + 1] = i,
this.float32[s + 2] = r,
this.float32[s + 3] = n,
this.float32[s + 4] = o,
e
}
}
bs.prototype.bytesPerElement = 20,
Ln(bs, "StructArrayLayout5f20");
class ws extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint32 = new Uint32Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t, i, r) {
const n = this.length;
return this.resize(n + 1),
this.emplace(n, e, t, i, r)
}
emplace(e, t, i, r, n) {
const o = 6 * e;
return this.uint32[3 * e + 0] = t,
this.uint16[o + 2] = i,
this.uint16[o + 3] = r,
this.uint16[o + 4] = n,
e
}
}
ws.prototype.bytesPerElement = 12,
Ln(ws, "StructArrayLayout1ul3ui12");
class Ts extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e, t) {
const i = this.length;
return this.resize(i + 1),
this.emplace(i, e, t)
}
emplace(e, t, i) {
const r = 2 * e;
return this.uint16[r + 0] = t,
this.uint16[r + 1] = i,
e
}
}
Ts.prototype.bytesPerElement = 4,
Ln(Ts, "StructArrayLayout2ui4");
class Es extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.uint16 = new Uint16Array(this.arrayBuffer)
}
emplaceBack(e) {
const t = this.length;
return this.resize(t + 1),
this.emplace(t, e)
}
emplace(e, t) {
return this.uint16[1 * e + 0] = t,
e
}
}
Es.prototype.bytesPerElement = 2,
Ln(Es, "StructArrayLayout1ui2");
class Ss extends Jo {
_refreshViews() {
this.uint8 = new Uint8Array(this.arrayBuffer),
this.float32 = new Float32Array(this.arrayBuffer)
}
emplaceBack(e, t) {
const i = this.length;
return this.resize(i + 1),
this.emplace(i, e, t)
}
emplace(e, t, i) {
const r = 2 * e;
return this.float32[r + 0] = t,
this.float32[r + 1] = i,
e
}
}
Ss.prototype.bytesPerElement = 8,
Ln(Ss, "StructArrayLayout2f8");
class Cs extends Ko {
get a_pos_30() {
return this._structArray.int16[this._pos2 + 0]
}
get a_pos_31() {
return this._structArray.int16[this._pos2 + 1]
}
get a_pos_32() {
return this._structArray.int16[this._pos2 + 2]
}
get a_pos_normal_30() {
return this._structArray.int16[this._pos2 + 3]
}
get a_pos_normal_31() {
return this._structArray.int16[this._pos2 + 4]
}
get a_pos_normal_32() {
return this._structArray.int16[this._pos2 + 5]
}
}
Cs.prototype.size = 12;
class Ms extends ls {
get(e) {
return new Cs(this,e)
}
}
Ln(Ms, "FillExtrusionExtArray");
class As extends Ko {
get projectedAnchorX() {
return this._structArray.int16[this._pos2 + 0]
}
get projectedAnchorY() {
return this._structArray.int16[this._pos2 + 1]
}
get projectedAnchorZ() {
return this._structArray.int16[this._pos2 + 2]
}
get tileAnchorX() {
return this._structArray.int16[this._pos2 + 3]
}
get tileAnchorY() {
return this._structArray.int16[this._pos2 + 4]
}
get x1() {
return this._structArray.float32[this._pos4 + 3]
}
get y1() {
return this._structArray.float32[this._pos4 + 4]
}
get x2() {
return this._structArray.float32[this._pos4 + 5]
}
get y2() {
return this._structArray.float32[this._pos4 + 6]
}
get padding() {
return this._structArray.int16[this._pos2 + 14]
}
get featureIndex() {
return this._structArray.uint32[this._pos4 + 8]
}
get sourceLayerIndex() {
return this._structArray.uint16[this._pos2 + 18]
}
get bucketIndex() {
return this._structArray.uint16[this._pos2 + 19]
}
}
As.prototype.size = 40;
class Is extends ds {
get(e) {
return new As(this,e)
}
}
Ln(Is, "CollisionBoxArray");
class zs extends Ko {
get projectedAnchorX() {
return this._structArray.int16[this._pos2 + 0]
}
get projectedAnchorY() {
return this._structArray.int16[this._pos2 + 1]
}
get projectedAnchorZ() {
return this._structArray.int16[this._pos2 + 2]
}
get tileAnchorX() {
return this._structArray.float32[this._pos4 + 2]
}
get tileAnchorY() {
return this._structArray.float32[this._pos4 + 3]
}
get glyphStartIndex() {
return this._structArray.uint16[this._pos2 + 8]
}
get numGlyphs() {
return this._structArray.uint16[this._pos2 + 9]
}
get vertexStartIndex() {
return this._structArray.uint32[this._pos4 + 5]
}
get lineStartIndex() {
return this._structArray.uint32[this._pos4 + 6]
}
get lineLength() {
return this._structArray.uint32[this._pos4 + 7]
}
get segment() {
return this._structArray.uint16[this._pos2 + 16]
}
get lowerSize() {
return this._structArray.uint16[this._pos2 + 17]
}
get upperSize() {
return this._structArray.uint16[this._pos2 + 18]
}
get lineOffsetX() {
return this._structArray.float32[this._pos4 + 10]
}
get lineOffsetY() {
return this._structArray.float32[this._pos4 + 11]
}
get writingMode() {
return this._structArray.uint8[this._pos1 + 48]
}
get placedOrientation() {
return this._structArray.uint8[this._pos1 + 49]
}
set placedOrientation(e) {
this._structArray.uint8[this._pos1 + 49] = e
}
get hidden() {
return this._structArray.uint8[this._pos1 + 50]
}
set hidden(e) {
this._structArray.uint8[this._pos1 + 50] = e
}
get crossTileID() {
return this._structArray.uint32[this._pos4 + 13]
}
set crossTileID(e) {
this._structArray.uint32[this._pos4 + 13] = e
}
get associatedIconIndex() {
return this._structArray.int16[this._pos2 + 28]
}
get flipState() {
return this._structArray.uint8[this._pos1 + 58]
}
set flipState(e) {
this._structArray.uint8[this._pos1 + 58] = e
}
}
zs.prototype.size = 60;
class ks extends ys {
get(e) {
return new zs(this,e)
}
}
Ln(ks, "PlacedSymbolArray");
class Ps extends Ko {
get projectedAnchorX() {
return this._structArray.int16[this._pos2 + 0]
}
get projectedAnchorY() {
return this._structArray.int16[this._pos2 + 1]
}
get projectedAnchorZ() {
return this._structArray.int16[this._pos2 + 2]
}
get tileAnchorX() {
return this._structArray.float32[this._pos4 + 2]
}
get tileAnchorY() {
return this._structArray.float32[this._pos4 + 3]
}
get rightJustifiedTextSymbolIndex() {
return this._structArray.int16[this._pos2 + 8]
}
get centerJustifiedTextSymbolIndex() {
return this._structArray.int16[this._pos2 + 9]
}
get leftJustifiedTextSymbolIndex() {
return this._structArray.int16[this._pos2 + 10]
}
get verticalPlacedTextSymbolIndex() {
return this._structArray.int16[this._pos2 + 11]
}
get placedIconSymbolIndex() {
return this._structArray.int16[this._pos2 + 12]
}
get verticalPlacedIconSymbolIndex() {
return this._structArray.int16[this._pos2 + 13]
}
get key() {
return this._structArray.uint16[this._pos2 + 14]
}
get textBoxStartIndex() {
return this._structArray.uint16[this._pos2 + 15]
}
get textBoxEndIndex() {
return this._structArray.uint16[this._pos2 + 16]
}
get verticalTextBoxStartIndex() {
return this._structArray.uint16[this._pos2 + 17]
}
get verticalTextBoxEndIndex() {
return this._structArray.uint16[this._pos2 + 18]
}
get iconBoxStartIndex() {
return this._structArray.uint16[this._pos2 + 19]
}
get iconBoxEndIndex() {
return this._structArray.uint16[this._pos2 + 20]
}
get verticalIconBoxStartIndex() {
return this._structArray.uint16[this._pos2 + 21]
}
get verticalIconBoxEndIndex() {
return this._structArray.uint16[this._pos2 + 22]
}
get featureIndex() {
return this._structArray.uint16[this._pos2 + 23]
}
get numHorizontalGlyphVertices() {
return this._structArray.uint16[this._pos2 + 24]
}
get numVerticalGlyphVertices() {
return this._structArray.uint16[this._pos2 + 25]
}
get numIconVertices() {
return this._structArray.uint16[this._pos2 + 26]
}
get numVerticalIconVertices() {
return this._structArray.uint16[this._pos2 + 27]
}
get useRuntimeCollisionCircles() {
return this._structArray.uint16[this._pos2 + 28]
}
get crossTileID() {
return this._structArray.uint32[this._pos4 + 15]
}
set crossTileID(e) {
this._structArray.uint32[this._pos4 + 15] = e
}
get textOffset0() {
return this._structArray.float32[this._pos4 + 16]
}
get textOffset1() {
return this._structArray.float32[this._pos4 + 17]
}
get collisionCircleDiameter() {
return this._structArray.float32[this._pos4 + 18]
}
}
Ps.prototype.size = 76;
class Ds extends xs {
get(e) {
return new Ps(this,e)
}
}
Ln(Ds, "SymbolInstanceArray");
class Ls extends vs {
getoffsetX(e) {
return this.float32[1 * e + 0]
}
}
Ln(Ls, "GlyphOffsetArray");
class Bs extends is {
getx(e) {
return this.int16[3 * e + 0]
}
gety(e) {
return this.int16[3 * e + 1]
}
gettileUnitDistanceFromAnchor(e) {
return this.int16[3 * e + 2]
}
}
Ln(Bs, "SymbolLineVertexArray");
class Os extends Ko {
get featureIndex() {
return this._structArray.uint32[this._pos4 + 0]
}
get sourceLayerIndex() {
return this._structArray.uint16[this._pos2 + 2]
}
get bucketIndex() {
return this._structArray.uint16[this._pos2 + 3]
}
get layoutVertexArrayOffset() {
return this._structArray.uint16[this._pos2 + 4]
}
}
Os.prototype.size = 12;
class Rs extends ws {
get(e) {
return new Os(this,e)
}
}
Ln(Rs, "FeatureIndexArray");
class Fs extends Ko {
get a_centroid_pos0() {
return this._structArray.uint16[this._pos2 + 0]
}
get a_centroid_pos1() {
return this._structArray.uint16[this._pos2 + 1]
}
}
Fs.prototype.size = 4;
class Us extends Ts {
get(e) {
return new Fs(this,e)
}
}
Ln(Us, "FillExtrusionCentroidArray");
class Vs extends Ko {
get a_pos_30() {
return this._structArray.int16[this._pos2 + 0]
}
get a_pos_31() {
return this._structArray.int16[this._pos2 + 1]
}
get a_pos_32() {
return this._structArray.int16[this._pos2 + 2]
}
get a_pos_normal_30() {
return this._structArray.int16[this._pos2 + 3]
}
get a_pos_normal_31() {
return this._structArray.int16[this._pos2 + 4]
}
get a_pos_normal_32() {
return this._structArray.int16[this._pos2 + 5]
}
}
Vs.prototype.size = 12;
class js extends ls {
get(e) {
return new Vs(this,e)
}
}
Ln(js, "CircleGlobeExtArray");
const Ns = Qo([{
name: "a_pattern_to",
components: 4,
type: "Uint16"
}, {
name: "a_pattern_from",
components: 4,
type: "Uint16"
}, {
name: "a_pixel_ratio_to",
components: 1,
type: "Uint16"
}, {
name: "a_pixel_ratio_from",
components: 1,
type: "Uint16"
}])
, Gs = Qo([{
name: "a_dash_to",
components: 4,
type: "Uint16"
}, {
name: "a_dash_from",
components: 4,
type: "Uint16"
}]);
var $s = _t((function(e) {
e.exports = function(e, t) {
var i, r, n, o, s, a, l, c;
for (r = e.length - (i = 3 & e.length),
n = t,
s = 3432918353,
a = 461845907,
c = 0; c < r; )
l = 255 & e.charCodeAt(c) | (255 & e.charCodeAt(++c)) << 8 | (255 & e.charCodeAt(++c)) << 16 | (255 & e.charCodeAt(++c)) << 24,
++c,
n = 27492 + (65535 & (o = 5 * (65535 & (n = (n ^= l = (65535 & (l = (l = (65535 & l) * s + (((l >>> 16) * s & 65535) << 16) & 4294967295) << 15 | l >>> 17)) * a + (((l >>> 16) * a & 65535) << 16) & 4294967295) << 13 | n >>> 19)) + ((5 * (n >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (o >>> 16) & 65535) << 16);
switch (l = 0,
i) {
case 3:
l ^= (255 & e.charCodeAt(c + 2)) << 16;
case 2:
l ^= (255 & e.charCodeAt(c + 1)) << 8;
case 1:
n ^= l = (65535 & (l = (l = (65535 & (l ^= 255 & e.charCodeAt(c))) * s + (((l >>> 16) * s & 65535) << 16) & 4294967295) << 15 | l >>> 17)) * a + (((l >>> 16) * a & 65535) << 16) & 4294967295
}
return n ^= e.length,
n = 2246822507 * (65535 & (n ^= n >>> 16)) + ((2246822507 * (n >>> 16) & 65535) << 16) & 4294967295,
n = 3266489909 * (65535 & (n ^= n >>> 13)) + ((3266489909 * (n >>> 16) & 65535) << 16) & 4294967295,
(n ^= n >>> 16) >>> 0
}
}
))
, qs = _t((function(e) {
e.exports = function(e, t) {
for (var i, r = e.length, n = t ^ r, o = 0; r >= 4; )
i = 1540483477 * (65535 & (i = 255 & e.charCodeAt(o) | (255 & e.charCodeAt(++o)) << 8 | (255 & e.charCodeAt(++o)) << 16 | (255 & e.charCodeAt(++o)) << 24)) + ((1540483477 * (i >>> 16) & 65535) << 16),
n = 1540483477 * (65535 & n) + ((1540483477 * (n >>> 16) & 65535) << 16) ^ (i = 1540483477 * (65535 & (i ^= i >>> 24)) + ((1540483477 * (i >>> 16) & 65535) << 16)),
r -= 4,
++o;
switch (r) {
case 3:
n ^= (255 & e.charCodeAt(o + 2)) << 16;
case 2:
n ^= (255 & e.charCodeAt(o + 1)) << 8;
case 1:
n = 1540483477 * (65535 & (n ^= 255 & e.charCodeAt(o))) + ((1540483477 * (n >>> 16) & 65535) << 16)
}
return n = 1540483477 * (65535 & (n ^= n >>> 13)) + ((1540483477 * (n >>> 16) & 65535) << 16),
(n ^= n >>> 15) >>> 0
}
}
))
, Zs = $s
, Ws = qs;
Zs.murmur3 = $s,
Zs.murmur2 = Ws;
class Xs {
constructor() {
this.ids = [],
this.positions = [],
this.indexed = !1
}
add(e, t, i, r) {
this.ids.push(Hs(e)),
this.positions.push(t, i, r)
}
getPositions(e) {
const t = Hs(e);
let i = 0
, r = this.ids.length - 1;
for (; i < r; ) {
const e = i + r >> 1;
this.ids[e] >= t ? r = e : i = e + 1
}
const n = [];
for (; this.ids[i] === t; )
n.push({
index: this.positions[3 * i],
start: this.positions[3 * i + 1],
end: this.positions[3 * i + 2]
}),
i++;
return n
}
static serialize(e, t) {
const i = new Float64Array(e.ids)
, r = new Uint32Array(e.positions);
return Ys(i, r, 0, i.length - 1),
t && t.push(i.buffer, r.buffer),
{
ids: i,
positions: r
}
}
static deserialize(e) {
const t = new Xs;
return t.ids = e.ids,
t.positions = e.positions,
t.indexed = !0,
t
}
}
function Hs(e) {
const t = +e;
return !isNaN(t) && Number.MIN_SAFE_INTEGER <= t && t <= Number.MAX_SAFE_INTEGER ? t : Zs(String(e))
}
function Ys(e, t, i, r) {
for (; i < r; ) {
const n = e[i + r >> 1];
let o = i - 1
, s = r + 1;
for (; ; ) {
do {
o++
} while (e[o] < n);
do {
s--
} while (e[s] > n);
if (o >= s)
break;
Ks(e, o, s),
Ks(t, 3 * o, 3 * s),
Ks(t, 3 * o + 1, 3 * s + 1),
Ks(t, 3 * o + 2, 3 * s + 2)
}
s - i < r - s ? (Ys(e, t, i, s),
i = s + 1) : (Ys(e, t, s + 1, r),
r = s)
}
}
function Ks(e, t, i) {
const r = e[t];
e[t] = e[i],
e[i] = r
}
Ln(Xs, "FeaturePositionMap");
class Js {
constructor(e) {
this.gl = e.gl,
this.initialized = !1
}
fetchUniformLocation(e, t) {
return this.location || this.initialized || (this.location = this.gl.getUniformLocation(e, t),
this.initialized = !0),
!!this.location
}
}
class Qs extends Js {
constructor(e) {
super(e),
this.current = 0
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && this.current !== i && (this.current = i,
this.gl.uniform1f(this.location, i))
}
}
class ea extends Js {
constructor(e) {
super(e),
this.current = [0, 0, 0, 0]
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && (i[0] === this.current[0] && i[1] === this.current[1] && i[2] === this.current[2] && i[3] === this.current[3] || (this.current = i,
this.gl.uniform4f(this.location, i[0], i[1], i[2], i[3])))
}
}
class ta extends Js {
constructor(e) {
super(e),
this.current = xt.transparent
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && (i.r === this.current.r && i.g === this.current.g && i.b === this.current.b && i.a === this.current.a || (this.current = i,
this.gl.uniform4f(this.location, i.r, i.g, i.b, i.a)))
}
}
const ia = new Float32Array(16)
, ra = new Float32Array(9)
, na = new Float32Array(4);
function oa(e) {
return [Ho(255 * e.r, 255 * e.g), Ho(255 * e.b, 255 * e.a)]
}
class sa {
constructor(e, t, i) {
this.value = e,
this.uniformNames = t.map((e=>`u_ ${e}`)),
this.type = i
}
setUniform(e, t, i, r, n) {
t.set(e, n, r.constantOr(this.value))
}
getBinding(e, t) {
return "color" === this.type ? new ta(e) : new Qs(e)
}
}
class aa {
constructor(e, t) {
this.uniformNames = t.map((e=>`u_ ${e}`)),
this.patternFrom = null,
this.patternTo = null,
this.pixelRatioFrom = 1,
this.pixelRatioTo = 1
}
setConstantPatternPositions(e, t) {
this.pixelRatioFrom = t.pixelRatio || 1,
this.pixelRatioTo = e.pixelRatio || 1,
this.patternFrom = t.tl.concat(t.br),
this.patternTo = e.tl.concat(e.br)
}
setUniform(e, t, i, r, n) {
const o = "u_pattern_to" === n || "u_dash_to" === n ? this.patternTo : "u_pattern_from" === n || "u_dash_from" === n ? this.patternFrom : "u_pixel_ratio_to" === n ? this.pixelRatioTo : "u_pixel_ratio_from" === n ? this.pixelRatioFrom : null;
o && t.set(e, n, o)
}
getBinding(e, t) {
return "u_pattern_from" === t || "u_pattern_to" === t || "u_dash_from" === t || "u_dash_to" === t ? new ea(e) : new Qs(e)
}
}
class la {
constructor(e, t, i, r) {
this.expression = e,
this.type = i,
this.maxValue = 0,
this.paintVertexAttributes = t.map((e=>({
name: `a_ ${e}`,
type: "Float32",
components: "color" === i ? 2 : 1,
offset: 0
}))),
this.paintVertexArray = new r
}
populatePaintArray(e, t, i, r, n, o) {
const s = this.paintVertexArray.length
, a = this.expression.evaluate(new Lo(0), t, {}, n, r, o);
this.paintVertexArray.resize(e),
this._setPaintValue(s, e, a)
}
updatePaintArray(e, t, i, r, n) {
const o = this.expression.evaluate({
zoom: 0
}, i, r, void 0, n);
this._setPaintValue(e, t, o)
}
_setPaintValue(e, t, i) {
if ("color" === this.type) {
const r = oa(i);
for (let i = e; i < t; i++)
this.paintVertexArray.emplace(i, r[0], r[1])
} else {
for (let r = e; r < t; r++)
this.paintVertexArray.emplace(r, i);
this.maxValue = Math.max(this.maxValue, Math.abs(i))
}
}
upload(e) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = e.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent))
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy()
}
}
class ca {
constructor(e, t, i, r, n, o) {
this.expression = e,
this.uniformNames = t.map((e=>`u_ ${e}_t`)),
this.type = i,
this.useIntegerZoom = r,
this.zoom = n,
this.maxValue = 0,
this.paintVertexAttributes = t.map((e=>({
name: `a_ ${e}`,
type: "Float32",
components: "color" === i ? 4 : 2,
offset: 0
}))),
this.paintVertexArray = new o
}
populatePaintArray(e, t, i, r, n, o) {
const s = this.expression.evaluate(new Lo(this.zoom), t, {}, n, r, o)
, a = this.expression.evaluate(new Lo(this.zoom + 1), t, {}, n, r, o)
, l = this.paintVertexArray.length;
this.paintVertexArray.resize(e),
this._setPaintValue(l, e, s, a)
}
updatePaintArray(e, t, i, r, n) {
const o = this.expression.evaluate({
zoom: this.zoom
}, i, r, void 0, n)
, s = this.expression.evaluate({
zoom: this.zoom + 1
}, i, r, void 0, n);
this._setPaintValue(e, t, o, s)
}
_setPaintValue(e, t, i, r) {
if ("color" === this.type) {
const n = oa(i)
, o = oa(r);
for (let i = e; i < t; i++)
this.paintVertexArray.emplace(i, n[0], n[1], o[0], o[1])
} else {
for (let n = e; n < t; n++)
this.paintVertexArray.emplace(n, i, r);
this.maxValue = Math.max(this.maxValue, Math.abs(i), Math.abs(r))
}
}
upload(e) {
this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = e.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent))
}
destroy() {
this.paintVertexBuffer && this.paintVertexBuffer.destroy()
}
setUniform(e, t, i, r, n) {
const o = this.useIntegerZoom ? Math.floor(i.zoom) : i.zoom
, s = m(this.expression.interpolationFactor(o, this.zoom, this.zoom + 1), 0, 1);
t.set(e, n, s)
}
getBinding(e, t) {
return new Qs(e)
}
}
class ua {
constructor(e, t, i, r, n, o, s) {
this.expression = e,
this.type = i,
this.useIntegerZoom = r,
this.zoom = n,
this.layerId = s,
this.paintVertexAttributes = ("array" === i ? Gs : Ns).members;
for (let e = 0; e < t.length; ++e)
;
this.zoomInPaintVertexArray = new o,
this.zoomOutPaintVertexArray = new o
}
populatePaintArray(e, t, i) {
const r = this.zoomInPaintVertexArray.length;
this.zoomInPaintVertexArray.resize(e),
this.zoomOutPaintVertexArray.resize(e),
this._setPaintValues(r, e, t.patterns && t.patterns[this.layerId], i)
}
updatePaintArray(e, t, i, r, n, o) {
this._setPaintValues(e, t, i.patterns && i.patterns[this.layerId], o)
}
_setPaintValues(e, t, i, r) {
if (!r || !i)
return;
const {min: n, mid: o, max: s} = i
, a = r[n]
, l = r[o]
, c = r[s];
if (a && l && c)
for (let i = e; i < t; i++)
this._setPaintValue(this.zoomInPaintVertexArray, i, l, a),
this._setPaintValue(this.zoomOutPaintVertexArray, i, l, c)
}
_setPaintValue(e, t, i, r) {
e.emplace(t, i.tl[0], i.tl[1], i.br[0], i.br[1], r.tl[0], r.tl[1], r.br[0], r.br[1], i.pixelRatio, r.pixelRatio)
}
upload(e) {
this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = e.createVertexBuffer(this.zoomInPaintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent),
this.zoomOutPaintVertexBuffer = e.createVertexBuffer(this.zoomOutPaintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent))
}
destroy() {
this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(),
this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy()
}
}
class ha {
constructor(e, t, i=(()=>!0)) {
this.binders = {},
this._buffers = [];
const r = [];
for (const n in e.paint._values) {
if (!i(n))
continue;
const o = e.paint.get(n);
if (!(o instanceof jo && Tr(o.property.specification)))
continue;
const s = fa(n, e.type)
, a = o.value
, l = o.property.specification.type
, c = o.property.useIntegerZoom
, u = o.property.specification["property-type"]
, h = "cross-faded" === u || "cross-faded-data-driven" === u
, d = "line-dasharray" === String(n) && "constant" !== e.layout.get("line-cap").value.kind;
if ("constant" !== a.kind || d)
if ("source" === a.kind || d || h) {
const i = ga(n, l, "source");
this.binders[n] = h ? new ua(a,s,l,c,t,i,e.id) : new la(a,s,l,i),
r.push(`/a_ ${n}`)
} else {
const e = ga(n, l, "composite");
this.binders[n] = new ca(a,s,l,c,t,e),
r.push(`/z_ ${n}`)
}
else
this.binders[n] = h ? new aa(a.value,s) : new sa(a.value,s,l),
r.push(`/u_ ${n}`)
}
this.cacheKey = r.sort().join("")
}
getMaxValue(e) {
const t = this.binders[e];
return t instanceof la || t instanceof ca ? t.maxValue : 0
}
populatePaintArrays(e, t, i, r, n, o) {
for (const s in this.binders) {
const a = this.binders[s];
(a instanceof la || a instanceof ca || a instanceof ua) && a.populatePaintArray(e, t, i, r, n, o)
}
}
setConstantPatternPositions(e, t) {
for (const i in this.binders) {
const r = this.binders[i];
r instanceof aa && r.setConstantPatternPositions(e, t)
}
}
updatePaintArrays(e, t, i, r, n, o) {
let s = !1;
for (const a in e) {
const l = t.getPositions(a);
for (const t of l) {
const l = i.feature(t.index);
for (const i in this.binders) {
const c = this.binders[i];
if ((c instanceof la || c instanceof ca || c instanceof ua) && !0 === c.expression.isStateDependent) {
const u = r.paint.get(i);
c.expression = u.value,
c.updatePaintArray(t.start, t.end, l, e[a], n, o),
s = !0
}
}
}
}
return s
}
defines() {
const e = [];
for (const t in this.binders) {
const i = this.binders[t];
(i instanceof sa || i instanceof aa) && e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_ ${e}`)))
}
return e
}
getBinderAttributes() {
const e = [];
for (const t in this.binders) {
const i = this.binders[t];
if (i instanceof la || i instanceof ca || i instanceof ua)
for (let t = 0; t < i.paintVertexAttributes.length; t++)
e.push(i.paintVertexAttributes[t].name)
}
return e
}
getBinderUniforms() {
const e = [];
for (const t in this.binders) {
const i = this.binders[t];
if (i instanceof sa || i instanceof aa || i instanceof ca)
for (const t of i.uniformNames)
e.push(t)
}
return e
}
getPaintVertexBuffers() {
return this._buffers
}
getUniforms(e) {
const t = [];
for (const i in this.binders) {
const r = this.binders[i];
if (r instanceof sa || r instanceof aa || r instanceof ca)
for (const n of r.uniformNames)
t.push({
name: n,
property: i,
binding: r.getBinding(e, n)
})
}
return t
}
setUniforms(e, t, i, r, n) {
for (const {name: t, property: o, binding: s} of i)
this.binders[o].setUniform(e, s, n, r.get(o), t)
}
updatePaintBuffers(e) {
this._buffers = [];
for (const t in this.binders) {
const i = this.binders[t];
if (e && i instanceof ua) {
const t = 2 === e.fromScale ? i.zoomInPaintVertexBuffer : i.zoomOutPaintVertexBuffer;
t && this._buffers.push(t)
} else
(i instanceof la || i instanceof ca) && i.paintVertexBuffer && this._buffers.push(i.paintVertexBuffer)
}
}
upload(e) {
for (const t in this.binders) {
const i = this.binders[t];
(i instanceof la || i instanceof ca || i instanceof ua) && i.upload(e)
}
this.updatePaintBuffers()
}
destroy() {
for (const e in this.binders) {
const t = this.binders[e];
(t instanceof la || t instanceof ca || t instanceof ua) && t.destroy()
}
}
}
class da {
constructor(e, t, i=(()=>!0)) {
this.programConfigurations = {};
for (const r of e)
this.programConfigurations[r.id] = new ha(r,t,i);
this.needsUpload = !1,
this._featureMap = new Xs,
this._bufferOffset = 0
}
populatePaintArrays(e, t, i, r, n, o, s) {
for (const i in this.programConfigurations)
this.programConfigurations[i].populatePaintArrays(e, t, r, n, o, s);
void 0 !== t.id && this._featureMap.add(t.id, i, this._bufferOffset, e),
this._bufferOffset = e,
this.needsUpload = !0
}
updatePaintArrays(e, t, i, r, n) {
for (const o of i)
this.needsUpload = this.programConfigurations[o.id].updatePaintArrays(e, this._featureMap, t, o, r, n) || this.needsUpload
}
get(e) {
return this.programConfigurations[e]
}
upload(e) {
if (this.needsUpload) {
for (const t in this.programConfigurations)
this.programConfigurations[t].upload(e);
this.needsUpload = !1
}
}
destroy() {
for (const e in this.programConfigurations)
this.programConfigurations[e].destroy()
}
}
const pa = {
"text-opacity": ["opacity"],
"icon-opacity": ["opacity"],
"text-color": ["fill_color"],
"icon-color": ["fill_color"],
"text-halo-color": ["halo_color"],
"icon-halo-color": ["halo_color"],
"text-halo-blur": ["halo_blur"],
"icon-halo-blur": ["halo_blur"],
"text-halo-width": ["halo_width"],
"icon-halo-width": ["halo_width"],
"line-gap-width": ["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"],
"line-dasharray": ["dash_to", "dash_from"]
};
function fa(e, t) {
return pa[e] || [e.replace(`${t}-`, "").replace(/-/g, "_")]
}
const ma = {
"line-pattern": {
source: ss,
composite: ss
},
"fill-pattern": {
source: ss,
composite: ss
},
"fill-extrusion-pattern": {
source: ss,
composite: ss
},
"line-dasharray": {
source: as,
composite: as
}
}
, _a = {
color: {
source: Ss,
composite: os
},
number: {
source: vs,
composite: Ss
}
};
function ga(e, t, i) {
const r = ma[e];
return r && r[i] || _a[t][i]
}
Ln(sa, "ConstantBinder"),
Ln(aa, "CrossFadedConstantBinder"),
Ln(la, "SourceExpressionBinder"),
Ln(ua, "CrossFadedCompositeBinder"),
Ln(ca, "CompositeExpressionBinder"),
Ln(ha, "ProgramConfiguration", {
omit: ["_buffers"]
}),
Ln(da, "ProgramConfigurationSet");
const ya = "-transition";
class xa extends qe {
constructor(e, t) {
if (super(),
this.id = e.id,
this.type = e.type,
this._featureFilter = {
filter: ()=>!0,
needGeometry: !1,
needFeature: !1
},
this._filterCompiled = !1,
"custom" !== e.type && (this.metadata = e.metadata,
this.minzoom = e.minzoom,
this.maxzoom = e.maxzoom,
"background" !== e.type && "sky" !== e.type && (this.source = e.source,
this.sourceLayer = e["source-layer"],
this.filter = e.filter),
t.layout && (this._unevaluatedLayout = new Vo(t.layout)),
t.paint)) {
this._transitionablePaint = new Ro(t.paint);
for (const t in e.paint)
this.setPaintProperty(t, e.paint[t], {
validate: !1
});
for (const t in e.layout)
this.setLayoutProperty(t, e.layout[t], {
validate: !1
});
this._transitioningPaint = this._transitionablePaint.untransitioned(),
this.paint = new No(t.paint)
}
}
getCrossfadeParameters() {
return this._crossfadeParameters
}
getLayoutProperty(e) {
return "visibility" === e ? this.visibility : this._unevaluatedLayout.getValue(e)
}
setLayoutProperty(e, t, i={}) {
null != t && this._validate(An, `layers.${this.id}.layout.${e}`, e, t, i) || ("visibility" !== e ? this._unevaluatedLayout.setValue(e, t) : this.visibility = t)
}
getPaintProperty(e) {
return M(e, ya) ? this._transitionablePaint.getTransition(e.slice(0, -ya.length)) : this._transitionablePaint.getValue(e)
}
setPaintProperty(e, t, i={}) {
if (null != t && this._validate(Mn, `layers.${this.id}.paint.${e}`, e, t, i))
return !1;
if (M(e, ya))
return this._transitionablePaint.setTransition(e.slice(0, -ya.length), t || void 0),
!1;
{
const i = this._transitionablePaint._values[e]
, r = "cross-faded-data-driven" === i.property.specification["property-type"]
, n = i.value.isDataDriven()
, o = i.value;
this._transitionablePaint.setValue(e, t),
this._handleSpecialPaintPropertyUpdate(e);
const s = this._transitionablePaint._values[e].value;
return s.isDataDriven() || n || r || this._handleOverridablePaintPropertyUpdate(e, o, s)
}
}
_handleSpecialPaintPropertyUpdate(e) {}
getProgramIds() {
return null
}
getProgramConfiguration(e) {
return null
}
_handleOverridablePaintPropertyUpdate(e, t, i) {
return !1
}
isHidden(e) {
return !!(this.minzoom && e < this.minzoom) || !!(this.maxzoom && e >= this.maxzoom) || "none" === this.visibility
}
updateTransitions(e) {
this._transitioningPaint = this._transitionablePaint.transitioned(e, this._transitioningPaint)
}
hasTransition() {
return this._transitioningPaint.hasTransition()
}
recalculate(e, t) {
e.getCrossfadeParameters && (this._crossfadeParameters = e.getCrossfadeParameters()),
this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(e, void 0, t)),
this.paint = this._transitioningPaint.possiblyEvaluate(e, void 0, t)
}
serialize() {
const e = {
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 && (e.layout = e.layout || {},
e.layout.visibility = this.visibility),
I(e, ((e,t)=>!(void 0 === e || "layout" === t && !Object.keys(e).length || "paint" === t && !Object.keys(e).length)))
}
_validate(e, t, i, r, n={}) {
return (!n || !1 !== n.validate) && zn(this, e.call(Cn, {
key: t,
layerType: this.type,
objectKey: i,
value: r,
styleSpec: Ze,
style: {
glyphs: !0,
sprite: !0
}
}))
}
is3D() {
return !1
}
isSky() {
return !1
}
isTileClipped() {
return !1
}
hasOffscreenPass() {
return !1
}
resize() {}
isStateDependent() {
for (const e in this.paint._values) {
const t = this.paint.get(e);
if (t instanceof jo && Tr(t.property.specification) && ("source" === t.value.kind || "composite" === t.value.kind) && t.value.isStateDependent)
return !0
}
return !1
}
compileFilter() {
this._filterCompiled || (this._featureFilter = Jr(this.filter),
this._filterCompiled = !0)
}
invalidateCompiledFilter() {
this._filterCompiled = !1
}
dynamicFilter() {
return this._featureFilter.dynamicFilter
}
dynamicFilterNeedsFeature() {
return this._featureFilter.needFeature
}
}
const va = Qo([{
name: "a_pos",
components: 2,
type: "Int16"
}], 4)
, ba = Qo([{
name: "a_pos_3",
components: 3,
type: "Int16"
}, {
name: "a_pos_normal_3",
components: 3,
type: "Int16"
}]);
class wa {
constructor(e=[]) {
this.segments = e
}
prepareSegment(e, t, i, r) {
let n = this.segments[this.segments.length - 1];
return e > wa.MAX_VERTEX_ARRAY_LENGTH && P(`Max vertices per segment is ${wa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),
(!n || n.vertexLength + e > wa.MAX_VERTEX_ARRAY_LENGTH || n.sortKey !== r) && (n = {
vertexOffset: t.length,
primitiveOffset: i.length,
vertexLength: 0,
primitiveLength: 0
},
void 0 !== r && (n.sortKey = r),
this.segments.push(n)),
n
}
get() {
return this.segments
}
destroy() {
for (const e of this.segments)
for (const t in e.vaos)
e.vaos[t].destroy()
}
static simpleSegment(e, t, i, r) {
return new wa([{
vertexOffset: e,
primitiveOffset: t,
vertexLength: i,
primitiveLength: r,
vaos: {},
sortKey: 0
}])
}
}
wa.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1,
Ln(wa, "SegmentVector");
var Ta = 8192;
class Ea {
constructor(e, t) {
e && (t ? this.setSouthWest(e).setNorthEast(t) : 4 === e.length ? this.setSouthWest([e[0], e[1]]).setNorthEast([e[2], e[3]]) : this.setSouthWest(e[0]).setNorthEast(e[1]))
}
setNorthEast(e) {
return this._ne = e instanceof Ca ? new Ca(e.lng,e.lat) : Ca.convert(e),
this
}
setSouthWest(e) {
return this._sw = e instanceof Ca ? new Ca(e.lng,e.lat) : Ca.convert(e),
this
}
extend(e) {
const t = this._sw
, i = this._ne;
let r, n;
if (e instanceof Ca)
r = e,
n = e;
else {
if (!(e instanceof Ea))
return Array.isArray(e) ? 4 === e.length || e.every(Array.isArray) ? this.extend(Ea.convert(e)) : this.extend(Ca.convert(e)) : this;
if (r = e._sw,
n = e._ne,
!r || !n)
return this
}
return t || i ? (t.lng = Math.min(r.lng, t.lng),
t.lat = Math.min(r.lat, t.lat),
i.lng = Math.max(n.lng, i.lng),
i.lat = Math.max(n.lat, i.lat)) : (this._sw = new Ca(r.lng,r.lat),
this._ne = new Ca(n.lng,n.lat)),
this
}
getCenter() {
return new Ca((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 Ca(this.getWest(),this.getNorth())
}
getSouthEast() {
return new Ca(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(e) {
const {lng: t, lat: i} = Ca.convert(e);
let r = this._sw.lng <= t && t <= this._ne.lng;
return this._sw.lng > this._ne.lng && (r = this._sw.lng >= t && t >= this._ne.lng),
this._sw.lat <= i && i <= this._ne.lat && r
}
static convert(e) {
return !e || e instanceof Ea ? e : new Ea(e)
}
}
const Sa = 6371008.8;
class Ca {
constructor(e, t) {
if (isNaN(e) || isNaN(t))
throw new Error(`Invalid LngLat object: (${e}, ${t})`);
if (this.lng = +e,
this.lat = +t,
this.lat > 90 || this.lat < -90)
throw new Error("Invalid LngLat latitude value: must be between -90 and 90")
}
wrap() {
return new Ca(g(this.lng, -180, 180),this.lat)
}
toArray() {
return [this.lng, this.lat]
}
toString() {
return `LngLat(${this.lng}, ${this.lat})`
}
distanceTo(e) {
const t = Math.PI / 180
, i = this.lat * t
, r = e.lat * t
, n = Math.sin(i) * Math.sin(r) + Math.cos(i) * Math.cos(r) * Math.cos((e.lng - this.lng) * t);
return Sa * Math.acos(Math.min(n, 1))
}
toBounds(e=0) {
const t = 360 * e / 40075017
, i = t / Math.cos(Math.PI / 180 * this.lat);
return new Ea(new Ca(this.lng - i,this.lat - t),new Ca(this.lng + i,this.lat + t))
}
static convert(e) {
if (e instanceof Ca)
return e;
if (Array.isArray(e) && (2 === e.length || 3 === e.length))
return new Ca(Number(e[0]),Number(e[1]));
if (!Array.isArray(e) && "object" == typeof e && null !== e)
return new Ca(Number("lng"in e ? e.lng : e.lon),Number(e.lat));
throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")
}
}
const Ma = 2 * Math.PI * Sa;
function Aa(e) {
return Ma * Math.cos(e * Math.PI / 180)
}
function Ia(e) {
return (180 + e) / 360
}
function za(e) {
return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + e * Math.PI / 360))) / 360
}
function ka(e, t) {
return e / Aa(t)
}
function Pa(e) {
return 360 * e - 180
}
function Da(e) {
return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * e) * Math.PI / 180)) - 90
}
function La(e, t) {
return e * Aa(Da(t))
}
const Ba = 85.051129;
function Oa(e) {
return 1 / Math.cos(e * Math.PI / 180)
}
class Ra {
constructor(e, t, i=0) {
this.x = +e,
this.y = +t,
this.z = +i
}
static fromLngLat(e, t=0) {
const i = Ca.convert(e);
return new Ra(Ia(i.lng),za(i.lat),ka(t, i.lat))
}
toLngLat() {
return new Ca(Pa(this.x),Da(this.y))
}
toAltitude() {
return La(this.z, this.y)
}
meterInMercatorCoordinateUnits() {
return 1 / Ma * Oa(Da(this.y))
}
}
function Fa(e, t, i, r, n, s, a, l, c) {
const u = (t + r) / 2
, h = (i + n) / 2
, d = new o(u,h);
l(d),
function(e, t, i, r, n, o) {
const s = i - n
, a = r - o;
return Math.abs((r - t) * s - (i - e) * a) / Math.hypot(s, a)
}(d.x, d.y, s.x, s.y, a.x, a.y) >= c ? (Fa(e, t, i, u, h, s, d, l, c),
Fa(e, u, h, r, n, d, a, l, c)) : e.push(a)
}
function Ua(e, t, i) {
let r = e[0]
, n = r.x
, o = r.y;
t(r);
const s = [r];
for (let a = 1; a < e.length; a++) {
const l = e[a]
, {x: c, y: u} = l;
t(l),
Fa(s, n, o, c, u, r, l, t, i),
n = c,
o = u,
r = l
}
return s
}
function Va(e, t, i, r, n) {
if (n(t, i)) {
const o = t.add(i).mult(.5);
r(o),
Va(e, t, o, r, n),
Va(e, o, i, r, n)
} else
e.push(i)
}
function ja(e, t, i) {
let r = e[0];
t(r);
const n = [r];
for (let o = 1; o < e.length; o++) {
const s = e[o];
t(s),
Va(n, r, s, t, i),
r = s
}
return n
}
const Na = Math.pow(2, 14) - 1
, Ga = -Na - 1;
function $a(e, t) {
const i = Math.round(e.x * t)
, r = Math.round(e.y * t);
return e.x = m(i, Ga, Na),
e.y = m(r, Ga, Na),
(i < e.x || i > e.x + 1 || r < e.y || r > e.y + 1) && P("Geometry exceeds allowed extent, reduce your vector tile buffer size"),
e
}
function qa(e, t, i) {
const r = e.loadGeometry()
, n = e.extent
, o = Ta / n;
if (t && i && i.projection.isReprojectedInTileSpace) {
const o = 1 << t.z
, {scale: s, x: a, y: l, projection: c} = i
, u = e=>{
const i = Pa((t.x + e.x / n) / o)
, r = Da((t.y + e.y / n) / o)
, u = c.project(i, r);
e.x = (u.x * s - a) * n,
e.y = (u.y * s - l) * n
}
;
for (let t = 0; t < r.length; t++)
if (1 !== e.type)
r[t] = Ua(r[t], u, 1);
else {
const e = [];
for (const i of r[t])
i.x < 0 || i.x >= n || i.y < 0 || i.y >= n || (u(i),
e.push(i));
r[t] = e
}
}
for (const e of r)
for (const t of e)
$a(t, o);
return r
}
function Za(e, t) {
return {
type: e.type,
id: e.id,
properties: e.properties,
geometry: t ? qa(e) : []
}
}
function Wa(e, t, i, r, n) {
e.emplaceBack(2 * t + (r + 1) / 2, 2 * i + (n + 1) / 2)
}
function Xa(e, t, i) {
const r = 16384;
e.emplaceBack(t.x, t.y, t.z, i[0] * r, i[1] * r, i[2] * r)
}
class Ha {
constructor(e) {
this.zoom = e.zoom,
this.overscaling = e.overscaling,
this.layers = e.layers,
this.layerIds = this.layers.map((e=>e.id)),
this.index = e.index,
this.hasPattern = !1,
this.projection = e.projection,
this.layoutVertexArray = new ts,
this.indexArray = new gs,
this.segments = new wa,
this.programConfigurations = new da(e.layers,e.zoom),
this.stateDependentLayerIds = this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))
}
populate(e, t, i, r) {
const n = this.layers[0]
, o = [];
let s = null;
"circle" === n.type && (s = n.layout.get("circle-sort-key"));
for (const {feature: t, id: n, index: a, sourceLayerIndex: l} of e) {
const e = this.layers[0]._featureFilter.needGeometry
, c = Za(t, e);
if (!this.layers[0]._featureFilter.filter(new Lo(this.zoom), c, i))
continue;
const u = s ? s.evaluate(c, {}, i) : void 0
, h = {
id: n,
properties: t.properties,
type: t.type,
sourceLayerIndex: l,
index: a,
geometry: e ? c.geometry : qa(t, i, r),
patterns: {},
sortKey: u
};
o.push(h)
}
s && o.sort(((e,t)=>e.sortKey - t.sortKey));
let a = null;
"globe" === r.projection.name && (this.globeExtVertexArray = new js,
a = r.projection);
for (const r of o) {
const {geometry: n, index: o, sourceLayerIndex: s} = r
, l = e[o].feature;
this.addFeature(r, n, o, t.availableImages, i, a),
t.featureIndex.insert(l, n, o, s, this.index)
}
}
update(e, t, i, r) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(e, t, this.stateDependentLayers, i, r)
}
isEmpty() {
return 0 === this.layoutVertexArray.length
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload
}
upload(e) {
this.uploaded || (this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, va.members),
this.indexBuffer = e.createIndexBuffer(this.indexArray),
this.globeExtVertexArray && (this.globeExtVertexBuffer = e.createVertexBuffer(this.globeExtVertexArray, ba.members))),
this.programConfigurations.upload(e),
this.uploaded = !0
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.programConfigurations.destroy(),
this.segments.destroy(),
this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy())
}
addFeature(e, t, i, r, n, o) {
for (const i of t)
for (const t of i) {
const i = t.x
, r = t.y;
if (i < 0 || i >= Ta || r < 0 || r >= Ta)
continue;
if (o) {
const e = o.projectTilePoint(i, r, n)
, t = o.upVector(n, i, r)
, s = this.globeExtVertexArray;
Xa(s, e, t),
Xa(s, e, t),
Xa(s, e, t),
Xa(s, e, t)
}
const s = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, e.sortKey)
, a = s.vertexLength;
Wa(this.layoutVertexArray, i, r, -1, -1),
Wa(this.layoutVertexArray, i, r, 1, -1),
Wa(this.layoutVertexArray, i, r, 1, 1),
Wa(this.layoutVertexArray, i, r, -1, 1),
this.indexArray.emplaceBack(a, a + 1, a + 2),
this.indexArray.emplaceBack(a, a + 2, a + 3),
s.vertexLength += 4,
s.primitiveLength += 2
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e, i, {}, r, n)
}
}
function Ya(e, t) {
for (let i = 0; i < e.length; i++)
if (ol(t, e[i]))
return !0;
for (let i = 0; i < t.length; i++)
if (ol(e, t[i]))
return !0;
return !!el(e, t)
}
function Ka(e, t, i) {
return !!ol(e, t) || !!il(t, e, i)
}
function Ja(e, t) {
if (1 === e.length)
return nl(t, e[0]);
for (let i = 0; i < t.length; i++) {
const r = t[i];
for (let t = 0; t < r.length; t++)
if (ol(e, r[t]))
return !0
}
for (let i = 0; i < e.length; i++)
if (nl(t, e[i]))
return !0;
for (let i = 0; i < t.length; i++)
if (el(e, t[i]))
return !0;
return !1
}
function Qa(e, t, i) {
if (e.length > 1) {
if (el(e, t))
return !0;
for (let r = 0; r < t.length; r++)
if (il(t[r], e, i))
return !0
}
for (let r = 0; r < e.length; r++)
if (il(e[r], t, i))
return !0;
return !1
}
function el(e, t) {
if (0 === e.length || 0 === t.length)
return !1;
for (let i = 0; i < e.length - 1; i++) {
const r = e[i]
, n = e[i + 1];
for (let e = 0; e < t.length - 1; e++)
if (tl(r, n, t[e], t[e + 1]))
return !0
}
return !1
}
function tl(e, t, i, r) {
return D(e, i, r) !== D(t, i, r) && D(e, t, i) !== D(e, t, r)
}
function il(e, t, i) {
const r = i * i;
if (1 === t.length)
return e.distSqr(t[0]) < r;
for (let i = 1; i < t.length; i++)
if (rl(e, t[i - 1], t[i]) < r)
return !0;
return !1
}
function rl(e, t, i) {
const r = t.distSqr(i);
if (0 === r)
return e.distSqr(t);
const n = ((e.x - t.x) * (i.x - t.x) + (e.y - t.y) * (i.y - t.y)) / r;
return e.distSqr(n < 0 ? t : n > 1 ? i : i.sub(t)._mult(n)._add(t))
}
function nl(e, t) {
let i, r, n, o = !1;
for (let s = 0; s < e.length; s++) {
i = e[s];
for (let e = 0, s = i.length - 1; e < i.length; s = e++)
r = i[e],
n = i[s],
r.y > t.y != n.y > t.y && t.x < (n.x - r.x) * (t.y - r.y) / (n.y - r.y) + r.x && (o = !o)
}
return o
}
function ol(e, t) {
let i = !1;
for (let r = 0, n = e.length - 1; r < e.length; n = r++) {
const o = e[r]
, s = e[n];
o.y > t.y != s.y > t.y && t.x < (s.x - o.x) * (t.y - o.y) / (s.y - o.y) + o.x && (i = !i)
}
return i
}
function sl(e, t, i, r, n) {
for (const o of e)
if (t <= o.x && i <= o.y && r >= o.x && n >= o.y)
return !0;
const s = [new o(t,i), new o(t,n), new o(r,n), new o(r,i)];
if (e.length > 2)
for (const t of s)
if (ol(e, t))
return !0;
for (let t = 0; t < e.length - 1; t++)
if (al(e[t], e[t + 1], s))
return !0;
return !1
}
function al(e, t, i) {
const r = i[0]
, n = i[2];
if (e.x < r.x && t.x < r.x || e.x > n.x && t.x > n.x || e.y < r.y && t.y < r.y || e.y > n.y && t.y > n.y)
return !1;
const o = D(e, t, i[0]);
return o !== D(e, t, i[1]) || o !== D(e, t, i[2]) || o !== D(e, t, i[3])
}
function ll(e, t, i) {
const r = t.paint.get(e).value;
return "constant" === r.kind ? r.value : i.programConfigurations.get(t.id).getMaxValue(e)
}
function cl(e) {
return Math.sqrt(e[0] * e[0] + e[1] * e[1])
}
function ul(e, t, i, r, n) {
if (!t[0] && !t[1])
return e;
const s = o.convert(t)._mult(n);
"viewport" === i && s._rotate(-r);
const a = [];
for (let t = 0; t < e.length; t++)
a.push(e[t].sub(s));
return a
}
function hl(e, t, i, r) {
const n = o.convert(e)._mult(r);
return "viewport" === t && n._rotate(-i),
n
}
Ln(Ha, "CircleBucket", {
omit: ["layers"]
});
const dl = new Xo({
"circle-sort-key": new $o(Ze.layout_circle["circle-sort-key"])
});
var pl = {
paint: new Xo({
"circle-radius": new $o(Ze.paint_circle["circle-radius"]),
"circle-color": new $o(Ze.paint_circle["circle-color"]),
"circle-blur": new $o(Ze.paint_circle["circle-blur"]),
"circle-opacity": new $o(Ze.paint_circle["circle-opacity"]),
"circle-translate": new Go(Ze.paint_circle["circle-translate"]),
"circle-translate-anchor": new Go(Ze.paint_circle["circle-translate-anchor"]),
"circle-pitch-scale": new Go(Ze.paint_circle["circle-pitch-scale"]),
"circle-pitch-alignment": new Go(Ze.paint_circle["circle-pitch-alignment"]),
"circle-stroke-width": new $o(Ze.paint_circle["circle-stroke-width"]),
"circle-stroke-color": new $o(Ze.paint_circle["circle-stroke-color"]),
"circle-stroke-opacity": new $o(Ze.paint_circle["circle-stroke-opacity"])
}),
layout: dl
}
, fl = 1e-6
, ml = "undefined" != typeof Float32Array ? Float32Array : Array;
function _l() {
var e = new ml(9);
return ml != Float32Array && (e[1] = 0,
e[2] = 0,
e[3] = 0,
e[5] = 0,
e[6] = 0,
e[7] = 0),
e[0] = 1,
e[4] = 1,
e[8] = 1,
e
}
function gl(e) {
return e[0] = 1,
e[1] = 0,
e[2] = 0,
e[3] = 0,
e[4] = 0,
e[5] = 1,
e[6] = 0,
e[7] = 0,
e[8] = 0,
e[9] = 0,
e[10] = 1,
e[11] = 0,
e[12] = 0,
e[13] = 0,
e[14] = 0,
e[15] = 1,
e
}
function yl(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = t[3]
, s = t[4]
, a = t[5]
, l = t[6]
, c = t[7]
, u = t[8]
, h = t[9]
, d = t[10]
, p = t[11]
, f = t[12]
, m = t[13]
, _ = t[14]
, g = t[15]
, y = i * a - r * s
, x = i * l - n * s
, v = i * c - o * s
, b = r * l - n * a
, w = r * c - o * a
, T = n * c - o * l
, E = u * m - h * f
, S = u * _ - d * f
, C = u * g - p * f
, M = h * _ - d * m
, A = h * g - p * m
, I = d * g - p * _
, z = y * I - x * A + v * M + b * C - w * S + T * E;
return z ? (e[0] = (a * I - l * A + c * M) * (z = 1 / z),
e[1] = (n * A - r * I - o * M) * z,
e[2] = (m * T - _ * w + g * b) * z,
e[3] = (d * w - h * T - p * b) * z,
e[4] = (l * C - s * I - c * S) * z,
e[5] = (i * I - n * C + o * S) * z,
e[6] = (_ * v - f * T - g * x) * z,
e[7] = (u * T - d * v + p * x) * z,
e[8] = (s * A - a * C + c * E) * z,
e[9] = (r * C - i * A - o * E) * z,
e[10] = (f * w - m * v + g * y) * z,
e[11] = (h * v - u * w - p * y) * z,
e[12] = (a * S - s * M - l * E) * z,
e[13] = (i * M - r * S + n * E) * z,
e[14] = (m * x - f * b - _ * y) * z,
e[15] = (u * b - h * x + d * y) * z,
e) : null
}
function xl(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = t[4]
, l = t[5]
, c = t[6]
, u = t[7]
, h = t[8]
, d = t[9]
, p = t[10]
, f = t[11]
, m = t[12]
, _ = t[13]
, g = t[14]
, y = t[15]
, x = i[0]
, v = i[1]
, b = i[2]
, w = i[3];
return e[0] = x * r + v * a + b * h + w * m,
e[1] = x * n + v * l + b * d + w * _,
e[2] = x * o + v * c + b * p + w * g,
e[3] = x * s + v * u + b * f + w * y,
e[4] = (x = i[4]) * r + (v = i[5]) * a + (b = i[6]) * h + (w = i[7]) * m,
e[5] = x * n + v * l + b * d + w * _,
e[6] = x * o + v * c + b * p + w * g,
e[7] = x * s + v * u + b * f + w * y,
e[8] = (x = i[8]) * r + (v = i[9]) * a + (b = i[10]) * h + (w = i[11]) * m,
e[9] = x * n + v * l + b * d + w * _,
e[10] = x * o + v * c + b * p + w * g,
e[11] = x * s + v * u + b * f + w * y,
e[12] = (x = i[12]) * r + (v = i[13]) * a + (b = i[14]) * h + (w = i[15]) * m,
e[13] = x * n + v * l + b * d + w * _,
e[14] = x * o + v * c + b * p + w * g,
e[15] = x * s + v * u + b * f + w * y,
e
}
function vl(e, t, i) {
var r, n, o, s, a, l, c, u, h, d, p, f, m = i[0], _ = i[1], g = i[2];
return t === e ? (e[12] = t[0] * m + t[4] * _ + t[8] * g + t[12],
e[13] = t[1] * m + t[5] * _ + t[9] * g + t[13],
e[14] = t[2] * m + t[6] * _ + t[10] * g + t[14],
e[15] = t[3] * m + t[7] * _ + t[11] * g + t[15]) : (n = t[1],
o = t[2],
s = t[3],
a = t[4],
l = t[5],
c = t[6],
u = t[7],
h = t[8],
d = t[9],
p = t[10],
f = t[11],
e[0] = r = t[0],
e[1] = n,
e[2] = o,
e[3] = s,
e[4] = a,
e[5] = l,
e[6] = c,
e[7] = u,
e[8] = h,
e[9] = d,
e[10] = p,
e[11] = f,
e[12] = r * m + a * _ + h * g + t[12],
e[13] = n * m + l * _ + d * g + t[13],
e[14] = o * m + c * _ + p * g + t[14],
e[15] = s * m + u * _ + f * g + t[15]),
e
}
function bl(e, t, i) {
var r = i[0]
, n = i[1]
, o = i[2];
return e[0] = t[0] * r,
e[1] = t[1] * r,
e[2] = t[2] * r,
e[3] = t[3] * r,
e[4] = t[4] * n,
e[5] = t[5] * n,
e[6] = t[6] * n,
e[7] = t[7] * n,
e[8] = t[8] * o,
e[9] = t[9] * o,
e[10] = t[10] * o,
e[11] = t[11] * o,
e[12] = t[12],
e[13] = t[13],
e[14] = t[14],
e[15] = t[15],
e
}
function wl(e, t, i) {
var r = Math.sin(i)
, n = Math.cos(i)
, o = t[4]
, s = t[5]
, a = t[6]
, l = t[7]
, c = t[8]
, u = t[9]
, h = t[10]
, d = t[11];
return t !== e && (e[0] = t[0],
e[1] = t[1],
e[2] = t[2],
e[3] = t[3],
e[12] = t[12],
e[13] = t[13],
e[14] = t[14],
e[15] = t[15]),
e[4] = o * n + c * r,
e[5] = s * n + u * r,
e[6] = a * n + h * r,
e[7] = l * n + d * r,
e[8] = c * n - o * r,
e[9] = u * n - s * r,
e[10] = h * n - a * r,
e[11] = d * n - l * r,
e
}
function Tl(e, t, i) {
var r = Math.sin(i)
, n = Math.cos(i)
, o = t[0]
, s = t[1]
, a = t[2]
, l = t[3]
, c = t[8]
, u = t[9]
, h = t[10]
, d = t[11];
return t !== e && (e[4] = t[4],
e[5] = t[5],
e[6] = t[6],
e[7] = t[7],
e[12] = t[12],
e[13] = t[13],
e[14] = t[14],
e[15] = t[15]),
e[0] = o * n - c * r,
e[1] = s * n - u * r,
e[2] = a * n - h * r,
e[3] = l * n - d * r,
e[8] = o * r + c * n,
e[9] = s * r + u * n,
e[10] = a * r + h * n,
e[11] = l * r + d * n,
e
}
function El(e, t) {
return e[0] = t[0],
e[1] = 0,
e[2] = 0,
e[3] = 0,
e[4] = 0,
e[5] = t[1],
e[6] = 0,
e[7] = 0,
e[8] = 0,
e[9] = 0,
e[10] = t[2],
e[11] = 0,
e[12] = 0,
e[13] = 0,
e[14] = 0,
e[15] = 1,
e
}
function Sl(e, t, i) {
var r, n, o, s = i[0], a = i[1], l = i[2], c = Math.hypot(s, a, l);
return c < fl ? null : (s *= c = 1 / c,
a *= c,
l *= c,
r = Math.sin(t),
n = Math.cos(t),
e[0] = s * s * (o = 1 - n) + n,
e[1] = a * s * o + l * r,
e[2] = l * s * o - a * r,
e[3] = 0,
e[4] = s * a * o - l * r,
e[5] = a * a * o + n,
e[6] = l * a * o + s * r,
e[7] = 0,
e[8] = s * l * o + a * r,
e[9] = a * l * o - s * r,
e[10] = l * l * o + n,
e[11] = 0,
e[12] = 0,
e[13] = 0,
e[14] = 0,
e[15] = 1,
e)
}
Math.hypot || (Math.hypot = function() {
for (var e = 0, t = arguments.length; t--; )
e += arguments[t] * arguments[t];
return Math.sqrt(e)
}
);
var Cl = xl;
function Ml() {
var e = new ml(3);
return ml != Float32Array && (e[0] = 0,
e[1] = 0,
e[2] = 0),
e
}
function Al(e) {
var t = new ml(3);
return t[0] = e[0],
t[1] = e[1],
t[2] = e[2],
t
}
function Il(e) {
return Math.hypot(e[0], e[1], e[2])
}
function zl(e, t, i) {
var r = new ml(3);
return r[0] = e,
r[1] = t,
r[2] = i,
r
}
function kl(e, t, i) {
return e[0] = t[0] + i[0],
e[1] = t[1] + i[1],
e[2] = t[2] + i[2],
e
}
function Pl(e, t, i) {
return e[0] = t[0] - i[0],
e[1] = t[1] - i[1],
e[2] = t[2] - i[2],
e
}
function Dl(e, t, i) {
return e[0] = t[0] * i[0],
e[1] = t[1] * i[1],
e[2] = t[2] * i[2],
e
}
function Ll(e, t, i) {
return e[0] = Math.min(t[0], i[0]),
e[1] = Math.min(t[1], i[1]),
e[2] = Math.min(t[2], i[2]),
e
}
function Bl(e, t, i) {
return e[0] = Math.max(t[0], i[0]),
e[1] = Math.max(t[1], i[1]),
e[2] = Math.max(t[2], i[2]),
e
}
function Ol(e, t, i) {
return e[0] = t[0] * i,
e[1] = t[1] * i,
e[2] = t[2] * i,
e
}
function Rl(e, t, i, r) {
return e[0] = t[0] + i[0] * r,
e[1] = t[1] + i[1] * r,
e[2] = t[2] + i[2] * r,
e
}
function Fl(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = i * i + r * r + n * n;
return o > 0 && (o = 1 / Math.sqrt(o)),
e[0] = t[0] * o,
e[1] = t[1] * o,
e[2] = t[2] * o,
e
}
function Ul(e, t) {
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2]
}
function Vl(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = i[0]
, a = i[1]
, l = i[2];
return e[0] = n * l - o * a,
e[1] = o * s - r * l,
e[2] = r * a - n * s,
e
}
function jl(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = i[3] * r + i[7] * n + i[11] * o + i[15];
return e[0] = (i[0] * r + i[4] * n + i[8] * o + i[12]) / (s = s || 1),
e[1] = (i[1] * r + i[5] * n + i[9] * o + i[13]) / s,
e[2] = (i[2] * r + i[6] * n + i[10] * o + i[14]) / s,
e
}
function Nl(e, t, i) {
var r = i[0]
, n = i[1]
, o = i[2]
, s = t[0]
, a = t[1]
, l = t[2]
, c = n * l - o * a
, u = o * s - r * l
, h = r * a - n * s
, d = n * h - o * u
, p = o * c - r * h
, f = r * u - n * c
, m = 2 * i[3];
return u *= m,
h *= m,
p *= 2,
f *= 2,
e[0] = s + (c *= m) + (d *= 2),
e[1] = a + u + p,
e[2] = l + h + f,
e
}
var Gl, $l = Pl, ql = Dl, Zl = Il;
function Wl(e, t, i) {
return e[0] = t[0] * i,
e[1] = t[1] * i,
e[2] = t[2] * i,
e[3] = t[3] * i,
e
}
function Xl(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3];
return e[0] = i[0] * r + i[4] * n + i[8] * o + i[12] * s,
e[1] = i[1] * r + i[5] * n + i[9] * o + i[13] * s,
e[2] = i[2] * r + i[6] * n + i[10] * o + i[14] * s,
e[3] = i[3] * r + i[7] * n + i[11] * o + i[15] * s,
e
}
function Hl() {
var e = new ml(4);
return ml != Float32Array && (e[0] = 0,
e[1] = 0,
e[2] = 0),
e[3] = 1,
e
}
function Yl(e) {
return e[0] = 0,
e[1] = 0,
e[2] = 0,
e[3] = 1,
e
}
function Kl(e, t, i) {
i *= .5;
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = Math.sin(i)
, l = Math.cos(i);
return e[0] = r * l + s * a,
e[1] = n * l + o * a,
e[2] = o * l - n * a,
e[3] = s * l - r * a,
e
}
function Jl(e, t, i) {
i *= .5;
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = Math.sin(i)
, l = Math.cos(i);
return e[0] = r * l - o * a,
e[1] = n * l + s * a,
e[2] = o * l + r * a,
e[3] = s * l - n * a,
e
}
Ml(),
Gl = new ml(4),
ml != Float32Array && (Gl[0] = 0,
Gl[1] = 0,
Gl[2] = 0,
Gl[3] = 0),
Ml(),
zl(1, 0, 0),
zl(0, 1, 0),
Hl(),
Hl(),
_l();
class Ql {
constructor(e, t) {
this.pos = e,
this.dir = t
}
intersectsPlane(e, t, i) {
const r = Ul(t, this.dir);
if (Math.abs(r) < 1e-6)
return !1;
const n = ((e[0] - this.pos[0]) * t[0] + (e[1] - this.pos[1]) * t[1] + (e[2] - this.pos[2]) * t[2]) / r;
return i[0] = this.pos[0] + this.dir[0] * n,
i[1] = this.pos[1] + this.dir[1] * n,
i[2] = this.pos[2] + this.dir[2] * n,
!0
}
closestPointOnSphere(e, t, i) {
if (function(e, t) {
var i = e[0]
, r = e[1]
, n = e[2]
, o = t[0]
, s = t[1]
, a = t[2];
return Math.abs(i - o) <= fl * Math.max(1, Math.abs(i), Math.abs(o)) && Math.abs(r - s) <= fl * Math.max(1, Math.abs(r), Math.abs(s)) && Math.abs(n - a) <= fl * Math.max(1, Math.abs(n), Math.abs(a))
}(this.pos, e) || 0 === t)
return i[0] = i[1] = i[2] = 0,
!1;
const [r,n,o] = this.dir
, s = this.pos[0] - e[0]
, a = this.pos[1] - e[1]
, l = this.pos[2] - e[2]
, c = r * r + n * n + o * o
, u = 2 * (s * r + a * n + l * o)
, h = u * u - 4 * c * (s * s + a * a + l * l - t * t);
if (h < 0) {
const e = Math.max(-u / 2, 0)
, c = s + r * e
, h = a + n * e
, d = l + o * e
, p = Math.hypot(c, h, d);
return i[0] = c * t / p,
i[1] = h * t / p,
i[2] = d * t / p,
!1
}
{
const e = (-u - Math.sqrt(h)) / (2 * c);
if (e < 0) {
const e = Math.hypot(s, a, l);
return i[0] = s * t / e,
i[1] = a * t / e,
i[2] = l * t / e,
!1
}
return i[0] = s + r * e,
i[1] = a + n * e,
i[2] = l + o * e,
!0
}
}
}
class ec {
constructor(e, t, i, r, n) {
this.TL = e,
this.TR = t,
this.BR = i,
this.BL = r,
this.horizon = n
}
static fromInvProjectionMatrix(e, t, i) {
const r = [-1, 1, 1]
, n = [1, 1, 1]
, o = [1, -1, 1]
, s = [-1, -1, 1]
, a = jl(r, r, e)
, l = jl(n, n, e)
, c = jl(o, o, e)
, u = jl(s, s, e);
return new ec(a,l,c,u,t / i)
}
}
class tc {
constructor(e, t) {
this.points = e,
this.planes = t
}
static fromInvProjectionMatrix(e, t, i, r) {
const n = Math.pow(2, i)
, o = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]].map((i=>{
const o = Xl([], i, e)
, s = 1 / o[3] / t * n;
return function(e, t, i) {
return e[0] = t[0] * i[0],
e[1] = t[1] * i[1],
e[2] = t[2] * i[2],
e[3] = t[3] * i[3],
e
}(o, o, [s, s, r ? 1 / o[3] : s, s])
}
))
, s = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map((e=>{
const t = Fl([], Vl([], $l([], o[e[0]], o[e[1]]), $l([], o[e[2]], o[e[1]])))
, i = -Ul(t, o[e[1]]);
return t.concat(i)
}
));
return new tc(o,s)
}
}
class ic {
static fromPoints(e) {
const t = [Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE]
, i = [Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE];
for (const r of e)
t[0] = Math.min(t[0], r[0]),
t[1] = Math.min(t[1], r[1]),
t[2] = Math.min(t[2], r[2]),
i[0] = Math.max(i[0], r[0]),
i[1] = Math.max(i[1], r[1]),
i[2] = Math.max(i[2], r[2]);
return new ic(t,i)
}
constructor(e, t) {
this.min = e,
this.max = t,
this.center = Ol([], kl([], this.min, this.max), .5)
}
quadrant(e) {
const t = [e % 2 == 0, e < 2]
, i = Al(this.min)
, r = Al(this.max);
for (let e = 0; e < t.length; e++)
i[e] = t[e] ? this.min[e] : this.center[e],
r[e] = t[e] ? this.center[e] : this.max[e];
return r[2] = this.max[2],
new ic(i,r)
}
distanceX(e) {
return Math.max(Math.min(this.max[0], e[0]), this.min[0]) - e[0]
}
distanceY(e) {
return Math.max(Math.min(this.max[1], e[1]), this.min[1]) - e[1]
}
distanceZ(e) {
return Math.max(Math.min(this.max[2], e[2]), this.min[2]) - e[2]
}
getCorners() {
const e = this.min
, t = this.max;
return [[e[0], e[1], e[2]], [t[0], e[1], e[2]], [t[0], t[1], e[2]], [e[0], t[1], e[2]], [e[0], e[1], t[2]], [t[0], e[1], t[2]], [t[0], t[1], t[2]], [e[0], t[1], t[2]]]
}
intersects(e) {
const t = this.getCorners();
let i = !0;
for (let r = 0; r < e.planes.length; r++) {
const n = e.planes[r];
let o = 0;
for (let e = 0; e < t.length; e++)
o += Ul(n, t[e]) + n[3] >= 0;
if (0 === o)
return 0;
o !== t.length && (i = !1)
}
if (i)
return 2;
for (let t = 0; t < 3; t++) {
let i = Number.MAX_VALUE
, r = -Number.MAX_VALUE;
for (let n = 0; n < e.points.length; n++) {
const o = e.points[n][t] - this.min[t];
i = Math.min(i, o),
r = Math.max(r, o)
}
if (r < 0 || i > this.max[t] - this.min[t])
return 0
}
return 1
}
}
function rc(e, t, i, r, n, o, s, a, l) {
if (o && e.queryGeometry.isAboveHorizon)
return !1;
o && (l *= e.pixelToTileUnitsFactor);
const c = e.tileID.canonical
, u = i.projection.upVectorScale(c, i.center.lat, i.worldSize).metersToTile;
for (const h of t)
for (const t of h) {
const h = t.add(a)
, d = n && i.elevation ? i.elevation.exaggeration() * n.getElevationAt(h.x, h.y, !0) : 0
, p = i.projection.projectTilePoint(h.x, h.y, c);
if (d > 0) {
const e = i.projection.upVector(c, h.x, h.y);
p.x += e[0] * u * d,
p.y += e[1] * u * d,
p.z += e[2] * u * d
}
const f = o ? h : nc(p.x, p.y, p.z, r)
, m = o ? e.tilespaceRays.map((e=>ac(e, d))) : e.queryGeometry.screenGeometry
, _ = Xl([], [p.x, p.y, p.z, 1], r);
if (!s && o ? l *= _[3] / i.cameraToCenterDistance : s && !o && (l *= i.cameraToCenterDistance / _[3]),
o) {
const e = Da((t.y / Ta + c.y) / (1 << c.z));
l /= i.projection.pixelsPerMeter(e, 1) / ka(1, e)
}
if (Ka(m, f, l))
return !0
}
return !1
}
function nc(e, t, i, r) {
const n = Xl([], [e, t, i, 1], r);
return new o(n[0] / n[3],n[1] / n[3])
}
const oc = zl(0, 0, 0)
, sc = zl(0, 0, 1);
function ac(e, t) {
const i = Ml();
return oc[2] = t,
e.intersectsPlane(oc, sc, i),
new o(i[0],i[1])
}
class lc extends Ha {
}
function cc(e, {width: t, height: i}, r, n) {
if (n) {
if (n instanceof Uint8ClampedArray)
n = new Uint8Array(n.buffer);
else if (n.length !== t * i * r)
throw new RangeError("mismatched image size")
} else
n = new Uint8Array(t * i * r);
return e.width = t,
e.height = i,
e.data = n,
e
}
function uc(e, t, i) {
const {width: r, height: n} = t;
r === e.width && n === e.height || (hc(e, t, {
x: 0,
y: 0
}, {
x: 0,
y: 0
}, {
width: Math.min(e.width, r),
height: Math.min(e.height, n)
}, i),
e.width = r,
e.height = n,
e.data = t.data)
}
function hc(e, t, i, r, n, o) {
if (0 === n.width || 0 === n.height)
return t;
if (n.width > e.width || n.height > e.height || i.x > e.width - n.width || i.y > e.height - n.height)
throw new RangeError("out of range source coordinates for image copy");
if (n.width > t.width || n.height > t.height || r.x > t.width - n.width || r.y > t.height - n.height)
throw new RangeError("out of range destination coordinates for image copy");
const s = e.data
, a = t.data;
for (let l = 0; l < n.height; l++) {
const c = ((i.y + l) * e.width + i.x) * o
, u = ((r.y + l) * t.width + r.x) * o;
for (let e = 0; e < n.width * o; e++)
a[u + e] = s[c + e]
}
return t
}
Ln(lc, "HeatmapBucket", {
omit: ["layers"]
});
class dc {
constructor(e, t) {
cc(this, e, 1, t)
}
resize(e) {
uc(this, new dc(e), 1)
}
clone() {
return new dc({
width: this.width,
height: this.height
},new Uint8Array(this.data))
}
static copy(e, t, i, r, n) {
hc(e, t, i, r, n, 1)
}
}
class pc {
constructor(e, t) {
cc(this, e, 4, t)
}
resize(e) {
uc(this, new pc(e), 4)
}
replace(e, t) {
t ? this.data.set(e) : this.data = e instanceof Uint8ClampedArray ? new Uint8Array(e.buffer) : e
}
clone() {
return new pc({
width: this.width,
height: this.height
},new Uint8Array(this.data))
}
static copy(e, t, i, r, n) {
hc(e, t, i, r, n, 4)
}
}
Ln(dc, "AlphaImage"),
Ln(pc, "RGBAImage");
var fc = {
paint: new Xo({
"heatmap-radius": new $o(Ze.paint_heatmap["heatmap-radius"]),
"heatmap-weight": new $o(Ze.paint_heatmap["heatmap-weight"]),
"heatmap-intensity": new Go(Ze.paint_heatmap["heatmap-intensity"]),
"heatmap-color": new Wo(Ze.paint_heatmap["heatmap-color"]),
"heatmap-opacity": new Go(Ze.paint_heatmap["heatmap-opacity"])
})
};
function mc(e) {
const t = {}
, i = e.resolution || 256
, r = e.clips ? e.clips.length : 1
, n = e.image || new pc({
width: i,
height: r
})
, o = (i,r,o)=>{
t[e.evaluationKey] = o;
const s = e.expression.evaluate(t);
n.data[i + r + 0] = Math.floor(255 * s.r / s.a),
n.data[i + r + 1] = Math.floor(255 * s.g / s.a),
n.data[i + r + 2] = Math.floor(255 * s.b / s.a),
n.data[i + r + 3] = Math.floor(255 * s.a)
}
;
if (e.clips)
for (let t = 0, n = 0; t < r; ++t,
n += 4 * i)
for (let r = 0, s = 0; r < i; r++,
s += 4) {
const a = r / (i - 1)
, {start: l, end: c} = e.clips[t];
o(n, s, l * (1 - a) + c * a)
}
else
for (let e = 0, t = 0; e < i; e++,
t += 4)
o(0, t, e / (i - 1));
return n
}
var _c = {
paint: new Xo({
"hillshade-illumination-direction": new Go(Ze.paint_hillshade["hillshade-illumination-direction"]),
"hillshade-illumination-anchor": new Go(Ze.paint_hillshade["hillshade-illumination-anchor"]),
"hillshade-exaggeration": new Go(Ze.paint_hillshade["hillshade-exaggeration"]),
"hillshade-shadow-color": new Go(Ze.paint_hillshade["hillshade-shadow-color"]),
"hillshade-highlight-color": new Go(Ze.paint_hillshade["hillshade-highlight-color"]),
"hillshade-accent-color": new Go(Ze.paint_hillshade["hillshade-accent-color"])
})
};
const gc = Qo([{
name: "a_pos",
components: 2,
type: "Int16"
}], 4)
, {members: yc} = gc;
var xc = bc
, vc = bc;
function bc(e, t, i) {
i = i || 2;
var r, n, o, s, a, l, c, u = t && t.length, h = u ? t[0] * i : e.length, d = wc(e, 0, h, i, !0), p = [];
if (!d || d.next === d.prev)
return p;
if (u && (d = function(e, t, i, r) {
var n, o, s, a = [];
for (n = 0,
o = t.length; n < o; n++)
(s = wc(e, t[n] * r, n < o - 1 ? t[n + 1] * r : e.length, r, !1)) === s.next && (s.steiner = !0),
a.push(Dc(s));
for (a.sort(Ic),
n = 0; n < a.length; n++)
i = zc(a[n], i);
return i
}(e, t, d, i)),
e.length > 80 * i) {
r = o = e[0],
n = s = e[1];
for (var f = i; f < h; f += i)
(a = e[f]) < r && (r = a),
(l = e[f + 1]) < n && (n = l),
a > o && (o = a),
l > s && (s = l);
c = 0 !== (c = Math.max(o - r, s - n)) ? 32767 / c : 0
}
return Ec(d, p, i, r, n, c, 0),
p
}
function wc(e, t, i, r, n) {
var o, s;
if (n === Zc(e, t, i, r) > 0)
for (o = t; o < i; o += r)
s = Gc(o, e[o], e[o + 1], s);
else
for (o = i - r; o >= t; o -= r)
s = Gc(o, e[o], e[o + 1], s);
return s && Rc(s, s.next) && ($c(s),
s = s.next),
s
}
function Tc(e, t) {
if (!e)
return e;
t || (t = e);
var i, r = e;
do {
if (i = !1,
r.steiner || !Rc(r, r.next) && 0 !== Oc(r.prev, r, r.next))
r = r.next;
else {
if ($c(r),
(r = t = r.prev) === r.next)
break;
i = !0
}
} while (i || r !== t);
return t
}
function Ec(e, t, i, r, n, o, s) {
if (e) {
!s && o && function(e, t, i, r) {
var n = e;
do {
0 === n.z && (n.z = Pc(n.x, n.y, t, i, r)),
n.prevZ = n.prev,
n.nextZ = n.next,
n = n.next
} while (n !== e);
n.prevZ.nextZ = null,
n.prevZ = null,
function(e) {
var t, i, r, n, o, s, a, l, c = 1;
do {
for (i = e,
e = null,
o = null,
s = 0; i; ) {
for (s++,
r = i,
a = 0,
t = 0; t < c && (a++,
r = r.nextZ); t++)
;
for (l = c; a > 0 || l > 0 && r; )
0 !== a && (0 === l || !r || i.z <= r.z) ? (n = i,
i = i.nextZ,
a--) : (n = r,
r = r.nextZ,
l--),
o ? o.nextZ = n : e = n,
n.prevZ = o,
o = n;
i = r
}
o.nextZ = null,
c *= 2
} while (s > 1)
}(n)
}(e, r, n, o);
for (var a, l, c = e; e.prev !== e.next; )
if (a = e.prev,
l = e.next,
o ? Cc(e, r, n, o) : Sc(e))
t.push(a.i / i | 0),
t.push(e.i / i | 0),
t.push(l.i / i | 0),
$c(e),
e = l.next,
c = l.next;
else if ((e = l) === c) {
s ? 1 === s ? Ec(e = Mc(Tc(e), t, i), t, i, r, n, o, 2) : 2 === s && Ac(e, t, i, r, n, o) : Ec(Tc(e), t, i, r, n, o, 1);
break
}
}
}
function Sc(e) {
var t = e.prev
, i = e
, r = e.next;
if (Oc(t, i, r) >= 0)
return !1;
for (var n = t.x, o = i.x, s = r.x, a = t.y, l = i.y, c = r.y, u = n < o ? n < s ? n : s : o < s ? o : s, h = a < l ? a < c ? a : c : l < c ? l : c, d = n > o ? n > s ? n : s : o > s ? o : s, p = a > l ? a > c ? a : c : l > c ? l : c, f = r.next; f !== t; ) {
if (f.x >= u && f.x <= d && f.y >= h && f.y <= p && Lc(n, a, o, l, s, c, f.x, f.y) && Oc(f.prev, f, f.next) >= 0)
return !1;
f = f.next
}
return !0
}
function Cc(e, t, i, r) {
var n = e.prev
, o = e
, s = e.next;
if (Oc(n, o, s) >= 0)
return !1;
for (var a = n.x, l = o.x, c = s.x, u = n.y, h = o.y, d = s.y, p = a < l ? a < c ? a : c : l < c ? l : c, f = u < h ? u < d ? u : d : h < d ? h : d, m = a > l ? a > c ? a : c : l > c ? l : c, _ = u > h ? u > d ? u : d : h > d ? h : d, g = Pc(p, f, t, i, r), y = Pc(m, _, t, i, r), x = e.prevZ, v = e.nextZ; x && x.z >= g && v && v.z <= y; ) {
if (x.x >= p && x.x <= m && x.y >= f && x.y <= _ && x !== n && x !== s && Lc(a, u, l, h, c, d, x.x, x.y) && Oc(x.prev, x, x.next) >= 0)
return !1;
if (x = x.prevZ,
v.x >= p && v.x <= m && v.y >= f && v.y <= _ && v !== n && v !== s && Lc(a, u, l, h, c, d, v.x, v.y) && Oc(v.prev, v, v.next) >= 0)
return !1;
v = v.nextZ
}
for (; x && x.z >= g; ) {
if (x.x >= p && x.x <= m && x.y >= f && x.y <= _ && x !== n && x !== s && Lc(a, u, l, h, c, d, x.x, x.y) && Oc(x.prev, x, x.next) >= 0)
return !1;
x = x.prevZ
}
for (; v && v.z <= y; ) {
if (v.x >= p && v.x <= m && v.y >= f && v.y <= _ && v !== n && v !== s && Lc(a, u, l, h, c, d, v.x, v.y) && Oc(v.prev, v, v.next) >= 0)
return !1;
v = v.nextZ
}
return !0
}
function Mc(e, t, i) {
var r = e;
do {
var n = r.prev
, o = r.next.next;
!Rc(n, o) && Fc(n, r, r.next, o) && jc(n, o) && jc(o, n) && (t.push(n.i / i | 0),
t.push(r.i / i | 0),
t.push(o.i / i | 0),
$c(r),
$c(r.next),
r = e = o),
r = r.next
} while (r !== e);
return Tc(r)
}
function Ac(e, t, i, r, n, o) {
var s = e;
do {
for (var a = s.next.next; a !== s.prev; ) {
if (s.i !== a.i && Bc(s, a)) {
var l = Nc(s, a);
return s = Tc(s, s.next),
l = Tc(l, l.next),
Ec(s, t, i, r, n, o, 0),
void Ec(l, t, i, r, n, o, 0)
}
a = a.next
}
s = s.next
} while (s !== e)
}
function Ic(e, t) {
return e.x - t.x
}
function zc(e, t) {
var i = function(e, t) {
var i, r = t, n = e.x, o = e.y, s = -1 / 0;
do {
if (o <= r.y && o >= r.next.y && r.next.y !== r.y) {
var a = r.x + (o - r.y) * (r.next.x - r.x) / (r.next.y - r.y);
if (a <= n && a > s && (s = a,
i = r.x < r.next.x ? r : r.next,
a === n))
return i
}
r = r.next
} while (r !== t);
if (!i)
return null;
var l, c = i, u = i.x, h = i.y, d = 1 / 0;
r = i;
do {
n >= r.x && r.x >= u && n !== r.x && Lc(o < h ? n : s, o, u, h, o < h ? s : n, o, r.x, r.y) && (l = Math.abs(o - r.y) / (n - r.x),
jc(r, e) && (l < d || l === d && (r.x > i.x || r.x === i.x && kc(i, r))) && (i = r,
d = l)),
r = r.next
} while (r !== c);
return i
}(e, t);
if (!i)
return t;
var r = Nc(i, e);
return Tc(r, r.next),
Tc(i, i.next)
}
function kc(e, t) {
return Oc(e.prev, e, t.prev) < 0 && Oc(t.next, e, e.next) < 0
}
function Pc(e, t, i, r, n) {
return (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = (e - i) * n | 0) | e << 8)) | e << 4)) | e << 2)) | e << 1)) | (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = (t - r) * n | 0) | t << 8)) | t << 4)) | t << 2)) | t << 1)) << 1
}
function Dc(e) {
var t = e
, i = e;
do {
(t.x < i.x || t.x === i.x && t.y < i.y) && (i = t),
t = t.next
} while (t !== e);
return i
}
function Lc(e, t, i, r, n, o, s, a) {
return (n - s) * (t - a) >= (e - s) * (o - a) && (e - s) * (r - a) >= (i - s) * (t - a) && (i - s) * (o - a) >= (n - s) * (r - a)
}
function Bc(e, t) {
return e.next.i !== t.i && e.prev.i !== t.i && !function(e, t) {
var i = e;
do {
if (i.i !== e.i && i.next.i !== e.i && i.i !== t.i && i.next.i !== t.i && Fc(i, i.next, e, t))
return !0;
i = i.next
} while (i !== e);
return !1
}(e, t) && (jc(e, t) && jc(t, e) && function(e, t) {
var i = e
, r = !1
, n = (e.x + t.x) / 2
, o = (e.y + t.y) / 2;
do {
i.y > o != i.next.y > o && i.next.y !== i.y && n < (i.next.x - i.x) * (o - i.y) / (i.next.y - i.y) + i.x && (r = !r),
i = i.next
} while (i !== e);
return r
}(e, t) && (Oc(e.prev, e, t.prev) || Oc(e, t.prev, t)) || Rc(e, t) && Oc(e.prev, e, e.next) > 0 && Oc(t.prev, t, t.next) > 0)
}
function Oc(e, t, i) {
return (t.y - e.y) * (i.x - t.x) - (t.x - e.x) * (i.y - t.y)
}
function Rc(e, t) {
return e.x === t.x && e.y === t.y
}
function Fc(e, t, i, r) {
var n = Vc(Oc(e, t, i))
, o = Vc(Oc(e, t, r))
, s = Vc(Oc(i, r, e))
, a = Vc(Oc(i, r, t));
return n !== o && s !== a || !(0 !== n || !Uc(e, i, t)) || !(0 !== o || !Uc(e, r, t)) || !(0 !== s || !Uc(i, e, r)) || !(0 !== a || !Uc(i, t, r))
}
function Uc(e, t, i) {
return t.x <= Math.max(e.x, i.x) && t.x >= Math.min(e.x, i.x) && t.y <= Math.max(e.y, i.y) && t.y >= Math.min(e.y, i.y)
}
function Vc(e) {
return e > 0 ? 1 : e < 0 ? -1 : 0
}
function jc(e, t) {
return Oc(e.prev, e, e.next) < 0 ? Oc(e, t, e.next) >= 0 && Oc(e, e.prev, t) >= 0 : Oc(e, t, e.prev) < 0 || Oc(e, e.next, t) < 0
}
function Nc(e, t) {
var i = new qc(e.i,e.x,e.y)
, r = new qc(t.i,t.x,t.y)
, n = e.next
, o = t.prev;
return e.next = t,
t.prev = e,
i.next = n,
n.prev = i,
r.next = i,
i.prev = r,
o.next = r,
r.prev = o,
r
}
function Gc(e, t, i, r) {
var n = new qc(e,t,i);
return r ? (n.next = r.next,
n.prev = r,
r.next.prev = n,
r.next = n) : (n.prev = n,
n.next = n),
n
}
function $c(e) {
e.next.prev = e.prev,
e.prev.next = e.next,
e.prevZ && (e.prevZ.nextZ = e.nextZ),
e.nextZ && (e.nextZ.prevZ = e.prevZ)
}
function qc(e, t, i) {
this.i = e,
this.x = t,
this.y = i,
this.prev = null,
this.next = null,
this.z = 0,
this.prevZ = null,
this.nextZ = null,
this.steiner = !1
}
function Zc(e, t, i, r) {
for (var n = 0, o = t, s = i - r; o < i; o += r)
n += (e[s] - e[o]) * (e[o + 1] + e[s + 1]),
s = o;
return n
}
function Wc(e, t, i, r, n) {
Xc(e, t, i || 0, r || e.length - 1, n || Yc)
}
function Xc(e, t, i, r, n) {
for (; r > i; ) {
if (r - i > 600) {
var o = r - i + 1
, s = t - i + 1
, a = Math.log(o)
, l = .5 * Math.exp(2 * a / 3)
, c = .5 * Math.sqrt(a * l * (o - l) / o) * (s - o / 2 < 0 ? -1 : 1);
Xc(e, t, Math.max(i, Math.floor(t - s * l / o + c)), Math.min(r, Math.floor(t + (o - s) * l / o + c)), n)
}
var u = e[t]
, h = i
, d = r;
for (Hc(e, i, t),
n(e[r], u) > 0 && Hc(e, i, r); h < d; ) {
for (Hc(e, h, d),
h++,
d--; n(e[h], u) < 0; )
h++;
for (; n(e[d], u) > 0; )
d--
}
0 === n(e[i], u) ? Hc(e, i, d) : Hc(e, ++d, r),
d <= t && (i = d + 1),
t <= d && (r = d - 1)
}
}
function Hc(e, t, i) {
var r = e[t];
e[t] = e[i],
e[i] = r
}
function Yc(e, t) {
return e < t ? -1 : e > t ? 1 : 0
}
function Kc(e, t) {
const i = e.length;
if (i <= 1)
return [e];
const r = [];
let n, o;
for (let t = 0; t < i; t++) {
const i = L(e[t]);
0 !== i && (e[t].area = Math.abs(i),
void 0 === o && (o = i < 0),
o === i < 0 ? (n && r.push(n),
n = [e[t]]) : n.push(e[t]))
}
if (n && r.push(n),
t > 1)
for (let e = 0; e < r.length; e++)
r[e].length <= t || (Wc(r[e], t, 1, r[e].length - 1, Jc),
r[e] = r[e].slice(0, t));
return r
}
function Jc(e, t) {
return t.area - e.area
}
function Qc(e, t, i) {
const r = i.patternDependencies;
let n = !1;
for (const i of t) {
const t = i.paint.get(`${e}-pattern`);
t.isConstant() || (n = !0);
const o = t.constantOr(null);
o && (n = !0,
r[o.to] = !0,
r[o.from] = !0)
}
return n
}
function eu(e, t, i, r, n) {
const o = n.patternDependencies;
for (const s of t) {
const t = s.paint.get(`${e}-pattern`).value;
if ("constant" !== t.kind) {
let e = t.evaluate({
zoom: r - 1
}, i, {}, n.availableImages)
, a = t.evaluate({
zoom: r
}, i, {}, n.availableImages)
, l = t.evaluate({
zoom: r + 1
}, i, {}, n.availableImages);
e = e && e.name ? e.name : e,
a = a && a.name ? a.name : a,
l = l && l.name ? l.name : l,
o[e] = !0,
o[a] = !0,
o[l] = !0,
i.patterns[s.id] = {
min: e,
mid: a,
max: l
}
}
}
return i
}
bc.deviation = function(e, t, i, r) {
var n = t && t.length
, o = Math.abs(Zc(e, 0, n ? t[0] * i : e.length, i));
if (n)
for (var s = 0, a = t.length; s < a; s++)
o -= Math.abs(Zc(e, t[s] * i, s < a - 1 ? t[s + 1] * i : e.length, i));
var l = 0;
for (s = 0; s < r.length; s += 3) {
var c = r[s] * i
, u = r[s + 1] * i
, h = r[s + 2] * i;
l += Math.abs((e[c] - e[h]) * (e[u + 1] - e[c + 1]) - (e[c] - e[u]) * (e[h + 1] - e[c + 1]))
}
return 0 === o && 0 === l ? 0 : Math.abs((l - o) / o)
}
,
bc.flatten = function(e) {
for (var t = e[0][0].length, i = {
vertices: [],
holes: [],
dimensions: t
}, r = 0, n = 0; n < e.length; n++) {
for (var o = 0; o < e[n].length; o++)
for (var s = 0; s < t; s++)
i.vertices.push(e[n][o][s]);
n > 0 && i.holes.push(r += e[n - 1].length)
}
return i
}
,
xc.default = vc;
class tu {
constructor(e) {
this.zoom = e.zoom,
this.overscaling = e.overscaling,
this.layers = e.layers,
this.layerIds = this.layers.map((e=>e.id)),
this.index = e.index,
this.hasPattern = !1,
this.patternFeatures = [],
this.layoutVertexArray = new ts,
this.indexArray = new gs,
this.indexArray2 = new Ts,
this.programConfigurations = new da(e.layers,e.zoom),
this.segments = new wa,
this.segments2 = new wa,
this.stateDependentLayerIds = this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),
this.projection = e.projection
}
populate(e, t, i, r) {
this.hasPattern = Qc("fill", this.layers, t);
const n = this.layers[0].layout.get("fill-sort-key")
, o = [];
for (const {feature: s, id: a, index: l, sourceLayerIndex: c} of e) {
const e = this.layers[0]._featureFilter.needGeometry
, u = Za(s, e);
if (!this.layers[0]._featureFilter.filter(new Lo(this.zoom), u, i))
continue;
const h = n ? n.evaluate(u, {}, i, t.availableImages) : void 0
, d = {
id: a,
properties: s.properties,
type: s.type,
sourceLayerIndex: c,
index: l,
geometry: e ? u.geometry : qa(s, i, r),
patterns: {},
sortKey: h
};
o.push(d)
}
n && o.sort(((e,t)=>e.sortKey - t.sortKey));
for (const r of o) {
const {geometry: n, index: o, sourceLayerIndex: s} = r;
if (this.hasPattern) {
const e = eu("fill", this.layers, r, this.zoom, t);
this.patternFeatures.push(e)
} else
this.addFeature(r, n, o, i, {}, t.availableImages);
t.featureIndex.insert(e[o].feature, n, o, s, this.index)
}
}
update(e, t, i, r) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(e, t, this.stateDependentLayers, i, r)
}
addFeatures(e, t, i, r, n) {
for (const e of this.patternFeatures)
this.addFeature(e, e.geometry, e.index, t, i, r)
}
isEmpty() {
return 0 === this.layoutVertexArray.length
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload
}
upload(e) {
this.uploaded || (this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, yc),
this.indexBuffer = e.createIndexBuffer(this.indexArray),
this.indexBuffer2 = e.createIndexBuffer(this.indexArray2)),
this.programConfigurations.upload(e),
this.uploaded = !0
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.indexBuffer2.destroy(),
this.programConfigurations.destroy(),
this.segments.destroy(),
this.segments2.destroy())
}
addFeature(e, t, i, r, n, o=[]) {
for (const e of Kc(t, 500)) {
let t = 0;
for (const i of e)
t += i.length;
const i = this.segments.prepareSegment(t, this.layoutVertexArray, this.indexArray)
, r = i.vertexLength
, n = []
, o = [];
for (const t of e) {
if (0 === t.length)
continue;
t !== e[0] && o.push(n.length / 2);
const i = this.segments2.prepareSegment(t.length, this.layoutVertexArray, this.indexArray2)
, r = i.vertexLength;
this.layoutVertexArray.emplaceBack(t[0].x, t[0].y),
this.indexArray2.emplaceBack(r + t.length - 1, r),
n.push(t[0].x),
n.push(t[0].y);
for (let e = 1; e < t.length; e++)
this.layoutVertexArray.emplaceBack(t[e].x, t[e].y),
this.indexArray2.emplaceBack(r + e - 1, r + e),
n.push(t[e].x),
n.push(t[e].y);
i.vertexLength += t.length,
i.primitiveLength += t.length
}
const s = xc(n, o);
for (let e = 0; e < s.length; e += 3)
this.indexArray.emplaceBack(r + s[e], r + s[e + 1], r + s[e + 2]);
i.vertexLength += t,
i.primitiveLength += s.length / 3
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e, i, n, o, r)
}
}
Ln(tu, "FillBucket", {
omit: ["layers", "patternFeatures"]
});
const iu = new Xo({
"fill-sort-key": new $o(Ze.layout_fill["fill-sort-key"])
});
var ru = {
paint: new Xo({
"fill-antialias": new Go(Ze.paint_fill["fill-antialias"]),
"fill-opacity": new $o(Ze.paint_fill["fill-opacity"]),
"fill-color": new $o(Ze.paint_fill["fill-color"]),
"fill-outline-color": new $o(Ze.paint_fill["fill-outline-color"]),
"fill-translate": new Go(Ze.paint_fill["fill-translate"]),
"fill-translate-anchor": new Go(Ze.paint_fill["fill-translate-anchor"]),
"fill-pattern": new qo(Ze.paint_fill["fill-pattern"])
}),
layout: iu
};
const nu = Qo([{
name: "a_pos_normal_ed",
components: 4,
type: "Int16"
}])
, ou = Qo([{
name: "a_centroid_pos",
components: 2,
type: "Uint16"
}])
, su = Qo([{
name: "a_pos_3",
components: 3,
type: "Int16"
}, {
name: "a_pos_normal_3",
components: 3,
type: "Int16"
}])
, {members: au} = nu;
var lu = cu;
function cu(e, t, i, r, n) {
this.properties = {},
this.extent = i,
this.type = 0,
this._pbf = e,
this._geometry = -1,
this._keys = r,
this._values = n,
e.readFields(uu, this, t)
}
function uu(e, t, i) {
1 == e ? t.id = i.readVarint() : 2 == e ? function(e, t) {
for (var i = e.readVarint() + e.pos; e.pos < i; ) {
var r = t._keys[e.readVarint()]
, n = t._values[e.readVarint()];
t.properties[r] = n
}
}(i, t) : 3 == e ? t.type = i.readVarint() : 4 == e && (t._geometry = i.pos)
}
function hu(e) {
for (var t, i, r = 0, n = 0, o = e.length, s = o - 1; n < o; s = n++)
r += ((i = e[s]).x - (t = e[n]).x) * (t.y + i.y);
return r
}
cu.types = ["Unknown", "Point", "LineString", "Polygon"],
cu.prototype.loadGeometry = function() {
var e = this._pbf;
e.pos = this._geometry;
for (var t, i = e.readVarint() + e.pos, r = 1, n = 0, s = 0, a = 0, l = []; e.pos < i; ) {
if (n <= 0) {
var c = e.readVarint();
r = 7 & c,
n = c >> 3
}
if (n--,
1 === r || 2 === r)
s += e.readSVarint(),
a += e.readSVarint(),
1 === r && (t && l.push(t),
t = []),
t.push(new o(s,a));
else {
if (7 !== r)
throw new Error("unknown command " + r);
t && t.push(t[0].clone())
}
}
return t && l.push(t),
l
}
,
cu.prototype.bbox = function() {
var e = this._pbf;
e.pos = this._geometry;
for (var t = e.readVarint() + e.pos, i = 1, r = 0, n = 0, o = 0, s = 1 / 0, a = -1 / 0, l = 1 / 0, c = -1 / 0; e.pos < t; ) {
if (r <= 0) {
var u = e.readVarint();
i = 7 & u,
r = u >> 3
}
if (r--,
1 === i || 2 === i)
(n += e.readSVarint()) < s && (s = n),
n > a && (a = n),
(o += e.readSVarint()) < l && (l = o),
o > c && (c = o);
else if (7 !== i)
throw new Error("unknown command " + i)
}
return [s, l, a, c]
}
,
cu.prototype.toGeoJSON = function(e, t, i) {
var r, n, o = this.extent * Math.pow(2, i), s = this.extent * e, a = this.extent * t, l = this.loadGeometry(), c = cu.types[this.type];
function u(e) {
for (var t = 0; t < e.length; t++) {
var i = e[t];
e[t] = [360 * (i.x + s) / o - 180, 360 / Math.PI * Math.atan(Math.exp((180 - 360 * (i.y + a) / o) * Math.PI / 180)) - 90]
}
}
switch (this.type) {
case 1:
var h = [];
for (r = 0; r < l.length; r++)
h[r] = l[r][0];
u(l = h);
break;
case 2:
for (r = 0; r < l.length; r++)
u(l[r]);
break;
case 3:
for (l = function(e) {
var t = e.length;
if (t <= 1)
return [e];
for (var i, r, n = [], o = 0; o < t; o++) {
var s = hu(e[o]);
0 !== s && (void 0 === r && (r = s < 0),
r === s < 0 ? (i && n.push(i),
i = [e[o]]) : i.push(e[o]))
}
return i && n.push(i),
n
}(l),
r = 0; r < l.length; r++)
for (n = 0; n < l[r].length; n++)
u(l[r][n])
}
1 === l.length ? l = l[0] : c = "Multi" + c;
var d = {
type: "Feature",
geometry: {
type: c,
coordinates: l
},
properties: this.properties
};
return "id"in this && (d.id = this.id),
d
}
;
var du = pu;
function pu(e, t) {
this.version = 1,
this.name = null,
this.extent = 4096,
this.length = 0,
this._pbf = e,
this._keys = [],
this._values = [],
this._features = [],
e.readFields(fu, this, t),
this.length = this._features.length
}
function fu(e, t, i) {
15 === e ? t.version = i.readVarint() : 1 === e ? t.name = i.readString() : 5 === e ? t.extent = i.readVarint() : 2 === e ? t._features.push(i.pos) : 3 === e ? t._keys.push(i.readString()) : 4 === e && t._values.push(function(e) {
for (var t = null, i = e.readVarint() + e.pos; e.pos < i; ) {
var r = e.readVarint() >> 3;
t = 1 === r ? e.readString() : 2 === r ? e.readFloat() : 3 === r ? e.readDouble() : 4 === r ? e.readVarint64() : 5 === r ? e.readVarint() : 6 === r ? e.readSVarint() : 7 === r ? e.readBoolean() : null
}
return t
}(i))
}
function mu(e, t, i) {
if (3 === e) {
var r = new du(i,i.readVarint() + i.pos);
r.length && (t[r.name] = r)
}
}
pu.prototype.feature = function(e) {
if (e < 0 || e >= this._features.length)
throw new Error("feature index out of bounds");
this._pbf.pos = this._features[e];
var t = this._pbf.readVarint() + this._pbf.pos;
return new lu(this._pbf,t,this.extent,this._keys,this._values)
}
;
var _u = {
VectorTile: function(e, t) {
this.layers = e.readFields(mu, {}, t)
},
VectorTileFeature: lu,
VectorTileLayer: du
};
function gu(e, t, i, r) {
const n = []
, s = 0 === r ? (e,t,i,r,n,s)=>{
e.push(new o(s,i + (s - t) / (r - t) * (n - i)))
}
: (e,t,i,r,n,s)=>{
e.push(new o(t + (s - i) / (n - i) * (r - t),s))
}
;
for (const o of e) {
const e = [];
for (const n of o) {
if (n.length <= 2)
continue;
const o = [];
for (let e = 0; e < n.length - 1; e++) {
const a = n[e].x
, l = n[e].y
, c = n[e + 1].x
, u = n[e + 1].y
, h = 0 === r ? a : l
, d = 0 === r ? c : u;
h < t ? d > t && s(o, a, l, c, u, t) : h > i ? d < i && s(o, a, l, c, u, i) : o.push(n[e]),
d < t && h >= t && s(o, a, l, c, u, t),
d > i && h <= i && s(o, a, l, c, u, i)
}
let a = n[n.length - 1];
const l = 0 === r ? a.x : a.y;
l >= t && l <= i && o.push(a),
o.length && (a = o[o.length - 1],
o[0].x === a.x && o[0].y === a.y || o.push(o[0]),
e.push(o))
}
e.length && n.push(e)
}
return n
}
const yu = _u.VectorTileFeature.types
, xu = Math.pow(2, 13);
function vu(e, t, i, r, n, o, s, a) {
e.emplaceBack((t << 1) + s, (i << 1) + o, (Math.floor(r * xu) << 1) + n, Math.round(a))
}
function bu(e, t, i) {
const r = 16384;
e.emplaceBack(t.x, t.y, t.z, i[0] * r, i[1] * r, i[2] * r)
}
class wu {
constructor() {
this.acc = new o(0,0),
this.polyCount = []
}
startRing(e) {
this.currentPolyCount = {
edges: 0,
top: 0
},
this.polyCount.push(this.currentPolyCount),
this.min || (this.min = new o(e.x,e.y),
this.max = new o(e.x,e.y))
}
append(e, t) {
this.currentPolyCount.edges++,
this.acc._add(e);
const i = this.min
, r = this.max;
e.x < i.x ? i.x = e.x : e.x > r.x && (r.x = e.x),
e.y < i.y ? i.y = e.y : e.y > r.y && (r.y = e.y),
((0 === e.x || e.x === Ta) && e.x === t.x) != ((0 === e.y || e.y === Ta) && e.y === t.y) && this.processBorderOverlap(e, t),
t.x < 0 != e.x < 0 && this.addBorderIntersection(0, xi(t.y, e.y, (0 - t.x) / (e.x - t.x))),
t.x > Ta != e.x > Ta && this.addBorderIntersection(1, xi(t.y, e.y, (Ta - t.x) / (e.x - t.x))),
t.y < 0 != e.y < 0 && this.addBorderIntersection(2, xi(t.x, e.x, (0 - t.y) / (e.y - t.y))),
t.y > Ta != e.y > Ta && this.addBorderIntersection(3, xi(t.x, e.x, (Ta - t.y) / (e.y - t.y)))
}
addBorderIntersection(e, t) {
this.borders || (this.borders = [[Number.MAX_VALUE, -Number.MAX_VALUE], [Number.MAX_VALUE, -Number.MAX_VALUE], [Number.MAX_VALUE, -Number.MAX_VALUE], [Number.MAX_VALUE, -Number.MAX_VALUE]]);
const i = this.borders[e];
t < i[0] && (i[0] = t),
t > i[1] && (i[1] = t)
}
processBorderOverlap(e, t) {
if (e.x === t.x) {
if (e.y === t.y)
return;
const i = 0 === e.x ? 0 : 1;
this.addBorderIntersection(i, t.y),
this.addBorderIntersection(i, e.y)
} else {
const i = 0 === e.y ? 2 : 3;
this.addBorderIntersection(i, t.x),
this.addBorderIntersection(i, e.x)
}
}
centroid() {
const e = this.polyCount.reduce(((e,t)=>e + t.edges), 0);
return 0 !== e ? this.acc.div(e)._round() : new o(0,0)
}
span() {
return new o(this.max.x - this.min.x,this.max.y - this.min.y)
}
intersectsCount() {
return this.borders.reduce(((e,t)=>e + +(t[0] !== Number.MAX_VALUE)), 0)
}
}
class Tu {
constructor(e) {
this.zoom = e.zoom,
this.canonical = e.canonical,
this.overscaling = e.overscaling,
this.layers = e.layers,
this.layerIds = this.layers.map((e=>e.id)),
this.index = e.index,
this.hasPattern = !1,
this.edgeRadius = 0,
this.projection = e.projection,
this.layoutVertexArray = new rs,
this.centroidVertexArray = new Us,
this.indexArray = new gs,
this.programConfigurations = new da(e.layers,e.zoom),
this.segments = new wa,
this.stateDependentLayerIds = this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),
this.enableTerrain = e.enableTerrain
}
populate(e, t, i, r) {
this.features = [],
this.hasPattern = Qc("fill-extrusion", this.layers, t),
this.featuresOnBorder = [],
this.borders = [[], [], [], []],
this.borderDoneWithNeighborZ = [-1, -1, -1, -1],
this.tileToMeter = function(e) {
const t = Math.exp(Math.PI * (1 - e.y / (1 << e.z) * 2));
return 80150034 * t / (t * t + 1) / Ta / (1 << e.z)
}(i),
this.edgeRadius = this.layers[0].layout.get("fill-extrusion-edge-radius") / this.tileToMeter;
for (const {feature: n, id: o, index: s, sourceLayerIndex: a} of e) {
const e = this.layers[0]._featureFilter.needGeometry
, l = Za(n, e);
if (!this.layers[0]._featureFilter.filter(new Lo(this.zoom), l, i))
continue;
const c = {
id: o,
sourceLayerIndex: a,
index: s,
geometry: e ? l.geometry : qa(n, i, r),
properties: n.properties,
type: n.type,
patterns: {}
}
, u = this.layoutVertexArray.length;
this.hasPattern ? this.features.push(eu("fill-extrusion", this.layers, c, this.zoom, t)) : this.addFeature(c, c.geometry, s, i, {}, t.availableImages, r),
t.featureIndex.insert(n, c.geometry, s, a, this.index, u)
}
this.sortBorders()
}
addFeatures(e, t, i, r, n) {
for (const e of this.features) {
const {geometry: o} = e;
this.addFeature(e, o, e.index, t, i, r, n)
}
this.sortBorders()
}
update(e, t, i, r) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(e, t, this.stateDependentLayers, i, r)
}
isEmpty() {
return 0 === this.layoutVertexArray.length
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload
}
upload(e) {
this.uploaded || (this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, au),
this.indexBuffer = e.createIndexBuffer(this.indexArray),
this.layoutVertexExtArray && (this.layoutVertexExtBuffer = e.createVertexBuffer(this.layoutVertexExtArray, su.members, !0))),
this.programConfigurations.upload(e),
this.uploaded = !0
}
uploadCentroid(e) {
0 !== this.centroidVertexArray.length && (this.centroidVertexBuffer ? this.needsCentroidUpdate && this.centroidVertexBuffer.updateData(this.centroidVertexArray) : this.centroidVertexBuffer = e.createVertexBuffer(this.centroidVertexArray, ou.members, !0),
this.needsCentroidUpdate = !1)
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.centroidVertexBuffer && this.centroidVertexBuffer.destroy(),
this.layoutVertexExtBuffer && this.layoutVertexExtBuffer.destroy(),
this.indexBuffer.destroy(),
this.programConfigurations.destroy(),
this.segments.destroy())
}
addFeature(e, t, i, r, n, s, a) {
const l = [new o(0,0), new o(Ta,Ta)]
, c = a.projection
, u = "globe" === c.name
, h = this.enableTerrain && !u ? new wu : null
, d = "Polygon" === yu[e.type];
u && !this.layoutVertexExtArray && (this.layoutVertexExtArray = new Ms);
const p = Kc(t, 500);
for (let e = p.length - 1; e >= 0; e--) {
const t = p[e];
(0 === t.length || (f = t[0]).every((e=>e.x <= 0)) || f.every((e=>e.x >= Ta)) || f.every((e=>e.y <= 0)) || f.every((e=>e.y >= Ta))) && p.splice(e, 1)
}
var f;
let m;
if (u)
m = ku(p, l, r);
else {
m = [];
for (const e of p)
m.push({
polygon: e,
bounds: l
})
}
const _ = d ? this.edgeRadius : 0;
for (const {polygon: e, bounds: t} of m) {
let i = 0
, n = 0;
for (const t of e)
d && !t[0].equals(t[t.length - 1]) && t.push(t[0]),
n += d ? t.length - 1 : t.length;
const o = this.segments.prepareSegment((d ? 5 : 4) * n, this.layoutVertexArray, this.indexArray);
if (d) {
const t = []
, n = [];
i = o.vertexLength;
for (const i of e) {
let s, a;
i.length && i !== e[0] && n.push(t.length / 2),
s = i[1].sub(i[0])._perp()._unit();
for (let e = 1; e < i.length; e++) {
const n = i[e]
, l = i[e === i.length - 1 ? 1 : e + 1];
let {x: h, y: d} = n;
if (_) {
a = l.sub(n)._perp()._unit();
const e = s.add(a)._unit()
, t = _ * Math.min(4, 1 / (s.x * e.x + s.y * e.y));
h += t * e.x,
d += t * e.y,
s = a
}
vu(this.layoutVertexArray, h, d, 0, 0, 1, 1, 0),
o.vertexLength++,
t.push(n.x, n.y),
u && bu(this.layoutVertexExtArray, c.projectTilePoint(h, d, r), c.upVector(r, h, d))
}
}
const s = xc(t, n);
for (let e = 0; e < s.length; e += 3)
this.indexArray.emplaceBack(i + s[e], i + s[e + 2], i + s[e + 1]),
o.primitiveLength++
}
for (const n of e) {
h && n.length && h.startRing(n[0]);
let e, s, a, l = n.length > 4 && Au(n[n.length - 2], n[0], n[1]), p = _ ? Su(n[n.length - 2], n[0], n[1], _) : 0;
s = n[1].sub(n[0])._perp()._unit();
for (let f = 1, m = 0; f < n.length; f++) {
let g = n[f - 1]
, y = n[f];
const x = n[f === n.length - 1 ? 1 : f + 1];
if (h && d && h.currentPolyCount.top++,
Mu(y, g, t)) {
_ && (s = x.sub(y)._perp()._unit());
continue
}
h && h.append(y, g);
const v = y.sub(g)._perp()
, b = v.x / (Math.abs(v.x) + Math.abs(v.y))
, w = v.y > 0 ? 1 : 0
, T = g.dist(y);
if (m + T > 32768 && (m = 0),
_) {
a = x.sub(y)._perp()._unit();
let e = Cu(g, y, x, Eu(s, a), _);
isNaN(e) && (e = 0);
const t = y.sub(g)._unit();
g = g.add(t.mult(p))._round(),
y = y.add(t.mult(-e))._round(),
p = e,
s = a
}
const E = o.vertexLength
, S = n.length > 4 && Au(g, y, x);
let C = Iu(m, l, !0);
if (vu(this.layoutVertexArray, g.x, g.y, b, w, 0, 0, C),
vu(this.layoutVertexArray, g.x, g.y, b, w, 0, 1, C),
m += T,
C = Iu(m, S, !1),
l = S,
vu(this.layoutVertexArray, y.x, y.y, b, w, 0, 0, C),
vu(this.layoutVertexArray, y.x, y.y, b, w, 0, 1, C),
o.vertexLength += 4,
this.indexArray.emplaceBack(E + 0, E + 1, E + 2),
this.indexArray.emplaceBack(E + 1, E + 3, E + 2),
o.primitiveLength += 2,
_) {
const r = i + (1 === f ? n.length - 2 : f - 2)
, s = 1 === f ? i : r + 1;
if (this.indexArray.emplaceBack(E + 1, r, E + 3),
this.indexArray.emplaceBack(r, s, E + 3),
o.primitiveLength += 2,
void 0 === e && (e = E),
!Mu(x, n[f], t)) {
const t = f === n.length - 1 ? e : o.vertexLength;
this.indexArray.emplaceBack(E + 2, E + 3, t),
this.indexArray.emplaceBack(E + 3, t + 1, t),
this.indexArray.emplaceBack(E + 3, s, t + 1),
o.primitiveLength += 3
}
}
if (u) {
const e = this.layoutVertexExtArray
, t = c.projectTilePoint(g.x, g.y, r)
, i = c.projectTilePoint(y.x, y.y, r)
, n = c.upVector(r, g.x, g.y)
, o = c.upVector(r, y.x, y.y);
bu(e, t, n),
bu(e, t, n),
bu(e, i, o),
bu(e, i, o)
}
}
d && (i += n.length - 1)
}
}
if (h && h.polyCount.length > 0) {
if (h.borders) {
h.vertexArrayOffset = this.centroidVertexArray.length;
const e = h.borders
, t = this.featuresOnBorder.push(h) - 1;
for (let i = 0; i < 4; i++)
e[i][0] !== Number.MAX_VALUE && this.borders[i].push(t)
}
this.encodeCentroid(h.borders ? void 0 : h.centroid(), h)
}
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e, i, n, s, r)
}
sortBorders() {
for (let e = 0; e < 4; e++)
this.borders[e].sort(((t,i)=>this.featuresOnBorder[t].borders[e][0] - this.featuresOnBorder[i].borders[e][0]))
}
encodeCentroid(e, t, i=!0) {
let r, n;
if (e)
if (0 !== e.y) {
const i = t.span()._mult(this.tileToMeter);
r = (Math.max(e.x, 1) << 3) + Math.min(7, Math.round(i.x / 10)),
n = (Math.max(e.y, 1) << 3) + Math.min(7, Math.round(i.y / 10))
} else
r = Math.ceil(7 * (e.x + 450)),
n = 0;
else
r = 0,
n = +i;
let o = i ? this.centroidVertexArray.length : t.vertexArrayOffset;
for (const e of t.polyCount) {
i && this.centroidVertexArray.resize(this.centroidVertexArray.length + 4 * e.edges + e.top);
for (let t = 0; t < e.top; t++)
this.centroidVertexArray.emplace(o++, r, n);
for (let t = 0; t < 2 * e.edges; t++)
this.centroidVertexArray.emplace(o++, 0, n),
this.centroidVertexArray.emplace(o++, r, n)
}
}
}
function Eu(e, t) {
const i = e.add(t)._unit();
return e.x * i.x + e.y * i.y
}
function Su(e, t, i, r) {
const n = t.sub(e)._perp()._unit()
, o = i.sub(t)._perp()._unit();
return Cu(e, t, i, Eu(n, o), r)
}
function Cu(e, t, i, r, n) {
const o = Math.sqrt(1 - r * r);
return Math.min(e.dist(t) / 3, t.dist(i) / 3, n * o / r)
}
function Mu(e, t, i) {
return e.x < i[0].x && t.x < i[0].x || e.x > i[1].x && t.x > i[1].x || e.y < i[0].y && t.y < i[0].y || e.y > i[1].y && t.y > i[1].y
}
function Au(e, t, i) {
if (e.x < 0 || e.x >= Ta || t.x < 0 || t.x >= Ta || i.x < 0 || i.x >= Ta)
return !1;
const r = i.sub(t)
, n = r.perp()
, o = e.sub(t);
return (r.x * o.x + r.y * o.y) / Math.sqrt((r.x * r.x + r.y * r.y) * (o.x * o.x + o.y * o.y)) > -.866 && n.x * o.x + n.y * o.y < 0
}
function Iu(e, t, i) {
const r = t ? 2 | e : -3 & e;
return i ? 1 | r : -2 & r
}
function zu() {
const e = Math.PI / 32
, t = Math.tan(e)
, i = Sa;
return i * Math.sqrt(1 + 2 * t * t) - i
}
function ku(e, t, i) {
const r = 1 << i.z
, n = Pa(i.x / r)
, s = Pa((i.x + 1) / r)
, a = Da(i.y / r)
, l = Da((i.y + 1) / r);
return function(e, t, i, r, n=0, s) {
const a = [];
if (!e.length || !i || !r)
return a;
const l = (e,t)=>{
for (const i of e)
a.push({
polygon: i,
bounds: t
})
}
, c = Math.ceil(Math.log2(i))
, u = Math.ceil(Math.log2(r))
, h = c - u
, d = [];
for (let e = 0; e < Math.abs(h); e++)
d.push(h > 0 ? 0 : 1);
for (let e = 0; e < Math.min(c, u); e++)
d.push(0),
d.push(1);
let p = e;
if (p = gu(p, t[0].y - n, t[1].y + n, 1),
p = gu(p, t[0].x - n, t[1].x + n, 0),
!p.length)
return a;
const f = [];
for (d.length ? f.push({
polygons: p,
bounds: t,
depth: 0
}) : l(p, t); f.length; ) {
const e = f.pop()
, t = e.depth
, i = d[t]
, r = e.bounds[0]
, a = e.bounds[1]
, c = 0 === i ? r.x : r.y
, u = 0 === i ? a.x : a.y
, h = s ? s(i, c, u) : .5 * (c + u)
, p = gu(e.polygons, c - n, h + n, i)
, m = gu(e.polygons, h - n, u + n, i);
if (p.length) {
const e = [r, new o(0 === i ? h : a.x,1 === i ? h : a.y)];
d.length > t + 1 ? f.push({
polygons: p,
bounds: e,
depth: t + 1
}) : l(p, e)
}
if (m.length) {
const e = [new o(0 === i ? h : r.x,1 === i ? h : r.y), a];
d.length > t + 1 ? f.push({
polygons: m,
bounds: e,
depth: t + 1
}) : l(m, e)
}
}
return a
}(e, t, Math.ceil((s - n) / 11.25), Math.ceil((a - l) / 11.25), 1, ((e,t,n)=>{
if (0 === e)
return .5 * (t + n);
{
const e = Da((i.y + t / Ta) / r);
return (za(.5 * (Da((i.y + n / Ta) / r) + e)) * r - i.y) * Ta
}
}
))
}
Ln(Tu, "FillExtrusionBucket", {
omit: ["layers", "features"]
}),
Ln(wu, "PartMetadata");
const Pu = new Xo({
"fill-extrusion-edge-radius": new Go(Ze["layout_fill-extrusion"]["fill-extrusion-edge-radius"])
});
var Du = {
paint: new Xo({
"fill-extrusion-opacity": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-opacity"]),
"fill-extrusion-color": new $o(Ze["paint_fill-extrusion"]["fill-extrusion-color"]),
"fill-extrusion-translate": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-translate"]),
"fill-extrusion-translate-anchor": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),
"fill-extrusion-pattern": new qo(Ze["paint_fill-extrusion"]["fill-extrusion-pattern"]),
"fill-extrusion-height": new $o(Ze["paint_fill-extrusion"]["fill-extrusion-height"]),
"fill-extrusion-base": new $o(Ze["paint_fill-extrusion"]["fill-extrusion-base"]),
"fill-extrusion-vertical-gradient": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),
"fill-extrusion-ambient-occlusion-intensity": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),
"fill-extrusion-ambient-occlusion-radius": new Go(Ze["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])
}),
layout: Pu
};
function Lu(e, t, i) {
var r = 2 * Math.PI * 6378137 / 256 / Math.pow(2, i);
return [e * r - 2 * Math.PI * 6378137 / 2, t * r - 2 * Math.PI * 6378137 / 2]
}
class Bu {
constructor(e, t, i) {
this.z = e,
this.x = t,
this.y = i,
this.key = Fu(0, e, e, t, i)
}
equals(e) {
return this.z === e.z && this.x === e.x && this.y === e.y
}
url(e, t) {
const i = function(e, t, i) {
var r = Lu(256 * e, 256 * (t = Math.pow(2, i) - t - 1), i)
, n = Lu(256 * (e + 1), 256 * (t + 1), i);
return r[0] + "," + r[1] + "," + n[0] + "," + n[1]
}(this.x, this.y, this.z)
, r = function(e, t, i) {
let r, n = "";
for (let o = e; o > 0; o--)
r = 1 << o - 1,
n += (t & r ? 1 : 0) + (i & r ? 2 : 0);
return n
}(this.z, this.x, this.y);
return e[(this.x + this.y) % e.length].replace("{prefix}", (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(/{z}/g, String(this.z)).replace(/{x}/g, String(this.x)).replace(/{y}/g, String("tms" === t ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace("{quadkey}", r).replace("{bbox-epsg-3857}", i)
}
toString() {
return `${this.z}/${this.x}/${this.y}`
}
}
class Ou {
constructor(e, t) {
this.wrap = e,
this.canonical = t,
this.key = Fu(e, t.z, t.z, t.x, t.y)
}
}
class Ru {
constructor(e, t, i, r, n) {
this.overscaledZ = e,
this.wrap = t,
this.canonical = new Bu(i,+r,+n),
this.key = 0 === t && e === i ? this.canonical.key : Fu(t, e, i, r, n)
}
equals(e) {
return this.overscaledZ === e.overscaledZ && this.wrap === e.wrap && this.canonical.equals(e.canonical)
}
scaledTo(e) {
const t = this.canonical.z - e;
return e > this.canonical.z ? new Ru(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y) : new Ru(e,this.wrap,e,this.canonical.x >> t,this.canonical.y >> t)
}
calculateScaledKey(e, t=!0) {
if (this.overscaledZ === e && t)
return this.key;
if (e > this.canonical.z)
return Fu(this.wrap * +t, e, this.canonical.z, this.canonical.x, this.canonical.y);
{
const i = this.canonical.z - e;
return Fu(this.wrap * +t, e, e, this.canonical.x >> i, this.canonical.y >> i)
}
}
isChildOf(e) {
if (e.wrap !== this.wrap)
return !1;
const t = this.canonical.z - e.canonical.z;
return 0 === e.overscaledZ || e.overscaledZ < this.overscaledZ && e.canonical.x === this.canonical.x >> t && e.canonical.y === this.canonical.y >> t
}
children(e) {
if (this.overscaledZ >= e)
return [new Ru(this.overscaledZ + 1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];
const t = this.canonical.z + 1
, i = 2 * this.canonical.x
, r = 2 * this.canonical.y;
return [new Ru(t,this.wrap,t,i,r), new Ru(t,this.wrap,t,i + 1,r), new Ru(t,this.wrap,t,i,r + 1), new Ru(t,this.wrap,t,i + 1,r + 1)]
}
isLessThan(e) {
return this.wrap < e.wrap || !(this.wrap > e.wrap) && (this.overscaledZ < e.overscaledZ || !(this.overscaledZ > e.overscaledZ) && (this.canonical.x < e.canonical.x || !(this.canonical.x > e.canonical.x) && this.canonical.y < e.canonical.y))
}
wrapped() {
return new Ru(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)
}
unwrapTo(e) {
return new Ru(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)
}
overscaleFactor() {
return Math.pow(2, this.overscaledZ - this.canonical.z)
}
toUnwrapped() {
return new Ou(this.wrap,this.canonical)
}
toString() {
return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`
}
}
function Fu(e, t, i, r, n) {
const o = 1 << Math.min(i, 22);
let s = o * (n % o) + r % o;
return e && i < 22 && (s += o * o * ((e < 0 ? -2 * e - 1 : 2 * e) % (1 << 2 * (22 - i)))),
16 * (32 * s + i) + (t - i)
}
function Uu(e, t) {
return e.x * t.x + e.y * t.y
}
function Vu(e, t) {
if (1 === e.length) {
let i = 0;
const r = t[i++];
let n;
for (; !n || r.equals(n); )
if (n = t[i++],
!n)
return 1 / 0;
for (; i < t.length; i++) {
const o = t[i]
, s = e[0]
, a = n.sub(r)
, l = o.sub(r)
, c = s.sub(r)
, u = Uu(a, a)
, h = Uu(a, l)
, d = Uu(l, l)
, p = Uu(c, a)
, f = Uu(c, l)
, m = u * d - h * h
, _ = (d * p - h * f) / m
, g = (u * f - h * p) / m
, y = r.z * (1 - _ - g) + n.z * _ + o.z * g;
if (isFinite(y))
return y
}
return 1 / 0
}
{
let e = 1 / 0;
for (const i of t)
e = Math.min(e, i.z);
return e
}
}
function ju(e) {
const t = new o(e[0],e[1]);
return t.z = e[2],
t
}
function Nu(e, t, i, r, n, o, s, a) {
const l = s * n.getElevationAt(e, t, !0, !0)
, c = 0 !== o[0]
, u = c ? 0 === o[1] ? s * (o[0] / 7 - 450) : s * function(e, t, i) {
const r = Math.floor(t[0] / 8)
, n = Math.floor(t[1] / 8)
, o = 10 * (t[0] - 8 * r)
, s = 10 * (t[1] - 8 * n)
, a = e.getElevationAt(r, n, !0, !0)
, l = e.getMeterToDEM(i)
, c = Math.floor(.5 * (o * l - 1))
, u = Math.floor(.5 * (s * l - 1))
, h = e.tileCoordToPixel(r, n)
, d = 2 * c + 1
, p = 2 * u + 1
, f = function(e, t, i, r, n) {
return [e.getElevationAtPixel(t, i, !0), e.getElevationAtPixel(t + n, i, !0), e.getElevationAtPixel(t, i + n, !0), e.getElevationAtPixel(t + r, i + n, !0)]
}(e, h.x - c, h.y - u, d, p)
, m = Math.abs(f[0] - f[1])
, _ = Math.abs(f[2] - f[3])
, g = Math.abs(f[0] - f[2]) + Math.abs(f[1] - f[3])
, y = Math.min(.25, .5 * l * (m + _) / d)
, x = Math.min(.25, .5 * l * g / p);
return a + Math.max(y * o, x * s)
}(n, o, a) : l;
return {
base: l + (0 === i) ? -1 : i,
top: c ? Math.max(u + r, l + i + 2) : l + r
}
}
Ln(Bu, "CanonicalTileID"),
Ln(Ru, "OverscaledTileID", {
omit: ["projMatrix"]
});
const Gu = Qo([{
name: "a_pos_normal",
components: 2,
type: "Int16"
}, {
name: "a_data",
components: 4,
type: "Uint8"
}, {
name: "a_linesofar",
components: 1,
type: "Float32"
}], 4)
, {members: $u} = Gu
, qu = Qo([{
name: "a_packed",
components: 4,
type: "Float32"
}])
, {members: Zu} = qu
, Wu = _u.VectorTileFeature.types
, Xu = Math.cos(Math.PI / 180 * 37.5);
class Hu {
constructor(e) {
this.zoom = e.zoom,
this.overscaling = e.overscaling,
this.layers = e.layers,
this.layerIds = this.layers.map((e=>e.id)),
this.index = e.index,
this.projection = e.projection,
this.hasPattern = !1,
this.patternFeatures = [],
this.lineClipsArray = [],
this.gradients = {},
this.layers.forEach((e=>{
this.gradients[e.id] = {}
}
)),
this.layoutVertexArray = new ns,
this.layoutVertexArray2 = new os,
this.indexArray = new gs,
this.programConfigurations = new da(e.layers,e.zoom),
this.segments = new wa,
this.maxLineLength = 0,
this.stateDependentLayerIds = this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))
}
populate(e, t, i, r) {
this.hasPattern = Qc("line", this.layers, t);
const n = this.layers[0].layout.get("line-sort-key")
, o = [];
for (const {feature: t, id: s, index: a, sourceLayerIndex: l} of e) {
const e = this.layers[0]._featureFilter.needGeometry
, c = Za(t, e);
if (!this.layers[0]._featureFilter.filter(new Lo(this.zoom), c, i))
continue;
const u = n ? n.evaluate(c, {}, i) : void 0
, h = {
id: s,
properties: t.properties,
type: t.type,
sourceLayerIndex: l,
index: a,
geometry: e ? c.geometry : qa(t, i, r),
patterns: {},
sortKey: u
};
o.push(h)
}
n && o.sort(((e,t)=>e.sortKey - t.sortKey));
const {lineAtlas: s, featureIndex: a} = t
, l = this.addConstantDashes(s);
for (const r of o) {
const {geometry: n, index: o, sourceLayerIndex: c} = r;
if (l && this.addFeatureDashes(r, s),
this.hasPattern) {
const e = eu("line", this.layers, r, this.zoom, t);
this.patternFeatures.push(e)
} else
this.addFeature(r, n, o, i, s.positions, t.availableImages);
a.insert(e[o].feature, n, o, c, this.index)
}
}
addConstantDashes(e) {
let t = !1;
for (const i of this.layers) {
const r = i.paint.get("line-dasharray").value
, n = i.layout.get("line-cap").value;
if ("constant" !== r.kind || "constant" !== n.kind)
t = !0;
else {
const t = n.value
, i = r.value;
if (!i)
continue;
e.addDash(i.from, t),
e.addDash(i.to, t),
i.other && e.addDash(i.other, t)
}
}
return t
}
addFeatureDashes(e, t) {
const i = this.zoom;
for (const r of this.layers) {
const n = r.paint.get("line-dasharray").value
, o = r.layout.get("line-cap").value;
if ("constant" === n.kind && "constant" === o.kind)
continue;
let s, a, l, c, u, h;
if ("constant" === n.kind) {
const e = n.value;
if (!e)
continue;
s = e.other || e.to,
a = e.to,
l = e.from
} else
s = n.evaluate({
zoom: i - 1
}, e),
a = n.evaluate({
zoom: i
}, e),
l = n.evaluate({
zoom: i + 1
}, e);
"constant" === o.kind ? c = u = h = o.value : (c = o.evaluate({
zoom: i - 1
}, e),
u = o.evaluate({
zoom: i
}, e),
h = o.evaluate({
zoom: i + 1
}, e)),
t.addDash(s, c),
t.addDash(a, u),
t.addDash(l, h);
const d = t.getKey(s, c)
, p = t.getKey(a, u)
, f = t.getKey(l, h);
e.patterns[r.id] = {
min: d,
mid: p,
max: f
}
}
}
update(e, t, i, r) {
this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(e, t, this.stateDependentLayers, i, r)
}
addFeatures(e, t, i, r, n) {
for (const e of this.patternFeatures)
this.addFeature(e, e.geometry, e.index, t, i, r)
}
isEmpty() {
return 0 === this.layoutVertexArray.length
}
uploadPending() {
return !this.uploaded || this.programConfigurations.needsUpload
}
upload(e) {
this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = e.createVertexBuffer(this.layoutVertexArray2, Zu)),
this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, $u),
this.indexBuffer = e.createIndexBuffer(this.indexArray)),
this.programConfigurations.upload(e),
this.uploaded = !0
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.programConfigurations.destroy(),
this.segments.destroy())
}
lineFeatureClips(e) {
if (e.properties && e.properties.hasOwnProperty("mapbox_clip_start") && e.properties.hasOwnProperty("mapbox_clip_end"))
return {
start: +e.properties.mapbox_clip_start,
end: +e.properties.mapbox_clip_end
}
}
addFeature(e, t, i, r, n, o) {
const s = this.layers[0].layout
, a = s.get("line-join").evaluate(e, {})
, l = s.get("line-cap").evaluate(e, {})
, c = s.get("line-miter-limit")
, u = s.get("line-round-limit");
this.lineClips = this.lineFeatureClips(e);
for (const i of t)
this.addLine(i, e, a, l, c, u);
this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e, i, n, o, r)
}
addLine(e, t, i, r, n, o) {
if (this.distance = 0,
this.scaledDistance = 0,
this.totalDistance = 0,
this.lineSoFar = 0,
this.lineClips) {
this.lineClipsArray.push(this.lineClips);
for (let t = 0; t < e.length - 1; t++)
this.totalDistance += e[t].dist(e[t + 1]);
this.updateScaledDistance(),
this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance)
}
const s = "Polygon" === Wu[t.type];
let a = e.length;
for (; a >= 2 && e[a - 1].equals(e[a - 2]); )
a--;
let l = 0;
for (; l < a - 1 && e[l].equals(e[l + 1]); )
l++;
if (a < (s ? 3 : 2))
return;
"bevel" === i && (n = 1.05);
const c = this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0
, u = this.segments.prepareSegment(10 * a, this.layoutVertexArray, this.indexArray);
let h, d, p, f, m;
this.e1 = this.e2 = -1,
s && (h = e[a - 2],
m = e[l].sub(h)._unit()._perp());
for (let t = l; t < a; t++) {
if (p = t === a - 1 ? s ? e[l + 1] : void 0 : e[t + 1],
p && e[t].equals(p))
continue;
m && (f = m),
h && (d = h),
h = e[t],
m = p ? p.sub(h)._unit()._perp() : f,
f = f || m;
let _ = f.add(m);
0 === _.x && 0 === _.y || _._unit();
const g = f.x * m.x + f.y * m.y
, y = _.x * m.x + _.y * m.y
, x = 0 !== y ? 1 / y : 1 / 0
, v = 2 * Math.sqrt(2 - 2 * y)
, b = y < Xu && d && p
, w = f.x * m.y - f.y * m.x > 0;
if (b && t > l) {
const e = h.dist(d);
if (e > 2 * c) {
const t = h.sub(h.sub(d)._mult(c / e)._round());
this.updateDistance(d, t),
this.addCurrentVertex(t, f, 0, 0, u),
d = t
}
}
const T = d && p;
let E = T ? i : s ? "butt" : r;
if (T && "round" === E && (x < o ? E = "miter" : x <= 2 && (E = "fakeround")),
"miter" === E && x > n && (E = "bevel"),
"bevel" === E && (x > 2 && (E = "flipbevel"),
x < n && (E = "miter")),
d && this.updateDistance(d, h),
"miter" === E)
_._mult(x),
this.addCurrentVertex(h, _, 0, 0, u);
else if ("flipbevel" === E) {
if (x > 100)
_ = m.mult(-1);
else {
const e = x * f.add(m).mag() / f.sub(m).mag();
_._perp()._mult(e * (w ? -1 : 1))
}
this.addCurrentVertex(h, _, 0, 0, u),
this.addCurrentVertex(h, _.mult(-1), 0, 0, u)
} else if ("bevel" === E || "fakeround" === E) {
const e = -Math.sqrt(x * x - 1)
, t = w ? e : 0
, i = w ? 0 : e;
if (d && this.addCurrentVertex(h, f, t, i, u),
"fakeround" === E) {
const e = Math.round(180 * v / Math.PI / 20);
for (let t = 1; t < e; t++) {
let i = t / e;
if (.5 !== i) {
const e = i - .5;
i += i * e * (i - 1) * ((1.0904 + g * (g * (3.55645 - 1.43519 * g) - 3.2452)) * e * e + (.848013 + g * (.215638 * g - 1.06021)))
}
const r = m.sub(f)._mult(i)._add(f)._unit()._mult(w ? -1 : 1);
this.addHalfVertex(h, r.x, r.y, !1, w, 0, u)
}
}
p && this.addCurrentVertex(h, m, -t, -i, u)
} else if ("butt" === E)
this.addCurrentVertex(h, _, 0, 0, u);
else if ("square" === E) {
const e = d ? 1 : -1;
d || this.addCurrentVertex(h, _, e, e, u),
this.addCurrentVertex(h, _, 0, 0, u),
d && this.addCurrentVertex(h, _, e, e, u)
} else
"round" === E && (d && (this.addCurrentVertex(h, f, 0, 0, u),
this.addCurrentVertex(h, f, 1, 1, u, !0)),
p && (this.addCurrentVertex(h, m, -1, -1, u, !0),
this.addCurrentVertex(h, m, 0, 0, u)));
if (b && t < a - 1) {
const e = h.dist(p);
if (e > 2 * c) {
const t = h.add(p.sub(h)._mult(c / e)._round());
this.updateDistance(h, t),
this.addCurrentVertex(t, m, 0, 0, u),
h = t
}
}
}
}
addCurrentVertex(e, t, i, r, n, o=!1) {
const s = t.y * r - t.x
, a = -t.y - t.x * r;
this.addHalfVertex(e, t.x + t.y * i, t.y - t.x * i, o, !1, i, n),
this.addHalfVertex(e, s, a, o, !0, -r, n)
}
addHalfVertex({x: e, y: t}, i, r, n, o, s, a) {
this.layoutVertexArray.emplaceBack((e << 1) + (n ? 1 : 0), (t << 1) + (o ? 1 : 0), Math.round(63 * i) + 128, Math.round(63 * r) + 128, 1 + (0 === s ? 0 : s < 0 ? -1 : 1), 0, this.lineSoFar),
this.lineClips && this.layoutVertexArray2.emplaceBack(this.scaledDistance, this.lineClipsArray.length, this.lineClips.start, this.lineClips.end);
const l = a.vertexLength++;
this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, l),
a.primitiveLength++),
o ? this.e2 = l : this.e1 = l
}
updateScaledDistance() {
if (this.lineClips) {
const e = this.totalDistance / (this.lineClips.end - this.lineClips.start);
this.scaledDistance = this.distance / this.totalDistance,
this.lineSoFar = e * this.lineClips.start + this.distance
} else
this.lineSoFar = this.distance
}
updateDistance(e, t) {
this.distance += e.dist(t),
this.updateScaledDistance()
}
}
Ln(Hu, "LineBucket", {
omit: ["layers", "patternFeatures"]
});
const Yu = new Xo({
"line-cap": new $o(Ze.layout_line["line-cap"]),
"line-join": new $o(Ze.layout_line["line-join"]),
"line-miter-limit": new Go(Ze.layout_line["line-miter-limit"]),
"line-round-limit": new Go(Ze.layout_line["line-round-limit"]),
"line-sort-key": new $o(Ze.layout_line["line-sort-key"])
});
var Ku = {
paint: new Xo({
"line-opacity": new $o(Ze.paint_line["line-opacity"]),
"line-color": new $o(Ze.paint_line["line-color"]),
"line-translate": new Go(Ze.paint_line["line-translate"]),
"line-translate-anchor": new Go(Ze.paint_line["line-translate-anchor"]),
"line-width": new $o(Ze.paint_line["line-width"]),
"line-gap-width": new $o(Ze.paint_line["line-gap-width"]),
"line-offset": new $o(Ze.paint_line["line-offset"]),
"line-blur": new $o(Ze.paint_line["line-blur"]),
"line-dasharray": new qo(Ze.paint_line["line-dasharray"]),
"line-pattern": new qo(Ze.paint_line["line-pattern"]),
"line-gradient": new Wo(Ze.paint_line["line-gradient"]),
"line-trim-offset": new Go(Ze.paint_line["line-trim-offset"])
}),
layout: Yu
};
const Ju = new class extends $o {
possiblyEvaluate(e, t) {
return t = new Lo(Math.floor(t.zoom),{
now: t.now,
fadeDuration: t.fadeDuration,
zoomHistory: t.zoomHistory,
transition: t.transition
}),
super.possiblyEvaluate(e, t)
}
evaluate(e, t, i, r) {
return t = v({}, t, {
zoom: Math.floor(t.zoom)
}),
super.evaluate(e, t, i, r)
}
}
(Ku.paint.properties["line-width"].specification);
function Qu(e, t) {
return t > 0 ? t + 2 * e : e
}
Ju.useIntegerZoom = !0;
const eh = Qo([{
name: "a_pos_offset",
components: 4,
type: "Int16"
}, {
name: "a_tex_size",
components: 4,
type: "Uint16"
}, {
name: "a_pixeloffset",
components: 4,
type: "Int16"
}], 4)
, th = Qo([{
name: "a_globe_anchor",
components: 3,
type: "Int16"
}, {
name: "a_globe_normal",
components: 3,
type: "Float32"
}], 4)
, ih = Qo([{
name: "a_projected_pos",
components: 4,
type: "Float32"
}], 4);
Qo([{
name: "a_fade_opacity",
components: 1,
type: "Uint32"
}], 4);
const rh = Qo([{
name: "a_placed",
components: 2,
type: "Uint8"
}, {
name: "a_shift",
components: 2,
type: "Float32"
}])
, nh = Qo([{
name: "a_size_scale",
components: 1,
type: "Float32"
}, {
name: "a_padding",
components: 2,
type: "Float32"
}]);
Qo([{
type: "Int16",
name: "projectedAnchorX"
}, {
type: "Int16",
name: "projectedAnchorY"
}, {
type: "Int16",
name: "projectedAnchorZ"
}, {
type: "Int16",
name: "tileAnchorX"
}, {
type: "Int16",
name: "tileAnchorY"
}, {
type: "Float32",
name: "x1"
}, {
type: "Float32",
name: "y1"
}, {
type: "Float32",
name: "x2"
}, {
type: "Float32",
name: "y2"
}, {
type: "Int16",
name: "padding"
}, {
type: "Uint32",
name: "featureIndex"
}, {
type: "Uint16",
name: "sourceLayerIndex"
}, {
type: "Uint16",
name: "bucketIndex"
}]);
const oh = Qo([{
name: "a_pos",
components: 3,
type: "Int16"
}, {
name: "a_anchor_pos",
components: 2,
type: "Int16"
}, {
name: "a_extrude",
components: 2,
type: "Int16"
}], 4)
, sh = Qo([{
name: "a_pos_2f",
components: 2,
type: "Float32"
}, {
name: "a_radius",
components: 1,
type: "Float32"
}, {
name: "a_flags",
components: 2,
type: "Int16"
}], 4);
Qo([{
name: "triangle",
components: 3,
type: "Uint16"
}]),
Qo([{
type: "Int16",
name: "projectedAnchorX"
}, {
type: "Int16",
name: "projectedAnchorY"
}, {
type: "Int16",
name: "projectedAnchorZ"
}, {
type: "Float32",
name: "tileAnchorX"
}, {
type: "Float32",
name: "tileAnchorY"
}, {
type: "Uint16",
name: "glyphStartIndex"
}, {
type: "Uint16",
name: "numGlyphs"
}, {
type: "Uint32",
name: "vertexStartIndex"
}, {
type: "Uint32",
name: "lineStartIndex"
}, {
type: "Uint32",
name: "lineLength"
}, {
type: "Uint16",
name: "segment"
}, {
type: "Uint16",
name: "lowerSize"
}, {
type: "Uint16",
name: "upperSize"
}, {
type: "Float32",
name: "lineOffsetX"
}, {
type: "Float32",
name: "lineOffsetY"
}, {
type: "Uint8",
name: "writingMode"
}, {
type: "Uint8",
name: "placedOrientation"
}, {
type: "Uint8",
name: "hidden"
}, {
type: "Uint32",
name: "crossTileID"
}, {
type: "Int16",
name: "associatedIconIndex"
}, {
type: "Uint8",
name: "flipState"
}]),
Qo([{
type: "Int16",
name: "projectedAnchorX"
}, {
type: "Int16",
name: "projectedAnchorY"
}, {
type: "Int16",
name: "projectedAnchorZ"
}, {
type: "Float32",
name: "tileAnchorX"
}, {
type: "Float32",
name: "tileAnchorY"
}, {
type: "Int16",
name: "rightJustifiedTextSymbolIndex"
}, {
type: "Int16",
name: "centerJustifiedTextSymbolIndex"
}, {
type: "Int16",
name: "leftJustifiedTextSymbolIndex"
}, {
type: "Int16",
name: "verticalPlacedTextSymbolIndex"
}, {
type: "Int16",
name: "placedIconSymbolIndex"
}, {
type: "Int16",
name: "verticalPlacedIconSymbolIndex"
}, {
type: "Uint16",
name: "key"
}, {
type: "Uint16",
name: "textBoxStartIndex"
}, {
type: "Uint16",
name: "textBoxEndIndex"
}, {
type: "Uint16",
name: "verticalTextBoxStartIndex"
}, {
type: "Uint16",
name: "verticalTextBoxEndIndex"
}, {
type: "Uint16",
name: "iconBoxStartIndex"
}, {
type: "Uint16",
name: "iconBoxEndIndex"
}, {
type: "Uint16",
name: "verticalIconBoxStartIndex"
}, {
type: "Uint16",
name: "verticalIconBoxEndIndex"
}, {
type: "Uint16",
name: "featureIndex"
}, {
type: "Uint16",
name: "numHorizontalGlyphVertices"
}, {
type: "Uint16",
name: "numVerticalGlyphVertices"
}, {
type: "Uint16",
name: "numIconVertices"
}, {
type: "Uint16",
name: "numVerticalIconVertices"
}, {
type: "Uint16",
name: "useRuntimeCollisionCircles"
}, {
type: "Uint32",
name: "crossTileID"
}, {
type: "Float32",
components: 2,
name: "textOffset"
}, {
type: "Float32",
name: "collisionCircleDiameter"
}]),
Qo([{
type: "Float32",
name: "offsetX"
}]),
Qo([{
type: "Int16",
name: "x"
}, {
type: "Int16",
name: "y"
}, {
type: "Int16",
name: "tileUnitDistanceFromAnchor"
}]);
var ah = 24;
const lh = 128;
function ch(e, t) {
const {expression: i} = t;
if ("constant" === i.kind)
return {
kind: "constant",
layoutSize: i.evaluate(new Lo(e + 1))
};
if ("source" === i.kind)
return {
kind: "source"
};
{
const {zoomStops: t, interpolationType: r} = i;
let n = 0;
for (; n < t.length && t[n] <= e; )
n++;
n = Math.max(0, n - 1);
let o = n;
for (; o < t.length && t[o] < e + 1; )
o++;
o = Math.min(t.length - 1, o);
const s = t[n]
, a = t[o];
return "composite" === i.kind ? {
kind: "composite",
minZoom: s,
maxZoom: a,
interpolationType: r
} : {
kind: "camera",
minZoom: s,
maxZoom: a,
minSize: i.evaluate(new Lo(s)),
maxSize: i.evaluate(new Lo(a)),
interpolationType: r
}
}
}
function uh(e, {uSize: t, uSizeT: i}, {lowerSize: r, upperSize: n}) {
return "source" === e.kind ? r / lh : "composite" === e.kind ? xi(r / lh, n / lh, i) : t
}
function hh(e, t) {
let i = 0
, r = 0;
if ("constant" === e.kind)
r = e.layoutSize;
else if ("source" !== e.kind) {
const {interpolationType: n, minZoom: o, maxZoom: s} = e
, a = n ? m(ji.interpolationFactor(n, t, o, s), 0, 1) : 0;
"camera" === e.kind ? r = xi(e.minSize, e.maxSize, a) : i = a
}
return {
uSizeT: i,
uSize: r
}
}
var dh = Object.freeze({
__proto__: null,
getSizeData: ch,
evaluateSizeForFeature: uh,
evaluateSizeForZoom: hh,
SIZE_PACK_FACTOR: lh
});
function ph(e, t, i) {
return e.sections.forEach((e=>{
e.text = function(e, t, i) {
const r = t.layout.get("text-transform").evaluate(i, {});
return "uppercase" === r ? e = e.toLocaleUpperCase() : "lowercase" === r && (e = e.toLocaleLowerCase()),
Do.applyArabicShaping && (e = Do.applyArabicShaping(e)),
e
}(e.text, t, i)
}
)),
e
}
const fh = {
"!": "︕",
"#": "#",
$: "$",
"%": "%",
"&": "&",
"(": "︵",
")": "︶",
"*": "*",
"+": "+",
",": "︐",
"-": "︲",
".": "・",
"/": "/",
":": "︓",
";": "︔",
"<": "︿",
"=": "=",
">": "﹀",
"?": "︖",
"@": "@",
"[": "﹇",
"\\": "\",
"]": "﹈",
"^": "^",
_: "︳",
"`": "`",
"{": "︷",
"|": "―",
"}": "︸",
"~": "~",
"¢": "¢",
"£": "£",
"¥": "¥",
"¦": "¦",
"¬": "¬",
"¯": " ̄",
"–": "︲",
"—": "︱",
"‘": "﹃",
"’": "﹄",
"“": "﹁",
"”": "﹂",
"…": "︙",
"‧": "・",
"₩": "₩",
"、": "︑",
"。": "︒",
"〈": "︿",
"〉": "﹀",
"《": "︽",
"》": "︾",
"「": "﹁",
"」": "﹂",
"『": "﹃",
"』": "﹄",
"【": "︻",
"】": "︼",
"〔": "︹",
"〕": "︺",
"〖": "︗",
"〗": "︘",
"!": "︕",
"(": "︵",
")": "︶",
",": "︐",
"-": "︲",
".": "・",
":": "︓",
";": "︔",
"<": "︿",
">": "﹀",
"?": "︖",
"[": "﹇",
"]": "﹈",
"_": "︳",
"{": "︷",
"|": "―",
"}": "︸",
"⦅": "︵",
"⦆": "︶",
"。": "︒",
"「": "﹁",
"」": "﹂"
};
function mh(e) {
return "︶" === e || "﹈" === e || "︸" === e || "﹄" === e || "﹂" === e || "︾" === e || "︼" === e || "︺" === e || "︘" === e || "﹀" === e || "︐" === e || "︓" === e || "︔" === e || "`" === e || " ̄" === e || "︑" === e || "︒" === e
}
function _h(e) {
return "︵" === e || "﹇" === e || "︷" === e || "﹃" === e || "﹁" === e || "︽" === e || "︻" === e || "︹" === e || "︗" === e || "︿" === e
}
var gh = function(e, t, i, r, n) {
var o, s, a = 8 * n - r - 1, l = (1 << a) - 1, c = l >> 1, u = -7, h = i ? n - 1 : 0, d = i ? -1 : 1, p = e[t + h];
for (h += d,
o = p & (1 << -u) - 1,
p >>= -u,
u += a; u > 0; o = 256 * o + e[t + h],
h += d,
u -= 8)
;
for (s = o & (1 << -u) - 1,
o >>= -u,
u += r; u > 0; s = 256 * s + e[t + h],
h += d,
u -= 8)
;
if (0 === o)
o = 1 - c;
else {
if (o === l)
return s ? NaN : 1 / 0 * (p ? -1 : 1);
s += Math.pow(2, r),
o -= c
}
return (p ? -1 : 1) * s * Math.pow(2, o - r)
}
, yh = function(e, t, i, r, n, o) {
var s, a, l, c = 8 * o - n - 1, u = (1 << c) - 1, h = u >> 1, d = 23 === n ? Math.pow(2, -24) - Math.pow(2, -77) : 0, p = r ? 0 : o - 1, f = r ? 1 : -1, m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
for (t = Math.abs(t),
isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0,
s = u) : (s = Math.floor(Math.log(t) / Math.LN2),
t * (l = Math.pow(2, -s)) < 1 && (s--,
l *= 2),
(t += s + h >= 1 ? d / l : d * Math.pow(2, 1 - h)) * l >= 2 && (s++,
l /= 2),
s + h >= u ? (a = 0,
s = u) : s + h >= 1 ? (a = (t * l - 1) * Math.pow(2, n),
s += h) : (a = t * Math.pow(2, h - 1) * Math.pow(2, n),
s = 0)); n >= 8; e[i + p] = 255 & a,
p += f,
a /= 256,
n -= 8)
;
for (s = s << n | a,
c += n; c > 0; e[i + p] = 255 & s,
p += f,
s /= 256,
c -= 8)
;
e[i + p - f] |= 128 * m
}
, xh = vh;
function vh(e) {
this.buf = ArrayBuffer.isView && ArrayBuffer.isView(e) ? e : new Uint8Array(e || 0),
this.pos = 0,
this.type = 0,
this.length = this.buf.length
}
vh.Varint = 0,
vh.Fixed64 = 1,
vh.Bytes = 2,
vh.Fixed32 = 5;
var bh = 4294967296
, wh = 1 / bh
, Th = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf8");
function Eh(e) {
return e.type === vh.Bytes ? e.readVarint() + e.pos : e.pos + 1
}
function Sh(e, t, i) {
return i ? 4294967296 * t + (e >>> 0) : 4294967296 * (t >>> 0) + (e >>> 0)
}
function Ch(e, t, i) {
var r = t <= 16383 ? 1 : t <= 2097151 ? 2 : t <= 268435455 ? 3 : Math.floor(Math.log(t) / (7 * Math.LN2));
i.realloc(r);
for (var n = i.pos - 1; n >= e; n--)
i.buf[n + r] = i.buf[n]
}
function Mh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeVarint(e[i])
}
function Ah(e, t) {
for (var i = 0; i < e.length; i++)
t.writeSVarint(e[i])
}
function Ih(e, t) {
for (var i = 0; i < e.length; i++)
t.writeFloat(e[i])
}
function zh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeDouble(e[i])
}
function kh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeBoolean(e[i])
}
function Ph(e, t) {
for (var i = 0; i < e.length; i++)
t.writeFixed32(e[i])
}
function Dh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeSFixed32(e[i])
}
function Lh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeFixed64(e[i])
}
function Bh(e, t) {
for (var i = 0; i < e.length; i++)
t.writeSFixed64(e[i])
}
function Oh(e, t) {
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + 16777216 * e[t + 3]
}
function Rh(e, t, i) {
e[i] = t,
e[i + 1] = t >>> 8,
e[i + 2] = t >>> 16,
e[i + 3] = t >>> 24
}
function Fh(e, t) {
return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + (e[t + 3] << 24)
}
function Uh(e, t, i) {
t.glyphs = [],
1 === e && i.readMessage(Vh, t)
}
function Vh(e, t, i) {
if (3 === e) {
const {id: e, bitmap: r, width: n, height: o, left: s, top: a, advance: l} = i.readMessage(jh, {});
t.glyphs.push({
id: e,
bitmap: new dc({
width: n + 6,
height: o + 6
},r),
metrics: {
width: n,
height: o,
left: s,
top: a,
advance: l
}
})
} else
4 === e ? t.ascender = i.readSVarint() : 5 === e && (t.descender = i.readSVarint())
}
function jh(e, t, i) {
1 === e ? t.id = i.readVarint() : 2 === e ? t.bitmap = i.readBytes() : 3 === e ? t.width = i.readVarint() : 4 === e ? t.height = i.readVarint() : 5 === e ? t.left = i.readSVarint() : 6 === e ? t.top = i.readSVarint() : 7 === e && (t.advance = i.readVarint())
}
function Nh(e) {
let t = 0
, i = 0;
for (const r of e)
t += r.w * r.h,
i = Math.max(i, r.w);
e.sort(((e,t)=>t.h - e.h));
const r = [{
x: 0,
y: 0,
w: Math.max(Math.ceil(Math.sqrt(t / .95)), i),
h: 1 / 0
}];
let n = 0
, o = 0;
for (const t of e)
for (let e = r.length - 1; e >= 0; e--) {
const i = r[e];
if (!(t.w > i.w || t.h > i.h)) {
if (t.x = i.x,
t.y = i.y,
o = Math.max(o, t.y + t.h),
n = Math.max(n, t.x + t.w),
t.w === i.w && t.h === i.h) {
const t = r.pop();
e < r.length && (r[e] = t)
} else
t.h === i.h ? (i.x += t.w,
i.w -= t.w) : t.w === i.w ? (i.y += t.h,
i.h -= t.h) : (r.push({
x: i.x + t.w,
y: i.y,
w: i.w - t.w,
h: t.h
}),
i.y += t.h,
i.h -= t.h);
break
}
}
return {
w: n,
h: o,
fill: t / (n * o) || 0
}
}
vh.prototype = {
destroy: function() {
this.buf = null
},
readFields: function(e, t, i) {
for (i = i || this.length; this.pos < i; ) {
var r = this.readVarint()
, n = r >> 3
, o = this.pos;
this.type = 7 & r,
e(n, t, this),
this.pos === o && this.skip(r)
}
return t
},
readMessage: function(e, t) {
return this.readFields(e, t, this.readVarint() + this.pos)
},
readFixed32: function() {
var e = Oh(this.buf, this.pos);
return this.pos += 4,
e
},
readSFixed32: function() {
var e = Fh(this.buf, this.pos);
return this.pos += 4,
e
},
readFixed64: function() {
var e = Oh(this.buf, this.pos) + Oh(this.buf, this.pos + 4) * bh;
return this.pos += 8,
e
},
readSFixed64: function() {
var e = Oh(this.buf, this.pos) + Fh(this.buf, this.pos + 4) * bh;
return this.pos += 8,
e
},
readFloat: function() {
var e = gh(this.buf, this.pos, !0, 23, 4);
return this.pos += 4,
e
},
readDouble: function() {
var e = gh(this.buf, this.pos, !0, 52, 8);
return this.pos += 8,
e
},
readVarint: function(e) {
var t, i, r = this.buf;
return t = 127 & (i = r[this.pos++]),
i < 128 ? t : (t |= (127 & (i = r[this.pos++])) << 7,
i < 128 ? t : (t |= (127 & (i = r[this.pos++])) << 14,
i < 128 ? t : (t |= (127 & (i = r[this.pos++])) << 21,
i < 128 ? t : function(e, t, i) {
var r, n, o = i.buf;
if (r = (112 & (n = o[i.pos++])) >> 4,
n < 128)
return Sh(e, r, t);
if (r |= (127 & (n = o[i.pos++])) << 3,
n < 128)
return Sh(e, r, t);
if (r |= (127 & (n = o[i.pos++])) << 10,
n < 128)
return Sh(e, r, t);
if (r |= (127 & (n = o[i.pos++])) << 17,
n < 128)
return Sh(e, r, t);
if (r |= (127 & (n = o[i.pos++])) << 24,
n < 128)
return Sh(e, r, t);
if (r |= (1 & (n = o[i.pos++])) << 31,
n < 128)
return Sh(e, r, t);
throw new Error("Expected varint not more than 10 bytes")
}(t |= (15 & (i = r[this.pos])) << 28, e, this))))
},
readVarint64: function() {
return this.readVarint(!0)
},
readSVarint: function() {
var e = this.readVarint();
return e % 2 == 1 ? (e + 1) / -2 : e / 2
},
readBoolean: function() {
return Boolean(this.readVarint())
},
readString: function() {
var e = this.readVarint() + this.pos
, t = this.pos;
return this.pos = e,
e - t >= 12 && Th ? function(e, t, i) {
return Th.decode(e.subarray(t, i))
}(this.buf, t, e) : function(e, t, i) {
for (var r = "", n = t; n < i; ) {
var o, s, a, l = e[n], c = null, u = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
if (n + u > i)
break;
1 === u ? l < 128 && (c = l) : 2 === u ? 128 == (192 & (o = e[n + 1])) && (c = (31 & l) << 6 | 63 & o) <= 127 && (c = null) : 3 === u ? (s = e[n + 2],
128 == (192 & (o = e[n + 1])) && 128 == (192 & s) && ((c = (15 & l) << 12 | (63 & o) << 6 | 63 & s) <= 2047 || c >= 55296 && c <= 57343) && (c = null)) : 4 === u && (s = e[n + 2],
a = e[n + 3],
128 == (192 & (o = e[n + 1])) && 128 == (192 & s) && 128 == (192 & a) && ((c = (15 & l) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) <= 65535 || c >= 1114112) && (c = null)),
null === c ? (c = 65533,
u = 1) : c > 65535 && (c -= 65536,
r += String.fromCharCode(c >>> 10 & 1023 | 55296),
c = 56320 | 1023 & c),
r += String.fromCharCode(c),
n += u
}
return r
}(this.buf, t, e)
},
readBytes: function() {
var e = this.readVarint() + this.pos
, t = this.buf.subarray(this.pos, e);
return this.pos = e,
t
},
readPackedVarint: function(e, t) {
if (this.type !== vh.Bytes)
return e.push(this.readVarint(t));
var i = Eh(this);
for (e = e || []; this.pos < i; )
e.push(this.readVarint(t));
return e
},
readPackedSVarint: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readSVarint());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readSVarint());
return e
},
readPackedBoolean: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readBoolean());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readBoolean());
return e
},
readPackedFloat: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readFloat());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readFloat());
return e
},
readPackedDouble: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readDouble());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readDouble());
return e
},
readPackedFixed32: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readFixed32());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readFixed32());
return e
},
readPackedSFixed32: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readSFixed32());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readSFixed32());
return e
},
readPackedFixed64: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readFixed64());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readFixed64());
return e
},
readPackedSFixed64: function(e) {
if (this.type !== vh.Bytes)
return e.push(this.readSFixed64());
var t = Eh(this);
for (e = e || []; this.pos < t; )
e.push(this.readSFixed64());
return e
},
skip: function(e) {
var t = 7 & e;
if (t === vh.Varint)
for (; this.buf[this.pos++] > 127; )
;
else if (t === vh.Bytes)
this.pos = this.readVarint() + this.pos;
else if (t === vh.Fixed32)
this.pos += 4;
else {
if (t !== vh.Fixed64)
throw new Error("Unimplemented type: " + t);
this.pos += 8
}
},
writeTag: function(e, t) {
this.writeVarint(e << 3 | t)
},
realloc: function(e) {
for (var t = this.length || 16; t < this.pos + e; )
t *= 2;
if (t !== this.length) {
var i = new Uint8Array(t);
i.set(this.buf),
this.buf = i,
this.length = t
}
},
finish: function() {
return this.length = this.pos,
this.pos = 0,
this.buf.subarray(0, this.length)
},
writeFixed32: function(e) {
this.realloc(4),
Rh(this.buf, e, this.pos),
this.pos += 4
},
writeSFixed32: function(e) {
this.realloc(4),
Rh(this.buf, e, this.pos),
this.pos += 4
},
writeFixed64: function(e) {
this.realloc(8),
Rh(this.buf, -1 & e, this.pos),
Rh(this.buf, Math.floor(e * wh), this.pos + 4),
this.pos += 8
},
writeSFixed64: function(e) {
this.realloc(8),
Rh(this.buf, -1 & e, this.pos),
Rh(this.buf, Math.floor(e * wh), this.pos + 4),
this.pos += 8
},
writeVarint: function(e) {
(e = +e || 0) > 268435455 || e < 0 ? function(e, t) {
var i, r;
if (e >= 0 ? (i = e % 4294967296 | 0,
r = e / 4294967296 | 0) : (r = ~(-e / 4294967296),
4294967295 ^ (i = ~(-e % 4294967296)) ? i = i + 1 | 0 : (i = 0,
r = r + 1 | 0)),
e >= 0x10000000000000000 || e < -0x10000000000000000)
throw new Error("Given varint doesn't fit into 10 bytes");
t.realloc(10),
function(e, t, i) {
i.buf[i.pos++] = 127 & e | 128,
e >>>= 7,
i.buf[i.pos++] = 127 & e | 128,
e >>>= 7,
i.buf[i.pos++] = 127 & e | 128,
e >>>= 7,
i.buf[i.pos++] = 127 & e | 128,
i.buf[i.pos] = 127 & (e >>>= 7)
}(i, 0, t),
function(e, t) {
var i = (7 & e) << 4;
t.buf[t.pos++] |= i | ((e >>>= 3) ? 128 : 0),
e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
e && (t.buf[t.pos++] = 127 & e | ((e >>>= 7) ? 128 : 0),
e && (t.buf[t.pos++] = 127 & e)))))
}(r, t)
}(e, this) : (this.realloc(4),
this.buf[this.pos++] = 127 & e | (e > 127 ? 128 : 0),
e <= 127 || (this.buf[this.pos++] = 127 & (e >>>= 7) | (e > 127 ? 128 : 0),
e <= 127 || (this.buf[this.pos++] = 127 & (e >>>= 7) | (e > 127 ? 128 : 0),
e <= 127 || (this.buf[this.pos++] = e >>> 7 & 127))))
},
writeSVarint: function(e) {
this.writeVarint(e < 0 ? 2 * -e - 1 : 2 * e)
},
writeBoolean: function(e) {
this.writeVarint(Boolean(e))
},
writeString: function(e) {
e = String(e),
this.realloc(4 * e.length),
this.pos++;
var t = this.pos;
this.pos = function(e, t, i) {
for (var r, n, o = 0; o < t.length; o++) {
if ((r = t.charCodeAt(o)) > 55295 && r < 57344) {
if (!n) {
r > 56319 || o + 1 === t.length ? (e[i++] = 239,
e[i++] = 191,
e[i++] = 189) : n = r;
continue
}
if (r < 56320) {
e[i++] = 239,
e[i++] = 191,
e[i++] = 189,
n = r;
continue
}
r = n - 55296 << 10 | r - 56320 | 65536,
n = null
} else
n && (e[i++] = 239,
e[i++] = 191,
e[i++] = 189,
n = null);
r < 128 ? e[i++] = r : (r < 2048 ? e[i++] = r >> 6 | 192 : (r < 65536 ? e[i++] = r >> 12 | 224 : (e[i++] = r >> 18 | 240,
e[i++] = r >> 12 & 63 | 128),
e[i++] = r >> 6 & 63 | 128),
e[i++] = 63 & r | 128)
}
return i
}(this.buf, e, this.pos);
var i = this.pos - t;
i >= 128 && Ch(t, i, this),
this.pos = t - 1,
this.writeVarint(i),
this.pos += i
},
writeFloat: function(e) {
this.realloc(4),
yh(this.buf, e, this.pos, !0, 23, 4),
this.pos += 4
},
writeDouble: function(e) {
this.realloc(8),
yh(this.buf, e, this.pos, !0, 52, 8),
this.pos += 8
},
writeBytes: function(e) {
var t = e.length;
this.writeVarint(t),
this.realloc(t);
for (var i = 0; i < t; i++)
this.buf[this.pos++] = e[i]
},
writeRawMessage: function(e, t) {
this.pos++;
var i = this.pos;
e(t, this);
var r = this.pos - i;
r >= 128 && Ch(i, r, this),
this.pos = i - 1,
this.writeVarint(r),
this.pos += r
},
writeMessage: function(e, t, i) {
this.writeTag(e, vh.Bytes),
this.writeRawMessage(t, i)
},
writePackedVarint: function(e, t) {
t.length && this.writeMessage(e, Mh, t)
},
writePackedSVarint: function(e, t) {
t.length && this.writeMessage(e, Ah, t)
},
writePackedBoolean: function(e, t) {
t.length && this.writeMessage(e, kh, t)
},
writePackedFloat: function(e, t) {
t.length && this.writeMessage(e, Ih, t)
},
writePackedDouble: function(e, t) {
t.length && this.writeMessage(e, zh, t)
},
writePackedFixed32: function(e, t) {
t.length && this.writeMessage(e, Ph, t)
},
writePackedSFixed32: function(e, t) {
t.length && this.writeMessage(e, Dh, t)
},
writePackedFixed64: function(e, t) {
t.length && this.writeMessage(e, Lh, t)
},
writePackedSFixed64: function(e, t) {
t.length && this.writeMessage(e, Bh, t)
},
writeBytesField: function(e, t) {
this.writeTag(e, vh.Bytes),
this.writeBytes(t)
},
writeFixed32Field: function(e, t) {
this.writeTag(e, vh.Fixed32),
this.writeFixed32(t)
},
writeSFixed32Field: function(e, t) {
this.writeTag(e, vh.Fixed32),
this.writeSFixed32(t)
},
writeFixed64Field: function(e, t) {
this.writeTag(e, vh.Fixed64),
this.writeFixed64(t)
},
writeSFixed64Field: function(e, t) {
this.writeTag(e, vh.Fixed64),
this.writeSFixed64(t)
},
writeVarintField: function(e, t) {
this.writeTag(e, vh.Varint),
this.writeVarint(t)
},
writeSVarintField: function(e, t) {
this.writeTag(e, vh.Varint),
this.writeSVarint(t)
},
writeStringField: function(e, t) {
this.writeTag(e, vh.Bytes),
this.writeString(t)
},
writeFloatField: function(e, t) {
this.writeTag(e, vh.Fixed32),
this.writeFloat(t)
},
writeDoubleField: function(e, t) {
this.writeTag(e, vh.Fixed64),
this.writeDouble(t)
},
writeBooleanField: function(e, t) {
this.writeVarintField(e, Boolean(t))
}
};
class Gh {
constructor(e, {pixelRatio: t, version: i, stretchX: r, stretchY: n, content: o}) {
this.paddedRect = e,
this.pixelRatio = t,
this.stretchX = r,
this.stretchY = n,
this.content = o,
this.version = i
}
get tl() {
return [this.paddedRect.x + 1, this.paddedRect.y + 1]
}
get br() {
return [this.paddedRect.x + this.paddedRect.w - 1, this.paddedRect.y + this.paddedRect.h - 1]
}
get displaySize() {
return [(this.paddedRect.w - 2) / this.pixelRatio, (this.paddedRect.h - 2) / this.pixelRatio]
}
}
class $h {
constructor(e, t) {
const i = {}
, r = {};
this.haveRenderCallbacks = [];
const n = [];
this.addImages(e, i, n),
this.addImages(t, r, n);
const {w: o, h: s} = Nh(n)
, a = new pc({
width: o || 1,
height: s || 1
});
for (const t in e) {
const r = e[t]
, n = i[t].paddedRect;
pc.copy(r.data, a, {
x: 0,
y: 0
}, {
x: n.x + 1,
y: n.y + 1
}, r.data)
}
for (const e in t) {
const i = t[e]
, n = r[e].paddedRect
, o = n.x + 1
, s = n.y + 1
, l = i.data.width
, c = i.data.height;
pc.copy(i.data, a, {
x: 0,
y: 0
}, {
x: o,
y: s
}, i.data),
pc.copy(i.data, a, {
x: 0,
y: c - 1
}, {
x: o,
y: s - 1
}, {
width: l,
height: 1
}),
pc.copy(i.data, a, {
x: 0,
y: 0
}, {
x: o,
y: s + c
}, {
width: l,
height: 1
}),
pc.copy(i.data, a, {
x: l - 1,
y: 0
}, {
x: o - 1,
y: s
}, {
width: 1,
height: c
}),
pc.copy(i.data, a, {
x: 0,
y: 0
}, {
x: o + l,
y: s
}, {
width: 1,
height: c
})
}
this.image = a,
this.iconPositions = i,
this.patternPositions = r
}
addImages(e, t, i) {
for (const r in e) {
const n = e[r]
, o = {
x: 0,
y: 0,
w: n.data.width + 2,
h: n.data.height + 2
};
i.push(o),
t[r] = new Gh(o,n),
n.hasRenderCallback && this.haveRenderCallbacks.push(r)
}
}
patchUpdatedImages(e, t) {
this.haveRenderCallbacks = this.haveRenderCallbacks.filter((t=>e.hasImage(t))),
e.dispatchRenderCallbacks(this.haveRenderCallbacks);
for (const i in e.updatedImages)
this.patchUpdatedImage(this.iconPositions[i], e.getImage(i), t),
this.patchUpdatedImage(this.patternPositions[i], e.getImage(i), t)
}
patchUpdatedImage(e, t, i) {
if (!e || !t)
return;
if (e.version === t.version)
return;
e.version = t.version;
const [r,n] = e.tl;
i.update(t.data, void 0, {
x: r,
y: n
})
}
}
Ln(Gh, "ImagePosition"),
Ln($h, "ImageAtlas");
const qh = {
horizontal: 1,
vertical: 2,
horizontalOnly: 3
};
class Zh {
constructor() {
this.scale = 1,
this.fontStack = "",
this.imageName = null
}
static forText(e, t) {
const i = new Zh;
return i.scale = e || 1,
i.fontStack = t,
i
}
static forImage(e) {
const t = new Zh;
return t.imageName = e,
t
}
}
class Wh {
constructor() {
this.text = "",
this.sectionIndex = [],
this.sections = [],
this.imageSectionID = null
}
static fromFeature(e, t) {
const i = new Wh;
for (let r = 0; r < e.sections.length; r++) {
const n = e.sections[r];
n.image ? i.addImageSection(n) : i.addTextSection(n, t)
}
return i
}
length() {
return this.text.length
}
getSection(e) {
return this.sections[this.sectionIndex[e]]
}
getSections() {
return this.sections
}
getSectionIndex(e) {
return this.sectionIndex[e]
}
getCharCode(e) {
return this.text.charCodeAt(e)
}
verticalizePunctuation(e) {
this.text = function(e, t) {
let i = "";
for (let r = 0; r < e.length; r++) {
const n = e.charCodeAt(r + 1) || null
, o = e.charCodeAt(r - 1) || null;
i += !t && (n && yo(n) && !fh[e[r + 1]] || o && yo(o) && !fh[e[r - 1]]) || !fh[e[r]] ? e[r] : fh[e[r]]
}
return i
}(this.text, e)
}
trim() {
let e = 0;
for (let t = 0; t < this.text.length && Hh[this.text.charCodeAt(t)]; t++)
e++;
let t = this.text.length;
for (let i = this.text.length - 1; i >= 0 && i >= e && Hh[this.text.charCodeAt(i)]; i--)
t--;
this.text = this.text.substring(e, t),
this.sectionIndex = this.sectionIndex.slice(e, t)
}
substring(e, t) {
const i = new Wh;
return i.text = this.text.substring(e, t),
i.sectionIndex = this.sectionIndex.slice(e, t),
i.sections = this.sections,
i
}
toString() {
return this.text
}
getMaxScale() {
return this.sectionIndex.reduce(((e,t)=>Math.max(e, this.sections[t].scale)), 0)
}
addTextSection(e, t) {
this.text += e.text,
this.sections.push(Zh.forText(e.scale, e.fontStack || t));
const i = this.sections.length - 1;
for (let t = 0; t < e.text.length; ++t)
this.sectionIndex.push(i)
}
addImageSection(e) {
const t = e.image ? e.image.name : "";
if (0 === t.length)
return void P("Can't add FormattedSection with an empty image.");
const i = this.getNextImageSectionCharCode();
i ? (this.text += String.fromCharCode(i),
this.sections.push(Zh.forImage(t)),
this.sectionIndex.push(this.sections.length - 1)) : P("Reached maximum number of images 6401")
}
getNextImageSectionCharCode() {
return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344,
this.imageSectionID)
}
}
function Xh(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m) {
const _ = Wh.fromFeature(e, n);
let g;
h === qh.vertical && _.verticalizePunctuation(d);
const {processBidirectionalText: y, processStyledBidirectionalText: x} = Do;
if (y && 1 === _.sections.length) {
g = [];
const e = y(_.toString(), id(_, c, o, t, r, p, f));
for (const t of e) {
const e = new Wh;
e.text = t,
e.sections = _.sections;
for (let i = 0; i < t.length; i++)
e.sectionIndex.push(0);
g.push(e)
}
} else if (x) {
g = [];
const e = x(_.text, _.sectionIndex, id(_, c, o, t, r, p, f));
for (const t of e) {
const e = new Wh;
e.text = t[0],
e.sectionIndex = t[1],
e.sections = _.sections,
g.push(e)
}
} else
g = function(e, t) {
const i = []
, r = e.text;
let n = 0;
for (const r of t)
i.push(e.substring(n, r)),
n = r;
return n < r.length && i.push(e.substring(n, r.length)),
i
}(_, id(_, c, o, t, r, p, f));
const v = []
, b = {
positionedLines: v,
text: _.toString(),
top: u[1],
bottom: u[1],
left: u[0],
right: u[0],
writingMode: h,
iconsInText: !1,
verticalizable: !1,
hasBaseline: !1
};
return function(e, t, i, r, n, o, s, a, l, c, u, h) {
let d = 0
, p = 0
, f = 0;
const m = "right" === a ? 1 : "left" === a ? 0 : .5;
let _ = !1;
for (const e of n) {
const i = e.getSections();
for (const e of i) {
if (e.imageName)
continue;
const i = t[e.fontStack];
if (i && (_ = void 0 !== i.ascender && void 0 !== i.descender,
!_))
break
}
if (!_)
break
}
let g = 0;
for (const s of n) {
s.trim();
const n = s.getMaxScale()
, a = (n - 1) * ah
, x = {
positionedGlyphs: [],
lineOffset: 0
};
e.positionedLines[g] = x;
const v = x.positionedGlyphs;
let b = 0;
if (!s.length()) {
p += o,
++g;
continue
}
let w = 0
, T = 0;
for (let o = 0; o < s.length(); o++) {
const a = s.getSection(o)
, f = s.getSectionIndex(o)
, m = s.getCharCode(o);
let g = a.scale
, x = null
, E = null
, S = null
, C = ah
, M = 0;
const A = !(l === qh.horizontal || !u && !go(m) || u && (Hh[m] || (y = m,
Vn(y) || jn(y) || Nn(y) || ao(y) || ho(y))));
if (a.imageName) {
const t = r[a.imageName];
if (!t)
continue;
S = a.imageName,
e.iconsInText = e.iconsInText || !0,
E = t.paddedRect;
const i = t.displaySize;
g = g * ah / h,
x = {
width: i[0],
height: i[1],
left: 1,
top: -3,
advance: A ? i[1] : i[0],
localGlyph: !1
},
M = _ ? -x.height * g : n * ah - 17 - i[1] * g,
C = x.advance;
const o = (A ? i[0] : i[1]) * g - ah * n;
o > 0 && o > b && (b = o)
} else {
const e = i[a.fontStack];
if (!e)
continue;
e[m] && (E = e[m]);
const r = t[a.fontStack];
if (!r)
continue;
const o = r.glyphs[m];
if (!o)
continue;
if (x = o.metrics,
C = 8203 !== m ? ah : 0,
_) {
const e = void 0 !== r.ascender ? Math.abs(r.ascender) : 0
, t = void 0 !== r.descender ? Math.abs(r.descender) : 0
, i = (e + t) * g;
w < i && (w = i,
T = (e - t) / 2 * g),
M = -e * g
} else
M = (n - g) * ah - 17
}
A ? (e.verticalizable = !0,
v.push({
glyph: m,
imageName: S,
x: d,
y: p + M,
vertical: A,
scale: g,
localGlyph: x.localGlyph,
fontStack: a.fontStack,
sectionIndex: f,
metrics: x,
rect: E
}),
d += C * g + c) : (v.push({
glyph: m,
imageName: S,
x: d,
y: p + M,
vertical: A,
scale: g,
localGlyph: x.localGlyph,
fontStack: a.fontStack,
sectionIndex: f,
metrics: x,
rect: E
}),
d += x.advance * g + c)
}
0 !== v.length && (f = Math.max(d - c, f),
_ ? nd(v, m, b, T, o * n / 2) : nd(v, m, b, 0, o / 2)),
d = 0;
const E = o * n + b;
x.lineOffset = Math.max(b, a),
p += E,
++g
}
var y;
const x = p
, {horizontalAlign: v, verticalAlign: b} = rd(s);
(function(e, t, i, r, n, o) {
const s = (t - i) * n
, a = -o * r;
for (const t of e)
for (const e of t.positionedGlyphs)
e.x += s,
e.y += a
}
)(e.positionedLines, m, v, b, f, x),
e.top += -b * x,
e.bottom = e.top + x,
e.left += -v * f,
e.right = e.left + f,
e.hasBaseline = _
}(b, t, i, r, g, s, a, l, h, c, d, m),
!function(e) {
for (const t of e)
if (0 !== t.positionedGlyphs.length)
return !1;
return !0
}(v) && b
}
const Hh = {
9: !0,
10: !0,
11: !0,
12: !0,
13: !0,
32: !0
}
, Yh = {
10: !0,
32: !0,
38: !0,
40: !0,
41: !0,
43: !0,
45: !0,
47: !0,
173: !0,
183: !0,
8203: !0,
8208: !0,
8211: !0,
8231: !0
};
function Kh(e, t, i, r, n, o) {
if (t.imageName) {
const e = r[t.imageName];
return e ? e.displaySize[0] * t.scale * ah / o + n : 0
}
{
const r = i[t.fontStack]
, o = r && r.glyphs[e];
return o ? o.metrics.advance * t.scale + n : 0
}
}
function Jh(e, t, i, r) {
const n = Math.pow(e - t, 2);
return r ? e < t ? n / 2 : 2 * n : n + Math.abs(i) * i
}
function Qh(e, t, i) {
let r = 0;
return 10 === e && (r -= 1e4),
i && (r += 150),
40 !== e && 65288 !== e || (r += 50),
41 !== t && 65289 !== t || (r += 50),
r
}
function ed(e, t, i, r, n, o) {
let s = null
, a = Jh(t, i, n, o);
for (const e of r) {
const r = Jh(t - e.x, i, n, o) + e.badness;
r <= a && (s = e,
a = r)
}
return {
index: e,
x: t,
priorBreak: s,
badness: a
}
}
function td(e) {
return e ? td(e.priorBreak).concat(e.index) : []
}
function id(e, t, i, r, n, o, s) {
if ("point" !== o)
return [];
if (!e)
return [];
const a = []
, l = function(e, t, i, r, n, o) {
let s = 0;
for (let i = 0; i < e.length(); i++) {
const a = e.getSection(i);
s += Kh(e.getCharCode(i), a, r, n, t, o)
}
return s / Math.max(1, Math.ceil(s / i))
}(e, t, i, r, n, s)
, c = e.text.indexOf("") >= 0;
let u = 0;
for (let i = 0; i < e.length(); i++) {
const o = e.getSection(i)
, d = e.getCharCode(i);
if (Hh[d] || (u += Kh(d, o, r, n, t, s)),
i < e.length() - 1) {
const t = !((h = d) < 11904 || !(Yn(h) || Hn(h) || co(h) || so(h) || eo(h) || Gn(h) || Kn(h) || Zn(h) || to(h) || io(h) || Qn(h) || po(h) || Wn(h) || qn(h) || $n(h) || Jn(h) || Xn(h) || lo(h) || no(h) || ro(h)));
(Yh[d] || t || o.imageName) && a.push(ed(i + 1, u, l, a, Qh(d, e.getCharCode(i + 1), t && c), !1))
}
}
var h;
return td(ed(e.length(), u, l, a, 0, !0))
}
function rd(e) {
let t = .5
, i = .5;
switch (e) {
case "right":
case "top-right":
case "bottom-right":
t = 1;
break;
case "left":
case "top-left":
case "bottom-left":
t = 0
}
switch (e) {
case "bottom":
case "bottom-right":
case "bottom-left":
i = 1;
break;
case "top":
case "top-right":
case "top-left":
i = 0
}
return {
horizontalAlign: t,
verticalAlign: i
}
}
function nd(e, t, i, r, n) {
if (!(t || i || r || n))
return;
const o = e.length - 1
, s = e[o]
, a = (s.x + s.metrics.advance * s.scale) * t;
for (let t = 0; t <= o; t++)
e[t].x -= a,
e[t].y += i + r + n
}
function od(e, t, i) {
const {horizontalAlign: r, verticalAlign: n} = rd(i)
, o = t[0] - e.displaySize[0] * r
, s = t[1] - e.displaySize[1] * n;
return {
image: e,
top: s,
bottom: s + e.displaySize[1],
left: o,
right: o + e.displaySize[0]
}
}
function sd(e, t, i, r, n, o) {
const s = e.image;
let a;
if (s.content) {
const e = s.content
, t = s.pixelRatio || 1;
a = [e[0] / t, e[1] / t, s.displaySize[0] - e[2] / t, s.displaySize[1] - e[3] / t]
}
const l = t.left * o
, c = t.right * o;
let u, h, d, p;
"width" === i || "both" === i ? (p = n[0] + l - r[3],
h = n[0] + c + r[1]) : (p = n[0] + (l + c - s.displaySize[0]) / 2,
h = p + s.displaySize[0]);
const f = t.top * o
, m = t.bottom * o;
return "height" === i || "both" === i ? (u = n[1] + f - r[0],
d = n[1] + m + r[2]) : (u = n[1] + (f + m - s.displaySize[1]) / 2,
d = u + s.displaySize[1]),
{
image: s,
top: u,
right: h,
bottom: d,
left: p,
collisionPadding: a
}
}
class ad extends o {
constructor(e, t, i, r, n) {
super(e, t),
this.angle = r,
this.z = i,
void 0 !== n && (this.segment = n)
}
clone() {
return new ad(this.x,this.y,this.z,this.angle,this.segment)
}
}
function ld(e, t, i, r, n) {
if (void 0 === t.segment)
return !0;
let o = t
, s = t.segment + 1
, a = 0;
for (; a > -i / 2; ) {
if (s--,
s < 0)
return !1;
a -= e[s].dist(o),
o = e[s]
}
a += e[s].dist(e[s + 1]),
s++;
const l = [];
let c = 0;
for (; a < i / 2; ) {
const t = e[s]
, i = e[s + 1];
if (!i)
return !1;
let o = e[s - 1].angleTo(t) - t.angleTo(i);
for (o = Math.abs((o + 3 * Math.PI) % (2 * Math.PI) - Math.PI),
l.push({
distance: a,
angleDelta: o
}),
c += o; a - l[0].distance > r; )
c -= l.shift().angleDelta;
if (c > n)
return !1;
s++,
a += t.dist(i)
}
return !0
}
function cd(e) {
let t = 0;
for (let i = 0; i < e.length - 1; i++)
t += e[i].dist(e[i + 1]);
return t
}
function ud(e, t, i) {
return e ? .6 * t * i : 0
}
function hd(e, t) {
return Math.max(e ? e.right - e.left : 0, t ? t.right - t.left : 0)
}
function dd(e, t, i, r, n, o) {
const s = ud(i, n, o)
, a = hd(i, r) * o;
let l = 0;
const c = cd(e) / 2;
for (let i = 0; i < e.length - 1; i++) {
const r = e[i]
, n = e[i + 1]
, o = r.dist(n);
if (l + o > c) {
const u = (c - l) / o
, h = xi(r.x, n.x, u)
, d = xi(r.y, n.y, u)
, p = new ad(h,d,0,n.angleTo(r),i);
return !s || ld(e, p, a, s, t) ? p : void 0
}
l += o
}
}
function pd(e, t, i, r, n, o, s, a, l) {
const c = ud(r, o, s)
, u = hd(r, n)
, h = u * s
, d = 0 === e[0].x || e[0].x === l || 0 === e[0].y || e[0].y === l;
return t - h < t / 4 && (t = h + t / 4),
fd(e, d ? t / 2 * a % t : (u / 2 + 2 * o) * s * a % t, t, c, i, h, d, !1, l)
}
function fd(e, t, i, r, n, o, s, a, l) {
const c = o / 2
, u = cd(e);
let h = 0
, d = t - i
, p = [];
for (let t = 0; t < e.length - 1; t++) {
const s = e[t]
, a = e[t + 1]
, f = s.dist(a)
, m = a.angleTo(s);
for (; d + i < h + f; ) {
d += i;
const _ = (d - h) / f
, g = xi(s.x, a.x, _)
, y = xi(s.y, a.y, _);
if (g >= 0 && g < l && y >= 0 && y < l && d - c >= 0 && d + c <= u) {
const i = new ad(g,y,0,m,t);
i._round(),
r && !ld(e, i, o, r, n) || p.push(i)
}
}
h += f
}
return a || p.length || s || (p = fd(e, h / 2, i, r, n, o, s, !0, l)),
p
}
function md(e, t, i, r, n) {
const s = [];
for (let a = 0; a < e.length; a++) {
const l = e[a];
let c;
for (let e = 0; e < l.length - 1; e++) {
let a = l[e]
, u = l[e + 1];
a.x < t && u.x < t || (a.x < t ? a = new o(t,a.y + (t - a.x) / (u.x - a.x) * (u.y - a.y))._round() : u.x < t && (u = new o(t,a.y + (t - a.x) / (u.x - a.x) * (u.y - a.y))._round()),
a.y < i && u.y < i || (a.y < i ? a = new o(a.x + (i - a.y) / (u.y - a.y) * (u.x - a.x),i)._round() : u.y < i && (u = new o(a.x + (i - a.y) / (u.y - a.y) * (u.x - a.x),i)._round()),
a.x >= r && u.x >= r || (a.x >= r ? a = new o(r,a.y + (r - a.x) / (u.x - a.x) * (u.y - a.y))._round() : u.x >= r && (u = new o(r,a.y + (r - a.x) / (u.x - a.x) * (u.y - a.y))._round()),
a.y >= n && u.y >= n || (a.y >= n ? a = new o(a.x + (n - a.y) / (u.y - a.y) * (u.x - a.x),n)._round() : u.y >= n && (u = new o(a.x + (n - a.y) / (u.y - a.y) * (u.x - a.x),n)._round()),
c && a.equals(c[c.length - 1]) || (c = [a],
s.push(c)),
c.push(u)))))
}
}
return s
}
Ln(ad, "Anchor");
const _d = 1e20;
function gd(e, t, i, r, n, o, s, a, l) {
for (let c = t; c < t + r; c++)
yd(e, i * o + c, o, n, s, a, l);
for (let c = i; c < i + n; c++)
yd(e, c * o + t, 1, r, s, a, l)
}
function yd(e, t, i, r, n, o, s) {
o[0] = 0,
s[0] = -_d,
s[1] = _d,
n[0] = e[t];
for (let a = 1, l = 0, c = 0; a < r; a++) {
n[a] = e[t + a * i];
const r = a * a;
do {
const e = o[l];
c = (n[a] - n[e] + r - e * e) / (a - e) / 2
} while (c <= s[l] && --l > -1);
l++,
o[l] = a,
s[l] = c,
s[l + 1] = _d
}
for (let a = 0, l = 0; a < r; a++) {
for (; s[l + 1] < a; )
l++;
const r = o[l]
, c = a - r;
e[t + a * i] = n[r] + c * c
}
}
const xd = {
none: 0,
ideographs: 1,
all: 2
};
class vd {
constructor(e, t, i) {
this.requestManager = e,
this.localGlyphMode = t,
this.localFontFamily = i,
this.entries = {},
this.localGlyphs = {
200: {},
400: {},
500: {},
900: {}
}
}
setURL(e) {
this.url = e
}
getGlyphs(e, t) {
const i = [];
for (const t in e)
for (const r of e[t])
i.push({
stack: t,
id: r
});
y(i, (({stack: e, id: t},i)=>{
let r = this.entries[e];
r || (r = this.entries[e] = {
glyphs: {},
requests: {},
ranges: {},
ascender: void 0,
descender: void 0
});
let n = r.glyphs[t];
if (void 0 !== n)
return void i(null, {
stack: e,
id: t,
glyph: n
});
if (n = this._tinySDF(r, e, t),
n)
return r.glyphs[t] = n,
void i(null, {
stack: e,
id: t,
glyph: n
});
const o = Math.floor(t / 256);
if (256 * o > 65535)
return void i(new Error("glyphs > 65535 not supported"));
if (r.ranges[o])
return void i(null, {
stack: e,
id: t,
glyph: n
});
let s = r.requests[o];
s || (s = r.requests[o] = [],
vd.loadGlyphRange(e, o, this.url, this.requestManager, ((e,t)=>{
if (t) {
r.ascender = t.ascender,
r.descender = t.descender;
for (const e in t.glyphs)
this._doesCharSupportLocalGlyph(+e) || (r.glyphs[+e] = t.glyphs[+e]);
r.ranges[o] = !0
}
for (const i of s)
i(e, t);
delete r.requests[o]
}
))),
s.push(((r,n)=>{
r ? i(r) : n && i(null, {
stack: e,
id: t,
glyph: n.glyphs[t] || null
})
}
))
}
), ((e,i)=>{
if (e)
t(e);
else if (i) {
const e = {};
for (const {stack: t, id: r, glyph: n} of i)
void 0 === e[t] && (e[t] = {}),
void 0 === e[t].glyphs && (e[t].glyphs = {}),
e[t].glyphs[r] = n && {
id: n.id,
bitmap: n.bitmap.clone(),
metrics: n.metrics
},
e[t].ascender = this.entries[t].ascender,
e[t].descender = this.entries[t].descender;
t(null, e)
}
}
))
}
_doesCharSupportLocalGlyph(e) {
return this.localGlyphMode !== xd.none && (this.localGlyphMode === xd.all ? !!this.localFontFamily : !!this.localFontFamily && (io(e) || oo(e) || Wn(e) || Xn(e) || Zn(e)))
}
_tinySDF(e, t, i) {
const r = this.localFontFamily;
if (!r || !this._doesCharSupportLocalGlyph(i))
return;
let n = e.tinySDF;
if (!n) {
let i = "400";
/bold/i.test(t) ? i = "900" : /medium/i.test(t) ? i = "500" : /light/i.test(t) && (i = "200"),
n = e.tinySDF = new vd.TinySDF({
fontFamily: r,
fontWeight: i,
fontSize: 48,
buffer: 6,
radius: 16
}),
n.fontWeight = i
}
if (this.localGlyphs[n.fontWeight][i])
return this.localGlyphs[n.fontWeight][i];
const o = String.fromCharCode(i)
, {data: s, width: a, height: l, glyphWidth: c, glyphHeight: u, glyphLeft: h, glyphTop: d, glyphAdvance: p} = n.draw(o);
return this.localGlyphs[n.fontWeight][i] = {
id: i,
bitmap: new dc({
width: a,
height: l
},s),
metrics: {
width: c / 2,
height: u / 2,
left: h / 2,
top: d / 2 - 27,
advance: p / 2,
localGlyph: !0
}
}
}
}
function bd(e, t, i, r) {
const n = []
, s = e.image
, a = s.pixelRatio
, l = s.paddedRect.w - 2
, c = s.paddedRect.h - 2
, u = e.right - e.left
, h = e.bottom - e.top
, d = s.stretchX || [[0, l]]
, p = s.stretchY || [[0, c]]
, f = (e,t)=>e + t[1] - t[0]
, m = d.reduce(f, 0)
, _ = p.reduce(f, 0)
, g = l - m
, y = c - _;
let x = 0
, v = m
, b = 0
, w = _
, T = 0
, E = g
, S = 0
, C = y;
if (s.content && r) {
const e = s.content;
x = wd(d, 0, e[0]),
b = wd(p, 0, e[1]),
v = wd(d, e[0], e[2]),
w = wd(p, e[1], e[3]),
T = e[0] - x,
S = e[1] - b,
E = e[2] - e[0] - v,
C = e[3] - e[1] - w
}
const M = (r,n,l,c)=>{
const d = Ed(r.stretch - x, v, u, e.left)
, p = Sd(r.fixed - T, E, r.stretch, m)
, f = Ed(n.stretch - b, w, h, e.top)
, g = Sd(n.fixed - S, C, n.stretch, _)
, y = Ed(l.stretch - x, v, u, e.left)
, M = Sd(l.fixed - T, E, l.stretch, m)
, A = Ed(c.stretch - b, w, h, e.top)
, I = Sd(c.fixed - S, C, c.stretch, _)
, z = new o(d,f)
, k = new o(y,f)
, P = new o(y,A)
, D = new o(d,A)
, L = new o(p / a,g / a)
, B = new o(M / a,I / a)
, O = t * Math.PI / 180;
if (O) {
const e = Math.sin(O)
, t = Math.cos(O)
, i = [t, -e, e, t];
z._matMult(i),
k._matMult(i),
D._matMult(i),
P._matMult(i)
}
const R = r.stretch + r.fixed
, F = n.stretch + n.fixed;
return {
tl: z,
tr: k,
bl: D,
br: P,
tex: {
x: s.paddedRect.x + 1 + R,
y: s.paddedRect.y + 1 + F,
w: l.stretch + l.fixed - R,
h: c.stretch + c.fixed - F
},
writingMode: void 0,
glyphOffset: [0, 0],
sectionIndex: 0,
pixelOffsetTL: L,
pixelOffsetBR: B,
minFontScaleX: E / a / u,
minFontScaleY: C / a / h,
isSDF: i
}
}
;
if (r && (s.stretchX || s.stretchY)) {
const e = Td(d, g, m)
, t = Td(p, y, _);
for (let i = 0; i < e.length - 1; i++) {
const r = e[i]
, o = e[i + 1];
for (let e = 0; e < t.length - 1; e++)
n.push(M(r, t[e], o, t[e + 1]))
}
} else
n.push(M({
fixed: 0,
stretch: -1
}, {
fixed: 0,
stretch: -1
}, {
fixed: 0,
stretch: l + 1
}, {
fixed: 0,
stretch: c + 1
}));
return n
}
function wd(e, t, i) {
let r = 0;
for (const n of e)
r += Math.max(t, Math.min(i, n[1])) - Math.max(t, Math.min(i, n[0]));
return r
}
function Td(e, t, i) {
const r = [{
fixed: -1,
stretch: 0
}];
for (const [t,i] of e) {
const e = r[r.length - 1];
r.push({
fixed: t - e.stretch,
stretch: e.stretch
}),
r.push({
fixed: t - e.stretch,
stretch: e.stretch + (i - t)
})
}
return r.push({
fixed: t + 1,
stretch: i
}),
r
}
function Ed(e, t, i, r) {
return e / t * i + r
}
function Sd(e, t, i, r) {
return e - t * i / r
}
function Cd(e, t, i, r) {
const n = t + e.positionedLines[r].lineOffset;
return 0 === r ? i + n / 2 : i + (n + (t + e.positionedLines[r - 1].lineOffset)) / 2
}
vd.loadGlyphRange = function(e, t, i, r, n) {
const o = 256 * t
, s = o + 255
, a = r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}", e).replace("{range}", `${o}-${s}`), Ie.Glyphs);
De(a, ((e,t)=>{
if (e)
n(e);
else if (t) {
const e = {}
, i = function(e) {
return new xh(e).readFields(Uh, {})
}(t);
for (const t of i.glyphs)
e[t.id] = t;
n(null, {
glyphs: e,
ascender: i.ascender,
descender: i.descender
})
}
}
))
}
,
vd.TinySDF = class {
constructor({fontSize: e=24, buffer: t=3, radius: i=8, cutoff: r=.25, fontFamily: n="sans-serif", fontWeight: o="normal", fontStyle: s="normal"}={}) {
this.buffer = t,
this.cutoff = r,
this.radius = i;
const a = this.size = e + 4 * t
, l = this._createCanvas(a)
, c = this.ctx = l.getContext("2d", {
willReadFrequently: !0
});
c.font = `${s} ${o} ${e}px ${n}`,
c.textBaseline = "alphabetic",
c.textAlign = "left",
c.fillStyle = "black",
this.gridOuter = new Float64Array(a * a),
this.gridInner = new Float64Array(a * a),
this.f = new Float64Array(a),
this.z = new Float64Array(a + 1),
this.v = new Uint16Array(a)
}
_createCanvas(e) {
const t = document.createElement("canvas");
return t.width = t.height = e,
t
}
draw(e) {
const {width: t, actualBoundingBoxAscent: i, actualBoundingBoxDescent: r, actualBoundingBoxLeft: n, actualBoundingBoxRight: o} = this.ctx.measureText(e)
, s = Math.ceil(i)
, a = Math.min(this.size - this.buffer, Math.ceil(o - n))
, l = Math.min(this.size - this.buffer, s + Math.ceil(r))
, c = a + 2 * this.buffer
, u = l + 2 * this.buffer
, h = Math.max(c * u, 0)
, d = new Uint8ClampedArray(h)
, p = {
data: d,
width: c,
height: u,
glyphWidth: a,
glyphHeight: l,
glyphTop: s,
glyphLeft: 0,
glyphAdvance: t
};
if (0 === a || 0 === l)
return p;
const {ctx: f, buffer: m, gridInner: _, gridOuter: g} = this;
f.clearRect(m, m, a, l),
f.fillText(e, m, m + s);
const y = f.getImageData(m, m, a, l);
g.fill(_d, 0, h),
_.fill(0, 0, h);
for (let e = 0; e < l; e++)
for (let t = 0; t < a; t++) {
const i = y.data[4 * (e * a + t) + 3] / 255;
if (0 === i)
continue;
const r = (e + m) * c + t + m;
if (1 === i)
g[r] = 0,
_[r] = _d;
else {
const e = .5 - i;
g[r] = e > 0 ? e * e : 0,
_[r] = e < 0 ? e * e : 0
}
}
gd(g, 0, 0, c, u, c, this.f, this.v, this.z),
gd(_, m, m, a, l, c, this.f, this.v, this.z);
for (let e = 0; e < h; e++) {
const t = Math.sqrt(g[e]) - Math.sqrt(_[e]);
d[e] = Math.round(255 - 255 * (t / this.radius + this.cutoff))
}
return p
}
}
;
class Md {
constructor(e=[], t=Ad) {
if (this.data = e,
this.length = this.data.length,
this.compare = t,
this.length > 0)
for (let e = (this.length >> 1) - 1; e >= 0; e--)
this._down(e)
}
push(e) {
this.data.push(e),
this.length++,
this._up(this.length - 1)
}
pop() {
if (0 === this.length)
return;
const e = this.data[0]
, t = this.data.pop();
return this.length--,
this.length > 0 && (this.data[0] = t,
this._down(0)),
e
}
peek() {
return this.data[0]
}
_up(e) {
const {data: t, compare: i} = this
, r = t[e];
for (; e > 0; ) {
const n = e - 1 >> 1
, o = t[n];
if (i(r, o) >= 0)
break;
t[e] = o,
e = n
}
t[e] = r
}
_down(e) {
const {data: t, compare: i} = this
, r = this.length >> 1
, n = t[e];
for (; e < r; ) {
let r = 1 + (e << 1)
, o = t[r];
const s = r + 1;
if (s < this.length && i(t[s], o) < 0 && (r = s,
o = t[s]),
i(o, n) >= 0)
break;
t[e] = o,
e = r
}
t[e] = n
}
}
function Ad(e, t) {
return e < t ? -1 : e > t ? 1 : 0
}
function Id(e, t=1, i=!1) {
let r = 1 / 0
, n = 1 / 0
, s = -1 / 0
, a = -1 / 0;
const l = e[0];
for (let e = 0; e < l.length; e++) {
const t = l[e];
(!e || t.x < r) && (r = t.x),
(!e || t.y < n) && (n = t.y),
(!e || t.x > s) && (s = t.x),
(!e || t.y > a) && (a = t.y)
}
const c = Math.min(s - r, a - n);
let u = c / 2;
const h = new Md([],zd);
if (0 === c)
return new o(r,n);
for (let t = r; t < s; t += c)
for (let i = n; i < a; i += c)
h.push(new kd(t + u,i + u,u,e));
let d = function(e) {
let t = 0
, i = 0
, r = 0;
const n = e[0];
for (let e = 0, o = n.length, s = o - 1; e < o; s = e++) {
const o = n[e]
, a = n[s]
, l = o.x * a.y - a.x * o.y;
i += (o.x + a.x) * l,
r += (o.y + a.y) * l,
t += 3 * l
}
return new kd(i / t,r / t,0,e)
}(e)
, p = h.length;
for (; h.length; ) {
const r = h.pop();
(r.d > d.d || !d.d) && (d = r,
i && console.log("found best %d after %d probes", Math.round(1e4 * r.d) / 1e4, p)),
r.max - d.d <= t || (u = r.h / 2,
h.push(new kd(r.p.x - u,r.p.y - u,u,e)),
h.push(new kd(r.p.x + u,r.p.y - u,u,e)),
h.push(new kd(r.p.x - u,r.p.y + u,u,e)),
h.push(new kd(r.p.x + u,r.p.y + u,u,e)),
p += 4)
}
return i && (console.log(`num probes: ${p}`),
console.log(`best distance: ${d.d}`)),
d.p
}
function zd(e, t) {
return t.max - e.max
}
function kd(e, t, i, r) {
this.p = new o(e,t),
this.h = i,
this.d = function(e, t) {
let i = !1
, r = 1 / 0;
for (let n = 0; n < t.length; n++) {
const o = t[n];
for (let t = 0, n = o.length, s = n - 1; t < n; s = t++) {
const n = o[t]
, a = o[s];
n.y > e.y != a.y > e.y && e.x < (a.x - n.x) * (e.y - n.y) / (a.y - n.y) + n.x && (i = !i),
r = Math.min(r, rl(e, n, a))
}
}
return (i ? 1 : -1) * Math.sqrt(r)
}(this.p, r),
this.max = this.d + this.h * Math.SQRT2
}
const Pd = Number.POSITIVE_INFINITY
, Dd = Math.sqrt(2);
function Ld(e, t) {
return t[1] !== Pd ? function(e, t, i) {
let r = 0
, n = 0;
switch (t = Math.abs(t),
i = Math.abs(i),
e) {
case "top-right":
case "top-left":
case "top":
n = i - 7;
break;
case "bottom-right":
case "bottom-left":
case "bottom":
n = 7 - i
}
switch (e) {
case "top-right":
case "bottom-right":
case "right":
r = -t;
break;
case "top-left":
case "bottom-left":
case "left":
r = t
}
return [r, n]
}(e, t[0], t[1]) : function(e, t) {
let i = 0
, r = 0;
t < 0 && (t = 0);
const n = t / Dd;
switch (e) {
case "top-right":
case "top-left":
r = n - 7;
break;
case "bottom-right":
case "bottom-left":
r = 7 - n;
break;
case "bottom":
r = 7 - t;
break;
case "top":
r = t - 7
}
switch (e) {
case "top-right":
case "bottom-right":
i = -n;
break;
case "top-left":
case "bottom-left":
i = n;
break;
case "left":
i = t;
break;
case "right":
i = -t
}
return [i, r]
}(e, t[0])
}
function Bd(e, t, i, r, n, o, s, a, l, c) {
e.createArrays(),
e.tilePixelRatio = Ta / (512 * e.overscaling),
e.compareText = {},
e.iconsNeedLinear = !1;
const u = e.layers[0].layout
, h = e.layers[0]._unevaluatedLayout._values
, d = {};
if ("composite" === e.textSizeData.kind) {
const {minZoom: t, maxZoom: i} = e.textSizeData;
d.compositeTextSizes = [h["text-size"].possiblyEvaluate(new Lo(t), a), h["text-size"].possiblyEvaluate(new Lo(i), a)]
}
if ("composite" === e.iconSizeData.kind) {
const {minZoom: t, maxZoom: i} = e.iconSizeData;
d.compositeIconSizes = [h["icon-size"].possiblyEvaluate(new Lo(t), a), h["icon-size"].possiblyEvaluate(new Lo(i), a)]
}
d.layoutTextSize = h["text-size"].possiblyEvaluate(new Lo(l + 1), a),
d.layoutIconSize = h["icon-size"].possiblyEvaluate(new Lo(l + 1), a),
d.textMaxSize = h["text-size"].possiblyEvaluate(new Lo(18), a);
const p = "map" === u.get("text-rotation-alignment") && "point" !== u.get("symbol-placement")
, f = u.get("text-size");
for (const o of e.features) {
const l = u.get("text-font").evaluate(o, {}, a).join(",")
, h = f.evaluate(o, {}, a)
, m = d.layoutTextSize.evaluate(o, {}, a)
, _ = (d.layoutIconSize.evaluate(o, {}, a),
{
horizontal: {},
vertical: void 0
})
, g = o.text;
let y, x = [0, 0];
if (g) {
const r = g.toString()
, s = u.get("text-letter-spacing").evaluate(o, {}, a) * ah
, c = u.get("text-line-height").evaluate(o, {}, a) * ah
, d = mo(r) ? s : 0
, f = u.get("text-anchor").evaluate(o, {}, a)
, y = u.get("text-variable-anchor");
if (!y) {
const e = u.get("text-radial-offset").evaluate(o, {}, a);
x = e ? Ld(f, [e * ah, Pd]) : u.get("text-offset").evaluate(o, {}, a).map((e=>e * ah))
}
let v = p ? "center" : u.get("text-justify").evaluate(o, {}, a);
const b = u.get("symbol-placement")
, w = "point" === b
, T = "point" === b ? u.get("text-max-width").evaluate(o, {}, a) * ah : 0
, E = o=>{
e.allowVerticalPlacement && fo(r) && (_.vertical = Xh(g, t, i, n, l, T, c, f, o, d, x, qh.vertical, !0, b, m, h))
}
;
if (!p && y) {
const e = "auto" === v ? y.map((e=>Od(e))) : [v];
let r = !1;
for (let o = 0; o < e.length; o++) {
const s = e[o];
if (!_.horizontal[s])
if (r)
_.horizontal[s] = _.horizontal[0];
else {
const e = Xh(g, t, i, n, l, T, c, "center", s, d, x, qh.horizontal, !1, b, m, h);
e && (_.horizontal[s] = e,
r = 1 === e.positionedLines.length)
}
}
E("left")
} else {
if ("auto" === v && (v = Od(f)),
w || u.get("text-writing-mode").indexOf("horizontal") >= 0 || !fo(r)) {
const e = Xh(g, t, i, n, l, T, c, f, v, d, x, qh.horizontal, !1, b, m, h);
e && (_.horizontal[v] = e)
}
E("point" === b ? "left" : v)
}
}
let v = !1;
if (o.icon && o.icon.name) {
const t = r[o.icon.name];
t && (y = od(n[o.icon.name], u.get("icon-offset").evaluate(o, {}, a), u.get("icon-anchor").evaluate(o, {}, a)),
v = t.sdf,
void 0 === e.sdfIcons ? e.sdfIcons = t.sdf : e.sdfIcons !== t.sdf && P("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),
(t.pixelRatio !== e.pixelRatio || 0 !== u.get("icon-rotate").constantOr(1)) && (e.iconsNeedLinear = !0))
}
const b = Vd(_.horizontal) || _.vertical;
e.iconsInText || (e.iconsInText = !!b && b.iconsInText),
(b || y) && Rd(e, o, _, y, r, d, m, 0, x, v, s, a, c)
}
o && e.generateCollisionDebugBuffers(l, e.collisionBoxArray)
}
function Od(e) {
switch (e) {
case "right":
case "top-right":
case "bottom-right":
return "right";
case "left":
case "top-left":
case "bottom-left":
return "left"
}
return "center"
}
function Rd(e, t, i, r, n, o, s, a, l, u, h, d, p) {
let f = o.textMaxSize.evaluate(t, {}, d);
void 0 === f && (f = s);
const m = e.layers[0].layout
, _ = m.get("icon-offset").evaluate(t, {}, d)
, g = Vd(i.horizontal) || i.vertical
, y = "globe" === p.name
, x = s / 24
, v = e.tilePixelRatio * f / 24
, b = (I = e.overscaling,
e.zoom > 18 && I > 2 && (I >>= 1),
Math.max(Ta / (512 * I), 1) * m.get("symbol-spacing"))
, w = m.get("text-padding") * e.tilePixelRatio
, T = m.get("icon-padding") * e.tilePixelRatio
, E = c(m.get("text-max-angle"))
, S = "map" === m.get("text-rotation-alignment") && "point" !== m.get("symbol-placement")
, C = "map" === m.get("icon-rotation-alignment") && "point" !== m.get("symbol-placement")
, M = m.get("symbol-placement")
, A = b / 2;
var I;
const z = m.get("icon-text-fit");
let k;
r && "none" !== z && (e.allowVerticalPlacement && i.vertical && (k = sd(r, i.vertical, z, m.get("icon-text-fit-padding"), _, x)),
g && (r = sd(r, g, z, m.get("icon-text-fit-padding"), _, x)));
const D = (s,a,c)=>{
if (a.x < 0 || a.x >= Ta || a.y < 0 || a.y >= Ta)
return;
let f = null;
if (y) {
const {x: e, y: t, z: i} = p.projectTilePoint(a.x, a.y, c);
f = {
anchor: new ad(e,t,i,0,void 0),
up: p.upVector(c, a.x, a.y)
}
}
!function(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x, v, b, w, T, E) {
const S = e.addToLineVertexArray(t, r);
let C, M, A, I, z, k, D, L = 0, B = 0, O = 0, R = 0, F = -1, U = -1;
const V = {};
let j = Zs("");
const N = i ? i.anchor : t;
let G = 0
, $ = 0;
if (void 0 === l._unevaluatedLayout.getValue("text-radial-offset") ? [G,$] = l.layout.get("text-offset").evaluate(v, {}, E).map((e=>e * ah)) : (G = l.layout.get("text-radial-offset").evaluate(v, {}, E) * ah,
$ = Pd),
e.allowVerticalPlacement && n.vertical) {
const e = n.vertical;
if (f)
k = Nd(e),
a && (D = Nd(a));
else {
const i = l.layout.get("text-rotate").evaluate(v, {}, E) + 90;
A = jd(c, N, t, u, h, d, e, p, i, m),
a && (I = jd(c, N, t, u, h, d, a, g, i))
}
}
if (o) {
const r = l.layout.get("icon-rotate").evaluate(v, {}, E)
, n = "none" !== l.layout.get("icon-text-fit")
, s = bd(o, r, w, n)
, p = a ? bd(a, r, w, n) : void 0;
M = jd(c, N, t, u, h, d, o, g, r),
L = 4 * s.length;
const f = e.iconSizeData;
let m = null;
"source" === f.kind ? (m = [lh * l.layout.get("icon-size").evaluate(v, {}, E)],
m[0] > Fd && P(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)) : "composite" === f.kind && (m = [lh * b.compositeIconSizes[0].evaluate(v, {}, E), lh * b.compositeIconSizes[1].evaluate(v, {}, E)],
(m[0] > Fd || m[1] > Fd) && P(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),
e.addSymbols(e.icon, s, m, x, y, v, !1, i, t, S.lineStartIndex, S.lineLength, -1, T, E),
F = e.icon.placedSymbolArray.length - 1,
p && (B = 4 * p.length,
e.addSymbols(e.icon, p, m, x, y, v, qh.vertical, i, t, S.lineStartIndex, S.lineLength, -1, T, E),
U = e.icon.placedSymbolArray.length - 1)
}
for (const r in n.horizontal) {
const o = n.horizontal[r];
C || (j = Zs(o.text),
f ? z = Nd(o) : C = jd(c, N, t, u, h, d, o, p, l.layout.get("text-rotate").evaluate(v, {}, E), m));
const a = 1 === o.positionedLines.length;
if (O += Ud(e, i, t, o, s, l, f, v, m, S, n.vertical ? qh.horizontal : qh.horizontalOnly, a ? Object.keys(n.horizontal) : [r], V, F, b, T, E),
a)
break
}
n.vertical && (R += Ud(e, i, t, n.vertical, s, l, f, v, m, S, qh.vertical, ["vertical"], V, U, b, T, E));
let q = -1;
const Z = (e,t)=>e ? Math.max(e, t) : t;
q = Z(z, q),
q = Z(k, q),
q = Z(D, q);
const W = q > -1 ? 1 : 0;
e.glyphOffsetArray.length >= Qp.MAX_GLYPHS && P("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),
void 0 !== v.sortKey && e.addToSortKeyRanges(e.symbolInstances.length, v.sortKey),
e.symbolInstances.emplaceBack(N.x, N.y, N.z, t.x, t.y, V.right >= 0 ? V.right : -1, V.center >= 0 ? V.center : -1, V.left >= 0 ? V.left : -1, V.vertical >= 0 ? V.vertical : -1, F, U, j, void 0 !== C ? C : e.collisionBoxArray.length, void 0 !== C ? C + 1 : e.collisionBoxArray.length, void 0 !== A ? A : e.collisionBoxArray.length, void 0 !== A ? A + 1 : e.collisionBoxArray.length, void 0 !== M ? M : e.collisionBoxArray.length, void 0 !== M ? M + 1 : e.collisionBoxArray.length, I || e.collisionBoxArray.length, I ? I + 1 : e.collisionBoxArray.length, u, O, R, L, B, W, 0, G, $, q)
}(e, a, f, s, i, r, n, k, e.layers[0], e.collisionBoxArray, t.index, t.sourceLayerIndex, e.index, w, S, l, 0, T, C, _, t, o, u, h, d)
}
;
if ("line" === M)
for (const n of md(t.geometry, 0, 0, Ta, Ta)) {
const t = pd(n, b, E, i.vertical || g, r, 24, v, e.overscaling, Ta);
for (const i of t) {
const t = g;
t && Gd(e, t.text, A, i) || D(n, i, d)
}
}
else if ("line-center" === M) {
for (const e of t.geometry)
if (e.length > 1) {
const t = dd(e, E, i.vertical || g, r, 24, v);
t && D(e, t, d)
}
} else if ("Polygon" === t.type)
for (const e of Kc(t.geometry, 0)) {
const t = Id(e, 16);
D(e[0], new ad(t.x,t.y,0,0,void 0), d)
}
else if ("LineString" === t.type)
for (const e of t.geometry)
D(e, new ad(e[0].x,e[0].y,0,0,void 0), d);
else if ("Point" === t.type)
for (const e of t.geometry)
for (const t of e)
D([t], new ad(t.x,t.y,0,0,void 0), d)
}
const Fd = 32640;
function Ud(e, t, i, r, n, s, a, l, c, u, h, d, p, f, m, _, g) {
const y = function(e, t, i, r, n, s, a, l) {
const c = [];
if (0 === t.positionedLines.length)
return c;
const u = r.layout.get("text-rotate").evaluate(s, {}) * Math.PI / 180
, h = function(e) {
const t = e[0]
, i = e[1]
, r = t * i;
return r > 0 ? [t, -i] : r < 0 ? [-t, i] : 0 === t ? [i, t] : [i, -t]
}(i);
let d = Math.abs(t.top - t.bottom);
for (const e of t.positionedLines)
d -= e.lineOffset;
const p = t.positionedLines.length
, f = d / p;
let m = t.top - i[1];
for (let e = 0; e < p; ++e) {
const r = t.positionedLines[e];
m = Cd(t, f, m, e);
for (const e of r.positionedGlyphs) {
if (!e.rect)
continue;
const r = e.rect || {};
let s = 4
, d = !0
, p = 1
, f = 0;
if (e.imageName) {
const t = a[e.imageName];
if (!t)
continue;
if (t.sdf) {
P("SDF images are not supported in formatted text and will be ignored.");
continue
}
d = !1,
p = t.pixelRatio,
s = 1 / p
}
const _ = (n || l) && e.vertical
, g = e.metrics.advance * e.scale / 2
, y = e.metrics
, x = e.rect;
if (null === x)
continue;
l && t.verticalizable && (f = e.imageName ? g - e.metrics.width * e.scale / 2 : 0);
const v = n ? [e.x + g, e.y] : [0, 0];
let b = [0, 0]
, w = [0, 0]
, T = !1;
n || (_ ? (w = [e.x + g + h[0], e.y + h[1] - f],
T = !0) : b = [e.x + g + i[0], e.y + i[1] - f]);
const E = x.w * e.scale / (p * (e.localGlyph ? 2 : 1))
, S = x.h * e.scale / (p * (e.localGlyph ? 2 : 1));
let C, M, A, I;
if (_) {
const t = e.y - m
, i = new o(-g,g - t)
, r = -Math.PI / 2
, n = new o(...w);
C = new o(-g + b[0],b[1]),
C._rotateAround(r, i)._add(n),
C.x += -t + g,
C.y -= (y.left - s) * e.scale;
const a = e.imageName ? y.advance * e.scale : ah * e.scale
, l = String.fromCharCode(e.glyph);
mh(l) ? C.x += (1 - s) * e.scale : _h(l) ? C.x += a - y.height * e.scale + (-s - 1) * e.scale : C.x += e.imageName || y.width + 2 * s === x.w && y.height + 2 * s === x.h ? (a - S) / 2 : (a - (y.height + 2 * s) * e.scale) / 2,
M = new o(C.x,C.y - E),
A = new o(C.x + S,C.y),
I = new o(C.x + S,C.y - E)
} else {
const t = (y.left - s) * e.scale - g + b[0]
, i = (-y.top - s) * e.scale + b[1]
, r = t + E
, n = i + S;
C = new o(t,i),
M = new o(r,i),
A = new o(t,n),
I = new o(r,n)
}
if (u) {
let e;
e = n ? new o(0,0) : T ? new o(h[0],h[1]) : new o(i[0],i[1]),
C._rotateAround(u, e),
M._rotateAround(u, e),
A._rotateAround(u, e),
I._rotateAround(u, e)
}
const z = new o(0,0)
, k = new o(0,0);
c.push({
tl: C,
tr: M,
bl: A,
br: I,
tex: r,
writingMode: t.writingMode,
glyphOffset: v,
sectionIndex: e.sectionIndex,
isSDF: d,
pixelOffsetTL: z,
pixelOffsetBR: k,
minFontScaleX: 0,
minFontScaleY: 0
})
}
}
return c
}(0, r, c, s, a, l, n, e.allowVerticalPlacement)
, x = e.textSizeData;
let v = null;
"source" === x.kind ? (v = [lh * s.layout.get("text-size").evaluate(l, {}, g)],
v[0] > Fd && P(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)) : "composite" === x.kind && (v = [lh * m.compositeTextSizes[0].evaluate(l, {}, g), lh * m.compositeTextSizes[1].evaluate(l, {}, g)],
(v[0] > Fd || v[1] > Fd) && P(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),
e.addSymbols(e.text, y, v, c, a, l, h, t, i, u.lineStartIndex, u.lineLength, f, _, g);
for (const t of d)
p[t] = e.text.placedSymbolArray.length - 1;
return 4 * y.length
}
function Vd(e) {
for (const t in e)
return e[t];
return null
}
function jd(e, t, i, r, n, s, a, l, u, h) {
let d = a.top
, p = a.bottom
, f = a.left
, m = a.right;
const _ = a.collisionPadding;
if (_ && (f -= _[0],
d -= _[1],
m += _[2],
p += _[3]),
u) {
const e = new o(f,d)
, t = new o(m,d)
, i = new o(f,p)
, r = new o(m,p)
, n = c(u);
let s = new o(0,0);
h && (s = new o(h[0],h[1])),
e._rotateAround(n, s),
t._rotateAround(n, s),
i._rotateAround(n, s),
r._rotateAround(n, s),
f = Math.min(e.x, t.x, i.x, r.x),
m = Math.max(e.x, t.x, i.x, r.x),
d = Math.min(e.y, t.y, i.y, r.y),
p = Math.max(e.y, t.y, i.y, r.y)
}
return e.emplaceBack(t.x, t.y, t.z, i.x, i.y, f, d, m, p, l, r, n, s),
e.length - 1
}
function Nd(e) {
e.collisionPadding && (e.top -= e.collisionPadding[1],
e.bottom += e.collisionPadding[3]);
const t = e.bottom - e.top;
return t > 0 ? Math.max(10, t) : null
}
function Gd(e, t, i, r) {
const n = e.compareText;
if (t in n) {
const e = n[t];
for (let t = e.length - 1; t >= 0; t--)
if (r.dist(e[t]) < i)
return !0
} else
n[t] = [];
return n[t].push(r),
!1
}
const $d = Qo([{
type: "Float32",
name: "a_globe_pos",
components: 3
}, {
type: "Float32",
name: "a_uv",
components: 2
}])
, {members: qd} = $d
, Zd = Qo([{
name: "a_pos_3",
components: 3,
type: "Int16"
}]);
var Wd = Qo([{
name: "a_pos",
type: "Int16",
components: 2
}]);
const Xd = Ta / Math.PI / 2
, Hd = 2 * ka(1, 0) * Xd * Math.PI
, Yd = [64, 32, 16]
, Kd = -Xd
, Jd = Xd
, Qd = [new ic([Kd, Kd, Kd],[Jd, Jd, Jd]), new ic([Kd, Kd, Kd],[0, 0, Jd]), new ic([0, Kd, Kd],[Jd, 0, Jd]), new ic([Kd, 0, Kd],[0, Jd, Jd]), new ic([0, 0, Kd],[Jd, Jd, Jd])];
function ep(e, t, i, r=!0) {
const n = Ol([], e._camera.position, e.worldSize)
, o = [t, i, 1, 1];
Xl(o, o, e.pixelMatrixInverse),
Wl(o, o, 1 / o[3]);
const s = Fl([], $l([], o, n))
, a = e.globeMatrix
, l = [a[12], a[13], a[14]]
, c = $l([], l, n)
, h = Il(c)
, d = Fl([], c)
, p = e.worldSize / (2 * Math.PI)
, f = Ul(d, s)
, _ = Math.asin(p / h);
if (_ < Math.acos(f)) {
if (!r)
return null;
const e = []
, t = [];
Ol(e, s, h / f),
Fl(t, $l(t, e, c)),
Fl(s, kl(s, c, Ol(s, t, Math.tan(_) * h)))
}
const g = [];
new Ql(n,s).closestPointOnSphere(l, p, g);
const y = Fl([], V(a, 0))
, x = Fl([], V(a, 1))
, v = Fl([], V(a, 2))
, b = Ul(y, g)
, w = Ul(x, g)
, T = Ul(v, g)
, E = u(Math.asin(-w / p));
let S = u(Math.atan2(b, T));
S = e.center.lng + function(e, t) {
const i = (t - e + 180) % 360 - 180;
return i < -180 ? i + 360 : i
}(e.center.lng, S);
const C = Ia(S)
, M = m(za(E), 0, 1);
return new Ra(C,M)
}
class tp {
constructor(e, t, i) {
this.a = $l([], e, i),
this.b = $l([], t, i),
this.center = i;
const r = Fl([], this.a)
, n = Fl([], this.b);
this.angle = Math.acos(Ul(r, n))
}
}
function ip(e, t) {
if (0 === e.angle)
return null;
let i;
return i = 0 === e.a[t] ? 1 / e.angle * .5 * Math.PI : 1 / e.angle * Math.atan(e.b[t] / e.a[t] / Math.sin(e.angle) - 1 / Math.tan(e.angle)),
i < 0 || i > 1 ? null : function(e, t, i, r) {
const n = Math.sin(i);
return e * (Math.sin((1 - r) * i) / n) + t * (Math.sin(r * i) / n)
}(e.a[t], e.b[t], e.angle, m(i, 0, 1)) + e.center[t]
}
function rp(e) {
if (e.z <= 1)
return Qd[e.z + 2 * e.y + e.x];
const t = lp(ap(e));
return ic.fromPoints(t)
}
function np(e, t) {
const i = gp(t.zoom);
if (0 === i)
return rp(e);
const r = ap(e)
, n = lp(r)
, o = Ia(r.getWest()) * t.worldSize
, s = Ia(r.getEast()) * t.worldSize
, a = za(r.getNorth()) * t.worldSize
, l = za(r.getSouth()) * t.worldSize
, c = [o, a, 0]
, u = [s, a, 0]
, h = [o, l, 0]
, d = [s, l, 0]
, p = yl([], t.globeMatrix);
return jl(c, c, p),
jl(u, u, p),
jl(h, h, p),
jl(d, d, p),
n[0] = vi(n[0], h, i),
n[1] = vi(n[1], d, i),
n[2] = vi(n[2], u, i),
n[3] = vi(n[3], c, i),
ic.fromPoints(n)
}
function op(e, t, i, r, n) {
for (const o of i)
jl(o, o, r),
Ol(o, o, n),
Ll(e, e, o),
Bl(t, t, o)
}
function sp(e, t, i) {
const r = t / e.worldSize
, n = Number.MAX_VALUE
, o = [-n, -n, -n]
, s = [n, n, n]
, a = e.globeMatrix;
if (i.z <= 1)
return op(s, o, rp(i).getCorners(), a, r),
new ic(s,o);
const l = ap(i)
, u = lp(l);
if (op(s, o, u, a, r),
l.contains(e.center)) {
o[2] = 0;
const t = e.point
, i = [t.x * r, t.y * r, 0];
return Ll(s, s, i),
Bl(o, o, i),
new ic(s,o)
}
const h = [a[12] * r, a[13] * r, a[14] * r]
, d = l.getCenter()
, p = m(e.center.lat, -85.051129, Ba)
, f = m(d.lat, -85.051129, Ba)
, _ = Ia(e.center.lng)
, g = za(p);
let y = _ - Ia(d.lng);
const x = g - za(f);
y > .5 ? y -= 1 : y < -.5 && (y += 1);
let v = 0;
Math.abs(y) > Math.abs(x) ? v = y >= 0 ? 1 : 3 : (v = x >= 0 ? 0 : 2,
Rl(h, h, [a[4] * r, a[5] * r, a[6] * r], -Math.sin(c(x >= 0 ? l.getSouth() : l.getNorth())) * Xd));
const b = u[v]
, w = u[(v + 1) % 4]
, T = new tp(b,w,h)
, E = [ip(T, 0) || b[0], ip(T, 1) || b[1], ip(T, 2) || b[2]];
return s[2] = Math.min(b[2], w[2]),
Ll(s, s, E),
Bl(o, o, E),
new ic(s,o)
}
function ap({x: e, y: t, z: i}) {
const r = 1 / (1 << i)
, n = new Ca(Pa(e * r),Da((t + 1) * r))
, o = new Ca(Pa((e + 1) * r),Da(t * r));
return new Ea(n,o)
}
function lp(e) {
const t = c(e.getNorth())
, i = c(e.getSouth())
, r = Math.cos(t)
, n = Math.cos(i)
, o = Math.sin(t)
, s = Math.sin(i)
, a = e.getWest()
, l = e.getEast();
return [cp(n, s, a), cp(n, s, l), cp(r, o, l), cp(r, o, a)]
}
function cp(e, t, i, r=Xd) {
return i = c(i),
[e * Math.sin(i) * r, -t * r, e * Math.cos(i) * r]
}
function up(e, t, i) {
return cp(Math.cos(c(e)), Math.sin(c(e)), t, i)
}
function hp(e, t, i, r) {
const n = 1 << i.z
, o = (e / Ta + i.x) / n;
return up(Da((t / Ta + i.y) / n), Pa(o), r)
}
function dp({min: e, max: t}) {
return 16383 / Math.max(t[0] - e[0], t[1] - e[1], t[2] - e[2])
}
const pp = new Float64Array(16);
function fp(e) {
const t = dp(e)
, i = El(pp, [t, t, t]);
return vl(i, i, ((r = [])[0] = -(n = e.min)[0],
r[1] = -n[1],
r[2] = -n[2],
r));
var r, n
}
function mp(e) {
const t = (r = e.min,
(i = pp)[0] = 1,
i[1] = 0,
i[2] = 0,
i[3] = 0,
i[4] = 0,
i[5] = 1,
i[6] = 0,
i[7] = 0,
i[8] = 0,
i[9] = 0,
i[10] = 1,
i[11] = 0,
i[12] = r[0],
i[13] = r[1],
i[14] = r[2],
i[15] = 1,
i);
var i, r;
const n = 1 / dp(e);
return bl(t, t, [n, n, n])
}
function _p(e, t, i, r, n) {
const o = function(e) {
const t = Ta / (2 * Math.PI);
return e / (2 * Math.PI) / t
}(i)
, s = [e, t, -i / (2 * Math.PI)]
, a = gl(new Float64Array(16));
return vl(a, a, s),
bl(a, a, [o, o, o]),
wl(a, a, c(-n)),
Tl(a, a, c(-r)),
a
}
function gp(e) {
return _(5, 6, e)
}
function yp(e, t) {
const i = up(t.lat, t.lng);
return o = (r = Pl([], function(e) {
const t = up(e._center.lat, e._center.lng);
let i = Vl([], zl(0, 1, 0), t);
const r = Sl([], -e.angle, t);
i = jl(i, i, r),
Sl(r, -e._pitch, i);
const n = Fl([], t);
return Ol(n, n, e.cameraToCenterDistance / e.pixelsPerMeter * Hd),
jl(n, n, r),
kl([], t, n)
}(e), i))[0],
s = r[1],
a = r[2],
l = (n = i)[0],
c = n[1],
u = n[2],
d = (h = Math.sqrt(o * o + s * s + a * a) * Math.sqrt(l * l + c * c + u * u)) && Ul(r, n) / h,
Math.acos(Math.min(Math.max(d, -1), 1));
var r, n, o, s, a, l, c, u, h, d
}
const xp = c(85)
, vp = Math.cos(xp)
, bp = Math.sin(xp);
function wp(e, t) {
const i = e.fovAboveCenter
, r = e.elevation ? e.elevation.getMinElevationBelowMSL() * t : 0
, n = (e._camera.position[2] * e.worldSize - r) / Math.cos(e._pitch)
, o = Math.sin(i) * n / Math.sin(Math.max(Math.PI / 2 - e._pitch - i, .01))
, s = Math.sin(e._pitch) * o + n;
return Math.min(1.01 * s, n * (1 / e._horizonShift))
}
function Tp(e, t) {
if (!t.isReprojectedInTileSpace)
return {
scale: 1 << e.z,
x: e.x,
y: e.y,
x2: e.x + 1,
y2: e.y + 1,
projection: t
};
const i = Math.pow(2, -e.z)
, r = e.x * i
, n = (e.x + 1) * i
, o = e.y * i
, s = (e.y + 1) * i
, a = Pa(r)
, l = Pa(n)
, c = Da(o)
, u = Da(s)
, h = t.project(a, c)
, d = t.project(l, c)
, p = t.project(l, u)
, f = t.project(a, u);
let m = Math.min(h.x, d.x, p.x, f.x)
, _ = Math.min(h.y, d.y, p.y, f.y)
, g = Math.max(h.x, d.x, p.x, f.x)
, y = Math.max(h.y, d.y, p.y, f.y);
const x = i / 16;
function v(e, i, r, n, o, s) {
const a = (r + o) / 2
, l = (n + s) / 2
, c = t.project(Pa(a), Da(l))
, u = Math.max(0, m - c.x, _ - c.y, c.x - g, c.y - y);
m = Math.min(m, c.x),
g = Math.max(g, c.x),
_ = Math.min(_, c.y),
y = Math.max(y, c.y),
u > x && (v(e, c, r, n, a, l),
v(c, i, a, l, o, s))
}
v(h, d, r, o, n, o),
v(d, p, n, o, n, s),
v(p, f, n, s, r, s),
v(f, h, r, s, r, o),
m -= x,
_ -= x,
g += x,
y += x;
const b = 1 / Math.max(g - m, y - _);
return {
scale: b,
x: m * b,
y: _ * b,
x2: g * b,
y2: y * b,
projection: t
}
}
const Ep = gl(new Float32Array(16));
class Sp {
constructor(e) {
this.spec = e,
this.name = e.name,
this.wrap = !1,
this.requiresDraping = !1,
this.supportsWorldCopies = !1,
this.supportsTerrain = !1,
this.supportsFog = !1,
this.supportsFreeCamera = !1,
this.zAxisUnit = "meters",
this.isReprojectedInTileSpace = !0,
this.unsupportedLayers = ["custom"],
this.center = [0, 0],
this.range = [3.5, 7]
}
project(e, t) {
return {
x: 0,
y: 0,
z: 0
}
}
unproject(e, t) {
return new Ca(0,0)
}
projectTilePoint(e, t, i) {
return {
x: e,
y: t,
z: 0
}
}
locationPoint(e, t, i=!0) {
return e._coordinatePoint(e.locationCoordinate(t), i)
}
pixelsPerMeter(e, t) {
return ka(1, e) * t
}
pixelSpaceConversion(e, t, i) {
return 1
}
farthestPixelDistance(e) {
return wp(e, e.pixelsPerMeter)
}
pointCoordinate(e, t, i, r) {
const n = e.horizonLineFromTop(!1)
, s = new o(t,Math.max(n, i));
return e.rayIntersectionCoordinate(e.pointRayIntersection(s, r))
}
pointCoordinate3D(e, t, i) {
const r = new o(t,i);
if (e.elevation)
return e.elevation.pointCoordinate(r);
{
const t = this.pointCoordinate(e, r.x, r.y, 0);
return [t.x, t.y, t.z]
}
}
isPointAboveHorizon(e, t) {
if (e.elevation)
return !this.pointCoordinate3D(e, t.x, t.y);
const i = e.horizonLineFromTop();
return t.y < i
}
createInversionMatrix(e, t) {
return Ep
}
createTileMatrix(e, t, i) {
let r, n, o;
const s = i.canonical
, a = gl(new Float64Array(16));
if (this.isReprojectedInTileSpace) {
const l = Tp(s, this);
r = 1,
n = l.x + i.wrap * l.scale,
o = l.y,
bl(a, a, [r / l.scale, r / l.scale, e.pixelsPerMeter / t])
} else
r = t / e.zoomScale(s.z),
n = (s.x + Math.pow(2, s.z) * i.wrap) * r,
o = s.y * r;
return vl(a, a, [n, o, 0]),
bl(a, a, [r / Ta, r / Ta, 1]),
a
}
upVector(e, t, i) {
return [0, 0, 1]
}
upVectorScale(e, t, i) {
return {
metersToTile: 1
}
}
}
class Cp extends Sp {
constructor(e) {
super(e),
this.range = [4, 7],
this.center = e.center || [-96, 37.5];
const [t,i] = this.parallels = e.parallels || [29.5, 45.5]
, r = Math.sin(c(t));
this.n = (r + Math.sin(c(i))) / 2,
this.c = 1 + r * (2 * this.n - r),
this.r0 = Math.sqrt(this.c) / this.n
}
project(e, t) {
const {n: i, c: r, r0: n} = this
, o = c(e - this.center[0])
, s = c(t)
, a = Math.sqrt(r - 2 * i * Math.sin(s)) / i;
return {
x: a * Math.sin(o * i),
y: a * Math.cos(o * i) - n,
z: 0
}
}
unproject(e, t) {
const {n: i, c: r, r0: n} = this
, o = n + t;
let s = Math.atan2(e, Math.abs(o)) * Math.sign(o);
o * i < 0 && (s -= Math.PI * Math.sign(e) * Math.sign(o));
const a = c(this.center[0]) * i;
s = g(s, -Math.PI - a, Math.PI - a);
const l = u(s / i) + this.center[0]
, h = Math.asin(m((r - (e * e + o * o) * i * i) / (2 * i), -1, 1))
, d = m(u(h), -85.051129, Ba);
return new Ca(l,d)
}
}
const Mp = 1.340264
, Ap = -.081106
, Ip = 893e-6
, zp = .003796
, kp = Math.sqrt(3) / 2;
class Pp extends Sp {
project(e, t) {
t = t / 180 * Math.PI,
e = e / 180 * Math.PI;
const i = Math.asin(kp * Math.sin(t))
, r = i * i
, n = r * r * r;
return {
x: .5 * (e * Math.cos(i) / (kp * (Mp + 3 * Ap * r + n * (7 * Ip + 9 * zp * r))) / Math.PI + .5),
y: 1 - .5 * (i * (Mp + Ap * r + n * (Ip + zp * r)) / Math.PI + 1),
z: 0
}
}
unproject(e, t) {
e = (2 * e - .5) * Math.PI;
let i = t = (2 * (1 - t) - 1) * Math.PI
, r = i * i
, n = r * r * r;
for (let e, o, s, a = 0; a < 12 && (o = i * (Mp + Ap * r + n * (Ip + zp * r)) - t,
s = Mp + 3 * Ap * r + n * (7 * Ip + 9 * zp * r),
e = o / s,
i = m(i - e, -Math.PI / 3, Math.PI / 3),
r = i * i,
n = r * r * r,
!(Math.abs(e) < 1e-12)); ++a)
;
const o = kp * e * (Mp + 3 * Ap * r + n * (7 * Ip + 9 * zp * r)) / Math.cos(i)
, s = Math.asin(Math.sin(i) / kp)
, a = m(180 * o / Math.PI, -180, 180)
, l = m(180 * s / Math.PI, -85.051129, Ba);
return new Ca(a,l)
}
}
class Dp extends Sp {
constructor(e) {
super(e),
this.wrap = !0,
this.supportsWorldCopies = !0
}
project(e, t) {
return {
x: .5 + e / 360,
y: .5 - t / 360,
z: 0
}
}
unproject(e, t) {
const i = 360 * (e - .5)
, r = m(360 * (.5 - t), -85.051129, Ba);
return new Ca(i,r)
}
}
const Lp = Math.PI / 2;
function Bp(e) {
return Math.tan((Lp + e) / 2)
}
class Op extends Sp {
constructor(e) {
super(e),
this.center = e.center || [0, 30];
const [t,i] = this.parallels = e.parallels || [30, 30]
, r = c(t)
, n = c(i)
, o = Math.cos(r);
this.n = r === n ? Math.sin(r) : Math.log(o / Math.cos(n)) / Math.log(Bp(n) / Bp(r)),
this.f = o * Math.pow(Bp(r), this.n) / this.n
}
project(e, t) {
t = c(t),
e = c(e - this.center[0]);
const i = 1e-6
, {n: r, f: n} = this;
n > 0 ? t < -Lp + i && (t = -Lp + i) : t > Lp - i && (t = Lp - i);
const o = n / Math.pow(Bp(t), r)
, s = o * Math.sin(r * e)
, a = n - o * Math.cos(r * e);
return {
x: .5 * (s / Math.PI + .5),
y: 1 - .5 * (a / Math.PI + .5),
z: 0
}
}
unproject(e, t) {
e = (2 * e - .5) * Math.PI,
t = (2 * (1 - t) - .5) * Math.PI;
const {n: i, f: r} = this
, n = r - t
, o = Math.sign(n)
, s = Math.sign(i) * Math.sqrt(e * e + n * n);
let a = Math.atan2(e, Math.abs(n)) * o;
n * i < 0 && (a -= Math.PI * Math.sign(e) * o);
const l = m(u(a / i) + this.center[0], -180, 180)
, c = m(u(2 * Math.atan(Math.pow(r / s, 1 / i)) - Lp), -85.051129, Ba);
return new Ca(l,c)
}
}
class Rp extends Sp {
constructor(e) {
super(e),
this.wrap = !0,
this.supportsWorldCopies = !0,
this.supportsTerrain = !0,
this.supportsFog = !0,
this.supportsFreeCamera = !0,
this.isReprojectedInTileSpace = !1,
this.unsupportedLayers = [],
this.range = null
}
project(e, t) {
return {
x: Ia(e),
y: za(t),
z: 0
}
}
unproject(e, t) {
const i = Pa(e)
, r = Da(t);
return new Ca(i,r)
}
}
const Fp = c(Ba);
class Up extends Sp {
project(e, t) {
const i = (t = c(t)) * t
, r = i * i;
return {
x: .5 * ((e = c(e)) * (.8707 - .131979 * i + r * (r * (.003971 * i - .001529 * r) - .013791)) / Math.PI + .5),
y: 1 - .5 * (t * (1.007226 + i * (.015085 + r * (.028874 * i - .044475 - .005916 * r))) / Math.PI + 1),
z: 0
}
}
unproject(e, t) {
e = (2 * e - .5) * Math.PI;
let i = t = (2 * (1 - t) - 1) * Math.PI
, r = 25
, n = 0
, o = i * i;
do {
o = i * i;
const e = o * o;
n = (i * (1.007226 + o * (.015085 + e * (.028874 * o - .044475 - .005916 * e))) - t) / (1.007226 + o * (.045255 + e * (.259866 * o - .311325 - .005916 * 11 * e))),
i = m(i - n, -Fp, Fp)
} while (Math.abs(n) > 1e-6 && --r > 0);
o = i * i;
const s = m(u(e / (.8707 + o * (o * (o * o * o * (.003971 - .001529 * o) - .013791) - .131979))), -180, 180)
, a = u(i);
return new Ca(s,a)
}
}
const Vp = c(Ba);
class jp extends Sp {
project(e, t) {
t = c(t),
e = c(e);
const i = Math.cos(t)
, r = 2 / Math.PI
, n = Math.acos(i * Math.cos(e / 2))
, o = Math.sin(n) / n
, s = .5 * (e * r + 2 * i * Math.sin(e / 2) / o) || 0
, a = .5 * (t + Math.sin(t) / o) || 0;
return {
x: .5 * (s / Math.PI + .5),
y: 1 - .5 * (a / Math.PI + 1),
z: 0
}
}
unproject(e, t) {
let i = e = (2 * e - .5) * Math.PI
, r = t = (2 * (1 - t) - 1) * Math.PI
, n = 25;
const o = 1e-6;
let s = 0
, a = 0;
do {
const n = Math.cos(r)
, o = Math.sin(r)
, l = 2 * o * n
, c = o * o
, u = n * n
, h = Math.cos(i / 2)
, d = Math.sin(i / 2)
, p = 2 * h * d
, f = d * d
, _ = 1 - u * h * h
, g = _ ? 1 / _ : 0
, y = _ ? Math.acos(n * h) * Math.sqrt(1 / _) : 0
, x = .5 * (2 * y * n * d + 2 * i / Math.PI) - e
, v = .5 * (y * o + r) - t
, b = .5 * g * (u * f + y * n * h * c) + 1 / Math.PI
, w = g * (p * l / 4 - y * o * d)
, T = .125 * g * (l * d - y * o * u * p)
, E = .5 * g * (c * h + y * f * n) + .5
, S = w * T - E * b;
s = (v * w - x * E) / S,
a = (x * T - v * b) / S,
i = m(i - s, -Math.PI, Math.PI),
r = m(r - a, -Vp, Vp)
} while ((Math.abs(s) > o || Math.abs(a) > o) && --n > 0);
return new Ca(u(i),u(r))
}
}
class Np extends Sp {
constructor(e) {
super(e),
this.center = e.center || [0, 0],
this.parallels = e.parallels || [0, 0],
this.cosPhi = Math.max(.01, Math.cos(c(this.parallels[0]))),
this.scale = 1 / (2 * Math.max(Math.PI * this.cosPhi, 1 / this.cosPhi)),
this.wrap = !0,
this.supportsWorldCopies = !0
}
project(e, t) {
const {scale: i, cosPhi: r} = this;
return {
x: c(e) * r * i + .5,
y: -Math.sin(c(t)) / r * i + .5,
z: 0
}
}
unproject(e, t) {
const {scale: i, cosPhi: r} = this
, n = -(t - .5) / i
, o = m(u((e - .5) / i) / r, -180, 180)
, s = Math.asin(m(n * r, -1, 1))
, a = m(u(s), -85.051129, Ba);
return new Ca(o,a)
}
}
class Gp extends Rp {
constructor(e) {
super(e),
this.requiresDraping = !0,
this.supportsWorldCopies = !1,
this.supportsFog = !0,
this.zAxisUnit = "pixels",
this.unsupportedLayers = ["debug", "custom"],
this.range = [3, 5]
}
projectTilePoint(e, t, i) {
const r = hp(e, t, i);
return jl(r, r, fp(rp(i))),
{
x: r[0],
y: r[1],
z: r[2]
}
}
locationPoint(e, t) {
const i = up(t.lat, t.lng)
, r = Fl([], i)
, n = e.elevation ? e.elevation.getAtPointOrZero(e.locationCoordinate(t), e._centerAltitude) : e._centerAltitude;
Rl(i, i, r, ka(1, 0) * Ta * n);
const s = gl(new Float64Array(16));
return xl(s, e.pixelMatrix, e.globeMatrix),
jl(i, i, s),
new o(i[0],i[1])
}
pixelsPerMeter(e, t) {
return ka(1, 0) * t
}
pixelSpaceConversion(e, t, i) {
const r = xi(ka(1, 45) * t, ka(1, e) * t, i);
return this.pixelsPerMeter(e, t) / r
}
createTileMatrix(e, t, i) {
const r = mp(rp(i.canonical));
return xl(new Float64Array(16), e.globeMatrix, r)
}
createInversionMatrix(e, t) {
const {center: i} = e
, r = fp(rp(t));
return Tl(r, r, c(i.lng)),
wl(r, r, c(i.lat)),
bl(r, r, [e._pixelsPerMercatorPixel, e._pixelsPerMercatorPixel, 1]),
Float32Array.from(r)
}
pointCoordinate(e, t, i, r) {
return ep(e, t, i, !0) || new Ra(0,0)
}
pointCoordinate3D(e, t, i) {
const r = this.pointCoordinate(e, t, i, 0);
return [r.x, r.y, r.z]
}
isPointAboveHorizon(e, t) {
return !ep(e, t.x, t.y, !1)
}
farthestPixelDistance(e) {
const t = function(e, t) {
const i = e.cameraToCenterDistance
, r = e._centerAltitude * t
, n = e._camera
, o = e._camera.forward()
, s = kl([], Ol([], o, -i), [0, 0, r])
, a = e.worldSize / (2 * Math.PI)
, l = [0, 0, -a]
, c = e.width / e.height
, u = Math.tan(e.fovAboveCenter)
, h = Ol([], n.up(), u)
, d = Ol([], n.right(), u * c)
, p = Fl([], kl([], kl([], o, h), d))
, f = [];
let m;
if (new Ql(s,p).closestPointOnSphere(l, a, f)) {
const t = kl([], f, l)
, i = $l([], t, s);
m = Math.cos(e.fovAboveCenter) * Il(i)
} else {
const e = $l([], s, l)
, t = $l([], l, s);
Fl(t, t);
const i = Il(e) - a;
m = Math.sqrt(i * (i + 2 * a));
const r = Math.acos(m / (a + i)) - Math.acos(Ul(o, t));
m *= Math.cos(r)
}
return 1.01 * m
}(e, this.pixelsPerMeter(e.center.lat, e.worldSize))
, i = gp(e.zoom);
if (i > 0) {
const r = wp(e, ka(1, e.center.lat) * e.worldSize)
, n = e.worldSize / (2 * Math.PI)
, o = Math.max(e.width, e.height) / e.worldSize * Math.PI;
return xi(t, r + n * (1 - Math.cos(o)), Math.pow(i, 10))
}
return t
}
upVector(e, t, i) {
return hp(t, i, e, 1)
}
upVectorScale(e) {
return {
metersToTile: Hd * dp(rp(e))
}
}
}
function $p(e) {
const t = e.parallels
, i = !!t && Math.abs(t[0] + t[1]) < .01;
switch (e.name) {
case "mercator":
return new Rp(e);
case "equirectangular":
return new Dp(e);
case "naturalEarth":
return new Up(e);
case "equalEarth":
return new Pp(e);
case "winkelTripel":
return new jp(e);
case "albers":
return i ? new Np(e) : new Cp(e);
case "lambertConformalConic":
return i ? new Np(e) : new Op(e);
case "globe":
return new Gp(e)
}
throw new Error(`Invalid projection name: ${e.name}`)
}
const qp = _u.VectorTileFeature.types
, Zp = [{
name: "a_fade_opacity",
components: 1,
type: "Uint8",
offset: 0
}];
function Wp(e, t, i, r, n, o, s, a, l, c, u, h, d) {
const p = a ? Math.min(Fd, Math.round(a[0])) : 0
, f = a ? Math.min(Fd, Math.round(a[1])) : 0;
e.emplaceBack(t, i, Math.round(32 * r), Math.round(32 * n), o, s, (p << 1) + (l ? 1 : 0), f, 16 * c, 16 * u, 256 * h, 256 * d)
}
function Xp(e, t, i, r, n, o, s) {
e.emplaceBack(t, i, r, n, o, s)
}
function Hp(e, t, i, r, n) {
e.emplaceBack(t, i, r, n),
e.emplaceBack(t, i, r, n),
e.emplaceBack(t, i, r, n),
e.emplaceBack(t, i, r, n)
}
function Yp(e) {
for (const t of e.sections)
if (bo(t.text))
return !0;
return !1
}
class Kp {
constructor(e) {
this.layoutVertexArray = new cs,
this.indexArray = new gs,
this.programConfigurations = e,
this.segments = new wa,
this.dynamicLayoutVertexArray = new os,
this.opacityVertexArray = new hs,
this.placedSymbolArray = new ks,
this.globeExtVertexArray = new us
}
isEmpty() {
return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length
}
upload(e, t, i, r) {
this.isEmpty() || (i && (this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, eh.members),
this.indexBuffer = e.createIndexBuffer(this.indexArray, t),
this.dynamicLayoutVertexBuffer = e.createVertexBuffer(this.dynamicLayoutVertexArray, ih.members, !0),
this.opacityVertexBuffer = e.createVertexBuffer(this.opacityVertexArray, Zp, !0),
this.globeExtVertexArray.length > 0 && (this.globeExtVertexBuffer = e.createVertexBuffer(this.globeExtVertexArray, th.members, !0)),
this.opacityVertexBuffer.itemSize = 1),
(i || r) && this.programConfigurations.upload(e))
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.programConfigurations.destroy(),
this.segments.destroy(),
this.dynamicLayoutVertexBuffer.destroy(),
this.opacityVertexBuffer.destroy(),
this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy())
}
}
Ln(Kp, "SymbolBuffers");
class Jp {
constructor(e, t, i) {
this.layoutVertexArray = new e,
this.layoutAttributes = t,
this.indexArray = new i,
this.segments = new wa,
this.collisionVertexArray = new ms,
this.collisionVertexArrayExt = new _s
}
upload(e) {
this.layoutVertexBuffer = e.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes),
this.indexBuffer = e.createIndexBuffer(this.indexArray),
this.collisionVertexBuffer = e.createVertexBuffer(this.collisionVertexArray, rh.members, !0),
this.collisionVertexBufferExt = e.createVertexBuffer(this.collisionVertexArrayExt, nh.members, !0)
}
destroy() {
this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.segments.destroy(),
this.collisionVertexBuffer.destroy(),
this.collisionVertexBufferExt.destroy())
}
}
Ln(Jp, "CollisionBuffers");
class Qp {
constructor(e) {
this.collisionBoxArray = e.collisionBoxArray,
this.zoom = e.zoom,
this.overscaling = e.overscaling,
this.layers = e.layers,
this.layerIds = this.layers.map((e=>e.id)),
this.index = e.index,
this.pixelRatio = e.pixelRatio,
this.sourceLayerIndex = e.sourceLayerIndex,
this.hasPattern = !1,
this.hasRTLText = !1,
this.fullyClipped = !1,
this.sortKeyRanges = [],
this.collisionCircleArray = [],
this.placementInvProjMatrix = gl([]),
this.placementViewportMatrix = gl([]);
const t = this.layers[0]._unevaluatedLayout._values;
this.textSizeData = ch(this.zoom, t["text-size"]),
this.iconSizeData = ch(this.zoom, t["icon-size"]);
const i = this.layers[0].layout
, r = i.get("symbol-sort-key")
, n = i.get("symbol-z-order");
this.canOverlap = i.get("text-allow-overlap") || i.get("icon-allow-overlap") || i.get("text-ignore-placement") || i.get("icon-ignore-placement"),
this.sortFeaturesByKey = "viewport-y" !== n && void 0 !== r.constantOr(1),
this.sortFeaturesByY = ("viewport-y" === n || "auto" === n && !this.sortFeaturesByKey) && this.canOverlap,
this.writingModes = i.get("text-writing-mode").map((e=>qh[e])),
this.stateDependentLayerIds = this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),
this.sourceID = e.sourceID,
this.projection = e.projection
}
createArrays() {
this.text = new Kp(new da(this.layers,this.zoom,(e=>/^text/.test(e)))),
this.icon = new Kp(new da(this.layers,this.zoom,(e=>/^icon/.test(e)))),
this.glyphOffsetArray = new Ls,
this.lineVertexArray = new Bs,
this.symbolInstances = new Ds
}
calculateGlyphDependencies(e, t, i, r, n) {
for (let i = 0; i < e.length; i++)
if (t[e.charCodeAt(i)] = !0,
r && n) {
const r = fh[e.charAt(i)];
r && (t[r.charCodeAt(0)] = !0)
}
}
populate(e, t, i, r) {
const n = this.layers[0]
, o = n.layout
, s = "globe" === this.projection.name
, a = o.get("text-font")
, l = o.get("text-field")
, c = o.get("icon-image")
, u = ("constant" !== l.value.kind || l.value.value instanceof wt && !l.value.value.isEmpty() || l.value.value.toString().length > 0) && ("constant" !== a.value.kind || a.value.value.length > 0)
, h = "constant" !== c.value.kind || !!c.value.value || Object.keys(c.parameters).length > 0
, d = o.get("symbol-sort-key");
if (this.features = [],
!u && !h)
return;
const p = t.iconDependencies
, f = t.glyphDependencies
, m = t.availableImages
, _ = new Lo(this.zoom);
for (const {feature: t, id: l, index: c, sourceLayerIndex: g} of e) {
const e = n._featureFilter.needGeometry
, y = Za(t, e);
if (!n._featureFilter.filter(_, y, i))
continue;
if (e || (y.geometry = qa(t, i, r)),
s && 1 !== t.type && i.z <= 5) {
const e = y.geometry
, t = .98078528056;
for (let r = 0; r < e.length; r++)
e[r] = ja(e[r], (e=>e), ((e,r)=>Ul(hp(e.x, e.y, i, 1), hp(r.x, r.y, i, 1)) < t))
}
let x, v;
if (u) {
const e = n.getValueAndResolveTokens("text-field", y, i, m)
, t = wt.factory(e);
Yp(t) && (this.hasRTLText = !0),
(!this.hasRTLText || "unavailable" === ko() || this.hasRTLText && Do.isParsed()) && (x = ph(t, n, y))
}
if (h) {
const e = n.getValueAndResolveTokens("icon-image", y, i, m);
v = e instanceof Tt ? e : Tt.fromString(e)
}
if (!x && !v)
continue;
const b = this.sortFeaturesByKey ? d.evaluate(y, {}, i) : void 0;
if (this.features.push({
id: l,
text: x,
icon: v,
index: c,
sourceLayerIndex: g,
geometry: y.geometry,
properties: t.properties,
type: qp[t.type],
sortKey: b
}),
v && (p[v.name] = !0),
x) {
const e = a.evaluate(y, {}, i).join(",")
, t = "map" === o.get("text-rotation-alignment") && "point" !== o.get("symbol-placement");
this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(qh.vertical) >= 0;
for (const i of x.sections)
if (i.image)
p[i.image.name] = !0;
else {
const r = fo(x.toString())
, n = i.fontStack || e
, o = f[n] = f[n] || {};
this.calculateGlyphDependencies(i.text, o, t, this.allowVerticalPlacement, r)
}
}
}
"line" === o.get("symbol-placement") && (this.features = function(e) {
const t = {}
, i = {}
, r = [];
let n = 0;
function o(t) {
r.push(e[t]),
n++
}
function s(e, t, n) {
const o = i[e];
return delete i[e],
i[t] = o,
r[o].geometry[0].pop(),
r[o].geometry[0] = r[o].geometry[0].concat(n[0]),
o
}
function a(e, i, n) {
const o = t[i];
return delete t[i],
t[e] = o,
r[o].geometry[0].shift(),
r[o].geometry[0] = n[0].concat(r[o].geometry[0]),
o
}
function l(e, t, i) {
const r = i ? t[0][t[0].length - 1] : t[0][0];
return `${e}:${r.x}:${r.y}`
}
for (let c = 0; c < e.length; c++) {
const u = e[c]
, h = u.geometry
, d = u.text ? u.text.toString() : null;
if (!d) {
o(c);
continue
}
const p = l(d, h)
, f = l(d, h, !0);
if (p in i && f in t && i[p] !== t[f]) {
const e = a(p, f, h)
, n = s(p, f, r[e].geometry);
delete t[p],
delete i[f],
i[l(d, r[n].geometry, !0)] = n,
r[e].geometry = null
} else
p in i ? s(p, f, h) : f in t ? a(p, f, h) : (o(c),
t[p] = n - 1,
i[f] = n - 1)
}
return r.filter((e=>e.geometry))
}(this.features)),
this.sortFeaturesByKey && this.features.sort(((e,t)=>e.sortKey - t.sortKey))
}
update(e, t, i, r) {
this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(e, t, this.layers, i, r),
this.icon.programConfigurations.updatePaintArrays(e, t, this.layers, i, r))
}
isEmpty() {
return 0 === this.symbolInstances.length && !this.hasRTLText
}
uploadPending() {
return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload
}
upload(e) {
!this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(e),
this.iconCollisionBox.upload(e)),
this.text.upload(e, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload),
this.icon.upload(e, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload),
this.uploaded = !0
}
destroyDebugData() {
this.textCollisionBox.destroy(),
this.iconCollisionBox.destroy()
}
getProjection() {
return this.projectionInstance || (this.projectionInstance = $p(this.projection)),
this.projectionInstance
}
destroy() {
this.text.destroy(),
this.icon.destroy(),
this.hasDebugData() && this.destroyDebugData()
}
addToLineVertexArray(e, t) {
const i = this.lineVertexArray.length
, r = e.segment;
if (void 0 !== r) {
let i = e.dist(t[r + 1])
, n = e.dist(t[r]);
const o = {};
for (let e = r + 1; e < t.length; e++)
o[e] = {
x: t[e].x,
y: t[e].y,
tileUnitDistanceFromAnchor: i
},
e < t.length - 1 && (i += t[e + 1].dist(t[e]));
for (let e = r || 0; e >= 0; e--)
o[e] = {
x: t[e].x,
y: t[e].y,
tileUnitDistanceFromAnchor: n
},
e > 0 && (n += t[e - 1].dist(t[e]));
for (let e = 0; e < t.length; e++) {
const t = o[e];
this.lineVertexArray.emplaceBack(t.x, t.y, t.tileUnitDistanceFromAnchor)
}
}
return {
lineStartIndex: i,
lineLength: this.lineVertexArray.length - i
}
}
addSymbols(e, t, i, r, n, o, s, a, l, c, u, h, d, p) {
const f = e.indexArray
, m = e.layoutVertexArray
, _ = e.globeExtVertexArray
, g = e.segments.prepareSegment(4 * t.length, m, f, this.canOverlap ? o.sortKey : void 0)
, y = this.glyphOffsetArray.length
, x = g.vertexLength
, v = this.allowVerticalPlacement && s === qh.vertical ? Math.PI / 2 : 0
, b = o.text && o.text.sections;
for (let r = 0; r < t.length; r++) {
const {tl: n, tr: s, bl: c, br: u, tex: h, pixelOffsetTL: y, pixelOffsetBR: x, minFontScaleX: w, minFontScaleY: T, glyphOffset: E, isSDF: S, sectionIndex: C} = t[r]
, M = g.vertexLength
, A = E[1];
if (Wp(m, l.x, l.y, n.x, A + n.y, h.x, h.y, i, S, y.x, y.y, w, T),
Wp(m, l.x, l.y, s.x, A + s.y, h.x + h.w, h.y, i, S, x.x, y.y, w, T),
Wp(m, l.x, l.y, c.x, A + c.y, h.x, h.y + h.h, i, S, y.x, x.y, w, T),
Wp(m, l.x, l.y, u.x, A + u.y, h.x + h.w, h.y + h.h, i, S, x.x, x.y, w, T),
a) {
const t = a.anchor
, i = a.up;
Xp(_, t.x, t.y, t.z, i[0], i[1], i[2]),
Xp(_, t.x, t.y, t.z, i[0], i[1], i[2]),
Xp(_, t.x, t.y, t.z, i[0], i[1], i[2]),
Xp(_, t.x, t.y, t.z, i[0], i[1], i[2]),
Hp(e.dynamicLayoutVertexArray, t.x, t.y, t.z, v)
} else
Hp(e.dynamicLayoutVertexArray, l.x, l.y, l.z, v);
f.emplaceBack(M, M + 1, M + 2),
f.emplaceBack(M + 1, M + 2, M + 3),
g.vertexLength += 4,
g.primitiveLength += 2,
this.glyphOffsetArray.emplaceBack(E[0]),
r !== t.length - 1 && C === t[r + 1].sectionIndex || e.programConfigurations.populatePaintArrays(m.length, o, o.index, {}, d, p, b && b[C])
}
const w = a ? a.anchor : l;
e.placedSymbolArray.emplaceBack(w.x, w.y, w.z, l.x, l.y, y, this.glyphOffsetArray.length - y, x, c, u, l.segment, i ? i[0] : 0, i ? i[1] : 0, r[0], r[1], s, 0, !1, 0, h, 0)
}
_commitLayoutVertex(e, t, i, r, n, o, s) {
e.emplaceBack(t, i, r, n, o, Math.round(s.x), Math.round(s.y))
}
_addCollisionDebugVertices(e, t, i, r, n, s, a) {
const l = i.segments.prepareSegment(4, i.layoutVertexArray, i.indexArray)
, c = l.vertexLength
, u = a.tileAnchorX
, h = a.tileAnchorY;
for (let e = 0; e < 4; e++)
i.collisionVertexArray.emplaceBack(0, 0, 0, 0);
i.collisionVertexArrayExt.emplaceBack(t, -e.padding, -e.padding),
i.collisionVertexArrayExt.emplaceBack(t, e.padding, -e.padding),
i.collisionVertexArrayExt.emplaceBack(t, e.padding, e.padding),
i.collisionVertexArrayExt.emplaceBack(t, -e.padding, e.padding),
this._commitLayoutVertex(i.layoutVertexArray, r, n, s, u, h, new o(e.x1,e.y1)),
this._commitLayoutVertex(i.layoutVertexArray, r, n, s, u, h, new o(e.x2,e.y1)),
this._commitLayoutVertex(i.layoutVertexArray, r, n, s, u, h, new o(e.x2,e.y2)),
this._commitLayoutVertex(i.layoutVertexArray, r, n, s, u, h, new o(e.x1,e.y2)),
l.vertexLength += 4;
const d = i.indexArray;
d.emplaceBack(c, c + 1),
d.emplaceBack(c + 1, c + 2),
d.emplaceBack(c + 2, c + 3),
d.emplaceBack(c + 3, c),
l.primitiveLength += 4
}
_addTextDebugCollisionBoxes(e, t, i, r, n, o) {
for (let s = r; s < n; s++) {
const r = i.get(s)
, n = this.getSymbolInstanceTextSize(e, o, t, s);
this._addCollisionDebugVertices(r, n, this.textCollisionBox, r.projectedAnchorX, r.projectedAnchorY, r.projectedAnchorZ, o)
}
}
_addIconDebugCollisionBoxes(e, t, i, r, n, o) {
for (let s = r; s < n; s++) {
const r = i.get(s)
, n = this.getSymbolInstanceIconSize(e, t, s);
this._addCollisionDebugVertices(r, n, this.iconCollisionBox, r.projectedAnchorX, r.projectedAnchorY, r.projectedAnchorZ, o)
}
}
generateCollisionDebugBuffers(e, t) {
this.hasDebugData() && this.destroyDebugData(),
this.textCollisionBox = new Jp(ps,oh.members,Ts),
this.iconCollisionBox = new Jp(ps,oh.members,Ts);
const i = hh(this.iconSizeData, e)
, r = hh(this.textSizeData, e);
for (let n = 0; n < this.symbolInstances.length; n++) {
const o = this.symbolInstances.get(n);
this._addTextDebugCollisionBoxes(r, e, t, o.textBoxStartIndex, o.textBoxEndIndex, o),
this._addTextDebugCollisionBoxes(r, e, t, o.verticalTextBoxStartIndex, o.verticalTextBoxEndIndex, o),
this._addIconDebugCollisionBoxes(i, e, t, o.iconBoxStartIndex, o.iconBoxEndIndex, o),
this._addIconDebugCollisionBoxes(i, e, t, o.verticalIconBoxStartIndex, o.verticalIconBoxEndIndex, o)
}
}
getSymbolInstanceTextSize(e, t, i, r) {
const n = this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex >= 0 ? t.rightJustifiedTextSymbolIndex : t.centerJustifiedTextSymbolIndex >= 0 ? t.centerJustifiedTextSymbolIndex : t.leftJustifiedTextSymbolIndex >= 0 ? t.leftJustifiedTextSymbolIndex : t.verticalPlacedTextSymbolIndex >= 0 ? t.verticalPlacedTextSymbolIndex : r)
, o = uh(this.textSizeData, e, n) / ah;
return this.tilePixelRatio * o
}
getSymbolInstanceIconSize(e, t, i) {
const r = this.icon.placedSymbolArray.get(i)
, n = uh(this.iconSizeData, e, r);
return this.tilePixelRatio * n
}
_commitDebugCollisionVertexUpdate(e, t, i) {
e.emplaceBack(t, -i, -i),
e.emplaceBack(t, i, -i),
e.emplaceBack(t, i, i),
e.emplaceBack(t, -i, i)
}
_updateTextDebugCollisionBoxes(e, t, i, r, n, o) {
for (let s = r; s < n; s++) {
const r = i.get(s)
, n = this.getSymbolInstanceTextSize(e, o, t, s);
this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt, n, r.padding)
}
}
_updateIconDebugCollisionBoxes(e, t, i, r, n) {
for (let o = r; o < n; o++) {
const r = i.get(o)
, n = this.getSymbolInstanceIconSize(e, t, o);
this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt, n, r.padding)
}
}
updateCollisionDebugBuffers(e, t) {
if (!this.hasDebugData())
return;
this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexArrayExt.clear(),
this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexArrayExt.clear();
const i = hh(this.iconSizeData, e)
, r = hh(this.textSizeData, e);
for (let n = 0; n < this.symbolInstances.length; n++) {
const o = this.symbolInstances.get(n);
this._updateTextDebugCollisionBoxes(r, e, t, o.textBoxStartIndex, o.textBoxEndIndex, o),
this._updateTextDebugCollisionBoxes(r, e, t, o.verticalTextBoxStartIndex, o.verticalTextBoxEndIndex, o),
this._updateIconDebugCollisionBoxes(i, e, t, o.iconBoxStartIndex, o.iconBoxEndIndex),
this._updateIconDebugCollisionBoxes(i, e, t, o.verticalIconBoxStartIndex, o.verticalIconBoxEndIndex)
}
this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexBufferExt && this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),
this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexBufferExt && this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)
}
_deserializeCollisionBoxesForSymbol(e, t, i, r, n, o, s, a, l) {
const c = {};
for (let r = t; r < i; r++) {
const t = e.get(r);
c.textBox = {
x1: t.x1,
y1: t.y1,
x2: t.x2,
y2: t.y2,
padding: t.padding,
projectedAnchorX: t.projectedAnchorX,
projectedAnchorY: t.projectedAnchorY,
projectedAnchorZ: t.projectedAnchorZ,
tileAnchorX: t.tileAnchorX,
tileAnchorY: t.tileAnchorY
},
c.textFeatureIndex = t.featureIndex;
break
}
for (let t = r; t < n; t++) {
const i = e.get(t);
c.verticalTextBox = {
x1: i.x1,
y1: i.y1,
x2: i.x2,
y2: i.y2,
padding: i.padding,
projectedAnchorX: i.projectedAnchorX,
projectedAnchorY: i.projectedAnchorY,
projectedAnchorZ: i.projectedAnchorZ,
tileAnchorX: i.tileAnchorX,
tileAnchorY: i.tileAnchorY
},
c.verticalTextFeatureIndex = i.featureIndex;
break
}
for (let t = o; t < s; t++) {
const i = e.get(t);
c.iconBox = {
x1: i.x1,
y1: i.y1,
x2: i.x2,
y2: i.y2,
padding: i.padding,
projectedAnchorX: i.projectedAnchorX,
projectedAnchorY: i.projectedAnchorY,
projectedAnchorZ: i.projectedAnchorZ,
tileAnchorX: i.tileAnchorX,
tileAnchorY: i.tileAnchorY
},
c.iconFeatureIndex = i.featureIndex;
break
}
for (let t = a; t < l; t++) {
const i = e.get(t);
c.verticalIconBox = {
x1: i.x1,
y1: i.y1,
x2: i.x2,
y2: i.y2,
padding: i.padding,
projectedAnchorX: i.projectedAnchorX,
projectedAnchorY: i.projectedAnchorY,
projectedAnchorZ: i.projectedAnchorZ,
tileAnchorX: i.tileAnchorX,
tileAnchorY: i.tileAnchorY
},
c.verticalIconFeatureIndex = i.featureIndex;
break
}
return c
}
deserializeCollisionBoxes(e) {
this.collisionArrays = [];
for (let t = 0; t < this.symbolInstances.length; t++) {
const i = this.symbolInstances.get(t);
this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e, i.textBoxStartIndex, i.textBoxEndIndex, i.verticalTextBoxStartIndex, i.verticalTextBoxEndIndex, i.iconBoxStartIndex, i.iconBoxEndIndex, i.verticalIconBoxStartIndex, i.verticalIconBoxEndIndex))
}
}
hasTextData() {
return this.text.segments.get().length > 0
}
hasIconData() {
return this.icon.segments.get().length > 0
}
hasDebugData() {
return this.textCollisionBox && this.iconCollisionBox
}
hasTextCollisionBoxData() {
return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0
}
hasIconCollisionBoxData() {
return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0
}
addIndicesForPlacedSymbol(e, t) {
const i = e.placedSymbolArray.get(t)
, r = i.vertexStartIndex + 4 * i.numGlyphs;
for (let t = i.vertexStartIndex; t < r; t += 4)
e.indexArray.emplaceBack(t, t + 1, t + 2),
e.indexArray.emplaceBack(t + 1, t + 2, t + 3)
}
getSortedSymbolIndexes(e) {
if (this.sortedAngle === e && void 0 !== this.symbolInstanceIndexes)
return this.symbolInstanceIndexes;
const t = Math.sin(e)
, i = Math.cos(e)
, r = []
, n = []
, o = [];
for (let e = 0; e < this.symbolInstances.length; ++e) {
o.push(e);
const s = this.symbolInstances.get(e);
r.push(0 | Math.round(t * s.tileAnchorX + i * s.tileAnchorY)),
n.push(s.featureIndex)
}
return o.sort(((e,t)=>r[e] - r[t] || n[t] - n[e])),
o
}
addToSortKeyRanges(e, t) {
const i = this.sortKeyRanges[this.sortKeyRanges.length - 1];
i && i.sortKey === t ? i.symbolInstanceEnd = e + 1 : this.sortKeyRanges.push({
sortKey: t,
symbolInstanceStart: e,
symbolInstanceEnd: e + 1
})
}
sortFeatures(e) {
if (this.sortFeaturesByY && this.sortedAngle !== e && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) {
this.symbolInstanceIndexes = this.getSortedSymbolIndexes(e),
this.sortedAngle = e,
this.text.indexArray.clear(),
this.icon.indexArray.clear(),
this.featureSortOrder = [];
for (const e of this.symbolInstanceIndexes) {
const t = this.symbolInstances.get(e);
this.featureSortOrder.push(t.featureIndex),
[t.rightJustifiedTextSymbolIndex, t.centerJustifiedTextSymbolIndex, t.leftJustifiedTextSymbolIndex].forEach(((e,t,i)=>{
e >= 0 && i.indexOf(e) === t && this.addIndicesForPlacedSymbol(this.text, e)
}
)),
t.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, t.verticalPlacedTextSymbolIndex),
t.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, t.placedIconSymbolIndex),
t.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, t.verticalPlacedIconSymbolIndex)
}
this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray),
this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray)
}
}
}
Ln(Qp, "SymbolBucket", {
omit: ["layers", "collisionBoxArray", "features", "compareText"]
}),
Qp.MAX_GLYPHS = 65535,
Qp.addDynamicAttributes = Hp;
const ef = new Xo({
"symbol-placement": new Go(Ze.layout_symbol["symbol-placement"]),
"symbol-spacing": new Go(Ze.layout_symbol["symbol-spacing"]),
"symbol-avoid-edges": new Go(Ze.layout_symbol["symbol-avoid-edges"]),
"symbol-sort-key": new $o(Ze.layout_symbol["symbol-sort-key"]),
"symbol-z-order": new Go(Ze.layout_symbol["symbol-z-order"]),
"icon-allow-overlap": new Go(Ze.layout_symbol["icon-allow-overlap"]),
"icon-ignore-placement": new Go(Ze.layout_symbol["icon-ignore-placement"]),
"icon-optional": new Go(Ze.layout_symbol["icon-optional"]),
"icon-rotation-alignment": new Go(Ze.layout_symbol["icon-rotation-alignment"]),
"icon-size": new $o(Ze.layout_symbol["icon-size"]),
"icon-text-fit": new Go(Ze.layout_symbol["icon-text-fit"]),
"icon-text-fit-padding": new Go(Ze.layout_symbol["icon-text-fit-padding"]),
"icon-image": new $o(Ze.layout_symbol["icon-image"]),
"icon-rotate": new $o(Ze.layout_symbol["icon-rotate"]),
"icon-padding": new Go(Ze.layout_symbol["icon-padding"]),
"icon-keep-upright": new Go(Ze.layout_symbol["icon-keep-upright"]),
"icon-offset": new $o(Ze.layout_symbol["icon-offset"]),
"icon-anchor": new $o(Ze.layout_symbol["icon-anchor"]),
"icon-pitch-alignment": new Go(Ze.layout_symbol["icon-pitch-alignment"]),
"text-pitch-alignment": new Go(Ze.layout_symbol["text-pitch-alignment"]),
"text-rotation-alignment": new Go(Ze.layout_symbol["text-rotation-alignment"]),
"text-field": new $o(Ze.layout_symbol["text-field"]),
"text-font": new $o(Ze.layout_symbol["text-font"]),
"text-size": new $o(Ze.layout_symbol["text-size"]),
"text-max-width": new $o(Ze.layout_symbol["text-max-width"]),
"text-line-height": new $o(Ze.layout_symbol["text-line-height"]),
"text-letter-spacing": new $o(Ze.layout_symbol["text-letter-spacing"]),
"text-justify": new $o(Ze.layout_symbol["text-justify"]),
"text-radial-offset": new $o(Ze.layout_symbol["text-radial-offset"]),
"text-variable-anchor": new Go(Ze.layout_symbol["text-variable-anchor"]),
"text-anchor": new $o(Ze.layout_symbol["text-anchor"]),
"text-max-angle": new Go(Ze.layout_symbol["text-max-angle"]),
"text-writing-mode": new Go(Ze.layout_symbol["text-writing-mode"]),
"text-rotate": new $o(Ze.layout_symbol["text-rotate"]),
"text-padding": new Go(Ze.layout_symbol["text-padding"]),
"text-keep-upright": new Go(Ze.layout_symbol["text-keep-upright"]),
"text-transform": new $o(Ze.layout_symbol["text-transform"]),
"text-offset": new $o(Ze.layout_symbol["text-offset"]),
"text-allow-overlap": new Go(Ze.layout_symbol["text-allow-overlap"]),
"text-ignore-placement": new Go(Ze.layout_symbol["text-ignore-placement"]),
"text-optional": new Go(Ze.layout_symbol["text-optional"])
});
var tf = {
paint: new Xo({
"icon-opacity": new $o(Ze.paint_symbol["icon-opacity"]),
"icon-color": new $o(Ze.paint_symbol["icon-color"]),
"icon-halo-color": new $o(Ze.paint_symbol["icon-halo-color"]),
"icon-halo-width": new $o(Ze.paint_symbol["icon-halo-width"]),
"icon-halo-blur": new $o(Ze.paint_symbol["icon-halo-blur"]),
"icon-translate": new Go(Ze.paint_symbol["icon-translate"]),
"icon-translate-anchor": new Go(Ze.paint_symbol["icon-translate-anchor"]),
"text-opacity": new $o(Ze.paint_symbol["text-opacity"]),
"text-color": new $o(Ze.paint_symbol["text-color"],{
runtimeType: nt,
getOverride: e=>e.textColor,
hasOverride: e=>!!e.textColor
}),
"text-halo-color": new $o(Ze.paint_symbol["text-halo-color"]),
"text-halo-width": new $o(Ze.paint_symbol["text-halo-width"]),
"text-halo-blur": new $o(Ze.paint_symbol["text-halo-blur"]),
"text-translate": new Go(Ze.paint_symbol["text-translate"]),
"text-translate-anchor": new Go(Ze.paint_symbol["text-translate-anchor"])
}),
layout: ef
};
class rf {
constructor(e) {
this.type = e.property.overrides ? e.property.overrides.runtimeType : et,
this.defaultValue = e
}
evaluate(e) {
if (e.formattedSection) {
const t = this.defaultValue.property.overrides;
if (t && t.hasOverride(e.formattedSection))
return t.getOverride(e.formattedSection)
}
return e.feature && e.featureState ? this.defaultValue.evaluate(e.feature, e.featureState) : this.defaultValue.property.specification.default
}
eachChild(e) {
this.defaultValue.isConstant() || e(this.defaultValue.value._styleExpression.expression)
}
outputDefined() {
return !1
}
serialize() {
return null
}
}
Ln(rf, "FormatSectionOverride", {
omit: ["defaultValue"]
});
class nf extends xa {
constructor(e) {
super(e, tf)
}
recalculate(e, t) {
super.recalculate(e, t),
"auto" === this.layout.get("icon-rotation-alignment") && (this.layout._values["icon-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"),
"auto" === this.layout.get("text-rotation-alignment") && (this.layout._values["text-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"),
"auto" === this.layout.get("text-pitch-alignment") && (this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment")),
"auto" === this.layout.get("icon-pitch-alignment") && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment"));
const i = this.layout.get("text-writing-mode");
if (i) {
const e = [];
for (const t of i)
e.indexOf(t) < 0 && e.push(t);
this.layout._values["text-writing-mode"] = e
} else
this.layout._values["text-writing-mode"] = "point" === this.layout.get("symbol-placement") ? ["horizontal"] : ["horizontal", "vertical"];
this._setPaintOverrides()
}
getValueAndResolveTokens(e, t, i, r) {
const n = this.layout.get(e).evaluate(t, {}, i, r)
, o = this._unevaluatedLayout._values[e];
return o.isDataDriven() || Or(o.value) || !n ? n : function(e, t) {
return t.replace(/{([^{}]+)}/g, ((t,i)=>i in e ? String(e[i]) : ""))
}(t.properties, n)
}
createBucket(e) {
return new Qp(e)
}
queryRadius() {
return 0
}
queryIntersectsFeature() {
return !1
}
_setPaintOverrides() {
for (const e of tf.paint.overridableProperties) {
if (!nf.hasPaintOverride(this.layout, e))
continue;
const t = this.paint.get(e)
, i = new rf(t)
, r = new Br(i,t.property.specification);
let n = null;
n = "constant" === t.value.kind || "source" === t.value.kind ? new Fr("source",r) : new Ur("composite",r,t.value.zoomStops,t.value._interpolationType),
this.paint._values[e] = new jo(t.property,n,t.parameters)
}
}
_handleOverridablePaintPropertyUpdate(e, t, i) {
return !(!this.layout || t.isDataDriven() || i.isDataDriven()) && nf.hasPaintOverride(this.layout, e)
}
static hasPaintOverride(e, t) {
const i = e.get("text-field")
, r = tf.paint.properties[t];
let n = !1;
const o = e=>{
for (const t of e)
if (r.overrides && r.overrides.hasOverride(t))
return void (n = !0)
}
;
if ("constant" === i.value.kind && i.value.value instanceof wt)
o(i.value.value.sections);
else if ("source" === i.value.kind) {
const e = t=>{
n || (t instanceof It && Ct(t.value) === lt ? o(t.value.sections) : t instanceof Lt ? o(t.sections) : t.eachChild(e))
}
, t = i.value;
t._styleExpression && e(t._styleExpression.expression)
}
return n
}
getProgramConfiguration(e) {
return new ha(this,e)
}
}
var of = {
paint: new Xo({
"background-color": new Go(Ze.paint_background["background-color"]),
"background-pattern": new Zo(Ze.paint_background["background-pattern"]),
"background-opacity": new Go(Ze.paint_background["background-opacity"])
})
}
, sf = {
paint: new Xo({
"raster-opacity": new Go(Ze.paint_raster["raster-opacity"]),
"raster-hue-rotate": new Go(Ze.paint_raster["raster-hue-rotate"]),
"raster-brightness-min": new Go(Ze.paint_raster["raster-brightness-min"]),
"raster-brightness-max": new Go(Ze.paint_raster["raster-brightness-max"]),
"raster-saturation": new Go(Ze.paint_raster["raster-saturation"]),
"raster-contrast": new Go(Ze.paint_raster["raster-contrast"]),
"raster-resampling": new Go(Ze.paint_raster["raster-resampling"]),
"raster-fade-duration": new Go(Ze.paint_raster["raster-fade-duration"])
})
};
class af extends xa {
constructor(e) {
super(e, {}),
this.implementation = e
}
is3D() {
return "3d" === this.implementation.renderingMode
}
hasOffscreenPass() {
return void 0 !== this.implementation.prerender
}
recalculate() {}
updateTransitions() {}
hasTransition() {
return !1
}
serialize() {}
onAdd(e) {
this.implementation.onAdd && this.implementation.onAdd(e, e.painter.context.gl)
}
onRemove(e) {
this.implementation.onRemove && this.implementation.onRemove(e, e.painter.context.gl)
}
}
var lf = {
paint: new Xo({
"sky-type": new Go(Ze.paint_sky["sky-type"]),
"sky-atmosphere-sun": new Go(Ze.paint_sky["sky-atmosphere-sun"]),
"sky-atmosphere-sun-intensity": new Go(Ze.paint_sky["sky-atmosphere-sun-intensity"]),
"sky-gradient-center": new Go(Ze.paint_sky["sky-gradient-center"]),
"sky-gradient-radius": new Go(Ze.paint_sky["sky-gradient-radius"]),
"sky-gradient": new Wo(Ze.paint_sky["sky-gradient"]),
"sky-atmosphere-halo-color": new Go(Ze.paint_sky["sky-atmosphere-halo-color"]),
"sky-atmosphere-color": new Go(Ze.paint_sky["sky-atmosphere-color"]),
"sky-opacity": new Go(Ze.paint_sky["sky-opacity"])
})
};
function cf(e, t, i) {
const r = [0, 0, 1]
, n = Yl([]);
return Jl(n, n, i ? -c(e) + Math.PI : c(e)),
Kl(n, n, -c(t)),
Nl(r, r, n),
Fl(r, r)
}
const uf = {
circle: class extends xa {
constructor(e) {
super(e, pl)
}
createBucket(e) {
return new Ha(e)
}
queryRadius(e) {
const t = e;
return ll("circle-radius", this, t) + ll("circle-stroke-width", this, t) + cl(this.paint.get("circle-translate"))
}
queryIntersectsFeature(e, t, i, r, n, o, s, a) {
const l = hl(this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), o.angle, e.pixelToTileUnitsFactor)
, c = this.paint.get("circle-radius").evaluate(t, i) + this.paint.get("circle-stroke-width").evaluate(t, i);
return rc(e, r, o, s, a, "map" === this.paint.get("circle-pitch-alignment"), "map" === this.paint.get("circle-pitch-scale"), l, c)
}
getProgramIds() {
return ["circle"]
}
getProgramConfiguration(e) {
return new ha(this,e)
}
}
,
heatmap: class extends xa {
createBucket(e) {
return new lc(e)
}
constructor(e) {
super(e, fc),
this._updateColorRamp()
}
_handleSpecialPaintPropertyUpdate(e) {
"heatmap-color" === e && this._updateColorRamp()
}
_updateColorRamp() {
this.colorRamp = mc({
expression: this._transitionablePaint._values["heatmap-color"].value.expression,
evaluationKey: "heatmapDensity",
image: this.colorRamp
}),
this.colorRampTexture = null
}
resize() {
this.heatmapFbo && (this.heatmapFbo.destroy(),
this.heatmapFbo = null)
}
queryRadius(e) {
return ll("heatmap-radius", this, e)
}
queryIntersectsFeature(e, t, i, r, n, s, a, l) {
const c = this.paint.get("heatmap-radius").evaluate(t, i);
return rc(e, r, s, a, l, !0, !0, new o(0,0), c)
}
hasOffscreenPass() {
return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility
}
getProgramIds() {
return ["heatmap", "heatmapTexture"]
}
getProgramConfiguration(e) {
return new ha(this,e)
}
}
,
hillshade: class extends xa {
constructor(e) {
super(e, _c)
}
hasOffscreenPass() {
return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility
}
getProgramIds() {
return ["hillshade", "hillshadePrepare"]
}
}
,
fill: class extends xa {
constructor(e) {
super(e, ru)
}
getProgramIds() {
const e = this.paint.get("fill-pattern")
, t = e && e.constantOr(1)
, i = [t ? "fillPattern" : "fill"];
return this.paint.get("fill-antialias") && i.push(t && !this.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline"),
i
}
getProgramConfiguration(e) {
return new ha(this,e)
}
recalculate(e, t) {
super.recalculate(e, t);
const i = this.paint._values["fill-outline-color"];
"constant" === i.value.kind && void 0 === i.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"])
}
createBucket(e) {
return new tu(e)
}
queryRadius() {
return cl(this.paint.get("fill-translate"))
}
queryIntersectsFeature(e, t, i, r, n, o) {
return !e.queryGeometry.isAboveHorizon && Ja(ul(e.tilespaceGeometry, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), o.angle, e.pixelToTileUnitsFactor), r)
}
isTileClipped() {
return !0
}
}
,
"fill-extrusion": class extends xa {
constructor(e) {
super(e, Du)
}
createBucket(e) {
return new Tu(e)
}
queryRadius() {
return cl(this.paint.get("fill-extrusion-translate"))
}
is3D() {
return !0
}
getProgramIds() {
return [this.paint.get("fill-extrusion-pattern").constantOr(1) ? "fillExtrusionPattern" : "fillExtrusion"]
}
getProgramConfiguration(e) {
return new ha(this,e)
}
queryIntersectsFeature(e, t, i, r, n, s, a, l, c) {
const u = hl(this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), s.angle, e.pixelToTileUnitsFactor)
, h = this.paint.get("fill-extrusion-height").evaluate(t, i)
, d = this.paint.get("fill-extrusion-base").evaluate(t, i)
, p = [0, 0]
, f = l && s.elevation
, m = s.elevation ? s.elevation.exaggeration() : 1
, _ = e.tile.getBucket(this);
if (f && _ instanceof Tu) {
const e = _.centroidVertexArray
, t = c + 1;
if (t < e.length) {
const i = e.get(t);
p[0] = i.a_centroid_pos0,
p[1] = i.a_centroid_pos1
}
}
if (0 === p[0] && 1 === p[1])
return !1;
"globe" === s.projection.name && (r = ku([r], [new o(0,0), new o(Ta,Ta)], e.tileID.canonical).map((e=>e.polygon)).flat());
const g = function(e, t, i, r, n, s, a, l, c, u, h) {
return "globe" === e.projection.name ? function(e, t, i, r, n, o, s, a, l, c, u) {
const h = []
, d = []
, p = e.projection.upVectorScale(u, e.center.lat, e.worldSize).metersToTile
, f = [0, 0, 0, 1]
, m = [0, 0, 0, 1]
, _ = (e,t,i,r)=>{
e[0] = t,
e[1] = i,
e[2] = r,
e[3] = 1
}
, g = zu();
i > 0 && (i += g),
r += g;
for (const g of t) {
const t = []
, y = [];
for (const h of g) {
const d = h.x + n.x
, g = h.y + n.y
, x = e.projection.projectTilePoint(d, g, u)
, v = e.projection.upVector(u, h.x, h.y);
let b = i
, w = r;
if (s) {
const e = Nu(d, g, i, r, s, a, l, c);
b += e.base,
w += e.top
}
0 !== i ? _(f, x.x + v[0] * p * b, x.y + v[1] * p * b, x.z + v[2] * p * b) : _(f, x.x, x.y, x.z),
_(m, x.x + v[0] * p * w, x.y + v[1] * p * w, x.z + v[2] * p * w),
jl(f, f, o),
jl(m, m, o),
t.push(ju(f)),
y.push(ju(m))
}
h.push(t),
d.push(y)
}
return [h, d]
}(e, t, i, r, n, s, a, l, c, u, h) : a ? function(e, t, i, r, n, o, s, a, l) {
const c = []
, u = []
, h = [0, 0, 0, 1];
for (const d of e) {
const e = []
, p = [];
for (const c of d) {
const u = c.x + r.x
, d = c.y + r.y
, f = Nu(u, d, t, i, o, s, a, l);
h[0] = u,
h[1] = d,
h[2] = f.base,
h[3] = 1,
Xl(h, h, n),
h[3] = Math.max(h[3], 1e-5);
const m = ju([h[0] / h[3], h[1] / h[3], h[2] / h[3]]);
h[0] = u,
h[1] = d,
h[2] = f.top,
h[3] = 1,
Xl(h, h, n),
h[3] = Math.max(h[3], 1e-5);
const _ = ju([h[0] / h[3], h[1] / h[3], h[2] / h[3]]);
e.push(m),
p.push(_)
}
c.push(e),
u.push(p)
}
return [c, u]
}(t, i, r, n, s, a, l, c, u) : function(e, t, i, r, n) {
const s = []
, a = []
, l = n[8] * t
, c = n[9] * t
, u = n[10] * t
, h = n[11] * t
, d = n[8] * i
, p = n[9] * i
, f = n[10] * i
, m = n[11] * i;
for (const t of e) {
const e = []
, i = [];
for (const s of t) {
const t = s.x + r.x
, a = s.y + r.y
, _ = n[0] * t + n[4] * a + n[12]
, g = n[1] * t + n[5] * a + n[13]
, y = n[2] * t + n[6] * a + n[14]
, x = n[3] * t + n[7] * a + n[15]
, v = _ + l
, b = g + c
, w = y + u
, T = Math.max(x + h, 1e-5)
, E = _ + d
, S = g + p
, C = y + f
, M = Math.max(x + m, 1e-5)
, A = new o(v / T,b / T);
A.z = w / T,
e.push(A);
const I = new o(E / M,S / M);
I.z = C / M,
i.push(I)
}
s.push(e),
a.push(i)
}
return [s, a]
}(t, i, r, n, s)
}(s, r, d, h, u, a, f ? l : null, p, m, s.center.lat, e.tileID.canonical)
, y = e.queryGeometry;
return function(e, t, i) {
let r = 1 / 0;
Ja(i, t) && (r = Vu(i, t[0]));
for (let n = 0; n < t.length; n++) {
const o = t[n]
, s = e[n];
for (let e = 0; e < o.length - 1; e++) {
const t = o[e]
, n = [t, o[e + 1], s[e + 1], s[e], t];
Ya(i, n) && (r = Math.min(r, Vu(i, n)))
}
}
return r !== 1 / 0 && r
}(g[0], g[1], y.isPointQuery() ? y.screenBounds : y.screenGeometry)
}
}
,
line: class extends xa {
constructor(e) {
super(e, Ku),
this.gradientVersion = 0
}
_handleSpecialPaintPropertyUpdate(e) {
if ("line-gradient" === e) {
const e = this._transitionablePaint._values["line-gradient"].value.expression;
this.stepInterpolant = e._styleExpression && e._styleExpression.expression instanceof yi,
this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER
}
}
gradientExpression() {
return this._transitionablePaint._values["line-gradient"].value.expression
}
recalculate(e, t) {
super.recalculate(e, t),
this.paint._values["line-floorwidth"] = Ju.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, e)
}
createBucket(e) {
return new Hu(e)
}
getProgramIds() {
return [this.paint.get("line-pattern").constantOr(1) ? "linePattern" : "line"]
}
getProgramConfiguration(e) {
return new ha(this,e)
}
queryRadius(e) {
const t = e
, i = Qu(ll("line-width", this, t), ll("line-gap-width", this, t))
, r = ll("line-offset", this, t);
return i / 2 + Math.abs(r) + cl(this.paint.get("line-translate"))
}
queryIntersectsFeature(e, t, i, r, n, s) {
if (e.queryGeometry.isAboveHorizon)
return !1;
const a = ul(e.tilespaceGeometry, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), s.angle, e.pixelToTileUnitsFactor)
, l = e.pixelToTileUnitsFactor / 2 * Qu(this.paint.get("line-width").evaluate(t, i), this.paint.get("line-gap-width").evaluate(t, i))
, c = this.paint.get("line-offset").evaluate(t, i);
return c && (r = function(e, t) {
const i = []
, r = new o(0,0);
for (let n = 0; n < e.length; n++) {
const o = e[n]
, s = [];
for (let e = 0; e < o.length; e++) {
const i = o[e - 1]
, n = o[e]
, a = o[e + 1]
, l = 0 === e ? r : n.sub(i)._unit()._perp()
, c = e === o.length - 1 ? r : a.sub(n)._unit()._perp()
, u = l._add(c)._unit();
u._mult(1 / (u.x * c.x + u.y * c.y)),
s.push(u._mult(t)._add(n))
}
i.push(s)
}
return i
}(r, c * e.pixelToTileUnitsFactor)),
function(e, t, i) {
for (let r = 0; r < t.length; r++) {
const n = t[r];
if (e.length >= 3)
for (let t = 0; t < n.length; t++)
if (ol(e, n[t]))
return !0;
if (Qa(e, n, i))
return !0
}
return !1
}(a, r, l)
}
isTileClipped() {
return !0
}
}
,
symbol: nf,
background: class extends xa {
constructor(e) {
super(e, of)
}
getProgramIds() {
return [this.paint.get("background-pattern") ? "backgroundPattern" : "background"]
}
}
,
raster: class extends xa {
constructor(e) {
super(e, sf)
}
getProgramIds() {
return ["raster"]
}
}
,
sky: class extends xa {
constructor(e) {
super(e, lf),
this._updateColorRamp()
}
_handleSpecialPaintPropertyUpdate(e) {
"sky-gradient" === e ? this._updateColorRamp() : "sky-atmosphere-sun" !== e && "sky-atmosphere-halo-color" !== e && "sky-atmosphere-color" !== e && "sky-atmosphere-sun-intensity" !== e || (this._skyboxInvalidated = !0)
}
_updateColorRamp() {
this.colorRamp = mc({
expression: this._transitionablePaint._values["sky-gradient"].value.expression,
evaluationKey: "skyRadialProgress"
}),
this.colorRampTexture && (this.colorRampTexture.destroy(),
this.colorRampTexture = null)
}
needsSkyboxCapture(e) {
if (this._skyboxInvalidated || !this.skyboxTexture || !this.skyboxGeometry)
return !0;
if (!this.paint.get("sky-atmosphere-sun")) {
const t = e.style.light.properties.get("position");
return this._lightPosition.azimuthal !== t.azimuthal || this._lightPosition.polar !== t.polar
}
return !1
}
getCenter(e, t) {
if ("atmosphere" === this.paint.get("sky-type")) {
const i = this.paint.get("sky-atmosphere-sun")
, r = !i
, n = e.style.light
, o = n.properties.get("position");
return r && "viewport" === n.properties.get("anchor") && P("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),
r ? cf(o.azimuthal, 90 - o.polar, t) : cf(i[0], 90 - i[1], t)
}
const i = this.paint.get("sky-gradient-center");
return cf(i[0], 90 - i[1], t)
}
is3D() {
return !1
}
isSky() {
return !0
}
markSkyboxValid(e) {
this._skyboxInvalidated = !1,
this._lightPosition = e.style.light.properties.get("position")
}
hasOffscreenPass() {
return !0
}
getProgramIds() {
const e = this.paint.get("sky-type");
return "atmosphere" === e ? ["skyboxCapture", "skybox"] : "gradient" === e ? ["skyboxGradient"] : null
}
}
};
class hf {
constructor(e, t, i, r) {
this.context = e,
this.format = i,
this.texture = e.gl.createTexture(),
this.update(t, r)
}
update(e, i, r) {
const {width: n, height: o} = e
, {context: s} = this
, {gl: a} = s
, {HTMLImageElement: l, HTMLCanvasElement: c, HTMLVideoElement: u, ImageData: h, ImageBitmap: d} = t;
if (a.bindTexture(a.TEXTURE_2D, this.texture),
s.pixelStoreUnpackFlipY.set(!1),
s.pixelStoreUnpack.set(1),
s.pixelStoreUnpackPremultiplyAlpha.set(this.format === a.RGBA && (!i || !1 !== i.premultiply)),
r || this.size && this.size[0] === n && this.size[1] === o) {
const {x: t, y: i} = r || {
x: 0,
y: 0
};
e instanceof l || e instanceof c || e instanceof u || e instanceof h || d && e instanceof d ? a.texSubImage2D(a.TEXTURE_2D, 0, t, i, a.RGBA, a.UNSIGNED_BYTE, e) : a.texSubImage2D(a.TEXTURE_2D, 0, t, i, n, o, a.RGBA, a.UNSIGNED_BYTE, e.data)
} else
this.size = [n, o],
e instanceof l || e instanceof c || e instanceof u || e instanceof h || d && e instanceof d ? a.texImage2D(a.TEXTURE_2D, 0, this.format, this.format, a.UNSIGNED_BYTE, e) : a.texImage2D(a.TEXTURE_2D, 0, this.format, n, o, 0, this.format, a.UNSIGNED_BYTE, e.data);
this.useMipmap = Boolean(i && i.useMipmap && this.isSizePowerOfTwo()),
this.useMipmap && a.generateMipmap(a.TEXTURE_2D)
}
bind(e, t) {
const {context: i} = this
, {gl: r} = i;
r.bindTexture(r.TEXTURE_2D, this.texture),
e !== this.filter && (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, e),
r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, this.useMipmap ? e === r.NEAREST ? r.NEAREST_MIPMAP_NEAREST : r.LINEAR_MIPMAP_NEAREST : e),
this.filter = e),
t !== this.wrap && (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, t),
r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, t),
this.wrap = t)
}
isSizePowerOfTwo() {
return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0
}
destroy() {
const {gl: e} = this.context;
e.deleteTexture(this.texture),
this.texture = null
}
}
class df {
constructor(e, t) {
this.width = e,
this.height = t,
this.nextRow = 0,
this.image = new dc({
width: e,
height: t
}),
this.positions = {},
this.uploaded = !1
}
getDash(e, t) {
const i = this.getKey(e, t);
return this.positions[i]
}
trim() {
const e = this.width
, t = this.height = E(this.nextRow);
this.image.resize({
width: e,
height: t
})
}
getKey(e, t) {
return e.join(",") + t
}
getDashRanges(e, t, i) {
const r = [];
let n = e.length % 2 == 1 ? -e[e.length - 1] * i : 0
, o = e[0] * i
, s = !0;
r.push({
left: n,
right: o,
isDash: s,
zeroLength: 0 === e[0]
});
let a = e[0];
for (let t = 1; t < e.length; t++) {
s = !s;
const l = e[t];
n = a * i,
a += l,
o = a * i,
r.push({
left: n,
right: o,
isDash: s,
zeroLength: 0 === l
})
}
return r
}
addRoundDash(e, t, i) {
const r = t / 2;
for (let t = -i; t <= i; t++) {
const n = this.width * (this.nextRow + i + t);
let o = 0
, s = e[o];
for (let a = 0; a < this.width; a++) {
a / s.right > 1 && (s = e[++o]);
const l = Math.abs(a - s.left)
, c = Math.abs(a - s.right)
, u = Math.min(l, c);
let h;
const d = t / i * (r + 1);
if (s.isDash) {
const e = r - Math.abs(d);
h = Math.sqrt(u * u + e * e)
} else
h = r - Math.sqrt(u * u + d * d);
this.image.data[n + a] = Math.max(0, Math.min(255, h + 128))
}
}
}
addRegularDash(e, t) {
for (let t = e.length - 1; t >= 0; --t) {
const i = e[t]
, r = e[t + 1];
i.zeroLength ? e.splice(t, 1) : r && r.isDash === i.isDash && (r.left = i.left,
e.splice(t, 1))
}
const i = e[0]
, r = e[e.length - 1];
i.isDash === r.isDash && (i.left = r.left - this.width,
r.right = i.right + this.width);
const n = this.width * this.nextRow;
let o = 0
, s = e[o];
for (let i = 0; i < this.width; i++) {
i / s.right > 1 && (s = e[++o]);
const r = Math.abs(i - s.left)
, a = Math.abs(i - s.right)
, l = Math.min(r, a);
this.image.data[n + i] = Math.max(0, Math.min(255, (s.isDash ? l : -l) + t + 128))
}
}
addDash(e, t) {
const i = this.getKey(e, t);
if (this.positions[i])
return this.positions[i];
const r = "round" === t
, n = r ? 7 : 0
, o = 2 * n + 1;
if (this.nextRow + o > this.height)
return P("LineAtlas out of space"),
null;
0 === e.length && e.push(1);
let s = 0;
for (let t = 0; t < e.length; t++)
e[t] < 0 && (P("Negative value is found in line dasharray, replacing values with 0"),
e[t] = 0),
s += e[t];
if (0 !== s) {
const i = this.width / s
, o = this.getDashRanges(e, this.width, i);
r ? this.addRoundDash(o, i, n) : this.addRegularDash(o, "square" === t ? .5 * i : 0)
}
const a = this.nextRow + n;
this.nextRow += o;
const l = {
tl: [a, n],
br: [s, 0]
};
return this.positions[i] = l,
l
}
}
Ln(df, "LineAtlas");
class pf {
constructor(e) {
this._callback = e,
this._triggered = !1,
"undefined" != typeof MessageChannel && (this._channel = new MessageChannel,
this._channel.port2.onmessage = ()=>{
this._triggered = !1,
this._callback()
}
)
}
trigger() {
this._triggered || (this._triggered = !0,
this._channel ? this._channel.port1.postMessage(!0) : setTimeout((()=>{
this._triggered = !1,
this._callback()
}
), 0))
}
remove() {
this._channel = void 0,
this._callback = ()=>{}
}
}
class ff {
constructor() {
this.tasks = {},
this.taskQueue = [],
C(["process"], this),
this.invoker = new pf(this.process),
this.nextId = 0
}
add(e, t) {
const i = this.nextId++
, r = function({type: e, isSymbolTile: t, zoom: i}) {
return i = i || 0,
"message" === e ? 0 : "maybePrepare" !== e || t ? "parseTile" !== e || t ? "parseTile" === e && t ? 300 - i : "maybePrepare" === e && t ? 400 - i : 500 : 200 - i : 100 - i
}(t);
if (0 === r) {
B();
try {
e()
} finally {}
return {
cancel: ()=>{}
}
}
return this.tasks[i] = {
fn: e,
metadata: t,
priority: r,
id: i
},
this.taskQueue.push(i),
this.invoker.trigger(),
{
cancel: ()=>{
delete this.tasks[i]
}
}
}
process() {
B();
try {
if (this.taskQueue = this.taskQueue.filter((e=>!!this.tasks[e])),
!this.taskQueue.length)
return;
const e = this.pick();
if (null === e)
return;
const t = this.tasks[e];
if (delete this.tasks[e],
this.taskQueue.length && this.invoker.trigger(),
!t)
return;
t.fn()
} finally {}
}
pick() {
let e = null
, t = 1 / 0;
for (let i = 0; i < this.taskQueue.length; i++) {
const r = this.tasks[this.taskQueue[i]];
r.priority < t && (t = r.priority,
e = i)
}
if (null === e)
return null;
const i = this.taskQueue[e];
return this.taskQueue.splice(e, 1),
i
}
remove() {
this.invoker.remove()
}
}
class mf {
constructor(e) {
this._stringToNumber = {},
this._numberToString = [];
for (let t = 0; t < e.length; t++) {
const i = e[t];
this._stringToNumber[i] = t,
this._numberToString[t] = i
}
}
encode(e) {
return this._stringToNumber[e]
}
decode(e) {
return this._numberToString[e]
}
}
const _f = ["tile", "layer", "source", "sourceLayer", "state"];
class gf {
constructor(e, t, i, r, n) {
this.type = "Feature",
this._vectorTileFeature = e,
this._z = t,
this._x = i,
this._y = r,
this.properties = e.properties,
this.id = n
}
get geometry() {
return void 0 === this._geometry && (this._geometry = this._vectorTileFeature.toGeoJSON(this._x, this._y, this._z).geometry),
this._geometry
}
set geometry(e) {
this._geometry = e
}
toJSON() {
const e = {
type: "Feature",
geometry: this.geometry,
properties: this.properties
};
void 0 !== this.id && (e.id = this.id);
for (const t of _f)
void 0 !== this[t] && (e[t] = this[t]);
return e
}
}
const yf = 32
, xf = 33
, vf = new Uint16Array(8184);
for (let e = 0; e < 2046; e++) {
let t = e + 2
, i = 0
, r = 0
, n = 0
, o = 0
, s = 0
, a = 0;
for (1 & t ? n = o = s = yf : i = r = a = yf; (t >>= 1) > 1; ) {
const e = i + n >> 1
, l = r + o >> 1;
1 & t ? (n = i,
o = r,
i = s,
r = a) : (i = n,
r = o,
n = s,
o = a),
s = e,
a = l
}
const l = 4 * e;
vf[l + 0] = i,
vf[l + 1] = r,
vf[l + 2] = n,
vf[l + 3] = o
}
const bf = new Uint16Array(2178)
, wf = new Uint8Array(1089)
, Tf = new Uint16Array(1089);
function Ef(e) {
return 0 === e ? -.03125 : 32 === e ? .03125 : 0
}
var Sf = Qo([{
name: "a_pos",
type: "Int16",
components: 2
}, {
name: "a_texture_pos",
type: "Int16",
components: 2
}]);
const Cf = {
type: 2,
extent: Ta,
loadGeometry: ()=>[[new o(0,0), new o(8193,0), new o(8193,8193), new o(0,8193), new o(0,0)]]
};
class Mf {
constructor(e, t, i, r, n) {
this.tileID = e,
this.uid = w(),
this.uses = 0,
this.tileSize = t,
this.tileZoom = i,
this.buckets = {},
this.expirationTime = null,
this.queryPadding = 0,
this.hasSymbolBuckets = !1,
this.hasRTLText = !1,
this.dependencies = {},
this.isRaster = n,
this.expiredRequestCount = 0,
this.state = "loading",
r && r.transform && (this.projection = r.transform.projection)
}
registerFadeDuration(e) {
const t = e + this.timeAdded;
t < X.now() || this.fadeEndTime && t < this.fadeEndTime || (this.fadeEndTime = t)
}
wasRequested() {
return "errored" === this.state || "loaded" === this.state || "reloading" === this.state
}
get tileTransform() {
return this._tileTransform || (this._tileTransform = Tp(this.tileID.canonical, this.projection)),
this._tileTransform
}
loadVectorData(e, t, i) {
if (this.unloadVectorData(),
this.state = "loaded",
e) {
e.featureIndex && (this.latestFeatureIndex = e.featureIndex,
e.rawTileData ? (this.latestRawTileData = e.rawTileData,
this.latestFeatureIndex.rawTileData = e.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)),
this.collisionBoxArray = e.collisionBoxArray,
this.buckets = function(e, t) {
const i = {};
if (!t)
return i;
for (const r of e) {
const e = r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);
if (0 !== e.length) {
r.layers = e,
r.stateDependentLayerIds && (r.stateDependentLayers = r.stateDependentLayerIds.map((t=>e.filter((e=>e.id === t))[0])));
for (const t of e)
i[t.id] = r
}
}
return i
}(e.buckets, t.style),
this.hasSymbolBuckets = !1;
for (const e in this.buckets) {
const t = this.buckets[e];
if (t instanceof Qp) {
if (this.hasSymbolBuckets = !0,
!i)
break;
t.justReloaded = !0
}
}
if (this.hasRTLText = !1,
this.hasSymbolBuckets)
for (const e in this.buckets) {
const t = this.buckets[e];
if (t instanceof Qp && t.hasRTLText) {
this.hasRTLText = !0,
Do.isLoading() || Do.isLoaded() || "deferred" !== ko() || Po();
break
}
}
this.queryPadding = 0;
for (const e in this.buckets) {
const i = this.buckets[e];
this.queryPadding = Math.max(this.queryPadding, t.style.getLayer(e).queryRadius(i))
}
e.imageAtlas && (this.imageAtlas = e.imageAtlas),
e.glyphAtlasImage && (this.glyphAtlasImage = e.glyphAtlasImage),
e.lineAtlas && (this.lineAtlas = e.lineAtlas)
} else
this.collisionBoxArray = new Is
}
unloadVectorData() {
if (this.hasData()) {
for (const e in this.buckets)
this.buckets[e].destroy();
this.buckets = {},
this.imageAtlas && (this.imageAtlas = null),
this.lineAtlas && (this.lineAtlas = null),
this.imageAtlasTexture && this.imageAtlasTexture.destroy(),
this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(),
this.lineAtlasTexture && this.lineAtlasTexture.destroy(),
this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(),
this._tileBoundsIndexBuffer.destroy(),
this._tileBoundsSegments.destroy(),
this._tileBoundsBuffer = null),
this._tileDebugBuffer && (this._tileDebugBuffer.destroy(),
this._tileDebugSegments.destroy(),
this._tileDebugBuffer = null),
this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(),
this._tileDebugIndexBuffer = null),
this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(),
this._globeTileDebugBorderBuffer = null),
this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(),
this._tileDebugTextSegments.destroy(),
this._tileDebugTextIndexBuffer.destroy(),
this._tileDebugTextBuffer = null),
this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(),
this._globeTileDebugTextBuffer = null),
this.latestFeatureIndex = null,
this.state = "unloaded"
}
}
getBucket(e) {
return this.buckets[e.id]
}
upload(e) {
for (const t in this.buckets) {
const i = this.buckets[t];
i.uploadPending() && i.upload(e)
}
const t = e.gl;
this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new hf(e,this.imageAtlas.image,t.RGBA),
this.imageAtlas.uploaded = !0),
this.glyphAtlasImage && (this.glyphAtlasTexture = new hf(e,this.glyphAtlasImage,t.ALPHA),
this.glyphAtlasImage = null),
this.lineAtlas && !this.lineAtlas.uploaded && (this.lineAtlasTexture = new hf(e,this.lineAtlas.image,t.ALPHA),
this.lineAtlas.uploaded = !0)
}
prepare(e) {
this.imageAtlas && this.imageAtlas.patchUpdatedImages(e, this.imageAtlasTexture)
}
queryRenderedFeatures(e, t, i, r, n, o, s, a) {
return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({
tileResult: r,
pixelPosMatrix: s,
transform: o,
params: n,
tileTransform: this.tileTransform
}, e, t, i) : {}
}
querySourceFeatures(e, t) {
const i = this.latestFeatureIndex;
if (!i || !i.rawTileData)
return;
const r = i.loadVTLayers()
, n = t ? t.sourceLayer : ""
, o = r._geojsonTileLayer || r[n];
if (!o)
return;
const s = Jr(t && t.filter)
, {z: a, x: l, y: c} = this.tileID.canonical
, u = {
z: a,
x: l,
y: c
};
for (let t = 0; t < o.length; t++) {
const r = o.feature(t);
if (s.needGeometry) {
const e = Za(r, !0);
if (!s.filter(new Lo(this.tileID.overscaledZ), e, this.tileID.canonical))
continue
} else if (!s.filter(new Lo(this.tileID.overscaledZ), r))
continue;
const h = i.getId(r, n)
, d = new gf(r,a,l,c,h);
d.tile = u,
e.push(d)
}
}
hasData() {
return "loaded" === this.state || "reloading" === this.state || "expired" === this.state
}
patternsLoaded() {
return !!this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length
}
setExpiryData(e) {
const t = this.expirationTime;
if (e.cacheControl) {
const t = O(e.cacheControl);
t["max-age"] && (this.expirationTime = Date.now() + 1e3 * t["max-age"])
} else
e.expires && (this.expirationTime = new Date(e.expires).getTime());
if (this.expirationTime) {
const e = Date.now();
let i = !1;
if (this.expirationTime > e)
i = !1;
else if (t)
if (this.expirationTime < t)
i = !0;
else {
const r = this.expirationTime - t;
r ? this.expirationTime = e + Math.max(r, 3e4) : i = !0
}
else
i = !0;
i ? (this.expiredRequestCount++,
this.state = "expired") : this.expiredRequestCount = 0
}
}
getExpiryTimeout() {
if (this.expirationTime)
return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - (new Date).getTime(), Math.pow(2, 31) - 1)
}
setFeatureState(e, t) {
if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData || 0 === Object.keys(e).length || !t)
return;
const i = this.latestFeatureIndex.loadVTLayers()
, r = t.style.listImages();
for (const n in this.buckets) {
if (!t.style.hasLayer(n))
continue;
const o = this.buckets[n]
, s = o.layers[0].sourceLayer || "_geojsonTileLayer"
, a = i[s]
, l = e[s];
if (!a || !l || 0 === Object.keys(l).length)
continue;
if (o.update(l, a, r, this.imageAtlas && this.imageAtlas.patternPositions || {}),
o instanceof Hu || o instanceof tu) {
const e = t.style._getSourceCache(o.layers[0].source);
t._terrain && t._terrain.enabled && e && o.programConfigurations.needsUpload && t._terrain._clearRenderCacheForTile(e.id, this.tileID)
}
const c = t && t.style && t.style.getLayer(n);
c && (this.queryPadding = Math.max(this.queryPadding, c.queryRadius(o)))
}
}
holdingForFade() {
return void 0 !== this.symbolFadeHoldUntil
}
symbolFadeFinished() {
return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < X.now()
}
clearFadeHold() {
this.symbolFadeHoldUntil = void 0
}
setHoldDuration(e) {
this.symbolFadeHoldUntil = X.now() + e
}
setTexture(e, t) {
const i = t.context
, r = i.gl;
this.texture = t.getTileTexture(e.width),
this.texture ? this.texture.update(e, {
useMipmap: !0
}) : (this.texture = new hf(i,e,r.RGBA,{
useMipmap: !0
}),
this.texture.bind(r.LINEAR, r.CLAMP_TO_EDGE),
i.extTextureFilterAnisotropic && r.texParameterf(r.TEXTURE_2D, i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, i.extTextureFilterAnisotropicMax))
}
setDependencies(e, t) {
const i = {};
for (const e of t)
i[e] = !0;
this.dependencies[e] = i
}
hasDependency(e, t) {
for (const i of e) {
const e = this.dependencies[i];
if (e)
for (const i of t)
if (e[i])
return !0
}
return !1
}
clearQueryDebugViz() {}
_makeDebugTileBoundsBuffers(e, t) {
if (!t || "mercator" === t.name || this._tileDebugBuffer)
return;
const i = qa(Cf, this.tileID.canonical, this.tileTransform)[0]
, r = new ts
, n = new Es;
for (let e = 0; e < i.length; e++) {
const {x: t, y: o} = i[e];
r.emplaceBack(t, o),
n.emplaceBack(e)
}
n.emplaceBack(0),
this._tileDebugIndexBuffer = e.createIndexBuffer(n),
this._tileDebugBuffer = e.createVertexBuffer(r, Wd.members),
this._tileDebugSegments = wa.simpleSegment(0, 0, r.length, n.length)
}
_makeTileBoundsBuffers(e, t) {
if (this._tileBoundsBuffer || !t || "mercator" === t.name)
return;
const i = qa(Cf, this.tileID.canonical, this.tileTransform)[0];
let r, n;
if (this.isRaster) {
const e = function(e, t) {
const i = Tp(e, t)
, r = Math.pow(2, e.z);
for (let n = 0; n < xf; n++)
for (let o = 0; o < xf; o++) {
const s = Pa((e.x + (o + Ef(o)) / yf) / r)
, a = Da((e.y + (n + Ef(n)) / yf) / r)
, l = t.project(s, a)
, c = n * xf + o;
bf[2 * c + 0] = Math.round((l.x * i.scale - i.x) * Ta),
bf[2 * c + 1] = Math.round((l.y * i.scale - i.y) * Ta)
}
wf.fill(0),
Tf.fill(0);
for (let e = 2045; e >= 0; e--) {
const t = 4 * e
, i = vf[t + 0]
, r = vf[t + 1]
, n = vf[t + 2]
, o = vf[t + 3]
, s = i + n >> 1
, a = r + o >> 1
, l = s + a - r
, c = a + i - s
, u = r * xf + i
, h = o * xf + n
, d = a * xf + s
, p = Math.hypot((bf[2 * u + 0] + bf[2 * h + 0]) / 2 - bf[2 * d + 0], (bf[2 * u + 1] + bf[2 * h + 1]) / 2 - bf[2 * d + 1]) >= 16;
if (wf[d] = wf[d] || (p ? 1 : 0),
e < 1022) {
const e = (r + c >> 1) * xf + (i + l >> 1)
, t = (o + c >> 1) * xf + (n + l >> 1);
wf[d] = wf[d] || wf[e] || wf[t]
}
}
const n = new rs
, o = new gs;
let s = 0;
function a(e, t) {
const i = t * xf + e;
return 0 === Tf[i] && (n.emplaceBack(bf[2 * i + 0], bf[2 * i + 1], e * Ta / yf, t * Ta / yf),
Tf[i] = ++s),
Tf[i] - 1
}
function l(e, t, i, r, n, s) {
const c = e + i >> 1
, u = t + r >> 1;
if (Math.abs(e - n) + Math.abs(t - s) > 1 && wf[u * xf + c])
l(n, s, e, t, c, u),
l(i, r, n, s, c, u);
else {
const l = a(e, t)
, c = a(i, r)
, u = a(n, s);
o.emplaceBack(l, c, u)
}
}
return l(0, 0, yf, yf, yf, 0),
l(yf, yf, 0, 0, 0, yf),
{
vertices: n,
indices: o
}
}(this.tileID.canonical, t);
r = e.vertices,
n = e.indices
} else {
r = new rs,
n = new gs;
for (const {x: e, y: t} of i)
r.emplaceBack(e, t, 0, 0);
const e = xc(r.int16, void 0, 4);
for (let t = 0; t < e.length; t += 3)
n.emplaceBack(e[t], e[t + 1], e[t + 2])
}
this._tileBoundsBuffer = e.createVertexBuffer(r, Sf.members),
this._tileBoundsIndexBuffer = e.createIndexBuffer(n),
this._tileBoundsSegments = wa.simpleSegment(0, 0, r.length, n.length)
}
_makeGlobeTileDebugBuffers(e, t) {
const i = t.projection;
if (!i || "globe" !== i.name || t.freezeTileCoverage)
return;
const r = this.tileID.canonical
, n = fp(np(r, t))
, o = gp(t.zoom);
let s;
o > 0 && (s = yl(new Float64Array(16), t.globeMatrix));
const a = (r.x + .5) / (1 << r.z) - Ia(t.center.lng);
let l = 0;
a > .5 ? l = -1 : a < -.5 && (l = 1),
this._makeGlobeTileDebugBorderBuffer(e, r, t, n, s, o, l),
this._makeGlobeTileDebugTextBuffer(e, r, t, n, s, o, l)
}
_globePoint(e, t, i, r, n, o, s, a) {
let l = hp(e, t, i);
if (o) {
const n = 1 << i.z
, c = [((e / Ta + i.x) / n + a) * r, (t / Ta + i.y) / n * r, 0];
jl(c, c, o),
l = vi(l, c, s)
}
return jl(l, l, n)
}
_makeGlobeTileDebugBorderBuffer(e, t, i, r, n, o, s) {
const a = new ts
, l = new Es
, c = new is
, u = (e,u,h,d,p)=>{
const f = (h - e) / (p - 1)
, m = (d - u) / (p - 1)
, _ = a.length;
for (let h = 0; h < p; h++) {
const d = e + h * f
, p = u + h * m;
a.emplaceBack(d, p);
const g = this._globePoint(d, p, t, i.worldSize, r, n, o, s);
c.emplaceBack(g[0], g[1], g[2]),
l.emplaceBack(_ + h)
}
}
, h = Ta;
u(0, 0, h, 0, 16),
u(h, 0, h, h, 16),
u(h, h, 0, h, 16),
u(0, h, 0, 0, 16),
this._tileDebugIndexBuffer = e.createIndexBuffer(l),
this._tileDebugBuffer = e.createVertexBuffer(a, Wd.members),
this._globeTileDebugBorderBuffer = e.createVertexBuffer(c, Zd.members),
this._tileDebugSegments = wa.simpleSegment(0, 0, a.length, l.length)
}
_makeGlobeTileDebugTextBuffer(e, t, i, r, n, o, s) {
const a = new ts
, l = new gs
, c = new is
, u = 25;
l.reserve(32),
a.reserve(u),
c.reserve(u);
const h = (e,t)=>u * e + t;
for (let e = 0; e < u; e++) {
const l = 2048 * e;
for (let e = 0; e < u; e++) {
const u = 2048 * e;
a.emplaceBack(u, l);
const h = this._globePoint(u, l, t, i.worldSize, r, n, o, s);
c.emplaceBack(h[0], h[1], h[2])
}
}
for (let e = 0; e < 4; e++)
for (let t = 0; t < 4; t++) {
const i = h(e, t)
, r = h(e, t + 1)
, n = h(e + 1, t)
, o = h(e + 1, t + 1);
l.emplaceBack(i, r, n),
l.emplaceBack(n, r, o)
}
this._tileDebugTextIndexBuffer = e.createIndexBuffer(l),
this._tileDebugTextBuffer = e.createVertexBuffer(a, Wd.members),
this._globeTileDebugTextBuffer = e.createVertexBuffer(c, Zd.members),
this._tileDebugTextSegments = wa.simpleSegment(0, 0, u, 32)
}
}
class Af {
constructor() {
this.state = {},
this.stateChanges = {},
this.deletedStates = {}
}
updateState(e, t, i) {
const r = String(t);
if (this.stateChanges[e] = this.stateChanges[e] || {},
this.stateChanges[e][r] = this.stateChanges[e][r] || {},
v(this.stateChanges[e][r], i),
null === this.deletedStates[e]) {
this.deletedStates[e] = {};
for (const t in this.state[e])
t !== r && (this.deletedStates[e][t] = null)
} else if (this.deletedStates[e] && null === this.deletedStates[e][r]) {
this.deletedStates[e][r] = {};
for (const t in this.state[e][r])
i[t] || (this.deletedStates[e][r][t] = null)
} else
for (const t in i)
this.deletedStates[e] && this.deletedStates[e][r] && null === this.deletedStates[e][r][t] && delete this.deletedStates[e][r][t]
}
removeFeatureState(e, t, i) {
if (null === this.deletedStates[e])
return;
const r = String(t);
if (this.deletedStates[e] = this.deletedStates[e] || {},
i && void 0 !== t)
null !== this.deletedStates[e][r] && (this.deletedStates[e][r] = this.deletedStates[e][r] || {},
this.deletedStates[e][r][i] = null);
else if (void 0 !== t)
if (this.stateChanges[e] && this.stateChanges[e][r])
for (i in this.deletedStates[e][r] = {},
this.stateChanges[e][r])
this.deletedStates[e][r][i] = null;
else
this.deletedStates[e][r] = null;
else
this.deletedStates[e] = null
}
getState(e, t) {
const i = String(t)
, r = v({}, (this.state[e] || {})[i], (this.stateChanges[e] || {})[i]);
if (null === this.deletedStates[e])
return {};
if (this.deletedStates[e]) {
const i = this.deletedStates[e][t];
if (null === i)
return {};
for (const e in i)
delete r[e]
}
return r
}
initializeTileState(e, t) {
e.setFeatureState(this.state, t)
}
coalesceChanges(e, t) {
const i = {};
for (const e in this.stateChanges) {
this.state[e] = this.state[e] || {};
const t = {};
for (const i in this.stateChanges[e])
this.state[e][i] || (this.state[e][i] = {}),
v(this.state[e][i], this.stateChanges[e][i]),
t[i] = this.state[e][i];
i[e] = t
}
for (const e in this.deletedStates) {
this.state[e] = this.state[e] || {};
const t = {};
if (null === this.deletedStates[e])
for (const i in this.state[e])
t[i] = {},
this.state[e][i] = {};
else
for (const i in this.deletedStates[e]) {
if (null === this.deletedStates[e][i])
this.state[e][i] = {};
else
for (const t of Object.keys(this.deletedStates[e][i]))
delete this.state[e][i][t];
t[i] = this.state[e][i]
}
i[e] = i[e] || {},
v(i[e], t)
}
if (this.stateChanges = {},
this.deletedStates = {},
0 !== Object.keys(i).length)
for (const r in e)
e[r].setFeatureState(i, t)
}
}
class If {
constructor(e) {
this.size = e,
this.minimums = [],
this.maximums = [],
this.leaves = []
}
getElevation(e, t) {
const i = this.toIdx(e, t);
return {
min: this.minimums[i],
max: this.maximums[i]
}
}
isLeaf(e, t) {
return this.leaves[this.toIdx(e, t)]
}
toIdx(e, t) {
return t * this.size + e
}
}
function zf(e, t, i, r) {
let n = 0
, o = Number.MAX_VALUE;
for (let s = 0; s < 3; s++)
if (Math.abs(r[s]) < 1e-15) {
if (i[s] < e[s] || i[s] > t[s])
return null
} else {
const a = 1 / r[s];
let l = (e[s] - i[s]) * a
, c = (t[s] - i[s]) * a;
if (l > c) {
const e = l;
l = c,
c = e
}
if (l > n && (n = l),
c < o && (o = c),
n > o)
return null
}
return n
}
function kf(e, t, i, r, n, o, s, a, l, c, u) {
const h = r - e
, d = n - t
, p = o - i
, f = s - e
, m = a - t
, _ = l - i
, g = u[1] * _ - u[2] * m
, y = u[2] * f - u[0] * _
, x = u[0] * m - u[1] * f
, v = h * g + d * y + p * x;
if (Math.abs(v) < 1e-15)
return null;
const b = 1 / v
, w = c[0] - e
, T = c[1] - t
, E = c[2] - i
, S = (w * g + T * y + E * x) * b;
if (S < 0 || S > 1)
return null;
const C = T * p - E * d
, M = E * h - w * p
, A = w * d - T * h
, I = (u[0] * C + u[1] * M + u[2] * A) * b;
return I < 0 || S + I > 1 ? null : (f * C + m * M + _ * A) * b
}
function Pf(e, t, i) {
return (e - t) / (i - t)
}
function Df(e, t, i, r, n, o, s, a, l) {
const c = 1 << i
, u = o - r
, h = s - n
, d = (e + 1) / c * u + r
, p = (t + 0) / c * h + n
, f = (t + 1) / c * h + n;
a[0] = (e + 0) / c * u + r,
a[1] = p,
l[0] = d,
l[1] = f
}
class Lf {
constructor(e) {
if (this.maximums = [],
this.minimums = [],
this.leaves = [],
this.childOffsets = [],
this.nodeCount = 0,
this.dem = e,
this._siblingOffset = [[0, 0], [1, 0], [0, 1], [1, 1]],
!this.dem)
return;
const t = function(e) {
const t = Math.ceil(Math.log2(e.dim / 8))
, i = [];
let r = Math.ceil(Math.pow(2, t));
const n = 1 / r
, o = (e,t,i,r,n)=>{
const o = r ? 1 : 0
, s = (e + 1) * i - o
, a = t * i
, l = (t + 1) * i - o;
n[0] = e * i,
n[1] = a,
n[2] = s,
n[3] = l
}
;
let s = new If(r);
const a = [];
for (let t = 0; t < r * r; t++) {
o(t % r, Math.floor(t / r), n, !1, a);
const i = Of(a[0], a[1], e)
, l = Of(a[2], a[1], e)
, c = Of(a[2], a[3], e)
, u = Of(a[0], a[3], e);
s.minimums.push(Math.min(i, l, c, u)),
s.maximums.push(Math.max(i, l, c, u)),
s.leaves.push(1)
}
for (i.push(s),
r /= 2; r >= 1; r /= 2) {
const e = i[i.length - 1];
s = new If(r);
for (let t = 0; t < r * r; t++) {
o(t % r, Math.floor(t / r), 2, !0, a);
const i = e.getElevation(a[0], a[1])
, n = e.getElevation(a[2], a[1])
, l = e.getElevation(a[2], a[3])
, c = e.getElevation(a[0], a[3])
, u = e.isLeaf(a[0], a[1])
, h = e.isLeaf(a[2], a[1])
, d = e.isLeaf(a[2], a[3])
, p = e.isLeaf(a[0], a[3])
, f = Math.min(i.min, n.min, l.min, c.min)
, m = Math.max(i.max, n.max, l.max, c.max)
, _ = u && h && d && p;
s.maximums.push(m),
s.minimums.push(f),
s.leaves.push(m - f <= 5 && _ ? 1 : 0)
}
i.push(s)
}
return i
}(this.dem)
, i = t.length - 1
, r = t[i];
this._addNode(r.minimums[0], r.maximums[0], r.leaves[0]),
this._construct(t, 0, 0, i, 0)
}
raycastRoot(e, t, i, r, n, o, s=1) {
return zf([e, t, -100], [i, r, this.maximums[0] * s], n, o)
}
raycast(e, t, i, r, n, o, s=1) {
if (!this.nodeCount)
return null;
const a = this.raycastRoot(e, t, i, r, n, o, s);
if (null == a)
return null;
const l = []
, c = []
, u = []
, h = []
, d = [{
idx: 0,
t: a,
nodex: 0,
nodey: 0,
depth: 0
}];
for (; d.length > 0; ) {
const {idx: a, t: p, nodex: f, nodey: m, depth: _} = d.pop();
if (this.leaves[a]) {
Df(f, m, _, e, t, i, r, u, h);
const a = 1 << _
, l = (f + 0) / a
, c = (f + 1) / a
, d = (m + 0) / a
, g = (m + 1) / a
, y = Of(l, d, this.dem) * s
, x = Of(c, d, this.dem) * s
, v = Of(c, g, this.dem) * s
, b = Of(l, g, this.dem) * s
, w = kf(u[0], u[1], y, h[0], u[1], x, h[0], h[1], v, n, o)
, T = kf(h[0], h[1], v, u[0], h[1], b, u[0], u[1], y, n, o)
, E = Math.min(null !== w ? w : Number.MAX_VALUE, null !== T ? T : Number.MAX_VALUE);
if (E !== Number.MAX_VALUE)
return E;
{
const e = Rl([], n, o, p);
if (Bf(y, x, b, v, Pf(e[0], u[0], h[0]), Pf(e[1], u[1], h[1])) >= e[2])
return p
}
continue
}
let g = 0;
for (let d = 0; d < this._siblingOffset.length; d++) {
Df((f << 1) + this._siblingOffset[d][0], (m << 1) + this._siblingOffset[d][1], _ + 1, e, t, i, r, u, h),
u[2] = -100,
h[2] = this.maximums[this.childOffsets[a] + d] * s;
const p = zf(u, h, n, o);
if (null != p) {
const e = p;
l[d] = e;
let t = !1;
for (let i = 0; i < g && !t; i++)
e >= l[c[i]] && (c.splice(i, 0, d),
t = !0);
t || (c[g] = d),
g++
}
}
for (let e = 0; e < g; e++) {
const t = c[e];
d.push({
idx: this.childOffsets[a] + t,
t: l[t],
nodex: (f << 1) + this._siblingOffset[t][0],
nodey: (m << 1) + this._siblingOffset[t][1],
depth: _ + 1
})
}
}
return null
}
_addNode(e, t, i) {
return this.minimums.push(e),
this.maximums.push(t),
this.leaves.push(i),
this.childOffsets.push(0),
this.nodeCount++
}
_construct(e, t, i, r, n) {
if (1 === e[r].isLeaf(t, i))
return;
this.childOffsets[n] || (this.childOffsets[n] = this.nodeCount);
const o = r - 1
, s = e[o];
let a = 0
, l = 0;
for (let e = 0; e < this._siblingOffset.length; e++) {
const r = 2 * t + this._siblingOffset[e][0]
, n = 2 * i + this._siblingOffset[e][1]
, o = s.getElevation(r, n)
, c = s.isLeaf(r, n)
, u = this._addNode(o.min, o.max, c);
c && (a |= 1 << e),
l || (l = u)
}
for (let r = 0; r < this._siblingOffset.length; r++)
a & 1 << r || this._construct(e, 2 * t + this._siblingOffset[r][0], 2 * i + this._siblingOffset[r][1], o, l + r)
}
}
function Bf(e, t, i, r, n, o) {
return xi(xi(e, i, o), xi(t, r, o), n)
}
function Of(e, t, i) {
const r = i.dim
, n = m(e * r - .5, 0, r - 1)
, o = m(t * r - .5, 0, r - 1)
, s = Math.floor(n)
, a = Math.floor(o)
, l = Math.min(s + 1, r - 1)
, c = Math.min(a + 1, r - 1);
return Bf(i.get(s, a), i.get(l, a), i.get(s, c), i.get(l, c), n - s, o - a)
}
const Rf = {
mapbox: [6553.6, 25.6, .1, 1e4],
terrarium: [256, 1, 1 / 256, 32768]
};
class Ff {
get tree() {
return this._tree || this._buildQuadTree(),
this._tree
}
constructor(e, t, i, r=!1, n=!1) {
if (this.uid = e,
t.height !== t.width)
throw new RangeError("DEM tiles must be square");
if (i && "mapbox" !== i && "terrarium" !== i)
return P(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);
this.stride = t.height;
const o = this.dim = t.height - 2
, s = new Uint32Array(t.data.buffer);
if (this.pixels = new Uint8Array(t.data.buffer),
this.encoding = i || "mapbox",
this.borderReady = r,
!r) {
for (let e = 0; e < o; e++)
s[this._idx(-1, e)] = s[this._idx(0, e)],
s[this._idx(o, e)] = s[this._idx(o - 1, e)],
s[this._idx(e, -1)] = s[this._idx(e, 0)],
s[this._idx(e, o)] = s[this._idx(e, o - 1)];
s[this._idx(-1, -1)] = s[this._idx(0, 0)],
s[this._idx(o, -1)] = s[this._idx(o - 1, 0)],
s[this._idx(-1, o)] = s[this._idx(0, o - 1)],
s[this._idx(o, o)] = s[this._idx(o - 1, o - 1)],
n && this._buildQuadTree()
}
}
_buildQuadTree() {
this._tree = new Lf(this)
}
get(e, t, i=!1) {
i && (e = m(e, -1, this.dim),
t = m(t, -1, this.dim));
const r = 4 * this._idx(e, t);
return ("terrarium" === this.encoding ? this._unpackTerrarium : this._unpackMapbox)(this.pixels[r], this.pixels[r + 1], this.pixels[r + 2])
}
static getUnpackVector(e) {
return Rf[e]
}
get unpackVector() {
return Rf[this.encoding]
}
_idx(e, t) {
if (e < -1 || e >= this.dim + 1 || t < -1 || t >= this.dim + 1)
throw new RangeError("out of range source coordinates for DEM data");
return (t + 1) * this.stride + (e + 1)
}
_unpackMapbox(e, t, i) {
return (256 * e * 256 + 256 * t + i) / 10 - 1e4
}
_unpackTerrarium(e, t, i) {
return 256 * e + t + i / 256 - 32768
}
static pack(e, t) {
const i = [0, 0, 0, 0]
, r = Ff.getUnpackVector(t);
let n = Math.floor((e + r[3]) / r[2]);
return i[2] = n % 256,
n = Math.floor(n / 256),
i[1] = n % 256,
n = Math.floor(n / 256),
i[0] = n,
i
}
getPixels() {
return new pc({
width: this.stride,
height: this.stride
},this.pixels)
}
backfillBorder(e, t, i) {
if (this.dim !== e.dim)
throw new Error("dem dimension mismatch");
let r = t * this.dim
, n = t * this.dim + this.dim
, o = i * this.dim
, s = i * this.dim + this.dim;
switch (t) {
case -1:
r = n - 1;
break;
case 1:
n = r + 1
}
switch (i) {
case -1:
o = s - 1;
break;
case 1:
s = o + 1
}
const a = -t * this.dim
, l = -i * this.dim;
for (let t = o; t < s; t++)
for (let i = r; i < n; i++) {
const r = 4 * this._idx(i, t)
, n = 4 * this._idx(i + a, t + l);
this.pixels[r + 0] = e.pixels[n + 0],
this.pixels[r + 1] = e.pixels[n + 1],
this.pixels[r + 2] = e.pixels[n + 2],
this.pixels[r + 3] = e.pixels[n + 3]
}
}
onDeserialize() {
this._tree && (this._tree.dem = this)
}
}
Ln(Ff, "DEMData"),
Ln(Lf, "DemMinMaxQuadTree", {
omit: ["dem"]
});
class Uf {
constructor(e, t) {
this.max = e,
this.onRemove = t,
this.reset()
}
reset() {
for (const e in this.data)
for (const t of this.data[e])
t.timeout && clearTimeout(t.timeout),
this.onRemove(t.value);
return this.data = {},
this.order = [],
this
}
add(e, t, i) {
const r = e.wrapped().key;
void 0 === this.data[r] && (this.data[r] = []);
const n = {
value: t,
timeout: void 0
};
if (void 0 !== i && (n.timeout = setTimeout((()=>{
this.remove(e, n)
}
), i)),
this.data[r].push(n),
this.order.push(r),
this.order.length > this.max) {
const e = this._getAndRemoveByKey(this.order[0]);
e && this.onRemove(e)
}
return this
}
has(e) {
return e.wrapped().key in this.data
}
getAndRemove(e) {
return this.has(e) ? this._getAndRemoveByKey(e.wrapped().key) : null
}
_getAndRemoveByKey(e) {
const t = this.data[e].shift();
return t.timeout && clearTimeout(t.timeout),
0 === this.data[e].length && delete this.data[e],
this.order.splice(this.order.indexOf(e), 1),
t.value
}
getByKey(e) {
const t = this.data[e];
return t ? t[0].value : null
}
get(e) {
return this.has(e) ? this.data[e.wrapped().key][0].value : null
}
remove(e, t) {
if (!this.has(e))
return this;
const i = e.wrapped().key
, r = void 0 === t ? 0 : this.data[i].indexOf(t)
, n = this.data[i][r];
return this.data[i].splice(r, 1),
n.timeout && clearTimeout(n.timeout),
0 === this.data[i].length && delete this.data[i],
this.onRemove(n.value),
this.order.splice(this.order.indexOf(i), 1),
this
}
setMaxSize(e) {
for (this.max = e; this.order.length > this.max; ) {
const e = this._getAndRemoveByKey(this.order[0]);
e && this.onRemove(e)
}
return this
}
filter(e) {
const t = [];
for (const i in this.data)
for (const r of this.data[i])
e(r.value) || t.push(r);
for (const e of t)
this.remove(e.value.tileID, e)
}
}
class Vf {
constructor(e, t, i) {
this.func = e,
this.mask = t,
this.range = i
}
}
Vf.ReadOnly = !1,
Vf.ReadWrite = !0,
Vf.disabled = new Vf(519,Vf.ReadOnly,[0, 1]);
const jf = 7680;
class Nf {
constructor(e, t, i, r, n, o) {
this.test = e,
this.ref = t,
this.mask = i,
this.fail = r,
this.depthFail = n,
this.pass = o
}
}
Nf.disabled = new Nf({
func: 519,
mask: 0
},0,0,jf,jf,jf);
class Gf {
constructor(e, t, i) {
this.blendFunction = e,
this.blendColor = t,
this.mask = i
}
}
Gf.Replace = [1, 0],
Gf.disabled = new Gf(Gf.Replace,xt.transparent,[!1, !1, !1, !1]),
Gf.unblended = new Gf(Gf.Replace,xt.transparent,[!0, !0, !0, !0]),
Gf.alphaBlended = new Gf([1, 771],xt.transparent,[!0, !0, !0, !0]);
const $f = 1029
, qf = 2305;
class Zf {
constructor(e, t, i) {
this.enable = e,
this.mode = t,
this.frontFace = i
}
}
Zf.disabled = new Zf(!1,$f,qf),
Zf.backCCW = new Zf(!0,$f,qf),
Zf.backCW = new Zf(!0,$f,2304),
Zf.frontCW = new Zf(!0,1028,2304),
Zf.frontCCW = new Zf(!0,1028,qf);
class Wf extends qe {
constructor(e, t, i) {
super(),
this.id = e,
this._onlySymbols = i,
t.on("data", (e=>{
"source" === e.dataType && "metadata" === e.sourceDataType && (this._sourceLoaded = !0),
this._sourceLoaded && !this._paused && "source" === e.dataType && "content" === e.sourceDataType && (this.reload(),
this.transform && this.update(this.transform))
}
)),
t.on("error", (()=>{
this._sourceErrored = !0
}
)),
this._source = t,
this._tiles = {},
this._cache = new Uf(0,this._unloadTile.bind(this)),
this._timers = {},
this._cacheTimers = {},
this._minTileCacheSize = t.minTileCacheSize,
this._maxTileCacheSize = t.maxTileCacheSize,
this._loadedParentTiles = {},
this._coveredTiles = {},
this._state = new Af,
this._isRaster = "raster" === this._source.type || "raster-dem" === this._source.type || "custom" === this._source.type && "raster" === this._source._dataType
}
onAdd(e) {
this.map = e,
this._minTileCacheSize = void 0 === this._minTileCacheSize && e ? e._minTileCacheSize : this._minTileCacheSize,
this._maxTileCacheSize = void 0 === this._maxTileCacheSize && e ? e._maxTileCacheSize : this._maxTileCacheSize
}
loaded() {
if (this._sourceErrored)
return !0;
if (!this._sourceLoaded)
return !1;
if (!this._source.loaded())
return !1;
for (const e in this._tiles) {
const t = this._tiles[e];
if ("loaded" !== t.state && "errored" !== t.state)
return !1
}
return !0
}
getSource() {
return this._source
}
pause() {
this._paused = !0
}
resume() {
if (!this._paused)
return;
const e = this._shouldReloadOnResume;
this._paused = !1,
this._shouldReloadOnResume = !1,
e && this.reload(),
this.transform && this.update(this.transform)
}
_loadTile(e, t) {
return e.isSymbolTile = this._onlySymbols,
this._source.loadTile(e, t)
}
_unloadTile(e) {
if (this._source.unloadTile)
return this._source.unloadTile(e, (()=>{}
))
}
_abortTile(e) {
if (this._source.abortTile)
return this._source.abortTile(e, (()=>{}
))
}
serialize() {
return this._source.serialize()
}
prepare(e) {
if (this._source.prepare && this._source.prepare(),
this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null),
this._source.prepareTile)
for (const t in this._tiles) {
const i = this._tiles[t];
this._source.prepareTile(i) && this.map.painter.terrain && this.map.painter.terrain._clearRenderCacheForTile(this.id, i.tileID),
i.upload(e),
i.prepare(this.map.style.imageManager)
}
else
for (const t in this._tiles) {
const i = this._tiles[t];
i.upload(e),
i.prepare(this.map.style.imageManager)
}
}
getIds() {
return x(this._tiles).map((e=>e.tileID)).sort(Xf).map((e=>e.key))
}
getRenderableIds(e) {
const t = [];
for (const i in this._tiles)
this._isIdRenderable(+i, e) && t.push(this._tiles[i]);
return e ? t.sort(((e,t)=>{
const i = e.tileID
, r = t.tileID
, n = new o(i.canonical.x,i.canonical.y)._rotate(this.transform.angle)
, s = new o(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);
return i.overscaledZ - r.overscaledZ || s.y - n.y || s.x - n.x
}
)).map((e=>e.tileID.key)) : t.map((e=>e.tileID)).sort(Xf).map((e=>e.key))
}
hasRenderableParent(e) {
const t = this.findLoadedParent(e, 0);
return !!t && this._isIdRenderable(t.tileID.key)
}
_isIdRenderable(e, t) {
return this._tiles[e] && this._tiles[e].hasData() && !this._coveredTiles[e] && (t || !this._tiles[e].holdingForFade())
}
reload() {
if (this._paused)
this._shouldReloadOnResume = !0;
else {
this._cache.reset();
for (const e in this._tiles)
"errored" !== this._tiles[e].state && this._reloadTile(+e, "reloading")
}
}
_reloadTile(e, t) {
const i = this._tiles[e];
i && ("loading" !== i.state && (i.state = t),
this._loadTile(i, this._tileLoaded.bind(this, i, e, t)))
}
_tileLoaded(e, t, i, r) {
if (r)
if (e.state = "errored",
404 !== r.status)
this._source.fire(new $e(r,{
tile: e
}));
else if ("raster-dem" === this._source.type && this.usedForTerrain && this.map.painter.terrain) {
const e = this.map.painter.terrain;
this.update(this.transform, e.getScaledDemTileSize(), !0),
e.resetTileLookupCache(this.id)
} else
this.update(this.transform);
else
e.timeAdded = X.now(),
"expired" === i && (e.refreshedUponExpiration = !0),
this._setTileReloadTimer(t, e),
"raster-dem" === this._source.type && e.dem && this._backfillDEM(e),
this._state.initializeTileState(e, this.map ? this.map.painter : null),
this._source.fire(new Ge("data",{
dataType: "source",
tile: e,
coord: e.tileID,
sourceCacheId: this.id
}))
}
_backfillDEM(e) {
const t = this.getRenderableIds();
for (let r = 0; r < t.length; r++) {
const n = t[r];
if (e.neighboringTiles && e.neighboringTiles[n]) {
const t = this.getTileByID(n);
i(e, t),
i(t, e)
}
}
function i(e, t) {
if (!e.dem || e.dem.borderReady)
return;
e.needsHillshadePrepare = !0,
e.needsDEMTextureUpload = !0;
let i = t.tileID.canonical.x - e.tileID.canonical.x;
const r = t.tileID.canonical.y - e.tileID.canonical.y
, n = Math.pow(2, e.tileID.canonical.z)
, o = t.tileID.key;
0 === i && 0 === r || Math.abs(r) > 1 || (Math.abs(i) > 1 && (1 === Math.abs(i + n) ? i += n : 1 === Math.abs(i - n) && (i -= n)),
t.dem && e.dem && (e.dem.backfillBorder(t.dem, i, r),
e.neighboringTiles && e.neighboringTiles[o] && (e.neighboringTiles[o].backfilled = !0)))
}
}
getTile(e) {
return this.getTileByID(e.key)
}
getTileByID(e) {
return this._tiles[e]
}
_retainLoadedChildren(e, t, i, r) {
for (const n in this._tiles) {
let o = this._tiles[n];
if (r[n] || !o.hasData() || o.tileID.overscaledZ <= t || o.tileID.overscaledZ > i)
continue;
let s = o.tileID;
for (; o && o.tileID.overscaledZ > t + 1; ) {
const e = o.tileID.scaledTo(o.tileID.overscaledZ - 1);
o = this._tiles[e.key],
o && o.hasData() && (s = e)
}
let a = s;
for (; a.overscaledZ > t; )
if (a = a.scaledTo(a.overscaledZ - 1),
e[a.key]) {
r[s.key] = s;
break
}
}
}
findLoadedParent(e, t) {
if (e.key in this._loadedParentTiles) {
const i = this._loadedParentTiles[e.key];
return i && i.tileID.overscaledZ >= t ? i : null
}
for (let i = e.overscaledZ - 1; i >= t; i--) {
const t = e.scaledTo(i)
, r = this._getLoadedTile(t);
if (r)
return r
}
}
_getLoadedTile(e) {
const t = this._tiles[e.key];
return t && t.hasData() ? t : this._cache.getByKey(this._source.reparseOverscaled ? e.wrapped().key : e.canonical.key)
}
updateCacheSize(e, t) {
t = t || this._source.tileSize;
const i = Math.ceil(e.width / t) + 1
, r = Math.ceil(e.height / t) + 1
, n = Math.floor(i * r * 5)
, o = "number" == typeof this._minTileCacheSize ? Math.max(this._minTileCacheSize, n) : n
, s = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, o) : o;
this._cache.setMaxSize(s)
}
handleWrapJump(e) {
const t = Math.round((e - (void 0 === this._prevLng ? e : this._prevLng)) / 360);
if (this._prevLng = e,
t) {
const e = {};
for (const i in this._tiles) {
const r = this._tiles[i];
r.tileID = r.tileID.unwrapTo(r.tileID.wrap + t),
e[r.tileID.key] = r
}
this._tiles = e;
for (const e in this._timers)
clearTimeout(this._timers[e]),
delete this._timers[e];
for (const e in this._tiles)
this._setTileReloadTimer(+e, this._tiles[e])
}
}
update(e, t, i) {
if (this.transform = e,
!this._sourceLoaded || this._paused || this.transform.freezeTileCoverage)
return;
if (this.usedForTerrain && !i)
return;
let r;
this.updateCacheSize(e, t),
"globe" !== this.transform.projection.name && this.handleWrapJump(this.transform.center.lng),
this._coveredTiles = {},
this.used || this.usedForTerrain ? this._source.tileID ? r = e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new Ru(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))) : (r = e.coveringTiles({
tileSize: t || this._source.tileSize,
minzoom: this._source.minzoom,
maxzoom: this._source.maxzoom,
roundZoom: this._source.roundZoom && !i,
reparseOverscaled: this._source.reparseOverscaled,
isTerrainDEM: this.usedForTerrain
}),
this._source.hasTile && (r = r.filter((e=>this._source.hasTile(e))))) : r = [];
const n = this._updateRetainedTiles(r);
if (Hf(this._source.type) && 0 !== r.length) {
const e = {}
, t = {}
, i = Object.keys(n);
for (const r of i) {
const i = n[r]
, o = this._tiles[r];
if (!o || o.fadeEndTime && o.fadeEndTime <= X.now())
continue;
const s = this.findLoadedParent(i, Math.max(i.overscaledZ - Wf.maxOverzooming, this._source.minzoom));
s && (this._addTile(s.tileID),
e[s.tileID.key] = s.tileID),
t[r] = i
}
const o = r[r.length - 1].overscaledZ;
for (const e in this._tiles) {
const i = this._tiles[e];
if (n[e] || !i.hasData())
continue;
let r = i.tileID;
for (; r.overscaledZ > o; ) {
r = r.scaledTo(r.overscaledZ - 1);
const o = this._tiles[r.key];
if (o && o.hasData() && t[r.key]) {
n[e] = i.tileID;
break
}
}
}
for (const t in e)
n[t] || (this._coveredTiles[t] = !0,
n[t] = e[t])
}
for (const e in n)
this._tiles[e].clearFadeHold();
const o = function(e, t) {
const i = [];
for (const r in e)
r in t || i.push(r);
return i
}(this._tiles, n);
for (const e of o) {
const t = this._tiles[e];
t.hasSymbolBuckets && !t.holdingForFade() ? t.setHoldDuration(this.map._fadeDuration) : t.hasSymbolBuckets && !t.symbolFadeFinished() || this._removeTile(+e)
}
this._updateLoadedParentTileCache(),
this._onlySymbols && this._source.afterUpdate && this._source.afterUpdate()
}
releaseSymbolFadeTiles() {
for (const e in this._tiles)
this._tiles[e].holdingForFade() && this._removeTile(+e)
}
_updateRetainedTiles(e) {
const t = {};
if (0 === e.length)
return t;
const i = {}
, r = e.reduce(((e,t)=>Math.min(e, t.overscaledZ)), 1 / 0)
, n = e[0].overscaledZ
, o = Math.max(n - Wf.maxOverzooming, this._source.minzoom)
, s = Math.max(n + Wf.maxUnderzooming, this._source.minzoom)
, a = {};
for (const i of e) {
const e = this._addTile(i);
t[i.key] = i,
e.hasData() || r < this._source.maxzoom && (a[i.key] = i)
}
this._retainLoadedChildren(a, r, s, t);
for (const r of e) {
let e = this._tiles[r.key];
if (e.hasData())
continue;
if (r.canonical.z >= this._source.maxzoom) {
const e = r.children(this._source.maxzoom)[0]
, i = this.getTile(e);
if (i && i.hasData()) {
t[e.key] = e;
continue
}
} else {
const e = r.children(this._source.maxzoom);
if (t[e[0].key] && t[e[1].key] && t[e[2].key] && t[e[3].key])
continue
}
let n = e.wasRequested();
for (let s = r.overscaledZ - 1; s >= o; --s) {
const o = r.scaledTo(s);
if (i[o.key])
break;
if (i[o.key] = !0,
e = this.getTile(o),
!e && n && (e = this._addTile(o)),
e && (t[o.key] = o,
n = e.wasRequested(),
e.hasData()))
break
}
}
return t
}
_updateLoadedParentTileCache() {
this._loadedParentTiles = {};
for (const e in this._tiles) {
const t = [];
let i, r = this._tiles[e].tileID;
for (; r.overscaledZ > 0; ) {
if (r.key in this._loadedParentTiles) {
i = this._loadedParentTiles[r.key];
break
}
t.push(r.key);
const e = r.scaledTo(r.overscaledZ - 1);
if (i = this._getLoadedTile(e),
i)
break;
r = e
}
for (const e of t)
this._loadedParentTiles[e] = i
}
}
_addTile(e) {
let t = this._tiles[e.key];
if (t)
return this._source.prepareTile && this._source.prepareTile(t),
t;
t = this._cache.getAndRemove(e),
t && (this._setTileReloadTimer(e.key, t),
t.tileID = e,
this._state.initializeTileState(t, this.map ? this.map.painter : null),
this._cacheTimers[e.key] && (clearTimeout(this._cacheTimers[e.key]),
delete this._cacheTimers[e.key],
this._setTileReloadTimer(e.key, t)));
const i = Boolean(t);
if (!i) {
const i = this.map ? this.map.painter : null;
t = new Mf(e,this._source.tileSize * e.overscaleFactor(),this.transform.tileZoom,i,this._isRaster),
this._source.prepareTile && this._source.prepareTile(t) || this._loadTile(t, this._tileLoaded.bind(this, t, e.key, t.state))
}
return t ? (t.uses++,
this._tiles[e.key] = t,
i || this._source.fire(new Ge("dataloading",{
tile: t,
coord: t.tileID,
dataType: "source"
})),
t) : null
}
_setTileReloadTimer(e, t) {
e in this._timers && (clearTimeout(this._timers[e]),
delete this._timers[e]);
const i = t.getExpiryTimeout();
i && (this._timers[e] = setTimeout((()=>{
this._reloadTile(e, "expired"),
delete this._timers[e]
}
), i))
}
_removeTile(e) {
const t = this._tiles[e];
t && (t.uses--,
delete this._tiles[e],
this._timers[e] && (clearTimeout(this._timers[e]),
delete this._timers[e]),
t.uses > 0 || (t.hasData() && "reloading" !== t.state ? this._cache.add(t.tileID, t, t.getExpiryTimeout()) : (t.aborted = !0,
this._abortTile(t),
this._unloadTile(t))))
}
clearTiles() {
this._shouldReloadOnResume = !1,
this._paused = !1;
for (const e in this._tiles)
this._removeTile(+e);
this._source._clear && this._source._clear(),
this._cache.reset(),
this.map && this.usedForTerrain && this.map.painter.terrain && this.map.painter.terrain.resetTileLookupCache(this.id)
}
tilesIn(e, t, i) {
const r = []
, n = this.transform;
if (!n)
return r;
const o = "globe" === n.projection.name
, s = Ia(n.center.lng);
for (const a in this._tiles) {
const l = this._tiles[a];
if (i && l.clearQueryDebugViz(),
l.holdingForFade())
continue;
let c;
if (o) {
const e = l.tileID.canonical;
if (0 === e.z) {
const t = [Math.abs(m(s, ...Yf(e, -1)) - s), Math.abs(m(s, ...Yf(e, 1)) - s)];
c = [0, 2 * t.indexOf(Math.min(...t)) - 1]
} else {
const t = [Math.abs(m(s, ...Yf(e, -1)) - s), Math.abs(m(s, ...Yf(e, 0)) - s), Math.abs(m(s, ...Yf(e, 1)) - s)];
c = [t.indexOf(Math.min(...t)) - 1]
}
} else
c = [0];
for (const i of c) {
const o = e.containsTile(l, n, t, i);
o && r.push(o)
}
}
return r
}
getVisibleCoordinates(e) {
const t = this.getRenderableIds(e).map((e=>this._tiles[e].tileID));
for (const e of t)
e.projMatrix = this.transform.calculateProjMatrix(e.toUnwrapped());
return t
}
hasTransition() {
if (this._source.hasTransition())
return !0;
if (Hf(this._source.type))
for (const e in this._tiles) {
const t = this._tiles[e];
if (void 0 !== t.fadeEndTime && t.fadeEndTime >= X.now())
return !0
}
return !1
}
setFeatureState(e, t, i) {
this._state.updateState(e = e || "_geojsonTileLayer", t, i)
}
removeFeatureState(e, t, i) {
this._state.removeFeatureState(e = e || "_geojsonTileLayer", t, i)
}
getFeatureState(e, t) {
return this._state.getState(e = e || "_geojsonTileLayer", t)
}
setDependencies(e, t, i) {
const r = this._tiles[e];
r && r.setDependencies(t, i)
}
reloadTilesForDependencies(e, t) {
for (const i in this._tiles)
this._tiles[i].hasDependency(e, t) && this._reloadTile(+i, "reloading");
this._cache.filter((i=>!i.hasDependency(e, t)))
}
_preloadTiles(e, t) {
const i = new Map
, r = Array.isArray(e) ? e : [e]
, n = this.map.painter.terrain
, o = this.usedForTerrain && n ? n.getScaledDemTileSize() : this._source.tileSize;
for (const e of r) {
const t = e.coveringTiles({
tileSize: o,
minzoom: this._source.minzoom,
maxzoom: this._source.maxzoom,
roundZoom: this._source.roundZoom && !this.usedForTerrain,
reparseOverscaled: this._source.reparseOverscaled,
isTerrainDEM: this.usedForTerrain
});
for (const e of t)
i.set(e.key, e);
this.usedForTerrain && e.updateElevation(!1)
}
y(Array.from(i.values()), ((e,t)=>{
const i = new Mf(e,this._source.tileSize * e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);
this._loadTile(i, (e=>{
"raster-dem" === this._source.type && i.dem && this._backfillDEM(i),
t(e, i)
}
))
}
), t)
}
}
function Xf(e, t) {
const i = Math.abs(2 * e.wrap) - +(e.wrap < 0)
, r = Math.abs(2 * t.wrap) - +(t.wrap < 0);
return e.overscaledZ - t.overscaledZ || r - i || t.canonical.y - e.canonical.y || t.canonical.x - e.canonical.x
}
function Hf(e) {
return "raster" === e || "image" === e || "video" === e
}
function Yf(e, t) {
const i = 1 << e.z;
return [e.x / i + t, (e.x + 1) / i + t]
}
Wf.maxOverzooming = 10,
Wf.maxUnderzooming = 3;
class Kf {
constructor(e, t, i) {
this._demTile = e,
this._dem = this._demTile.dem,
this._scale = t,
this._offset = i
}
static create(e, t, i) {
const r = i || e.findDEMTileFor(t);
if (!r || !r.dem)
return;
const n = r.dem
, o = r.tileID
, s = 1 << t.canonical.z - o.canonical.z;
return new Kf(r,r.tileSize / Ta / s,[(t.canonical.x / s - o.canonical.x) * n.dim, (t.canonical.y / s - o.canonical.y) * n.dim])
}
tileCoordToPixel(e, t) {
const i = t * this._scale + this._offset[1]
, r = Math.floor(e * this._scale + this._offset[0])
, n = Math.floor(i);
return new o(r,n)
}
getElevationAt(e, t, i, r) {
const n = e * this._scale + this._offset[0]
, o = t * this._scale + this._offset[1]
, s = Math.floor(n)
, a = Math.floor(o)
, l = this._dem;
return r = !!r,
i ? xi(xi(l.get(s, a, r), l.get(s, a + 1, r), o - a), xi(l.get(s + 1, a, r), l.get(s + 1, a + 1, r), o - a), n - s) : l.get(s, a, r)
}
getElevationAtPixel(e, t, i) {
return this._dem.get(e, t, !!i)
}
getMeterToDEM(e) {
return (1 << this._demTile.tileID.canonical.z) * ka(1, e) * this._dem.stride
}
}
class Jf {
constructor(e, t) {
this.tileID = e,
this.x = e.canonical.x,
this.y = e.canonical.y,
this.z = e.canonical.z,
this.grid = new kn(Ta,16,0),
this.featureIndexArray = new Rs,
this.promoteId = t
}
insert(e, t, i, r, n, o=0) {
const s = this.featureIndexArray.length;
this.featureIndexArray.emplaceBack(i, r, n, o);
const a = this.grid;
for (let e = 0; e < t.length; e++) {
const i = t[e]
, r = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
for (let e = 0; e < i.length; e++) {
const t = i[e];
r[0] = Math.min(r[0], t.x),
r[1] = Math.min(r[1], t.y),
r[2] = Math.max(r[2], t.x),
r[3] = Math.max(r[3], t.y)
}
r[0] < Ta && r[1] < Ta && r[2] >= 0 && r[3] >= 0 && a.insert(s, r[0], r[1], r[2], r[3])
}
}
loadVTLayers() {
if (!this.vtLayers) {
this.vtLayers = new _u.VectorTile(new xh(this.rawTileData)).layers,
this.sourceLayerCoder = new mf(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"]),
this.vtFeatures = {};
for (const e in this.vtLayers)
this.vtFeatures[e] = []
}
return this.vtLayers
}
query(e, t, i, r) {
this.loadVTLayers();
const n = e.params || {}
, o = Jr(n.filter)
, s = e.tileResult
, a = e.transform
, l = s.bufferedTilespaceBounds
, c = this.grid.query(l.min.x, l.min.y, l.max.x, l.max.y, ((e,t,i,r)=>sl(s.bufferedTilespaceGeometry, e, t, i, r)));
c.sort(em);
let u = null;
a.elevation && c.length > 0 && (u = Kf.create(a.elevation, this.tileID));
const h = {};
let d;
for (let a = 0; a < c.length; a++) {
const l = c[a];
if (l === d)
continue;
d = l;
const p = this.featureIndexArray.get(l);
let f = null;
this.loadMatchingFeature(h, p, o, n.layers, n.availableImages, t, i, r, ((t,i,r,n=0)=>(f || (f = qa(t, this.tileID.canonical, e.tileTransform)),
i.queryIntersectsFeature(s, t, r, f, this.z, e.transform, e.pixelPosMatrix, u, n))))
}
return h
}
loadMatchingFeature(e, t, i, r, n, o, s, a, l) {
const {featureIndex: c, bucketIndex: u, sourceLayerIndex: h, layoutVertexArrayOffset: d} = t
, p = this.bucketLayerIDs[u];
if (r && !function(e, t) {
for (let i = 0; i < e.length; i++)
if (t.indexOf(e[i]) >= 0)
return !0;
return !1
}(r, p))
return;
const f = this.sourceLayerCoder.decode(h)
, m = this.vtLayers[f].feature(c);
if (i.needGeometry) {
const e = Za(m, !0);
if (!i.filter(new Lo(this.tileID.overscaledZ), e, this.tileID.canonical))
return
} else if (!i.filter(new Lo(this.tileID.overscaledZ), m))
return;
const _ = this.getId(m, f);
for (let t = 0; t < p.length; t++) {
const i = p[t];
if (r && r.indexOf(i) < 0)
continue;
const u = o[i];
if (!u)
continue;
let h = {};
void 0 !== _ && a && (h = a.getState(u.sourceLayer || "_geojsonTileLayer", _));
const f = v({}, s[i]);
f.paint = Qf(f.paint, u.paint, m, h, n),
f.layout = Qf(f.layout, u.layout, m, h, n);
const g = !l || l(m, u, h, d);
if (!g)
continue;
const y = new gf(m,this.z,this.x,this.y,_);
y.layer = f;
let x = e[i];
void 0 === x && (x = e[i] = []),
x.push({
featureIndex: c,
feature: y,
intersectionZ: g
})
}
}
lookupSymbolFeatures(e, t, i, r, n, o, s, a) {
const l = {};
this.loadVTLayers();
const c = Jr(n);
for (const n of e)
this.loadMatchingFeature(l, {
bucketIndex: i,
sourceLayerIndex: r,
featureIndex: n,
layoutVertexArrayOffset: 0
}, c, o, s, a, t);
return l
}
loadFeature(e) {
const {featureIndex: t, sourceLayerIndex: i} = e;
this.loadVTLayers();
const r = this.sourceLayerCoder.decode(i)
, n = this.vtFeatures[r];
if (n[t])
return n[t];
const o = this.vtLayers[r].feature(t);
return n[t] = o,
o
}
hasLayer(e) {
for (const t of this.bucketLayerIDs)
for (const i of t)
if (e === i)
return !0;
return !1
}
getId(e, t) {
let i = e.id;
return this.promoteId && (i = e.properties["string" == typeof this.promoteId ? this.promoteId : this.promoteId[t]],
"boolean" == typeof i && (i = Number(i))),
i
}
}
function Qf(e, t, i, r, n) {
return A(e, ((e,o)=>{
const s = t instanceof No ? t.get(o) : null;
return s && s.evaluate ? s.evaluate(i, r, n) : s
}
))
}
function em(e, t) {
return t - e
}
Ln(Jf, "FeatureIndex", {
omit: ["rawTileData", "sourceLayerCoder"]
});
class tm {
constructor(e) {
const t = {}
, i = [];
for (const r in e) {
const n = e[r]
, o = t[r] = {};
for (const e in n.glyphs) {
const t = n.glyphs[+e];
if (!t || 0 === t.bitmap.width || 0 === t.bitmap.height)
continue;
const r = t.metrics.localGlyph ? 2 : 1
, s = {
x: 0,
y: 0,
w: t.bitmap.width + 2 * r,
h: t.bitmap.height + 2 * r
};
i.push(s),
o[e] = s
}
}
const {w: r, h: n} = Nh(i)
, o = new dc({
width: r || 1,
height: n || 1
});
for (const i in e) {
const r = e[i];
for (const e in r.glyphs) {
const n = r.glyphs[+e];
if (!n || 0 === n.bitmap.width || 0 === n.bitmap.height)
continue;
const s = t[i][e]
, a = n.metrics.localGlyph ? 2 : 1;
dc.copy(n.bitmap, o, {
x: 0,
y: 0
}, {
x: s.x + a,
y: s.y + a
}, n.bitmap)
}
}
this.image = o,
this.positions = t
}
}
Ln(tm, "GlyphAtlas");
class im {
constructor(e) {
this.tileID = new Ru(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),
this.tileZoom = e.tileZoom,
this.uid = e.uid,
this.zoom = e.zoom,
this.canonical = e.tileID.canonical,
this.pixelRatio = e.pixelRatio,
this.tileSize = e.tileSize,
this.source = e.source,
this.overscaling = this.tileID.overscaleFactor(),
this.showCollisionBoxes = e.showCollisionBoxes,
this.collectResourceTiming = !!e.collectResourceTiming,
this.returnDependencies = !!e.returnDependencies,
this.promoteId = e.promoteId,
this.enableTerrain = !!e.enableTerrain,
this.isSymbolTile = e.isSymbolTile,
this.tileTransform = Tp(e.tileID.canonical, e.projection),
this.projection = e.projection
}
parse(e, t, i, r, n) {
this.status = "parsing",
this.data = e,
this.collisionBoxArray = new Is;
const o = new mf(Object.keys(e.layers).sort())
, s = new Jf(this.tileID,this.promoteId);
s.bucketLayerIDs = [];
const a = {}
, l = new df(256,256)
, c = {
featureIndex: s,
iconDependencies: {},
patternDependencies: {},
glyphDependencies: {},
lineAtlas: l,
availableImages: i
}
, u = t.familiesBySource[this.source];
for (const t in u) {
const r = e.layers[t];
if (!r)
continue;
let n = !1
, l = !1;
for (const e of u[t])
"symbol" === e[0].type ? n = !0 : l = !0;
if (!0 === this.isSymbolTile && !n)
continue;
if (!1 === this.isSymbolTile && !l)
continue;
1 === r.version && P(`Vector tile source "${this.source}" layer "${t}" does not use vector tile spec v2 and therefore may have some rendering errors.`);
const h = o.encode(t)
, d = [];
for (let e = 0; e < r.length; e++) {
const i = r.feature(e)
, n = s.getId(i, t);
d.push({
feature: i,
id: n,
index: e,
sourceLayerIndex: h
})
}
for (const e of u[t]) {
const t = e[0];
void 0 !== this.isSymbolTile && "symbol" === t.type !== this.isSymbolTile || t.minzoom && this.zoom < Math.floor(t.minzoom) || t.maxzoom && this.zoom >= t.maxzoom || "none" !== t.visibility && (rm(e, this.zoom, i),
(a[t.id] = t.createBucket({
index: s.bucketLayerIDs.length,
layers: e,
zoom: this.zoom,
canonical: this.canonical,
pixelRatio: this.pixelRatio,
overscaling: this.overscaling,
collisionBoxArray: this.collisionBoxArray,
sourceLayerIndex: h,
sourceID: this.source,
enableTerrain: this.enableTerrain,
projection: this.projection.spec,
availableImages: i
})).populate(d, c, this.tileID.canonical, this.tileTransform),
s.bucketLayerIDs.push(e.map((e=>e.id))))
}
}
let h, d, p, f;
l.trim();
const m = {
type: "maybePrepare",
isSymbolTile: this.isSymbolTile,
zoom: this.zoom
}
, _ = A(c.glyphDependencies, (e=>Object.keys(e).map(Number)));
Object.keys(_).length ? r.send("getGlyphs", {
uid: this.uid,
stacks: _
}, ((e,t)=>{
h || (h = e,
d = t,
v.call(this))
}
), void 0, !1, m) : d = {};
const g = Object.keys(c.iconDependencies);
g.length ? r.send("getImages", {
icons: g,
source: this.source,
tileID: this.tileID,
type: "icons"
}, ((e,t)=>{
h || (h = e,
p = t,
v.call(this))
}
), void 0, !1, m) : p = {};
const y = Object.keys(c.patternDependencies);
function v() {
if (h)
return n(h);
if (d && p && f) {
const e = new tm(d)
, t = new $h(p,f);
for (const r in a) {
const n = a[r];
n instanceof Qp ? (rm(n.layers, this.zoom, i),
Bd(n, d, e.positions, p, t.iconPositions, this.showCollisionBoxes, i, this.tileID.canonical, this.tileZoom, this.projection)) : n.hasPattern && (n instanceof Hu || n instanceof tu || n instanceof Tu) && (rm(n.layers, this.zoom, i),
n.addFeatures(c, this.tileID.canonical, t.patternPositions, i, this.tileTransform))
}
this.status = "done",
n(null, {
buckets: x(a).filter((e=>!e.isEmpty())),
featureIndex: s,
collisionBoxArray: this.collisionBoxArray,
glyphAtlasImage: e.image,
lineAtlas: l,
imageAtlas: t,
glyphMap: this.returnDependencies ? d : null,
iconMap: this.returnDependencies ? p : null,
glyphPositions: this.returnDependencies ? e.positions : null
})
}
}
y.length ? r.send("getImages", {
icons: y,
source: this.source,
tileID: this.tileID,
type: "patterns"
}, ((e,t)=>{
h || (h = e,
f = t,
v.call(this))
}
), void 0, !1, m) : f = {},
v.call(this)
}
}
function rm(e, t, i) {
const r = new Lo(t);
for (const t of e)
t.recalculate(r, i)
}
class nm {
constructor(e) {
this.entries = {},
this.scheduler = e
}
request(e, t, i, r) {
const n = this.entries[e] = this.entries[e] || {
callbacks: []
};
if (n.result) {
const [e,i] = n.result;
return this.scheduler ? this.scheduler.add((()=>{
r(e, i)
}
), t) : r(e, i),
()=>{}
}
return n.callbacks.push(r),
n.cancel || (n.cancel = i(((i,r)=>{
n.result = [i, r];
for (const e of n.callbacks)
this.scheduler ? this.scheduler.add((()=>{
e(i, r)
}
), t) : e(i, r);
setTimeout((()=>delete this.entries[e]), 3e3)
}
))),
()=>{
n.result || (n.callbacks = n.callbacks.filter((e=>e !== r)),
n.callbacks.length || (n.cancel(),
delete this.entries[e]))
}
}
}
function om(e, t, i) {
const r = JSON.stringify(e.request);
return e.data && (this.deduped.entries[r] = {
result: [null, e.data]
}),
this.deduped.request(r, {
type: "parseTile",
isSymbolTile: e.isSymbolTile,
zoom: e.tileZoom
}, (t=>{
const r = De(e.request, ((e,r,n,o)=>{
e ? t(e) : r && t(null, {
vectorTile: i ? void 0 : new _u.VectorTile(new xh(r)),
rawData: r,
cacheControl: n,
expires: o
})
}
));
return ()=>{
r.cancel(),
t()
}
}
), t)
}
e.ARRAY_TYPE = ml,
e.AUTH_ERR_MSG = ne,
e.Aabb = ic,
e.Actor = class {
constructor(e, i, r) {
this.target = e,
this.parent = i,
this.mapId = r,
this.callbacks = {},
this.cancelCallbacks = {},
C(["receive"], this),
this.target.addEventListener("message", this.receive, !1),
this.globalScope = B() ? e : t,
this.scheduler = new ff
}
send(e, t, i, r, n=!1, o) {
const s = Math.round(1e18 * Math.random()).toString(36).substring(0, 10);
i && (i.metadata = o,
this.callbacks[s] = i);
const a = F(this.globalScope) ? void 0 : [];
return this.target.postMessage({
id: s,
type: e,
hasCallback: !!i,
targetMapId: r,
mustQueue: n,
sourceMapId: this.mapId,
data: Rn(t, a)
}, a),
{
cancel: ()=>{
i && delete this.callbacks[s],
this.target.postMessage({
id: s,
type: "<cancel>",
targetMapId: r,
sourceMapId: this.mapId
})
}
}
}
receive(e) {
const t = e.data
, i = t.id;
if (i && (!t.targetMapId || this.mapId === t.targetMapId))
if ("<cancel>" === t.type) {
const e = this.cancelCallbacks[i];
delete this.cancelCallbacks[i],
e && e.cancel()
} else if (t.mustQueue || B()) {
const e = this.callbacks[i];
this.cancelCallbacks[i] = this.scheduler.add((()=>this.processTask(i, t)), e && e.metadata || {
type: "message"
})
} else
this.processTask(i, t)
}
processTask(e, t) {
if ("<response>" === t.type) {
const i = this.callbacks[e];
delete this.callbacks[e],
i && (t.error ? i(Fn(t.error)) : i(null, Fn(t.data)))
} else {
const i = F(this.globalScope) ? void 0 : []
, r = t.hasCallback ? (t,r)=>{
delete this.cancelCallbacks[e],
this.target.postMessage({
id: e,
type: "<response>",
sourceMapId: this.mapId,
error: t ? Rn(t) : null,
data: Rn(r, i)
}, i)
}
: e=>{}
, n = Fn(t.data);
if (this.parent[t.type])
this.parent[t.type](t.sourceMapId, n, r);
else if (this.parent.getWorkerSource) {
const e = t.type.split(".");
this.parent.getWorkerSource(t.sourceMapId, e[0], n.source)[e[1]](n, r)
} else
r(new Error(`Could not find function ${t.type}`))
}
}
remove() {
this.scheduler.remove(),
this.target.removeEventListener("message", this.receive, !1)
}
}
,
e.CanonicalTileID = Bu,
e.Color = xt,
e.ColorMode = Gf,
e.CullFaceMode = Zf,
e.DEMData = Ff,
e.DataConstantProperty = Go,
e.DedupedRequest = nm,
e.DepthMode = Vf,
e.EXTENT = Ta,
e.Elevation = class {
isDataAvailableAtPoint(e) {
const t = this._source();
if (!t || e.y < 0 || e.y > 1)
return !1;
const i = t.getSource().maxzoom
, r = 1 << i
, n = Math.floor(e.x)
, o = Math.floor((e.x - n) * r)
, s = Math.floor(e.y * r)
, a = this.findDEMTileFor(new Ru(i,n,i,o,s));
return !(!a || !a.dem)
}
getAtPointOrZero(e, t=0) {
return this.getAtPoint(e, t) || 0
}
getAtPoint(e, t, i=!0) {
null == t && (t = null);
const r = this._source();
if (!r)
return t;
if (e.y < 0 || e.y > 1)
return t;
const n = r.getSource().maxzoom
, o = 1 << n
, s = Math.floor(e.x)
, a = e.x - s
, l = new Ru(n,s,n,Math.floor(a * o),Math.floor(e.y * o))
, c = this.findDEMTileFor(l);
if (!c || !c.dem)
return t;
const u = c.dem
, h = 1 << c.tileID.canonical.z
, d = (a * h - c.tileID.canonical.x) * u.dim
, p = (e.y * h - c.tileID.canonical.y) * u.dim
, f = Math.floor(d)
, m = Math.floor(p);
return (i ? this.exaggeration() : 1) * xi(xi(u.get(f, m), u.get(f, m + 1), p - m), xi(u.get(f + 1, m), u.get(f + 1, m + 1), p - m), d - f)
}
getAtTileOffset(e, t, i) {
const r = 1 << e.canonical.z;
return this.getAtPointOrZero(new Ra(e.wrap + (e.canonical.x + t / Ta) / r,(e.canonical.y + i / Ta) / r))
}
getAtTileOffsetFunc(e, t, i, r) {
return n=>{
const o = this.getAtTileOffset(e, n.x, n.y)
, s = r.upVector(e.canonical, n.x, n.y);
return Ol(s, s, o * r.upVectorScale(e.canonical, t, i).metersToTile),
s
}
}
getForTilePoints(e, t, i, r) {
const n = Kf.create(this, e, r);
return !!n && (t.forEach((e=>{
e[2] = this.exaggeration() * n.getElevationAt(e[0], e[1], i)
}
)),
!0)
}
getMinMaxForTile(e) {
const t = this.findDEMTileFor(e);
if (!t || !t.dem)
return null;
const i = t.dem.tree
, r = t.tileID
, n = 1 << e.canonical.z - r.canonical.z;
let o = e.canonical.x / n - r.canonical.x
, s = e.canonical.y / n - r.canonical.y
, a = 0;
for (let t = 0; t < e.canonical.z - r.canonical.z && !i.leaves[a]; t++) {
o *= 2,
s *= 2;
const e = 2 * Math.floor(s) + Math.floor(o);
a = i.childOffsets[a] + e,
o %= 1,
s %= 1
}
return {
min: this.exaggeration() * i.minimums[a],
max: this.exaggeration() * i.maximums[a]
}
}
getMinElevationBelowMSL() {
throw new Error("Pure virtual method called.")
}
raycast(e, t, i) {
throw new Error("Pure virtual method called.")
}
pointCoordinate(e) {
throw new Error("Pure virtual method called.")
}
_source() {
throw new Error("Pure virtual method called.")
}
exaggeration() {
throw new Error("Pure virtual method called.")
}
findDEMTileFor(e) {
throw new Error("Pure virtual method called.")
}
get visibleDemTiles() {
throw new Error("Getter must be implemented in subclass.")
}
}
,
e.ErrorEvent = $e,
e.EvaluationParameters = Lo,
e.Event = Ge,
e.Evented = qe,
e.FillExtrusionBucket = Tu,
e.Frustum = tc,
e.FrustumCorners = ec,
e.GLOBE_METERS_TO_ECEF = Hd,
e.GLOBE_RADIUS = Xd,
e.GLOBE_SCALE_MATCH_LATITUDE = 45,
e.GLOBE_ZOOM_THRESHOLD_MAX = 6,
e.GLOBE_ZOOM_THRESHOLD_MIN = 5,
e.GlobeSharedBuffers = class {
constructor(e) {
this._createGrid(e),
this._createPoles(e)
}
destroy() {
this._poleIndexBuffer.destroy(),
this._gridBuffer.destroy(),
this._gridIndexBuffer.destroy(),
this._poleNorthVertexBuffer.destroy(),
this._poleSouthVertexBuffer.destroy();
for (const e of this._poleSegments)
e.destroy();
for (const e of this._gridSegments)
e.destroy();
if (this._wireframeIndexBuffer) {
this._wireframeIndexBuffer.destroy();
for (const e of this._wireframeSegments)
e.destroy()
}
}
_createGrid(e) {
const t = new ts
, i = new gs
, r = 65;
for (let e = 0; e < r; e++)
for (let i = 0; i < r; i++)
t.emplaceBack(i, e);
this._gridSegments = [];
for (let e = 0, t = 0; e < Yd.length; e++) {
const n = Yd[e];
for (let e = 0; e < n; e++)
for (let t = 0; t < 64; t++) {
const n = e * r + t;
i.emplaceBack(n + 1, n, n + r),
i.emplaceBack(n + r, n + r + 1, n + 1)
}
const o = 64 * n * 2;
this._gridSegments.push(wa.simpleSegment(0, t, (n + 1) * r, o)),
t += o
}
this._gridBuffer = e.createVertexBuffer(t, Wd.members),
this._gridIndexBuffer = e.createIndexBuffer(i, !0)
}
_createPoles(e) {
const t = new gs;
for (let e = 0; e <= 64; e++)
t.emplaceBack(0, e + 1, e + 2);
this._poleIndexBuffer = e.createIndexBuffer(t, !0);
const i = new bs
, r = new bs;
this._poleSegments = [];
for (let e = 0, t = 0; e < 5; e++) {
const n = 360 / (1 << e);
i.emplaceBack(0, -Xd, 0, .5, 0),
r.emplaceBack(0, -Xd, 0, .5, 1);
for (let e = 0; e <= 64; e++) {
const t = e / 64
, o = xi(0, n, t)
, [s,a,l] = cp(vp, bp, o, Xd);
i.emplaceBack(s, a, l, t, 0),
r.emplaceBack(s, a, l, t, 1)
}
this._poleSegments.push(wa.simpleSegment(t, 0, 66, 64)),
t += 66
}
this._poleNorthVertexBuffer = e.createVertexBuffer(i, qd, !1),
this._poleSouthVertexBuffer = e.createVertexBuffer(r, qd, !1)
}
getGridBuffers(e) {
return [this._gridBuffer, this._gridIndexBuffer, this._gridSegments[e]]
}
getPoleBuffers(e) {
return [this._poleNorthVertexBuffer, this._poleSouthVertexBuffer, this._poleIndexBuffer, this._poleSegments[e]]
}
getWirefameBuffers(e, t) {
if (!this._wireframeSegments) {
const t = new Ts
, i = 64
, r = i + 1;
this._wireframeSegments = [];
for (let e = 0, n = 0; e < Yd.length; e++) {
const o = Yd[e];
for (let e = 0; e < o; e++)
for (let n = 0; n < i; n++) {
const i = e * r + n;
t.emplaceBack(i, i + 1),
t.emplaceBack(i, i + r),
t.emplaceBack(i, i + r + 1)
}
const s = o * i * 3;
this._wireframeSegments.push(wa.simpleSegment(0, n, (o + 1) * r, s)),
n += s
}
this._wireframeIndexBuffer = e.createIndexBuffer(t)
}
return [this._gridBuffer, this._wireframeIndexBuffer, this._wireframeSegments[t]]
}
}
,
e.GlyphManager = vd,
e.ImagePosition = Gh,
e.LineAtlas = df,
e.LngLat = Ca,
e.LngLatBounds = Ea,
e.LocalGlyphMode = xd,
e.MAX_MERCATOR_LATITUDE = Ba,
e.MercatorCoordinate = Ra,
e.ONE_EM = ah,
e.OverscaledTileID = Ru,
e.Properties = Xo,
e.RGBAImage = pc,
e.Ray = Ql,
e.RequestManager = class {
constructor(e, t, i) {
this._transformRequestFn = e,
this._customAccessToken = t,
this._silenceAuthErrors = !!i,
this._createSkuToken()
}
_createSkuToken() {
const e = function() {
let e = "";
for (let t = 0; t < 10; t++)
e += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62 * Math.random())];
return {
token: ["1", re, e].join(""),
tokenExpiresAt: Date.now() + 432e5
}
}();
this._skuToken = e.token,
this._skuTokenExpiresAt = e.tokenExpiresAt
}
_isSkuTokenExpired() {
return Date.now() > this._skuTokenExpiresAt
}
transformRequest(e, t) {
return this._transformRequestFn && this._transformRequestFn(e, t) || {
url: e
}
}
normalizeStyleURL(e, t) {
if (!oe(e))
return e;
const i = le(e);
return i.path = `/styles/v1 ${i.path}`,
this._makeAPIURL(i, this._customAccessToken || t)
}
normalizeGlyphsURL(e, t) {
if (!oe(e))
return e;
const i = le(e);
return i.path = `/fonts/v1 ${i.path}`,
this._makeAPIURL(i, this._customAccessToken || t)
}
normalizeSourceURL(e, t, i, r) {
if (!oe(e))
return e;
const n = le(e);
return n.path = `/v4/${n.authority}.json`,
n.params.push("secure"),
i && n.params.push(`language=${i}`),
r && n.params.push(`worldview=${r}`),
this._makeAPIURL(n, this._customAccessToken || t)
}
normalizeSpriteURL(e, t, i, r) {
const n = le(e);
return oe(e) ? (n.path = `/styles/v1 ${n.path}/sprite ${t}${i}`,
this._makeAPIURL(n, this._customAccessToken || r)) : (n.path += `${t}${i}`,
ce(n))
}
normalizeTileURL(e, t, i) {
if (this._isSkuTokenExpired() && this._createSkuToken(),
e && !oe(e))
return e;
const r = le(e);
r.path = r.path.replace(/(\.(png|jpg)\d*)(?=$)/, `${t || i && "raster" !== r.authority && 512 === i ? "@2x" : ""}${K.supported ? ".webp" : "$1"}`),
"raster" === r.authority ? r.path = `/${Y.RASTER_URL_PREFIX}${r.path}` : (r.path = r.path.replace(/^.+\/v4\//, "/"),
r.path = `/${Y.TILE_URL_VERSION}${r.path}`);
const n = this._customAccessToken || function(e) {
for (const t of e) {
const e = t.match(/^access_token=(.*)$/);
if (e)
return e[1]
}
return null
}(r.params) || Y.ACCESS_TOKEN;
return Y.REQUIRE_ACCESS_TOKEN && n && this._skuToken && r.params.push(`sku=${this._skuToken}`),
this._makeAPIURL(r, n)
}
canonicalizeTileURL(e, t) {
const i = le(e);
if (!i.path.match(/^(\/v4\/|\/raster\/v1\/)/) || !i.path.match(/\.[\w]+$/))
return e;
let r = "mapbox://";
i.path.match(/^\/raster\/v1\//) ? r += `raster/${i.path.replace(`/${Y.RASTER_URL_PREFIX}/`, "")}` : r += `tiles/${i.path.replace(`/${Y.TILE_URL_VERSION}/`, "")}`;
let n = i.params;
return t && (n = n.filter((e=>!e.match(/^access_token=/)))),
n.length && (r += `?${n.join("&")}`),
r
}
canonicalizeTileset(e, t) {
const i = !!t && oe(t)
, r = [];
for (const t of e.tiles || [])
se(t) ? r.push(this.canonicalizeTileURL(t, i)) : r.push(t);
return r
}
_makeAPIURL(e, t) {
const i = "See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"
, r = le(Y.API_URL);
if (e.protocol = r.protocol,
e.authority = r.authority,
"http" === e.protocol) {
const t = e.params.indexOf("secure");
t >= 0 && e.params.splice(t, 1)
}
if ("/" !== r.path && (e.path = `${r.path}${e.path}`),
!Y.REQUIRE_ACCESS_TOKEN)
return ce(e);
if (t = t || Y.ACCESS_TOKEN,
!this._silenceAuthErrors) {
if (!t)
throw new Error(`An API access token is required to use Mapbox GL. ${i}`);
if ("s" === t[0])
throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)
}
return e.params = e.params.filter((e=>-1 === e.indexOf("access_token"))),
e.params.push(`access_token=${t || ""}`),
ce(e)
}
}
,
e.ResourceType = Ie,
e.SegmentVector = wa,
e.SourceCache = Wf,
e.StencilMode = Nf,
e.StructArrayLayout1ui2 = Es,
e.StructArrayLayout2f1f2i16 = fs,
e.StructArrayLayout2i4 = ts,
e.StructArrayLayout2ui4 = Ts,
e.StructArrayLayout3f12 = _s,
e.StructArrayLayout3ui6 = gs,
e.StructArrayLayout4i8 = rs,
e.StructArrayLayout5f20 = bs,
e.Texture = hf,
e.Tile = Mf,
e.Transitionable = Ro,
e.Uniform1f = Qs,
e.Uniform1i = class extends Js {
constructor(e) {
super(e),
this.current = 0
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && this.current !== i && (this.current = i,
this.gl.uniform1i(this.location, i))
}
}
,
e.Uniform2f = class extends Js {
constructor(e) {
super(e),
this.current = [0, 0]
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && (i[0] === this.current[0] && i[1] === this.current[1] || (this.current = i,
this.gl.uniform2f(this.location, i[0], i[1])))
}
}
,
e.Uniform3f = class extends Js {
constructor(e) {
super(e),
this.current = [0, 0, 0]
}
set(e, t, i) {
this.fetchUniformLocation(e, t) && (i[0] === this.current[0] && i[1] === this.current[1] && i[2] === this.current[2] || (this.current = i,
this.gl.uniform3f(this.location, i[0], i[1], i[2])))
}
}
,
e.Uniform4f = ea,
e.UniformColor = ta,
e.UniformMatrix2f = class extends Js {
constructor(e) {
super(e),
this.current = na
}
set(e, t, i) {
if (this.fetchUniformLocation(e, t))
for (let e = 0; e < 4; e++)
if (i[e] !== this.current[e]) {
this.current = i,
this.gl.uniformMatrix2fv(this.location, !1, i);
break
}
}
}
,
e.UniformMatrix3f = class extends Js {
constructor(e) {
super(e),
this.current = ra
}
set(e, t, i) {
if (this.fetchUniformLocation(e, t))
for (let e = 0; e < 9; e++)
if (i[e] !== this.current[e]) {
this.current = i,
this.gl.uniformMatrix3fv(this.location, !1, i);
break
}
}
}
,
e.UniformMatrix4f = class extends Js {
constructor(e) {
super(e),
this.current = ia
}
set(e, t, i) {
if (this.fetchUniformLocation(e, t)) {
if (i[12] !== this.current[12] || i[0] !== this.current[0])
return this.current = i,
void this.gl.uniformMatrix4fv(this.location, !1, i);
for (let e = 1; e < 16; e++)
if (i[e] !== this.current[e]) {
this.current = i,
this.gl.uniformMatrix4fv(this.location, !1, i);
break
}
}
}
}
,
e.UnwrappedTileID = Ou,
e.ValidationError = Gr,
e.VectorTileWorkerSource = class extends qe {
constructor(e, t, i, r, n) {
super(),
this.actor = e,
this.layerIndex = t,
this.availableImages = i,
this.loadVectorData = n || om,
this.loading = {},
this.loaded = {},
this.deduped = new nm(e.scheduler),
this.isSpriteLoaded = r,
this.scheduler = e.scheduler
}
loadTile(e, t) {
const i = e.uid
, r = e && e.request
, n = r && r.collectResourceTiming
, o = this.loading[i] = new im(e);
o.abort = this.loadVectorData(e, ((s,a)=>{
const l = !this.loading[i];
if (delete this.loading[i],
l || s || !a)
return o.status = "done",
l || (this.loaded[i] = o),
t(s);
const c = a.rawData
, u = {};
a.expires && (u.expires = a.expires),
a.cacheControl && (u.cacheControl = a.cacheControl),
o.vectorTile = a.vectorTile || new _u.VectorTile(new xh(c));
const h = ()=>{
o.parse(o.vectorTile, this.layerIndex, this.availableImages, this.actor, ((e,i)=>{
if (e || !i)
return t(e);
const o = {};
if (n) {
const e = N(r);
e.length > 0 && (o.resourceTiming = JSON.parse(JSON.stringify(e)))
}
t(null, v({
rawTileData: c.slice(0)
}, i, u, o))
}
))
}
;
this.isSpriteLoaded ? h() : this.once("isSpriteLoaded", (()=>{
this.scheduler ? this.scheduler.add(h, {
type: "parseTile",
isSymbolTile: e.isSymbolTile,
zoom: e.tileZoom
}) : h()
}
)),
this.loaded = this.loaded || {},
this.loaded[i] = o
}
))
}
reloadTile(e, t) {
const i = this.loaded
, r = e.uid
, n = this;
if (i && i[r]) {
const o = i[r];
o.showCollisionBoxes = e.showCollisionBoxes,
o.enableTerrain = !!e.enableTerrain,
o.projection = e.projection,
o.tileTransform = Tp(e.tileID.canonical, e.projection);
const s = (e,i)=>{
const r = o.reloadCallback;
r && (delete o.reloadCallback,
o.parse(o.vectorTile, n.layerIndex, this.availableImages, n.actor, r)),
t(e, i)
}
;
"parsing" === o.status ? o.reloadCallback = s : "done" === o.status && (o.vectorTile ? o.parse(o.vectorTile, this.layerIndex, this.availableImages, this.actor, s) : s())
}
}
abortTile(e, t) {
const i = e.uid
, r = this.loading[i];
r && (r.abort && r.abort(),
delete this.loading[i]),
t()
}
removeTile(e, t) {
const i = this.loaded
, r = e.uid;
i && i[r] && delete i[r],
t()
}
}
,
e.WritingMode = qh,
e.ZoomHistory = Un,
e.add = kl,
e.addDynamicAttributes = Hp,
e.adjoint = function(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = t[3]
, s = t[4]
, a = t[5]
, l = t[6]
, c = t[7]
, u = t[8];
return e[0] = s * u - a * c,
e[1] = n * c - r * u,
e[2] = r * a - n * s,
e[3] = a * l - o * u,
e[4] = i * u - n * l,
e[5] = n * o - i * a,
e[6] = o * c - s * l,
e[7] = r * l - i * c,
e[8] = i * s - r * o,
e
}
,
e.asyncAll = y,
e.bezier = p,
e.bindAll = C,
e.boundsAttributes = Sf,
e.bufferConvexPolygon = function(e, t) {
const i = [];
for (let r = 0; r < e.length; r++) {
const n = g(r - 1, -1, e.length - 1)
, o = g(r + 1, -1, e.length - 1)
, s = e[r]
, a = e[o]
, l = e[n].sub(s).unit()
, c = a.sub(s).unit()
, u = c.angleWithSep(l.x, l.y)
, h = l.add(c).unit().mult(-1 * t / Math.sin(u / 2));
i.push(s.add(h))
}
return i
}
,
e.cacheEntryPossiblyAdded = function(e) {
Ae++,
Ae > be && (e.getActor().send("enforceCacheSizeLimit", ve),
Ae = 0)
}
,
e.calculateGlobeLabelMatrix = function(e, t) {
const {x: i, y: r} = e.point
, n = _p(i, r, e.worldSize / e._pixelsPerMercatorPixel, 0, 0);
return xl(n, n, mp(rp(t)))
}
,
e.calculateGlobeMatrix = function(e) {
const {x: t, y: i} = e.point
, {lng: r, lat: n} = e._center;
return _p(t, i, e.worldSize, r, n)
}
,
e.calculateGlobeMercatorMatrix = function(e) {
const t = e.pixelsPerMeter
, i = t / ka(1, e.center.lat)
, r = gl(new Float64Array(16));
return vl(r, r, [e.point.x, e.point.y, 0]),
bl(r, r, [i, i, t]),
Float32Array.from(r)
}
,
e.circumferenceAtLatitude = Aa,
e.clamp = m,
e.clearTileCache = function(e) {
const t = Ee()
, i = [];
for (const e in we)
t && i.push(t.delete(e)),
delete we[e];
e && Promise.all(i).catch(e).then((()=>e()))
}
,
e.clipLine = md,
e.clone = function(e) {
var t = new ml(16);
return t[0] = e[0],
t[1] = e[1],
t[2] = e[2],
t[3] = e[3],
t[4] = e[4],
t[5] = e[5],
t[6] = e[6],
t[7] = e[7],
t[8] = e[8],
t[9] = e[9],
t[10] = e[10],
t[11] = e[11],
t[12] = e[12],
t[13] = e[13],
t[14] = e[14],
t[15] = e[15],
t
}
,
e.clone$1 = z,
e.collisionCircleLayout = sh,
e.config = Y,
e.conjugate = function(e, t) {
return e[0] = -t[0],
e[1] = -t[1],
e[2] = -t[2],
e[3] = t[3],
e
}
,
e.create = function() {
var e = new ml(16);
return ml != Float32Array && (e[1] = 0,
e[2] = 0,
e[3] = 0,
e[4] = 0,
e[6] = 0,
e[7] = 0,
e[8] = 0,
e[9] = 0,
e[11] = 0,
e[12] = 0,
e[13] = 0,
e[14] = 0),
e[0] = 1,
e[5] = 1,
e[10] = 1,
e[15] = 1,
e
}
,
e.create$1 = _l,
e.createExpression = Rr,
e.createLayout = Qo,
e.createStyleLayer = function(e) {
return "custom" === e.type ? new af(e) : new uf[e.type](e)
}
,
e.cross = Vl,
e.degToRad = c,
e.distance = function(e, t) {
return Math.hypot(t[0] - e[0], t[1] - e[1], t[2] - e[2])
}
,
e.div = function(e, t, i) {
return e[0] = t[0] / i[0],
e[1] = t[1] / i[1],
e[2] = t[2] / i[2],
e
}
,
e.dot = Ul,
e.ease = f,
e.easeCubicInOut = d,
e.emitValidationErrors = zn,
e.endsWith = M,
e.enforceCacheSizeLimit = function(e) {
for (const t in we)
Se(t),
we[t].then((t=>{
t.keys().then((i=>{
for (let r = 0; r < i.length - e; r++)
t.delete(i[r])
}
))
}
))
}
,
e.evaluateSizeForFeature = uh,
e.evaluateSizeForZoom = hh,
e.evaluateVariableOffset = Ld,
e.evented = zo,
e.exactEquals = function(e, t) {
return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3]
}
,
e.exactEquals$1 = function(e, t) {
return e[0] === t[0] && e[1] === t[1] && e[2] === t[2]
}
,
e.exported = X,
e.exported$1 = K,
e.extend = v,
e.extend$1 = We,
e.fillExtrusionHeightLift = zu,
e.filterObject = I,
e.fromMat4 = function(e, t) {
return e[0] = t[0],
e[1] = t[1],
e[2] = t[2],
e[3] = t[4],
e[4] = t[5],
e[5] = t[6],
e[6] = t[8],
e[7] = t[9],
e[8] = t[10],
e
}
,
e.fromQuat = function(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = t[3]
, s = i + i
, a = r + r
, l = n + n
, c = i * s
, u = r * s
, h = r * a
, d = n * s
, p = n * a
, f = n * l
, m = o * s
, _ = o * a
, g = o * l;
return e[0] = 1 - h - f,
e[1] = u + g,
e[2] = d - _,
e[3] = 0,
e[4] = u - g,
e[5] = 1 - c - f,
e[6] = p + m,
e[7] = 0,
e[8] = d + _,
e[9] = p - m,
e[10] = 1 - c - h,
e[11] = 0,
e[12] = 0,
e[13] = 0,
e[14] = 0,
e[15] = 1,
e
}
,
e.fromRotation = function(e, t) {
var i = Math.sin(t)
, r = Math.cos(t);
return e[0] = r,
e[1] = i,
e[2] = 0,
e[3] = -i,
e[4] = r,
e[5] = 0,
e[6] = 0,
e[7] = 0,
e[8] = 1,
e
}
,
e.fromScaling = El,
e.furthestTileCorner = function(e) {
const t = Math.round((e + 45 + 360) % 360 / 90) % 4;
return h[t]
}
,
e.getAABBPointSquareDist = function(e, t, i) {
let r = 0;
for (let n = 0; n < 2; ++n) {
const o = i ? i[n] : 0;
e[n] > o && (r += (e[n] - o) * (e[n] - o)),
t[n] < o && (r += (o - t[n]) * (o - t[n]))
}
return r
}
,
e.getAnchorAlignment = rd,
e.getAnchorJustification = Od,
e.getBounds = function(e) {
let t = 1 / 0
, i = 1 / 0
, r = -1 / 0
, n = -1 / 0;
for (const o of e)
t = Math.min(t, o.x),
i = Math.min(i, o.y),
r = Math.max(r, o.x),
n = Math.max(n, o.y);
return {
min: new o(t,i),
max: new o(r,n)
}
}
,
e.getColumn = V,
e.getGridMatrix = function(e, t, i) {
const r = t.getNorth()
, n = t.getSouth()
, o = t.getWest()
, s = .015625;
return [0, (t.getEast() - o) * s, 1 << e.z, (n - r) / Yd[i], 0, e.y, r, o, s]
}
,
e.getImage = Ve,
e.getJSON = function(e, t) {
return Pe(v(e, {
type: "json"
}), t)
}
,
e.getLatitudinalLod = function(e) {
const t = 80.051129;
e = m(e, -80.051129, t) / t * 90;
const i = Math.pow(Math.abs(Math.sin(c(e))), 3);
return Math.round(i * (Yd.length - 1))
}
,
e.getMapSessionAPI = ge,
e.getPerformanceMeasurement = N,
e.getProjection = $p,
e.getRTLTextPluginStatus = ko,
e.getReferrer = ke,
e.getTilePoint = function(e, {x: t, y: i}, r=0) {
return new o(((t - r) * e.scale - e.x) * Ta,(i * e.scale - e.y) * Ta)
}
,
e.getTileVec3 = function(e, t, i=0) {
return zl(((t.x - i) * e.scale - e.x) * Ta, (t.y * e.scale - e.y) * Ta, La(t.z, t.y))
}
,
e.getVideo = function(e, i) {
const r = t.document.createElement("video");
r.muted = !0,
r.onloadstart = function() {
i(null, r)
}
;
for (let i = 0; i < e.length; i++) {
const n = t.document.createElement("source");
Oe(e[i]) || (r.crossOrigin = "Anonymous"),
n.src = e[i],
r.appendChild(n)
}
return {
cancel: ()=>{}
}
}
,
e.globeCenterToScreenPoint = function(e) {
const t = [0, 0, 0]
, i = gl(new Float64Array(16));
return xl(i, e.pixelMatrix, e.globeMatrix),
jl(t, t, i),
new o(t[0],t[1])
}
,
e.globeDenormalizeECEF = mp,
e.globeECEFOrigin = function(e, t) {
const i = [0, 0, 0];
return jl(i, i, fp(rp(t.canonical))),
jl(i, i, e),
i
}
,
e.globeNormalizeECEF = fp,
e.globePixelsToTileUnits = function(e, t) {
return Ta / (512 * Math.pow(2, e)) * dp(rp(t))
}
,
e.globePoleMatrixForTile = function(e, t, i) {
const r = gl(new Float64Array(16))
, n = (t / (1 << e) - .5) * Math.PI * 2;
return Tl(r, i.globeMatrix, n),
Float32Array.from(r)
}
,
e.globeTileBounds = rp,
e.globeTiltAtLngLat = yp,
e.globeToMercatorTransition = gp,
e.globeUseCustomAntiAliasing = function(e, t, i) {
const r = gp(i.zoom)
, n = e.style.map._antialias
, o = !!t.extStandardDerivatives
, s = t.extStandardDerivativesForceOff || e.terrain && e.terrain.exaggeration() > 0;
return 0 === r && !n && !s && o
}
,
e.identity = gl,
e.identity$1 = Yl,
e.invert = yl,
e.isFullscreen = function() {
return !!t.document.fullscreenElement || !!t.document.webkitFullscreenElement
}
,
e.isLngLatBehindGlobe = function(e, t) {
return yp(e, t) > Math.PI / 2 * 1.01
}
,
e.isMapAuthenticated = function(e) {
return ye.has(e)
}
,
e.isMapboxURL = oe,
e.isSafariWithAntialiasingBug = function(e) {
const t = e.navigator ? e.navigator.userAgent : null;
return !!F(e) && t && (t.match("Version/15.4") || t.match("Version/15.5") || t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))
}
,
e.latFromMercatorY = Da,
e.len = Zl,
e.length = Il,
e.length$1 = function(e) {
return Math.hypot(e[0], e[1], e[2], e[3])
}
,
e.loadVectorTile = om,
e.makeRequest = Pe,
e.mapValue = function(e, t, i, r, n) {
return m((e - t) / (i - t) * (n - r) + r, r, n)
}
,
e.mercatorScale = Oa,
e.mercatorXfromLng = Ia,
e.mercatorYfromLat = za,
e.mercatorZfromAltitude = ka,
e.mul = Cl,
e.mul$1 = ql,
e.multiply = xl,
e.multiply$1 = function(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = t[4]
, l = t[5]
, c = t[6]
, u = t[7]
, h = t[8]
, d = i[0]
, p = i[1]
, f = i[2]
, m = i[3]
, _ = i[4]
, g = i[5]
, y = i[6]
, x = i[7]
, v = i[8];
return e[0] = d * r + p * s + f * c,
e[1] = d * n + p * a + f * u,
e[2] = d * o + p * l + f * h,
e[3] = m * r + _ * s + g * c,
e[4] = m * n + _ * a + g * u,
e[5] = m * o + _ * l + g * h,
e[6] = y * r + x * s + v * c,
e[7] = y * n + x * a + v * u,
e[8] = y * o + x * l + v * h,
e
}
,
e.multiply$2 = Dl,
e.nextPowerOfTwo = E,
e.normalize = Fl,
e.normalize$1 = function(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = t[3]
, s = i * i + r * r + n * n + o * o;
return s > 0 && (s = 1 / Math.sqrt(s)),
e[0] = i * s,
e[1] = r * s,
e[2] = n * s,
e[3] = o * s,
e
}
,
e.number = xi,
e.ortho = function(e, t, i, r, n, o, s) {
var a = 1 / (t - i)
, l = 1 / (r - n)
, c = 1 / (o - s);
return e[0] = -2 * a,
e[1] = 0,
e[2] = 0,
e[3] = 0,
e[4] = 0,
e[5] = -2 * l,
e[6] = 0,
e[7] = 0,
e[8] = 0,
e[9] = 0,
e[10] = 2 * c,
e[11] = 0,
e[12] = (t + i) * a,
e[13] = (n + r) * l,
e[14] = (s + o) * c,
e[15] = 1,
e
}
,
e.pbf = xh,
e.perspective = function(e, t, i, r, n) {
var o, s = 1 / Math.tan(t / 2);
return e[0] = s / i,
e[1] = 0,
e[2] = 0,
e[3] = 0,
e[4] = 0,
e[5] = s,
e[6] = 0,
e[7] = 0,
e[8] = 0,
e[9] = 0,
e[11] = -1,
e[12] = 0,
e[13] = 0,
e[15] = 0,
null != n && n !== 1 / 0 ? (e[10] = (n + r) * (o = 1 / (r - n)),
e[14] = 2 * n * r * o) : (e[10] = -1,
e[14] = -2 * r),
e
}
,
e.pick = function(e, t) {
const i = {};
for (let r = 0; r < t.length; r++) {
const n = t[r];
n in e && (i[n] = e[n])
}
return i
}
,
e.plugin = Do,
e.pointGeometry = o,
e.polygonContainsPoint = ol,
e.polygonIntersectsBox = sl,
e.polygonIntersectsPolygon = Ya,
e.polygonizeBounds = function(e, t, i=0, r=!0) {
const n = new o(i,i)
, s = e.sub(n)
, a = t.add(n)
, l = [s, new o(a.x,s.y), a, new o(s.x,a.y)];
return r && l.push(s.clone()),
l
}
,
e.posAttributes = Wd,
e.postMapLoadEvent = me,
e.postTurnstileEvent = pe,
e.potpack = Nh,
e.prevPowerOfTwo = function(e) {
return e <= 1 ? 1 : Math.pow(2, Math.floor(Math.log(e) / Math.LN2))
}
,
e.radToDeg = u,
e.refProperties = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"],
e.registerForPluginStateChange = function(e) {
return e({
pluginStatus: Co,
pluginURL: Mo
}),
zo.on("pluginStateChange", e),
e
}
,
e.removeAuthState = function(e) {
ye.delete(e)
}
,
e.renderColorRamp = mc,
e.resample = Ua,
e.rotateX = wl,
e.rotateX$1 = Kl,
e.rotateY = Tl,
e.rotateY$1 = Jl,
e.rotateZ = function(e, t, i) {
var r = Math.sin(i)
, n = Math.cos(i)
, o = t[0]
, s = t[1]
, a = t[2]
, l = t[3]
, c = t[4]
, u = t[5]
, h = t[6]
, d = t[7];
return t !== e && (e[8] = t[8],
e[9] = t[9],
e[10] = t[10],
e[11] = t[11],
e[12] = t[12],
e[13] = t[13],
e[14] = t[14],
e[15] = t[15]),
e[0] = o * n + c * r,
e[1] = s * n + u * r,
e[2] = a * n + h * r,
e[3] = l * n + d * r,
e[4] = c * n - o * r,
e[5] = u * n - s * r,
e[6] = h * n - a * r,
e[7] = d * n - l * r,
e
}
,
e.rotateZ$1 = function(e, t, i) {
i *= .5;
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = Math.sin(i)
, l = Math.cos(i);
return e[0] = r * l + n * a,
e[1] = n * l - r * a,
e[2] = o * l + s * a,
e[3] = s * l - o * a,
e
}
,
e.scale = bl,
e.scale$1 = Wl,
e.scale$2 = Ol,
e.scaleAndAdd = Rl,
e.setCacheLimits = function(e, t) {
ve = e,
be = t
}
,
e.setColumn = function(e, t, i) {
e[4 * t + 0] = i[0],
e[4 * t + 1] = i[1],
e[4 * t + 2] = i[2],
e[4 * t + 3] = i[3]
}
,
e.setRTLTextPlugin = function(e, t, i=!1) {
if (Co === wo || Co === To || Co === Eo)
throw new Error("setRTLTextPlugin cannot be called multiple times.");
Mo = X.resolveURL(e),
Co = wo,
So = t,
Io(),
i || Po()
}
,
e.smoothstep = _,
e.spec = Ze,
e.storeAuthState = function(e, t) {
t ? ye.add(e) : ye.delete(e)
}
,
e.sub = $l,
e.subtract = Pl,
e.symbolSize = dh,
e.tileAABB = function(e, t, i, r, n, o, s, a, l) {
if ("globe" === l.name)
return sp(e, t, new Bu(i,r,n));
const c = Tp({
z: i,
x: r,
y: n
}, l);
return new ic([(o + c.x / c.scale) * t, t * (c.y / c.scale), s],[(o + c.x2 / c.scale) * t, t * (c.y2 / c.scale), a])
}
,
e.tileCornersToBounds = ap,
e.tileTransform = Tp,
e.transformMat3 = function(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2];
return e[0] = r * i[0] + n * i[3] + o * i[6],
e[1] = r * i[1] + n * i[4] + o * i[7],
e[2] = r * i[2] + n * i[5] + o * i[8],
e
}
,
e.transformMat4 = jl,
e.transformMat4$1 = Xl,
e.transformQuat = Nl,
e.transitionTileAABBinECEF = np,
e.translate = vl,
e.transpose = function(e, t) {
if (e === t) {
var i = t[1]
, r = t[2]
, n = t[5];
e[1] = t[3],
e[2] = t[6],
e[3] = i,
e[5] = t[7],
e[6] = r,
e[7] = n
} else
e[0] = t[0],
e[1] = t[3],
e[2] = t[6],
e[3] = t[1],
e[4] = t[4],
e[5] = t[7],
e[6] = t[2],
e[7] = t[5],
e[8] = t[8];
return e
}
,
e.triggerPluginCompletionEvent = Ao,
e.uniqueId = w,
e.updateGlobeVertexNormal = function(e, t, i, r, n) {
const o = 5 * t + 2;
e.float32[o + 0] = i,
e.float32[o + 1] = r,
e.float32[o + 2] = n
}
,
e.validateCustomStyleLayer = function(e) {
const t = []
, i = e.id;
return void 0 === i && t.push({
message: `layers.${i}: missing required property "id"`
}),
void 0 === e.render && t.push({
message: `layers.${i}: missing required method "render"`
}),
e.renderingMode && "2d" !== e.renderingMode && "3d" !== e.renderingMode && t.push({
message: `layers.${i}: property "renderingMode" must be either "2d" or "3d"`
}),
t
}
,
e.validateFilter = e=>In(hn(e)),
e.validateFog = e=>In(wn(e)),
e.validateLayer = e=>In(_n(e)),
e.validateLight = e=>In(vn(e)),
e.validateSource = e=>In(xn(e)),
e.validateStyle = Cn,
e.validateTerrain = e=>In(bn(e)),
e.values = x,
e.vectorTile = _u,
e.version = G,
e.warnOnce = P,
e.window = t,
e.wrap = g
}
)),
n(["./shared"], (function(e) {
function t(e) {
if ("number" == typeof e || "boolean" == typeof e || "string" == typeof e || null == e)
return JSON.stringify(e);
if (Array.isArray(e)) {
let i = "[";
for (const r of e)
i += `${t(r)},`;
return `${i}]`
}
let i = "{";
for (const r of Object.keys(e).sort())
i += `${r}:${t(e[r])},`;
return `${i}}`
}
function i(i) {
let r = "";
for (const n of e.refProperties)
r += `/${t(i[n])}`;
return r
}
class r {
constructor(e) {
this.keyCache = {},
e && this.replace(e)
}
replace(e) {
this._layerConfigs = {},
this._layers = {},
this.update(e, [])
}
update(t, r) {
for (const i of t)
this._layerConfigs[i.id] = i,
(this._layers[i.id] = e.createStyleLayer(i)).compileFilter(),
this.keyCache[i.id] && delete this.keyCache[i.id];
for (const e of r)
delete this.keyCache[e],
delete this._layerConfigs[e],
delete this._layers[e];
this.familiesBySource = {};
const n = function(e, t) {
const r = {};
for (let n = 0; n < e.length; n++) {
const o = t && t[e[n].id] || i(e[n]);
t && (t[e[n].id] = o);
let s = r[o];
s || (s = r[o] = []),
s.push(e[n])
}
const n = [];
for (const e in r)
n.push(r[e]);
return n
}(e.values(this._layerConfigs), this.keyCache);
for (const e of n) {
const t = e.map((e=>this._layers[e.id]))
, i = t[0];
if ("none" === i.visibility)
continue;
const r = i.source || "";
let n = this.familiesBySource[r];
n || (n = this.familiesBySource[r] = {});
const o = i.sourceLayer || "_geojsonTileLayer";
let s = n[o];
s || (s = n[o] = []),
s.push(t)
}
}
}
class n {
loadTile(t, i) {
const {uid: r, encoding: n, rawImageData: o, padding: s, buildQuadTree: a} = t
, l = e.window.ImageBitmap && o instanceof e.window.ImageBitmap ? this.getImageData(o, s) : o;
i(null, new e.DEMData(r,l,n,s < 1,a))
}
getImageData(e, t) {
this.offscreenCanvas && this.offscreenCanvasContext || (this.offscreenCanvas = new OffscreenCanvas(e.width,e.height),
this.offscreenCanvasContext = this.offscreenCanvas.getContext("2d")),
this.offscreenCanvas.width = e.width,
this.offscreenCanvas.height = e.height,
this.offscreenCanvasContext.drawImage(e, 0, 0, e.width, e.height);
const i = this.offscreenCanvasContext.getImageData(-t, -t, e.width + 2 * t, e.height + 2 * t);
return this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height),
i
}
}
var o = function e(t, i) {
var r, n = t && t.type;
if ("FeatureCollection" === n)
for (r = 0; r < t.features.length; r++)
e(t.features[r], i);
else if ("GeometryCollection" === n)
for (r = 0; r < t.geometries.length; r++)
e(t.geometries[r], i);
else if ("Feature" === n)
e(t.geometry, i);
else if ("Polygon" === n)
s(t.coordinates, i);
else if ("MultiPolygon" === n)
for (r = 0; r < t.coordinates.length; r++)
s(t.coordinates[r], i);
return t
};
function s(e, t) {
if (0 !== e.length) {
a(e[0], t);
for (var i = 1; i < e.length; i++)
a(e[i], !t)
}
}
function a(e, t) {
for (var i = 0, r = 0, n = 0, o = e.length, s = o - 1; n < o; s = n++) {
var a = (e[n][0] - e[s][0]) * (e[s][1] + e[n][1])
, l = i + a;
r += Math.abs(i) >= Math.abs(a) ? i - l + a : a - l + i,
i = l
}
i + r >= 0 != !!t && e.reverse()
}
const l = e.vectorTile.VectorTileFeature.prototype.toGeoJSON;
class c {
constructor(t) {
this._feature = t,
this.extent = e.EXTENT,
this.type = t.type,
this.properties = t.tags,
"id"in t && !isNaN(t.id) && (this.id = parseInt(t.id, 10))
}
loadGeometry() {
if (1 === this._feature.type) {
const t = [];
for (const i of this._feature.geometry)
t.push([new e.pointGeometry(i[0],i[1])]);
return t
}
{
const t = [];
for (const i of this._feature.geometry) {
const r = [];
for (const t of i)
r.push(new e.pointGeometry(t[0],t[1]));
t.push(r)
}
return t
}
}
toGeoJSON(e, t, i) {
return l.call(this, e, t, i)
}
}
class u {
constructor(t) {
this.layers = {
_geojsonTileLayer: this
},
this.name = "_geojsonTileLayer",
this.extent = e.EXTENT,
this.length = t.length,
this._features = t
}
feature(e) {
return new c(this._features[e])
}
}
var h = e.vectorTile.VectorTileFeature
, d = p;
function p(e, t) {
this.options = t || {},
this.features = e,
this.length = e.length
}
function f(e, t) {
this.id = "number" == typeof e.id ? e.id : void 0,
this.type = e.type,
this.rawGeometry = 1 === e.type ? [e.geometry] : e.geometry,
this.properties = e.tags,
this.extent = t || 4096
}
p.prototype.feature = function(e) {
return new f(this.features[e],this.options.extent)
}
,
f.prototype.loadGeometry = function() {
var t = this.rawGeometry;
this.geometry = [];
for (var i = 0; i < t.length; i++) {
for (var r = t[i], n = [], o = 0; o < r.length; o++)
n.push(new e.pointGeometry(r[o][0],r[o][1]));
this.geometry.push(n)
}
return this.geometry
}
,
f.prototype.bbox = function() {
this.geometry || this.loadGeometry();
for (var e = this.geometry, t = 1 / 0, i = -1 / 0, r = 1 / 0, n = -1 / 0, o = 0; o < e.length; o++)
for (var s = e[o], a = 0; a < s.length; a++) {
var l = s[a];
t = Math.min(t, l.x),
i = Math.max(i, l.x),
r = Math.min(r, l.y),
n = Math.max(n, l.y)
}
return [t, r, i, n]
}
,
f.prototype.toGeoJSON = h.prototype.toGeoJSON;
var m = g
, _ = d;
function g(t) {
var i = new e.pbf;
return function(e, t) {
for (var i in e.layers)
t.writeMessage(3, y, e.layers[i])
}(t, i),
i.finish()
}
function y(e, t) {
var i;
t.writeVarintField(15, e.version || 1),
t.writeStringField(1, e.name || ""),
t.writeVarintField(5, e.extent || 4096);
var r = {
keys: [],
values: [],
keycache: {},
valuecache: {}
};
for (i = 0; i < e.length; i++)
r.feature = e.feature(i),
t.writeMessage(2, x, r);
var n = r.keys;
for (i = 0; i < n.length; i++)
t.writeStringField(3, n[i]);
var o = r.values;
for (i = 0; i < o.length; i++)
t.writeMessage(4, E, o[i])
}
function x(e, t) {
var i = e.feature;
void 0 !== i.id && t.writeVarintField(1, i.id),
t.writeMessage(2, v, e),
t.writeVarintField(3, i.type),
t.writeMessage(4, T, i)
}
function v(e, t) {
var i = e.feature
, r = e.keys
, n = e.values
, o = e.keycache
, s = e.valuecache;
for (var a in i.properties) {
var l = i.properties[a]
, c = o[a];
if (null !== l) {
void 0 === c && (r.push(a),
o[a] = c = r.length - 1),
t.writeVarint(c);
var u = typeof l;
"string" !== u && "boolean" !== u && "number" !== u && (l = JSON.stringify(l));
var h = u + ":" + l
, d = s[h];
void 0 === d && (n.push(l),
s[h] = d = n.length - 1),
t.writeVarint(d)
}
}
}
function b(e, t) {
return (t << 3) + (7 & e)
}
function w(e) {
return e << 1 ^ e >> 31
}
function T(e, t) {
for (var i = e.loadGeometry(), r = e.type, n = 0, o = 0, s = i.length, a = 0; a < s; a++) {
var l = i[a]
, c = 1;
1 === r && (c = l.length),
t.writeVarint(b(1, c));
for (var u = 3 === r ? l.length - 1 : l.length, h = 0; h < u; h++) {
1 === h && 1 !== r && t.writeVarint(b(2, u - 1));
var d = l[h].x - n
, p = l[h].y - o;
t.writeVarint(w(d)),
t.writeVarint(w(p)),
n += d,
o += p
}
3 === r && t.writeVarint(b(7, 1))
}
}
function E(e, t) {
var i = typeof e;
"string" === i ? t.writeStringField(1, e) : "boolean" === i ? t.writeBooleanField(7, e) : "number" === i && (e % 1 != 0 ? t.writeDoubleField(3, e) : e < 0 ? t.writeSVarintField(6, e) : t.writeVarintField(5, e))
}
function S(e, t, i, r, n, o) {
if (n - r <= i)
return;
const s = r + n >> 1;
C(e, t, s, r, n, o % 2),
S(e, t, i, r, s - 1, o + 1),
S(e, t, i, s + 1, n, o + 1)
}
function C(e, t, i, r, n, o) {
for (; n > r; ) {
if (n - r > 600) {
const s = n - r + 1
, a = i - r + 1
, l = Math.log(s)
, c = .5 * Math.exp(2 * l / 3)
, u = .5 * Math.sqrt(l * c * (s - c) / s) * (a - s / 2 < 0 ? -1 : 1);
C(e, t, i, Math.max(r, Math.floor(i - a * c / s + u)), Math.min(n, Math.floor(i + (s - a) * c / s + u)), o)
}
const s = t[2 * i + o];
let a = r
, l = n;
for (M(e, t, r, i),
t[2 * n + o] > s && M(e, t, r, n); a < l; ) {
for (M(e, t, a, l),
a++,
l--; t[2 * a + o] < s; )
a++;
for (; t[2 * l + o] > s; )
l--
}
t[2 * r + o] === s ? M(e, t, r, l) : (l++,
M(e, t, l, n)),
l <= i && (r = l + 1),
i <= l && (n = l - 1)
}
}
function M(e, t, i, r) {
A(e, i, r),
A(t, 2 * i, 2 * r),
A(t, 2 * i + 1, 2 * r + 1)
}
function A(e, t, i) {
const r = e[t];
e[t] = e[i],
e[i] = r
}
function I(e, t, i, r) {
const n = e - i
, o = t - r;
return n * n + o * o
}
m.fromVectorTileJs = g,
m.fromGeojsonVt = function(e, t) {
t = t || {};
var i = {};
for (var r in e)
i[r] = new d(e[r].features,t),
i[r].name = r,
i[r].version = t.version,
i[r].extent = t.extent;
return g({
layers: i
})
}
,
m.GeoJSONWrapper = _;
const z = e=>e[0]
, k = e=>e[1];
class P {
constructor(e, t=z, i=k, r=64, n=Float64Array) {
this.nodeSize = r,
this.points = e;
const o = e.length < 65536 ? Uint16Array : Uint32Array
, s = this.ids = new o(e.length)
, a = this.coords = new n(2 * e.length);
for (let r = 0; r < e.length; r++)
s[r] = r,
a[2 * r] = t(e[r]),
a[2 * r + 1] = i(e[r]);
S(s, a, r, 0, s.length - 1, 0)
}
range(e, t, i, r) {
return function(e, t, i, r, n, o, s) {
const a = [0, e.length - 1, 0]
, l = [];
let c, u;
for (; a.length; ) {
const h = a.pop()
, d = a.pop()
, p = a.pop();
if (d - p <= s) {
for (let s = p; s <= d; s++)
c = t[2 * s],
u = t[2 * s + 1],
c >= i && c <= n && u >= r && u <= o && l.push(e[s]);
continue
}
const f = Math.floor((p + d) / 2);
c = t[2 * f],
u = t[2 * f + 1],
c >= i && c <= n && u >= r && u <= o && l.push(e[f]);
const m = (h + 1) % 2;
(0 === h ? i <= c : r <= u) && (a.push(p),
a.push(f - 1),
a.push(m)),
(0 === h ? n >= c : o >= u) && (a.push(f + 1),
a.push(d),
a.push(m))
}
return l
}(this.ids, this.coords, e, t, i, r, this.nodeSize)
}
within(e, t, i) {
return function(e, t, i, r, n, o) {
const s = [0, e.length - 1, 0]
, a = []
, l = n * n;
for (; s.length; ) {
const c = s.pop()
, u = s.pop()
, h = s.pop();
if (u - h <= o) {
for (let n = h; n <= u; n++)
I(t[2 * n], t[2 * n + 1], i, r) <= l && a.push(e[n]);
continue
}
const d = Math.floor((h + u) / 2)
, p = t[2 * d]
, f = t[2 * d + 1];
I(p, f, i, r) <= l && a.push(e[d]);
const m = (c + 1) % 2;
(0 === c ? i - n <= p : r - n <= f) && (s.push(h),
s.push(d - 1),
s.push(m)),
(0 === c ? i + n >= p : r + n >= f) && (s.push(d + 1),
s.push(u),
s.push(m))
}
return a
}(this.ids, this.coords, e, t, i, this.nodeSize)
}
}
const D = {
minZoom: 0,
maxZoom: 16,
minPoints: 2,
radius: 40,
extent: 512,
nodeSize: 64,
log: !1,
generateId: !1,
reduce: null,
map: e=>e
}
, L = Math.fround || (B = new Float32Array(1),
e=>(B[0] = +e,
B[0]));
var B;
class O {
constructor(e) {
this.options = $(Object.create(D), e),
this.trees = new Array(this.options.maxZoom + 1)
}
load(e) {
const {log: t, minZoom: i, maxZoom: r, nodeSize: n} = this.options;
t && console.time("total time");
const o = `prepare ${e.length} points`;
t && console.time(o),
this.points = e;
let s = [];
for (let t = 0; t < e.length; t++)
e[t].geometry && s.push(F(e[t], t));
this.trees[r + 1] = new P(s,q,Z,n,Float32Array),
t && console.timeEnd(o);
for (let e = r; e >= i; e--) {
const i = +Date.now();
s = this._cluster(s, e),
this.trees[e] = new P(s,q,Z,n,Float32Array),
t && console.log("z%d: %d clusters in %dms", e, s.length, +Date.now() - i)
}
return t && console.timeEnd("total time"),
this
}
getClusters(e, t) {
let i = ((e[0] + 180) % 360 + 360) % 360 - 180;
const r = Math.max(-90, Math.min(90, e[1]));
let n = 180 === e[2] ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180;
const o = Math.max(-90, Math.min(90, e[3]));
if (e[2] - e[0] >= 360)
i = -180,
n = 180;
else if (i > n) {
const e = this.getClusters([i, r, 180, o], t)
, s = this.getClusters([-180, r, n, o], t);
return e.concat(s)
}
const s = this.trees[this._limitZoom(t)]
, a = s.range(j(i), N(o), j(n), N(r))
, l = [];
for (const e of a) {
const t = s.points[e];
l.push(t.numPoints ? U(t) : this.points[t.index])
}
return l
}
getChildren(e) {
const t = this._getOriginId(e)
, i = this._getOriginZoom(e)
, r = "No cluster with the specified id."
, n = this.trees[i];
if (!n)
throw new Error(r);
const o = n.points[t];
if (!o)
throw new Error(r);
const s = this.options.radius / (this.options.extent * Math.pow(2, i - 1))
, a = n.within(o.x, o.y, s)
, l = [];
for (const t of a) {
const i = n.points[t];
i.parentId === e && l.push(i.numPoints ? U(i) : this.points[i.index])
}
if (0 === l.length)
throw new Error(r);
return l
}
getLeaves(e, t, i) {
const r = [];
return this._appendLeaves(r, e, t = t || 10, i = i || 0, 0),
r
}
getTile(e, t, i) {
const r = this.trees[this._limitZoom(e)]
, n = Math.pow(2, e)
, {extent: o, radius: s} = this.options
, a = s / o
, l = (i - a) / n
, c = (i + 1 + a) / n
, u = {
features: []
};
return this._addTileFeatures(r.range((t - a) / n, l, (t + 1 + a) / n, c), r.points, t, i, n, u),
0 === t && this._addTileFeatures(r.range(1 - a / n, l, 1, c), r.points, n, i, n, u),
t === n - 1 && this._addTileFeatures(r.range(0, l, a / n, c), r.points, -1, i, n, u),
u.features.length ? u : null
}
getClusterExpansionZoom(e) {
let t = this._getOriginZoom(e) - 1;
for (; t <= this.options.maxZoom; ) {
const i = this.getChildren(e);
if (t++,
1 !== i.length)
break;
e = i[0].properties.cluster_id
}
return t
}
_appendLeaves(e, t, i, r, n) {
const o = this.getChildren(t);
for (const t of o) {
const o = t.properties;
if (o && o.cluster ? n + o.point_count <= r ? n += o.point_count : n = this._appendLeaves(e, o.cluster_id, i, r, n) : n < r ? n++ : e.push(t),
e.length === i)
break
}
return n
}
_addTileFeatures(e, t, i, r, n, o) {
for (const s of e) {
const e = t[s]
, a = e.numPoints;
let l, c, u;
if (a)
l = V(e),
c = e.x,
u = e.y;
else {
const t = this.points[e.index];
l = t.properties,
c = j(t.geometry.coordinates[0]),
u = N(t.geometry.coordinates[1])
}
const h = {
type: 1,
geometry: [[Math.round(this.options.extent * (c * n - i)), Math.round(this.options.extent * (u * n - r))]],
tags: l
};
let d;
a ? d = e.id : this.options.generateId ? d = e.index : this.points[e.index].id && (d = this.points[e.index].id),
void 0 !== d && (h.id = d),
o.features.push(h)
}
}
_limitZoom(e) {
return Math.max(this.options.minZoom, Math.min(+e, this.options.maxZoom + 1))
}
_cluster(e, t) {
const i = []
, {radius: r, extent: n, reduce: o, minPoints: s} = this.options
, a = r / (n * Math.pow(2, t));
for (let r = 0; r < e.length; r++) {
const n = e[r];
if (n.zoom <= t)
continue;
n.zoom = t;
const l = this.trees[t + 1]
, c = l.within(n.x, n.y, a)
, u = n.numPoints || 1;
let h = u;
for (const e of c) {
const i = l.points[e];
i.zoom > t && (h += i.numPoints || 1)
}
if (h > u && h >= s) {
let e = n.x * u
, s = n.y * u
, a = o && u > 1 ? this._map(n, !0) : null;
const d = (r << 5) + (t + 1) + this.points.length;
for (const i of c) {
const r = l.points[i];
if (r.zoom <= t)
continue;
r.zoom = t;
const c = r.numPoints || 1;
e += r.x * c,
s += r.y * c,
r.parentId = d,
o && (a || (a = this._map(n, !0)),
o(a, this._map(r)))
}
n.parentId = d,
i.push(R(e / h, s / h, d, h, a))
} else if (i.push(n),
h > 1)
for (const e of c) {
const r = l.points[e];
r.zoom <= t || (r.zoom = t,
i.push(r))
}
}
return i
}
_getOriginId(e) {
return e - this.points.length >> 5
}
_getOriginZoom(e) {
return (e - this.points.length) % 32
}
_map(e, t) {
if (e.numPoints)
return t ? $({}, e.properties) : e.properties;
const i = this.points[e.index].properties
, r = this.options.map(i);
return t && r === i ? $({}, r) : r
}
}
function R(e, t, i, r, n) {
return {
x: L(e),
y: L(t),
zoom: 1 / 0,
id: i,
parentId: -1,
numPoints: r,
properties: n
}
}
function F(e, t) {
const [i,r] = e.geometry.coordinates;
return {
x: L(j(i)),
y: L(N(r)),
zoom: 1 / 0,
index: t,
parentId: -1
}
}
function U(e) {
return {
type: "Feature",
id: e.id,
properties: V(e),
geometry: {
type: "Point",
coordinates: [(t = e.x,
360 * (t - .5)), G(e.y)]
}
};
var t
}
function V(e) {
const t = e.numPoints
, i = t >= 1e4 ? `${Math.round(t / 1e3)}k` : t >= 1e3 ? Math.round(t / 100) / 10 + "k" : t;
return $($({}, e.properties), {
cluster: !0,
cluster_id: e.id,
point_count: t,
point_count_abbreviated: i
})
}
function j(e) {
return e / 360 + .5
}
function N(e) {
const t = Math.sin(e * Math.PI / 180)
, i = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI;
return i < 0 ? 0 : i > 1 ? 1 : i
}
function G(e) {
const t = (180 - 360 * e) * Math.PI / 180;
return 360 * Math.atan(Math.exp(t)) / Math.PI - 90
}
function $(e, t) {
for (const i in t)
e[i] = t[i];
return e
}
function q(e) {
return e.x
}
function Z(e) {
return e.y
}
function W(e, t, i, r) {
for (var n, o = r, s = i - t >> 1, a = i - t, l = e[t], c = e[t + 1], u = e[i], h = e[i + 1], d = t + 3; d < i; d += 3) {
var p = X(e[d], e[d + 1], l, c, u, h);
if (p > o)
n = d,
o = p;
else if (p === o) {
var f = Math.abs(d - s);
f < a && (n = d,
a = f)
}
}
o > r && (n - t > 3 && W(e, t, n, r),
e[n + 2] = o,
i - n > 3 && W(e, n, i, r))
}
function X(e, t, i, r, n, o) {
var s = n - i
, a = o - r;
if (0 !== s || 0 !== a) {
var l = ((e - i) * s + (t - r) * a) / (s * s + a * a);
l > 1 ? (i = n,
r = o) : l > 0 && (i += s * l,
r += a * l)
}
return (s = e - i) * s + (a = t - r) * a
}
function H(e, t, i, r) {
var n = {
id: void 0 === e ? null : e,
type: t,
geometry: i,
tags: r,
minX: 1 / 0,
minY: 1 / 0,
maxX: -1 / 0,
maxY: -1 / 0
};
return function(e) {
var t = e.geometry
, i = e.type;
if ("Point" === i || "MultiPoint" === i || "LineString" === i)
Y(e, t);
else if ("Polygon" === i || "MultiLineString" === i)
for (var r = 0; r < t.length; r++)
Y(e, t[r]);
else if ("MultiPolygon" === i)
for (r = 0; r < t.length; r++)
for (var n = 0; n < t[r].length; n++)
Y(e, t[r][n])
}(n),
n
}
function Y(e, t) {
for (var i = 0; i < t.length; i += 3)
e.minX = Math.min(e.minX, t[i]),
e.minY = Math.min(e.minY, t[i + 1]),
e.maxX = Math.max(e.maxX, t[i]),
e.maxY = Math.max(e.maxY, t[i + 1])
}
function K(e, t, i, r) {
if (t.geometry) {
var n = t.geometry.coordinates
, o = t.geometry.type
, s = Math.pow(i.tolerance / ((1 << i.maxZoom) * i.extent), 2)
, a = []
, l = t.id;
if (i.promoteId ? l = t.properties[i.promoteId] : i.generateId && (l = r || 0),
"Point" === o)
J(n, a);
else if ("MultiPoint" === o)
for (var c = 0; c < n.length; c++)
J(n[c], a);
else if ("LineString" === o)
Q(n, a, s, !1);
else if ("MultiLineString" === o) {
if (i.lineMetrics) {
for (c = 0; c < n.length; c++)
Q(n[c], a = [], s, !1),
e.push(H(l, "LineString", a, t.properties));
return
}
ee(n, a, s, !1)
} else if ("Polygon" === o)
ee(n, a, s, !0);
else {
if ("MultiPolygon" !== o) {
if ("GeometryCollection" === o) {
for (c = 0; c < t.geometry.geometries.length; c++)
K(e, {
id: l,
geometry: t.geometry.geometries[c],
properties: t.properties
}, i, r);
return
}
throw new Error("Input data is not a valid GeoJSON object.")
}
for (c = 0; c < n.length; c++) {
var u = [];
ee(n[c], u, s, !0),
a.push(u)
}
}
e.push(H(l, o, a, t.properties))
}
}
function J(e, t) {
t.push(te(e[0])),
t.push(ie(e[1])),
t.push(0)
}
function Q(e, t, i, r) {
for (var n, o, s = 0, a = 0; a < e.length; a++) {
var l = te(e[a][0])
, c = ie(e[a][1]);
t.push(l),
t.push(c),
t.push(0),
a > 0 && (s += r ? (n * c - l * o) / 2 : Math.sqrt(Math.pow(l - n, 2) + Math.pow(c - o, 2))),
n = l,
o = c
}
var u = t.length - 3;
t[2] = 1,
W(t, 0, u, i),
t[u + 2] = 1,
t.size = Math.abs(s),
t.start = 0,
t.end = t.size
}
function ee(e, t, i, r) {
for (var n = 0; n < e.length; n++) {
var o = [];
Q(e[n], o, i, r),
t.push(o)
}
}
function te(e) {
return e / 360 + .5
}
function ie(e) {
var t = Math.sin(e * Math.PI / 180)
, i = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI;
return i < 0 ? 0 : i > 1 ? 1 : i
}
function re(e, t, i, r, n, o, s, a) {
if (r /= t,
o >= (i /= t) && s < r)
return e;
if (s < i || o >= r)
return null;
for (var l = [], c = 0; c < e.length; c++) {
var u = e[c]
, h = u.geometry
, d = u.type
, p = 0 === n ? u.minX : u.minY
, f = 0 === n ? u.maxX : u.maxY;
if (p >= i && f < r)
l.push(u);
else if (!(f < i || p >= r)) {
var m = [];
if ("Point" === d || "MultiPoint" === d)
ne(h, m, i, r, n);
else if ("LineString" === d)
oe(h, m, i, r, n, !1, a.lineMetrics);
else if ("MultiLineString" === d)
ae(h, m, i, r, n, !1);
else if ("Polygon" === d)
ae(h, m, i, r, n, !0);
else if ("MultiPolygon" === d)
for (var _ = 0; _ < h.length; _++) {
var g = [];
ae(h[_], g, i, r, n, !0),
g.length && m.push(g)
}
if (m.length) {
if (a.lineMetrics && "LineString" === d) {
for (_ = 0; _ < m.length; _++)
l.push(H(u.id, d, m[_], u.tags));
continue
}
"LineString" !== d && "MultiLineString" !== d || (1 === m.length ? (d = "LineString",
m = m[0]) : d = "MultiLineString"),
"Point" !== d && "MultiPoint" !== d || (d = 3 === m.length ? "Point" : "MultiPoint"),
l.push(H(u.id, d, m, u.tags))
}
}
}
return l.length ? l : null
}
function ne(e, t, i, r, n) {
for (var o = 0; o < e.length; o += 3) {
var s = e[o + n];
s >= i && s <= r && (t.push(e[o]),
t.push(e[o + 1]),
t.push(e[o + 2]))
}
}
function oe(e, t, i, r, n, o, s) {
for (var a, l, c = se(e), u = 0 === n ? ce : ue, h = e.start, d = 0; d < e.length - 3; d += 3) {
var p = e[d]
, f = e[d + 1]
, m = e[d + 2]
, _ = e[d + 3]
, g = e[d + 4]
, y = 0 === n ? p : f
, x = 0 === n ? _ : g
, v = !1;
s && (a = Math.sqrt(Math.pow(p - _, 2) + Math.pow(f - g, 2))),
y < i ? x > i && (l = u(c, p, f, _, g, i),
s && (c.start = h + a * l)) : y > r ? x < r && (l = u(c, p, f, _, g, r),
s && (c.start = h + a * l)) : le(c, p, f, m),
x < i && y >= i && (l = u(c, p, f, _, g, i),
v = !0),
x > r && y <= r && (l = u(c, p, f, _, g, r),
v = !0),
!o && v && (s && (c.end = h + a * l),
t.push(c),
c = se(e)),
s && (h += a)
}
var b = e.length - 3;
p = e[b],
f = e[b + 1],
m = e[b + 2],
(y = 0 === n ? p : f) >= i && y <= r && le(c, p, f, m),
b = c.length - 3,
o && b >= 3 && (c[b] !== c[0] || c[b + 1] !== c[1]) && le(c, c[0], c[1], c[2]),
c.length && t.push(c)
}
function se(e) {
var t = [];
return t.size = e.size,
t.start = e.start,
t.end = e.end,
t
}
function ae(e, t, i, r, n, o) {
for (var s = 0; s < e.length; s++)
oe(e[s], t, i, r, n, o, !1)
}
function le(e, t, i, r) {
e.push(t),
e.push(i),
e.push(r)
}
function ce(e, t, i, r, n, o) {
var s = (o - t) / (r - t);
return e.push(o),
e.push(i + (n - i) * s),
e.push(1),
s
}
function ue(e, t, i, r, n, o) {
var s = (o - i) / (n - i);
return e.push(t + (r - t) * s),
e.push(o),
e.push(1),
s
}
function he(e, t) {
for (var i = [], r = 0; r < e.length; r++) {
var n, o = e[r], s = o.type;
if ("Point" === s || "MultiPoint" === s || "LineString" === s)
n = de(o.geometry, t);
else if ("MultiLineString" === s || "Polygon" === s) {
n = [];
for (var a = 0; a < o.geometry.length; a++)
n.push(de(o.geometry[a], t))
} else if ("MultiPolygon" === s)
for (n = [],
a = 0; a < o.geometry.length; a++) {
for (var l = [], c = 0; c < o.geometry[a].length; c++)
l.push(de(o.geometry[a][c], t));
n.push(l)
}
i.push(H(o.id, s, n, o.tags))
}
return i
}
function de(e, t) {
var i = [];
i.size = e.size,
void 0 !== e.start && (i.start = e.start,
i.end = e.end);
for (var r = 0; r < e.length; r += 3)
i.push(e[r] + t, e[r + 1], e[r + 2]);
return i
}
function pe(e, t) {
if (e.transformed)
return e;
var i, r, n, o = 1 << e.z, s = e.x, a = e.y;
for (i = 0; i < e.features.length; i++) {
var l = e.features[i]
, c = l.geometry
, u = l.type;
if (l.geometry = [],
1 === u)
for (r = 0; r < c.length; r += 2)
l.geometry.push(fe(c[r], c[r + 1], t, o, s, a));
else
for (r = 0; r < c.length; r++) {
var h = [];
for (n = 0; n < c[r].length; n += 2)
h.push(fe(c[r][n], c[r][n + 1], t, o, s, a));
l.geometry.push(h)
}
}
return e.transformed = !0,
e
}
function fe(e, t, i, r, n, o) {
return [Math.round(i * (e * r - n)), Math.round(i * (t * r - o))]
}
function me(e, t, i, r, n) {
for (var o = t === n.maxZoom ? 0 : n.tolerance / ((1 << t) * n.extent), s = {
features: [],
numPoints: 0,
numSimplified: 0,
numFeatures: 0,
source: null,
x: i,
y: r,
z: t,
transformed: !1,
minX: 2,
minY: 1,
maxX: -1,
maxY: 0
}, a = 0; a < e.length; a++) {
s.numFeatures++,
_e(s, e[a], o, n);
var l = e[a].minX
, c = e[a].minY
, u = e[a].maxX
, h = e[a].maxY;
l < s.minX && (s.minX = l),
c < s.minY && (s.minY = c),
u > s.maxX && (s.maxX = u),
h > s.maxY && (s.maxY = h)
}
return s
}
function _e(e, t, i, r) {
var n = t.geometry
, o = t.type
, s = [];
if ("Point" === o || "MultiPoint" === o)
for (var a = 0; a < n.length; a += 3)
s.push(n[a]),
s.push(n[a + 1]),
e.numPoints++,
e.numSimplified++;
else if ("LineString" === o)
ge(s, n, e, i, !1, !1);
else if ("MultiLineString" === o || "Polygon" === o)
for (a = 0; a < n.length; a++)
ge(s, n[a], e, i, "Polygon" === o, 0 === a);
else if ("MultiPolygon" === o)
for (var l = 0; l < n.length; l++) {
var c = n[l];
for (a = 0; a < c.length; a++)
ge(s, c[a], e, i, !0, 0 === a)
}
if (s.length) {
var u = t.tags || null;
if ("LineString" === o && r.lineMetrics) {
for (var h in u = {},
t.tags)
u[h] = t.tags[h];
u.mapbox_clip_start = n.start / n.size,
u.mapbox_clip_end = n.end / n.size
}
var d = {
geometry: s,
type: "Polygon" === o || "MultiPolygon" === o ? 3 : "LineString" === o || "MultiLineString" === o ? 2 : 1,
tags: u
};
null !== t.id && (d.id = t.id),
e.features.push(d)
}
}
function ge(e, t, i, r, n, o) {
var s = r * r;
if (r > 0 && t.size < (n ? s : r))
i.numPoints += t.length / 3;
else {
for (var a = [], l = 0; l < t.length; l += 3)
(0 === r || t[l + 2] > s) && (i.numSimplified++,
a.push(t[l]),
a.push(t[l + 1])),
i.numPoints++;
n && function(e, t) {
for (var i = 0, r = 0, n = e.length, o = n - 2; r < n; o = r,
r += 2)
i += (e[r] - e[o]) * (e[r + 1] + e[o + 1]);
if (i > 0 === t)
for (r = 0,
n = e.length; r < n / 2; r += 2) {
var s = e[r]
, a = e[r + 1];
e[r] = e[n - 2 - r],
e[r + 1] = e[n - 1 - r],
e[n - 2 - r] = s,
e[n - 1 - r] = a
}
}(a, o),
e.push(a)
}
}
function ye(e, t) {
var i = (t = this.options = function(e, t) {
for (var i in t)
e[i] = t[i];
return e
}(Object.create(this.options), t)).debug;
if (i && console.time("preprocess data"),
t.maxZoom < 0 || t.maxZoom > 24)
throw new Error("maxZoom should be in the 0-24 range");
if (t.promoteId && t.generateId)
throw new Error("promoteId and generateId cannot be used together.");
var r = function(e, t) {
var i = [];
if ("FeatureCollection" === e.type)
for (var r = 0; r < e.features.length; r++)
K(i, e.features[r], t, r);
else
K(i, "Feature" === e.type ? e : {
geometry: e
}, t);
return i
}(e, t);
this.tiles = {},
this.tileCoords = [],
i && (console.timeEnd("preprocess data"),
console.log("index: maxZoom: %d, maxPoints: %d", t.indexMaxZoom, t.indexMaxPoints),
console.time("generate tiles"),
this.stats = {},
this.total = 0),
(r = function(e, t) {
var i = t.buffer / t.extent
, r = e
, n = re(e, 1, -1 - i, i, 0, -1, 2, t)
, o = re(e, 1, 1 - i, 2 + i, 0, -1, 2, t);
return (n || o) && (r = re(e, 1, -i, 1 + i, 0, -1, 2, t) || [],
n && (r = he(n, 1).concat(r)),
o && (r = r.concat(he(o, -1)))),
r
}(r, t)).length && this.splitTile(r, 0, 0, 0),
i && (r.length && console.log("features: %d, points: %d", this.tiles[0].numFeatures, this.tiles[0].numPoints),
console.timeEnd("generate tiles"),
console.log("tiles generated:", this.total, JSON.stringify(this.stats)))
}
function xe(e, t, i) {
return 32 * ((1 << e) * i + t) + e
}
function ve(e, t) {
const i = e.tileID.canonical;
if (!this._geoJSONIndex)
return t(null, null);
const r = this._geoJSONIndex.getTile(i.z, i.x, i.y);
if (!r)
return t(null, null);
const n = new u(r.features);
let o = m(n);
0 === o.byteOffset && o.byteLength === o.buffer.byteLength || (o = new Uint8Array(o)),
t(null, {
vectorTile: n,
rawData: o.buffer
})
}
ye.prototype.options = {
maxZoom: 14,
indexMaxZoom: 5,
indexMaxPoints: 1e5,
tolerance: 3,
extent: 4096,
buffer: 64,
lineMetrics: !1,
promoteId: null,
generateId: !1,
debug: 0
},
ye.prototype.splitTile = function(e, t, i, r, n, o, s) {
for (var a = [e, t, i, r], l = this.options, c = l.debug; a.length; ) {
r = a.pop(),
i = a.pop(),
t = a.pop(),
e = a.pop();
var u = 1 << t
, h = xe(t, i, r)
, d = this.tiles[h];
if (!d && (c > 1 && console.time("creation"),
d = this.tiles[h] = me(e, t, i, r, l),
this.tileCoords.push({
z: t,
x: i,
y: r
}),
c)) {
c > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t, i, r, d.numFeatures, d.numPoints, d.numSimplified),
console.timeEnd("creation"));
var p = "z" + t;
this.stats[p] = (this.stats[p] || 0) + 1,
this.total++
}
if (d.source = e,
n) {
if (t === l.maxZoom || t === n)
continue;
var f = 1 << n - t;
if (i !== Math.floor(o / f) || r !== Math.floor(s / f))
continue
} else if (t === l.indexMaxZoom || d.numPoints <= l.indexMaxPoints)
continue;
if (d.source = null,
0 !== e.length) {
c > 1 && console.time("clipping");
var m, _, g, y, x, v, b = .5 * l.buffer / l.extent, w = .5 - b, T = .5 + b, E = 1 + b;
m = _ = g = y = null,
x = re(e, u, i - b, i + T, 0, d.minX, d.maxX, l),
v = re(e, u, i + w, i + E, 0, d.minX, d.maxX, l),
e = null,
x && (m = re(x, u, r - b, r + T, 1, d.minY, d.maxY, l),
_ = re(x, u, r + w, r + E, 1, d.minY, d.maxY, l),
x = null),
v && (g = re(v, u, r - b, r + T, 1, d.minY, d.maxY, l),
y = re(v, u, r + w, r + E, 1, d.minY, d.maxY, l),
v = null),
c > 1 && console.timeEnd("clipping"),
a.push(m || [], t + 1, 2 * i, 2 * r),
a.push(_ || [], t + 1, 2 * i, 2 * r + 1),
a.push(g || [], t + 1, 2 * i + 1, 2 * r),
a.push(y || [], t + 1, 2 * i + 1, 2 * r + 1)
}
}
}
,
ye.prototype.getTile = function(e, t, i) {
var r = this.options
, n = r.extent
, o = r.debug;
if (e < 0 || e > 24)
return null;
var s = 1 << e
, a = xe(e, t = (t % s + s) % s, i);
if (this.tiles[a])
return pe(this.tiles[a], n);
o > 1 && console.log("drilling down to z%d-%d-%d", e, t, i);
for (var l, c = e, u = t, h = i; !l && c > 0; )
c--,
u = Math.floor(u / 2),
h = Math.floor(h / 2),
l = this.tiles[xe(c, u, h)];
return l && l.source ? (o > 1 && console.log("found parent tile z%d-%d-%d", c, u, h),
o > 1 && console.time("drilling down"),
this.splitTile(l.source, c, u, h, e, t, i),
o > 1 && console.timeEnd("drilling down"),
this.tiles[a] ? pe(this.tiles[a], n) : null) : null
}
;
class be extends e.VectorTileWorkerSource {
constructor(e, t, i, r, n) {
super(e, t, i, r, ve),
n && (this.loadGeoJSON = n)
}
loadData(t, i) {
const r = t && t.request
, n = r && r.collectResourceTiming;
this.loadGeoJSON(t, ((s,a)=>{
if (s || !a)
return i(s);
if ("object" != typeof a)
return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));
{
o(a, !0);
try {
if (t.filter) {
const i = e.createExpression(t.filter, {
type: "boolean",
"property-type": "data-driven",
overridable: !1,
transition: !1
});
if ("error" === i.result)
throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));
const r = a.features.filter((e=>i.value.evaluate({
zoom: 0
}, e)));
a = {
type: "FeatureCollection",
features: r
}
}
this._geoJSONIndex = t.cluster ? new O(function({superclusterOptions: t, clusterProperties: i}) {
if (!i || !t)
return t;
const r = {}
, n = {}
, o = {
accumulated: null,
zoom: 0
}
, s = {
properties: null
}
, a = Object.keys(i);
for (const t of a) {
const [o,s] = i[t]
, a = e.createExpression(s)
, l = e.createExpression("string" == typeof o ? [o, ["accumulated"], ["get", t]] : o);
r[t] = a.value,
n[t] = l.value
}
return t.map = e=>{
s.properties = e;
const t = {};
for (const e of a)
t[e] = r[e].evaluate(o, s);
return t
}
,
t.reduce = (e,t)=>{
s.properties = t;
for (const t of a)
o.accumulated = e[t],
e[t] = n[t].evaluate(o, s)
}
,
t
}(t)).load(a.features) : function(e, t) {
return new ye(e,t)
}(a, t.geojsonVtOptions)
} catch (s) {
return i(s)
}
this.loaded = {};
const l = {};
if (n) {
const i = e.getPerformanceMeasurement(r);
i && (l.resourceTiming = {},
l.resourceTiming[t.source] = JSON.parse(JSON.stringify(i)))
}
i(null, l)
}
}
))
}
reloadTile(e, t) {
const i = this.loaded;
return i && i[e.uid] ? super.reloadTile(e, t) : this.loadTile(e, t)
}
loadGeoJSON(t, i) {
if (t.request)
e.getJSON(t.request, i);
else {
if ("string" != typeof t.data)
return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));
try {
return i(null, JSON.parse(t.data))
} catch (e) {
return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))
}
}
}
getClusterExpansionZoom(e, t) {
try {
t(null, this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))
} catch (e) {
t(e)
}
}
getClusterChildren(e, t) {
try {
t(null, this._geoJSONIndex.getChildren(e.clusterId))
} catch (e) {
t(e)
}
}
getClusterLeaves(e, t) {
try {
t(null, this._geoJSONIndex.getLeaves(e.clusterId, e.limit, e.offset))
} catch (e) {
t(e)
}
}
}
class we {
constructor(t) {
this.self = t,
this.actor = new e.Actor(t,this),
this.layerIndexes = {},
this.availableImages = {},
this.isSpriteLoaded = {},
this.projections = {},
this.defaultProjection = e.getProjection({
name: "mercator"
}),
this.workerSourceTypes = {
vector: e.VectorTileWorkerSource,
geojson: be
},
this.workerSources = {},
this.demWorkerSources = {},
this.self.registerWorkerSource = (e,t)=>{
if (this.workerSourceTypes[e])
throw new Error(`Worker source with name "${e}" already registered.`);
this.workerSourceTypes[e] = t
}
,
this.self.registerRTLTextPlugin = t=>{
if (e.plugin.isParsed())
throw new Error("RTL text plugin already registered.");
e.plugin.applyArabicShaping = t.applyArabicShaping,
e.plugin.processBidirectionalText = t.processBidirectionalText,
e.plugin.processStyledBidirectionalText = t.processStyledBidirectionalText
}
}
clearCaches(e, t, i) {
delete this.layerIndexes[e],
delete this.availableImages[e],
delete this.workerSources[e],
delete this.demWorkerSources[e],
i()
}
checkIfReady(e, t, i) {
i()
}
setReferrer(e, t) {
this.referrer = t
}
spriteLoaded(t, i) {
this.isSpriteLoaded[t] = i;
for (const r in this.workerSources[t]) {
const n = this.workerSources[t][r];
for (const t in n)
n[t]instanceof e.VectorTileWorkerSource && (n[t].isSpriteLoaded = i,
n[t].fire(new e.Event("isSpriteLoaded")))
}
}
setImages(e, t, i) {
this.availableImages[e] = t;
for (const i in this.workerSources[e]) {
const r = this.workerSources[e][i];
for (const e in r)
r[e].availableImages = t
}
i()
}
enableTerrain(e, t, i) {
this.terrain = t,
i()
}
setProjection(t, i) {
this.projections[t] = e.getProjection(i)
}
setLayers(e, t, i) {
this.getLayerIndex(e).replace(t),
i()
}
updateLayers(e, t, i) {
this.getLayerIndex(e).update(t.layers, t.removedIds),
i()
}
loadTile(t, i, r) {
const n = this.enableTerrain ? e.extend({
enableTerrain: this.terrain
}, i) : i;
n.projection = this.projections[t] || this.defaultProjection,
this.getWorkerSource(t, i.type, i.source).loadTile(n, r)
}
loadDEMTile(t, i, r) {
const n = this.enableTerrain ? e.extend({
buildQuadTree: this.terrain
}, i) : i;
this.getDEMWorkerSource(t, i.source).loadTile(n, r)
}
reloadTile(t, i, r) {
const n = this.enableTerrain ? e.extend({
enableTerrain: this.terrain
}, i) : i;
n.projection = this.projections[t] || this.defaultProjection,
this.getWorkerSource(t, i.type, i.source).reloadTile(n, r)
}
abortTile(e, t, i) {
this.getWorkerSource(e, t.type, t.source).abortTile(t, i)
}
removeTile(e, t, i) {
this.getWorkerSource(e, t.type, t.source).removeTile(t, i)
}
removeSource(e, t, i) {
if (!this.workerSources[e] || !this.workerSources[e][t.type] || !this.workerSources[e][t.type][t.source])
return;
const r = this.workerSources[e][t.type][t.source];
delete this.workerSources[e][t.type][t.source],
void 0 !== r.removeSource ? r.removeSource(t, i) : i()
}
loadWorkerSource(e, t, i) {
try {
this.self.importScripts(t.url),
i()
} catch (e) {
i(e.toString())
}
}
syncRTLPluginState(t, i, r) {
try {
e.plugin.setState(i);
const t = e.plugin.getPluginURL();
if (e.plugin.isLoaded() && !e.plugin.isParsed() && null != t) {
this.self.importScripts(t);
const i = e.plugin.isParsed();
r(i ? void 0 : new Error(`RTL Text Plugin failed to import scripts from ${t}`), i)
}
} catch (e) {
r(e.toString())
}
}
getAvailableImages(e) {
let t = this.availableImages[e];
return t || (t = []),
t
}
getLayerIndex(e) {
let t = this.layerIndexes[e];
return t || (t = this.layerIndexes[e] = new r),
t
}
getWorkerSource(e, t, i) {
return this.workerSources[e] || (this.workerSources[e] = {}),
this.workerSources[e][t] || (this.workerSources[e][t] = {}),
this.workerSources[e][t][i] || (this.workerSources[e][t][i] = new this.workerSourceTypes[t]({
send: (t,i,r,n,o,s)=>{
this.actor.send(t, i, r, e, o, s)
}
,
scheduler: this.actor.scheduler
},this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])),
this.workerSources[e][t][i]
}
getDEMWorkerSource(e, t) {
return this.demWorkerSources[e] || (this.demWorkerSources[e] = {}),
this.demWorkerSources[e][t] || (this.demWorkerSources[e][t] = new n),
this.demWorkerSources[e][t]
}
enforceCacheSizeLimit(t, i) {
e.enforceCacheSizeLimit(i)
}
getWorkerPerformanceMetrics(e, t, i) {
i(void 0, void 0)
}
}
return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope && (self.worker = new we(self)),
we
}
)),
n(["./shared"], (function(e) {
function t(e, i) {
if (Array.isArray(e)) {
if (!Array.isArray(i) || e.length !== i.length)
return !1;
for (let r = 0; r < e.length; r++)
if (!t(e[r], i[r]))
return !1;
return !0
}
if ("object" == typeof e && null !== e && null !== i) {
if ("object" != typeof i)
return !1;
if (Object.keys(e).length !== Object.keys(i).length)
return !1;
for (const r in e)
if (!t(e[r], i[r]))
return !1;
return !0
}
return e === i
}
var i = r;
function r(e) {
return !function(e) {
return "undefined" == typeof window || "undefined" == typeof document ? "not a browser" : Array.prototype && Array.prototype.every && Array.prototype.filter && Array.prototype.forEach && Array.prototype.indexOf && Array.prototype.lastIndexOf && Array.prototype.map && Array.prototype.some && Array.prototype.reduce && Array.prototype.reduceRight && Array.isArray ? Function.prototype && Function.prototype.bind ? Object.keys && Object.create && Object.getPrototypeOf && Object.getOwnPropertyNames && Object.isSealed && Object.isFrozen && Object.isExtensible && Object.getOwnPropertyDescriptor && Object.defineProperty && Object.defineProperties && Object.seal && Object.freeze && Object.preventExtensions ? "JSON"in window && "parse"in JSON && "stringify"in JSON ? function() {
if (!("Worker"in window && "Blob"in window && "URL"in window))
return !1;
var e, t, i = new Blob([""],{
type: "text/javascript"
}), r = URL.createObjectURL(i);
try {
t = new Worker(r),
e = !0
} catch (t) {
e = !1
}
return t && t.terminate(),
URL.revokeObjectURL(r),
e
}() ? "Uint8ClampedArray"in window ? ArrayBuffer.isView ? function() {
var e = document.createElement("canvas");
e.width = e.height = 1;
var t = e.getContext("2d");
if (!t)
return !1;
var i = t.getImageData(0, 0, 1, 1);
return i && i.width === e.width
}() ? (void 0 === n[t = e && e.failIfMajorPerformanceCaveat] && (n[t] = function(e) {
var t, i = function(e) {
var t = document.createElement("canvas")
, i = Object.create(r.webGLContextAttributes);
return i.failIfMajorPerformanceCaveat = e,
t.getContext("webgl", i) || t.getContext("experimental-webgl", i)
}(e);
if (!i)
return !1;
try {
t = i.createShader(i.VERTEX_SHADER)
} catch (e) {
return !1
}
return !(!t || i.isContextLost()) && (i.shaderSource(t, "void main() {}"),
i.compileShader(t),
!0 === i.getShaderParameter(t, i.COMPILE_STATUS))
}(t)),
n[t] ? document.documentMode ? "insufficient ECMAScript 6 support" : void 0 : "insufficient WebGL support") : "insufficient Canvas/getImageData support" : "insufficient ArrayBuffer support" : "insufficient Uint8ClampedArray support" : "insufficient worker support" : "insufficient JSON support" : "insufficient Object support" : "insufficient Function support" : "insufficent Array support";
var t
}(e)
}
var n = {};
function o(t, i, r) {
const n = e.window.document.createElement(t);
return void 0 !== i && (n.className = i),
r && r.appendChild(n),
n
}
function s(t, i, r) {
const n = e.window.document.createElementNS("http://www.w3.org/2000/svg", t);
for (const e of Object.keys(i))
n.setAttributeNS(null, e, i[e]);
return r && r.appendChild(n),
n
}
r.webGLContextAttributes = {
antialias: !1,
alpha: !0,
stencil: !0,
depth: !0
};
const a = e.window.document && e.window.document.documentElement.style
, l = a && void 0 !== a.userSelect ? "userSelect" : "WebkitUserSelect";
let c;
function u() {
a && l && (c = a[l],
a[l] = "none")
}
function h() {
a && l && (a[l] = c)
}
function d(t) {
t.preventDefault(),
t.stopPropagation(),
e.window.removeEventListener("click", d, !0)
}
function p() {
e.window.addEventListener("click", d, !0),
e.window.setTimeout((()=>{
e.window.removeEventListener("click", d, !0)
}
), 0)
}
function f(e, t) {
const i = e.getBoundingClientRect();
return g(e, i, t)
}
function m(e, t) {
const i = e.getBoundingClientRect()
, r = [];
for (let n = 0; n < t.length; n++)
r.push(g(e, i, t[n]));
return r
}
function _(t) {
return void 0 !== e.window.InstallTrigger && 2 === t.button && t.ctrlKey && e.window.navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? 0 : t.button
}
function g(t, i, r) {
const n = t.offsetWidth === i.width ? 1 : t.offsetWidth / i.width;
return new e.pointGeometry((r.clientX - i.left) * n,(r.clientY - i.top) * n)
}
function y(e, t) {
var i = t[0]
, r = t[1]
, n = t[2]
, o = t[3]
, s = i * o - n * r;
return s ? (e[0] = o * (s = 1 / s),
e[1] = -r * s,
e[2] = -n * s,
e[3] = i * s,
e) : null
}
function x(e) {
const {userImage: t} = e;
return !!(t && t.render && t.render()) && (e.data.replace(new Uint8Array(t.data.buffer)),
!0)
}
class v extends e.Evented {
constructor() {
super(),
this.images = {},
this.updatedImages = {},
this.callbackDispatchedThisFrame = {},
this.loaded = !1,
this.requestors = [],
this.patterns = {},
this.atlasImage = new e.RGBAImage({
width: 1,
height: 1
}),
this.dirty = !0
}
isLoaded() {
return this.loaded
}
setLoaded(e) {
if (this.loaded !== e && (this.loaded = e,
e)) {
for (const {ids: e, callback: t} of this.requestors)
this._notify(e, t);
this.requestors = []
}
}
hasImage(e) {
return !!this.getImage(e)
}
getImage(e) {
return this.images[e]
}
addImage(e, t) {
this._validate(e, t) && (this.images[e] = t)
}
_validate(t, i) {
let r = !0;
return this._validateStretch(i.stretchX, i.data && i.data.width) || (this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),
r = !1),
this._validateStretch(i.stretchY, i.data && i.data.height) || (this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),
r = !1),
this._validateContent(i.content, i) || (this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),
r = !1),
r
}
_validateStretch(e, t) {
if (!e)
return !0;
let i = 0;
for (const r of e) {
if (r[0] < i || r[1] < r[0] || t < r[1])
return !1;
i = r[1]
}
return !0
}
_validateContent(e, t) {
return !(e && (4 !== e.length || e[0] < 0 || t.data.width < e[0] || e[1] < 0 || t.data.height < e[1] || e[2] < 0 || t.data.width < e[2] || e[3] < 0 || t.data.height < e[3] || e[2] < e[0] || e[3] < e[1]))
}
updateImage(e, t) {
t.version = this.images[e].version + 1,
this.images[e] = t,
this.updatedImages[e] = !0
}
removeImage(e) {
const t = this.images[e];
delete this.images[e],
delete this.patterns[e],
t.userImage && t.userImage.onRemove && t.userImage.onRemove()
}
listImages() {
return Object.keys(this.images)
}
getImages(e, t) {
let i = !0;
if (!this.isLoaded())
for (const t of e)
this.images[t] || (i = !1);
this.isLoaded() || i ? this._notify(e, t) : this.requestors.push({
ids: e,
callback: t
})
}
_notify(t, i) {
const r = {};
for (const i of t) {
this.images[i] || this.fire(new e.Event("styleimagemissing",{
id: i
}));
const t = this.images[i];
t ? r[i] = {
data: t.data.clone(),
pixelRatio: t.pixelRatio,
sdf: t.sdf,
version: t.version,
stretchX: t.stretchX,
stretchY: t.stretchY,
content: t.content,
hasRenderCallback: Boolean(t.userImage && t.userImage.render)
} : e.warnOnce(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)
}
i(null, r)
}
getPixelSize() {
const {width: e, height: t} = this.atlasImage;
return {
width: e,
height: t
}
}
getPattern(t) {
const i = this.patterns[t]
, r = this.getImage(t);
if (!r)
return null;
if (i && i.position.version === r.version)
return i.position;
if (i)
i.position.version = r.version;
else {
const i = {
w: r.data.width + 2,
h: r.data.height + 2,
x: 0,
y: 0
}
, n = new e.ImagePosition(i,r);
this.patterns[t] = {
bin: i,
position: n
}
}
return this._updatePatternAtlas(),
this.patterns[t].position
}
bind(t) {
const i = t.gl;
this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage),
this.dirty = !1) : this.atlasTexture = new e.Texture(t,this.atlasImage,i.RGBA),
this.atlasTexture.bind(i.LINEAR, i.CLAMP_TO_EDGE)
}
_updatePatternAtlas() {
const t = [];
for (const e in this.patterns)
t.push(this.patterns[e].bin);
const {w: i, h: r} = e.potpack(t)
, n = this.atlasImage;
n.resize({
width: i || 1,
height: r || 1
});
for (const t in this.patterns) {
const {bin: i} = this.patterns[t]
, r = i.x + 1
, o = i.y + 1
, s = this.images[t].data
, a = s.width
, l = s.height;
e.RGBAImage.copy(s, n, {
x: 0,
y: 0
}, {
x: r,
y: o
}, {
width: a,
height: l
}),
e.RGBAImage.copy(s, n, {
x: 0,
y: l - 1
}, {
x: r,
y: o - 1
}, {
width: a,
height: 1
}),
e.RGBAImage.copy(s, n, {
x: 0,
y: 0
}, {
x: r,
y: o + l
}, {
width: a,
height: 1
}),
e.RGBAImage.copy(s, n, {
x: a - 1,
y: 0
}, {
x: r - 1,
y: o
}, {
width: 1,
height: l
}),
e.RGBAImage.copy(s, n, {
x: 0,
y: 0
}, {
x: r + a,
y: o
}, {
width: 1,
height: l
})
}
this.dirty = !0
}
beginFrame() {
this.callbackDispatchedThisFrame = {}
}
dispatchRenderCallbacks(e) {
for (const t of e) {
if (this.callbackDispatchedThisFrame[t])
continue;
this.callbackDispatchedThisFrame[t] = !0;
const e = this.images[t];
x(e) && this.updateImage(t, e)
}
}
}
const b = new e.Properties({
anchor: new e.DataConstantProperty(e.spec.light.anchor),
position: new class {
constructor() {
this.specification = e.spec.light.position
}
possiblyEvaluate(t, i) {
return function([t,i,r]) {
const n = e.degToRad(i + 90)
, o = e.degToRad(r);
return {
x: t * Math.cos(n) * Math.sin(o),
y: t * Math.sin(n) * Math.sin(o),
z: t * Math.cos(o),
azimuthal: i,
polar: r
}
}(t.expression.evaluate(i))
}
interpolate(t, i, r) {
return {
x: e.number(t.x, i.x, r),
y: e.number(t.y, i.y, r),
z: e.number(t.z, i.z, r),
azimuthal: e.number(t.azimuthal, i.azimuthal, r),
polar: e.number(t.polar, i.polar, r)
}
}
}
,
color: new e.DataConstantProperty(e.spec.light.color),
intensity: new e.DataConstantProperty(e.spec.light.intensity)
})
, w = "-transition";
class T extends e.Evented {
constructor(t) {
super(),
this._transitionable = new e.Transitionable(b),
this.setLight(t),
this._transitioning = this._transitionable.untransitioned()
}
getLight() {
return this._transitionable.serialize()
}
setLight(t, i={}) {
if (!this._validate(e.validateLight, t, i))
for (const i in t) {
const r = t[i];
e.endsWith(i, w) ? this._transitionable.setTransition(i.slice(0, -w.length), r) : this._transitionable.setValue(i, r)
}
}
updateTransitions(e) {
this._transitioning = this._transitionable.transitioned(e, this._transitioning)
}
hasTransition() {
return this._transitioning.hasTransition()
}
recalculate(e) {
this.properties = this._transitioning.possiblyEvaluate(e)
}
_validate(t, i, r) {
return (!r || !1 !== r.validate) && e.emitValidationErrors(this, t.call(e.validateStyle, e.extend({
value: i,
style: {
glyphs: !0,
sprite: !0
},
styleSpec: e.spec
})))
}
}
const E = new e.Properties({
source: new e.DataConstantProperty(e.spec.terrain.source),
exaggeration: new e.DataConstantProperty(e.spec.terrain.exaggeration)
})
, S = "-transition";
class C extends e.Evented {
constructor(t, i) {
super(),
this._transitionable = new e.Transitionable(E),
this.set(t),
this._transitioning = this._transitionable.untransitioned(),
this.drapeRenderMode = i
}
get() {
return this._transitionable.serialize()
}
set(t) {
for (const i in t) {
const r = t[i];
e.endsWith(i, S) ? this._transitionable.setTransition(i.slice(0, -S.length), r) : this._transitionable.setValue(i, r)
}
}
updateTransitions(e) {
this._transitioning = this._transitionable.transitioned(e, this._transitioning)
}
hasTransition() {
return this._transitioning.hasTransition()
}
recalculate(e) {
this.properties = this._transitioning.possiblyEvaluate(e)
}
}
function M(t, i, r, n) {
const o = e.smoothstep(45, 65, r)
, [s,a] = A(t, n)
, l = e.length(i);
let c = 1 - Math.min(1, Math.exp((l - s) / (a - s) * -6));
return c *= c * c,
c = Math.min(1, 1.00747 * c),
c * o * t.alpha
}
function A(e, t) {
const i = .5 / Math.tan(.5 * t);
return [e.range[0] + i, e.range[1] + i]
}
const I = new e.Properties({
range: new e.DataConstantProperty(e.spec.fog.range),
color: new e.DataConstantProperty(e.spec.fog.color),
"high-color": new e.DataConstantProperty(e.spec.fog["high-color"]),
"space-color": new e.DataConstantProperty(e.spec.fog["space-color"]),
"horizon-blend": new e.DataConstantProperty(e.spec.fog["horizon-blend"]),
"star-intensity": new e.DataConstantProperty(e.spec.fog["star-intensity"])
})
, z = "-transition";
class k extends e.Evented {
constructor(t, i) {
super(),
this._transitionable = new e.Transitionable(I),
this.set(t),
this._transitioning = this._transitionable.untransitioned(),
this._transform = i
}
get state() {
const t = this._transform
, i = "globe" === t.projection.name
, r = e.globeToMercatorTransition(t.zoom)
, n = this.properties.get("range")
, o = [.5, 3];
return {
range: i ? [e.number(o[0], n[0], r), e.number(o[1], n[1], r)] : n,
horizonBlend: this.properties.get("horizon-blend"),
alpha: this.properties.get("color").a
}
}
get() {
return this._transitionable.serialize()
}
set(t, i={}) {
if (!this._validate(e.validateFog, t, i)) {
for (const i of Object.keys(e.spec.fog))
t && void 0 === t[i] && (t[i] = e.spec.fog[i].default);
for (const i in t) {
const r = t[i];
e.endsWith(i, z) ? this._transitionable.setTransition(i.slice(0, -z.length), r) : this._transitionable.setValue(i, r)
}
}
}
getOpacity(t) {
if (!this._transform.projection.supportsFog)
return 0;
const i = this.properties && this.properties.get("color") || 1;
return ("globe" === this._transform.projection.name ? 1 : e.smoothstep(45, 65, t)) * i.a
}
getOpacityAtLatLng(t, i) {
return this._transform.projection.supportsFog ? function(t, i, r) {
const n = e.MercatorCoordinate.fromLngLat(i)
, o = r.elevation ? r.elevation.getAtPointOrZero(n) : 0
, s = [n.x, n.y, o];
return e.transformMat4(s, s, r.mercatorFogMatrix),
M(t, s, r.pitch, r._fov)
}(this.state, t, i) : 0
}
getFovAdjustedRange(e) {
return this._transform.projection.supportsFog ? A(this.state, e) : [0, 1]
}
updateTransitions(e) {
this._transitioning = this._transitionable.transitioned(e, this._transitioning)
}
hasTransition() {
return this._transitioning.hasTransition()
}
recalculate(e) {
this.properties = this._transitioning.possiblyEvaluate(e)
}
_validate(t, i, r) {
return (!r || !1 !== r.validate) && e.emitValidationErrors(this, t.call(e.validateStyle, e.extend({
value: i,
style: {
glyphs: !0,
sprite: !0
},
styleSpec: e.spec
})))
}
}
class P {
constructor(t, i) {
this.workerPool = t,
this.actors = [],
this.currentActor = 0,
this.id = e.uniqueId();
const r = this.workerPool.acquire(this.id);
for (let e = 0; e < r.length; e++) {
const t = new P.Actor(r[e],i,this.id);
t.name = `Worker ${e}`,
this.actors.push(t)
}
this.ready = !1,
this.broadcast("checkIfReady", null, (()=>{
this.ready = !0
}
))
}
broadcast(t, i, r) {
e.asyncAll(this.actors, ((e,r)=>{
e.send(t, i, r)
}
), r = r || function() {}
)
}
getActor() {
return this.currentActor = (this.currentActor + 1) % this.actors.length,
this.actors[this.currentActor]
}
remove() {
this.actors.forEach((e=>{
e.remove()
}
)),
this.actors = [],
this.workerPool.release(this.id)
}
}
function D(t, i, r) {
return i * (e.EXTENT / (t.tileSize * Math.pow(2, r - t.tileID.overscaledZ)))
}
P.Actor = e.Actor;
class L {
constructor(e, t, i, r) {
this.screenBounds = e,
this.cameraPoint = t,
this._screenRaycastCache = {},
this._cameraRaycastCache = {},
this.isAboveHorizon = i,
this.screenGeometry = this.bufferedScreenGeometry(0),
this.screenGeometryMercator = this._bufferedScreenMercator(0, r)
}
static createFromScreenPoints(t, i) {
let r, n;
if (t instanceof e.pointGeometry || "number" == typeof t[0]) {
const o = e.pointGeometry.convert(t);
r = [e.pointGeometry.convert(t)],
n = i.isPointAboveHorizon(o)
} else {
const o = e.pointGeometry.convert(t[0])
, s = e.pointGeometry.convert(t[1]);
r = [o, s],
n = e.polygonizeBounds(o, s).every((e=>i.isPointAboveHorizon(e)))
}
return new L(r,i.getCameraPoint(),n,i)
}
isPointQuery() {
return 1 === this.screenBounds.length
}
bufferedScreenGeometry(t) {
return e.polygonizeBounds(this.screenBounds[0], 1 === this.screenBounds.length ? this.screenBounds[0] : this.screenBounds[1], t)
}
bufferedCameraGeometry(t) {
const i = this.screenBounds[0]
, r = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e.pointGeometry(1,1)) : this.screenBounds[1]
, n = e.polygonizeBounds(i, r, 0, !1);
return this.cameraPoint.y > r.y && (this.cameraPoint.x > i.x && this.cameraPoint.x < r.x ? n.splice(3, 0, this.cameraPoint) : this.cameraPoint.x >= r.x ? n[2] = this.cameraPoint : this.cameraPoint.x <= i.x && (n[3] = this.cameraPoint)),
e.bufferConvexPolygon(n, t)
}
bufferedCameraGeometryGlobe(t) {
const i = this.screenBounds[0]
, r = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e.pointGeometry(1,1)) : this.screenBounds[1]
, n = e.polygonizeBounds(i, r, t)
, o = this.cameraPoint.clone();
switch (3 * ((o.y > i.y) + (o.y > r.y)) + ((o.x > i.x) + (o.x > r.x))) {
case 0:
n[0] = o,
n[4] = o.clone();
break;
case 1:
n.splice(1, 0, o);
break;
case 2:
n[1] = o;
break;
case 3:
n.splice(4, 0, o);
break;
case 5:
n.splice(2, 0, o);
break;
case 6:
n[3] = o;
break;
case 7:
n.splice(3, 0, o);
break;
case 8:
n[2] = o
}
return n
}
containsTile(t, i, r, n=0) {
const o = t.queryPadding / i._pixelsPerMercatorPixel + 1
, s = r ? this._bufferedCameraMercator(o, i) : this._bufferedScreenMercator(o, i);
let a = t.tileID.wrap + (s.unwrapped ? n : 0);
const l = s.polygon.map((i=>e.getTilePoint(t.tileTransform, i, a)));
if (!e.polygonIntersectsBox(l, 0, 0, e.EXTENT, e.EXTENT))
return;
a = t.tileID.wrap + (this.screenGeometryMercator.unwrapped ? n : 0);
const c = this.screenGeometryMercator.polygon.map((i=>e.getTileVec3(t.tileTransform, i, a)))
, u = c.map((t=>new e.pointGeometry(t[0],t[1])))
, h = i.getFreeCameraOptions().position || new e.MercatorCoordinate(0,0,0)
, d = e.getTileVec3(t.tileTransform, h, a)
, p = c.map((t=>{
const i = e.sub(t, t, d);
return e.normalize(i, i),
new e.Ray(d,i)
}
))
, f = D(t, 1, i.zoom) * i._pixelsPerMercatorPixel;
return {
queryGeometry: this,
tilespaceGeometry: u,
tilespaceRays: p,
bufferedTilespaceGeometry: l,
bufferedTilespaceBounds: (m = e.getBounds(l),
m.min.x = e.clamp(m.min.x, 0, e.EXTENT),
m.min.y = e.clamp(m.min.y, 0, e.EXTENT),
m.max.x = e.clamp(m.max.x, 0, e.EXTENT),
m.max.y = e.clamp(m.max.y, 0, e.EXTENT),
m),
tile: t,
tileID: t.tileID,
pixelToTileUnitsFactor: f
};
var m
}
_bufferedScreenMercator(e, t) {
const i = R(e);
if (this._screenRaycastCache[i])
return this._screenRaycastCache[i];
{
let r;
return r = "globe" === t.projection.name ? this._projectAndResample(this.bufferedScreenGeometry(e), t) : {
polygon: this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),
unwrapped: !0
},
this._screenRaycastCache[i] = r,
r
}
}
_bufferedCameraMercator(e, t) {
const i = R(e);
if (this._cameraRaycastCache[i])
return this._cameraRaycastCache[i];
{
let r;
return r = "globe" === t.projection.name ? this._projectAndResample(this.bufferedCameraGeometryGlobe(e), t) : {
polygon: this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),
unwrapped: !0
},
this._cameraRaycastCache[i] = r,
r
}
}
_projectAndResample(t, i) {
const r = function(t, i) {
const r = e.multiply([], i.pixelMatrix, i.globeMatrix)
, n = [0, -e.GLOBE_RADIUS, 0, 1]
, o = [0, e.GLOBE_RADIUS, 0, 1]
, s = [0, 0, 0, 1];
e.transformMat4$1(n, n, r),
e.transformMat4$1(o, o, r),
e.transformMat4$1(s, s, r);
const a = new e.pointGeometry(n[0] / n[3],n[1] / n[3])
, l = new e.pointGeometry(o[0] / o[3],o[1] / o[3])
, c = e.polygonContainsPoint(t, a) && n[3] < s[3]
, u = e.polygonContainsPoint(t, l) && o[3] < s[3];
if (!c && !u)
return null;
const h = function(e, t, i) {
for (let r = 1; r < e.length; r++) {
const n = O(t.pointCoordinate3D(e[r - 1]).x)
, o = O(t.pointCoordinate3D(e[r]).x);
if (i < 0) {
if (n < o)
return {
idx: r,
t: -n / (o - 1 - n)
}
} else if (o < n)
return {
idx: r,
t: (1 - n) / (o + 1 - n)
}
}
return null
}(t, i, c ? -1 : 1);
if (!h)
return null;
const {idx: d, t: p} = h;
let f = d > 1 ? B(t.slice(0, d), i) : []
, m = d < t.length ? B(t.slice(d), i) : [];
f = f.map((t=>new e.pointGeometry(O(t.x),t.y))),
m = m.map((t=>new e.pointGeometry(O(t.x),t.y)));
const _ = [...f];
0 === _.length && _.push(m[m.length - 1]);
const g = e.number(_[_.length - 1].y, (0 === m.length ? f[0] : m[0]).y, p);
let y;
return y = c ? [new e.pointGeometry(0,g), new e.pointGeometry(0,0), new e.pointGeometry(1,0), new e.pointGeometry(1,g)] : [new e.pointGeometry(1,g), new e.pointGeometry(1,1), new e.pointGeometry(0,1), new e.pointGeometry(0,g)],
_.push(...y),
0 === m.length ? _.push(f[0]) : _.push(...m),
{
polygon: _.map((t=>new e.MercatorCoordinate(t.x,t.y))),
unwrapped: !1
}
}(t, i);
if (r)
return r;
const n = function(t, i) {
let r = !1
, n = -1 / 0
, o = 0;
for (let e = 0; e < t.length - 1; e++)
t[e].x > n && (n = t[e].x,
o = e);
for (let e = 0; e < t.length - 1; e++) {
const i = (o + e) % (t.length - 1)
, n = t[i]
, s = t[i + 1];
Math.abs(n.x - s.x) > .5 && (n.x < s.x ? (n.x += 1,
0 === i && (t[t.length - 1].x += 1)) : (s.x += 1,
i + 1 === t.length - 1 && (t[0].x += 1)),
r = !0)
}
const s = e.mercatorXfromLng(i.center.lng);
return r && s < Math.abs(s - 1) && t.forEach((e=>{
e.x -= 1
}
)),
{
polygon: t,
unwrapped: r
}
}(B(t, i).map((t=>new e.pointGeometry(O(t.x),t.y))), i);
return {
polygon: n.polygon.map((t=>new e.MercatorCoordinate(t.x,t.y))),
unwrapped: n.unwrapped
}
}
}
function B(t, i) {
return e.resample(t, (e=>{
const t = i.pointCoordinate3D(e);
e.x = t.x,
e.y = t.y
}
), 1 / 256)
}
function O(e) {
return e < 0 ? 1 + e % 1 : e % 1
}
function R(e) {
return 100 * e | 0
}
function F(t, i, r, n, o) {
const s = function(r, n) {
if (r)
return o(r);
if (n) {
const r = e.pick(e.extend(n, t), ["tiles", "minzoom", "maxzoom", "attribution", "mapbox_logo", "bounds", "scheme", "tileSize", "encoding"]);
n.vector_layers && (r.vectorLayers = n.vector_layers,
r.vectorLayerIds = r.vectorLayers.map((e=>e.id))),
n.language_options && (r.languageOptions = n.language_options),
n.language && n.language[n.id] && (r.language = n.language[n.id]),
n.worldview_options && (r.worldviewOptions = n.worldview_options),
n.worldview ? r.worldview = n.worldview[n.id] : n.worldview_default && (r.worldview = n.worldview_default),
r.tiles = i.canonicalizeTileset(r, t.url),
o(null, r)
}
};
return t.url ? e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url, null, r, n), e.ResourceType.Source), s) : e.exported.frame((()=>s(null, t)))
}
class U {
constructor(t, i, r) {
this.bounds = e.LngLatBounds.convert(this.validateBounds(t)),
this.minzoom = i || 0,
this.maxzoom = r || 24
}
validateBounds(e) {
return Array.isArray(e) && 4 === e.length ? [Math.max(-180, e[0]), Math.max(-90, e[1]), Math.min(180, e[2]), Math.min(90, e[3])] : [-180, -90, 180, 90]
}
contains(t) {
const i = Math.pow(2, t.z)
, r = Math.floor(e.mercatorXfromLng(this.bounds.getWest()) * i)
, n = Math.floor(e.mercatorYfromLat(this.bounds.getNorth()) * i)
, o = Math.ceil(e.mercatorXfromLng(this.bounds.getEast()) * i)
, s = Math.ceil(e.mercatorYfromLat(this.bounds.getSouth()) * i);
return t.x >= r && t.x < o && t.y >= n && t.y < s
}
}
class V {
constructor(e, t, i) {
this.context = e;
const r = e.gl;
this.buffer = r.createBuffer(),
this.dynamicDraw = Boolean(i),
this.context.unbindVAO(),
e.bindElementBuffer.set(this.buffer),
r.bufferData(r.ELEMENT_ARRAY_BUFFER, t.arrayBuffer, this.dynamicDraw ? r.DYNAMIC_DRAW : r.STATIC_DRAW),
this.dynamicDraw || t.destroy()
}
bind() {
this.context.bindElementBuffer.set(this.buffer)
}
updateData(e) {
const t = this.context.gl;
this.context.unbindVAO(),
this.bind(),
t.bufferSubData(t.ELEMENT_ARRAY_BUFFER, 0, e.arrayBuffer)
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer),
delete this.buffer)
}
}
const j = {
Int8: "BYTE",
Uint8: "UNSIGNED_BYTE",
Int16: "SHORT",
Uint16: "UNSIGNED_SHORT",
Int32: "INT",
Uint32: "UNSIGNED_INT",
Float32: "FLOAT"
};
class N {
constructor(e, t, i, r) {
this.length = t.length,
this.attributes = i,
this.itemSize = t.bytesPerElement,
this.dynamicDraw = r,
this.context = e;
const n = e.gl;
this.buffer = n.createBuffer(),
e.bindVertexBuffer.set(this.buffer),
n.bufferData(n.ARRAY_BUFFER, t.arrayBuffer, this.dynamicDraw ? n.DYNAMIC_DRAW : n.STATIC_DRAW),
this.dynamicDraw || t.destroy()
}
bind() {
this.context.bindVertexBuffer.set(this.buffer)
}
updateData(e) {
const t = this.context.gl;
this.bind(),
t.bufferSubData(t.ARRAY_BUFFER, 0, e.arrayBuffer)
}
enableAttributes(e, t) {
for (let i = 0; i < this.attributes.length; i++) {
const r = t.attributes[this.attributes[i].name];
void 0 !== r && e.enableVertexAttribArray(r)
}
}
setVertexAttribPointers(e, t, i) {
for (let r = 0; r < this.attributes.length; r++) {
const n = this.attributes[r]
, o = t.attributes[n.name];
void 0 !== o && e.vertexAttribPointer(o, n.components, e[j[n.type]], !1, this.itemSize, n.offset + this.itemSize * (i || 0))
}
}
destroy() {
this.buffer && (this.context.gl.deleteBuffer(this.buffer),
delete this.buffer)
}
}
class G {
constructor(e) {
this.gl = e.gl,
this.default = this.getDefault(),
this.current = this.default,
this.dirty = !1
}
get() {
return this.current
}
set(e) {}
getDefault() {
return this.default
}
setDefault() {
this.set(this.default)
}
}
class $ extends G {
getDefault() {
return e.Color.transparent
}
set(e) {
const t = this.current;
(e.r !== t.r || e.g !== t.g || e.b !== t.b || e.a !== t.a || this.dirty) && (this.gl.clearColor(e.r, e.g, e.b, e.a),
this.current = e,
this.dirty = !1)
}
}
class q extends G {
getDefault() {
return 1
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.clearDepth(e),
this.current = e,
this.dirty = !1)
}
}
class Z extends G {
getDefault() {
return 0
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.clearStencil(e),
this.current = e,
this.dirty = !1)
}
}
class W extends G {
getDefault() {
return [!0, !0, !0, !0]
}
set(e) {
const t = this.current;
(e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || e[3] !== t[3] || this.dirty) && (this.gl.colorMask(e[0], e[1], e[2], e[3]),
this.current = e,
this.dirty = !1)
}
}
class X extends G {
getDefault() {
return !0
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.depthMask(e),
this.current = e,
this.dirty = !1)
}
}
class H extends G {
getDefault() {
return 255
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.stencilMask(e),
this.current = e,
this.dirty = !1)
}
}
class Y extends G {
getDefault() {
return {
func: this.gl.ALWAYS,
ref: 0,
mask: 255
}
}
set(e) {
const t = this.current;
(e.func !== t.func || e.ref !== t.ref || e.mask !== t.mask || this.dirty) && (this.gl.stencilFunc(e.func, e.ref, e.mask),
this.current = e,
this.dirty = !1)
}
}
class K extends G {
getDefault() {
const e = this.gl;
return [e.KEEP, e.KEEP, e.KEEP]
}
set(e) {
const t = this.current;
(e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || this.dirty) && (this.gl.stencilOp(e[0], e[1], e[2]),
this.current = e,
this.dirty = !1)
}
}
class J extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
e ? t.enable(t.STENCIL_TEST) : t.disable(t.STENCIL_TEST),
this.current = e,
this.dirty = !1
}
}
class Q extends G {
getDefault() {
return [0, 1]
}
set(e) {
const t = this.current;
(e[0] !== t[0] || e[1] !== t[1] || this.dirty) && (this.gl.depthRange(e[0], e[1]),
this.current = e,
this.dirty = !1)
}
}
class ee extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
e ? t.enable(t.DEPTH_TEST) : t.disable(t.DEPTH_TEST),
this.current = e,
this.dirty = !1
}
}
class te extends G {
getDefault() {
return this.gl.LESS
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.depthFunc(e),
this.current = e,
this.dirty = !1)
}
}
class ie extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
e ? t.enable(t.BLEND) : t.disable(t.BLEND),
this.current = e,
this.dirty = !1
}
}
class re extends G {
getDefault() {
const e = this.gl;
return [e.ONE, e.ZERO]
}
set(e) {
const t = this.current;
(e[0] !== t[0] || e[1] !== t[1] || this.dirty) && (this.gl.blendFunc(e[0], e[1]),
this.current = e,
this.dirty = !1)
}
}
class ne extends G {
getDefault() {
return e.Color.transparent
}
set(e) {
const t = this.current;
(e.r !== t.r || e.g !== t.g || e.b !== t.b || e.a !== t.a || this.dirty) && (this.gl.blendColor(e.r, e.g, e.b, e.a),
this.current = e,
this.dirty = !1)
}
}
class oe extends G {
getDefault() {
return this.gl.FUNC_ADD
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.blendEquation(e),
this.current = e,
this.dirty = !1)
}
}
class se extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
e ? t.enable(t.CULL_FACE) : t.disable(t.CULL_FACE),
this.current = e,
this.dirty = !1
}
}
class ae extends G {
getDefault() {
return this.gl.BACK
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.cullFace(e),
this.current = e,
this.dirty = !1)
}
}
class le extends G {
getDefault() {
return this.gl.CCW
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.frontFace(e),
this.current = e,
this.dirty = !1)
}
}
class ce extends G {
getDefault() {
return null
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.useProgram(e),
this.current = e,
this.dirty = !1)
}
}
class ue extends G {
getDefault() {
return this.gl.TEXTURE0
}
set(e) {
(e !== this.current || this.dirty) && (this.gl.activeTexture(e),
this.current = e,
this.dirty = !1)
}
}
class he extends G {
getDefault() {
const e = this.gl;
return [0, 0, e.drawingBufferWidth, e.drawingBufferHeight]
}
set(e) {
const t = this.current;
(e[0] !== t[0] || e[1] !== t[1] || e[2] !== t[2] || e[3] !== t[3] || this.dirty) && (this.gl.viewport(e[0], e[1], e[2], e[3]),
this.current = e,
this.dirty = !1)
}
}
class de extends G {
getDefault() {
return null
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.bindFramebuffer(t.FRAMEBUFFER, e),
this.current = e,
this.dirty = !1
}
}
class pe extends G {
getDefault() {
return null
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.bindRenderbuffer(t.RENDERBUFFER, e),
this.current = e,
this.dirty = !1
}
}
class fe extends G {
getDefault() {
return null
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.bindTexture(t.TEXTURE_2D, e),
this.current = e,
this.dirty = !1
}
}
class me extends G {
getDefault() {
return null
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.bindBuffer(t.ARRAY_BUFFER, e),
this.current = e,
this.dirty = !1
}
}
class _e extends G {
getDefault() {
return null
}
set(e) {
const t = this.gl;
t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, e),
this.current = e,
this.dirty = !1
}
}
class ge extends G {
constructor(e) {
super(e),
this.vao = e.extVertexArrayObject
}
getDefault() {
return null
}
set(e) {
this.vao && (e !== this.current || this.dirty) && (this.vao.bindVertexArrayOES(e),
this.current = e,
this.dirty = !1)
}
}
class ye extends G {
getDefault() {
return 4
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.pixelStorei(t.UNPACK_ALIGNMENT, e),
this.current = e,
this.dirty = !1
}
}
class xe extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e),
this.current = e,
this.dirty = !1
}
}
class ve extends G {
getDefault() {
return !1
}
set(e) {
if (e === this.current && !this.dirty)
return;
const t = this.gl;
t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, e),
this.current = e,
this.dirty = !1
}
}
class be extends G {
constructor(e, t) {
super(e),
this.context = e,
this.parent = t
}
getDefault() {
return null
}
}
class we extends be {
setDirty() {
this.dirty = !0
}
set(e) {
if (e === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const t = this.gl;
t.framebufferTexture2D(t.FRAMEBUFFER, t.COLOR_ATTACHMENT0, t.TEXTURE_2D, e, 0),
this.current = e,
this.dirty = !1
}
}
class Te extends be {
attachment() {
return this.gl.DEPTH_ATTACHMENT
}
set(e) {
if (e === this.current && !this.dirty)
return;
this.context.bindFramebuffer.set(this.parent);
const t = this.gl;
t.framebufferRenderbuffer(t.FRAMEBUFFER, this.attachment(), t.RENDERBUFFER, e),
this.current = e,
this.dirty = !1
}
}
class Ee extends Te {
attachment() {
return this.gl.DEPTH_STENCIL_ATTACHMENT
}
}
class Se {
constructor(e, t, i, r) {
this.context = e,
this.width = t,
this.height = i;
const n = this.framebuffer = e.gl.createFramebuffer();
this.colorAttachment = new we(e,n),
r && (this.depthAttachment = new Te(e,n))
}
destroy() {
const e = this.context.gl
, t = this.colorAttachment.get();
if (t && e.deleteTexture(t),
this.depthAttachment) {
const t = this.depthAttachment.get();
t && e.deleteRenderbuffer(t)
}
e.deleteFramebuffer(this.framebuffer)
}
}
class Ce {
constructor(e) {
this.gl = e,
this.extVertexArrayObject = this.gl.getExtension("OES_vertex_array_object"),
this.clearColor = new $(this),
this.clearDepth = new q(this),
this.clearStencil = new Z(this),
this.colorMask = new W(this),
this.depthMask = new X(this),
this.stencilMask = new H(this),
this.stencilFunc = new Y(this),
this.stencilOp = new K(this),
this.stencilTest = new J(this),
this.depthRange = new Q(this),
this.depthTest = new ee(this),
this.depthFunc = new te(this),
this.blend = new ie(this),
this.blendFunc = new re(this),
this.blendColor = new ne(this),
this.blendEquation = new oe(this),
this.cullFace = new se(this),
this.cullFaceSide = new ae(this),
this.frontFace = new le(this),
this.program = new ce(this),
this.activeTexture = new ue(this),
this.viewport = new he(this),
this.bindFramebuffer = new de(this),
this.bindRenderbuffer = new pe(this),
this.bindTexture = new fe(this),
this.bindVertexBuffer = new me(this),
this.bindElementBuffer = new _e(this),
this.bindVertexArrayOES = this.extVertexArrayObject && new ge(this),
this.pixelStoreUnpack = new ye(this),
this.pixelStoreUnpackPremultiplyAlpha = new xe(this),
this.pixelStoreUnpackFlipY = new ve(this),
this.extTextureFilterAnisotropic = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),
this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),
this.extTextureFilterAnisotropicForceOff = !1,
this.extStandardDerivativesForceOff = !1,
this.extTextureHalfFloat = e.getExtension("OES_texture_half_float"),
this.extTextureHalfFloat && (e.getExtension("OES_texture_half_float_linear"),
this.extRenderToTextureHalfFloat = e.getExtension("EXT_color_buffer_half_float")),
this.extStandardDerivatives = e.getExtension("OES_standard_derivatives"),
this.extTimerQuery = e.getExtension("EXT_disjoint_timer_query"),
this.maxTextureSize = e.getParameter(e.MAX_TEXTURE_SIZE)
}
setDefault() {
this.unbindVAO(),
this.clearColor.setDefault(),
this.clearDepth.setDefault(),
this.clearStencil.setDefault(),
this.colorMask.setDefault(),
this.depthMask.setDefault(),
this.stencilMask.setDefault(),
this.stencilFunc.setDefault(),
this.stencilOp.setDefault(),
this.stencilTest.setDefault(),
this.depthRange.setDefault(),
this.depthTest.setDefault(),
this.depthFunc.setDefault(),
this.blend.setDefault(),
this.blendFunc.setDefault(),
this.blendColor.setDefault(),
this.blendEquation.setDefault(),
this.cullFace.setDefault(),
this.cullFaceSide.setDefault(),
this.frontFace.setDefault(),
this.program.setDefault(),
this.activeTexture.setDefault(),
this.bindFramebuffer.setDefault(),
this.pixelStoreUnpack.setDefault(),
this.pixelStoreUnpackPremultiplyAlpha.setDefault(),
this.pixelStoreUnpackFlipY.setDefault()
}
setDirty() {
this.clearColor.dirty = !0,
this.clearDepth.dirty = !0,
this.clearStencil.dirty = !0,
this.colorMask.dirty = !0,
this.depthMask.dirty = !0,
this.stencilMask.dirty = !0,
this.stencilFunc.dirty = !0,
this.stencilOp.dirty = !0,
this.stencilTest.dirty = !0,
this.depthRange.dirty = !0,
this.depthTest.dirty = !0,
this.depthFunc.dirty = !0,
this.blend.dirty = !0,
this.blendFunc.dirty = !0,
this.blendColor.dirty = !0,
this.blendEquation.dirty = !0,
this.cullFace.dirty = !0,
this.cullFaceSide.dirty = !0,
this.frontFace.dirty = !0,
this.program.dirty = !0,
this.activeTexture.dirty = !0,
this.viewport.dirty = !0,
this.bindFramebuffer.dirty = !0,
this.bindRenderbuffer.dirty = !0,
this.bindTexture.dirty = !0,
this.bindVertexBuffer.dirty = !0,
this.bindElementBuffer.dirty = !0,
this.extVertexArrayObject && (this.bindVertexArrayOES.dirty = !0),
this.pixelStoreUnpack.dirty = !0,
this.pixelStoreUnpackPremultiplyAlpha.dirty = !0,
this.pixelStoreUnpackFlipY.dirty = !0
}
createIndexBuffer(e, t) {
return new V(this,e,t)
}
createVertexBuffer(e, t, i) {
return new N(this,e,t,i)
}
createRenderbuffer(e, t, i) {
const r = this.gl
, n = r.createRenderbuffer();
return this.bindRenderbuffer.set(n),
r.renderbufferStorage(r.RENDERBUFFER, e, t, i),
this.bindRenderbuffer.set(null),
n
}
createFramebuffer(e, t, i) {
return new Se(this,e,t,i)
}
clear({color: e, depth: t, stencil: i}) {
const r = this.gl;
let n = 0;
e && (n |= r.COLOR_BUFFER_BIT,
this.clearColor.set(e),
this.colorMask.set([!0, !0, !0, !0])),
void 0 !== t && (n |= r.DEPTH_BUFFER_BIT,
this.depthRange.set([0, 1]),
this.clearDepth.set(t),
this.depthMask.set(!0)),
void 0 !== i && (n |= r.STENCIL_BUFFER_BIT,
this.clearStencil.set(i),
this.stencilMask.set(255)),
r.clear(n)
}
setCullFace(e) {
!1 === e.enable ? this.cullFace.set(!1) : (this.cullFace.set(!0),
this.cullFaceSide.set(e.mode),
this.frontFace.set(e.frontFace))
}
setDepthMode(e) {
e.func !== this.gl.ALWAYS || e.mask ? (this.depthTest.set(!0),
this.depthFunc.set(e.func),
this.depthMask.set(e.mask),
this.depthRange.set(e.range)) : this.depthTest.set(!1)
}
setStencilMode(e) {
e.test.func !== this.gl.ALWAYS || e.mask ? (this.stencilTest.set(!0),
this.stencilMask.set(e.mask),
this.stencilOp.set([e.fail, e.depthFail, e.pass]),
this.stencilFunc.set({
func: e.test.func,
ref: e.ref,
mask: e.test.mask
})) : this.stencilTest.set(!1)
}
setColorMode(i) {
t(i.blendFunction, e.ColorMode.Replace) ? this.blend.set(!1) : (this.blend.set(!0),
this.blendFunc.set(i.blendFunction),
this.blendColor.set(i.blendColor)),
this.colorMask.set(i.mask)
}
unbindVAO() {
this.extVertexArrayObject && this.bindVertexArrayOES.set(null)
}
}
class Me extends e.Evented {
constructor(t, i, r, n) {
super(),
this.id = t,
this.dispatcher = r,
this.setEventedParent(n),
this.type = "raster",
this.minzoom = 0,
this.maxzoom = 22,
this.roundZoom = !0,
this.scheme = "xyz",
this.tileSize = 512,
this._loaded = !1,
this._options = e.extend({
type: "raster"
}, i),
e.extend(this, e.pick(i, ["url", "scheme", "tileSize"]))
}
load() {
this._loaded = !1,
this.fire(new e.Event("dataloading",{
dataType: "source"
})),
this._tileJSONRequest = F(this._options, this.map._requestManager, null, null, ((t,i)=>{
this._tileJSONRequest = null,
this._loaded = !0,
t ? this.fire(new e.ErrorEvent(t)) : i && (e.extend(this, i),
i.bounds && (this.tileBounds = new U(i.bounds,this.minzoom,this.maxzoom)),
e.postTurnstileEvent(i.tiles),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "metadata"
})),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "content"
})))
}
))
}
loaded() {
return this._loaded
}
onAdd(e) {
this.map = e,
this.load()
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.cancel(),
this._tileJSONRequest = null)
}
serialize() {
return e.extend({}, this._options)
}
hasTile(e) {
return !this.tileBounds || this.tileBounds.contains(e.canonical)
}
loadTile(t, i) {
const r = e.exported.devicePixelRatio >= 2
, n = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme), r, this.tileSize);
t.request = e.getImage(this.map._requestManager.transformRequest(n, e.ResourceType.Tile), ((r,n,o,s)=>(delete t.request,
t.aborted ? (t.state = "unloaded",
i(null)) : r ? (t.state = "errored",
i(r)) : n ? (this.map._refreshExpiredTiles && t.setExpiryData({
cacheControl: o,
expires: s
}),
t.setTexture(n, this.map.painter),
t.state = "loaded",
e.cacheEntryPossiblyAdded(this.dispatcher),
void i(null)) : i(null))))
}
static loadTileData(e, t, i) {
e.setTexture(t, i)
}
static unloadTileData(e, t) {
e.texture && t.saveTileTexture(e.texture)
}
abortTile(e, t) {
e.request && (e.request.cancel(),
delete e.request),
t()
}
unloadTile(e, t) {
e.texture && this.map.painter.saveTileTexture(e.texture),
t()
}
hasTransition() {
return !1
}
}
let Ae;
function Ie(t, i, r, n, o, s, a, l) {
const c = [t, r, o, i, n, s, 1, 1, 1]
, u = [a, l, 1]
, h = e.adjoint([], c)
, [d,p,f] = e.transformMat3(u, u, e.transpose(h, h));
return e.multiply$1(c, [d, 0, 0, 0, p, 0, 0, 0, f], c)
}
class ze extends e.Evented {
constructor(e, t, i, r) {
super(),
this.id = e,
this.dispatcher = i,
this.coordinates = t.coordinates,
this.type = "image",
this.minzoom = 0,
this.maxzoom = 22,
this.tileSize = 512,
this.tiles = {},
this._loaded = !1,
this.setEventedParent(r),
this.options = t
}
load(t, i) {
this._loaded = i || !1,
this.fire(new e.Event("dataloading",{
dataType: "source"
})),
this.url = this.options.url,
e.getImage(this.map._requestManager.transformRequest(this.url, e.ResourceType.Image), ((i,r)=>{
if (this._loaded = !0,
i)
this.fire(new e.ErrorEvent(i));
else if (r) {
const {HTMLImageElement: i} = e.window;
this.image = r instanceof i ? e.exported.getImageData(r) : r,
this.width = this.image.width,
this.height = this.image.height,
t && (this.coordinates = t),
this._finishLoading()
}
}
))
}
loaded() {
return this._loaded
}
updateImage(e) {
return this.image && e.url ? (this.options.url = e.url,
this.load(e.coordinates, this._loaded),
this) : this
}
_finishLoading() {
this.map && (this.setCoordinates(this.coordinates),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "metadata"
})))
}
onAdd(e) {
this.map = e,
this.load()
}
onRemove() {
this.texture && this.texture.destroy()
}
setCoordinates(t) {
this.coordinates = t,
this._boundsArray = void 0;
const i = t.map(e.MercatorCoordinate.fromLngLat);
return this.tileID = function(t) {
let i = 1 / 0
, r = 1 / 0
, n = -1 / 0
, o = -1 / 0;
for (const e of t)
i = Math.min(i, e.x),
r = Math.min(r, e.y),
n = Math.max(n, e.x),
o = Math.max(o, e.y);
const s = Math.max(n - i, o - r)
, a = Math.max(0, Math.floor(-Math.log(s) / Math.LN2))
, l = Math.pow(2, a);
return new e.CanonicalTileID(a,Math.floor((i + n) / 2 * l),Math.floor((r + o) / 2 * l))
}(i),
this.minzoom = this.maxzoom = this.tileID.z,
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "content"
})),
this
}
_clear() {
this._boundsArray = void 0
}
_prepareData(t) {
for (const e in this.tiles) {
const t = this.tiles[e];
"loaded" !== t.state && (t.state = "loaded",
t.texture = this.texture)
}
if (this._boundsArray)
return;
const i = e.tileTransform(this.tileID, this.map.transform.projection)
, [r,n,o,s] = this.coordinates.map((t=>{
const r = i.projection.project(t[0], t[1]);
return e.getTilePoint(i, r)._round()
}
));
this.perspectiveTransform = function(t, i, r, n, o, s, a, l, c, u) {
const h = Ie(0, 0, t, 0, 0, i, t, i)
, d = Ie(r, n, o, s, a, l, c, u);
return e.multiply$1(d, e.adjoint(h, h), d),
[d[6] / d[8] * t / e.EXTENT, d[7] / d[8] * i / e.EXTENT]
}(this.width, this.height, r.x, r.y, n.x, n.y, s.x, s.y, o.x, o.y);
const a = this._boundsArray = new e.StructArrayLayout4i8;
a.emplaceBack(r.x, r.y, 0, 0),
a.emplaceBack(n.x, n.y, e.EXTENT, 0),
a.emplaceBack(s.x, s.y, 0, e.EXTENT),
a.emplaceBack(o.x, o.y, e.EXTENT, e.EXTENT),
this.boundsBuffer && this.boundsBuffer.destroy(),
this.boundsBuffer = t.createVertexBuffer(a, e.boundsAttributes.members),
this.boundsSegments = e.SegmentVector.simpleSegment(0, 0, 4, 2)
}
prepare() {
if (0 === Object.keys(this.tiles).length || !this.image)
return;
const t = this.map.painter.context
, i = t.gl;
this.texture ? this.texture.update(this.image) : (this.texture = new e.Texture(t,this.image,i.RGBA),
this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)),
this._prepareData(t)
}
loadTile(e, t) {
this.tileID && this.tileID.equals(e.tileID.canonical) ? (this.tiles[String(e.tileID.wrap)] = e,
e.buckets = {},
t(null)) : (e.state = "errored",
t(null))
}
serialize() {
return {
type: "image",
url: this.options.url,
coordinates: this.coordinates
}
}
hasTransition() {
return !1
}
}
const ke = {
vector: class extends e.Evented {
constructor(t, i, r, n) {
if (super(),
this.id = t,
this.dispatcher = r,
this.type = "vector",
this.minzoom = 0,
this.maxzoom = 22,
this.scheme = "xyz",
this.tileSize = 512,
this.reparseOverscaled = !0,
this.isTileClipped = !0,
this._loaded = !1,
e.extend(this, e.pick(i, ["url", "scheme", "tileSize", "promoteId"])),
this._options = e.extend({
type: "vector"
}, i),
this._collectResourceTiming = i.collectResourceTiming,
512 !== this.tileSize)
throw new Error("vector tile sources must have a tileSize of 512");
this.setEventedParent(n),
this._tileWorkers = {},
this._deduped = new e.DedupedRequest
}
load(t) {
this._loaded = !1,
this.fire(new e.Event("dataloading",{
dataType: "source"
}));
const i = this.language || this.map._language
, r = this.worldview || this.map._worldview;
this._tileJSONRequest = F(this._options, this.map._requestManager, i, r, ((n,o)=>{
this._tileJSONRequest = null,
this._loaded = !0,
n ? (i && console.warn(`Ensure that your requested language string is a valid BCP-47 code. Found: ${i}`),
r && 2 !== r.length && console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),
this.fire(new e.ErrorEvent(n))) : o && (e.extend(this, o),
o.bounds && (this.tileBounds = new U(o.bounds,this.minzoom,this.maxzoom)),
e.postTurnstileEvent(o.tiles, this.map._requestManager._customAccessToken),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "metadata"
})),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "content"
}))),
t && t(n)
}
))
}
loaded() {
return this._loaded
}
hasTile(e) {
return !this.tileBounds || this.tileBounds.contains(e.canonical)
}
onAdd(e) {
this.map = e,
this.load()
}
setSourceProperty(e) {
this._tileJSONRequest && this._tileJSONRequest.cancel(),
e(),
this.load((()=>{
const e = this.map.style._getSourceCaches(this.id);
for (const t of e)
t.clearTiles()
}
))
}
setTiles(e) {
return this.setSourceProperty((()=>{
this._options.tiles = e
}
)),
this
}
setUrl(e) {
return this.setSourceProperty((()=>{
this.url = e,
this._options.url = e
}
)),
this
}
_setLanguage(e) {
return e === this.language || this.setSourceProperty((()=>{
this.language = e
}
)),
this
}
_setWorldview(e) {
return e === this.worldview ? this : this.worldviewOptions && e && !this.worldviewOptions[e] ? (console.warn(`Vector tile source "${this.id}" does not support worldview "${e}".`),
this) : (this.setSourceProperty((()=>{
this.worldview = e
}
)),
this)
}
onRemove() {
this._tileJSONRequest && (this._tileJSONRequest.cancel(),
this._tileJSONRequest = null)
}
serialize() {
return e.extend({}, this._options)
}
loadTile(t, i) {
const r = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme))
, n = {
request: this.map._requestManager.transformRequest(r, e.ResourceType.Tile),
data: void 0,
uid: t.uid,
tileID: t.tileID,
tileZoom: t.tileZoom,
zoom: t.tileID.overscaledZ,
tileSize: this.tileSize * t.tileID.overscaleFactor(),
type: this.type,
source: this.id,
pixelRatio: e.exported.devicePixelRatio,
showCollisionBoxes: this.map.showCollisionBoxes,
promoteId: this.promoteId,
isSymbolTile: t.isSymbolTile
};
if (n.request.collectResourceTiming = this._collectResourceTiming,
t.actor && "expired" !== t.state)
"loading" === t.state ? t.reloadCallback = i : t.request = t.actor.send("reloadTile", n, o.bind(this));
else if (t.actor = this._tileWorkers[r] = this._tileWorkers[r] || this.dispatcher.getActor(),
this.dispatcher.ready)
t.request = t.actor.send("loadTile", n, o.bind(this), void 0, !0);
else {
const i = e.loadVectorTile.call({
deduped: this._deduped
}, n, ((e,i)=>{
e || !i ? o.call(this, e) : (n.data = {
cacheControl: i.cacheControl,
expires: i.expires,
rawData: i.rawData.slice(0)
},
t.actor && t.actor.send("loadTile", n, o.bind(this), void 0, !0))
}
), !0);
t.request = {
cancel: i
}
}
function o(r, n) {
return delete t.request,
t.aborted ? i(null) : r && 404 !== r.status ? i(r) : (n && n.resourceTiming && (t.resourceTiming = n.resourceTiming),
this.map._refreshExpiredTiles && n && t.setExpiryData(n),
t.loadVectorData(n, this.map.painter),
e.cacheEntryPossiblyAdded(this.dispatcher),
i(null),
void (t.reloadCallback && (this.loadTile(t, t.reloadCallback),
t.reloadCallback = null)))
}
}
abortTile(e) {
e.request && (e.request.cancel(),
delete e.request),
e.actor && e.actor.send("abortTile", {
uid: e.uid,
type: this.type,
source: this.id
})
}
unloadTile(e) {
e.unloadVectorData(),
e.actor && e.actor.send("removeTile", {
uid: e.uid,
type: this.type,
source: this.id
})
}
hasTransition() {
return !1
}
afterUpdate() {
this._tileWorkers = {}
}
}
,
raster: Me,
"raster-dem": class extends Me {
constructor(t, i, r, n) {
super(t, i, r, n),
this.type = "raster-dem",
this.maxzoom = 22,
this._options = e.extend({
type: "raster-dem"
}, i),
this.encoding = i.encoding || "mapbox"
}
loadTile(t, i) {
const r = this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles, this.scheme), !1, this.tileSize);
function n(e, r) {
e && (t.state = "errored",
i(e)),
r && (t.dem = r,
t.dem.onDeserialize(),
t.needsHillshadePrepare = !0,
t.needsDEMTextureUpload = !0,
t.state = "loaded",
i(null))
}
t.request = e.getImage(this.map._requestManager.transformRequest(r, e.ResourceType.Tile), function(r, o, s, a) {
if (delete t.request,
t.aborted)
t.state = "unloaded",
i(null);
else if (r)
t.state = "errored",
i(r);
else if (o) {
this.map._refreshExpiredTiles && t.setExpiryData({
cacheControl: s,
expires: a
});
const i = e.window.ImageBitmap && o instanceof e.window.ImageBitmap && (null == Ae && (Ae = e.window.OffscreenCanvas && new e.window.OffscreenCanvas(1,1).getContext("2d") && "function" == typeof e.window.createImageBitmap),
Ae)
, r = 1 - (o.width - e.prevPowerOfTwo(o.width)) / 2;
r < 1 || t.neighboringTiles || (t.neighboringTiles = this._getNeighboringTiles(t.tileID));
const l = i ? o : e.exported.getImageData(o, r)
, c = {
uid: t.uid,
coord: t.tileID,
source: this.id,
rawImageData: l,
encoding: this.encoding,
padding: r
};
t.actor && "expired" !== t.state || (t.actor = this.dispatcher.getActor(),
t.actor.send("loadDEMTile", c, n.bind(this), void 0, !0))
}
}
.bind(this))
}
_getNeighboringTiles(t) {
const i = t.canonical
, r = Math.pow(2, i.z)
, n = (i.x - 1 + r) % r
, o = 0 === i.x ? t.wrap - 1 : t.wrap
, s = (i.x + 1 + r) % r
, a = i.x + 1 === r ? t.wrap + 1 : t.wrap
, l = {};
return l[new e.OverscaledTileID(t.overscaledZ,o,i.z,n,i.y).key] = {
backfilled: !1
},
l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y).key] = {
backfilled: !1
},
i.y > 0 && (l[new e.OverscaledTileID(t.overscaledZ,o,i.z,n,i.y - 1).key] = {
backfilled: !1
},
l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y - 1).key] = {
backfilled: !1
},
l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y - 1).key] = {
backfilled: !1
}),
i.y + 1 < r && (l[new e.OverscaledTileID(t.overscaledZ,o,i.z,n,i.y + 1).key] = {
backfilled: !1
},
l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y + 1).key] = {
backfilled: !1
},
l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y + 1).key] = {
backfilled: !1
}),
l
}
unloadTile(e) {
e.demTexture && this.map.painter.saveTileTexture(e.demTexture),
e.fbo && (e.fbo.destroy(),
delete e.fbo),
e.dem && delete e.dem,
delete e.neighboringTiles,
e.state = "unloaded"
}
}
,
geojson: class extends e.Evented {
constructor(t, i, r, n) {
super(),
this.id = t,
this.type = "geojson",
this.minzoom = 0,
this.maxzoom = 18,
this.tileSize = 512,
this.isTileClipped = !0,
this.reparseOverscaled = !0,
this._loaded = !1,
this.actor = r.getActor(),
this.setEventedParent(n),
this._data = i.data,
this._options = e.extend({}, i),
this._collectResourceTiming = i.collectResourceTiming,
void 0 !== i.maxzoom && (this.maxzoom = i.maxzoom),
i.type && (this.type = i.type),
i.attribution && (this.attribution = i.attribution),
this.promoteId = i.promoteId;
const o = e.EXTENT / this.tileSize;
this.workerOptions = e.extend({
source: this.id,
cluster: i.cluster || !1,
geojsonVtOptions: {
buffer: (void 0 !== i.buffer ? i.buffer : 128) * o,
tolerance: (void 0 !== i.tolerance ? i.tolerance : .375) * o,
extent: e.EXTENT,
maxZoom: this.maxzoom,
lineMetrics: i.lineMetrics || !1,
generateId: i.generateId || !1
},
superclusterOptions: {
maxZoom: void 0 !== i.clusterMaxZoom ? i.clusterMaxZoom : this.maxzoom - 1,
minPoints: Math.max(2, i.clusterMinPoints || 2),
extent: e.EXTENT,
radius: (void 0 !== i.clusterRadius ? i.clusterRadius : 50) * o,
log: !1,
generateId: i.generateId || !1
},
clusterProperties: i.clusterProperties,
filter: i.filter
}, i.workerOptions)
}
onAdd(e) {
this.map = e,
this.setData(this._data)
}
setData(e) {
return this._data = e,
this._updateWorkerData(),
this
}
getClusterExpansionZoom(e, t) {
return this.actor.send("geojson.getClusterExpansionZoom", {
clusterId: e,
source: this.id
}, t),
this
}
getClusterChildren(e, t) {
return this.actor.send("geojson.getClusterChildren", {
clusterId: e,
source: this.id
}, t),
this
}
getClusterLeaves(e, t, i, r) {
return this.actor.send("geojson.getClusterLeaves", {
source: this.id,
clusterId: e,
limit: t,
offset: i
}, r),
this
}
_updateWorkerData() {
if (this._pendingLoad)
return void (this._coalesce = !0);
this.fire(new e.Event("dataloading",{
dataType: "source"
})),
this._loaded = !1;
const t = e.extend({}, this.workerOptions)
, i = this._data;
"string" == typeof i ? (t.request = this.map._requestManager.transformRequest(e.exported.resolveURL(i), e.ResourceType.Source),
t.request.collectResourceTiming = this._collectResourceTiming) : t.data = JSON.stringify(i),
this._pendingLoad = this.actor.send(`${this.type}.loadData`, t, ((t,i)=>{
if (this._loaded = !0,
this._pendingLoad = null,
t)
this.fire(new e.ErrorEvent(t));
else {
const t = {
dataType: "source",
sourceDataType: this._metadataFired ? "content" : "metadata"
};
this._collectResourceTiming && i && i.resourceTiming && i.resourceTiming[this.id] && (t.resourceTiming = i.resourceTiming[this.id]),
this.fire(new e.Event("data",t)),
this._metadataFired = !0
}
this._coalesce && (this._updateWorkerData(),
this._coalesce = !1)
}
))
}
loaded() {
return this._loaded
}
loadTile(t, i) {
const r = t.actor ? "reloadTile" : "loadTile";
t.actor = this.actor,
t.request = this.actor.send(r, {
type: this.type,
uid: t.uid,
tileID: t.tileID,
tileZoom: t.tileZoom,
zoom: t.tileID.overscaledZ,
maxZoom: this.maxzoom,
tileSize: this.tileSize,
source: this.id,
pixelRatio: e.exported.devicePixelRatio,
showCollisionBoxes: this.map.showCollisionBoxes,
promoteId: this.promoteId
}, ((e,n)=>(delete t.request,
t.unloadVectorData(),
t.aborted ? i(null) : e ? i(e) : (t.loadVectorData(n, this.map.painter, "reloadTile" === r),
i(null)))), void 0, "loadTile" === r)
}
abortTile(e) {
e.request && (e.request.cancel(),
delete e.request),
e.aborted = !0
}
unloadTile(e) {
e.unloadVectorData(),
this.actor.send("removeTile", {
uid: e.uid,
type: this.type,
source: this.id
})
}
onRemove() {
this._pendingLoad && this._pendingLoad.cancel()
}
serialize() {
return e.extend({}, this._options, {
type: this.type,
data: this._data
})
}
hasTransition() {
return !1
}
}
,
video: class extends ze {
constructor(e, t, i, r) {
super(e, t, i, r),
this.roundZoom = !0,
this.type = "video",
this.options = t
}
load() {
this._loaded = !1;
const t = this.options;
this.urls = [];
for (const i of t.urls)
this.urls.push(this.map._requestManager.transformRequest(i, e.ResourceType.Source).url);
e.getVideo(this.urls, ((t,i)=>{
this._loaded = !0,
t ? this.fire(new e.ErrorEvent(t)) : i && (this.video = i,
this.video.loop = !0,
this.video.setAttribute("playsinline", ""),
this.video.addEventListener("playing", (()=>{
this.map.triggerRepaint()
}
)),
this.map && this.video.play(),
this._finishLoading())
}
))
}
pause() {
this.video && this.video.pause()
}
play() {
this.video && this.video.play()
}
seek(t) {
if (this.video) {
const i = this.video.seekable;
t < i.start(0) || t > i.end(0) ? this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))) : this.video.currentTime = t
}
}
getVideo() {
return this.video
}
onAdd(e) {
this.map || (this.map = e,
this.load(),
this.video && (this.video.play(),
this.setCoordinates(this.coordinates)))
}
prepare() {
if (0 === Object.keys(this.tiles).length || this.video.readyState < 2)
return;
const t = this.map.painter.context
, i = t.gl;
this.texture ? this.video.paused || (this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE),
i.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, i.RGBA, i.UNSIGNED_BYTE, this.video)) : (this.texture = new e.Texture(t,this.video,i.RGBA),
this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE),
this.width = this.video.videoWidth,
this.height = this.video.videoHeight),
this._prepareData(t)
}
serialize() {
return {
type: "video",
urls: this.urls,
coordinates: this.coordinates
}
}
hasTransition() {
return this.video && !this.video.paused
}
}
,
image: ze,
canvas: class extends ze {
constructor(t, i, r, n) {
super(t, i, r, n),
i.coordinates ? Array.isArray(i.coordinates) && 4 === i.coordinates.length && !i.coordinates.some((e=>!Array.isArray(e) || 2 !== e.length || e.some((e=>"number" != typeof e)))) || this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),
i.animate && "boolean" != typeof i.animate && this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),
i.canvas ? "string" == typeof i.canvas || i.canvas instanceof e.window.HTMLCanvasElement || this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),
this.options = i,
this.animate = void 0 === i.animate || i.animate
}
load() {
this._loaded = !0,
this.canvas || (this.canvas = this.options.canvas instanceof e.window.HTMLCanvasElement ? this.options.canvas : e.window.document.getElementById(this.options.canvas)),
this.width = this.canvas.width,
this.height = this.canvas.height,
this._hasInvalidDimensions() ? this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() {
this._playing = !0,
this.map.triggerRepaint()
}
,
this.pause = function() {
this._playing && (this.prepare(),
this._playing = !1)
}
,
this._finishLoading())
}
getCanvas() {
return this.canvas
}
onAdd(e) {
this.map = e,
this.load(),
this.canvas && this.animate && this.play()
}
onRemove() {
this.pause()
}
prepare() {
let t = !1;
if (this.canvas.width !== this.width && (this.width = this.canvas.width,
t = !0),
this.canvas.height !== this.height && (this.height = this.canvas.height,
t = !0),
this._hasInvalidDimensions())
return;
if (0 === Object.keys(this.tiles).length)
return;
const i = this.map.painter.context;
this.texture ? (t || this._playing) && this.texture.update(this.canvas, {
premultiply: !0
}) : this.texture = new e.Texture(i,this.canvas,i.gl.RGBA,{
premultiply: !0
}),
this._prepareData(i)
}
serialize() {
return {
type: "canvas",
coordinates: this.coordinates
}
}
hasTransition() {
return this._playing
}
_hasInvalidDimensions() {
for (const e of [this.canvas.width, this.canvas.height])
if (isNaN(e) || e <= 0)
return !0;
return !1
}
}
,
custom: class extends e.Evented {
constructor(t, i, r, n) {
super(),
this.id = t,
this.type = "custom",
this._dataType = "raster",
this._dispatcher = r,
this._implementation = i,
this.setEventedParent(n),
this.scheme = "xyz",
this.minzoom = 0,
this.maxzoom = 22,
this.tileSize = 512,
this._loaded = !1,
this.roundZoom = !0,
this._implementation || this.fire(new e.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),
this._implementation.loadTile || this.fire(new e.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),
this._implementation.bounds && (this.tileBounds = new U(this._implementation.bounds,this.minzoom,this.maxzoom)),
i.update = this._update.bind(this),
i.coveringTiles = this._coveringTiles.bind(this),
e.extend(this, e.pick(i, ["dataType", "scheme", "minzoom", "maxzoom", "tileSize", "attribution", "minTileCacheSize", "maxTileCacheSize"]))
}
serialize() {
return e.pick(this, ["type", "scheme", "minzoom", "maxzoom", "tileSize", "attribution"])
}
load() {
this._loaded = !0,
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "metadata"
})),
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "content"
}))
}
loaded() {
return this._loaded
}
onAdd(t) {
this._map = t,
this._loaded = !1,
this.fire(new e.Event("dataloading",{
dataType: "source"
})),
this._implementation.onAdd && this._implementation.onAdd(t),
this.load()
}
onRemove(e) {
this._implementation.onRemove && this._implementation.onRemove(e)
}
hasTile(e) {
if (this._implementation.hasTile) {
const {x: t, y: i, z: r} = e.canonical;
return this._implementation.hasTile({
x: t,
y: i,
z: r
})
}
return !this.tileBounds || this.tileBounds.contains(e.canonical)
}
loadTile(t, i) {
const {x: r, y: n, z: o} = t.tileID.canonical
, s = new e.window.AbortController
, a = this._implementation.loadTile({
x: r,
y: n,
z: o
}, {
signal: s.signal
});
if (!a)
return this.loadTileData(t, {
width: this.tileSize,
height: this.tileSize,
data: null
}),
t.state = "loaded",
i(null);
a.cancel = ()=>s.abort(),
t.request = a.then(function(r) {
return delete t.request,
t.aborted ? (t.state = "unloaded",
i(null)) : r ? function(t) {
return t instanceof e.window.ImageData || t instanceof e.window.ImageBitmap || t instanceof e.window.HTMLCanvasElement
}(r) ? (this.loadTileData(t, r),
t.state = "loaded",
void i(null)) : (t.state = "errored",
i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`))) : (this.loadTileData(t, {
width: this.tileSize,
height: this.tileSize,
data: null
}),
t.state = "loaded",
i(null))
}
.bind(this)).catch((e=>{
20 !== e.code && (t.state = "errored",
i(e))
}
))
}
loadTileData(e, t) {
Me.loadTileData(e, t, this._map.painter)
}
unloadTileData(e) {
Me.unloadTileData(e, this._map.painter)
}
prepareTile(e) {
if (!this._implementation.prepareTile)
return null;
const {x: t, y: i, z: r} = e.tileID.canonical
, n = this._implementation.prepareTile({
x: t,
y: i,
z: r
});
return n ? (this.loadTileData(e, n),
e.state = "loaded",
n) : null
}
unloadTile(e, t) {
if (this.unloadTileData(e),
this._implementation.unloadTile) {
const {x: t, y: i, z: r} = e.tileID.canonical;
this._implementation.unloadTile({
x: t,
y: i,
z: r
})
}
t()
}
abortTile(e, t) {
e.request && e.request.cancel && (e.request.cancel(),
delete e.request),
t()
}
hasTransition() {
return !1
}
_coveringTiles() {
return this._map.transform.coveringTiles({
tileSize: this.tileSize,
minzoom: this.minzoom,
maxzoom: this.maxzoom,
roundZoom: this.roundZoom
}).map((e=>({
x: e.canonical.x,
y: e.canonical.y,
z: e.canonical.z
})))
}
_update() {
this.fire(new e.Event("data",{
dataType: "source",
sourceDataType: "content"
}))
}
}
}
, Pe = function(t, i, r, n) {
const o = new ke[i.type](t,i,r,n);
if (o.id !== t)
throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);
return e.bindAll(["load", "abort", "unload", "serialize", "prepare"], o),
o
};
function De(t, i) {
const r = e.identity([]);
return e.scale(r, r, [.5 * t.width, .5 * -t.height, 1]),
e.translate(r, r, [1, -1, 0]),
e.multiply(r, r, t.calculateProjMatrix(i.toUnwrapped())),
Float32Array.from(r)
}
function Le(e, t, i, r, n, o, s, a=!1) {
const l = e.tilesIn(r, s, a);
l.sort(Oe);
const c = [];
for (const r of l)
c.push({
wrappedTileID: r.tile.tileID.wrapped().key,
queryResults: r.tile.queryRenderedFeatures(t, i, e._state, r, n, o, De(e.transform, r.tile.tileID), a)
});
const u = function(e) {
const t = {}
, i = {};
for (const r of e) {
const e = r.queryResults
, n = r.wrappedTileID
, o = i[n] = i[n] || {};
for (const i in e) {
const r = e[i]
, n = o[i] = o[i] || {}
, s = t[i] = t[i] || [];
for (const e of r)
n[e.featureIndex] || (n[e.featureIndex] = !0,
s.push(e))
}
}
return t
}(c);
for (const t in u)
u[t].forEach((t=>{
const i = t.feature
, r = i.layer;
r && "background" !== r.type && "sky" !== r.type && (i.source = r.source,
r["source-layer"] && (i.sourceLayer = r["source-layer"]),
i.state = void 0 !== i.id ? e.getFeatureState(r["source-layer"], i.id) : {})
}
));
return u
}
function Be(e, t) {
const i = e.getRenderableIds().map((t=>e.getTileByID(t)))
, r = []
, n = {};
for (let e = 0; e < i.length; e++) {
const o = i[e]
, s = o.tileID.canonical.key;
n[s] || (n[s] = !0,
o.querySourceFeatures(r, t))
}
return r
}
function Oe(e, t) {
const i = e.tileID
, r = t.tileID;
return i.overscaledZ - r.overscaledZ || i.canonical.y - r.canonical.y || i.wrap - r.wrap || i.canonical.x - r.canonical.x
}
function Re() {
return null != go.workerClass ? new go.workerClass : new e.window.Worker(go.workerUrl)
}
const Fe = "mapboxgl_preloaded_worker_pool";
class Ue {
constructor() {
this.active = {}
}
acquire(e) {
if (!this.workers)
for (this.workers = []; this.workers.length < Ue.workerCount; )
this.workers.push(new Re);
return this.active[e] = !0,
this.workers.slice()
}
release(e) {
delete this.active[e],
0 === this.numActive() && (this.workers.forEach((e=>{
e.terminate()
}
)),
this.workers = null)
}
isPreloaded() {
return !!this.active[Fe]
}
numActive() {
return Object.keys(this.active).length
}
}
let Ve;
function je() {
return Ve || (Ve = new Ue),
Ve
}
function Ne(t, i) {
const r = {};
for (const e in t)
"ref" !== e && (r[e] = t[e]);
return e.refProperties.forEach((e=>{
e in i && (r[e] = i[e])
}
)),
r
}
function Ge(e) {
e = e.slice();
const t = Object.create(null);
for (let i = 0; i < e.length; i++)
t[e[i].id] = e[i];
for (let i = 0; i < e.length; i++)
"ref"in e[i] && (e[i] = Ne(e[i], t[e[i].ref]));
return e
}
Ue.workerCount = 2;
const $e = {
setStyle: "setStyle",
addLayer: "addLayer",
removeLayer: "removeLayer",
setPaintProperty: "setPaintProperty",
setLayoutProperty: "setLayoutProperty",
setFilter: "setFilter",
addSource: "addSource",
removeSource: "removeSource",
setGeoJSONSourceData: "setGeoJSONSourceData",
setLayerZoomRange: "setLayerZoomRange",
setLayerProperty: "setLayerProperty",
setCenter: "setCenter",
setZoom: "setZoom",
setBearing: "setBearing",
setPitch: "setPitch",
setSprite: "setSprite",
setGlyphs: "setGlyphs",
setTransition: "setTransition",
setLight: "setLight",
setTerrain: "setTerrain",
setFog: "setFog",
setProjection: "setProjection"
};
function qe(e, t, i) {
i.push({
command: $e.addSource,
args: [e, t[e]]
})
}
function Ze(e, t, i) {
t.push({
command: $e.removeSource,
args: [e]
}),
i[e] = !0
}
function We(e, t, i, r) {
Ze(e, i, r),
qe(e, t, i)
}
function Xe(e, i, r) {
let n;
for (n in e[r])
if (e[r].hasOwnProperty(n) && "data" !== n && !t(e[r][n], i[r][n]))
return !1;
for (n in i[r])
if (i[r].hasOwnProperty(n) && "data" !== n && !t(e[r][n], i[r][n]))
return !1;
return !0
}
function He(e, i, r, n, o, s) {
let a;
for (a in i = i || {},
e = e || {})
e.hasOwnProperty(a) && (t(e[a], i[a]) || r.push({
command: s,
args: [n, a, i[a], o]
}));
for (a in i)
i.hasOwnProperty(a) && !e.hasOwnProperty(a) && (t(e[a], i[a]) || r.push({
command: s,
args: [n, a, i[a], o]
}))
}
function Ye(e) {
return e.id
}
function Ke(e, t) {
return e[t.id] = t,
e
}
class Je {
constructor(e, t) {
this.reset(e, t)
}
reset(e, t) {
this.points = e || [],
this._distances = [0];
for (let e = 1; e < this.points.length; e++)
this._distances[e] = this._distances[e - 1] + this.points[e].dist(this.points[e - 1]);
this.length = this._distances[this._distances.length - 1],
this.padding = Math.min(t || 0, .5 * this.length),
this.paddedLength = this.length - 2 * this.padding
}
lerp(t) {
if (1 === this.points.length)
return this.points[0];
t = e.clamp(t, 0, 1);
let i = 1
, r = this._distances[i];
const n = t * this.paddedLength + this.padding;
for (; r < n && i < this._distances.length; )
r = this._distances[++i];
const o = i - 1
, s = this._distances[o]
, a = r - s
, l = a > 0 ? (n - s) / a : 0;
return this.points[o].mult(1 - l).add(this.points[i].mult(l))
}
}
class Qe {
constructor(e, t, i) {
const r = this.boxCells = []
, n = this.circleCells = [];
this.xCellCount = Math.ceil(e / i),
this.yCellCount = Math.ceil(t / i);
for (let e = 0; e < this.xCellCount * this.yCellCount; e++)
r.push([]),
n.push([]);
this.circleKeys = [],
this.boxKeys = [],
this.bboxes = [],
this.circles = [],
this.width = e,
this.height = t,
this.xScale = this.xCellCount / e,
this.yScale = this.yCellCount / t,
this.boxUid = 0,
this.circleUid = 0
}
keysLength() {
return this.boxKeys.length + this.circleKeys.length
}
insert(e, t, i, r, n) {
this._forEachCell(t, i, r, n, this._insertBoxCell, this.boxUid++),
this.boxKeys.push(e),
this.bboxes.push(t),
this.bboxes.push(i),
this.bboxes.push(r),
this.bboxes.push(n)
}
insertCircle(e, t, i, r) {
this._forEachCell(t - r, i - r, t + r, i + r, this._insertCircleCell, this.circleUid++),
this.circleKeys.push(e),
this.circles.push(t),
this.circles.push(i),
this.circles.push(r)
}
_insertBoxCell(e, t, i, r, n, o) {
this.boxCells[n].push(o)
}
_insertCircleCell(e, t, i, r, n, o) {
this.circleCells[n].push(o)
}
_query(e, t, i, r, n, o) {
if (i < 0 || e > this.width || r < 0 || t > this.height)
return !n && [];
const s = [];
if (e <= 0 && t <= 0 && this.width <= i && this.height <= r) {
if (n)
return !0;
for (let e = 0; e < this.boxKeys.length; e++)
s.push({
key: this.boxKeys[e],
x1: this.bboxes[4 * e],
y1: this.bboxes[4 * e + 1],
x2: this.bboxes[4 * e + 2],
y2: this.bboxes[4 * e + 3]
});
for (let e = 0; e < this.circleKeys.length; e++) {
const t = this.circles[3 * e]
, i = this.circles[3 * e + 1]
, r = this.circles[3 * e + 2];
s.push({
key: this.circleKeys[e],
x1: t - r,
y1: i - r,
x2: t + r,
y2: i + r
})
}
return o ? s.filter(o) : s
}
return this._forEachCell(e, t, i, r, this._queryCell, s, {
hitTest: n,
seenUids: {
box: {},
circle: {}
}
}, o),
n ? s.length > 0 : s
}
_queryCircle(e, t, i, r, n) {
const o = e - i
, s = e + i
, a = t - i
, l = t + i;
if (s < 0 || o > this.width || l < 0 || a > this.height)
return !r && [];
const c = [];
return this._forEachCell(o, a, s, l, this._queryCellCircle, c, {
hitTest: r,
circle: {
x: e,
y: t,
radius: i
},
seenUids: {
box: {},
circle: {}
}
}, n),
r ? c.length > 0 : c
}
query(e, t, i, r, n) {
return this._query(e, t, i, r, !1, n)
}
hitTest(e, t, i, r, n) {
return this._query(e, t, i, r, !0, n)
}
hitTestCircle(e, t, i, r) {
return this._queryCircle(e, t, i, !0, r)
}
_queryCell(e, t, i, r, n, o, s, a) {
const l = s.seenUids
, c = this.boxCells[n];
if (null !== c) {
const n = this.bboxes;
for (const u of c)
if (!l.box[u]) {
l.box[u] = !0;
const c = 4 * u;
if (e <= n[c + 2] && t <= n[c + 3] && i >= n[c + 0] && r >= n[c + 1] && (!a || a(this.boxKeys[u]))) {
if (s.hitTest)
return o.push(!0),
!0;
o.push({
key: this.boxKeys[u],
x1: n[c],
y1: n[c + 1],
x2: n[c + 2],
y2: n[c + 3]
})
}
}
}
const u = this.circleCells[n];
if (null !== u) {
const n = this.circles;
for (const c of u)
if (!l.circle[c]) {
l.circle[c] = !0;
const u = 3 * c;
if (this._circleAndRectCollide(n[u], n[u + 1], n[u + 2], e, t, i, r) && (!a || a(this.circleKeys[c]))) {
if (s.hitTest)
return o.push(!0),
!0;
{
const e = n[u]
, t = n[u + 1]
, i = n[u + 2];
o.push({
key: this.circleKeys[c],
x1: e - i,
y1: t - i,
x2: e + i,
y2: t + i
})
}
}
}
}
}
_queryCellCircle(e, t, i, r, n, o, s, a) {
const l = s.circle
, c = s.seenUids
, u = this.boxCells[n];
if (null !== u) {
const e = this.bboxes;
for (const t of u)
if (!c.box[t]) {
c.box[t] = !0;
const i = 4 * t;
if (this._circleAndRectCollide(l.x, l.y, l.radius, e[i + 0], e[i + 1], e[i + 2], e[i + 3]) && (!a || a(this.boxKeys[t])))
return o.push(!0),
!0
}
}
const h = this.circleCells[n];
if (null !== h) {
const e = this.circles;
for (const t of h)
if (!c.circle[t]) {
c.circle[t] = !0;
const i = 3 * t;
if (this._circlesCollide(e[i], e[i + 1], e[i + 2], l.x, l.y, l.radius) && (!a || a(this.circleKeys[t])))
return o.push(!0),
!0
}
}
}
_forEachCell(e, t, i, r, n, o, s, a) {
const l = this._convertToXCellCoord(e)
, c = this._convertToYCellCoord(t)
, u = this._convertToXCellCoord(i)
, h = this._convertToYCellCoord(r);
for (let d = l; d <= u; d++)
for (let l = c; l <= h; l++)
if (n.call(this, e, t, i, r, this.xCellCount * l + d, o, s, a))
return
}
_convertToXCellCoord(e) {
return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(e * this.xScale)))
}
_convertToYCellCoord(e) {
return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(e * this.yScale)))
}
_circlesCollide(e, t, i, r, n, o) {
const s = r - e
, a = n - t
, l = i + o;
return l * l > s * s + a * a
}
_circleAndRectCollide(e, t, i, r, n, o, s) {
const a = (o - r) / 2
, l = Math.abs(e - (r + a));
if (l > a + i)
return !1;
const c = (s - n) / 2
, u = Math.abs(t - (n + c));
if (u > c + i)
return !1;
if (l <= a || u <= c)
return !0;
const h = l - a
, d = u - c;
return h * h + d * d <= i * i
}
}
const et = Math.tan(85 * Math.PI / 180);
function tt(t, i, r, n, o, s, a) {
const l = e.create();
if (r)
if ("globe" === s.name) {
const t = e.calculateGlobeLabelMatrix(o, i);
e.multiply(l, l, t)
} else {
const t = y([], a);
l[0] = t[0],
l[1] = t[1],
l[4] = t[2],
l[5] = t[3],
n || e.rotateZ(l, l, o.angle)
}
else
e.multiply(l, o.labelPlaneMatrix, t);
return l
}
function it(e, t, i, r, n, o, s) {
const a = tt(e, t, i, r, n, o, s);
return "globe" === o.name && i || (a[2] = a[6] = a[10] = a[14] = 0),
a
}
function rt(t, i, r, n, o, s, a) {
if (r) {
if ("globe" === s.name) {
const l = tt(t, i, r, n, o, s, a);
return e.invert(l, l),
e.multiply(l, t, l),
l
}
{
const i = e.clone(t)
, r = e.identity([]);
return r[0] = a[0],
r[1] = a[1],
r[4] = a[2],
r[5] = a[3],
e.multiply(i, i, r),
n || e.rotateZ(i, i, -o.angle),
i
}
}
return o.glCoordMatrix
}
function nt(t, i, r=0) {
const n = [t.x, t.y, r, 1];
r ? e.transformMat4$1(n, n, i) : gt(n, n, i);
const o = n[3];
return {
point: [n[0] / o, n[1] / o, n[2] / o],
signedDistanceFromCamera: o
}
}
function ot(t, i) {
const r = [t[0], t[1], t[2], 1];
e.transformMat4$1(r, r, i);
const n = r[3];
return {
point: [r[0] / n, r[1] / n, r[2] / n],
signedDistanceFromCamera: n
}
}
function st(e, t) {
return Math.min(.5 + e / t * .5, 1.5)
}
function at(e, t) {
const i = e[0] / e[3]
, r = e[1] / e[3];
return i >= -t[0] && i <= t[0] && r >= -t[1] && r <= t[1]
}
function lt(t, i, r, n, o, s, a, l, c, u) {
const h = r.transform
, d = n ? t.textSizeData : t.iconSizeData
, p = e.evaluateSizeForZoom(d, r.transform.zoom)
, f = "globe" === h.projection.name
, m = [256 / r.width * 2 + 1, 256 / r.height * 2 + 1]
, _ = n ? t.text.dynamicLayoutVertexArray : t.icon.dynamicLayoutVertexArray;
_.clear();
let g = null;
f && (g = n ? t.text.globeExtVertexArray : t.icon.globeExtVertexArray);
const y = t.lineVertexArray
, x = n ? t.text.placedSymbolArray : t.icon.placedSymbolArray
, v = r.transform.width / r.transform.height;
let b = !1;
for (let n = 0; n < x.length; n++) {
const f = x.get(n);
if (f.writingMode !== e.WritingMode.vertical || b || 0 !== n && x.get(n - 1).writingMode === e.WritingMode.horizontal || (b = !0),
(f.hidden || f.writingMode === e.WritingMode.vertical) && !b) {
_t(f.numGlyphs, _);
continue
}
b = !1;
const w = new e.pointGeometry(f.tileAnchorX,f.tileAnchorY)
, T = c ? c(w) : [0, 0, 0]
, E = h.projection.projectTilePoint(w.x, w.y, u.canonical)
, S = [E.x + T[0], E.y + T[1], E.z + T[2]]
, C = [...S, 1];
if (e.transformMat4$1(C, C, i),
!at(C, m)) {
_t(f.numGlyphs, _);
continue
}
const M = st(r.transform.cameraToCenterDistance, C[3])
, A = e.evaluateSizeForFeature(d, p, f)
, I = a ? A / M : A * M
, z = nt(new e.pointGeometry(S[0],S[1]), o, S[2]);
if (z.signedDistanceFromCamera <= 0) {
_t(f.numGlyphs, _);
continue
}
let k = {};
const P = a ? null : c
, D = ht(f, I, !1, l, i, o, s, t.glyphOffsetArray, y, _, g, z.point, w, k, v, P, h.projection, u, a);
b = D.useVertical,
P && D.needsFlipping && (k = {}),
(D.notEnoughRoom || b || D.needsFlipping && ht(f, I, !0, l, i, o, s, t.glyphOffsetArray, y, _, g, z.point, w, k, v, P, h.projection, u, a).notEnoughRoom) && _t(f.numGlyphs, _)
}
n ? (t.text.dynamicLayoutVertexBuffer.updateData(_),
g && t.text.globeExtVertexBuffer.updateData(g)) : (t.icon.dynamicLayoutVertexBuffer.updateData(_),
g && t.icon.globeExtVertexBuffer.updateData(g))
}
function ct(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m) {
const _ = a.glyphStartIndex + a.numGlyphs
, g = a.lineStartIndex
, y = a.lineStartIndex + a.lineLength
, x = t.getoffsetX(a.glyphStartIndex)
, v = t.getoffsetX(_ - 1)
, b = ft(e * x, i, r, n, o, s, a.segment, g, y, l, c, u, h, d, !0, p, f, m);
if (!b)
return null;
const w = ft(e * v, i, r, n, o, s, a.segment, g, y, l, c, u, h, d, !0, p, f, m);
return w ? {
first: b,
last: w
} : null
}
function ut(t, i, r, n) {
return t.writingMode === e.WritingMode.horizontal && Math.abs(r.y - i.y) > Math.abs(r.x - i.x) * n ? {
useVertical: !0
} : t.writingMode === e.WritingMode.vertical ? i.y < r.y ? {
needsFlipping: !0
} : null : 0 !== t.flipState && function(e, t, i) {
const r = (t.x - e.x) * i;
return 0 === r || Math.abs((t.y - e.y) / r) > et
}(i, r, n) ? 1 === t.flipState ? {
needsFlipping: !0
} : null : i.x > r.x ? {
needsFlipping: !0
} : null
}
function ht(t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y, x) {
const v = i / 24
, b = t.lineOffsetX * v
, w = t.lineOffsetY * v;
let T;
if (t.numGlyphs > 1) {
const i = t.glyphStartIndex + t.numGlyphs
, o = t.lineStartIndex
, u = t.lineStartIndex + t.lineLength
, h = ct(v, l, b, w, r, d, p, t, c, s, f, _, !1, g, y, x);
if (!h)
return {
notEnoughRoom: !0
};
const E = ot(h.first.point, a).point
, S = ot(h.last.point, a).point
, C = new e.pointGeometry(E[0],E[1])
, M = new e.pointGeometry(S[0],S[1]);
if (n && !r) {
const e = ut(t, C, M, m);
if (t.flipState = e && e.needsFlipping ? 1 : 2,
e)
return e
}
T = [h.first];
for (let e = t.glyphStartIndex + 1; e < i - 1; e++)
T.push(ft(v * l.getoffsetX(e), b, w, r, d, p, t.segment, o, u, c, s, f, _, !1, !1, g, y, x));
T.push(h.last)
} else {
if (n && !r) {
const i = nt(p, o).point
, r = t.lineStartIndex + t.segment + 1
, n = new e.pointGeometry(c.getx(r),c.gety(r))
, s = nt(n, o)
, a = s.signedDistanceFromCamera > 0 ? s.point : pt(p, n, i, 1, o, void 0, g, y.canonical)
, l = ut(t, new e.pointGeometry(i[0],i[1]), new e.pointGeometry(a[0],a[1]), m);
if (t.flipState = l && l.needsFlipping ? 1 : 2,
l)
return l
}
const i = ft(v * l.getoffsetX(t.glyphStartIndex), b, w, r, d, p, t.segment, t.lineStartIndex, t.lineStartIndex + t.lineLength, c, s, f, _, !1, !1, g, y, x);
if (!i)
return {
notEnoughRoom: !0
};
T = [i]
}
if (h)
for (const t of T)
e.updateGlobeVertexNormal(h, u.length + 0, t.up[0], t.up[1], t.up[2]),
e.updateGlobeVertexNormal(h, u.length + 1, t.up[0], t.up[1], t.up[2]),
e.updateGlobeVertexNormal(h, u.length + 2, t.up[0], t.up[1], t.up[2]),
e.updateGlobeVertexNormal(h, u.length + 3, t.up[0], t.up[1], t.up[2]),
e.addDynamicAttributes(u, t.point[0], t.point[1], t.point[2], t.angle);
else
for (const t of T)
e.addDynamicAttributes(u, t.point[0], t.point[1], t.point[2], t.angle);
return {}
}
function dt(t, i, r, n, o) {
const s = n.projectTilePoint(t.x, t.y, i);
if (!o)
return nt(s, r, s.z);
const a = o(t);
return nt(new e.pointGeometry(s.x + a[0],s.y + a[1]), r, s.z + a[2])
}
function pt(t, i, r, n, o, s, a, l) {
const c = dt(t.add(t.sub(i)._unit()), l, o, a, s).point
, u = e.sub([], r, c);
return e.scaleAndAdd([], r, u, n / e.length(u))
}
function ft(t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g, y) {
const x = n ? t - i : t + i;
let v = x > 0 ? 1 : -1
, b = 0;
n && (v *= -1,
b = Math.PI),
v < 0 && (b += Math.PI);
let w = v > 0 ? l + a : l + a + 1
, T = o
, E = o
, S = 0
, C = 0;
const M = Math.abs(x)
, A = []
, I = [];
let z = s;
const k = ()=>{
const t = w - v;
return 0 === S ? s : new e.pointGeometry(u.getx(t),u.gety(t))
}
, P = ()=>pt(k(), z, E, M - S + 1, h, p, _, g.canonical);
for (; S + C <= M; ) {
if (w += v,
w < l || w >= c)
return null;
if (E = T,
A.push(T),
f && I.push(z || k()),
T = d[w],
void 0 === T) {
z = new e.pointGeometry(u.getx(w),u.gety(w));
const t = dt(z, g.canonical, h, _, p);
T = t.signedDistanceFromCamera > 0 ? d[w] = t.point : P()
} else
z = null;
S += C,
C = e.distance(E, T)
}
z = z || new e.pointGeometry(u.getx(w),u.gety(w));
const D = k();
m && p && (d[w] = T = void 0 === d[w] ? T : P(),
C = e.distance(E, T));
const L = (M - S) / C
, B = z.sub(D).mult(L)._add(D)
, O = e.sub([], T, E)
, R = e.scaleAndAdd([], E, O, L);
let F = [0, 0, 1]
, U = O[0]
, V = O[1];
if (y && (F = _.upVector(g.canonical, B.x, B.y),
0 !== F[0] || 0 !== F[1] || 1 !== F[2])) {
const t = [1, 0, 0]
, i = [0, 1, 0];
t[0] = F[2],
t[1] = 0,
t[2] = -F[0],
e.cross(i, F, t),
e.normalize(t, t),
e.normalize(i, i),
U = e.dot(O, t),
V = e.dot(O, i)
}
if (r) {
const t = e.cross([], F, O);
e.normalize(t, t),
e.scaleAndAdd(R, R, t, r * v)
}
const j = b + Math.atan2(V, U);
return A.push(R),
f && I.push(B),
{
point: R,
angle: j,
path: A,
tilePath: I,
up: F
}
}
const mt = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]);
function _t(e, t) {
for (let i = 0; i < e; i++) {
const e = t.length;
t.resize(e + 4),
t.float32.set(mt, 4 * e)
}
}
function gt(e, t, i) {
const r = t[0]
, n = t[1];
return e[0] = i[0] * r + i[4] * n + i[12],
e[1] = i[1] * r + i[5] * n + i[13],
e[3] = i[3] * r + i[7] * n + i[15],
e
}
const yt = 100;
class xt {
constructor(e, t, i=new Qe(e.width + 200,e.height + 200,25), r=new Qe(e.width + 200,e.height + 200,25)) {
this.transform = e,
this.grid = i,
this.ignoredGrid = r,
this.pitchfactor = Math.cos(e._pitch) * e.cameraToCenterDistance,
this.screenRightBoundary = e.width + yt,
this.screenBottomBoundary = e.height + yt,
this.gridRightBoundary = e.width + 200,
this.gridBottomBoundary = e.height + 200,
this.fogState = t
}
placeCollisionBox(e, t, i, r, n, o, s, a) {
let l = i.projectedAnchorX
, c = i.projectedAnchorY
, u = i.projectedAnchorZ;
const h = i.elevation
, d = i.tileID;
if (h && d) {
const t = e.getProjection().upVector(d.canonical, i.tileAnchorX, i.tileAnchorY)
, r = e.getProjection().upVectorScale(d.canonical, this.transform.center.lat, this.transform.worldSize).metersToTile;
l += t[0] * h * r,
c += t[1] * h * r,
u += t[2] * h * r
}
const p = this.projectAndGetPerspectiveRatio(s, [l, c, u], i.tileID, "globe" === e.projection.name || !!h || this.transform.pitch > 0, e.getProjection())
, f = o * p.perspectiveRatio
, m = (i.x1 * t + r.x - i.padding) * f + p.point.x
, _ = (i.y1 * t + r.y - i.padding) * f + p.point.y
, g = (i.x2 * t + r.x + i.padding) * f + p.point.x
, y = (i.y2 * t + r.y + i.padding) * f + p.point.y
, x = p.perspectiveRatio <= .55 || p.occluded;
return !this.isInsideGrid(m, _, g, y) || !n && this.grid.hitTest(m, _, g, y, a) || x ? {
box: [],
offscreen: !1,
occluded: p.occluded
} : {
box: [m, _, g, y],
offscreen: this.isOffscreen(m, _, g, y),
occluded: !1
}
}
placeCollisionCircles(t, i, r, n, o, s, a, l, c, u, h, d, p, f, m) {
const _ = []
, g = this.transform.elevation
, y = g ? g.getAtTileOffsetFunc(m, this.transform.center.lat, this.transform.worldSize, t.getProjection()) : e=>[0, 0, 0]
, x = new e.pointGeometry(r.tileAnchorX,r.tileAnchorY)
, v = t.getProjection().projectTilePoint(r.tileAnchorX, r.tileAnchorY, m.canonical)
, b = y(x)
, w = [v.x + b[0], v.y + b[1], v.z + b[2]]
, T = "globe" === t.projection.name
, E = this.projectAndGetPerspectiveRatio(a, [w[0], w[1], w[2]], m, T || !!g || this.transform.pitch > 0, t.getProjection())
, {perspectiveRatio: S} = E
, C = (h ? s / S : s * S) / e.ONE_EM
, M = nt(new e.pointGeometry(w[0],w[1]), l, w[2]).point
, A = E.signedDistanceFromCamera > 0 ? ct(C, o, r.lineOffsetX * C, r.lineOffsetY * C, !1, M, x, r, n, l, {}, g && !h ? y : null, h && !!g, t.getProjection(), m, h) : null;
let I = !1
, z = !1
, k = !0;
if (A && !E.occluded) {
const t = .5 * p * S + f
, r = new e.pointGeometry(-100,-100)
, n = new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary)
, o = new Je
, s = A.first
, a = A.last;
let l = [];
for (let e = s.path.length - 1; e >= 1; e--)
l.push(s.path[e]);
for (let e = 1; e < a.path.length; e++)
l.push(a.path[e]);
const h = 2.5 * t;
if (c) {
const e = l.map(g && !T ? (e,t)=>{
const i = y(t < s.path.length - 1 ? s.tilePath[s.path.length - 1 - t] : a.tilePath[t - s.path.length + 2]);
return e[2] = i[2],
ot(e, c)
}
: e=>ot(e, c));
l = e.some((e=>e.signedDistanceFromCamera <= 0)) ? [] : e.map((e=>e.point))
}
let m = [];
if (l.length > 0) {
const t = l.map((t=>new e.pointGeometry(t[0],t[1])));
let i = 1 / 0
, o = -1 / 0
, s = 1 / 0
, a = -1 / 0;
for (let e = 0; e < t.length; e++)
i = Math.min(i, t[e].x),
s = Math.min(s, t[e].y),
o = Math.max(o, t[e].x),
a = Math.max(a, t[e].y);
m = i >= r.x && o <= n.x && s >= r.y && a <= n.y ? [t] : o < r.x || i > n.x || a < r.y || s > n.y ? [] : e.clipLine([t], r.x, r.y, n.x, n.y)
}
for (const e of m) {
o.reset(e, .25 * t);
let r = 0;
r = o.length <= .5 * t ? 1 : Math.ceil(o.paddedLength / h) + 1;
for (let e = 0; e < r; e++) {
const n = e / Math.max(r - 1, 1)
, s = o.lerp(n)
, a = s.x + yt
, l = s.y + yt;
_.push(a, l, t, 0);
const c = a - t
, h = l - t
, p = a + t
, f = l + t;
if (k = k && this.isOffscreen(c, h, p, f),
z = z || this.isInsideGrid(c, h, p, f),
!i && this.grid.hitTestCircle(a, l, t, d) && (I = !0,
!u))
return {
circles: [],
offscreen: !1,
collisionDetected: I,
occluded: !1
}
}
}
}
return {
circles: !u && I || !z ? [] : _,
offscreen: k,
collisionDetected: I,
occluded: E.occluded
}
}
queryRenderedSymbols(t) {
if (0 === t.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength())
return {};
const i = [];
let r = 1 / 0
, n = 1 / 0
, o = -1 / 0
, s = -1 / 0;
for (const a of t) {
const t = new e.pointGeometry(a.x + yt,a.y + yt);
r = Math.min(r, t.x),
n = Math.min(n, t.y),
o = Math.max(o, t.x),
s = Math.max(s, t.y),
i.push(t)
}
const a = this.grid.query(r, n, o, s).concat(this.ignoredGrid.query(r, n, o, s))
, l = {}
, c = {};
for (const t of a) {
const r = t.key;
if (void 0 === l[r.bucketInstanceId] && (l[r.bucketInstanceId] = {}),
l[r.bucketInstanceId][r.featureIndex])
continue;
const n = [new e.pointGeometry(t.x1,t.y1), new e.pointGeometry(t.x2,t.y1), new e.pointGeometry(t.x2,t.y2), new e.pointGeometry(t.x1,t.y2)];
e.polygonIntersectsPolygon(i, n) && (l[r.bucketInstanceId][r.featureIndex] = !0,
void 0 === c[r.bucketInstanceId] && (c[r.bucketInstanceId] = []),
c[r.bucketInstanceId].push(r.featureIndex))
}
return c
}
insertCollisionBox(e, t, i, r, n) {
(t ? this.ignoredGrid : this.grid).insert({
bucketInstanceId: i,
featureIndex: r,
collisionGroupID: n
}, e[0], e[1], e[2], e[3])
}
insertCollisionCircles(e, t, i, r, n) {
const o = t ? this.ignoredGrid : this.grid
, s = {
bucketInstanceId: i,
featureIndex: r,
collisionGroupID: n
};
for (let t = 0; t < e.length; t += 4)
o.insertCircle(s, e[t], e[t + 1], e[t + 2])
}
projectAndGetPerspectiveRatio(t, i, r, n, o) {
const s = [i[0], i[1], i[2], 1];
let a = !1;
if (i[2] || this.transform.pitch > 0) {
e.transformMat4$1(s, s, t);
const n = "globe" === o.name;
this.fogState && r && !n && (a = function(t, i, r, n, o, s) {
const a = s.calculateFogTileMatrix(o)
, l = [i, r, n];
return e.transformMat4(l, l, a),
M(t, l, s.pitch, s._fov)
}(this.fogState, i[0], i[1], i[2], r.toUnwrapped(), this.transform) > .9)
} else
gt(s, s, t);
return {
point: new e.pointGeometry((s[0] / s[3] + 1) / 2 * this.transform.width + yt,(-s[1] / s[3] + 1) / 2 * this.transform.height + yt),
perspectiveRatio: Math.min(.5 + this.transform.getCameraToCenterDistance(o) / s[3] * .5, 1.5),
signedDistanceFromCamera: s[3],
occluded: n && s[2] > s[3] || a
}
}
isOffscreen(e, t, i, r) {
return i < yt || e >= this.screenRightBoundary || r < yt || t > this.screenBottomBoundary
}
isInsideGrid(e, t, i, r) {
return i >= 0 && e < this.gridRightBoundary && r >= 0 && t < this.gridBottomBoundary
}
getViewportMatrix() {
const t = e.identity([]);
return e.translate(t, t, [-100, -100, 0]),
t
}
}
function vt(t, i, r) {
const n = i.createTileMatrix(t, t.worldSize, r.toUnwrapped());
return e.multiply(new Float32Array(16), t.projMatrix, n)
}
function bt(e, t, i) {
if (t.projection.name === i.projection.name)
return e.projMatrix;
const r = i.clone();
return r.setProjection(t.projection),
vt(r, t.getProjection(), e)
}
function wt(e, t, i) {
return t.name === i.projection.name ? e.projMatrix : vt(i, t, e)
}
class Tt {
constructor(e, t, i, r) {
this.opacity = e ? Math.max(0, Math.min(1, e.opacity + (e.placed ? t : -t))) : r && i ? 1 : 0,
this.placed = i
}
isHidden() {
return 0 === this.opacity && !this.placed
}
}
class Et {
constructor(e, t, i, r, n, o=!1) {
this.text = new Tt(e ? e.text : null,t,i,n),
this.icon = new Tt(e ? e.icon : null,t,r,n),
this.clipped = o
}
isHidden() {
return this.text.isHidden() && this.icon.isHidden()
}
}
class St {
constructor(e, t, i, r=!1) {
this.text = e,
this.icon = t,
this.skipFade = i,
this.clipped = r
}
}
class Ct {
constructor() {
this.invProjMatrix = e.create(),
this.viewportMatrix = e.create(),
this.circles = []
}
}
class Mt {
constructor(e, t, i, r, n) {
this.bucketInstanceId = e,
this.featureIndex = t,
this.sourceLayerIndex = i,
this.bucketIndex = r,
this.tileID = n
}
}
class At {
constructor(e) {
this.crossSourceCollisions = e,
this.maxGroupID = 0,
this.collisionGroups = {}
}
get(e) {
if (this.crossSourceCollisions)
return {
ID: 0,
predicate: null
};
if (!this.collisionGroups[e]) {
const t = ++this.maxGroupID;
this.collisionGroups[e] = {
ID: t,
predicate: e=>e.collisionGroupID === t
}
}
return this.collisionGroups[e]
}
}
function It(t, i, r, n, o) {
const {horizontalAlign: s, verticalAlign: a} = e.getAnchorAlignment(t)
, l = -(s - .5) * i
, c = -(a - .5) * r
, u = e.evaluateVariableOffset(t, n);
return new e.pointGeometry(l + u[0] * o,c + u[1] * o)
}
function zt(t, i, r, n, o) {
const s = new e.pointGeometry(t,i);
return r && s._rotate(n ? o : -o),
s
}
class kt {
constructor(e, t, i, r, n) {
this.transform = e.clone(),
this.projection = e.projection.name,
this.collisionIndex = new xt(this.transform,n),
this.placements = {},
this.opacities = {},
this.variableOffsets = {},
this.stale = !1,
this.commitTime = 0,
this.fadeDuration = t,
this.retainedQueryData = {},
this.collisionGroups = new At(i),
this.collisionCircleArrays = {},
this.prevPlacement = r,
r && (r.prevPlacement = void 0),
this.placedOrientations = {}
}
getBucketParts(t, i, r, n) {
const o = r.getBucket(i)
, s = r.latestFeatureIndex;
if (!o || !s || i.id !== o.layerIds[0])
return;
const a = o.layers[0].layout
, l = r.collisionBoxArray
, c = Math.pow(2, this.transform.zoom - r.tileID.overscaledZ)
, u = r.tileSize / e.EXTENT
, h = r.tileID.toUnwrapped();
this.transform.setProjection(o.projection);
const d = (p = r.tileID,
f = o.getProjection(),
m = this.transform,
f.name === this.projection ? m.calculateProjMatrix(p.toUnwrapped()) : vt(m, f, p));
var p, f, m;
const _ = "map" === a.get("text-pitch-alignment")
, g = "map" === a.get("text-rotation-alignment");
i.compileFilter();
const y = i.dynamicFilter()
, x = i.dynamicFilterNeedsFeature()
, v = this.transform.calculatePixelsToTileUnitsMatrix(r)
, b = it(d, r.tileID.canonical, _, g, this.transform, o.getProjection(), v);
let w = null;
if (_) {
const t = rt(d, r.tileID.canonical, _, g, this.transform, o.getProjection(), v);
w = e.multiply([], this.transform.labelPlaneMatrix, t)
}
let T = null;
y && r.latestFeatureIndex && (T = {
unwrappedTileID: h,
dynamicFilter: y,
dynamicFilterNeedsFeature: x,
featureIndex: r.latestFeatureIndex
}),
this.retainedQueryData[o.bucketInstanceId] = new Mt(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);
const E = {
bucket: o,
layout: a,
posMatrix: d,
textLabelPlaneMatrix: b,
labelToScreenMatrix: w,
clippingData: T,
scale: c,
textPixelRatio: u,
holdingForFade: r.holdingForFade(),
collisionBoxArray: l,
partiallyEvaluatedTextSize: e.evaluateSizeForZoom(o.textSizeData, this.transform.zoom),
partiallyEvaluatedIconSize: e.evaluateSizeForZoom(o.iconSizeData, this.transform.zoom),
collisionGroup: this.collisionGroups.get(o.sourceID)
};
if (n)
for (const e of o.sortKeyRanges) {
const {sortKey: i, symbolInstanceStart: r, symbolInstanceEnd: n} = e;
t.push({
sortKey: i,
symbolInstanceStart: r,
symbolInstanceEnd: n,
parameters: E
})
}
else
t.push({
symbolInstanceStart: 0,
symbolInstanceEnd: o.symbolInstances.length,
parameters: E
})
}
attemptAnchorPlacement(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f, m, _, g) {
const y = [h.textOffset0, h.textOffset1]
, x = It(e, i, r, y, n)
, v = this.collisionIndex.placeCollisionBox(p, n, t, zt(x.x, x.y, o, s, this.transform.angle), u, a, l, c.predicate);
if ((!m || 0 !== this.collisionIndex.placeCollisionBox(p, p.getSymbolInstanceIconSize(g, this.transform.zoom, d), m, zt(x.x, x.y, o, s, this.transform.angle), u, a, l, c.predicate).box.length) && v.box.length > 0) {
let t;
return this.prevPlacement && this.prevPlacement.variableOffsets[h.crossTileID] && this.prevPlacement.placements[h.crossTileID] && this.prevPlacement.placements[h.crossTileID].text && (t = this.prevPlacement.variableOffsets[h.crossTileID].anchor),
this.variableOffsets[h.crossTileID] = {
textOffset: y,
width: i,
height: r,
anchor: e,
textScale: n,
prevAnchor: t
},
this.markUsedJustification(p, e, h, f),
p.allowVerticalPlacement && (this.markUsedOrientation(p, f, h),
this.placedOrientations[h.crossTileID] = f),
{
shift: x,
placedGlyphBoxes: v
}
}
}
placeLayerBucketPart(t, i, r, n) {
const {bucket: o, layout: s, posMatrix: a, textLabelPlaneMatrix: l, labelToScreenMatrix: c, clippingData: u, textPixelRatio: h, holdingForFade: d, collisionBoxArray: p, partiallyEvaluatedTextSize: f, partiallyEvaluatedIconSize: m, collisionGroup: _} = t.parameters
, g = s.get("text-optional")
, y = s.get("icon-optional")
, x = s.get("text-allow-overlap")
, v = s.get("icon-allow-overlap")
, b = "map" === s.get("text-rotation-alignment")
, w = "map" === s.get("text-pitch-alignment")
, T = "none" !== s.get("icon-text-fit")
, E = "viewport-y" === s.get("symbol-z-order");
this.transform.setProjection(o.projection);
let S = x && (v || !o.hasIconData() || y)
, C = v && (x || !o.hasTextData() || g);
!o.collisionArrays && p && o.deserializeCollisionBoxes(p),
r && n && o.updateCollisionDebugBuffers(this.transform.zoom, p);
const M = (t,n,p)=>{
if (u) {
const r = {
zoom: this.transform.zoom,
pitch: this.transform.pitch
};
let n = null;
if (u.dynamicFilterNeedsFeature) {
const e = this.retainedQueryData[o.bucketInstanceId];
n = u.featureIndex.loadFeature({
featureIndex: t.featureIndex,
bucketIndex: e.bucketIndex,
sourceLayerIndex: e.sourceLayerIndex,
layoutVertexArrayOffset: 0
})
}
if (!(0,
u.dynamicFilter)(r, n, this.retainedQueryData[o.bucketInstanceId].tileID.canonical, new e.pointGeometry(t.tileAnchorX,t.tileAnchorY), this.transform.calculateDistanceTileData(u.unwrappedTileID)))
return this.placements[t.crossTileID] = new St(!1,!1,!1,!0),
void (i[t.crossTileID] = !0)
}
if (i[t.crossTileID])
return;
if (d)
return void (this.placements[t.crossTileID] = new St(!1,!1,!1));
let E = !1
, M = !1
, A = !0
, I = !1
, z = !1
, k = null
, P = {
box: null,
offscreen: null,
occluded: null
}
, D = {
box: null,
offscreen: null,
occluded: null
}
, L = null
, B = null
, O = null
, R = 0
, F = 0
, U = 0;
p.textFeatureIndex ? R = p.textFeatureIndex : t.useRuntimeCollisionCircles && (R = t.featureIndex),
p.verticalTextFeatureIndex && (F = p.verticalTextFeatureIndex);
const V = e=>{
e.tileID = this.retainedQueryData[o.bucketInstanceId].tileID,
(this.transform.elevation || e.elevation) && (e.elevation = this.transform.elevation ? this.transform.elevation.getAtTileOffset(this.retainedQueryData[o.bucketInstanceId].tileID, e.tileAnchorX, e.tileAnchorY) : 0)
}
, j = p.textBox;
if (j) {
V(j);
const i = i=>{
let r = e.WritingMode.horizontal;
if (o.allowVerticalPlacement && !i && this.prevPlacement) {
const e = this.prevPlacement.placedOrientations[t.crossTileID];
e && (this.placedOrientations[t.crossTileID] = e,
r = e,
this.markUsedOrientation(o, r, t))
}
return r
}
, r = (i,r)=>{
if (o.allowVerticalPlacement && t.numVerticalGlyphVertices > 0 && p.verticalTextBox) {
for (const t of o.writingModes)
if (t === e.WritingMode.vertical ? (P = r(),
D = P) : P = i(),
P && P.box && P.box.length)
break
} else
P = i()
}
;
if (s.get("text-variable-anchor")) {
let l = s.get("text-variable-anchor");
if (this.prevPlacement && this.prevPlacement.variableOffsets[t.crossTileID]) {
const e = this.prevPlacement.variableOffsets[t.crossTileID];
l.indexOf(e.anchor) > 0 && (l = l.filter((t=>t !== e.anchor)),
l.unshift(e.anchor))
}
const c = (e,i,r)=>{
const s = o.getSymbolInstanceTextSize(f, t, this.transform.zoom, n)
, c = (e.x2 - e.x1) * s + 2 * e.padding
, u = (e.y2 - e.y1) * s + 2 * e.padding
, d = T && !v ? i : null;
d && V(d);
let p = {
box: [],
offscreen: !1,
occluded: !1
};
const g = x ? 2 * l.length : l.length;
for (let i = 0; i < g; ++i) {
const g = this.attemptAnchorPlacement(l[i % l.length], e, c, u, s, b, w, h, a, _, i >= l.length, t, n, o, r, d, f, m);
if (g && (p = g.placedGlyphBoxes,
p && p.box && p.box.length)) {
E = !0,
k = g.shift;
break
}
}
return p
}
;
r((()=>c(j, p.iconBox, e.WritingMode.horizontal)), (()=>{
const i = p.verticalTextBox;
return i && V(i),
o.allowVerticalPlacement && !(P && P.box && P.box.length) && t.numVerticalGlyphVertices > 0 && i ? c(i, p.verticalIconBox, e.WritingMode.vertical) : {
box: null,
offscreen: null,
occluded: null
}
}
)),
P && (E = P.box,
A = P.offscreen,
I = P.occluded);
const u = i(P && P.box);
if (!E && this.prevPlacement) {
const e = this.prevPlacement.variableOffsets[t.crossTileID];
e && (this.variableOffsets[t.crossTileID] = e,
this.markUsedJustification(o, e.anchor, t, u))
}
} else {
const s = (i,r)=>{
const s = o.getSymbolInstanceTextSize(f, t, this.transform.zoom, n)
, l = this.collisionIndex.placeCollisionBox(o, s, i, new e.pointGeometry(0,0), x, h, a, _.predicate);
return l && l.box && l.box.length && (this.markUsedOrientation(o, r, t),
this.placedOrientations[t.crossTileID] = r),
l
}
;
r((()=>s(j, e.WritingMode.horizontal)), (()=>{
const i = p.verticalTextBox;
return o.allowVerticalPlacement && t.numVerticalGlyphVertices > 0 && i ? (V(i),
s(i, e.WritingMode.vertical)) : {
box: null,
offscreen: null,
occluded: null
}
}
)),
i(P && P.box && P.box.length)
}
}
if (L = P,
E = L && L.box && L.box.length > 0,
A = L && L.offscreen,
I = L && L.occluded,
t.useRuntimeCollisionCircles) {
const i = o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex >= 0 ? t.centerJustifiedTextSymbolIndex : t.verticalPlacedTextSymbolIndex)
, n = e.evaluateSizeForFeature(o.textSizeData, f, i)
, u = s.get("text-padding");
B = this.collisionIndex.placeCollisionCircles(o, x, i, o.lineVertexArray, o.glyphOffsetArray, n, a, l, c, r, w, _.predicate, t.collisionCircleDiameter * n / e.ONE_EM, u, this.retainedQueryData[o.bucketInstanceId].tileID),
E = x || B.circles.length > 0 && !B.collisionDetected,
A = A && B.offscreen,
I = B.occluded
}
if (p.iconFeatureIndex && (U = p.iconFeatureIndex),
p.iconBox) {
const t = t=>{
V(t);
const i = T && k ? zt(k.x, k.y, b, w, this.transform.angle) : new e.pointGeometry(0,0)
, r = o.getSymbolInstanceIconSize(m, this.transform.zoom, n);
return this.collisionIndex.placeCollisionBox(o, r, t, i, v, h, a, _.predicate)
}
;
D && D.box && D.box.length && p.verticalIconBox ? (O = t(p.verticalIconBox),
M = O.box.length > 0) : (O = t(p.iconBox),
M = O.box.length > 0),
A = A && O.offscreen,
z = O.occluded
}
const N = g || 0 === t.numHorizontalGlyphVertices && 0 === t.numVerticalGlyphVertices
, G = y || 0 === t.numIconVertices;
if (N || G ? G ? N || (M = M && E) : E = M && E : M = E = M && E,
E && L && L.box && this.collisionIndex.insertCollisionBox(L.box, s.get("text-ignore-placement"), o.bucketInstanceId, D && D.box && F ? F : R, _.ID),
M && O && this.collisionIndex.insertCollisionBox(O.box, s.get("icon-ignore-placement"), o.bucketInstanceId, U, _.ID),
B && (E && this.collisionIndex.insertCollisionCircles(B.circles, s.get("text-ignore-placement"), o.bucketInstanceId, R, _.ID),
r)) {
const e = o.bucketInstanceId;
let t = this.collisionCircleArrays[e];
void 0 === t && (t = this.collisionCircleArrays[e] = new Ct);
for (let e = 0; e < B.circles.length; e += 4)
t.circles.push(B.circles[e + 0]),
t.circles.push(B.circles[e + 1]),
t.circles.push(B.circles[e + 2]),
t.circles.push(B.collisionDetected ? 1 : 0)
}
const $ = "globe" !== o.projection.name;
S = S && ($ || !I),
C = C && ($ || !z),
this.placements[t.crossTileID] = new St(E || S,M || C,A || o.justReloaded),
i[t.crossTileID] = !0
}
;
if (E) {
const e = o.getSortedSymbolIndexes(this.transform.angle);
for (let t = e.length - 1; t >= 0; --t) {
const i = e[t];
M(o.symbolInstances.get(i), i, o.collisionArrays[i])
}
} else
for (let e = t.symbolInstanceStart; e < t.symbolInstanceEnd; e++)
M(o.symbolInstances.get(e), e, o.collisionArrays[e]);
if (r && o.bucketInstanceId in this.collisionCircleArrays) {
const t = this.collisionCircleArrays[o.bucketInstanceId];
e.invert(t.invProjMatrix, a),
t.viewportMatrix = this.collisionIndex.getViewportMatrix()
}
o.justReloaded = !1
}
markUsedJustification(t, i, r, n) {
let o;
o = n === e.WritingMode.vertical ? r.verticalPlacedTextSymbolIndex : {
left: r.leftJustifiedTextSymbolIndex,
center: r.centerJustifiedTextSymbolIndex,
right: r.rightJustifiedTextSymbolIndex
}[e.getAnchorJustification(i)];
const s = [r.leftJustifiedTextSymbolIndex, r.centerJustifiedTextSymbolIndex, r.rightJustifiedTextSymbolIndex, r.verticalPlacedTextSymbolIndex];
for (const e of s)
e >= 0 && (t.text.placedSymbolArray.get(e).crossTileID = o >= 0 && e !== o ? 0 : r.crossTileID)
}
markUsedOrientation(t, i, r) {
const n = i === e.WritingMode.horizontal || i === e.WritingMode.horizontalOnly ? i : 0
, o = i === e.WritingMode.vertical ? i : 0
, s = [r.leftJustifiedTextSymbolIndex, r.centerJustifiedTextSymbolIndex, r.rightJustifiedTextSymbolIndex];
for (const e of s)
t.text.placedSymbolArray.get(e).placedOrientation = n;
r.verticalPlacedTextSymbolIndex && (t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation = o)
}
commit(e) {
this.commitTime = e,
this.zoomAtLastRecencyCheck = this.transform.zoom;
const t = this.prevPlacement;
let i = !1;
this.prevZoomAdjustment = t ? t.zoomAdjustment(this.transform.zoom) : 0;
const r = t ? t.symbolFadeChange(e) : 1
, n = t ? t.opacities : {}
, o = t ? t.variableOffsets : {}
, s = t ? t.placedOrientations : {};
for (const e in this.placements) {
const t = this.placements[e]
, o = n[e];
o ? (this.opacities[e] = new Et(o,r,t.text,t.icon,null,t.clipped),
i = i || t.text !== o.text.placed || t.icon !== o.icon.placed) : (this.opacities[e] = new Et(null,r,t.text,t.icon,t.skipFade,t.clipped),
i = i || t.text || t.icon)
}
for (const e in n) {
const t = n[e];
if (!this.opacities[e]) {
const n = new Et(t,r,!1,!1);
n.isHidden() || (this.opacities[e] = n,
i = i || t.text.placed || t.icon.placed)
}
}
for (const e in o)
this.variableOffsets[e] || !this.opacities[e] || this.opacities[e].isHidden() || (this.variableOffsets[e] = o[e]);
for (const e in s)
this.placedOrientations[e] || !this.opacities[e] || this.opacities[e].isHidden() || (this.placedOrientations[e] = s[e]);
i ? this.lastPlacementChangeTime = e : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = t ? t.lastPlacementChangeTime : e)
}
updateLayerOpacities(e, t) {
const i = {};
for (const r of t) {
const t = r.getBucket(e);
t && r.latestFeatureIndex && e.id === t.layerIds[0] && this.updateBucketOpacities(t, i, r.collisionBoxArray)
}
}
updateBucketOpacities(t, i, r) {
t.hasTextData() && t.text.opacityVertexArray.clear(),
t.hasIconData() && t.icon.opacityVertexArray.clear(),
t.hasIconCollisionBoxData() && t.iconCollisionBox.collisionVertexArray.clear(),
t.hasTextCollisionBoxData() && t.textCollisionBox.collisionVertexArray.clear();
const n = t.layers[0].layout
, o = !!t.layers[0].dynamicFilter()
, s = new Et(null,0,!1,!1,!0)
, a = n.get("text-allow-overlap")
, l = n.get("icon-allow-overlap")
, c = n.get("text-variable-anchor")
, u = "map" === n.get("text-rotation-alignment")
, h = "map" === n.get("text-pitch-alignment")
, d = "none" !== n.get("icon-text-fit")
, p = new Et(null,0,a && (l || !t.hasIconData() || n.get("icon-optional")),l && (a || !t.hasTextData() || n.get("text-optional")),!0);
!t.collisionArrays && r && (t.hasIconCollisionBoxData() || t.hasTextCollisionBoxData()) && t.deserializeCollisionBoxes(r);
const f = (e,t,i)=>{
for (let r = 0; r < t / 4; r++)
e.opacityVertexArray.emplaceBack(i)
}
;
let m = 0;
for (let r = 0; r < t.symbolInstances.length; r++) {
const n = t.symbolInstances.get(r)
, {numHorizontalGlyphVertices: a, numVerticalGlyphVertices: l, crossTileID: _} = n;
let g = this.opacities[_];
i[_] ? g = s : g || (g = p,
this.opacities[_] = g),
i[_] = !0;
const y = a > 0 || l > 0
, x = n.numIconVertices > 0
, v = this.placedOrientations[n.crossTileID]
, b = v === e.WritingMode.vertical
, w = v === e.WritingMode.horizontal || v === e.WritingMode.horizontalOnly;
if (!y && !x || g.isHidden() || m++,
y) {
const e = Vt(g.text);
f(t.text, a, b ? jt : e),
f(t.text, l, w ? jt : e);
const i = g.text.isHidden();
[n.rightJustifiedTextSymbolIndex, n.centerJustifiedTextSymbolIndex, n.leftJustifiedTextSymbolIndex].forEach((e=>{
e >= 0 && (t.text.placedSymbolArray.get(e).hidden = i || b ? 1 : 0)
}
)),
n.verticalPlacedTextSymbolIndex >= 0 && (t.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden = i || w ? 1 : 0);
const r = this.variableOffsets[n.crossTileID];
r && this.markUsedJustification(t, r.anchor, n, v);
const o = this.placedOrientations[n.crossTileID];
o && (this.markUsedJustification(t, "left", n, o),
this.markUsedOrientation(t, o, n))
}
if (x) {
const e = Vt(g.icon);
n.placedIconSymbolIndex >= 0 && (f(t.icon, n.numIconVertices, b ? jt : e),
t.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden = g.icon.isHidden()),
n.verticalPlacedIconSymbolIndex >= 0 && (f(t.icon, n.numVerticalIconVertices, w ? jt : e),
t.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden = g.icon.isHidden())
}
if (t.hasIconCollisionBoxData() || t.hasTextCollisionBoxData()) {
const i = t.collisionArrays[r];
if (i) {
let r = new e.pointGeometry(0,0)
, n = !0;
if (i.textBox || i.verticalTextBox) {
if (c) {
const e = this.variableOffsets[_];
e ? (r = It(e.anchor, e.width, e.height, e.textOffset, e.textScale),
u && r._rotate(h ? this.transform.angle : -this.transform.angle)) : n = !1
}
o && (n = !g.clipped),
i.textBox && Pt(t.textCollisionBox.collisionVertexArray, g.text.placed, !n || b, r.x, r.y),
i.verticalTextBox && Pt(t.textCollisionBox.collisionVertexArray, g.text.placed, !n || w, r.x, r.y)
}
const s = n && Boolean(!w && i.verticalIconBox);
i.iconBox && Pt(t.iconCollisionBox.collisionVertexArray, g.icon.placed, s, d ? r.x : 0, d ? r.y : 0),
i.verticalIconBox && Pt(t.iconCollisionBox.collisionVertexArray, g.icon.placed, !s, d ? r.x : 0, d ? r.y : 0)
}
}
}
if (t.fullyClipped = 0 === m,
t.sortFeatures(this.transform.angle),
this.retainedQueryData[t.bucketInstanceId] && (this.retainedQueryData[t.bucketInstanceId].featureSortOrder = t.featureSortOrder),
t.hasTextData() && t.text.opacityVertexBuffer && t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),
t.hasIconData() && t.icon.opacityVertexBuffer && t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),
t.hasIconCollisionBoxData() && t.iconCollisionBox.collisionVertexBuffer && t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),
t.hasTextCollisionBoxData() && t.textCollisionBox.collisionVertexBuffer && t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),
t.bucketInstanceId in this.collisionCircleArrays) {
const e = this.collisionCircleArrays[t.bucketInstanceId];
t.placementInvProjMatrix = e.invProjMatrix,
t.placementViewportMatrix = e.viewportMatrix,
t.collisionCircleArray = e.circles,
delete this.collisionCircleArrays[t.bucketInstanceId]
}
}
symbolFadeChange(e) {
return 0 === this.fadeDuration ? 1 : (e - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment
}
zoomAdjustment(e) {
return Math.max(0, (this.transform.zoom - e) / 1.5)
}
hasTransitions(e) {
return this.stale || e - this.lastPlacementChangeTime < this.fadeDuration
}
stillRecent(e, t) {
const i = this.zoomAtLastRecencyCheck === t ? 1 - this.zoomAdjustment(t) : 1;
return this.zoomAtLastRecencyCheck = t,
this.commitTime + this.fadeDuration * i > e
}
setStale() {
this.stale = !0
}
}
function Pt(e, t, i, r, n) {
e.emplaceBack(t ? 1 : 0, i ? 1 : 0, r || 0, n || 0),
e.emplaceBack(t ? 1 : 0, i ? 1 : 0, r || 0, n || 0),
e.emplaceBack(t ? 1 : 0, i ? 1 : 0, r || 0, n || 0),
e.emplaceBack(t ? 1 : 0, i ? 1 : 0, r || 0, n || 0)
}
const Dt = Math.pow(2, 25)
, Lt = Math.pow(2, 24)
, Bt = Math.pow(2, 17)
, Ot = Math.pow(2, 16)
, Rt = Math.pow(2, 9)
, Ft = Math.pow(2, 8)
, Ut = Math.pow(2, 1);
function Vt(e) {
if (0 === e.opacity && !e.placed)
return 0;
if (1 === e.opacity && e.placed)
return 4294967295;
const t = e.placed ? 1 : 0
, i = Math.floor(127 * e.opacity);
return i * Dt + t * Lt + i * Bt + t * Ot + i * Rt + t * Ft + i * Ut + t
}
const jt = 0;
class Nt {
constructor(e) {
this._sortAcrossTiles = "viewport-y" !== e.layout.get("symbol-z-order") && void 0 !== e.layout.get("symbol-sort-key").constantOr(1),
this._currentTileIndex = 0,
this._currentPartIndex = 0,
this._seenCrossTileIDs = {},
this._bucketParts = []
}
continuePlacement(e, t, i, r, n) {
const o = this._bucketParts;
for (; this._currentTileIndex < e.length; )
if (t.getBucketParts(o, r, e[this._currentTileIndex], this._sortAcrossTiles),
this._currentTileIndex++,
n())
return !0;
for (this._sortAcrossTiles && (this._sortAcrossTiles = !1,
o.sort(((e,t)=>e.sortKey - t.sortKey))); this._currentPartIndex < o.length; ) {
const e = o[this._currentPartIndex];
if (t.placeLayerBucketPart(e, this._seenCrossTileIDs, i, 0 === e.symbolInstanceStart),
this._currentPartIndex++,
n())
return !0
}
return !1
}
}
class Gt {
constructor(e, t, i, r, n, o, s, a) {
this.placement = new kt(e,n,o,s,a),
this._currentPlacementIndex = t.length - 1,
this._forceFullPlacement = i,
this._showCollisionBoxes = r,
this._done = !1
}
isDone() {
return this._done
}
continuePlacement(t, i, r) {
const n = e.exported.now()
, o = ()=>{
const t = e.exported.now() - n;
return !this._forceFullPlacement && t > 2
}
;
for (; this._currentPlacementIndex >= 0; ) {
const e = i[t[this._currentPlacementIndex]]
, n = this.placement.collisionIndex.transform.zoom;
if ("symbol" === e.type && (!e.minzoom || e.minzoom <= n) && (!e.maxzoom || e.maxzoom > n)) {
if (this._inProgressLayer || (this._inProgressLayer = new Nt(e)),
this._inProgressLayer.continuePlacement(r[e.source], this.placement, this._showCollisionBoxes, e, o))
return;
delete this._inProgressLayer
}
this._currentPlacementIndex--
}
this._done = !0
}
commit(e) {
return this.placement.commit(e),
this.placement
}
}
const $t = 512 / e.EXTENT / 2;
class qt {
constructor(e, t, i) {
this.tileID = e,
this.indexedSymbolInstances = {},
this.bucketInstanceId = i;
for (let i = 0; i < t.length; i++) {
const r = t.get(i)
, n = r.key;
this.indexedSymbolInstances[n] || (this.indexedSymbolInstances[n] = []),
this.indexedSymbolInstances[n].push({
crossTileID: r.crossTileID,
coord: this.getScaledCoordinates(r, e)
})
}
}
getScaledCoordinates(t, i) {
const r = $t / Math.pow(2, i.canonical.z - this.tileID.canonical.z);
return {
x: Math.floor((i.canonical.x * e.EXTENT + t.tileAnchorX) * r),
y: Math.floor((i.canonical.y * e.EXTENT + t.tileAnchorY) * r)
}
}
findMatches(e, t, i) {
const r = this.tileID.canonical.z < t.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - t.canonical.z);
for (let n = 0; n < e.length; n++) {
const o = e.get(n);
if (o.crossTileID)
continue;
const s = this.indexedSymbolInstances[o.key];
if (!s)
continue;
const a = this.getScaledCoordinates(o, t);
for (const e of s)
if (Math.abs(e.coord.x - a.x) <= r && Math.abs(e.coord.y - a.y) <= r && !i[e.crossTileID]) {
i[e.crossTileID] = !0,
o.crossTileID = e.crossTileID;
break
}
}
}
}
class Zt {
constructor() {
this.maxCrossTileID = 0
}
generate() {
return ++this.maxCrossTileID
}
}
class Wt {
constructor() {
this.indexes = {},
this.usedCrossTileIDs = {},
this.lng = 0
}
handleWrapJump(e) {
const t = Math.round((e - this.lng) / 360);
if (0 !== t)
for (const e in this.indexes) {
const i = this.indexes[e]
, r = {};
for (const e in i) {
const n = i[e];
n.tileID = n.tileID.unwrapTo(n.tileID.wrap + t),
r[n.tileID.key] = n
}
this.indexes[e] = r
}
this.lng = e
}
addBucket(e, t, i) {
if (this.indexes[e.overscaledZ] && this.indexes[e.overscaledZ][e.key]) {
if (this.indexes[e.overscaledZ][e.key].bucketInstanceId === t.bucketInstanceId)
return !1;
this.removeBucketCrossTileIDs(e.overscaledZ, this.indexes[e.overscaledZ][e.key])
}
for (let e = 0; e < t.symbolInstances.length; e++)
t.symbolInstances.get(e).crossTileID = 0;
this.usedCrossTileIDs[e.overscaledZ] || (this.usedCrossTileIDs[e.overscaledZ] = {});
const r = this.usedCrossTileIDs[e.overscaledZ];
for (const i in this.indexes) {
const n = this.indexes[i];
if (Number(i) > e.overscaledZ)
for (const i in n) {
const o = n[i];
o.tileID.isChildOf(e) && o.findMatches(t.symbolInstances, e, r)
}
else {
const o = n[e.scaledTo(Number(i)).key];
o && o.findMatches(t.symbolInstances, e, r)
}
}
for (let e = 0; e < t.symbolInstances.length; e++) {
const n = t.symbolInstances.get(e);
n.crossTileID || (n.crossTileID = i.generate(),
r[n.crossTileID] = !0)
}
return void 0 === this.indexes[e.overscaledZ] && (this.indexes[e.overscaledZ] = {}),
this.indexes[e.overscaledZ][e.key] = new qt(e,t.symbolInstances,t.bucketInstanceId),
!0
}
removeBucketCrossTileIDs(e, t) {
for (const i in t.indexedSymbolInstances)
for (const r of t.indexedSymbolInstances[i])
delete this.usedCrossTileIDs[e][r.crossTileID]
}
removeStaleBuckets(e) {
let t = !1;
for (const i in this.indexes) {
const r = this.indexes[i];
for (const n in r)
e[r[n].bucketInstanceId] || (this.removeBucketCrossTileIDs(i, r[n]),
delete r[n],
t = !0)
}
return t
}
}
class Xt {
constructor() {
this.layerIndexes = {},
this.crossTileIDs = new Zt,
this.maxBucketInstanceId = 0,
this.bucketsInCurrentPlacement = {}
}
addLayer(e, t, i, r) {
let n = this.layerIndexes[e.id];
void 0 === n && (n = this.layerIndexes[e.id] = new Wt);
let o = !1;
const s = {};
"globe" !== r.name && n.handleWrapJump(i);
for (const i of t) {
const t = i.getBucket(e);
t && e.id === t.layerIds[0] && (t.bucketInstanceId || (t.bucketInstanceId = ++this.maxBucketInstanceId),
n.addBucket(i.tileID, t, this.crossTileIDs) && (o = !0),
s[t.bucketInstanceId] = !0)
}
return n.removeStaleBuckets(s) && (o = !0),
o
}
pruneUnusedLayers(e) {
const t = {};
e.forEach((e=>{
t[e] = !0
}
));
for (const e in this.layerIndexes)
t[e] || delete this.layerIndexes[e]
}
}
const Ht = (t,i)=>e.emitValidationErrors(t, i && i.filter((e=>"source.canvas" !== e.identifier)))
, Yt = e.pick($e, ["addLayer", "removeLayer", "setPaintProperty", "setLayoutProperty", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData", "setTerrain", "setFog", "setProjection"])
, Kt = e.pick($e, ["setCenter", "setZoom", "setBearing", "setPitch"])
, Jt = {
version: 8,
layers: [],
sources: {}
}
, Qt = {
fill: !0,
line: !0,
background: !0,
hillshade: !0,
raster: !0
};
class ei extends e.Evented {
constructor(t, i={}) {
super(),
this.map = t,
this.dispatcher = new P(je(),this),
this.imageManager = new v,
this.imageManager.setEventedParent(this),
this.glyphManager = new e.GlyphManager(t._requestManager,i.localFontFamily ? e.LocalGlyphMode.all : i.localIdeographFontFamily ? e.LocalGlyphMode.ideographs : e.LocalGlyphMode.none,i.localFontFamily || i.localIdeographFontFamily),
this.lineAtlas = new e.LineAtlas(256,512),
this.crossTileSymbolIndex = new Xt,
this._layers = {},
this._num3DLayers = 0,
this._numSymbolLayers = 0,
this._numCircleLayers = 0,
this._serializedLayers = {},
this._sourceCaches = {},
this._otherSourceCaches = {},
this._symbolSourceCaches = {},
this.zoomHistory = new e.ZoomHistory,
this._loaded = !1,
this._availableImages = [],
this._order = [],
this._drapedFirstOrder = [],
this._markersNeedUpdate = !1,
this._resetUpdates(),
this.dispatcher.broadcast("setReferrer", e.getReferrer());
const r = this;
this._rtlTextPluginCallback = ei.registerForPluginStateChange((t=>{
r.dispatcher.broadcast("syncRTLPluginState", {
pluginStatus: t.pluginStatus,
pluginURL: t.pluginURL
}, ((t,i)=>{
if (e.triggerPluginCompletionEvent(t),
i && i.every((e=>e)))
for (const e in r._sourceCaches) {
const t = r._sourceCaches[e]
, i = t.getSource().type;
"vector" !== i && "geojson" !== i || t.reload()
}
}
))
}
)),
this.on("data", (e=>{
if ("source" !== e.dataType || "metadata" !== e.sourceDataType)
return;
const t = this.getSource(e.sourceId);
if (t && t.vectorLayerIds)
for (const e in this._layers) {
const i = this._layers[e];
i.source === t.id && this._validateLayer(i)
}
}
))
}
loadURL(t, i={}) {
this.fire(new e.Event("dataloading",{
dataType: "style"
}));
const r = "boolean" == typeof i.validate ? i.validate : !e.isMapboxURL(t);
t = this.map._requestManager.normalizeStyleURL(t, i.accessToken);
const n = this.map._requestManager.transformRequest(t, e.ResourceType.Style);
this._request = e.getJSON(n, ((t,i)=>{
this._request = null,
t ? this.fire(new e.ErrorEvent(t)) : i && this._load(i, r)
}
))
}
loadJSON(t, i={}) {
this.fire(new e.Event("dataloading",{
dataType: "style"
})),
this._request = e.exported.frame((()=>{
this._request = null,
this._load(t, !1 !== i.validate)
}
))
}
loadEmpty() {
this.fire(new e.Event("dataloading",{
dataType: "style"
})),
this._load(Jt, !1)
}
_updateLayerCount(e, t) {
const i = t ? 1 : -1;
e.is3D() && (this._num3DLayers += i),
"circle" === e.type && (this._numCircleLayers += i),
"symbol" === e.type && (this._numSymbolLayers += i)
}
_load(t, i) {
if (i && Ht(this, e.validateStyle(t)))
return;
this._loaded = !0,
this.stylesheet = e.clone$1(t),
this._updateMapProjection();
for (const e in t.sources)
this.addSource(e, t.sources[e], {
validate: !1
});
this._changed = !1,
t.sprite ? this._loadSprite(t.sprite) : (this.imageManager.setLoaded(!0),
this.dispatcher.broadcast("spriteLoaded", !0)),
this.glyphManager.setURL(t.glyphs);
const r = Ge(this.stylesheet.layers);
this._order = r.map((e=>e.id)),
this._layers = {},
this._serializedLayers = {};
for (let t of r)
t = e.createStyleLayer(t),
t.setEventedParent(this, {
layer: {
id: t.id
}
}),
this._layers[t.id] = t,
this._serializedLayers[t.id] = t.serialize(),
this._updateLayerCount(t, !0);
this.dispatcher.broadcast("setLayers", this._serializeLayers(this._order)),
this.light = new T(this.stylesheet.light),
this.stylesheet.terrain && !this.terrainSetForDrapingOnly() && this._createTerrain(this.stylesheet.terrain, 1),
this.stylesheet.fog && this._createFog(this.stylesheet.fog),
this._updateDrapeFirstLayers(),
this.fire(new e.Event("data",{
dataType: "style"
})),
this.fire(new e.Event("style.load"))
}
terrainSetForDrapingOnly() {
return !!this.terrain && 0 === this.terrain.drapeRenderMode
}
setProjection(e) {
e ? this.stylesheet.projection = e : delete this.stylesheet.projection,
this._updateMapProjection()
}
applyProjectionUpdate() {
this._loaded && (this.dispatcher.broadcast("setProjection", this.map.transform.projectionOptions),
this.map.transform.projection.requiresDraping ? this.getTerrain() || this.stylesheet.terrain || this.setTerrainForDraping() : this.terrainSetForDrapingOnly() && this.setTerrain(null))
}
_updateMapProjection() {
this.map._useExplicitProjection ? this.applyProjectionUpdate() : this.map._prioritizeAndUpdateProjection(null, this.stylesheet.projection)
}
_loadSprite(t) {
this._spriteRequest = function(t, i, r) {
let n, o, s;
const a = e.exported.devicePixelRatio > 1 ? "@2x" : "";
let l = e.getJSON(i.transformRequest(i.normalizeSpriteURL(t, a, ".json"), e.ResourceType.SpriteJSON), ((e,t)=>{
l = null,
s || (s = e,
n = t,
u())
}
))
, c = e.getImage(i.transformRequest(i.normalizeSpriteURL(t, a, ".png"), e.ResourceType.SpriteImage), ((e,t)=>{
c = null,
s || (s = e,
o = t,
u())
}
));
function u() {
if (s)
r(s);
else if (n && o) {
const t = e.exported.getImageData(o)
, i = {};
for (const r in n) {
const {width: o, height: s, x: a, y: l, sdf: c, pixelRatio: u, stretchX: h, stretchY: d, content: p} = n[r]
, f = new e.RGBAImage({
width: o,
height: s
});
e.RGBAImage.copy(t, f, {
x: a,
y: l
}, {
x: 0,
y: 0
}, {
width: o,
height: s
}),
i[r] = {
data: f,
pixelRatio: u,
sdf: c,
stretchX: h,
stretchY: d,
content: p
}
}
r(null, i)
}
}
return {
cancel() {
l && (l.cancel(),
l = null),
c && (c.cancel(),
c = null)
}
}
}(t, this.map._requestManager, ((t,i)=>{
if (this._spriteRequest = null,
t)
this.fire(new e.ErrorEvent(t));
else if (i)
for (const e in i)
this.imageManager.addImage(e, i[e]);
this.imageManager.setLoaded(!0),
this._availableImages = this.imageManager.listImages(),
this.dispatcher.broadcast("setImages", this._availableImages),
this.dispatcher.broadcast("spriteLoaded", !0),
this.fire(new e.Event("data",{
dataType: "style"
}))
}
))
}
_validateLayer(t) {
const i = this.getSource(t.source);
if (!i)
return;
const r = t.sourceLayer;
r && ("geojson" === i.type || i.vectorLayerIds && -1 === i.vectorLayerIds.indexOf(r)) && this.fire(new e.ErrorEvent(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))
}
loaded() {
if (!this._loaded)
return !1;
if (Object.keys(this._updatedSources).length)
return !1;
for (const e in this._sourceCaches)
if (!this._sourceCaches[e].loaded())
return !1;
return !!this.imageManager.isLoaded()
}
_serializeLayers(e) {
const t = [];
for (const i of e) {
const e = this._layers[i];
"custom" !== e.type && t.push(e.serialize())
}
return t
}
hasTransitions() {
if (this.light && this.light.hasTransition())
return !0;
if (this.fog && this.fog.hasTransition())
return !0;
for (const e in this._sourceCaches)
if (this._sourceCaches[e].hasTransition())
return !0;
for (const e in this._layers)
if (this._layers[e].hasTransition())
return !0;
return !1
}
get order() {
return this.map._optimizeForTerrain && this.terrain ? this._drapedFirstOrder : this._order
}
isLayerDraped(e) {
return !!this.terrain && Qt[e.type]
}
_checkLoaded() {
if (!this._loaded)
throw new Error("Style is not done loading")
}
update(t) {
if (!this._loaded)
return;
const i = this._changed;
if (this._changed) {
const e = Object.keys(this._updatedLayers)
, i = Object.keys(this._removedLayers);
(e.length || i.length) && this._updateWorkerLayers(e, i);
for (const e in this._updatedSources) {
const t = this._updatedSources[e];
"reload" === t ? this._reloadSource(e) : "clear" === t && this._clearSource(e)
}
this._updateTilesForChangedImages();
for (const e in this._updatedPaintProps)
this._layers[e].updateTransitions(t);
this.light.updateTransitions(t),
this.fog && this.fog.updateTransitions(t),
this._resetUpdates()
}
const r = {};
for (const e in this._sourceCaches) {
const t = this._sourceCaches[e];
r[e] = t.used,
t.used = !1
}
for (const e of this._order) {
const i = this._layers[e];
if (i.recalculate(t, this._availableImages),
!i.isHidden(t.zoom)) {
const e = this._getLayerSourceCache(i);
e && (e.used = !0)
}
const r = this.map.painter;
if (r) {
const e = i.getProgramIds();
if (!e)
continue;
const n = i.getProgramConfiguration(t.zoom);
for (const t of e)
r.useProgram(t, n)
}
}
for (const t in r) {
const i = this._sourceCaches[t];
r[t] !== i.used && i.getSource().fire(new e.Event("data",{
sourceDataType: "visibility",
dataType: "source",
sourceId: i.getSource().id
}))
}
this.light.recalculate(t),
this.terrain && this.terrain.recalculate(t),
this.fog && this.fog.recalculate(t),
this.z = t.zoom,
this._markersNeedUpdate && (this._updateMarkersOpacity(),
this._markersNeedUpdate = !1),
i && this.fire(new e.Event("data",{
dataType: "style"
}))
}
_updateTilesForChangedImages() {
const e = Object.keys(this._changedImages);
if (e.length) {
for (const t in this._sourceCaches)
this._sourceCaches[t].reloadTilesForDependencies(["icons", "patterns"], e);
this._changedImages = {}
}
}
_updateWorkerLayers(e, t) {
this.dispatcher.broadcast("updateLayers", {
layers: this._serializeLayers(e),
removedIds: t
})
}
_resetUpdates() {
this._changed = !1,
this._updatedLayers = {},
this._removedLayers = {},
this._updatedSources = {},
this._updatedPaintProps = {},
this._changedImages = {}
}
setState(i) {
if (this._checkLoaded(),
Ht(this, e.validateStyle(i)))
return !1;
(i = e.clone$1(i)).layers = Ge(i.layers);
const r = function(e, i) {
if (!e)
return [{
command: $e.setStyle,
args: [i]
}];
let r = [];
try {
if (!t(e.version, i.version))
return [{
command: $e.setStyle,
args: [i]
}];
t(e.center, i.center) || r.push({
command: $e.setCenter,
args: [i.center]
}),
t(e.zoom, i.zoom) || r.push({
command: $e.setZoom,
args: [i.zoom]
}),
t(e.bearing, i.bearing) || r.push({
command: $e.setBearing,
args: [i.bearing]
}),
t(e.pitch, i.pitch) || r.push({
command: $e.setPitch,
args: [i.pitch]
}),
t(e.sprite, i.sprite) || r.push({
command: $e.setSprite,
args: [i.sprite]
}),
t(e.glyphs, i.glyphs) || r.push({
command: $e.setGlyphs,
args: [i.glyphs]
}),
t(e.transition, i.transition) || r.push({
command: $e.setTransition,
args: [i.transition]
}),
t(e.light, i.light) || r.push({
command: $e.setLight,
args: [i.light]
}),
t(e.fog, i.fog) || r.push({
command: $e.setFog,
args: [i.fog]
}),
t(e.projection, i.projection) || r.push({
command: $e.setProjection,
args: [i.projection]
});
const n = {}
, o = [];
!function(e, i, r, n) {
let o;
for (o in i = i || {},
e = e || {})
e.hasOwnProperty(o) && (i.hasOwnProperty(o) || Ze(o, r, n));
for (o in i)
i.hasOwnProperty(o) && (e.hasOwnProperty(o) ? t(e[o], i[o]) || ("geojson" === e[o].type && "geojson" === i[o].type && Xe(e, i, o) ? r.push({
command: $e.setGeoJSONSourceData,
args: [o, i[o].data]
}) : We(o, i, r, n)) : qe(o, i, r))
}(e.sources, i.sources, o, n);
const s = [];
e.layers && e.layers.forEach((e=>{
e.source && n[e.source] ? r.push({
command: $e.removeLayer,
args: [e.id]
}) : s.push(e)
}
));
let a = e.terrain;
a && n[a.source] && (r.push({
command: $e.setTerrain,
args: [void 0]
}),
a = void 0),
r = r.concat(o),
t(a, i.terrain) || r.push({
command: $e.setTerrain,
args: [i.terrain]
}),
function(e, i, r) {
i = i || [];
const n = (e = e || []).map(Ye)
, o = i.map(Ye)
, s = e.reduce(Ke, {})
, a = i.reduce(Ke, {})
, l = n.slice()
, c = Object.create(null);
let u, h, d, p, f, m, _;
for (u = 0,
h = 0; u < n.length; u++)
d = n[u],
a.hasOwnProperty(d) ? h++ : (r.push({
command: $e.removeLayer,
args: [d]
}),
l.splice(l.indexOf(d, h), 1));
for (u = 0,
h = 0; u < o.length; u++)
d = o[o.length - 1 - u],
l[l.length - 1 - u] !== d && (s.hasOwnProperty(d) ? (r.push({
command: $e.removeLayer,
args: [d]
}),
l.splice(l.lastIndexOf(d, l.length - h), 1)) : h++,
m = l[l.length - u],
r.push({
command: $e.addLayer,
args: [a[d], m]
}),
l.splice(l.length - u, 0, d),
c[d] = !0);
for (u = 0; u < o.length; u++)
if (d = o[u],
p = s[d],
f = a[d],
!c[d] && !t(p, f))
if (t(p.source, f.source) && t(p["source-layer"], f["source-layer"]) && t(p.type, f.type)) {
for (_ in He(p.layout, f.layout, r, d, null, $e.setLayoutProperty),
He(p.paint, f.paint, r, d, null, $e.setPaintProperty),
t(p.filter, f.filter) || r.push({
command: $e.setFilter,
args: [d, f.filter]
}),
t(p.minzoom, f.minzoom) && t(p.maxzoom, f.maxzoom) || r.push({
command: $e.setLayerZoomRange,
args: [d, f.minzoom, f.maxzoom]
}),
p)
p.hasOwnProperty(_) && "layout" !== _ && "paint" !== _ && "filter" !== _ && "metadata" !== _ && "minzoom" !== _ && "maxzoom" !== _ && (0 === _.indexOf("paint.") ? He(p[_], f[_], r, d, _.slice(6), $e.setPaintProperty) : t(p[_], f[_]) || r.push({
command: $e.setLayerProperty,
args: [d, _, f[_]]
}));
for (_ in f)
f.hasOwnProperty(_) && !p.hasOwnProperty(_) && "layout" !== _ && "paint" !== _ && "filter" !== _ && "metadata" !== _ && "minzoom" !== _ && "maxzoom" !== _ && (0 === _.indexOf("paint.") ? He(p[_], f[_], r, d, _.slice(6), $e.setPaintProperty) : t(p[_], f[_]) || r.push({
command: $e.setLayerProperty,
args: [d, _, f[_]]
}))
} else
r.push({
command: $e.removeLayer,
args: [d]
}),
m = l[l.lastIndexOf(d) + 1],
r.push({
command: $e.addLayer,
args: [f, m]
})
}(s, i.layers, r)
} catch (e) {
console.warn("Unable to compute style diff:", e),
r = [{
command: $e.setStyle,
args: [i]
}]
}
return r
}(this.serialize(), i).filter((e=>!(e.command in Kt)));
if (0 === r.length)
return !1;
const n = r.filter((e=>!(e.command in Yt)));
if (n.length > 0)
throw new Error(`Unimplemented: ${n.map((e=>e.command)).join(", ")}.`);
return r.forEach((e=>{
"setTransition" !== e.command && "setProjection" !== e.command && this[e.command].apply(this, e.args)
}
)),
this.stylesheet = i,
this._updateMapProjection(),
!0
}
addImage(t, i) {
return this.getImage(t) ? this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))) : (this.imageManager.addImage(t, i),
this._afterImageUpdated(t),
this)
}
updateImage(e, t) {
this.imageManager.updateImage(e, t)
}
getImage(e) {
return this.imageManager.getImage(e)
}
removeImage(t) {
return this.getImage(t) ? (this.imageManager.removeImage(t),
this._afterImageUpdated(t),
this) : this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))
}
_afterImageUpdated(t) {
this._availableImages = this.imageManager.listImages(),
this._changedImages[t] = !0,
this._changed = !0,
this.dispatcher.broadcast("setImages", this._availableImages),
this.fire(new e.Event("data",{
dataType: "style"
}))
}
listImages() {
return this._checkLoaded(),
this._availableImages.slice()
}
addSource(t, i, r={}) {
if (this._checkLoaded(),
void 0 !== this.getSource(t))
throw new Error("There is already a source with this ID");
if (!i.type)
throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);
if (["vector", "raster", "geojson", "video", "image"].indexOf(i.type) >= 0 && this._validate(e.validateSource, `sources.${t}`, i, null, r))
return;
this.map && this.map._collectResourceTiming && (i.collectResourceTiming = !0);
const n = Pe(t, i, this.dispatcher, this);
n.setEventedParent(this, (()=>({
isSourceLoaded: this._isSourceCacheLoaded(t),
source: n.serialize(),
sourceId: t
})));
const o = i=>{
const r = (i ? "symbol:" : "other:") + t
, o = this._sourceCaches[r] = new e.SourceCache(r,n,i);
(i ? this._symbolSourceCaches : this._otherSourceCaches)[t] = o,
o.style = this,
o.onAdd(this.map)
}
;
o(!1),
"vector" !== i.type && "geojson" !== i.type || o(!0),
n.onAdd && n.onAdd(this.map),
this._changed = !0
}
removeSource(t) {
this._checkLoaded();
const i = this.getSource(t);
if (!i)
throw new Error("There is no source with this ID");
for (const i in this._layers)
if (this._layers[i].source === t)
return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));
if (this.terrain && this.terrain.get().source === t)
return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));
const r = this._getSourceCaches(t);
for (const t of r)
delete this._sourceCaches[t.id],
delete this._updatedSources[t.id],
t.fire(new e.Event("data",{
sourceDataType: "metadata",
dataType: "source",
sourceId: t.getSource().id
})),
t.setEventedParent(null),
t.clearTiles();
return delete this._otherSourceCaches[t],
delete this._symbolSourceCaches[t],
i.setEventedParent(null),
i.onRemove && i.onRemove(this.map),
this._changed = !0,
this
}
setGeoJSONSourceData(e, t) {
this._checkLoaded(),
this.getSource(e).setData(t),
this._changed = !0
}
getSource(e) {
const t = this._getSourceCache(e);
return t && t.getSource()
}
addLayer(t, i, r={}) {
this._checkLoaded();
const n = t.id;
if (this.getLayer(n))
return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${n}" already exists on this map`)));
let o;
if ("custom" === t.type) {
if (Ht(this, e.validateCustomStyleLayer(t)))
return;
o = e.createStyleLayer(t)
} else {
if ("object" == typeof t.source && (this.addSource(n, t.source),
t = e.clone$1(t),
t = e.extend(t, {
source: n
})),
this._validate(e.validateLayer, `layers.${n}`, t, {
arrayIndex: -1
}, r))
return;
o = e.createStyleLayer(t),
this._validateLayer(o),
o.setEventedParent(this, {
layer: {
id: n
}
}),
this._serializedLayers[o.id] = o.serialize(),
this._updateLayerCount(o, !0)
}
const s = i ? this._order.indexOf(i) : this._order.length;
if (i && -1 === s)
return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`)));
this._order.splice(s, 0, n),
this._layerOrderChanged = !0,
this._layers[n] = o;
const a = this._getLayerSourceCache(o);
if (this._removedLayers[n] && o.source && a && "custom" !== o.type) {
const e = this._removedLayers[n];
delete this._removedLayers[n],
e.type !== o.type ? this._updatedSources[o.source] = "clear" : (this._updatedSources[o.source] = "reload",
a.pause())
}
this._updateLayer(o),
o.onAdd && o.onAdd(this.map),
this._updateDrapeFirstLayers()
}
moveLayer(t, i) {
if (this._checkLoaded(),
this._changed = !0,
!this._layers[t])
return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));
if (t === i)
return;
const r = this._order.indexOf(t);
this._order.splice(r, 1);
const n = i ? this._order.indexOf(i) : this._order.length;
i && -1 === n ? this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`))) : (this._order.splice(n, 0, t),
this._layerOrderChanged = !0,
this._updateDrapeFirstLayers())
}
removeLayer(t) {
this._checkLoaded();
const i = this._layers[t];
if (!i)
return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));
i.setEventedParent(null),
this._updateLayerCount(i, !1);
const r = this._order.indexOf(t);
this._order.splice(r, 1),
this._layerOrderChanged = !0,
this._changed = !0,
this._removedLayers[t] = i,
delete this._layers[t],
delete this._serializedLayers[t],
delete this._updatedLayers[t],
delete this._updatedPaintProps[t],
i.onRemove && i.onRemove(this.map),
this._updateDrapeFirstLayers()
}
getLayer(e) {
return this._layers[e]
}
hasLayer(e) {
return e in this._layers
}
hasLayerType(e) {
for (const t in this._layers)
if (this._layers[t].type === e)
return !0;
return !1
}
setLayerZoomRange(t, i, r) {
this._checkLoaded();
const n = this.getLayer(t);
n ? n.minzoom === i && n.maxzoom === r || (null != i && (n.minzoom = i),
null != r && (n.maxzoom = r),
this._updateLayer(n)) : this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))
}
setFilter(i, r, n={}) {
this._checkLoaded();
const o = this.getLayer(i);
if (o) {
if (!t(o.filter, r))
return null == r ? (o.filter = void 0,
void this._updateLayer(o)) : void (this._validate(e.validateFilter, `layers.${o.id}.filter`, r, {
layerType: o.type
}, n) || (o.filter = e.clone$1(r),
this._updateLayer(o)))
} else
this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be filtered.`)))
}
getFilter(t) {
const i = this.getLayer(t);
return i && e.clone$1(i.filter)
}
setLayoutProperty(i, r, n, o={}) {
this._checkLoaded();
const s = this.getLayer(i);
s ? t(s.getLayoutProperty(r), n) || (s.setLayoutProperty(r, n, o),
this._updateLayer(s)) : this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))
}
getLayoutProperty(t, i) {
const r = this.getLayer(t);
if (r)
return r.getLayoutProperty(i);
this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))
}
setPaintProperty(i, r, n, o={}) {
this._checkLoaded();
const s = this.getLayer(i);
s ? t(s.getPaintProperty(r), n) || (s.setPaintProperty(r, n, o) && this._updateLayer(s),
this._changed = !0,
this._updatedPaintProps[i] = !0) : this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))
}
getPaintProperty(e, t) {
const i = this.getLayer(e);
return i && i.getPaintProperty(t)
}
setFeatureState(t, i) {
this._checkLoaded();
const r = t.source
, n = t.sourceLayer
, o = this.getSource(r);
if (!o)
return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));
const s = o.type;
if ("geojson" === s && n)
return void this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));
if ("vector" === s && !n)
return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));
void 0 === t.id && this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));
const a = this._getSourceCaches(r);
for (const e of a)
e.setFeatureState(n, t.id, i)
}
removeFeatureState(t, i) {
this._checkLoaded();
const r = t.source
, n = this.getSource(r);
if (!n)
return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));
const o = n.type
, s = "vector" === o ? t.sourceLayer : void 0;
if ("vector" === o && !s)
return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));
if (i && "string" != typeof t.id && "number" != typeof t.id)
return void this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));
const a = this._getSourceCaches(r);
for (const e of a)
e.removeFeatureState(s, t.id, i)
}
getFeatureState(t) {
this._checkLoaded();
const i = t.source
, r = t.sourceLayer
, n = this.getSource(i);
if (n) {
if ("vector" !== n.type || r)
return void 0 === t.id && this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),
this._getSourceCaches(i)[0].getFeatureState(r, t.id);
this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))
} else
this.fire(new e.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))
}
getTransition() {
return e.extend({
duration: 300,
delay: 0
}, this.stylesheet && this.stylesheet.transition)
}
serialize() {
const t = {};
for (const e in this._sourceCaches) {
const i = this._sourceCaches[e].getSource();
t[i.id] || (t[i.id] = i.serialize())
}
return e.filterObject({
version: this.stylesheet.version,
name: this.stylesheet.name,
metadata: this.stylesheet.metadata,
light: this.stylesheet.light,
terrain: this.stylesheet.terrain,
fog: this.stylesheet.fog,
center: this.stylesheet.center,
zoom: this.stylesheet.zoom,
bearing: this.stylesheet.bearing,
pitch: this.stylesheet.pitch,
sprite: this.stylesheet.sprite,
glyphs: this.stylesheet.glyphs,
transition: this.stylesheet.transition,
projection: this.stylesheet.projection,
sources: t,
layers: this._serializeLayers(this._order)
}, (e=>void 0 !== e))
}
_updateLayer(e) {
this._updatedLayers[e.id] = !0;
const t = this._getLayerSourceCache(e);
e.source && !this._updatedSources[e.source] && t && "raster" !== t.getSource().type && (this._updatedSources[e.source] = "reload",
t.pause()),
this._changed = !0,
e.invalidateCompiledFilter()
}
_flattenAndSortRenderedFeatures(e) {
const t = e=>"fill-extrusion" === this._layers[e].type
, i = {}
, r = [];
for (let n = this._order.length - 1; n >= 0; n--) {
const o = this._order[n];
if (t(o)) {
i[o] = n;
for (const t of e) {
const e = t[o];
if (e)
for (const t of e)
r.push(t)
}
}
}
r.sort(((e,t)=>t.intersectionZ - e.intersectionZ));
const n = [];
for (let o = this._order.length - 1; o >= 0; o--) {
const s = this._order[o];
if (t(s))
for (let e = r.length - 1; e >= 0; e--) {
const t = r[e].feature;
if (i[t.layer.id] < o)
break;
n.push(t),
r.pop()
}
else
for (const t of e) {
const e = t[s];
if (e)
for (const t of e)
n.push(t.feature)
}
}
return n
}
queryRenderedFeatures(t, i, r) {
i && i.filter && this._validate(e.validateFilter, "queryRenderedFeatures.filter", i.filter, null, i);
const n = {};
if (i && i.layers) {
if (!Array.isArray(i.layers))
return this.fire(new e.ErrorEvent(new Error("parameters.layers must be an Array."))),
[];
for (const t of i.layers) {
const i = this._layers[t];
if (!i)
return this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),
[];
n[i.source] = !0
}
}
const o = [];
i.availableImages = this._availableImages;
const s = i && i.layers ? i.layers.some((e=>{
const t = this.getLayer(e);
return t && t.is3D()
}
)) : this.has3DLayers()
, a = L.createFromScreenPoints(t, r);
for (const e in this._sourceCaches) {
const t = this._sourceCaches[e].getSource().id;
i.layers && !n[t] || o.push(Le(this._sourceCaches[e], this._layers, this._serializedLayers, a, i, r, s, !!this.map._showQueryGeometry))
}
return this.placement && o.push(function(e, t, i, r, n, o, s) {
const a = {}
, l = o.queryRenderedSymbols(r)
, c = [];
for (const e of Object.keys(l).map(Number))
c.push(s[e]);
c.sort(Oe);
for (const i of c) {
const r = i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId], t, i.bucketIndex, i.sourceLayerIndex, n.filter, n.layers, n.availableImages, e);
for (const e in r) {
const t = a[e] = a[e] || []
, n = r[e];
n.sort(((e,t)=>{
const r = i.featureSortOrder;
if (r) {
const i = r.indexOf(e.featureIndex);
return r.indexOf(t.featureIndex) - i
}
return t.featureIndex - e.featureIndex
}
));
for (const e of n)
t.push(e)
}
}
for (const t in a)
a[t].forEach((r=>{
const n = r.feature
, o = i(e[t]).getFeatureState(n.layer["source-layer"], n.id);
n.source = n.layer.source,
n.layer["source-layer"] && (n.sourceLayer = n.layer["source-layer"]),
n.state = o
}
));
return a
}(this._layers, this._serializedLayers, this._getLayerSourceCache.bind(this), a.screenGeometry, i, this.placement.collisionIndex, this.placement.retainedQueryData)),
this._flattenAndSortRenderedFeatures(o)
}
querySourceFeatures(t, i) {
i && i.filter && this._validate(e.validateFilter, "querySourceFeatures.filter", i.filter, null, i);
const r = this._getSourceCaches(t);
let n = [];
for (const e of r)
n = n.concat(Be(e, i));
return n
}
addSourceType(e, t, i) {
return ei.getSourceType(e) ? i(new Error(`A source type called "${e}" already exists.`)) : (ei.setSourceType(e, t),
t.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", {
name: e,
url: t.workerSourceURL
}, i) : i(null, null))
}
getLight() {
return this.light.getLight()
}
setLight(e, i={}) {
this._checkLoaded();
const r = this.light.getLight();
let n = !1;
for (const i in e)
if (!t(e[i], r[i])) {
n = !0;
break
}
if (!n)
return;
const o = this._setTransitionParameters({
duration: 300,
delay: 0
});
this.light.setLight(e, i),
this.light.updateTransitions(o)
}
getTerrain() {
return this.terrain && 1 === this.terrain.drapeRenderMode ? this.terrain.get() : null
}
setTerrainForDraping() {
this.setTerrain({
source: "",
exaggeration: 0
}, 0)
}
setTerrain(i, r=1) {
if (this._checkLoaded(),
!i)
return delete this.terrain,
delete this.stylesheet.terrain,
this.dispatcher.broadcast("enableTerrain", !1),
this._force3DLayerUpdate(),
void (this._markersNeedUpdate = !0);
if (1 === r) {
if ("object" == typeof i.source) {
const t = "terrain-dem-src";
this.addSource(t, i.source),
i = e.clone$1(i),
i = e.extend(i, {
source: t
})
}
if (this._validate(e.validateTerrain, "terrain", i))
return
}
if (!this.terrain || this.terrain && r !== this.terrain.drapeRenderMode)
this._createTerrain(i, r);
else {
const r = this.terrain
, n = r.get();
for (const t of Object.keys(e.spec.terrain))
!i.hasOwnProperty(t) && e.spec.terrain[t].default && (i[t] = e.spec.terrain[t].default);
for (const e in i)
if (!t(i[e], n[e])) {
r.set(i),
this.stylesheet.terrain = i;
const e = this._setTransitionParameters({
duration: 0
});
r.updateTransitions(e);
break
}
}
this._updateDrapeFirstLayers(),
this._markersNeedUpdate = !0
}
_createFog(e) {
const t = this.fog = new k(e,this.map.transform);
this.stylesheet.fog = e;
const i = this._setTransitionParameters({
duration: 0
});
t.updateTransitions(i)
}
_updateMarkersOpacity() {
0 !== this.map._markers.length && this.map._requestDomTask((()=>{
for (const e of this.map._markers)
e._evaluateOpacity()
}
))
}
getFog() {
return this.fog ? this.fog.get() : null
}
setFog(e) {
if (this._checkLoaded(),
!e)
return delete this.fog,
delete this.stylesheet.fog,
void (this._markersNeedUpdate = !0);
if (this.fog) {
const i = this.fog
, r = i.get();
0 === Object.keys(e).length && i.set(e);
for (const n in e)
if (!t(e[n], r[n])) {
i.set(e),
this.stylesheet.fog = e;
const t = this._setTransitionParameters({
duration: 0
});
i.updateTransitions(t);
break
}
} else
this._createFog(e);
this._markersNeedUpdate = !0
}
_setTransitionParameters(t) {
return {
now: e.exported.now(),
transition: e.extend(t, this.stylesheet.transition)
}
}
_updateDrapeFirstLayers() {
if (!this.map._optimizeForTerrain || !this.terrain)
return;
const e = this._order.filter((e=>this.isLayerDraped(this._layers[e])))
, t = this._order.filter((e=>!this.isLayerDraped(this._layers[e])));
this._drapedFirstOrder = [],
this._drapedFirstOrder.push(...e),
this._drapedFirstOrder.push(...t)
}
_createTerrain(e, t) {
const i = this.terrain = new C(e,t);
this.stylesheet.terrain = e,
this.dispatcher.broadcast("enableTerrain", !this.terrainSetForDrapingOnly()),
this._force3DLayerUpdate();
const r = this._setTransitionParameters({
duration: 0
});
i.updateTransitions(r)
}
_force3DLayerUpdate() {
for (const e in this._layers) {
const t = this._layers[e];
"fill-extrusion" === t.type && this._updateLayer(t)
}
}
_forceSymbolLayerUpdate() {
for (const e in this._layers) {
const t = this._layers[e];
"symbol" === t.type && this._updateLayer(t)
}
}
_validate(t, i, r, n, o={}) {
return (!o || !1 !== o.validate) && Ht(this, t.call(e.validateStyle, e.extend({
key: i,
style: this.serialize(),
value: r,
styleSpec: e.spec
}, n)))
}
_remove() {
this._request && (this._request.cancel(),
this._request = null),
this._spriteRequest && (this._spriteRequest.cancel(),
this._spriteRequest = null),
e.evented.off("pluginStateChange", this._rtlTextPluginCallback);
for (const e in this._layers)
this._layers[e].setEventedParent(null);
for (const e in this._sourceCaches)
this._sourceCaches[e].clearTiles(),
this._sourceCaches[e].setEventedParent(null);
this.imageManager.setEventedParent(null),
this.setEventedParent(null),
this.dispatcher.remove()
}
_clearSource(e) {
const t = this._getSourceCaches(e);
for (const e of t)
e.clearTiles()
}
_reloadSource(e) {
const t = this._getSourceCaches(e);
for (const e of t)
e.resume(),
e.reload()
}
_updateSources(e) {
for (const t in this._sourceCaches)
this._sourceCaches[t].update(e)
}
_generateCollisionBoxes() {
for (const e in this._sourceCaches) {
const t = this._sourceCaches[e];
t.resume(),
t.reload()
}
}
_updatePlacement(t, i, r, n, o=!1) {
let s = !1
, a = !1;
const l = {};
for (const e of this._order) {
const i = this._layers[e];
if ("symbol" !== i.type)
continue;
if (!l[i.source]) {
const e = this._getLayerSourceCache(i);
if (!e)
continue;
l[i.source] = e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ - e.tileID.overscaledZ || (e.tileID.isLessThan(t.tileID) ? -1 : 1)))
}
const r = this.crossTileSymbolIndex.addLayer(i, l[i.source], t.center.lng, t.projection);
s = s || r
}
if (this.crossTileSymbolIndex.pruneUnusedLayers(this._order),
o = o || this._layerOrderChanged || 0 === r,
this._layerOrderChanged && this.fire(new e.Event("neworder")),
(o || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(e.exported.now(), t.zoom)) && (this.pauseablePlacement = new Gt(t,this._order,o,i,r,n,this.placement,this.fog && t.projection.supportsFog ? this.fog.state : null),
this._layerOrderChanged = !1),
this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, l),
this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(e.exported.now()),
a = !0),
s && this.pauseablePlacement.placement.setStale()),
a || s)
for (const e of this._order) {
const t = this._layers[e];
"symbol" === t.type && this.placement.updateLayerOpacities(t, l[t.source])
}
return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(e.exported.now())
}
_releaseSymbolFadeTiles() {
for (const e in this._sourceCaches)
this._sourceCaches[e].releaseSymbolFadeTiles()
}
getImages(e, t, i) {
this.imageManager.getImages(t.icons, i),
this._updateTilesForChangedImages();
const r = e=>{
e && e.setDependencies(t.tileID.key, t.type, t.icons)
}
;
r(this._otherSourceCaches[t.source]),
r(this._symbolSourceCaches[t.source])
}
getGlyphs(e, t, i) {
this.glyphManager.getGlyphs(t.stacks, i)
}
getResource(t, i, r) {
return e.makeRequest(i, r)
}
_getSourceCache(e) {
return this._otherSourceCaches[e]
}
_getLayerSourceCache(e) {
return "symbol" === e.type ? this._symbolSourceCaches[e.source] : this._otherSourceCaches[e.source]
}
_getSourceCaches(e) {
const t = [];
return this._otherSourceCaches[e] && t.push(this._otherSourceCaches[e]),
this._symbolSourceCaches[e] && t.push(this._symbolSourceCaches[e]),
t
}
_isSourceCacheLoaded(t) {
const i = this._getSourceCaches(t);
return 0 === i.length ? (this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`))),
!1) : i.every((e=>e.loaded()))
}
has3DLayers() {
return this._num3DLayers > 0
}
hasSymbolLayers() {
return this._numSymbolLayers > 0
}
hasCircleLayers() {
return this._numCircleLayers > 0
}
_clearWorkerCaches() {
this.dispatcher.broadcast("clearCaches")
}
destroy() {
this._clearWorkerCaches(),
this.terrainSetForDrapingOnly() && (delete this.terrain,
delete this.stylesheet.terrain)
}
}
ei.getSourceType = function(e) {
return ke[e]
}
,
ei.setSourceType = function(e, t) {
ke[e] = t
}
,
ei.registerForPluginStateChange = e.registerForPluginStateChange;
var ti = "\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0"
, ii = "attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}"
, ri = "\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {return currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;vec4 bounds=vec4(d,vec2(1.0)-d);h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif"
, ni = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif"
, oi = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";
let si = {}
, ai = {};
const li = [];
pi(ti, li),
pi(ri, li),
pi(ni, li),
pi(oi, li),
si = fi("", ri),
ai = fi(oi, ni);
const ci = fi("\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}", "\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered.")
, ui = ti
, hi = "\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";
var di = {
background: fi("uniform vec4 u_color;uniform float u_opacity;void main() {vec4 out_color=u_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
backgroundPattern: fi("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;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);vec4 out_color=mix(color1,color2,u_mix);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
circle: fi("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);vec4 world_center=vec4(pos,1);\n#else \nmat3 surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);vec4 world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);vec4 occlusion_world_center=vec4(circle_center,cantilevered_height,1);vec4 occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nvec4 occlusion_world_center=world_center;vec4 occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),
clippingMask: fi("void main() {gl_FragColor=vec4(1.0);}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),
heatmap: fi("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\nvec3 pos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),
heatmapTexture: fi("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}", "attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),
collisionBox: fi("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}", "attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),
collisionCircle: fi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}", "attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),
debug: fi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}", "attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),
fill: fi("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
fillOutline: fi("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
fillOutlinePattern: fi("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
fillPattern: fi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
fillExtrusion: fi("uniform lowp vec3 u_lightpos;varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;varying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvoid main() {vec4 color=v_color;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(v_normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying highp vec3 v_normal;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;vec3 pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_normal=normal;v_depth=gl_Position.w;\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_color.rgb+=clamp(color.rgb*directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),
fillExtrusionPattern: fi("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 p=vec3(pos_nx.xy,h);\n#else\nvec3 p=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);directional*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\nv_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),
hillshadePrepare: fi("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos);float f=getElevation(v_pos+vec2(epsilon.x,0));float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float h=getElevation(v_pos+vec2(0,epsilon.y));float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),
hillshade: fi("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
line: fi("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform float u_mix;uniform vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist_a=texture2D(u_dash_image,v_tex_a).a;float sdfdist_b=texture2D(u_dash_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfwidth=min(dash_from.z*u_scale.y,dash_to.z*u_scale.z);float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/sdfwidth;alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\n#ifdef RENDER_LINE_GRADIENT\nhighp vec4 out_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nvec4 out_color=color;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);}}\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform mediump vec3 u_scale;varying vec2 v_tex_a;varying vec2 v_tex_b;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash_from\n#pragma mapbox: define lowp vec4 dash_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash_from\n#pragma mapbox: initialize lowp vec4 dash_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;float scaleA=dash_from.z==0.0 ? 0.0 : tileZoomRatio/(dash_from.z*fromScale);float scaleB=dash_to.z==0.0 ? 0.0 : tileZoomRatio/(dash_to.z*toScale);float heightA=dash_from.y;float heightB=dash_to.y;v_tex_a=vec2(a_linesofar*scaleA/floorwidth,(-normal.y*heightA+dash_from.x+0.5)/u_texsize.y);v_tex_b=vec2(a_linesofar*scaleB/floorwidth,(-normal.y*heightB+dash_to.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),
linePattern: fi("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),
raster: fi("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),
symbolIcon: fi("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),
symbolSDF: fi("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);vec4 offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\nvec4 offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),
symbolTextAndIcon: fi("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;float globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nvec3 world_pos=vec3(tile_anchor,0)+h;float globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);vec4 projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),
terrainRaster: fi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float skirtOffset=24575.0;const float wireframeOffset=0.00015;void main() {v_pos0=a_texture_pos/8192.0;float skirt=float(a_pos.x >=skirtOffset);float elevation=elevation(a_texture_pos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=u_skirt_height*u_skirt_height*wireframeOffset;\n#endif\nvec2 decodedPos=a_pos-vec2(skirt*skirtOffset,0.0);gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),
terrainDepth: fi("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}", "uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying float v_depth;void main() {float elevation=elevation(a_texture_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),
skybox: fi("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", ii),
skyboxGradient: fi("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", ii),
skyboxCapture: fi("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}", "attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),
globeRaster: fi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);vec4 color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\nvec4 color=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idy=u_grid_matrix[1][2];float S=u_grid_matrix[2][2];vec3 latLng=u_grid_matrix*vec3(a_pos,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=a_pos[0]*S;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;\n#ifdef GLOBE_POLES\nvec3 up_vector=normalize(globe_pos)*u_tile_up_scale;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),
globeAtmosphere: fi("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));float horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nfloat horizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}", "attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")
};
function pi(e, t) {
const i = e.replace(/\s*\/\/[^\n]*\n/g, "\n").split("\n");
for (let e of i)
if (e = e.trim(),
"#" === e[0] && e.includes("if") && !e.includes("endif")) {
e = e.replace("#", "").replace(/ifdef|ifndef|elif|if/g, "").replace(/!|defined|\(|\)|\|\||&&/g, "").replace(/\s+/g, " ").trim();
const i = e.split(" ");
for (const e of i)
t.includes(e) || t.push(e)
}
}
function fi(e, t) {
const i = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g
, r = t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g)
, n = {}
, o = [...li];
return pi(e, o),
pi(t, o),
{
fragmentSource: e = e.replace(i, ((e,t,i,r,o)=>(n[o] = !0,
"define" === t ? `\n#ifndef HAS_UNIFORM_u_ ${o}\nvarying ${i} ${r} ${o};\n#else\nuniform ${i} ${r} u_ ${o};\n#endif\n` : `\n#ifdef HAS_UNIFORM_u_ ${o}\n ${i} ${r} ${o} = u_ ${o};\n#endif\n`))),
vertexSource: t = t.replace(i, ((e,t,i,r,o)=>{
const s = "float" === r ? "vec2" : "vec4"
, a = o.match(/color/) ? "color" : s;
return n[o] ? "define" === t ? `\n#ifndef HAS_UNIFORM_u_ ${o}\nuniform lowp float u_ ${o}_t;\nattribute ${i} ${s} a_ ${o};\nvarying ${i} ${r} ${o};\n#else\nuniform ${i} ${r} u_ ${o};\n#endif\n` : "vec4" === a ? `\n#ifndef HAS_UNIFORM_u_ ${o}\n ${o} = a_ ${o};\n#else\n ${i} ${r} ${o} = u_ ${o};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_ ${o}\n ${o} = unpack_mix_ ${a}(a_ ${o}, u_ ${o}_t);\n#else\n ${i} ${r} ${o} = u_ ${o};\n#endif\n` : "define" === t ? `\n#ifndef HAS_UNIFORM_u_ ${o}\nuniform lowp float u_ ${o}_t;\nattribute ${i} ${s} a_ ${o};\n#else\nuniform ${i} ${r} u_ ${o};\n#endif\n` : "vec4" === a ? `\n#ifndef HAS_UNIFORM_u_ ${o}\n ${i} ${r} ${o} = a_ ${o};\n#else\n ${i} ${r} ${o} = u_ ${o};\n#endif\n` : `\n#ifndef HAS_UNIFORM_u_ ${o}\n ${i} ${r} ${o} = unpack_mix_ ${a}(a_ ${o}, u_ ${o}_t);\n#else\n ${i} ${r} ${o} = u_ ${o};\n#endif\n`
}
)),
staticAttributes: r,
usedDefines: o
}
}
class mi {
constructor() {
this.boundProgram = null,
this.boundLayoutVertexBuffer = null,
this.boundPaintVertexBuffers = [],
this.boundIndexBuffer = null,
this.boundVertexOffset = null,
this.boundDynamicVertexBuffers = [],
this.vao = null
}
bind(e, t, i, r, n, o, s) {
this.context = e;
let a = this.boundPaintVertexBuffers.length !== r.length;
for (let e = 0; !a && e < r.length; e++)
this.boundPaintVertexBuffers[e] !== r[e] && (a = !0);
let l = this.boundDynamicVertexBuffers.length !== s.length;
for (let e = 0; !l && e < s.length; e++)
this.boundDynamicVertexBuffers[e] !== s[e] && (l = !0);
if (!e.extVertexArrayObject || !this.vao || this.boundProgram !== t || this.boundLayoutVertexBuffer !== i || a || l || this.boundIndexBuffer !== n || this.boundVertexOffset !== o)
this.freshBind(t, i, r, n, o, s);
else {
e.bindVertexArrayOES.set(this.vao);
for (const e of s)
e && e.bind();
n && n.dynamicDraw && n.bind()
}
}
freshBind(e, t, i, r, n, o) {
let s;
const a = e.numAttributes
, l = this.context
, c = l.gl;
if (l.extVertexArrayObject)
this.vao && this.destroy(),
this.vao = l.extVertexArrayObject.createVertexArrayOES(),
l.bindVertexArrayOES.set(this.vao),
s = 0,
this.boundProgram = e,
this.boundLayoutVertexBuffer = t,
this.boundPaintVertexBuffers = i,
this.boundIndexBuffer = r,
this.boundVertexOffset = n,
this.boundDynamicVertexBuffers = o;
else {
s = l.currentNumAttributes || 0;
for (let e = a; e < s; e++)
c.disableVertexAttribArray(e)
}
t.enableAttributes(c, e),
t.bind(),
t.setVertexAttribPointers(c, e, n);
for (const t of i)
t.enableAttributes(c, e),
t.bind(),
t.setVertexAttribPointers(c, e, n);
for (const t of o)
t && (t.enableAttributes(c, e),
t.bind(),
t.setVertexAttribPointers(c, e, n));
r && r.bind(),
l.currentNumAttributes = a
}
destroy() {
this.vao && (this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),
this.vao = null)
}
}
function _i(t, i) {
const r = Math.pow(2, i.canonical.z)
, n = i.canonical.y;
return [new e.MercatorCoordinate(0,n / r).toLngLat().lat, new e.MercatorCoordinate(0,(n + 1) / r).toLngLat().lat]
}
function gi(t, i, r, n, o, s, a) {
const l = t.context
, c = l.gl
, u = r.fbo;
if (!u)
return;
t.prepareDrawTile();
const h = t.useProgram("hillshade");
l.activeTexture.set(c.TEXTURE0),
c.bindTexture(c.TEXTURE_2D, u.colorAttachment.get());
const d = ((e,t,i,r)=>{
const n = i.paint.get("hillshade-shadow-color")
, o = i.paint.get("hillshade-highlight-color")
, s = i.paint.get("hillshade-accent-color");
let a = i.paint.get("hillshade-illumination-direction") * (Math.PI / 180);
"viewport" === i.paint.get("hillshade-illumination-anchor") && (a -= e.transform.angle);
const l = !e.options.moving;
return {
u_matrix: r || e.transform.calculateProjMatrix(t.tileID.toUnwrapped(), l),
u_image: 0,
u_latrange: _i(0, t.tileID),
u_light: [i.paint.get("hillshade-exaggeration"), a],
u_shadow: n,
u_highlight: o,
u_accent: s
}
}
)(t, r, n, t.terrain ? i.projMatrix : null);
t.prepareDrawProgram(l, h, i.toUnwrapped());
const {tileBoundsBuffer: p, tileBoundsIndexBuffer: f, tileBoundsSegments: m} = t.getTileBoundsBuffers(r);
h.draw(l, c.TRIANGLES, o, s, a, e.CullFaceMode.disabled, d, n.id, p, f, m)
}
function yi(t, i, r) {
if (!i.needsDEMTextureUpload)
return;
const n = t.context
, o = n.gl;
n.pixelStoreUnpackPremultiplyAlpha.set(!1),
i.demTexture = i.demTexture || t.getTileTexture(r.stride);
const s = r.getPixels();
i.demTexture ? i.demTexture.update(s, {
premultiply: !1
}) : i.demTexture = new e.Texture(n,s,o.RGBA,{
premultiply: !1
}),
i.needsDEMTextureUpload = !1
}
function xi(t, i, r, n, o, s) {
const a = t.context
, l = a.gl;
if (!i.dem)
return;
const c = i.dem;
if (a.activeTexture.set(l.TEXTURE1),
yi(t, i, c),
!i.demTexture)
return;
i.demTexture.bind(l.NEAREST, l.CLAMP_TO_EDGE);
const u = c.dim;
a.activeTexture.set(l.TEXTURE0);
let h = i.fbo;
if (!h) {
const t = new e.Texture(a,{
width: u,
height: u,
data: null
},l.RGBA);
t.bind(l.LINEAR, l.CLAMP_TO_EDGE),
h = i.fbo = a.createFramebuffer(u, u, !0),
h.colorAttachment.set(t.texture)
}
a.bindFramebuffer.set(h.framebuffer),
a.viewport.set([0, 0, u, u]);
const {tileBoundsBuffer: d, tileBoundsIndexBuffer: p, tileBoundsSegments: f} = t.getMercatorTileBoundsBuffers();
t.useProgram("hillshadePrepare").draw(a, l.TRIANGLES, n, o, s, e.CullFaceMode.disabled, ((t,i)=>{
const r = i.stride
, n = e.create();
return e.ortho(n, 0, e.EXTENT, -e.EXTENT, 0, 0, 1),
e.translate(n, n, [0, -e.EXTENT, 0]),
{
u_matrix: n,
u_image: 1,
u_dimension: [r, r],
u_zoom: t.overscaledZ,
u_unpack: i.unpackVector
}
}
)(i.tileID, c), r.id, d, p, f),
i.needsHillshadePrepare = !1
}
const vi = t=>({
u_matrix: new e.UniformMatrix4f(t),
u_image0: new e.Uniform1i(t),
u_skirt_height: new e.Uniform1f(t)
})
, bi = (e,t)=>({
u_matrix: e,
u_image0: 0,
u_skirt_height: t
})
, wi = (e,t,i,r,n,o,s,a,l,c,u,h,d,p)=>({
u_proj_matrix: Float32Array.from(e),
u_globe_matrix: t,
u_normalize_matrix: Float32Array.from(r),
u_merc_matrix: i,
u_zoom_transition: n,
u_merc_center: o,
u_image0: 0,
u_frustum_tl: s,
u_frustum_tr: a,
u_frustum_br: l,
u_frustum_bl: c,
u_globe_pos: u,
u_globe_radius: h,
u_viewport: d,
u_grid_matrix: p ? Float32Array.from(p) : new Float32Array(9)
});
function Ti(e, t) {
return null != e && null != t && !(!e.hasData() || !t.hasData()) && null != e.demTexture && null != t.demTexture && e.tileID.key !== t.tileID.key
}
const Ei = new class {
constructor() {
this.operations = {}
}
newMorphing(e, t, i, r, n) {
if (e in this.operations) {
const t = this.operations[e];
t.to.tileID.key !== i.tileID.key && (t.queued = i)
} else
this.operations[e] = {
startTime: r,
phase: 0,
duration: n,
from: t,
to: i,
queued: null
}
}
getMorphValuesForProxy(e) {
if (!(e in this.operations))
return null;
const t = this.operations[e];
return {
from: t.from,
to: t.to,
phase: t.phase
}
}
update(e) {
for (const t in this.operations) {
const i = this.operations[t];
for (i.phase = (e - i.startTime) / i.duration; i.phase >= 1 || !this._validOp(i); )
if (!this._nextOp(i, e)) {
delete this.operations[t];
break
}
}
}
_nextOp(e, t) {
return !!e.queued && (e.from = e.to,
e.to = e.queued,
e.queued = null,
e.phase = 0,
e.startTime = t,
!0)
}
_validOp(e) {
return e.from.hasData() && e.to.hasData()
}
}
, Si = {
0: null,
1: "TERRAIN_VERTEX_MORPHING",
2: "TERRAIN_WIREFRAME"
};
function Ci(e, t) {
const i = 1 << e.z;
return !t && (0 === e.x || e.x === i - 1) || 0 === e.y || e.y === i - 1
}
const Mi = e=>({
u_matrix: e
});
function Ai(t, i, r, n, o) {
if (o > 0) {
const s = e.exported.now()
, a = (s - t.timeAdded) / o
, l = i ? (s - i.timeAdded) / o : -1
, c = r.getSource()
, u = n.coveringZoomLevel({
tileSize: c.tileSize,
roundZoom: c.roundZoom
})
, h = !i || Math.abs(i.tileID.overscaledZ - u) > Math.abs(t.tileID.overscaledZ - u)
, d = h && t.refreshedUponExpiration ? 1 : e.clamp(h ? a : 1 - l, 0, 1);
return t.refreshedUponExpiration && a >= 1 && (t.refreshedUponExpiration = !1),
i ? {
opacity: 1,
mix: 1 - d
} : {
opacity: d,
mix: 0
}
}
return {
opacity: 1,
mix: 0
}
}
class Ii extends e.SourceCache {
constructor(e) {
const t = {
type: "raster-dem",
maxzoom: e.transform.maxZoom
}
, i = new P(je(),null)
, r = Pe("mock-dem", t, i, e.style);
super("mock-dem", r, !1),
r.setEventedParent(this),
this._sourceLoaded = !0
}
_loadTile(e, t) {
e.state = "loaded",
t(null)
}
}
class zi extends e.SourceCache {
constructor(e) {
const t = Pe("proxy", {
type: "geojson",
maxzoom: e.transform.maxZoom
}, new P(je(),null), e.style);
super("proxy", t, !1),
t.setEventedParent(this),
this.map = this.getSource().map = e,
this.used = this._sourceLoaded = !0,
this.renderCache = [],
this.renderCachePool = [],
this.proxyCachedFBO = {}
}
update(t, i, r) {
if (t.freezeTileCoverage)
return;
this.transform = t;
const n = t.coveringTiles({
tileSize: this._source.tileSize,
minzoom: this._source.minzoom,
maxzoom: this._source.maxzoom,
roundZoom: this._source.roundZoom,
reparseOverscaled: this._source.reparseOverscaled
}).reduce(((i,r)=>{
if (i[r.key] = "",
!this._tiles[r.key]) {
const i = new e.Tile(r,this._source.tileSize * r.overscaleFactor(),t.tileZoom);
i.state = "loaded",
this._tiles[r.key] = i
}
return i
}
), {});
for (const e in this._tiles)
e in n || (this.freeFBO(e),
this._tiles[e].unloadVectorData(),
delete this._tiles[e])
}
freeFBO(e) {
const t = this.proxyCachedFBO[e];
if (void 0 !== t) {
const i = Object.values(t);
this.renderCachePool.push(...i),
delete this.proxyCachedFBO[e]
}
}
deallocRenderCache() {
this.renderCache.forEach((e=>e.fb.destroy())),
this.renderCache = [],
this.renderCachePool = [],
this.proxyCachedFBO = {}
}
}
class ki extends e.OverscaledTileID {
constructor(e, t, i) {
super(e.overscaledZ, e.wrap, e.canonical.z, e.canonical.x, e.canonical.y),
this.proxyTileKey = t,
this.projMatrix = i
}
}
class Pi extends e.Elevation {
constructor(t, i) {
super(),
this.painter = t,
this.terrainTileForTile = {},
this.prevTerrainTileForTile = {};
const [r,n,o] = function(t) {
const i = new e.StructArrayLayout4i8
, r = new e.StructArrayLayout3ui6
, n = 131;
i.reserve(17161),
r.reserve(33800);
const o = e.EXTENT / 128
, s = e.EXTENT + o / 2
, a = s + o;
for (let t = -o; t < a; t += o)
for (let r = -o; r < a; r += o) {
const n = r < 0 || r > s || t < 0 || t > s ? 24575 : 0
, o = e.clamp(Math.round(r), 0, e.EXTENT)
, a = e.clamp(Math.round(t), 0, e.EXTENT);
i.emplaceBack(o + n, a, o, a)
}
const l = (e,t)=>{
const i = t * n + e;
r.emplaceBack(i + 1, i, i + n),
r.emplaceBack(i + n, i + n + 1, i + 1)
}
;
for (let e = 1; e < 129; e++)
for (let t = 1; t < 129; t++)
l(t, e);
return [0, 129].forEach((e=>{
for (let t = 0; t < 130; t++)
l(t, e),
l(e, t)
}
)),
[i, r, 32768]
}()
, s = t.context;
this.gridBuffer = s.createVertexBuffer(r, e.boundsAttributes.members),
this.gridIndexBuffer = s.createIndexBuffer(n),
this.gridSegments = e.SegmentVector.simpleSegment(0, 0, r.length, n.length),
this.gridNoSkirtSegments = e.SegmentVector.simpleSegment(0, 0, r.length, o),
this.proxyCoords = [],
this.proxiedCoords = {},
this._visibleDemTiles = [],
this._drapedRenderBatches = [],
this._sourceTilesOverlap = {},
this.proxySourceCache = new zi(i.map),
this.orthoMatrix = e.create(),
e.ortho(this.orthoMatrix, 0, e.EXTENT, 0, e.EXTENT, 0, 1);
const a = s.gl;
this._overlapStencilMode = new e.StencilMode({
func: a.GEQUAL,
mask: 255
},0,255,a.KEEP,a.KEEP,a.REPLACE),
this._previousZoom = t.transform.zoom,
this.pool = [],
this._findCoveringTileCache = {},
this._tilesDirty = {},
this.style = i,
this._useVertexMorphing = !0,
this._exaggeration = 1,
this._mockSourceCache = new Ii(i.map)
}
set style(e) {
e.on("data", this._onStyleDataEvent.bind(this)),
e.on("neworder", this._checkRenderCacheEfficiency.bind(this)),
this._style = e,
this._checkRenderCacheEfficiency()
}
update(t, i, r) {
if (t && t.terrain) {
this._style !== t && (this.style = t),
this.enabled = !0;
const n = t.terrain.properties;
this.sourceCache = 0 === t.terrain.drapeRenderMode ? this._mockSourceCache : t._getSourceCache(n.get("source")),
this._exaggeration = n.get("exaggeration");
const o = ()=>{
this.sourceCache.used && e.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);
const t = this.getScaledDemTileSize();
this.sourceCache.update(i, t, !0),
this.resetTileLookupCache(this.sourceCache.id)
}
;
this.sourceCache.usedForTerrain || (this.resetTileLookupCache(this.sourceCache.id),
this.sourceCache.usedForTerrain = !0,
o(),
this._initializing = !0),
o(),
i.updateElevation(!r),
this.resetTileLookupCache(this.proxySourceCache.id),
this.proxySourceCache.update(i),
this._emptyDEMTextureDirty = !0
} else
this._disable()
}
resetTileLookupCache(e) {
this._findCoveringTileCache[e] = {}
}
getScaledDemTileSize() {
return this.sourceCache.getSource().tileSize / 128 * this.proxySourceCache.getSource().tileSize
}
_checkRenderCacheEfficiency() {
const t = this.renderCacheEfficiency(this._style);
this._style.map._optimizeForTerrain || 100 !== t.efficiency && e.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)
}
_onStyleDataEvent(e) {
e.coord && "source" === e.dataType ? this._clearRenderCacheForTile(e.sourceCacheId, e.coord) : "style" === e.dataType && (this._invalidateRenderCache = !0)
}
_disable() {
if (this.enabled && (this.enabled = !1,
this._sharedDepthStencil = void 0,
this.proxySourceCache.deallocRenderCache(),
this._style))
for (const e in this._style._sourceCaches)
this._style._sourceCaches[e].usedForTerrain = !1
}
destroy() {
this._disable(),
this._emptyDEMTexture && this._emptyDEMTexture.destroy(),
this._emptyDepthBufferTexture && this._emptyDepthBufferTexture.destroy(),
this.pool.forEach((e=>e.fb.destroy())),
this.pool = [],
this._depthFBO && (this._depthFBO.destroy(),
this._depthFBO = void 0,
this._depthTexture = void 0)
}
_source() {
return this.enabled ? this.sourceCache : null
}
exaggeration() {
return this._exaggeration
}
get visibleDemTiles() {
return this._visibleDemTiles
}
get drapeBufferSize() {
const e = 2 * this.proxySourceCache.getSource().tileSize;
return [e, e]
}
set useVertexMorphing(e) {
this._useVertexMorphing = e
}
updateTileBinding(t) {
if (!this.enabled)
return;
this.prevTerrainTileForTile = this.terrainTileForTile;
const i = this.proxySourceCache
, r = this.painter.transform;
this._initializing && (this._initializing = 0 === r._centerAltitude && -1 === this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(r.center), -1),
this._emptyDEMTextureDirty = !this._initializing);
const n = this.proxyCoords = i.getIds().map((e=>{
const t = i.getTileByID(e).tileID;
return t.projMatrix = r.calculateProjMatrix(t.toUnwrapped()),
t
}
));
!function(t, i) {
const r = i.transform.pointCoordinate(i.transform.getCameraPoint())
, n = new e.pointGeometry(r.x,r.y);
t.sort(((t,i)=>{
if (i.overscaledZ - t.overscaledZ)
return i.overscaledZ - t.overscaledZ;
const r = new e.pointGeometry(t.canonical.x + (1 << t.canonical.z) * t.wrap,t.canonical.y)
, o = new e.pointGeometry(i.canonical.x + (1 << i.canonical.z) * i.wrap,i.canonical.y)
, s = n.mult(1 << t.canonical.z);
return s.x -= .5,
s.y -= .5,
s.distSqr(r) - s.distSqr(o)
}
))
}(n, this.painter),
this._previousZoom = r.zoom;
const o = this.proxyToSource || {};
this.proxyToSource = {},
n.forEach((e=>{
this.proxyToSource[e.key] = {}
}
)),
this.terrainTileForTile = {};
const s = this._style._sourceCaches;
for (const e in s) {
const i = s[e];
if (!i.used)
continue;
if (i !== this.sourceCache && this.resetTileLookupCache(i.id),
this._setupProxiedCoordsForOrtho(i, t[e], o),
i.usedForTerrain)
continue;
const r = t[e];
i.getSource().reparseOverscaled && this._assignTerrainTiles(r)
}
this.proxiedCoords[i.id] = n.map((e=>new ki(e,e.key,this.orthoMatrix))),
this._assignTerrainTiles(n),
this._prepareDEMTextures(),
this._setupDrapedRenderBatches(),
this._initFBOPool(),
this._setupRenderCache(o),
this.renderingToTexture = !1,
this._updateTimestamp = e.exported.now();
const a = {};
this._visibleDemTiles = [];
for (const e of this.proxyCoords) {
const t = this.terrainTileForTile[e.key];
if (!t)
continue;
const i = t.tileID.key;
i in a || (this._visibleDemTiles.push(t),
a[i] = i)
}
}
_assignTerrainTiles(e) {
this._initializing || e.forEach((e=>{
if (this.terrainTileForTile[e.key])
return;
const t = this._findTileCoveringTileID(e, this.sourceCache);
t && (this.terrainTileForTile[e.key] = t)
}
))
}
_prepareDEMTextures() {
const e = this.painter.context
, t = e.gl;
for (const i in this.terrainTileForTile) {
const r = this.terrainTileForTile[i]
, n = r.dem;
!n || r.demTexture && !r.needsDEMTextureUpload || (e.activeTexture.set(t.TEXTURE1),
yi(this.painter, r, n))
}
}
_prepareDemTileUniforms(e, t, i, r) {
if (!t || null == t.demTexture)
return !1;
const n = e.tileID.canonical
, o = Math.pow(2, t.tileID.canonical.z - n.z)
, s = r || "";
return i[`u_dem_tl ${s}`] = [n.x * o % 1, n.y * o % 1],
i[`u_dem_scale ${s}`] = o,
!0
}
get emptyDEMTexture() {
return !this._emptyDEMTextureDirty && this._emptyDEMTexture ? this._emptyDEMTexture : this._updateEmptyDEMTexture()
}
get emptyDepthBufferTexture() {
const t = this.painter.context
, i = t.gl;
if (!this._emptyDepthBufferTexture) {
const r = new e.RGBAImage({
width: 1,
height: 1
},Uint8Array.of(255, 255, 255, 255));
this._emptyDepthBufferTexture = new e.Texture(t,r,i.RGBA,{
premultiply: !1
})
}
return this._emptyDepthBufferTexture
}
_getLoadedAreaMinimum() {
let e = 0;
const t = this._visibleDemTiles.reduce(((t,i)=>{
if (!i.dem)
return t;
const r = i.dem.tree.minimums[0];
return r > 0 && e++,
t + r
}
), 0);
return e ? t / e : 0
}
_updateEmptyDEMTexture() {
const t = this.painter.context
, i = t.gl;
t.activeTexture.set(i.TEXTURE2);
const r = this._getLoadedAreaMinimum()
, n = new e.RGBAImage({
width: 1,
height: 1
},new Uint8Array(e.DEMData.pack(r, this.sourceCache.getSource().encoding)));
this._emptyDEMTextureDirty = !1;
let o = this._emptyDEMTexture;
return o ? o.update(n, {
premultiply: !1
}) : o = this._emptyDEMTexture = new e.Texture(t,n,i.RGBA,{
premultiply: !1
}),
o
}
setupElevationDraw(t, i, r) {
const n = this.painter.context
, o = n.gl
, s = (a = this.sourceCache.getSource().encoding,
{
u_dem: 2,
u_dem_prev: 4,
u_dem_unpack: e.DEMData.getUnpackVector(a),
u_dem_tl: [0, 0],
u_dem_tl_prev: [0, 0],
u_dem_scale: 0,
u_dem_scale_prev: 0,
u_dem_size: 0,
u_dem_lerp: 1,
u_depth: 3,
u_depth_size_inv: [0, 0],
u_exaggeration: 0,
u_tile_tl_up: [0, 0, 1],
u_tile_tr_up: [0, 0, 1],
u_tile_br_up: [0, 0, 1],
u_tile_bl_up: [0, 0, 1],
u_tile_up_scale: 1
});
var a;
s.u_dem_size = this.sourceCache.getSource().tileSize,
s.u_exaggeration = this.exaggeration();
const l = this.painter.transform
, c = l.projection
, u = t.tileID.canonical;
s.u_tile_tl_up = c.upVector(u, 0, 0),
s.u_tile_tr_up = c.upVector(u, e.EXTENT, 0),
s.u_tile_br_up = c.upVector(u, e.EXTENT, e.EXTENT),
s.u_tile_bl_up = c.upVector(u, 0, e.EXTENT),
s.u_tile_up_scale = r && r.useDenormalizedUpVectorScale ? e.GLOBE_METERS_TO_ECEF : c.upVectorScale(u, l.center.lat, l.worldSize).metersToTile;
let h = null
, d = null
, p = 1;
if (r && r.morphing && this._useVertexMorphing) {
const e = r.morphing.srcDemTile
, i = r.morphing.dstDemTile;
p = r.morphing.phase,
e && i && (this._prepareDemTileUniforms(t, e, s, "_prev") && (d = e),
this._prepareDemTileUniforms(t, i, s) && (h = i))
}
if (d && h ? (n.activeTexture.set(o.TEXTURE2),
h.demTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE, o.NEAREST),
n.activeTexture.set(o.TEXTURE4),
d.demTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE, o.NEAREST),
s.u_dem_lerp = p) : (h = this.terrainTileForTile[t.tileID.key],
n.activeTexture.set(o.TEXTURE2),
(this._prepareDemTileUniforms(t, h, s) ? h.demTexture : this.emptyDEMTexture).bind(o.NEAREST, o.CLAMP_TO_EDGE)),
n.activeTexture.set(o.TEXTURE3),
r && r.useDepthForOcclusion ? (this._depthTexture && this._depthTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE),
this._depthFBO && (s.u_depth_size_inv = [1 / this._depthFBO.width, 1 / this._depthFBO.height])) : (this.emptyDepthBufferTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE),
s.u_depth_size_inv = [1, 1]),
r && r.useMeterToDem && h) {
const t = (1 << h.tileID.canonical.z) * e.mercatorZfromAltitude(1, this.painter.transform.center.lat) * this.sourceCache.getSource().tileSize;
s.u_meter_to_dem = t
}
r && r.labelPlaneMatrixInv && (s.u_label_plane_matrix_inv = r.labelPlaneMatrixInv),
i.setTerrainUniformValues(n, s)
}
renderToBackBuffer(t) {
const i = this.painter
, r = this.painter.context;
0 !== t.length && (r.bindFramebuffer.set(null),
r.viewport.set([0, 0, i.width, i.height]),
i.gpuTimingDeferredRenderStart(),
this.renderingToTexture = !1,
function(t, i, r, n, o) {
if ("globe" === t.transform.projection.name)
!function(t, i, r, n, o) {
const s = t.context
, a = s.gl;
let l, c;
const u = t.options.showTerrainWireframe ? 2 : 0
, h = t.transform
, d = e.globeUseCustomAntiAliasing(t, s, h)
, p = (e,i)=>{
if (c === e)
return;
const r = [Si[e], "PROJECTION_GLOBE_VIEW"];
d && r.push("CUSTOM_ANTIALIASING"),
i && r.push(Si[u]),
l = t.useProgram("globeRaster", null, r),
c = e
}
, f = t.colorModeForRenderPass()
, m = new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);
Ei.update(o);
const _ = e.calculateGlobeMercatorMatrix(h)
, g = [e.mercatorXfromLng(h.center.lng), e.mercatorYfromLat(h.center.lat)]
, y = u ? [!1, !0] : [!1]
, x = t.globeSharedBuffers
, v = [h.width * e.exported.devicePixelRatio, h.height * e.exported.devicePixelRatio]
, b = Float32Array.from(h.globeMatrix)
, w = {
useDenormalizedUpVectorScale: !0
};
if (y.forEach((u=>{
c = -1;
const d = u ? a.LINES : a.TRIANGLES;
for (const c of n) {
const n = r.getTile(c)
, y = e.StencilMode.disabled
, T = i.prevTerrainTileForTile[c.key]
, E = i.terrainTileForTile[c.key];
Ti(T, E) && Ei.newMorphing(c.key, T, E, o, 250),
s.activeTexture.set(a.TEXTURE0),
n.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE);
const S = Ei.getMorphValuesForProxy(c.key)
, C = S ? 1 : 0;
S && e.extend$1(w, {
morphing: {
srcDemTile: S.from,
dstDemTile: S.to,
phase: e.easeCubicInOut(S.phase)
}
});
const M = e.tileCornersToBounds(c.canonical)
, A = e.getLatitudinalLod(M.getCenter().lat)
, I = e.getGridMatrix(c.canonical, M, A)
, z = e.globeNormalizeECEF(e.globeTileBounds(c.canonical))
, k = wi(h.projMatrix, b, _, z, e.globeToMercatorTransition(h.zoom), g, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, v, I);
if (p(C, u),
i.setupElevationDraw(n, l, w),
t.prepareDrawProgram(s, l, c.toUnwrapped()),
x) {
const [i,r,n] = u ? x.getWirefameBuffers(t.context, A) : x.getGridBuffers(A);
l.draw(s, d, m, y, f, e.CullFaceMode.backCCW, k, "globe_raster", i, r, n)
}
}
}
)),
x) {
const o = ["GLOBE_POLES", "PROJECTION_GLOBE_VIEW"];
d && o.push("CUSTOM_ANTIALIASING"),
l = t.useProgram("globeRaster", null, o);
for (const o of n) {
const {x: n, y: c, z: u} = o.canonical
, d = 0 === c
, p = c === (1 << u) - 1
, [_,y,b,T] = x.getPoleBuffers(u);
if (T && (d || p)) {
const c = r.getTile(o);
s.activeTexture.set(a.TEXTURE0),
c.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE);
let x = e.globePoleMatrixForTile(u, n, h);
const E = e.globeNormalizeECEF(e.globeTileBounds(o.canonical))
, S = (t,i)=>t.draw(s, a.TRIANGLES, m, e.StencilMode.disabled, f, e.CullFaceMode.disabled, wi(h.projMatrix, x, x, E, 0, g, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, v), "globe_pole_raster", i, b, T);
i.setupElevationDraw(c, l, w),
t.prepareDrawProgram(s, l, o.toUnwrapped()),
d && S(l, _),
p && (x = e.scale(e.create(), x, [1, -1, 1]),
S(l, y))
}
}
}
}(t, i, r, n, o);
else {
const s = t.context
, a = s.gl;
let l, c;
const u = t.options.showTerrainWireframe ? 2 : 0
, h = (e,i)=>{
if (c === e)
return;
const r = [Si[e]];
i && r.push(Si[u]),
l = t.useProgram("terrainRaster", null, r),
c = e
}
, d = t.colorModeForRenderPass()
, p = new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);
Ei.update(o);
const f = t.transform
, m = 6 * Math.pow(1.5, 22 - f.zoom) * i.exaggeration();
(u ? [!1, !0] : [!1]).forEach((u=>{
c = -1;
const _ = u ? a.LINES : a.TRIANGLES
, [g,y] = u ? i.getWirefameBuffer() : [i.gridIndexBuffer, i.gridSegments];
for (const c of n) {
const n = r.getTile(c)
, x = e.StencilMode.disabled
, v = i.prevTerrainTileForTile[c.key]
, b = i.terrainTileForTile[c.key];
Ti(v, b) && Ei.newMorphing(c.key, v, b, o, 250),
s.activeTexture.set(a.TEXTURE0),
n.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST);
const w = Ei.getMorphValuesForProxy(c.key)
, T = w ? 1 : 0;
let E;
w && (E = {
morphing: {
srcDemTile: w.from,
dstDemTile: w.to,
phase: e.easeCubicInOut(w.phase)
}
});
const S = bi(c.projMatrix, Ci(c.canonical, f.renderWorldCopies) ? m / 10 : m);
h(T, u),
i.setupElevationDraw(n, l, E),
t.prepareDrawProgram(s, l, c.toUnwrapped()),
l.draw(s, _, p, x, d, e.CullFaceMode.backCCW, S, "terrain_raster", i.gridBuffer, g, y)
}
}
))
}
}(i, this, this.proxySourceCache, t, this._updateTimestamp),
this.renderingToTexture = !0,
i.gpuTimingDeferredRenderEnd(),
t.splice(0, t.length))
}
renderBatch(t) {
if (0 === this._drapedRenderBatches.length)
return t + 1;
this.renderingToTexture = !0;
const i = this.painter
, r = this.painter.context
, n = this.proxySourceCache
, o = this.proxiedCoords[n.id]
, s = this._drapedRenderBatches.shift()
, a = []
, l = i.style.order;
let c = 0;
for (const u of o) {
const o = n.getTileByID(u.proxyTileKey)
, h = n.proxyCachedFBO[u.key] ? n.proxyCachedFBO[u.key][t] : void 0
, d = void 0 !== h ? n.renderCache[h] : this.pool[c++]
, p = void 0 !== h;
if (o.texture = d.tex,
p && !d.dirty) {
a.push(o.tileID);
continue
}
let f;
r.bindFramebuffer.set(d.fb.framebuffer),
this.renderedToTile = !1,
d.dirty && (r.clear({
color: e.Color.transparent,
stencil: 0
}),
d.dirty = !1);
for (let e = s.start; e <= s.end; ++e) {
const t = i.style._layers[l[e]];
if (t.isHidden(i.transform.zoom))
continue;
const n = i.style._getLayerSourceCache(t)
, o = n ? this.proxyToSource[u.key][n.id] : [u];
if (!o)
continue;
const s = o;
r.viewport.set([0, 0, d.fb.width, d.fb.height]),
f !== (n ? n.id : null) && (this._setupStencil(d, o, t, n),
f = n ? n.id : null),
i.renderLayer(i, n, t, s)
}
this.renderedToTile ? (d.dirty = !0,
a.push(o.tileID)) : p || --c,
5 === c && (c = 0,
this.renderToBackBuffer(a))
}
return this.renderToBackBuffer(a),
this.renderingToTexture = !1,
r.bindFramebuffer.set(null),
r.viewport.set([0, 0, i.width, i.height]),
s.end + 1
}
postRender() {}
renderCacheEfficiency(e) {
const t = e.order.length;
if (0 === t)
return {
efficiency: 100
};
let i, r = 0, n = 0, o = !1;
for (let s = 0; s < t; ++s) {
const t = e._layers[e.order[s]];
this._style.isLayerDraped(t) ? (o && ++r,
++n) : o || (o = !0,
i = t.id)
}
return 0 === n ? {
efficiency: 100
} : {
efficiency: 100 * (1 - r / n),
firstUndrapedLayer: i
}
}
getMinElevationBelowMSL() {
let e = 0;
return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{
e = Math.min(e, t.dem.tree.minimums[0])
}
)),
0 === e ? e : (e - 30) * this._exaggeration
}
raycast(e, t, i) {
if (!this._visibleDemTiles)
return null;
const r = this._visibleDemTiles.filter((e=>e.dem)).map((r=>{
const n = r.tileID
, o = 1 << n.overscaledZ
, {x: s, y: a} = n.canonical
, l = s / o
, c = (s + 1) / o
, u = a / o
, h = (a + 1) / o;
return {
minx: l,
miny: u,
maxx: c,
maxy: h,
t: r.dem.tree.raycastRoot(l, u, c, h, e, t, i),
tile: r
}
}
));
r.sort(((e,t)=>(null !== e.t ? e.t : Number.MAX_VALUE) - (null !== t.t ? t.t : Number.MAX_VALUE)));
for (const n of r) {
if (null == n.t)
return null;
const r = n.tile.dem.tree.raycast(n.minx, n.miny, n.maxx, n.maxy, e, t, i);
if (null != r)
return r
}
return null
}
_createFBO() {
const t = this.painter.context
, i = t.gl
, r = this.drapeBufferSize;
t.activeTexture.set(i.TEXTURE0);
const n = new e.Texture(t,{
width: r[0],
height: r[1],
data: null
},i.RGBA);
n.bind(i.LINEAR, i.CLAMP_TO_EDGE);
const o = t.createFramebuffer(r[0], r[1], !1);
return o.colorAttachment.set(n.texture),
o.depthAttachment = new Ee(t,o.framebuffer),
void 0 === this._sharedDepthStencil ? (this._sharedDepthStencil = t.createRenderbuffer(t.gl.DEPTH_STENCIL, r[0], r[1]),
this._stencilRef = 0,
o.depthAttachment.set(this._sharedDepthStencil),
t.clear({
stencil: 0
})) : o.depthAttachment.set(this._sharedDepthStencil),
t.extTextureFilterAnisotropic && !t.extTextureFilterAnisotropicForceOff && i.texParameterf(i.TEXTURE_2D, t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, t.extTextureFilterAnisotropicMax),
{
fb: o,
tex: n,
dirty: !1
}
}
_initFBOPool() {
for (; this.pool.length < Math.min(5, this.proxyCoords.length); )
this.pool.push(this._createFBO())
}
_shouldDisableRenderCache() {
if (this._style.light && this._style.light.hasTransition())
return !0;
for (const e in this._style._sourceCaches)
if (this._style._sourceCaches[e].hasTransition())
return !0;
return this._style.order.some((e=>{
const t = this._style._layers[e]
, i = t.isHidden(this.painter.transform.zoom)
, r = t.getCrossfadeParameters()
, n = !!r && 1 !== r.t
, o = t.hasTransition();
return "custom" !== t.type && !i && (n || o)
}
))
}
_clearRasterFadeFromRenderCache() {
let e = !1;
for (const t in this._style._sourceCaches)
if (this._style._sourceCaches[t]._source instanceof Me) {
e = !0;
break
}
if (e)
for (let e = 0; e < this._style.order.length; ++e) {
const t = this._style._layers[this._style.order[e]]
, i = t.isHidden(this.painter.transform.zoom)
, r = this._style._getLayerSourceCache(t);
if ("raster" !== t.type || i || !r)
continue;
const n = t.paint.get("raster-fade-duration");
for (const e of this.proxyCoords) {
const t = this.proxyToSource[e.key][r.id];
if (t)
for (const e of t) {
const t = Ai(r.getTile(e), r.findLoadedParent(e, 0), r, this.painter.transform, n);
(1 !== t.opacity || 0 !== t.mix) && this._clearRenderCacheForTile(r.id, e)
}
}
}
}
_setupDrapedRenderBatches() {
const e = this._style.order
, t = e.length;
if (0 === t)
return;
const i = [];
let r, n = 0, o = this._style._layers[e[n]];
for (; !this._style.isLayerDraped(o) && o.isHidden(this.painter.transform.zoom) && ++n < t; )
o = this._style._layers[e[n]];
for (; n < t; ++n) {
const t = this._style._layers[e[n]];
t.isHidden(this.painter.transform.zoom) || (this._style.isLayerDraped(t) ? void 0 === r && (r = n) : void 0 !== r && (i.push({
start: r,
end: n - 1
}),
r = void 0))
}
void 0 !== r && i.push({
start: r,
end: n - 1
}),
this._drapedRenderBatches = i
}
_setupRenderCache(e) {
const t = this.proxySourceCache;
if (this._shouldDisableRenderCache() || this._invalidateRenderCache) {
if (this._invalidateRenderCache = !1,
t.renderCache.length > t.renderCachePool.length) {
const e = Object.values(t.proxyCachedFBO);
t.proxyCachedFBO = {};
for (let i = 0; i < e.length; ++i) {
const r = Object.values(e[i]);
t.renderCachePool.push(...r)
}
}
return
}
this._clearRasterFadeFromRenderCache();
const i = this.proxyCoords
, r = this._tilesDirty;
for (let n = i.length - 1; n >= 0; n--) {
const o = i[n];
if (t.getTileByID(o.key),
void 0 !== t.proxyCachedFBO[o.key]) {
const i = e[o.key]
, n = this.proxyToSource[o.key];
let s = 0;
for (const e in n) {
const t = n[e]
, o = i[e];
if (!o || o.length !== t.length || t.some(((t,i)=>t !== o[i] || r[e] && r[e].hasOwnProperty(t.key)))) {
s = -1;
break
}
++s
}
for (const e in t.proxyCachedFBO[o.key])
t.renderCache[t.proxyCachedFBO[o.key][e]].dirty = s < 0 || s !== Object.values(i).length
}
}
const n = [...this._drapedRenderBatches];
n.sort(((e,t)=>t.end - t.start - (e.end - e.start)));
for (const e of n)
for (const r of i) {
if (t.proxyCachedFBO[r.key])
continue;
let i = t.renderCachePool.pop();
void 0 === i && t.renderCache.length < 50 && (i = t.renderCache.length,
t.renderCache.push(this._createFBO())),
void 0 !== i && (t.proxyCachedFBO[r.key] = {},
t.proxyCachedFBO[r.key][e.start] = i,
t.renderCache[i].dirty = !0)
}
this._tilesDirty = {}
}
_setupStencil(e, t, i, r) {
if (!r || !this._sourceTilesOverlap[r.id])
return void (this._overlapStencilType && (this._overlapStencilType = !1));
const n = this.painter.context
, o = n.gl;
if (t.length <= 1)
return void (this._overlapStencilType = !1);
let s;
if (i.isTileClipped())
s = t.length,
this._overlapStencilMode.test = {
func: o.EQUAL,
mask: 255
},
this._overlapStencilType = "Clip";
else {
if (!(t[0].overscaledZ > t[t.length - 1].overscaledZ))
return void (this._overlapStencilType = !1);
s = 1,
this._overlapStencilMode.test = {
func: o.GREATER,
mask: 255
},
this._overlapStencilType = "Mask"
}
this._stencilRef + s > 255 && (n.clear({
stencil: 0
}),
this._stencilRef = 0),
this._stencilRef += s,
this._overlapStencilMode.ref = this._stencilRef,
i.isTileClipped() && this._renderTileClippingMasks(t, this._overlapStencilMode.ref)
}
clipOrMaskOverlapStencilType() {
return "Clip" === this._overlapStencilType || "Mask" === this._overlapStencilType
}
stencilModeForRTTOverlap(t) {
return this.renderingToTexture && this._overlapStencilType ? ("Clip" === this._overlapStencilType && (this._overlapStencilMode.ref = this.painter._tileClippingMaskIDs[t.key]),
this._overlapStencilMode) : e.StencilMode.disabled
}
_renderTileClippingMasks(t, i) {
const r = this.painter
, n = this.painter.context
, o = n.gl;
r._tileClippingMaskIDs = {},
n.setColorMode(e.ColorMode.disabled),
n.setDepthMode(e.DepthMode.disabled);
const s = r.useProgram("clippingMask");
for (const a of t) {
const t = r._tileClippingMaskIDs[a.key] = --i;
s.draw(n, o.TRIANGLES, e.DepthMode.disabled, new e.StencilMode({
func: o.ALWAYS,
mask: 0
},t,255,o.KEEP,o.KEEP,o.REPLACE), e.ColorMode.disabled, e.CullFaceMode.disabled, Mi(a.projMatrix), "$clipping", r.tileExtentBuffer, r.quadTriangleIndexBuffer, r.tileExtentSegments)
}
}
pointCoordinate(t) {
const i = this.painter.transform;
if (t.x < 0 || t.x > i.width || t.y < 0 || t.y > i.height)
return null;
const r = [t.x, t.y, 1, 1];
e.transformMat4$1(r, r, i.pixelMatrixInverse),
e.scale$1(r, r, 1 / r[3]),
r[0] /= i.worldSize,
r[1] /= i.worldSize;
const n = i._camera.position
, o = e.mercatorZfromAltitude(1, i.center.lat)
, s = [n[0], n[1], n[2] / o, 0]
, a = e.subtract([], r.slice(0, 3), s);
e.normalize(a, a);
const l = this.raycast(s, a, this._exaggeration);
return null !== l && l ? (e.scaleAndAdd(s, s, a, l),
s[3] = s[2],
s[2] *= o,
s) : null
}
drawDepth() {
const t = this.painter
, i = t.context
, r = this.proxySourceCache
, n = Math.ceil(t.width)
, o = Math.ceil(t.height);
if (!this._depthFBO || this._depthFBO.width === n && this._depthFBO.height === o || (this._depthFBO.destroy(),
this._depthFBO = void 0,
this._depthTexture = void 0),
!this._depthFBO) {
const t = i.gl
, r = i.createFramebuffer(n, o, !0);
i.activeTexture.set(t.TEXTURE0);
const s = new e.Texture(i,{
width: n,
height: o,
data: null
},t.RGBA);
s.bind(t.NEAREST, t.CLAMP_TO_EDGE),
r.colorAttachment.set(s.texture);
const a = i.createRenderbuffer(i.gl.DEPTH_COMPONENT16, n, o);
r.depthAttachment.set(a),
this._depthFBO = r,
this._depthTexture = s
}
i.bindFramebuffer.set(this._depthFBO.framebuffer),
i.viewport.set([0, 0, n, o]),
function(t, i, r, n) {
if ("globe" === t.transform.projection.name)
return;
const o = t.context
, s = o.gl;
o.clear({
depth: 1
});
const a = t.useProgram("terrainDepth")
, l = new e.DepthMode(s.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D);
for (const t of n) {
const n = r.getTile(t)
, c = bi(t.projMatrix, 0);
i.setupElevationDraw(n, a),
a.draw(o, s.TRIANGLES, l, e.StencilMode.disabled, e.ColorMode.unblended, e.CullFaceMode.backCCW, c, "terrain_depth", i.gridBuffer, i.gridIndexBuffer, i.gridNoSkirtSegments)
}
}(t, this, r, this.proxyCoords)
}
_setupProxiedCoordsForOrtho(e, t, i) {
if (e.getSource()instanceof ze)
return this._setupProxiedCoordsForImageSource(e, t, i);
this._findCoveringTileCache[e.id] = this._findCoveringTileCache[e.id] || {};
const r = this.proxiedCoords[e.id] = []
, n = this.proxyCoords;
for (let t = 0; t < n.length; t++) {
const o = n[t]
, s = this._findTileCoveringTileID(o, e);
if (s) {
const t = this._createProxiedId(o, s, i[o.key] && i[o.key][e.id]);
r.push(t),
this.proxyToSource[o.key][e.id] = [t]
}
}
let o = !1;
for (let n = 0; n < t.length; n++) {
const s = e.getTile(t[n]);
if (!s || !s.hasData())
continue;
const a = this._findTileCoveringTileID(s.tileID, this.proxySourceCache);
if (a && a.tileID.canonical.z !== s.tileID.canonical.z) {
const t = this.proxyToSource[a.tileID.key][e.id]
, n = this._createProxiedId(a.tileID, s, i[a.tileID.key] && i[a.tileID.key][e.id]);
t ? t.splice(t.length - 1, 0, n) : this.proxyToSource[a.tileID.key][e.id] = [n],
r.push(n),
o = !0
}
}
this._sourceTilesOverlap[e.id] = o
}
_setupProxiedCoordsForImageSource(t, i, r) {
if (!t.getSource().loaded())
return;
const n = this.proxiedCoords[t.id] = []
, o = this.proxyCoords
, s = t.getSource()
, a = new e.pointGeometry(s.tileID.x,s.tileID.y)._div(1 << s.tileID.z)
, l = s.coordinates.map(e.MercatorCoordinate.fromLngLat).reduce(((e,t)=>(e.min.x = Math.min(e.min.x, t.x - a.x),
e.min.y = Math.min(e.min.y, t.y - a.y),
e.max.x = Math.max(e.max.x, t.x - a.x),
e.max.y = Math.max(e.max.y, t.y - a.y),
e)), {
min: new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),
max: new e.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)
})
, c = (t,i)=>{
const r = t.wrap + t.canonical.x / (1 << t.canonical.z)
, n = t.canonical.y / (1 << t.canonical.z)
, o = e.EXTENT / (1 << t.canonical.z)
, s = i.wrap + i.canonical.x / (1 << i.canonical.z)
, a = i.canonical.y / (1 << i.canonical.z);
return r + o < s + l.min.x || r > s + l.max.x || n + o < a + l.min.y || n > a + l.max.y
}
;
for (let e = 0; e < o.length; e++) {
const s = o[e];
for (let e = 0; e < i.length; e++) {
const o = t.getTile(i[e]);
if (!o || !o.hasData())
continue;
if (c(s, o.tileID))
continue;
const a = this._createProxiedId(s, o, r[s.key] && r[s.key][t.id])
, l = this.proxyToSource[s.key][t.id];
l ? l.push(a) : this.proxyToSource[s.key][t.id] = [a],
n.push(a)
}
}
}
_createProxiedId(t, i, r) {
let n = this.orthoMatrix;
if (r) {
const e = r.find((e=>e.key === i.tileID.key));
if (e)
return e
}
if (i.tileID.key !== t.key) {
const r = t.canonical.z - i.tileID.canonical.z;
let o, s, a;
n = e.create();
const l = i.tileID.wrap - t.wrap << t.overscaledZ;
r > 0 ? (o = e.EXTENT >> r,
s = o * ((i.tileID.canonical.x << r) - t.canonical.x + l),
a = o * ((i.tileID.canonical.y << r) - t.canonical.y)) : (o = e.EXTENT << -r,
s = e.EXTENT * (i.tileID.canonical.x - (t.canonical.x + l << -r)),
a = e.EXTENT * (i.tileID.canonical.y - (t.canonical.y << -r))),
e.ortho(n, 0, o, 0, o, 0, 1),
e.translate(n, n, [s, a, 0])
}
return new ki(i.tileID,t.key,n)
}
_findTileCoveringTileID(t, i) {
let r = i.getTile(t);
if (r && r.hasData())
return r;
const n = this._findCoveringTileCache[i.id]
, o = n[t.key];
if (r = o ? i.getTileByID(o) : null,
r && r.hasData() || null === o)
return r;
let s = r ? r.tileID : t
, a = s.overscaledZ;
const l = i.getSource().minzoom
, c = [];
if (!o) {
const n = i.getSource().maxzoom;
if (t.canonical.z >= n) {
const r = t.canonical.z - n;
i.getSource().reparseOverscaled ? (a = Math.max(t.canonical.z + 2, i.transform.tileZoom),
s = new e.OverscaledTileID(a,t.wrap,n,t.canonical.x >> r,t.canonical.y >> r)) : 0 !== r && (a = n,
s = new e.OverscaledTileID(a,t.wrap,n,t.canonical.x >> r,t.canonical.y >> r))
}
s.key !== t.key && (c.push(s.key),
r = i.getTile(s))
}
const u = e=>{
c.forEach((t=>{
n[t] = e
}
)),
c.length = 0
}
;
for (a -= 1; a >= l && (!r || !r.hasData()); a--) {
r && u(r.tileID.key);
const e = s.calculateScaledKey(a);
if (r = i.getTileByID(e),
r && r.hasData())
break;
const t = n[e];
if (null === t)
break;
void 0 === t ? c.push(e) : r = i.getTileByID(t)
}
return u(r ? r.tileID.key : null),
r && r.hasData() ? r : null
}
findDEMTileFor(e) {
return this.enabled ? this._findTileCoveringTileID(e, this.sourceCache) : null
}
prepareDrawTile() {
this.renderedToTile = !0
}
_clearRenderCacheForTile(e, t) {
let i = this._tilesDirty[e];
i || (i = this._tilesDirty[e] = {}),
i[t.key] = !0
}
getWirefameBuffer() {
if (!this.wireframeSegments) {
const t = function(t) {
let i = 0;
const r = new e.StructArrayLayout2ui4
, n = 131;
for (let e = 1; e < 129; e++) {
for (let t = 1; t < 129; t++)
i = e * n + t,
r.emplaceBack(i, i + 1),
r.emplaceBack(i, i + n),
r.emplaceBack(i + 1, i + n),
128 === e && r.emplaceBack(i + n, i + n + 1);
r.emplaceBack(i + 1, i + 1 + n)
}
return r
}();
this.wireframeIndexBuffer = this.painter.context.createIndexBuffer(t),
this.wireframeSegments = e.SegmentVector.simpleSegment(0, 0, this.gridBuffer.length, t.length)
}
return [this.wireframeIndexBuffer, this.wireframeSegments]
}
}
class Di {
static cacheKey(e, t, i, r) {
let n = `${t}${r ? r.cacheKey : ""}`;
for (const t of i)
e.usedDefines.includes(t) && (n += `/${t}`);
return n
}
constructor(t, i, r, n, o, s) {
const a = t.gl;
this.program = a.createProgram();
const l = function(e) {
const t = [];
for (let i = 0; i < e.length; i++) {
if (null === e[i])
continue;
const r = e[i].split(" ");
t.push(r.pop())
}
return t
}(r.staticAttributes)
, c = n ? n.getBinderAttributes() : []
, u = l.concat(c);
let h = n ? n.defines() : [];
h = h.concat(s.map((e=>`#define ${e}`)));
const d = h.concat(t.extStandardDerivatives ? "#extension GL_OES_standard_derivatives : enable\n".concat(hi) : hi, hi, ui, ci.fragmentSource, ai.fragmentSource, r.fragmentSource).join("\n")
, p = h.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif", ui, ci.vertexSource, ai.vertexSource, si.vertexSource, r.vertexSource).join("\n")
, f = a.createShader(a.FRAGMENT_SHADER);
if (a.isContextLost())
return void (this.failedToCreate = !0);
a.shaderSource(f, d),
a.compileShader(f),
a.attachShader(this.program, f);
const m = a.createShader(a.VERTEX_SHADER);
if (a.isContextLost())
this.failedToCreate = !0;
else {
a.shaderSource(m, p),
a.compileShader(m),
a.attachShader(this.program, m),
this.attributes = {},
this.numAttributes = u.length;
for (let e = 0; e < this.numAttributes; e++)
u[e] && (a.bindAttribLocation(this.program, e, u[e]),
this.attributes[u[e]] = e);
a.linkProgram(this.program),
a.deleteShader(m),
a.deleteShader(f),
this.fixedUniforms = o(t),
this.binderUniforms = n ? n.getUniforms(t) : [],
-1 !== s.indexOf("TERRAIN") && (this.terrainUniforms = (t=>({
u_dem: new e.Uniform1i(t),
u_dem_prev: new e.Uniform1i(t),
u_dem_unpack: new e.Uniform4f(t),
u_dem_tl: new e.Uniform2f(t),
u_dem_scale: new e.Uniform1f(t),
u_dem_tl_prev: new e.Uniform2f(t),
u_dem_scale_prev: new e.Uniform1f(t),
u_dem_size: new e.Uniform1f(t),
u_dem_lerp: new e.Uniform1f(t),
u_exaggeration: new e.Uniform1f(t),
u_depth: new e.Uniform1i(t),
u_depth_size_inv: new e.Uniform2f(t),
u_meter_to_dem: new e.Uniform1f(t),
u_label_plane_matrix_inv: new e.UniformMatrix4f(t),
u_tile_tl_up: new e.Uniform3f(t),
u_tile_tr_up: new e.Uniform3f(t),
u_tile_br_up: new e.Uniform3f(t),
u_tile_bl_up: new e.Uniform3f(t),
u_tile_up_scale: new e.Uniform1f(t)
}))(t)),
-1 !== s.indexOf("FOG") && (this.fogUniforms = (t=>({
u_fog_matrix: new e.UniformMatrix4f(t),
u_fog_range: new e.Uniform2f(t),
u_fog_color: new e.Uniform4f(t),
u_fog_horizon_blend: new e.Uniform1f(t),
u_fog_temporal_offset: new e.Uniform1f(t),
u_frustum_tl: new e.Uniform3f(t),
u_frustum_tr: new e.Uniform3f(t),
u_frustum_br: new e.Uniform3f(t),
u_frustum_bl: new e.Uniform3f(t),
u_globe_pos: new e.Uniform3f(t),
u_globe_radius: new e.Uniform1f(t),
u_globe_transition: new e.Uniform1f(t),
u_is_globe: new e.Uniform1i(t),
u_viewport: new e.Uniform2f(t)
}))(t))
}
}
setTerrainUniformValues(e, t) {
if (!this.terrainUniforms)
return;
const i = this.terrainUniforms;
if (!this.failedToCreate) {
e.program.set(this.program);
for (const e in t)
i[e].set(this.program, e, t[e])
}
}
setFogUniformValues(e, t) {
if (!this.fogUniforms)
return;
const i = this.fogUniforms;
if (!this.failedToCreate) {
e.program.set(this.program);
for (const e in t)
i[e].set(this.program, e, t[e])
}
}
draw(e, t, i, r, n, o, s, a, l, c, u, h, d, p, f) {
const m = e.gl;
if (this.failedToCreate)
return;
e.program.set(this.program),
e.setDepthMode(i),
e.setStencilMode(r),
e.setColorMode(n),
e.setCullFace(o);
for (const e of Object.keys(this.fixedUniforms))
this.fixedUniforms[e].set(this.program, e, s[e]);
p && p.setUniforms(this.program, e, this.binderUniforms, h, {
zoom: d
});
const _ = {
[m.LINES]: 2,
[m.TRIANGLES]: 3,
[m.LINE_STRIP]: 1
}[t];
for (const i of u.get()) {
const r = i.vaos || (i.vaos = {});
(r[a] || (r[a] = new mi)).bind(e, this, l, p ? p.getPaintVertexBuffers() : [], c, i.vertexOffset, f || []),
m.drawElements(t, i.primitiveLength * _, m.UNSIGNED_SHORT, i.primitiveOffset * _ * 2)
}
}
}
function Li(e, t, i) {
const r = 1 / D(i, 1, t.transform.tileZoom)
, n = Math.pow(2, i.tileID.overscaledZ)
, o = i.tileSize * Math.pow(2, t.transform.tileZoom) / n
, s = o * (i.tileID.canonical.x + i.tileID.wrap * n)
, a = o * i.tileID.canonical.y;
return {
u_image: 0,
u_texsize: i.imageAtlasTexture.size,
u_scale: [r, e.fromScale, e.toScale],
u_fade: e.t,
u_pixel_coord_upper: [s >> 16, a >> 16],
u_pixel_coord_lower: [65535 & s, 65535 & a]
}
}
const Bi = e.create()
, Oi = (t,i,r,n,o,s,a,l,c,u,h)=>{
const d = i.style.light
, p = d.properties.get("position")
, f = [p.x, p.y, p.z]
, m = e.create$1();
"viewport" === d.properties.get("anchor") && (e.fromRotation(m, -i.transform.angle),
e.transformMat3(f, f, m));
const _ = d.properties.get("color")
, g = i.transform
, y = {
u_matrix: t,
u_lightpos: f,
u_lightintensity: d.properties.get("intensity"),
u_lightcolor: [_.r, _.g, _.b],
u_vertical_gradient: +r,
u_opacity: n,
u_tile_id: [0, 0, 0],
u_zoom_transition: 0,
u_inv_rot_matrix: Bi,
u_merc_center: [0, 0],
u_up_dir: [0, 0, 0],
u_height_lift: 0,
u_ao: o,
u_edge_radius: s
};
return "globe" === g.projection.name && (y.u_tile_id = [a.canonical.x, a.canonical.y, 1 << a.canonical.z],
y.u_zoom_transition = c,
y.u_inv_rot_matrix = h,
y.u_merc_center = u,
y.u_up_dir = g.projection.upVector(new e.CanonicalTileID(0,0,0), u[0] * e.EXTENT, u[1] * e.EXTENT),
y.u_height_lift = l),
y
}
, Ri = (t,i,r,n,o,s,a,l,c,u,h,d,p)=>{
const f = Oi(t, i, r, n, o, s, a, u, h, d, p)
, m = {
u_height_factor: -Math.pow(2, a.overscaledZ) / c.tileSize / 8
};
return e.extend(f, Li(l, i, c), m)
}
, Fi = e=>({
u_matrix: e
})
, Ui = (t,i,r,n)=>e.extend(Fi(t), Li(r, i, n))
, Vi = (e,t)=>({
u_matrix: e,
u_world: t
})
, ji = (t,i,r,n,o)=>e.extend(Ui(t, i, r, n), {
u_world: o
})
, Ni = e.create()
, Gi = (t,i,r,n,o,s)=>{
const a = t.transform
, l = "globe" === a.projection.name;
let c;
if ("map" === s.paint.get("circle-pitch-alignment"))
if (l) {
const t = e.globePixelsToTileUnits(a.zoom, i.canonical) * a._pixelsPerMercatorPixel;
c = Float32Array.from([t, 0, 0, t])
} else
c = a.calculatePixelsToTileUnitsMatrix(r);
else
c = new Float32Array([a.pixelsToGLUnits[0], 0, 0, a.pixelsToGLUnits[1]]);
const u = {
u_camera_to_center_distance: a.cameraToCenterDistance,
u_matrix: t.translatePosMatrix(i.projMatrix, r, s.paint.get("circle-translate"), s.paint.get("circle-translate-anchor")),
u_device_pixel_ratio: e.exported.devicePixelRatio,
u_extrude_scale: c,
u_inv_rot_matrix: Ni,
u_merc_center: [0, 0],
u_tile_id: [0, 0, 0],
u_zoom_transition: 0,
u_up_dir: [0, 0, 0]
};
if (l) {
u.u_inv_rot_matrix = n,
u.u_merc_center = o,
u.u_tile_id = [i.canonical.x, i.canonical.y, 1 << i.canonical.z],
u.u_zoom_transition = e.globeToMercatorTransition(a.zoom);
const t = o[0] * e.EXTENT
, r = o[1] * e.EXTENT;
u.u_up_dir = a.projection.upVector(new e.CanonicalTileID(0,0,0), t, r)
}
return u
}
, $i = e=>{
const t = [];
return "map" === e.paint.get("circle-pitch-alignment") && t.push("PITCH_WITH_MAP"),
"map" === e.paint.get("circle-pitch-scale") && t.push("SCALE_WITH_MAP"),
t
}
, qi = (t,i,r,n)=>{
const o = e.EXTENT / r.tileSize;
return {
u_matrix: t,
u_camera_to_center_distance: i.getCameraToCenterDistance(n),
u_extrude_scale: [i.pixelsToGLUnits[0] / o, i.pixelsToGLUnits[1] / o]
}
}
, Zi = (e,t,i=1)=>({
u_matrix: e,
u_color: t,
u_overlay: 0,
u_overlay_scale: i
})
, Wi = e.create()
, Xi = (t,i,r,n,o,s,a)=>{
const l = t.transform
, c = "globe" === l.projection.name
, u = c ? e.globePixelsToTileUnits(l.zoom, i.canonical) * l._pixelsPerMercatorPixel : D(r, 1, s)
, h = {
u_matrix: i.projMatrix,
u_extrude_scale: u,
u_intensity: a,
u_inv_rot_matrix: Wi,
u_merc_center: [0, 0],
u_tile_id: [0, 0, 0],
u_zoom_transition: 0,
u_up_dir: [0, 0, 0]
};
if (c) {
h.u_inv_rot_matrix = n,
h.u_merc_center = o,
h.u_tile_id = [i.canonical.x, i.canonical.y, 1 << i.canonical.z],
h.u_zoom_transition = e.globeToMercatorTransition(l.zoom);
const t = o[0] * e.EXTENT
, r = o[1] * e.EXTENT;
h.u_up_dir = l.projection.upVector(new e.CanonicalTileID(0,0,0), t, r)
}
return h
}
, Hi = (e,t,i,r,n,o,s,a)=>{
const l = e.transform
, c = l.calculatePixelsToTileUnitsMatrix(t)
, u = {
u_matrix: Ji(e, t, i, n),
u_pixels_to_tile_units: c,
u_device_pixel_ratio: s,
u_units_to_pixels: [1 / l.pixelsToGLUnits[0], 1 / l.pixelsToGLUnits[1]],
u_dash_image: 0,
u_gradient_image: 1,
u_image_height: o,
u_texsize: [0, 0],
u_scale: [0, 0, 0],
u_mix: 0,
u_alpha_discard_threshold: 0,
u_trim_offset: a
};
if (Qi(i)) {
const i = Ki(t, e.transform);
u.u_texsize = t.lineAtlasTexture.size,
u.u_scale = [i, r.fromScale, r.toScale],
u.u_mix = r.t
}
return u
}
, Yi = (e,t,i,r,n,o)=>{
const s = e.transform
, a = Ki(t, s);
return {
u_matrix: Ji(e, t, i, n),
u_texsize: t.imageAtlasTexture.size,
u_pixels_to_tile_units: s.calculatePixelsToTileUnitsMatrix(t),
u_device_pixel_ratio: o,
u_image: 0,
u_scale: [a, r.fromScale, r.toScale],
u_fade: r.t,
u_units_to_pixels: [1 / s.pixelsToGLUnits[0], 1 / s.pixelsToGLUnits[1]],
u_alpha_discard_threshold: 0
}
}
;
function Ki(e, t) {
return 1 / D(e, 1, t.tileZoom)
}
function Ji(e, t, i, r) {
return e.translatePosMatrix(r || t.tileID.projMatrix, t, i.paint.get("line-translate"), i.paint.get("line-translate-anchor"))
}
function Qi(e) {
const t = e.paint.get("line-dasharray").value;
return t.value || "constant" !== t.kind
}
const er = (e,t,i,r,n,o)=>{
return {
u_matrix: e,
u_tl_parent: t,
u_scale_parent: i,
u_fade_t: r.mix,
u_opacity: r.opacity * n.paint.get("raster-opacity"),
u_image0: 0,
u_image1: 1,
u_brightness_low: n.paint.get("raster-brightness-min"),
u_brightness_high: n.paint.get("raster-brightness-max"),
u_saturation_factor: (a = n.paint.get("raster-saturation"),
a > 0 ? 1 - 1 / (1.001 - a) : -a),
u_contrast_factor: (s = n.paint.get("raster-contrast"),
s > 0 ? 1 / (1 - s) : 1 + s),
u_spin_weights: tr(n.paint.get("raster-hue-rotate")),
u_perspective_transform: o
};
var s, a
}
;
function tr(e) {
e *= Math.PI / 180;
const t = Math.sin(e)
, i = Math.cos(e);
return [(2 * i + 1) / 3, (-Math.sqrt(3) * t - i + 1) / 3, (Math.sqrt(3) * t - i + 1) / 3]
}
const ir = e.create()
, rr = (t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,_)=>{
const g = o.transform
, y = {
u_is_size_zoom_constant: +("constant" === t || "source" === t),
u_is_size_feature_constant: +("constant" === t || "camera" === t),
u_size_t: i ? i.uSizeT : 0,
u_size: i ? i.uSize : 0,
u_camera_to_center_distance: g.cameraToCenterDistance,
u_rotate_symbol: +r,
u_aspect_ratio: g.width / g.height,
u_fade_change: o.options.fadeDuration ? o.symbolFadeChange : 1,
u_matrix: s,
u_label_plane_matrix: a,
u_coord_matrix: l,
u_is_text: +c,
u_pitch_with_map: +n,
u_texsize: u,
u_texture: 0,
u_tile_id: [0, 0, 0],
u_zoom_transition: 0,
u_inv_rot_matrix: ir,
u_merc_center: [0, 0],
u_camera_forward: [0, 0, 0],
u_ecef_origin: [0, 0, 0],
u_tile_matrix: ir,
u_up_vector: [0, -1, 0]
};
return "globe" === _.name && (y.u_tile_id = [h.canonical.x, h.canonical.y, 1 << h.canonical.z],
y.u_zoom_transition = d,
y.u_inv_rot_matrix = f,
y.u_merc_center = p,
y.u_camera_forward = g._camera.forward(),
y.u_ecef_origin = e.globeECEFOrigin(g.globeMatrix, h.toUnwrapped()),
y.u_tile_matrix = Float32Array.from(g.globeMatrix),
y.u_up_vector = m),
y
}
, nr = (t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,_,g)=>e.extend(rr(t, i, r, n, o, s, a, l, c, u, d, p, f, m, _, g), {
u_gamma_scale: n ? o.transform.cameraToCenterDistance * Math.cos(o.terrain ? 0 : o.transform._pitch) : 1,
u_device_pixel_ratio: e.exported.devicePixelRatio,
u_is_halo: +h
})
, or = (t,i,r,n,o,s,a,l,c,u,h,d,p,f,m,_)=>e.extend(nr(t, i, r, n, o, s, a, l, !0, c, !0, h, d, p, f, m, _), {
u_texsize_icon: u,
u_texture_icon: 1
})
, sr = (e,t,i)=>({
u_matrix: e,
u_opacity: t,
u_color: i
})
, ar = (t,i,r,n,o,s)=>e.extend(function(e, t, i, r) {
const n = i.imageManager.getPattern(e.from.toString())
, o = i.imageManager.getPattern(e.to.toString())
, {width: s, height: a} = i.imageManager.getPixelSize()
, l = Math.pow(2, r.tileID.overscaledZ)
, c = r.tileSize * Math.pow(2, i.transform.tileZoom) / l
, u = c * (r.tileID.canonical.x + r.tileID.wrap * l)
, h = c * r.tileID.canonical.y;
return {
u_image: 0,
u_pattern_tl_a: n.tl,
u_pattern_br_a: n.br,
u_pattern_tl_b: o.tl,
u_pattern_br_b: o.br,
u_texsize: [s, a],
u_mix: t.t,
u_pattern_size_a: n.displaySize,
u_pattern_size_b: o.displaySize,
u_scale_a: t.fromScale,
u_scale_b: t.toScale,
u_tile_units_to_pixels: 1 / D(r, 1, i.transform.tileZoom),
u_pixel_coord_upper: [u >> 16, h >> 16],
u_pixel_coord_lower: [65535 & u, 65535 & h]
}
}(n, s, r, o), {
u_matrix: t,
u_opacity: i
})
, lr = {
fillExtrusion: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_lightpos: new e.Uniform3f(t),
u_lightintensity: new e.Uniform1f(t),
u_lightcolor: new e.Uniform3f(t),
u_vertical_gradient: new e.Uniform1f(t),
u_opacity: new e.Uniform1f(t),
u_edge_radius: new e.Uniform1f(t),
u_ao: new e.Uniform2f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_up_dir: new e.Uniform3f(t),
u_height_lift: new e.Uniform1f(t)
}),
fillExtrusionPattern: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_lightpos: new e.Uniform3f(t),
u_lightintensity: new e.Uniform1f(t),
u_lightcolor: new e.Uniform3f(t),
u_vertical_gradient: new e.Uniform1f(t),
u_height_factor: new e.Uniform1f(t),
u_edge_radius: new e.Uniform1f(t),
u_ao: new e.Uniform2f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_up_dir: new e.Uniform3f(t),
u_height_lift: new e.Uniform1f(t),
u_image: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_pixel_coord_upper: new e.Uniform2f(t),
u_pixel_coord_lower: new e.Uniform2f(t),
u_scale: new e.Uniform3f(t),
u_fade: new e.Uniform1f(t),
u_opacity: new e.Uniform1f(t)
}),
fill: t=>({
u_matrix: new e.UniformMatrix4f(t)
}),
fillPattern: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_image: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_pixel_coord_upper: new e.Uniform2f(t),
u_pixel_coord_lower: new e.Uniform2f(t),
u_scale: new e.Uniform3f(t),
u_fade: new e.Uniform1f(t)
}),
fillOutline: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_world: new e.Uniform2f(t)
}),
fillOutlinePattern: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_world: new e.Uniform2f(t),
u_image: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_pixel_coord_upper: new e.Uniform2f(t),
u_pixel_coord_lower: new e.Uniform2f(t),
u_scale: new e.Uniform3f(t),
u_fade: new e.Uniform1f(t)
}),
circle: t=>({
u_camera_to_center_distance: new e.Uniform1f(t),
u_extrude_scale: new e.UniformMatrix2f(t),
u_device_pixel_ratio: new e.Uniform1f(t),
u_matrix: new e.UniformMatrix4f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_up_dir: new e.Uniform3f(t)
}),
collisionBox: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_camera_to_center_distance: new e.Uniform1f(t),
u_extrude_scale: new e.Uniform2f(t)
}),
collisionCircle: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_inv_matrix: new e.UniformMatrix4f(t),
u_camera_to_center_distance: new e.Uniform1f(t),
u_viewport_size: new e.Uniform2f(t)
}),
debug: t=>({
u_color: new e.UniformColor(t),
u_matrix: new e.UniformMatrix4f(t),
u_overlay: new e.Uniform1i(t),
u_overlay_scale: new e.Uniform1f(t)
}),
clippingMask: t=>({
u_matrix: new e.UniformMatrix4f(t)
}),
heatmap: t=>({
u_extrude_scale: new e.Uniform1f(t),
u_intensity: new e.Uniform1f(t),
u_matrix: new e.UniformMatrix4f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_up_dir: new e.Uniform3f(t)
}),
heatmapTexture: t=>({
u_image: new e.Uniform1i(t),
u_color_ramp: new e.Uniform1i(t),
u_opacity: new e.Uniform1f(t)
}),
hillshade: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_image: new e.Uniform1i(t),
u_latrange: new e.Uniform2f(t),
u_light: new e.Uniform2f(t),
u_shadow: new e.UniformColor(t),
u_highlight: new e.UniformColor(t),
u_accent: new e.UniformColor(t)
}),
hillshadePrepare: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_image: new e.Uniform1i(t),
u_dimension: new e.Uniform2f(t),
u_zoom: new e.Uniform1f(t),
u_unpack: new e.Uniform4f(t)
}),
line: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_pixels_to_tile_units: new e.UniformMatrix2f(t),
u_device_pixel_ratio: new e.Uniform1f(t),
u_units_to_pixels: new e.Uniform2f(t),
u_dash_image: new e.Uniform1i(t),
u_gradient_image: new e.Uniform1i(t),
u_image_height: new e.Uniform1f(t),
u_texsize: new e.Uniform2f(t),
u_scale: new e.Uniform3f(t),
u_mix: new e.Uniform1f(t),
u_alpha_discard_threshold: new e.Uniform1f(t),
u_trim_offset: new e.Uniform2f(t)
}),
linePattern: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_texsize: new e.Uniform2f(t),
u_pixels_to_tile_units: new e.UniformMatrix2f(t),
u_device_pixel_ratio: new e.Uniform1f(t),
u_image: new e.Uniform1i(t),
u_units_to_pixels: new e.Uniform2f(t),
u_scale: new e.Uniform3f(t),
u_fade: new e.Uniform1f(t),
u_alpha_discard_threshold: new e.Uniform1f(t)
}),
raster: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_tl_parent: new e.Uniform2f(t),
u_scale_parent: new e.Uniform1f(t),
u_fade_t: new e.Uniform1f(t),
u_opacity: new e.Uniform1f(t),
u_image0: new e.Uniform1i(t),
u_image1: new e.Uniform1i(t),
u_brightness_low: new e.Uniform1f(t),
u_brightness_high: new e.Uniform1f(t),
u_saturation_factor: new e.Uniform1f(t),
u_contrast_factor: new e.Uniform1f(t),
u_spin_weights: new e.Uniform3f(t),
u_perspective_transform: new e.Uniform2f(t)
}),
symbolIcon: t=>({
u_is_size_zoom_constant: new e.Uniform1i(t),
u_is_size_feature_constant: new e.Uniform1i(t),
u_size_t: new e.Uniform1f(t),
u_size: new e.Uniform1f(t),
u_camera_to_center_distance: new e.Uniform1f(t),
u_rotate_symbol: new e.Uniform1i(t),
u_aspect_ratio: new e.Uniform1f(t),
u_fade_change: new e.Uniform1f(t),
u_matrix: new e.UniformMatrix4f(t),
u_label_plane_matrix: new e.UniformMatrix4f(t),
u_coord_matrix: new e.UniformMatrix4f(t),
u_is_text: new e.Uniform1i(t),
u_pitch_with_map: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_camera_forward: new e.Uniform3f(t),
u_tile_matrix: new e.UniformMatrix4f(t),
u_up_vector: new e.Uniform3f(t),
u_ecef_origin: new e.Uniform3f(t),
u_texture: new e.Uniform1i(t)
}),
symbolSDF: t=>({
u_is_size_zoom_constant: new e.Uniform1i(t),
u_is_size_feature_constant: new e.Uniform1i(t),
u_size_t: new e.Uniform1f(t),
u_size: new e.Uniform1f(t),
u_camera_to_center_distance: new e.Uniform1f(t),
u_rotate_symbol: new e.Uniform1i(t),
u_aspect_ratio: new e.Uniform1f(t),
u_fade_change: new e.Uniform1f(t),
u_matrix: new e.UniformMatrix4f(t),
u_label_plane_matrix: new e.UniformMatrix4f(t),
u_coord_matrix: new e.UniformMatrix4f(t),
u_is_text: new e.Uniform1i(t),
u_pitch_with_map: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_texture: new e.Uniform1i(t),
u_gamma_scale: new e.Uniform1f(t),
u_device_pixel_ratio: new e.Uniform1f(t),
u_tile_id: new e.Uniform3f(t),
u_zoom_transition: new e.Uniform1f(t),
u_inv_rot_matrix: new e.UniformMatrix4f(t),
u_merc_center: new e.Uniform2f(t),
u_camera_forward: new e.Uniform3f(t),
u_tile_matrix: new e.UniformMatrix4f(t),
u_up_vector: new e.Uniform3f(t),
u_ecef_origin: new e.Uniform3f(t),
u_is_halo: new e.Uniform1i(t)
}),
symbolTextAndIcon: t=>({
u_is_size_zoom_constant: new e.Uniform1i(t),
u_is_size_feature_constant: new e.Uniform1i(t),
u_size_t: new e.Uniform1f(t),
u_size: new e.Uniform1f(t),
u_camera_to_center_distance: new e.Uniform1f(t),
u_rotate_symbol: new e.Uniform1i(t),
u_aspect_ratio: new e.Uniform1f(t),
u_fade_change: new e.Uniform1f(t),
u_matrix: new e.UniformMatrix4f(t),
u_label_plane_matrix: new e.UniformMatrix4f(t),
u_coord_matrix: new e.UniformMatrix4f(t),
u_is_text: new e.Uniform1i(t),
u_pitch_with_map: new e.Uniform1i(t),
u_texsize: new e.Uniform2f(t),
u_texsize_icon: new e.Uniform2f(t),
u_texture: new e.Uniform1i(t),
u_texture_icon: new e.Uniform1i(t),
u_gamma_scale: new e.Uniform1f(t),
u_device_pixel_ratio: new e.Uniform1f(t),
u_is_halo: new e.Uniform1i(t)
}),
background: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_opacity: new e.Uniform1f(t),
u_color: new e.UniformColor(t)
}),
backgroundPattern: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_opacity: new e.Uniform1f(t),
u_image: new e.Uniform1i(t),
u_pattern_tl_a: new e.Uniform2f(t),
u_pattern_br_a: new e.Uniform2f(t),
u_pattern_tl_b: new e.Uniform2f(t),
u_pattern_br_b: new e.Uniform2f(t),
u_texsize: new e.Uniform2f(t),
u_mix: new e.Uniform1f(t),
u_pattern_size_a: new e.Uniform2f(t),
u_pattern_size_b: new e.Uniform2f(t),
u_scale_a: new e.Uniform1f(t),
u_scale_b: new e.Uniform1f(t),
u_pixel_coord_upper: new e.Uniform2f(t),
u_pixel_coord_lower: new e.Uniform2f(t),
u_tile_units_to_pixels: new e.Uniform1f(t)
}),
terrainRaster: vi,
terrainDepth: vi,
skybox: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_sun_direction: new e.Uniform3f(t),
u_cubemap: new e.Uniform1i(t),
u_opacity: new e.Uniform1f(t),
u_temporal_offset: new e.Uniform1f(t)
}),
skyboxGradient: t=>({
u_matrix: new e.UniformMatrix4f(t),
u_color_ramp: new e.Uniform1i(t),
u_center_direction: new e.Uniform3f(t),
u_radius: new e.Uniform1f(t),
u_opacity: new e.Uniform1f(t),
u_temporal_offset: new e.Uniform1f(t)
}),
skyboxCapture: t=>({
u_matrix_3f: new e.UniformMatrix3f(t),
u_sun_direction: new e.Uniform3f(t),
u_sun_intensity: new e.Uniform1f(t),
u_color_tint_r: new e.Uniform4f(t),
u_color_tint_m: new e.Uniform4f(t),
u_luminance: new e.Uniform1f(t)
}),
globeRaster: t=>({
u_proj_matrix: new e.UniformMatrix4f(t),
u_globe_matrix: new e.UniformMatrix4f(t),
u_normalize_matrix: new e.UniformMatrix4f(t),
u_merc_matrix: new e.UniformMatrix4f(t),
u_zoom_transition: new e.Uniform1f(t),
u_merc_center: new e.Uniform2f(t),
u_image0: new e.Uniform1i(t),
u_grid_matrix: new e.UniformMatrix3f(t),
u_frustum_tl: new e.Uniform3f(t),
u_frustum_tr: new e.Uniform3f(t),
u_frustum_br: new e.Uniform3f(t),
u_frustum_bl: new e.Uniform3f(t),
u_globe_pos: new e.Uniform3f(t),
u_globe_radius: new e.Uniform1f(t),
u_viewport: new e.Uniform2f(t)
}),
globeAtmosphere: t=>({
u_frustum_tl: new e.Uniform3f(t),
u_frustum_tr: new e.Uniform3f(t),
u_frustum_br: new e.Uniform3f(t),
u_frustum_bl: new e.Uniform3f(t),
u_horizon: new e.Uniform1f(t),
u_transition: new e.Uniform1f(t),
u_fadeout_range: new e.Uniform1f(t),
u_color: new e.Uniform4f(t),
u_high_color: new e.Uniform4f(t),
u_space_color: new e.Uniform4f(t),
u_star_intensity: new e.Uniform1f(t),
u_star_density: new e.Uniform1f(t),
u_star_size: new e.Uniform1f(t),
u_temporal_offset: new e.Uniform1f(t),
u_horizon_angle: new e.Uniform1f(t),
u_rotation_matrix: new e.UniformMatrix4f(t)
})
};
let cr;
function ur(t, i, r, n, o, s, a) {
const l = t.context
, c = l.gl
, u = t.transform
, h = t.useProgram("collisionBox")
, d = [];
let p = 0
, f = 0;
for (let m = 0; m < n.length; m++) {
const _ = n[m]
, g = i.getTile(_)
, y = g.getBucket(r);
if (!y)
continue;
const x = bt(_, y, u);
let v = x;
0 === o[0] && 0 === o[1] || (v = t.translatePosMatrix(x, g, o, s));
const b = a ? y.textCollisionBox : y.iconCollisionBox
, w = y.collisionCircleArray;
if (w.length > 0) {
const t = e.create()
, i = v;
e.mul(t, y.placementInvProjMatrix, u.glCoordMatrix),
e.mul(t, t, y.placementViewportMatrix),
d.push({
circleArray: w,
circleOffset: f,
transform: i,
invTransform: t,
projection: y.getProjection()
}),
p += w.length / 4,
f = p
}
b && (t.terrain && t.terrain.setupElevationDraw(g, h),
h.draw(l, c.LINES, e.DepthMode.disabled, e.StencilMode.disabled, t.colorModeForRenderPass(), e.CullFaceMode.disabled, qi(v, u, g, y.getProjection()), r.id, b.layoutVertexBuffer, b.indexBuffer, b.segments, null, u.zoom, null, [b.collisionVertexBuffer, b.collisionVertexBufferExt]))
}
if (!a || !d.length)
return;
const m = t.useProgram("collisionCircle")
, _ = new e.StructArrayLayout2f1f2i16;
_.resize(4 * p),
_._trim();
let g = 0;
for (const e of d)
for (let t = 0; t < e.circleArray.length / 4; t++) {
const i = 4 * t
, r = e.circleArray[i + 0]
, n = e.circleArray[i + 1]
, o = e.circleArray[i + 2]
, s = e.circleArray[i + 3];
_.emplace(g++, r, n, o, s, 0),
_.emplace(g++, r, n, o, s, 1),
_.emplace(g++, r, n, o, s, 2),
_.emplace(g++, r, n, o, s, 3)
}
(!cr || cr.length < 2 * p) && (cr = function(t) {
const i = 2 * t
, r = new e.StructArrayLayout3ui6;
r.resize(i),
r._trim();
for (let e = 0; e < i; e++) {
const t = 6 * e;
r.uint16[t + 0] = 4 * e + 0,
r.uint16[t + 1] = 4 * e + 1,
r.uint16[t + 2] = 4 * e + 2,
r.uint16[t + 3] = 4 * e + 2,
r.uint16[t + 4] = 4 * e + 3,
r.uint16[t + 5] = 4 * e + 0
}
return r
}(p));
const y = l.createIndexBuffer(cr, !0)
, x = l.createVertexBuffer(_, e.collisionCircleLayout.members, !0);
for (const i of d) {
const n = {
u_matrix: i.transform,
u_inv_matrix: i.invTransform,
u_camera_to_center_distance: (v = u).getCameraToCenterDistance(i.projection),
u_viewport_size: [v.width, v.height]
};
m.draw(l, c.TRIANGLES, e.DepthMode.disabled, e.StencilMode.disabled, t.colorModeForRenderPass(), e.CullFaceMode.disabled, n, r.id, x, y, e.SegmentVector.simpleSegment(0, 2 * i.circleOffset, i.circleArray.length, i.circleArray.length / 2), null, u.zoom)
}
var v;
x.destroy(),
y.destroy()
}
const hr = e.create();
function dr(t, i, r, n, o, s) {
const {horizontalAlign: a, verticalAlign: l} = e.getAnchorAlignment(t)
, c = -(a - .5) * i
, u = -(l - .5) * r
, h = e.evaluateVariableOffset(t, n);
return new e.pointGeometry((c / o + h[0]) * s,(u / o + h[1]) * s)
}
function pr(t, i, r, n, o, s, a, l, c, u, h) {
const d = t.text.placedSymbolArray
, p = t.text.dynamicLayoutVertexArray
, f = t.icon.dynamicLayoutVertexArray
, m = {}
, _ = wt(l, t.getProjection(), s)
, g = s.elevation
, y = t.getProjection().upVectorScale(l.canonical, s.center.lat, s.worldSize);
p.clear();
for (let f = 0; f < d.length; f++) {
const x = d.get(f)
, v = t.allowVerticalPlacement && !x.placedOrientation
, b = x.hidden || !x.crossTileID || v ? null : n[x.crossTileID];
if (b) {
const n = new e.pointGeometry(x.tileAnchorX,x.tileAnchorY)
, d = t.getProjection().upVector(l.canonical, n.x, n.y)
, f = g ? g.getAtTileOffset(l, n.x, n.y) : 0
, v = ot([x.projectedAnchorX + f * d[0] * y.metersToTile, x.projectedAnchorY + f * d[1] * y.metersToTile, x.projectedAnchorZ + f * d[2] * y.metersToTile], r ? _ : a)
, w = st(s.getCameraToCenterDistance(t.getProjection()), v.signedDistanceFromCamera);
let T = o.evaluateSizeForFeature(t.textSizeData, u, x) * w / e.ONE_EM;
r && (T *= t.tilePixelRatio / c);
const {width: E, height: S, anchor: C, textOffset: M, textScale: A} = b
, I = dr(C, E, S, M, A, T);
let z;
if (r) {
const e = n.add(I)
, {x: i, y: r, z: o} = t.getProjection().projectTilePoint(e.x, e.y, l.canonical);
z = ot([i + f * d[0] * y.metersToTile, r + f * d[1] * y.metersToTile, o + f * d[2] * y.metersToTile], a).point
} else {
const e = i ? I.rotate(-s.angle) : I;
z = [v.point[0] + e.x, v.point[1] + e.y, 0]
}
const k = t.allowVerticalPlacement && x.placedOrientation === e.WritingMode.vertical ? Math.PI / 2 : 0;
for (let t = 0; t < x.numGlyphs; t++)
e.addDynamicAttributes(p, z[0], z[1], z[2], k);
h && x.associatedIconIndex >= 0 && (m[x.associatedIconIndex] = {
shiftedAnchor: z,
angle: k
})
} else
_t(x.numGlyphs, p)
}
if (h) {
f.clear();
const i = t.icon.placedSymbolArray;
for (let t = 0; t < i.length; t++) {
const r = i.get(t);
if (r.hidden)
_t(r.numGlyphs, f);
else {
const i = m[t];
if (i)
for (let t = 0; t < r.numGlyphs; t++)
e.addDynamicAttributes(f, i.shiftedAnchor[0], i.shiftedAnchor[1], i.shiftedAnchor[2], i.angle);
else
_t(r.numGlyphs, f)
}
}
t.icon.dynamicLayoutVertexBuffer.updateData(f)
}
t.text.dynamicLayoutVertexBuffer.updateData(p)
}
function fr(e, t, i) {
return i.iconsInText && t ? "symbolTextAndIcon" : e ? "symbolSDF" : "symbolIcon"
}
function mr(t, i, r, n, o, s, a, l, c, u, h, d) {
const p = t.context
, f = p.gl
, m = t.transform
, _ = "map" === l
, g = "map" === c
, y = _ && "point" !== r.layout.get("symbol-placement")
, x = _ && !g && !y
, v = void 0 !== r.layout.get("symbol-sort-key").constantOr(1);
let b = !1;
const w = t.depthModeForSublayer(0, e.DepthMode.ReadOnly)
, T = [e.mercatorXfromLng(m.center.lng), e.mercatorYfromLat(m.center.lat)]
, E = r.layout.get("text-variable-anchor")
, S = "globe" === m.projection.name
, C = []
, M = [0, -1, 0];
let A = M;
!S && !m.mercatorFromTransition || _ || (A = function(t) {
const i = t._camera.getWorldToCamera(t.worldSize, 1)
, r = e.multiply([], i, t.globeMatrix);
e.invert(r, r);
const n = [0, 0, 0]
, o = [0, 1, 0, 0];
return e.transformMat4$1(o, o, r),
n[0] = o[0],
n[1] = o[1],
n[2] = o[2],
e.normalize(n, n),
n
}(m));
for (const l of n) {
const n = i.getTile(l)
, c = n.getBucket(r);
if (!c)
continue;
if ("mercator" === c.projection.name && S)
continue;
const h = o ? c.text : c.icon;
if (!h || c.fullyClipped || !h.segments.get().length)
continue;
const d = h.programConfigurations.get(r.id)
, p = o || c.sdfIcons
, w = o ? c.textSizeData : c.iconSizeData
, I = g || 0 !== m.pitch
, z = e.evaluateSizeForZoom(w, m.zoom);
let k, P, D, L, B = [0, 0], O = null;
if (o) {
if (P = n.glyphAtlasTexture,
D = f.LINEAR,
k = n.glyphAtlasTexture.size,
c.iconsInText) {
B = n.imageAtlasTexture.size,
O = n.imageAtlasTexture;
const e = "composite" === w.kind || "camera" === w.kind;
L = I || t.options.rotating || t.options.zooming || e ? f.LINEAR : f.NEAREST
}
} else {
const e = 1 !== r.layout.get("icon-size").constantOr(0) || c.iconsNeedLinear;
P = n.imageAtlasTexture,
D = p || t.options.rotating || t.options.zooming || e || I ? f.LINEAR : f.NEAREST,
k = n.imageAtlasTexture.size
}
const R = "globe" === c.projection.name
, F = R ? A : M
, U = R ? e.globeToMercatorTransition(m.zoom) : 0
, V = wt(l, c.getProjection(), m)
, j = m.calculatePixelsToTileUnitsMatrix(n)
, N = tt(V, n.tileID.canonical, g, _, m, c.getProjection(), j)
, G = t.terrain && g && y ? e.invert(e.create(), N) : hr
, $ = rt(V, n.tileID.canonical, g, _, m, c.getProjection(), j)
, q = E && c.hasTextData()
, Z = "none" !== r.layout.get("icon-text-fit") && q && c.hasIconData();
if (y) {
const e = m.elevation
, i = e ? e.getAtTileOffsetFunc(l, m.center.lat, m.worldSize, c.getProjection()) : e=>[0, 0, 0]
, r = it(V, n.tileID.canonical, g, _, m, c.getProjection(), j);
lt(c, V, t, o, r, $, g, u, i, l)
}
const W = y || o && E || Z
, X = t.translatePosMatrix(V, n, s, a)
, H = W ? hr : N
, Y = t.translatePosMatrix($, n, s, a, !0)
, K = c.getProjection().createInversionMatrix(m, l.canonical)
, J = [];
t.terrain && g && J.push("PITCH_WITH_MAP_TERRAIN"),
R && J.push("PROJECTION_GLOBE_VIEW"),
W && J.push("PROJECTED_POS_ON_VIEWPORT");
const Q = p && 0 !== r.paint.get(o ? "text-halo-width" : "icon-halo-width").constantOr(1);
let ee;
ee = p ? c.iconsInText ? or(w.kind, z, x, g, t, X, H, Y, k, B, l, U, T, K, F, c.getProjection()) : nr(w.kind, z, x, g, t, X, H, Y, o, k, !0, l, U, T, K, F, c.getProjection()) : rr(w.kind, z, x, g, t, X, H, Y, o, k, l, U, T, K, F, c.getProjection());
const te = {
program: t.useProgram(fr(p, o, c), d, J),
buffers: h,
uniformValues: ee,
atlasTexture: P,
atlasTextureIcon: O,
atlasInterpolation: D,
atlasInterpolationIcon: L,
isSDF: p,
hasHalo: Q,
tile: n,
labelPlaneMatrixInv: G
};
if (v && c.canOverlap) {
b = !0;
const t = h.segments.get();
for (const i of t)
C.push({
segments: new e.SegmentVector([i]),
sortKey: i.sortKey,
state: te
})
} else
C.push({
segments: h.segments,
sortKey: 0,
state: te
})
}
b && C.sort(((e,t)=>e.sortKey - t.sortKey));
for (const e of C) {
const i = e.state;
if (t.terrain && t.terrain.setupElevationDraw(i.tile, i.program, {
useDepthForOcclusion: !S,
labelPlaneMatrixInv: i.labelPlaneMatrixInv
}),
p.activeTexture.set(f.TEXTURE0),
i.atlasTexture.bind(i.atlasInterpolation, f.CLAMP_TO_EDGE),
i.atlasTextureIcon && (p.activeTexture.set(f.TEXTURE1),
i.atlasTextureIcon && i.atlasTextureIcon.bind(i.atlasInterpolationIcon, f.CLAMP_TO_EDGE)),
i.isSDF) {
const n = i.uniformValues;
i.hasHalo && (n.u_is_halo = 1,
_r(i.buffers, e.segments, r, t, i.program, w, h, d, n)),
n.u_is_halo = 0
}
_r(i.buffers, e.segments, r, t, i.program, w, h, d, i.uniformValues)
}
}
function _r(t, i, r, n, o, s, a, l, c) {
const u = n.context
, h = [t.dynamicLayoutVertexBuffer, t.opacityVertexBuffer, t.globeExtVertexBuffer];
o.draw(u, u.gl.TRIANGLES, s, a, l, e.CullFaceMode.disabled, c, r.id, t.layoutVertexBuffer, t.indexBuffer, i, r.paint, n.transform.zoom, t.programConfigurations.get(r.id), h)
}
function gr(t, i, r, n, o, s, a) {
const l = t.context.gl
, c = r.paint.get("fill-pattern")
, u = c && c.constantOr(1)
, h = r.getCrossfadeParameters();
let d, p, f, m, _;
a ? (p = u && !r.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline",
d = l.LINES) : (p = u ? "fillPattern" : "fill",
d = l.TRIANGLES);
for (const g of n) {
const n = i.getTile(g);
if (u && !n.patternsLoaded())
continue;
const y = n.getBucket(r);
if (!y)
continue;
t.prepareDrawTile();
const x = y.programConfigurations.get(r.id)
, v = t.useProgram(p, x);
u && (t.context.activeTexture.set(l.TEXTURE0),
n.imageAtlasTexture.bind(l.LINEAR, l.CLAMP_TO_EDGE),
x.updatePaintBuffers(h));
const b = c.constantOr(null);
if (b && n.imageAtlas) {
const e = n.imageAtlas
, t = e.patternPositions[b.to.toString()]
, i = e.patternPositions[b.from.toString()];
t && i && x.setConstantPatternPositions(t, i)
}
const w = t.translatePosMatrix(g.projMatrix, n, r.paint.get("fill-translate"), r.paint.get("fill-translate-anchor"));
if (a) {
m = y.indexBuffer2,
_ = y.segments2;
const e = t.terrain && t.terrain.renderingToTexture ? t.terrain.drapeBufferSize : [l.drawingBufferWidth, l.drawingBufferHeight];
f = "fillOutlinePattern" === p && u ? ji(w, t, h, n, e) : Vi(w, e)
} else
m = y.indexBuffer,
_ = y.segments,
f = u ? Ui(w, t, h, n) : Fi(w);
t.prepareDrawProgram(t.context, v, g.toUnwrapped()),
v.draw(t.context, d, o, t.stencilModeForClipping(g), s, e.CullFaceMode.disabled, f, r.id, y.layoutVertexBuffer, m, _, r.paint, t.transform.zoom, x)
}
}
function yr(t, i, r, n, o, s, a) {
const l = t.context
, c = l.gl
, u = t.transform
, h = r.paint.get("fill-extrusion-pattern")
, d = h.constantOr(1)
, p = r.getCrossfadeParameters()
, f = r.paint.get("fill-extrusion-opacity")
, m = [r.paint.get("fill-extrusion-ambient-occlusion-intensity"), r.paint.get("fill-extrusion-ambient-occlusion-radius")]
, _ = r.layout.get("fill-extrusion-edge-radius")
, g = "globe" === u.projection.name ? e.fillExtrusionHeightLift() : 0
, y = "globe" === u.projection.name
, x = y ? e.globeToMercatorTransition(u.zoom) : 0
, v = [e.mercatorXfromLng(u.center.lng), e.mercatorYfromLat(u.center.lat)]
, b = [];
y && (b.push("PROJECTION_GLOBE_VIEW"),
t.style.terrainSetForDrapingOnly() && b.push("TERRAIN")),
m[0] > 0 && b.push("FAUX_AO");
for (const w of n) {
const n = i.getTile(w)
, T = n.getBucket(r);
if (!T || T.projection.name !== u.projection.name)
continue;
const E = T.programConfigurations.get(r.id)
, S = t.useProgram(d ? "fillExtrusionPattern" : "fillExtrusion", E, b);
if (t.terrain) {
const e = t.terrain;
if (t.style.terrainSetForDrapingOnly())
e.setupElevationDraw(n, S, {
useMeterToDem: !0
});
else {
if (!T.enableTerrain)
continue;
if (e.setupElevationDraw(n, S, {
useMeterToDem: !0
}),
xr(l, i, w, T, r, e),
!T.centroidVertexBuffer) {
const e = S.attributes.a_centroid_pos;
void 0 !== e && c.vertexAttrib2f(e, 0, 0)
}
}
}
d && (t.context.activeTexture.set(c.TEXTURE0),
n.imageAtlasTexture.bind(c.LINEAR, c.CLAMP_TO_EDGE),
E.updatePaintBuffers(p));
const C = h.constantOr(null);
if (C && n.imageAtlas) {
const e = n.imageAtlas
, t = e.patternPositions[C.to.toString()]
, i = e.patternPositions[C.from.toString()];
t && i && E.setConstantPatternPositions(t, i)
}
const M = t.translatePosMatrix(w.projMatrix, n, r.paint.get("fill-extrusion-translate"), r.paint.get("fill-extrusion-translate-anchor"))
, A = u.projection.createInversionMatrix(u, w.canonical)
, I = r.paint.get("fill-extrusion-vertical-gradient")
, z = d ? Ri(M, t, I, f, m, _, w, p, n, g, x, v, A) : Oi(M, t, I, f, m, _, w, g, x, v, A);
t.prepareDrawProgram(l, S, w.toUnwrapped());
const k = [];
t.terrain && k.push(T.centroidVertexBuffer),
y && k.push(T.layoutVertexExtBuffer),
S.draw(l, l.gl.TRIANGLES, o, s, a, e.CullFaceMode.backCCW, z, r.id, T.layoutVertexBuffer, T.indexBuffer, T.segments, r.paint, t.transform.zoom, E, k)
}
}
function xr(t, i, r, n, o, s) {
const a = [t=>{
let i = t.canonical.x - 1
, r = t.wrap;
return i < 0 && (i = (1 << t.canonical.z) - 1,
r--),
new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)
}
, t=>{
let i = t.canonical.x + 1
, r = t.wrap;
return i === 1 << t.canonical.z && (i = 0,
r++),
new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)
}
, t=>new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0 === t.canonical.y ? 1 << t.canonical.z : t.canonical.y) - 1), t=>new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y === (1 << t.canonical.z) - 1 ? 0 : t.canonical.y + 1)]
, l = e=>{
const t = i.getSource().minzoom
, r = e=>{
const t = i.getTileByID(e);
if (t && t.hasData())
return t.getBucket(o)
}
, n = [0, -1, 1];
for (const i of n) {
if (e.overscaledZ + i < t)
continue;
const n = r(e.calculateScaledKey(e.overscaledZ + i));
if (n)
return n
}
}
, c = [0, 0, 0]
, u = (t,i)=>(c[0] = Math.min(t.min.y, i.min.y),
c[1] = Math.max(t.max.y, i.max.y),
c[2] = e.EXTENT - i.min.x > t.max.x ? i.min.x - e.EXTENT : t.max.x,
c)
, h = (t,i)=>(c[0] = Math.min(t.min.x, i.min.x),
c[1] = Math.max(t.max.x, i.max.x),
c[2] = e.EXTENT - i.min.y > t.max.y ? i.min.y - e.EXTENT : t.max.y,
c)
, d = [(e,t)=>u(e, t), (e,t)=>u(t, e), (e,t)=>h(e, t), (e,t)=>h(t, e)]
, p = new e.pointGeometry(0,0);
let f, m, _;
const g = (t,i,n,o,a)=>{
const l = [[o ? n : t, o ? t : n, 0], [o ? n : i, o ? i : n, 0]]
, c = a < 0 ? e.EXTENT + a : a
, u = [o ? c : (t + i) / 2, o ? (t + i) / 2 : c, 0];
return 0 === n && a < 0 || 0 !== n && a > 0 ? s.getForTilePoints(_, [u], !0, m) : l.push(u),
s.getForTilePoints(r, l, !0, f),
Math.max(l[0][2], l[1][2], u[2]) / s.exaggeration()
}
;
for (let t = 0; t < 4; t++) {
const i = (t < 2 ? 1 : 5) - t
, o = n.borders[t];
if (0 === o.length)
continue;
const c = _ = a[t](r)
, u = l(c);
if (!(u && u instanceof e.FillExtrusionBucket && u.enableTerrain))
continue;
if (n.borderDoneWithNeighborZ[t] === u.canonical.z && u.borderDoneWithNeighborZ[i] === n.canonical.z)
continue;
if (m = s.findDEMTileFor(c),
!m || !m.dem)
continue;
if (!f) {
const e = s.findDEMTileFor(r);
if (!e || !e.dem)
return;
f = e
}
const h = u.borders[i];
let y = 0;
const x = u.borderDoneWithNeighborZ[i] !== n.canonical.z;
if (n.canonical.z === u.canonical.z) {
for (let r = 0; r < o.length; r++) {
const s = n.featuresOnBorder[o[r]]
, a = s.borders[t];
let l;
for (; y < h.length && (l = u.featuresOnBorder[h[y]],
!(l.borders[i][1] > a[0] + 3)); )
x && u.encodeCentroid(void 0, l, !1),
y++;
if (l && y < h.length) {
const r = y;
let o = 0;
for (; !(l.borders[i][0] > a[1] - 3) && (o++,
++y !== h.length); )
l = u.featuresOnBorder[h[y]];
if (l = u.featuresOnBorder[h[r]],
s.intersectsCount() > 1 || l.intersectsCount() > 1 || 1 !== o) {
1 !== o && (y = r),
n.encodeCentroid(void 0, s, !1),
x && u.encodeCentroid(void 0, l, !1);
continue
}
const c = d[t](s, l)
, f = t % 2 ? e.EXTENT - 1 : 0;
p.x = g(c[0], Math.min(e.EXTENT - 1, c[1]), f, t < 2, c[2]),
p.y = 0,
n.encodeCentroid(p, s, !1),
x && u.encodeCentroid(p, l, !1)
} else
n.encodeCentroid(void 0, s, !1)
}
n.borderDoneWithNeighborZ[t] = u.canonical.z,
n.needsCentroidUpdate = !0,
x && (u.borderDoneWithNeighborZ[i] = n.canonical.z,
u.needsCentroidUpdate = !0)
} else {
for (const e of o)
n.encodeCentroid(void 0, n.featuresOnBorder[e], !1);
if (x) {
for (const e of h)
u.encodeCentroid(void 0, u.featuresOnBorder[e], !1);
u.borderDoneWithNeighborZ[i] = n.canonical.z,
u.needsCentroidUpdate = !0
}
n.borderDoneWithNeighborZ[t] = u.canonical.z,
n.needsCentroidUpdate = !0
}
}
(n.needsCentroidUpdate || !n.centroidVertexBuffer && 0 !== n.centroidVertexArray.length) && n.uploadCentroid(t)
}
const vr = new e.Color(1,0,0,1)
, br = new e.Color(0,1,0,1)
, wr = new e.Color(0,0,1,1)
, Tr = new e.Color(1,0,1,1)
, Er = new e.Color(0,1,1,1);
function Sr(t, i, r) {
const n = t.context
, o = t.transform
, s = n.gl
, a = "globe" === o.projection.name
, l = a ? ["PROJECTION_GLOBE_VIEW"] : null;
let c = r.projMatrix;
if (a && e.globeToMercatorTransition(o.zoom) > 0) {
const t = e.transitionTileAABBinECEF(r.canonical, o)
, i = e.globeDenormalizeECEF(t);
c = e.multiply(new Float32Array(16), o.globeMatrix, i),
e.multiply(c, o.projMatrix, c)
}
const u = t.useProgram("debug", null, l)
, h = i.getTileByID(r.key);
t.terrain && t.terrain.setupElevationDraw(h, u);
const d = e.DepthMode.disabled
, p = e.StencilMode.disabled
, f = t.colorModeForRenderPass()
, m = "$debug";
n.activeTexture.set(s.TEXTURE0),
t.emptyTexture.bind(s.LINEAR, s.CLAMP_TO_EDGE),
a ? h._makeGlobeTileDebugBuffers(t.context, o) : h._makeDebugTileBoundsBuffers(t.context, o.projection);
const _ = h._tileDebugBuffer || t.debugBuffer
, g = h._tileDebugIndexBuffer || t.debugIndexBuffer
, y = h._tileDebugSegments || t.debugSegments;
u.draw(n, s.LINE_STRIP, d, p, f, e.CullFaceMode.disabled, Zi(c, e.Color.red), m, _, g, y, null, null, null, [h._globeTileDebugBorderBuffer]);
const x = h.latestRawTileData
, v = Math.floor((x && x.byteLength || 0) / 1024)
, b = i.getTile(r).tileSize
, w = 512 / Math.min(b, 512) * (r.overscaledZ / o.zoom) * .5;
let T = r.canonical.toString();
r.overscaledZ !== r.canonical.z && (T += ` => ${r.overscaledZ}`),
T += ` ${v}kb`,
function(e, t) {
e.initDebugOverlayCanvas();
const i = e.debugOverlayCanvas
, r = e.context.gl
, n = e.debugOverlayCanvas.getContext("2d");
n.clearRect(0, 0, i.width, i.height),
n.shadowColor = "white",
n.shadowBlur = 2,
n.lineWidth = 1.5,
n.strokeStyle = "white",
n.textBaseline = "top",
n.font = "bold 36px Open Sans, sans-serif",
n.fillText(t, 5, 5),
n.strokeText(t, 5, 5),
e.debugOverlayTexture.update(i),
e.debugOverlayTexture.bind(r.LINEAR, r.CLAMP_TO_EDGE)
}(t, T);
const E = h._tileDebugTextBuffer || t.debugBuffer
, S = h._tileDebugTextIndexBuffer || t.quadTriangleIndexBuffer
, C = h._tileDebugTextSegments || t.debugSegments;
u.draw(n, s.TRIANGLES, d, p, e.ColorMode.alphaBlended, e.CullFaceMode.disabled, Zi(c, e.Color.transparent, w), m, E, S, C, null, null, null, [h._globeTileDebugTextBuffer])
}
function Cr(e, t, i, r) {
Ar(e, 0, t + i / 2, e.transform.width, i, r)
}
function Mr(e, t, i, r) {
Ar(e, t - i / 2, 0, i, e.transform.height, r)
}
function Ar(t, i, r, n, o, s) {
const a = t.context
, l = a.gl;
l.enable(l.SCISSOR_TEST),
l.scissor(i * e.exported.devicePixelRatio, r * e.exported.devicePixelRatio, n * e.exported.devicePixelRatio, o * e.exported.devicePixelRatio),
a.clear({
color: s
}),
l.disable(l.SCISSOR_TEST)
}
const Ir = e.createLayout([{
name: "a_pos_3f",
components: 3,
type: "Float32"
}])
, {members: zr} = Ir;
function kr(e, t, i, r) {
e.emplaceBack(t, i, r)
}
class Pr {
constructor(t) {
this.vertexArray = new e.StructArrayLayout3f12,
this.indices = new e.StructArrayLayout3ui6,
kr(this.vertexArray, -1, -1, 1),
kr(this.vertexArray, 1, -1, 1),
kr(this.vertexArray, -1, 1, 1),
kr(this.vertexArray, 1, 1, 1),
kr(this.vertexArray, -1, -1, -1),
kr(this.vertexArray, 1, -1, -1),
kr(this.vertexArray, -1, 1, -1),
kr(this.vertexArray, 1, 1, -1),
this.indices.emplaceBack(5, 1, 3),
this.indices.emplaceBack(3, 7, 5),
this.indices.emplaceBack(6, 2, 0),
this.indices.emplaceBack(0, 4, 6),
this.indices.emplaceBack(2, 6, 7),
this.indices.emplaceBack(7, 3, 2),
this.indices.emplaceBack(5, 4, 0),
this.indices.emplaceBack(0, 1, 5),
this.indices.emplaceBack(0, 2, 3),
this.indices.emplaceBack(3, 1, 0),
this.indices.emplaceBack(7, 6, 4),
this.indices.emplaceBack(4, 5, 7),
this.vertexBuffer = t.createVertexBuffer(this.vertexArray, zr),
this.indexBuffer = t.createIndexBuffer(this.indices),
this.segment = e.SegmentVector.simpleSegment(0, 0, 36, 12)
}
}
function Dr(t, i, r, n, o, s) {
const a = t.gl
, l = i.paint.get("sky-atmosphere-color")
, c = i.paint.get("sky-atmosphere-halo-color")
, u = i.paint.get("sky-atmosphere-sun-intensity")
, h = ((e,t,i,r,n)=>({
u_matrix_3f: e,
u_sun_direction: t,
u_sun_intensity: i,
u_color_tint_r: [r.r, r.g, r.b, r.a],
u_color_tint_m: [n.r, n.g, n.b, n.a],
u_luminance: 5e-5
}))(e.fromMat4(e.create$1(), n), o, u, l, c);
a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + s, i.skyboxTexture, 0),
r.draw(t, a.TRIANGLES, e.DepthMode.disabled, e.StencilMode.disabled, e.ColorMode.unblended, e.CullFaceMode.frontCW, h, "skyboxCapture", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment)
}
const Lr = e.createLayout([{
type: "Float32",
name: "a_pos",
components: 3
}, {
type: "Float32",
name: "a_uv",
components: 2
}]);
class Br {
constructor(t) {
const i = new e.StructArrayLayout5f20;
i.emplaceBack(-1, 1, 1, 0, 0),
i.emplaceBack(1, 1, 1, 1, 0),
i.emplaceBack(1, -1, 1, 1, 1),
i.emplaceBack(-1, -1, 1, 0, 1);
const r = new e.StructArrayLayout3ui6;
r.emplaceBack(0, 1, 2),
r.emplaceBack(2, 3, 0),
this.vertexBuffer = t.createVertexBuffer(i, Lr.members),
this.indexBuffer = t.createIndexBuffer(r),
this.segments = e.SegmentVector.simpleSegment(0, 0, 4, 2)
}
destroy() {
this.vertexBuffer.destroy(),
this.indexBuffer.destroy(),
this.segments.destroy()
}
}
const Or = {
symbol: function(t, i, r, n, o) {
if ("translucent" !== t.renderPass)
return;
const s = e.StencilMode.disabled
, a = t.colorModeForRenderPass();
r.layout.get("text-variable-anchor") && function(t, i, r, n, o, s, a) {
const l = i.transform
, c = "map" === o
, u = "map" === s;
for (const i of t) {
const t = n.getTile(i)
, o = t.getBucket(r);
if (!o || !o.text || !o.text.segments.get().length)
continue;
const s = e.evaluateSizeForZoom(o.textSizeData, l.zoom)
, h = wt(i, o.getProjection(), l)
, d = l.calculatePixelsToTileUnitsMatrix(t)
, p = tt(h, t.tileID.canonical, u, c, l, o.getProjection(), d)
, f = "none" !== r.layout.get("icon-text-fit") && o.hasIconData();
if (s) {
const r = Math.pow(2, l.zoom - t.tileID.overscaledZ);
pr(o, c, u, a, e.symbolSize, l, p, i, r, s, f)
}
}
}(n, t, r, i, r.layout.get("text-rotation-alignment"), r.layout.get("text-pitch-alignment"), o),
0 !== r.paint.get("icon-opacity").constantOr(1) && mr(t, i, r, n, !1, r.paint.get("icon-translate"), r.paint.get("icon-translate-anchor"), r.layout.get("icon-rotation-alignment"), r.layout.get("icon-pitch-alignment"), r.layout.get("icon-keep-upright"), s, a),
0 !== r.paint.get("text-opacity").constantOr(1) && mr(t, i, r, n, !0, r.paint.get("text-translate"), r.paint.get("text-translate-anchor"), r.layout.get("text-rotation-alignment"), r.layout.get("text-pitch-alignment"), r.layout.get("text-keep-upright"), s, a),
i.map.showCollisionBoxes && (ur(t, i, r, n, r.paint.get("text-translate"), r.paint.get("text-translate-anchor"), !0),
ur(t, i, r, n, r.paint.get("icon-translate"), r.paint.get("icon-translate-anchor"), !1))
},
circle: function(t, i, r, n) {
if ("translucent" !== t.renderPass)
return;
const o = r.paint.get("circle-opacity")
, s = r.paint.get("circle-stroke-width")
, a = r.paint.get("circle-stroke-opacity")
, l = void 0 !== r.layout.get("circle-sort-key").constantOr(1);
if (0 === o.constantOr(1) && (0 === s.constantOr(1) || 0 === a.constantOr(1)))
return;
const c = t.context
, u = c.gl
, h = t.transform
, d = t.depthModeForSublayer(0, e.DepthMode.ReadOnly)
, p = e.StencilMode.disabled
, f = t.colorModeForRenderPass()
, m = "globe" === h.projection.name
, _ = [e.mercatorXfromLng(h.center.lng), e.mercatorYfromLat(h.center.lat)]
, g = [];
for (let o = 0; o < n.length; o++) {
const s = n[o]
, a = i.getTile(s)
, c = a.getBucket(r);
if (!c || c.projection.name !== h.projection.name)
continue;
const u = c.programConfigurations.get(r.id)
, d = $i(r);
m && d.push("PROJECTION_GLOBE_VIEW");
const p = t.useProgram("circle", u, d)
, f = c.layoutVertexBuffer
, y = c.globeExtVertexBuffer
, x = c.indexBuffer
, v = h.projection.createInversionMatrix(h, s.canonical)
, b = {
programConfiguration: u,
program: p,
layoutVertexBuffer: f,
globeExtVertexBuffer: y,
indexBuffer: x,
uniformValues: Gi(t, s, a, v, _, r),
tile: a
};
if (l) {
const t = c.segments.get();
for (const i of t)
g.push({
segments: new e.SegmentVector([i]),
sortKey: i.sortKey,
state: b
})
} else
g.push({
segments: c.segments,
sortKey: 0,
state: b
})
}
l && g.sort(((e,t)=>e.sortKey - t.sortKey));
const y = {
useDepthForOcclusion: !m
};
for (const i of g) {
const {programConfiguration: n, program: o, layoutVertexBuffer: s, globeExtVertexBuffer: a, indexBuffer: l, uniformValues: m, tile: _} = i.state
, g = i.segments;
t.terrain && t.terrain.setupElevationDraw(_, o, y),
t.prepareDrawProgram(c, o, _.tileID.toUnwrapped()),
o.draw(c, u.TRIANGLES, d, p, f, e.CullFaceMode.disabled, m, r.id, s, l, g, r.paint, h.zoom, n, [a])
}
},
heatmap: function(t, i, r, n) {
if (0 !== r.paint.get("heatmap-opacity"))
if ("offscreen" === t.renderPass) {
const o = t.context
, s = o.gl
, a = e.StencilMode.disabled
, l = new e.ColorMode([s.ONE, s.ONE],e.Color.transparent,[!0, !0, !0, !0]);
!function(e, t, i, r) {
const n = e.gl
, o = t.width * r
, s = t.height * r;
e.activeTexture.set(n.TEXTURE1),
e.viewport.set([0, 0, o, s]);
let a = i.heatmapFbo;
if (!a || a && (a.width !== o || a.height !== s)) {
a && a.destroy();
const t = n.createTexture();
n.bindTexture(n.TEXTURE_2D, t),
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE),
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE),
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR),
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR),
a = i.heatmapFbo = e.createFramebuffer(o, s, !1),
function(e, t, i, r, n, o) {
const s = e.gl;
s.texImage2D(s.TEXTURE_2D, 0, s.RGBA, n, o, 0, s.RGBA, e.extRenderToTextureHalfFloat ? e.extTextureHalfFloat.HALF_FLOAT_OES : s.UNSIGNED_BYTE, null),
r.colorAttachment.set(i)
}(e, 0, t, a, o, s)
} else
n.bindTexture(n.TEXTURE_2D, a.colorAttachment.get()),
e.bindFramebuffer.set(a.framebuffer)
}(o, t, r, "globe" === t.transform.projection.name ? .5 : .25),
o.clear({
color: e.Color.transparent
});
const c = t.transform
, u = "globe" === c.projection.name
, h = u ? ["PROJECTION_GLOBE_VIEW"] : null
, d = u ? e.CullFaceMode.frontCCW : e.CullFaceMode.disabled
, p = [e.mercatorXfromLng(c.center.lng), e.mercatorYfromLat(c.center.lat)];
for (let f = 0; f < n.length; f++) {
const m = n[f];
if (i.hasRenderableParent(m))
continue;
const _ = i.getTile(m)
, g = _.getBucket(r);
if (!g || g.projection.name !== c.projection.name)
continue;
const y = g.programConfigurations.get(r.id)
, x = t.useProgram("heatmap", y, h)
, {zoom: v} = t.transform;
t.terrain && t.terrain.setupElevationDraw(_, x),
t.prepareDrawProgram(o, x, m.toUnwrapped());
const b = c.projection.createInversionMatrix(c, m.canonical);
x.draw(o, s.TRIANGLES, e.DepthMode.disabled, a, l, d, Xi(t, m, _, b, p, v, r.paint.get("heatmap-intensity")), r.id, g.layoutVertexBuffer, g.indexBuffer, g.segments, r.paint, t.transform.zoom, y, u ? [g.globeExtVertexBuffer] : null)
}
o.viewport.set([0, 0, t.width, t.height])
} else
"translucent" === t.renderPass && (t.context.setColorMode(t.colorModeForRenderPass()),
function(t, i) {
const r = t.context
, n = r.gl
, o = i.heatmapFbo;
if (!o)
return;
r.activeTexture.set(n.TEXTURE0),
n.bindTexture(n.TEXTURE_2D, o.colorAttachment.get()),
r.activeTexture.set(n.TEXTURE1);
let s = i.colorRampTexture;
s || (s = i.colorRampTexture = new e.Texture(r,i.colorRamp,n.RGBA)),
s.bind(n.LINEAR, n.CLAMP_TO_EDGE),
t.useProgram("heatmapTexture").draw(r, n.TRIANGLES, e.DepthMode.disabled, e.StencilMode.disabled, t.colorModeForRenderPass(), e.CullFaceMode.disabled, ((e,t,i,r)=>({
u_image: 0,
u_color_ramp: 1,
u_opacity: t.paint.get("heatmap-opacity")
}))(0, i), i.id, t.viewportBuffer, t.quadTriangleIndexBuffer, t.viewportSegments, i.paint, t.transform.zoom)
}(t, r))
},
line: function(t, i, r, n) {
if ("translucent" !== t.renderPass)
return;
const o = r.paint.get("line-opacity")
, s = r.paint.get("line-width");
if (0 === o.constantOr(1) || 0 === s.constantOr(1))
return;
const a = t.depthModeForSublayer(0, e.DepthMode.ReadOnly)
, l = t.colorModeForRenderPass()
, c = t.terrain && t.terrain.renderingToTexture ? 1 : e.exported.devicePixelRatio
, u = r.paint.get("line-dasharray")
, h = u.constantOr(1)
, d = r.layout.get("line-cap")
, p = r.paint.get("line-pattern")
, f = p.constantOr(1)
, m = r.paint.get("line-gradient")
, _ = r.getCrossfadeParameters()
, g = f ? "linePattern" : "line"
, y = t.context
, x = y.gl
, v = (e=>{
const t = [];
Qi(e) && t.push("RENDER_LINE_DASH"),
e.paint.get("line-gradient") && t.push("RENDER_LINE_GRADIENT");
const i = e.paint.get("line-trim-offset");
0 === i[0] && 0 === i[1] || t.push("RENDER_LINE_TRIM_OFFSET");
const r = e.paint.get("line-pattern").constantOr(1)
, n = 1 !== e.paint.get("line-opacity").constantOr(1);
return !r && n && t.push("RENDER_LINE_ALPHA_DISCARD"),
t
}
)(r);
let b = v.includes("RENDER_LINE_ALPHA_DISCARD");
t.terrain && t.terrain.clipOrMaskOverlapStencilType() && (b = !1);
for (const o of n) {
const n = i.getTile(o);
if (f && !n.patternsLoaded())
continue;
const s = n.getBucket(r);
if (!s)
continue;
t.prepareDrawTile();
const w = s.programConfigurations.get(r.id)
, T = t.useProgram(g, w, v)
, E = p.constantOr(null);
if (E && n.imageAtlas) {
const e = n.imageAtlas
, t = e.patternPositions[E.to.toString()]
, i = e.patternPositions[E.from.toString()];
t && i && w.setConstantPatternPositions(t, i)
}
const S = u.constantOr(null)
, C = d.constantOr(null);
if (!f && S && C && n.lineAtlas) {
const e = n.lineAtlas
, t = e.getDash(S.to, C)
, i = e.getDash(S.from, C);
t && i && w.setConstantPatternPositions(t, i)
}
let[M,A] = r.paint.get("line-trim-offset");
if ("round" === C || "square" === C) {
const e = 1;
M !== A && (0 === M && (M -= e),
1 === A && (A += e))
}
const I = t.terrain ? o.projMatrix : null
, z = f ? Yi(t, n, r, _, I, c) : Hi(t, n, r, _, I, s.lineClipsArray.length, c, [M, A]);
if (m) {
const n = s.gradients[r.id];
let a = n.texture;
if (r.gradientVersion !== n.version) {
let l = 256;
if (r.stepInterpolant) {
const r = i.getSource().maxzoom
, n = o.canonical.z === r ? Math.ceil(1 << t.transform.maxZoom - o.canonical.z) : 1;
l = e.clamp(e.nextPowerOfTwo(s.maxLineLength / e.EXTENT * 1024 * n), 256, y.maxTextureSize)
}
n.gradient = e.renderColorRamp({
expression: r.gradientExpression(),
evaluationKey: "lineProgress",
resolution: l,
image: n.gradient || void 0,
clips: s.lineClipsArray
}),
n.texture ? n.texture.update(n.gradient) : n.texture = new e.Texture(y,n.gradient,x.RGBA),
n.version = r.gradientVersion,
a = n.texture
}
y.activeTexture.set(x.TEXTURE1),
a.bind(r.stepInterpolant ? x.NEAREST : x.LINEAR, x.CLAMP_TO_EDGE)
}
h && (y.activeTexture.set(x.TEXTURE0),
n.lineAtlasTexture.bind(x.LINEAR, x.REPEAT),
w.updatePaintBuffers(_)),
f && (y.activeTexture.set(x.TEXTURE0),
n.imageAtlasTexture.bind(x.LINEAR, x.CLAMP_TO_EDGE),
w.updatePaintBuffers(_)),
t.prepareDrawProgram(y, T, o.toUnwrapped());
const k = i=>{
T.draw(y, x.TRIANGLES, a, i, l, e.CullFaceMode.disabled, z, r.id, s.layoutVertexBuffer, s.indexBuffer, s.segments, r.paint, t.transform.zoom, w, [s.layoutVertexBuffer2])
}
;
if (b) {
const i = t.stencilModeForClipping(o).ref;
0 === i && t.terrain && y.clear({
stencil: 0
});
const r = {
func: x.EQUAL,
mask: 255
};
z.u_alpha_discard_threshold = .8,
k(new e.StencilMode(r,i,255,x.KEEP,x.KEEP,x.INVERT)),
z.u_alpha_discard_threshold = 0,
k(new e.StencilMode(r,i,255,x.KEEP,x.KEEP,x.KEEP))
} else
k(t.stencilModeForClipping(o))
}
b && (t.resetStencilClippingMasks(),
t.terrain && y.clear({
stencil: 0
}))
},
fill: function(t, i, r, n) {
const o = r.paint.get("fill-color")
, s = r.paint.get("fill-opacity");
if (0 === s.constantOr(1))
return;
const a = t.colorModeForRenderPass()
, l = r.paint.get("fill-pattern")
, c = t.opaquePassEnabledForLayer() && !l.constantOr(1) && 1 === o.constantOr(e.Color.transparent).a && 1 === s.constantOr(0) ? "opaque" : "translucent";
if (t.renderPass === c) {
const o = t.depthModeForSublayer(1, "opaque" === t.renderPass ? e.DepthMode.ReadWrite : e.DepthMode.ReadOnly);
gr(t, i, r, n, o, a, !1)
}
if ("translucent" === t.renderPass && r.paint.get("fill-antialias")) {
const o = t.depthModeForSublayer(r.getPaintProperty("fill-outline-color") ? 2 : 0, e.DepthMode.ReadOnly);
gr(t, i, r, n, o, a, !0)
}
},
"fill-extrusion": function(t, i, r, n) {
const o = r.paint.get("fill-extrusion-opacity");
if (0 !== o && "translucent" === t.renderPass) {
const s = new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);
if (1 !== o || r.paint.get("fill-extrusion-pattern").constantOr(1))
yr(t, i, r, n, s, e.StencilMode.disabled, e.ColorMode.disabled),
yr(t, i, r, n, s, t.stencilModeFor3D(), t.colorModeForRenderPass()),
t.resetStencilClippingMasks();
else {
const o = t.colorModeForRenderPass();
yr(t, i, r, n, s, e.StencilMode.disabled, o)
}
}
},
hillshade: function(t, i, r, n) {
if ("offscreen" !== t.renderPass && "translucent" !== t.renderPass)
return;
const o = t.context
, s = t.depthModeForSublayer(0, e.DepthMode.ReadOnly)
, a = t.colorModeForRenderPass()
, l = t.terrain && t.terrain.renderingToTexture
, [c,u] = "translucent" !== t.renderPass || l ? [{}, n] : t.stencilConfigForOverlap(n);
for (const n of u) {
const o = i.getTile(n);
if (o.needsHillshadePrepare && "offscreen" === t.renderPass)
xi(t, o, r, s, e.StencilMode.disabled, a);
else if ("translucent" === t.renderPass) {
const e = l && t.terrain ? t.terrain.stencilModeForRTTOverlap(n) : c[n.overscaledZ];
gi(t, n, o, r, s, e, a)
}
}
o.viewport.set([0, 0, t.width, t.height]),
t.resetStencilClippingMasks()
},
raster: function(t, i, r, n, o, s) {
if ("translucent" !== t.renderPass)
return;
if (0 === r.paint.get("raster-opacity"))
return;
if (!n.length)
return;
const a = t.context
, l = a.gl
, c = i.getSource()
, u = t.useProgram("raster")
, h = t.colorModeForRenderPass()
, d = t.terrain && t.terrain.renderingToTexture
, [p,f] = c instanceof ze || d ? [{}, n] : t.stencilConfigForOverlap(n)
, m = f[f.length - 1].overscaledZ
, _ = !t.options.moving;
for (const n of f) {
const o = d ? e.DepthMode.disabled : t.depthModeForSublayer(n.overscaledZ - m, 1 === r.paint.get("raster-opacity") ? e.DepthMode.ReadWrite : e.DepthMode.ReadOnly, l.LESS)
, f = n.toUnwrapped()
, g = i.getTile(n);
if (d && (!g || !g.hasData()))
continue;
const y = d ? n.projMatrix : t.transform.calculateProjMatrix(f, _)
, x = t.terrain && d ? t.terrain.stencilModeForRTTOverlap(n) : p[n.overscaledZ]
, v = s ? 0 : r.paint.get("raster-fade-duration");
g.registerFadeDuration(v);
const b = i.findLoadedParent(n, 0)
, w = Ai(g, b, i, t.transform, v);
let T, E;
t.terrain && t.terrain.prepareDrawTile();
const S = "nearest" === r.paint.get("raster-resampling") ? l.NEAREST : l.LINEAR;
a.activeTexture.set(l.TEXTURE0),
g.texture.bind(S, l.CLAMP_TO_EDGE),
a.activeTexture.set(l.TEXTURE1),
b ? (b.texture.bind(S, l.CLAMP_TO_EDGE),
T = Math.pow(2, b.tileID.overscaledZ - g.tileID.overscaledZ),
E = [g.tileID.canonical.x * T % 1, g.tileID.canonical.y * T % 1]) : g.texture.bind(S, l.CLAMP_TO_EDGE);
const C = er(y, E || [0, 0], T || 1, w, r, c instanceof ze ? c.perspectiveTransform : [0, 0]);
if (t.prepareDrawProgram(a, u, f),
c instanceof ze)
c.boundsBuffer && c.boundsSegments && u.draw(a, l.TRIANGLES, o, e.StencilMode.disabled, h, e.CullFaceMode.disabled, C, r.id, c.boundsBuffer, t.quadTriangleIndexBuffer, c.boundsSegments);
else {
const {tileBoundsBuffer: i, tileBoundsIndexBuffer: n, tileBoundsSegments: s} = t.getTileBoundsBuffers(g);
u.draw(a, l.TRIANGLES, o, x, h, e.CullFaceMode.disabled, C, r.id, i, n, s)
}
}
t.resetStencilClippingMasks()
},
background: function(t, i, r, n) {
const o = r.paint.get("background-color")
, s = r.paint.get("background-opacity");
if (0 === s)
return;
const a = t.context
, l = a.gl
, c = t.transform
, u = c.tileSize
, h = r.paint.get("background-pattern");
if (t.isPatternMissing(h))
return;
const d = !h && 1 === o.a && 1 === s && t.opaquePassEnabledForLayer() ? "opaque" : "translucent";
if (t.renderPass !== d)
return;
const p = e.StencilMode.disabled
, f = t.depthModeForSublayer(0, "opaque" === d ? e.DepthMode.ReadWrite : e.DepthMode.ReadOnly)
, m = t.colorModeForRenderPass()
, _ = t.useProgram(h ? "backgroundPattern" : "background");
let g, y = n;
y || (g = t.getBackgroundTiles(),
y = Object.values(g).map((e=>e.tileID))),
h && (a.activeTexture.set(l.TEXTURE0),
t.imageManager.bind(t.context));
const x = r.getCrossfadeParameters();
for (const d of y) {
const y = d.toUnwrapped()
, v = n ? d.projMatrix : t.transform.calculateProjMatrix(y);
t.prepareDrawTile();
const b = i ? i.getTile(d) : g ? g[d.key] : new e.Tile(d,u,c.zoom,t)
, w = h ? ar(v, s, t, h, {
tileID: d,
tileSize: u
}, x) : sr(v, s, o);
t.prepareDrawProgram(a, _, y);
const {tileBoundsBuffer: T, tileBoundsIndexBuffer: E, tileBoundsSegments: S} = t.getTileBoundsBuffers(b);
_.draw(a, l.TRIANGLES, f, p, m, e.CullFaceMode.disabled, w, r.id, T, E, S)
}
},
sky: function(t, i, r) {
const n = t.transform
, o = "mercator" === n.projection.name || "globe" === n.projection.name ? 1 : e.smoothstep(7, 8, n.zoom)
, s = r.paint.get("sky-opacity") * o;
if (0 === s)
return;
const a = t.context
, l = r.paint.get("sky-type")
, c = new e.DepthMode(a.gl.LEQUAL,e.DepthMode.ReadOnly,[0, 1])
, u = t.frameCounter / 1e3 % 1;
"atmosphere" === l ? "offscreen" === t.renderPass ? r.needsSkyboxCapture(t) && (function(t, i, r, n) {
const o = t.context
, s = o.gl;
let a = i.skyboxFbo;
if (!a) {
a = i.skyboxFbo = o.createFramebuffer(32, 32, !1),
i.skyboxGeometry = new Pr(o),
i.skyboxTexture = o.gl.createTexture(),
s.bindTexture(s.TEXTURE_CUBE_MAP, i.skyboxTexture),
s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_WRAP_S, s.CLAMP_TO_EDGE),
s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_WRAP_T, s.CLAMP_TO_EDGE),
s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_MIN_FILTER, s.LINEAR),
s.texParameteri(s.TEXTURE_CUBE_MAP, s.TEXTURE_MAG_FILTER, s.LINEAR);
for (let e = 0; e < 6; ++e)
s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X + e, 0, s.RGBA, 32, 32, 0, s.RGBA, s.UNSIGNED_BYTE, null)
}
o.bindFramebuffer.set(a.framebuffer),
o.viewport.set([0, 0, 32, 32]);
const l = i.getCenter(t, !0)
, c = t.useProgram("skyboxCapture")
, u = new Float64Array(16);
e.identity(u),
e.rotateY(u, u, .5 * -Math.PI),
Dr(o, i, c, u, l, 0),
e.identity(u),
e.rotateY(u, u, .5 * Math.PI),
Dr(o, i, c, u, l, 1),
e.identity(u),
e.rotateX(u, u, .5 * -Math.PI),
Dr(o, i, c, u, l, 2),
e.identity(u),
e.rotateX(u, u, .5 * Math.PI),
Dr(o, i, c, u, l, 3),
e.identity(u),
Dr(o, i, c, u, l, 4),
e.identity(u),
e.rotateY(u, u, Math.PI),
Dr(o, i, c, u, l, 5),
o.viewport.set([0, 0, t.width, t.height])
}(t, r),
r.markSkyboxValid(t)) : "sky" === t.renderPass && function(t, i, r, n, o) {
const s = t.context
, a = s.gl
, l = t.transform
, c = t.useProgram("skybox");
s.activeTexture.set(a.TEXTURE0),
a.bindTexture(a.TEXTURE_CUBE_MAP, i.skyboxTexture);
const u = ((e,t,i,r,n)=>({
u_matrix: e,
u_sun_direction: t,
u_cubemap: 0,
u_opacity: r,
u_temporal_offset: n
}))(l.skyboxMatrix, i.getCenter(t, !1), 0, n, o);
t.prepareDrawProgram(s, c),
c.draw(s, a.TRIANGLES, r, e.StencilMode.disabled, t.colorModeForRenderPass(), e.CullFaceMode.backCW, u, "skybox", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment)
}(t, r, c, s, u) : "gradient" === l && "sky" === t.renderPass && function(t, i, r, n, o) {
const s = t.context
, a = s.gl
, l = t.transform
, c = t.useProgram("skyboxGradient");
i.skyboxGeometry || (i.skyboxGeometry = new Pr(s)),
s.activeTexture.set(a.TEXTURE0);
let u = i.colorRampTexture;
u || (u = i.colorRampTexture = new e.Texture(s,i.colorRamp,a.RGBA)),
u.bind(a.LINEAR, a.CLAMP_TO_EDGE);
const h = ((t,i,r,n,o)=>({
u_matrix: t,
u_color_ramp: 0,
u_center_direction: i,
u_radius: e.degToRad(r),
u_opacity: n,
u_temporal_offset: o
}))(l.skyboxMatrix, i.getCenter(t, !1), i.paint.get("sky-gradient-radius"), n, o);
t.prepareDrawProgram(s, c),
c.draw(s, a.TRIANGLES, r, e.StencilMode.disabled, t.colorModeForRenderPass(), e.CullFaceMode.backCW, h, "skyboxGradient", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment)
}(t, r, c, s, u)
},
debug: function(e, t, i) {
for (let r = 0; r < i.length; r++)
Sr(e, t, i[r])
},
custom: function(t, i, r) {
const n = t.context
, o = r.implementation;
if (t.transform.projection.unsupportedLayers && t.transform.projection.unsupportedLayers.includes("custom"))
e.warnOnce("Custom layers are not yet supported with non-mercator projections. Use mercator to enable custom layers.");
else if ("offscreen" === t.renderPass) {
const e = o.prerender;
e && (t.setCustomLayerDefaults(),
n.setColorMode(t.colorModeForRenderPass()),
e.call(o, n.gl, t.transform.customLayerMatrix()),
n.setDirty(),
t.setBaseState())
} else if ("translucent" === t.renderPass) {
t.setCustomLayerDefaults(),
n.setColorMode(t.colorModeForRenderPass()),
n.setStencilMode(e.StencilMode.disabled);
const i = "3d" === o.renderingMode ? new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D) : t.depthModeForSublayer(0, e.DepthMode.ReadOnly);
n.setDepthMode(i),
o.render(n.gl, t.transform.customLayerMatrix()),
n.setDirty(),
t.setBaseState(),
n.bindFramebuffer.set(null)
}
}
};
class Rr {
constructor(t, i) {
this.context = new Ce(t),
this.transform = i,
this._tileTextures = {},
this.frameCopies = [],
this.loadTimeStamps = [],
this.setup(),
this.numSublayers = e.SourceCache.maxUnderzooming + e.SourceCache.maxOverzooming + 1,
this.depthEpsilon = 1 / Math.pow(2, 16),
this.crossTileSymbolIndex = new Xt,
this.deferredRenderGpuTimeQueries = [],
this.gpuTimers = {},
this.frameCounter = 0,
this._backgroundTiles = {}
}
updateTerrain(e, t) {
const i = !!e && !!e.terrain && this.transform.projection.supportsTerrain;
if (!(i || this._terrain && this._terrain.enabled))
return;
this._terrain || (this._terrain = new Pi(this,e));
const r = this._terrain;
this.transform.elevation = i ? r : null,
r.update(e, this.transform, t)
}
_updateFog(e) {
const t = e.fog;
if (!t || "globe" === this.transform.projection.name || t.getOpacity(this.transform.pitch) < 1 || t.properties.get("horizon-blend") < .03)
return void (this.transform.fogCullDistSq = null);
const [i,r] = t.getFovAdjustedRange(this.transform._fov);
if (i > r)
return void (this.transform.fogCullDistSq = null);
const n = i + .78 * (r - i);
this.transform.fogCullDistSq = n * n
}
get terrain() {
return this.transform._terrainEnabled() && this._terrain && this._terrain.enabled ? this._terrain : null
}
resize(t, i) {
if (this.width = t * e.exported.devicePixelRatio,
this.height = i * e.exported.devicePixelRatio,
this.context.viewport.set([0, 0, this.width, this.height]),
this.style)
for (const e of this.style.order)
this.style._layers[e].resize()
}
setup() {
const t = this.context
, i = new e.StructArrayLayout2i4;
i.emplaceBack(0, 0),
i.emplaceBack(e.EXTENT, 0),
i.emplaceBack(0, e.EXTENT),
i.emplaceBack(e.EXTENT, e.EXTENT),
this.tileExtentBuffer = t.createVertexBuffer(i, e.posAttributes.members),
this.tileExtentSegments = e.SegmentVector.simpleSegment(0, 0, 4, 2);
const r = new e.StructArrayLayout2i4;
r.emplaceBack(0, 0),
r.emplaceBack(e.EXTENT, 0),
r.emplaceBack(0, e.EXTENT),
r.emplaceBack(e.EXTENT, e.EXTENT),
this.debugBuffer = t.createVertexBuffer(r, e.posAttributes.members),
this.debugSegments = e.SegmentVector.simpleSegment(0, 0, 4, 5);
const n = new e.StructArrayLayout2i4;
n.emplaceBack(-1, -1),
n.emplaceBack(1, -1),
n.emplaceBack(-1, 1),
n.emplaceBack(1, 1),
this.viewportBuffer = t.createVertexBuffer(n, e.posAttributes.members),
this.viewportSegments = e.SegmentVector.simpleSegment(0, 0, 4, 2);
const o = new e.StructArrayLayout4i8;
o.emplaceBack(0, 0, 0, 0),
o.emplaceBack(e.EXTENT, 0, e.EXTENT, 0),
o.emplaceBack(0, e.EXTENT, 0, e.EXTENT),
o.emplaceBack(e.EXTENT, e.EXTENT, e.EXTENT, e.EXTENT),
this.mercatorBoundsBuffer = t.createVertexBuffer(o, e.boundsAttributes.members),
this.mercatorBoundsSegments = e.SegmentVector.simpleSegment(0, 0, 4, 2);
const s = new e.StructArrayLayout3ui6;
s.emplaceBack(0, 1, 2),
s.emplaceBack(2, 1, 3),
this.quadTriangleIndexBuffer = t.createIndexBuffer(s);
const a = new e.StructArrayLayout1ui2;
for (const e of [0, 1, 3, 2, 0])
a.emplaceBack(e);
this.debugIndexBuffer = t.createIndexBuffer(a),
this.emptyTexture = new e.Texture(t,new e.RGBAImage({
width: 1,
height: 1
},Uint8Array.of(0, 0, 0, 0)),t.gl.RGBA),
this.identityMat = e.create();
const l = this.context.gl;
this.stencilClearMode = new e.StencilMode({
func: l.ALWAYS,
mask: 0
},0,255,l.ZERO,l.ZERO,l.ZERO),
this.loadTimeStamps.push(e.window.performance.now()),
this.atmosphereBuffer = new Br(this.context)
}
getMercatorTileBoundsBuffers() {
return {
tileBoundsBuffer: this.mercatorBoundsBuffer,
tileBoundsIndexBuffer: this.quadTriangleIndexBuffer,
tileBoundsSegments: this.mercatorBoundsSegments
}
}
getTileBoundsBuffers(e) {
return e._makeTileBoundsBuffers(this.context, this.transform.projection),
e._tileBoundsBuffer ? {
tileBoundsBuffer: e._tileBoundsBuffer,
tileBoundsIndexBuffer: e._tileBoundsIndexBuffer,
tileBoundsSegments: e._tileBoundsSegments
} : this.getMercatorTileBoundsBuffers()
}
clearStencil() {
const t = this.context
, i = t.gl;
this.nextStencilID = 1,
this.currentStencilSource = void 0,
this._tileClippingMaskIDs = {},
this.useProgram("clippingMask").draw(t, i.TRIANGLES, e.DepthMode.disabled, this.stencilClearMode, e.ColorMode.disabled, e.CullFaceMode.disabled, Mi(this.identityMat), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments)
}
resetStencilClippingMasks() {
this.terrain || (this.currentStencilSource = void 0,
this._tileClippingMaskIDs = {})
}
_renderTileClippingMasks(t, i, r) {
if (!i || this.currentStencilSource === i.id || !t.isTileClipped() || !r || 0 === r.length)
return;
if (this._tileClippingMaskIDs && !this.terrain) {
let e = !1;
for (const t of r)
if (void 0 === this._tileClippingMaskIDs[t.key]) {
e = !0;
break
}
if (!e)
return
}
this.currentStencilSource = i.id;
const n = this.context
, o = n.gl;
this.nextStencilID + r.length > 256 && this.clearStencil(),
n.setColorMode(e.ColorMode.disabled),
n.setDepthMode(e.DepthMode.disabled);
const s = this.useProgram("clippingMask");
this._tileClippingMaskIDs = {};
for (const t of r) {
const r = i.getTile(t)
, a = this._tileClippingMaskIDs[t.key] = this.nextStencilID++
, {tileBoundsBuffer: l, tileBoundsIndexBuffer: c, tileBoundsSegments: u} = this.getTileBoundsBuffers(r);
s.draw(n, o.TRIANGLES, e.DepthMode.disabled, new e.StencilMode({
func: o.ALWAYS,
mask: 0
},a,255,o.KEEP,o.KEEP,o.REPLACE), e.ColorMode.disabled, e.CullFaceMode.disabled, Mi(t.projMatrix), "$clipping", l, c, u)
}
}
stencilModeFor3D() {
this.currentStencilSource = void 0,
this.nextStencilID + 1 > 256 && this.clearStencil();
const t = this.nextStencilID++
, i = this.context.gl;
return new e.StencilMode({
func: i.NOTEQUAL,
mask: 255
},t,255,i.KEEP,i.KEEP,i.REPLACE)
}
stencilModeForClipping(t) {
if (this.terrain)
return this.terrain.stencilModeForRTTOverlap(t);
const i = this.context.gl;
return new e.StencilMode({
func: i.EQUAL,
mask: 255
},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)
}
stencilConfigForOverlap(t) {
const i = this.context.gl
, r = t.sort(((e,t)=>t.overscaledZ - e.overscaledZ))
, n = r[r.length - 1].overscaledZ
, o = r[0].overscaledZ - n + 1;
if (o > 1) {
this.currentStencilSource = void 0,
this.nextStencilID + o > 256 && this.clearStencil();
const t = {};
for (let r = 0; r < o; r++)
t[r + n] = new e.StencilMode({
func: i.GEQUAL,
mask: 255
},r + this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);
return this.nextStencilID += o,
[t, r]
}
return [{
[n]: e.StencilMode.disabled
}, r]
}
colorModeForRenderPass() {
const t = this.context.gl;
if (this._showOverdrawInspector) {
const i = 1 / 8;
return new e.ColorMode([t.CONSTANT_COLOR, t.ONE],new e.Color(i,i,i,0),[!0, !0, !0, !0])
}
return "opaque" === this.renderPass ? e.ColorMode.unblended : e.ColorMode.alphaBlended
}
depthModeForSublayer(t, i, r) {
if (!this.opaquePassEnabledForLayer())
return e.DepthMode.disabled;
const n = 1 - ((1 + this.currentLayer) * this.numSublayers + t) * this.depthEpsilon;
return new e.DepthMode(r || this.context.gl.LEQUAL,i,[n, n])
}
opaquePassEnabledForLayer() {
return this.currentLayer < this.opaquePassCutoff
}
render(t, i) {
this.style = t,
this.options = i,
this.lineAtlas = t.lineAtlas,
this.imageManager = t.imageManager,
this.glyphManager = t.glyphManager,
this.symbolFadeChange = t.placement.symbolFadeChange(e.exported.now()),
this.imageManager.beginFrame();
const r = this.style.order
, n = this.style._sourceCaches;
for (const e in n) {
const t = n[e];
t.used && t.prepare(this.context)
}
const o = {}
, s = {}
, a = {};
for (const e in n) {
const t = n[e];
o[e] = t.getVisibleCoordinates(),
s[e] = o[e].slice().reverse(),
a[e] = t.getVisibleCoordinates(!0).reverse()
}
this.opaquePassCutoff = 1 / 0;
for (let e = 0; e < r.length; e++)
if (this.style._layers[r[e]].is3D()) {
this.opaquePassCutoff = e;
break
}
if (this.terrain && (this.terrain.updateTileBinding(a),
this.opaquePassCutoff = 0),
"globe" !== this.transform.projection.name || this.globeSharedBuffers || (this.globeSharedBuffers = new e.GlobeSharedBuffers(this.context)),
e.isMapAuthenticated(this.context.gl)) {
this.renderPass = "offscreen";
for (const e of r) {
const i = this.style._layers[e]
, r = t._getLayerSourceCache(i);
if (!i.hasOffscreenPass() || i.isHidden(this.transform.zoom))
continue;
const n = r ? s[r.id] : void 0;
("custom" === i.type || i.isSky() || n && n.length) && this.renderLayer(this, r, i, n)
}
if (this.depthRangeFor3D = [0, 1 - (t.order.length + 2) * this.numSublayers * this.depthEpsilon],
this.terrain && (this.style.hasSymbolLayers() || this.style.hasCircleLayers()) && this.terrain.drawDepth(),
this.context.bindFramebuffer.set(null),
this.context.viewport.set([0, 0, this.width, this.height]),
this.context.clear({
color: i.showOverdrawInspector ? e.Color.black : e.Color.transparent,
depth: 1
}),
this.clearStencil(),
this._showOverdrawInspector = i.showOverdrawInspector,
this.renderPass = "opaque",
!this.terrain)
for (this.currentLayer = r.length - 1; this.currentLayer >= 0; this.currentLayer--) {
const e = this.style._layers[r[this.currentLayer]]
, i = t._getLayerSourceCache(e);
if (e.isSky())
continue;
const n = i ? s[i.id] : void 0;
this._renderTileClippingMasks(e, i, n),
this.renderLayer(this, i, e, n)
}
if (this.style.fog && this.transform.projection.supportsFog && function(t, i) {
const r = t.context
, n = r.gl
, o = t.transform
, s = new e.DepthMode(n.LEQUAL,e.DepthMode.ReadOnly,[0, 1])
, a = t.useProgram("globeAtmosphere", null, "globe" === o.projection.name ? ["PROJECTION_GLOBE_VIEW", "FOG"] : ["FOG"])
, l = e.globeToMercatorTransition(o.zoom)
, c = i.properties.get("color").toArray01()
, u = i.properties.get("high-color").toArray01()
, h = i.properties.get("space-color").toArray01PremultipliedAlpha()
, d = e.identity$1([]);
e.rotateY$1(d, d, -e.degToRad(o._center.lng)),
e.rotateX$1(d, d, e.degToRad(o._center.lat)),
e.rotateZ$1(d, d, o.angle),
e.rotateX$1(d, d, -o._pitch);
const p = e.fromQuat(new Float32Array(16), d)
, f = e.mapValue(i.properties.get("star-intensity"), 0, 1, 0, .25)
, m = 5e-4
, _ = e.mapValue(i.properties.get("horizon-blend"), 0, 1, m, .25)
, g = e.globeUseCustomAntiAliasing(t, r, o) && _ === m ? o.worldSize / (2 * Math.PI * 1.025) - 1 : o.globeRadius
, y = t.frameCounter / 1e3 % 1
, x = e.length(o.globeCenterInViewSpace)
, v = Math.sqrt(Math.pow(x, 2) - Math.pow(g, 2))
, b = Math.acos(v / x)
, w = ((t,i,r,n,o,s,a,l,c,u,h,d,p,f)=>({
u_frustum_tl: t,
u_frustum_tr: i,
u_frustum_br: r,
u_frustum_bl: n,
u_horizon: o,
u_transition: s,
u_fadeout_range: a,
u_color: l,
u_high_color: c,
u_space_color: u,
u_star_intensity: h,
u_star_size: 5 * e.exported.devicePixelRatio,
u_star_density: 0,
u_temporal_offset: d,
u_horizon_angle: p,
u_rotation_matrix: f
}))(o.frustumCorners.TL, o.frustumCorners.TR, o.frustumCorners.BR, o.frustumCorners.BL, o.frustumCorners.horizon, l, _, c, u, h, f, y, b, p);
t.prepareDrawProgram(r, a);
const T = t.atmosphereBuffer;
T && a.draw(r, n.TRIANGLES, s, e.StencilMode.disabled, e.ColorMode.alphaBlended, e.CullFaceMode.backCW, w, "skybox", T.vertexBuffer, T.indexBuffer, T.segments)
}(this, this.style.fog),
this.renderPass = "sky",
(e.globeToMercatorTransition(this.transform.zoom) > 0 || "globe" !== this.transform.projection.name) && this.transform.isHorizonVisible())
for (this.currentLayer = 0; this.currentLayer < r.length; this.currentLayer++) {
const e = this.style._layers[r[this.currentLayer]]
, i = t._getLayerSourceCache(e);
e.isSky() && this.renderLayer(this, i, e, i ? s[i.id] : void 0)
}
for (this.renderPass = "translucent",
this.currentLayer = 0; this.currentLayer < r.length; ) {
const e = this.style._layers[r[this.currentLayer]]
, i = t._getLayerSourceCache(e);
if (e.isSky()) {
++this.currentLayer;
continue
}
if (this.terrain && this.style.isLayerDraped(e)) {
if (e.isHidden(this.transform.zoom)) {
++this.currentLayer;
continue
}
this.currentLayer = this.terrain.renderBatch(this.currentLayer);
continue
}
const n = i ? ("symbol" === e.type ? a : s)[i.id] : void 0;
this._renderTileClippingMasks(e, i, i ? o[i.id] : void 0),
this.renderLayer(this, i, e, n),
++this.currentLayer
}
if (this.terrain && this.terrain.postRender(),
this.options.showTileBoundaries || this.options.showQueryGeometry) {
let i = null;
e.values(this.style._layers).forEach((e=>{
const r = t._getLayerSourceCache(e);
r && !e.isHidden(this.transform.zoom) && (!i || i.getSource().maxzoom < r.getSource().maxzoom) && (i = r)
}
)),
i && this.options.showTileBoundaries && Or.debug(this, i, i.getVisibleCoordinates())
}
this.options.showPadding && function(e) {
const t = e.transform.padding;
Cr(e, e.transform.height - (t.top || 0), 3, vr),
Cr(e, t.bottom || 0, 3, br),
Mr(e, t.left || 0, 3, wr),
Mr(e, e.transform.width - (t.right || 0), 3, Tr);
const i = e.transform.centerPoint;
!function(e, t, i, r) {
Ar(e, t - 1, i - 10, 2, 20, r),
Ar(e, t - 10, i - 1, 20, 2, r)
}(e, i.x, e.transform.height - i.y, Er)
}(this),
this.context.setDefault(),
this.frameCounter = (this.frameCounter + 1) % Number.MAX_SAFE_INTEGER,
this.tileLoaded && this.options.speedIndexTiming && (this.loadTimeStamps.push(e.window.performance.now()),
this.saveCanvasCopy())
}
}
renderLayer(e, t, i, r) {
i.isHidden(this.transform.zoom) || ("background" === i.type || "sky" === i.type || "custom" === i.type || r && r.length) && (this.id = i.id,
this.gpuTimingStart(i),
e.transform.projection.unsupportedLayers && e.transform.projection.unsupportedLayers.includes(i.type) || Or[i.type](e, t, i, r, this.style.placement.variableOffsets, this.options.isInitialLoad),
this.gpuTimingEnd())
}
gpuTimingStart(e) {
if (!this.options.gpuTiming)
return;
const t = this.context.extTimerQuery;
let i = this.gpuTimers[e.id];
i || (i = this.gpuTimers[e.id] = {
calls: 0,
cpuTime: 0,
query: t.createQueryEXT()
}),
i.calls++,
t.beginQueryEXT(t.TIME_ELAPSED_EXT, i.query)
}
gpuTimingDeferredRenderStart() {
if (this.options.gpuTimingDeferredRender) {
const e = this.context.extTimerQuery
, t = e.createQueryEXT();
this.deferredRenderGpuTimeQueries.push(t),
e.beginQueryEXT(e.TIME_ELAPSED_EXT, t)
}
}
gpuTimingDeferredRenderEnd() {
if (!this.options.gpuTimingDeferredRender)
return;
const e = this.context.extTimerQuery;
e.endQueryEXT(e.TIME_ELAPSED_EXT)
}
gpuTimingEnd() {
if (!this.options.gpuTiming)
return;
const e = this.context.extTimerQuery;
e.endQueryEXT(e.TIME_ELAPSED_EXT)
}
collectGpuTimers() {
const e = this.gpuTimers;
return this.gpuTimers = {},
e
}
collectDeferredRenderGpuQueries() {
const e = this.deferredRenderGpuTimeQueries;
return this.deferredRenderGpuTimeQueries = [],
e
}
queryGpuTimers(e) {
const t = {};
for (const i in e) {
const r = e[i]
, n = this.context.extTimerQuery
, o = n.getQueryObjectEXT(r.query, n.QUERY_RESULT_EXT) / 1e6;
n.deleteQueryEXT(r.query),
t[i] = o
}
return t
}
queryGpuTimeDeferredRender(e) {
if (!this.options.gpuTimingDeferredRender)
return 0;
const t = this.context.extTimerQuery;
let i = 0;
for (const r of e)
i += t.getQueryObjectEXT(r, t.QUERY_RESULT_EXT) / 1e6,
t.deleteQueryEXT(r);
return i
}
translatePosMatrix(t, i, r, n, o) {
if (!r[0] && !r[1])
return t;
const s = o ? "map" === n ? this.transform.angle : 0 : "viewport" === n ? -this.transform.angle : 0;
if (s) {
const e = Math.sin(s)
, t = Math.cos(s);
r = [r[0] * t - r[1] * e, r[0] * e + r[1] * t]
}
const a = [o ? r[0] : D(i, r[0], this.transform.zoom), o ? r[1] : D(i, r[1], this.transform.zoom), 0]
, l = new Float32Array(16);
return e.translate(l, t, a),
l
}
saveTileTexture(e) {
const t = this._tileTextures[e.size[0]];
t ? t.push(e) : this._tileTextures[e.size[0]] = [e]
}
getTileTexture(e) {
const t = this._tileTextures[e];
return t && t.length > 0 ? t.pop() : null
}
isPatternMissing(e) {
if (!e)
return !1;
if (!e.from || !e.to)
return !0;
const t = this.imageManager.getPattern(e.from.toString())
, i = this.imageManager.getPattern(e.to.toString());
return !t || !i
}
currentGlobalDefines() {
const e = this.terrain && this.terrain.renderingToTexture
, t = this.style && this.style.fog
, i = [];
return this.terrain && !this.terrain.renderingToTexture && i.push("TERRAIN"),
t && !e && 0 !== t.getOpacity(this.transform.pitch) && i.push("FOG"),
e && i.push("RENDER_TO_TEXTURE"),
this._showOverdrawInspector && i.push("OVERDRAW_INSPECTOR"),
i
}
useProgram(e, t, i) {
this.cache = this.cache || {};
const r = i || []
, n = this.currentGlobalDefines().concat(r)
, o = Di.cacheKey(di[e], e, n, t);
return this.cache[o] || (this.cache[o] = new Di(this.context,e,di[e],t,lr[e],n)),
this.cache[o]
}
setCustomLayerDefaults() {
this.context.unbindVAO(),
this.context.cullFace.setDefault(),
this.context.frontFace.setDefault(),
this.context.cullFaceSide.setDefault(),
this.context.activeTexture.setDefault(),
this.context.pixelStoreUnpack.setDefault(),
this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),
this.context.pixelStoreUnpackFlipY.setDefault()
}
setBaseState() {
const e = this.context.gl;
this.context.cullFace.set(!1),
this.context.viewport.set([0, 0, this.width, this.height]),
this.context.blendEquation.set(e.FUNC_ADD)
}
initDebugOverlayCanvas() {
null == this.debugOverlayCanvas && (this.debugOverlayCanvas = e.window.document.createElement("canvas"),
this.debugOverlayCanvas.width = 512,
this.debugOverlayCanvas.height = 512,
this.debugOverlayTexture = new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))
}
destroy() {
this._terrain && this._terrain.destroy(),
this.globeSharedBuffers && this.globeSharedBuffers.destroy(),
this.emptyTexture.destroy(),
this.debugOverlayTexture && this.debugOverlayTexture.destroy(),
this.atmosphereBuffer && this.atmosphereBuffer.destroy()
}
prepareDrawTile() {
this.terrain && this.terrain.prepareDrawTile()
}
prepareDrawProgram(t, i, r) {
if (this.terrain && this.terrain.renderingToTexture)
return;
const n = this.style.fog;
if (n) {
const o = n.getOpacity(this.transform.pitch)
, s = ((t,i,r,n,o,s,a,l,c,u,h)=>{
const d = t.transform
, p = i.properties.get("color").toArray01();
p[3] = n;
const f = t.frameCounter / 1e3 % 1;
return {
u_fog_matrix: r ? d.calculateFogTileMatrix(r) : t.identityMat,
u_fog_range: i.getFovAdjustedRange(d._fov),
u_fog_color: p,
u_fog_horizon_blend: i.properties.get("horizon-blend"),
u_fog_temporal_offset: f,
u_frustum_tl: o,
u_frustum_tr: s,
u_frustum_br: a,
u_frustum_bl: l,
u_globe_pos: c,
u_globe_radius: u,
u_viewport: h,
u_globe_transition: e.globeToMercatorTransition(d.zoom),
u_is_globe: +("globe" === d.projection.name)
}
}
)(this, n, r, o, this.transform.frustumCorners.TL, this.transform.frustumCorners.TR, this.transform.frustumCorners.BR, this.transform.frustumCorners.BL, this.transform.globeCenterInViewSpace, this.transform.globeRadius, [this.transform.width * e.exported.devicePixelRatio, this.transform.height * e.exported.devicePixelRatio]);
i.setFogUniformValues(t, s)
}
}
setTileLoadedFlag(e) {
this.tileLoaded = e
}
saveCanvasCopy() {
this.frameCopies.push(this.canvasCopy()),
this.tileLoaded = !1
}
canvasCopy() {
const e = this.context.gl
, t = e.createTexture();
return e.bindTexture(e.TEXTURE_2D, t),
e.copyTexImage2D(e.TEXTURE_2D, 0, e.RGBA, 0, 0, e.drawingBufferWidth, e.drawingBufferHeight, 0),
t
}
getCanvasCopiesAndTimestamps() {
return {
canvasCopies: this.frameCopies,
timeStamps: this.loadTimeStamps
}
}
averageElevationNeedsEasing() {
if (!this.transform._elevation)
return !1;
const e = this.style && this.style.fog;
return !!e && 0 !== e.getOpacity(this.transform.pitch)
}
getBackgroundTiles() {
const t = this._backgroundTiles
, i = this._backgroundTiles = {}
, r = this.transform.coveringTiles({
tileSize: 512
});
for (const n of r)
i[n.key] = t[n.key] || new e.Tile(n,512,this.transform.tileZoom,this);
return i
}
clearBackgroundTiles() {
this._backgroundTiles = {}
}
}
class Fr {
constructor(e=0, t=0, i=0, r=0) {
if (isNaN(e) || e < 0 || isNaN(t) || t < 0 || isNaN(i) || i < 0 || isNaN(r) || r < 0)
throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");
this.top = e,
this.bottom = t,
this.left = i,
this.right = r
}
interpolate(t, i, r) {
return null != i.top && null != t.top && (this.top = e.number(t.top, i.top, r)),
null != i.bottom && null != t.bottom && (this.bottom = e.number(t.bottom, i.bottom, r)),
null != i.left && null != t.left && (this.left = e.number(t.left, i.left, r)),
null != i.right && null != t.right && (this.right = e.number(t.right, i.right, r)),
this
}
getCenter(t, i) {
const r = e.clamp((this.left + t - this.right) / 2, 0, t)
, n = e.clamp((this.top + i - this.bottom) / 2, 0, i);
return new e.pointGeometry(r,n)
}
equals(e) {
return this.top === e.top && this.bottom === e.bottom && this.left === e.left && this.right === e.right
}
clone() {
return new Fr(this.top,this.bottom,this.left,this.right)
}
toJSON() {
return {
top: this.top,
bottom: this.bottom,
left: this.left,
right: this.right
}
}
}
function Ur(t, i) {
const r = e.getColumn(t, 3);
e.fromQuat(t, i),
e.setColumn(t, 3, r)
}
function Vr(t, i) {
const r = e.identity$1([]);
return e.rotateZ$1(r, r, -i),
e.rotateX$1(r, r, -t),
r
}
function jr(t, i) {
const r = [t[0], t[1], 0]
, n = [i[0], i[1], 0];
if (e.length(r) >= 1e-15) {
const t = e.normalize([], r);
e.scale$2(n, t, e.dot(n, t)),
i[0] = n[0],
i[1] = n[1]
}
const o = e.cross([], i, t);
if (e.len(o) < 1e-15)
return null;
const s = Math.atan2(-o[1], o[0]);
return Vr(Math.atan2(Math.sqrt(t[0] * t[0] + t[1] * t[1]), -t[2]), s)
}
class Nr {
constructor(e, t) {
this.position = e,
this.orientation = t
}
get position() {
return this._position
}
set position(t) {
if (t) {
const i = t instanceof e.MercatorCoordinate ? t : new e.MercatorCoordinate(t[0],t[1],t[2]);
this._renderWorldCopies && (i.x = e.wrap(i.x, 0, 1)),
this._position = i
} else
this._position = null
}
lookAtPoint(t, i) {
if (this.orientation = null,
!this.position)
return;
const r = this._elevation ? this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)) : 0
, n = this.position
, o = e.MercatorCoordinate.fromLngLat(t, r)
, s = [o.x - n.x, o.y - n.y, o.z - n.z];
i || (i = [0, 0, 1]),
i[2] = Math.abs(i[2]),
this.orientation = jr(s, i)
}
setPitchBearing(t, i) {
this.orientation = Vr(e.degToRad(t), e.degToRad(-i))
}
}
class Gr {
constructor(t, i) {
this._transform = e.identity([]),
this.orientation = i,
this.position = t
}
get mercatorPosition() {
const t = this.position;
return new e.MercatorCoordinate(t[0],t[1],t[2])
}
get position() {
const t = e.getColumn(this._transform, 3);
return [t[0], t[1], t[2]]
}
set position(t) {
var i;
t && e.setColumn(this._transform, 3, [(i = t)[0], i[1], i[2], 1])
}
get orientation() {
return this._orientation
}
set orientation(t) {
this._orientation = t || e.identity$1([]),
t && Ur(this._transform, this._orientation)
}
getPitchBearing() {
const e = this.forward()
, t = this.right();
return {
bearing: Math.atan2(-t[1], t[0]),
pitch: Math.atan2(Math.sqrt(e[0] * e[0] + e[1] * e[1]), -e[2])
}
}
setPitchBearing(e, t) {
this._orientation = Vr(e, t),
Ur(this._transform, this._orientation)
}
forward() {
const t = e.getColumn(this._transform, 2);
return [-t[0], -t[1], -t[2]]
}
up() {
const t = e.getColumn(this._transform, 1);
return [-t[0], -t[1], -t[2]]
}
right() {
const t = e.getColumn(this._transform, 0);
return [t[0], t[1], t[2]]
}
getCameraToWorld(t, i) {
const r = new Float64Array(16);
return e.invert(r, this.getWorldToCamera(t, i)),
r
}
getWorldToCameraPosition(t, i, r) {
const n = this.position;
e.scale$2(n, n, -t);
const o = new Float64Array(16);
return e.fromScaling(o, [r, r, r]),
e.translate(o, o, n),
o[10] *= i,
o
}
getWorldToCamera(t, i) {
const r = new Float64Array(16)
, n = new Float64Array(4)
, o = this.position;
return e.conjugate(n, this._orientation),
e.scale$2(o, o, -t),
e.fromQuat(r, n),
e.translate(r, r, o),
r[1] *= -1,
r[5] *= -1,
r[9] *= -1,
r[13] *= -1,
r[8] *= i,
r[9] *= i,
r[10] *= i,
r[11] *= i,
r
}
getCameraToClipPerspective(t, i, r, n) {
const o = new Float64Array(16);
return e.perspective(o, t, i, r, n),
o
}
getDistanceToElevation(t) {
const i = 0 === t ? 0 : e.mercatorZfromAltitude(t, this.position[1])
, r = this.forward();
return (i - this.position[2]) / r[2]
}
clone() {
return new Gr([...this.position],[...this.orientation])
}
}
function $r(t, i) {
const r = Zr(t.projection, t.zoom, t.width, t.height)
, n = function(t, i, r, n, o) {
const s = new e.LngLat(r.lng - 180 * Wr,r.lat)
, a = new e.LngLat(r.lng + 180 * Wr,r.lat)
, l = t.project(s.lng, s.lat)
, c = t.project(a.lng, a.lat)
, u = -Math.atan2(c.y - l.y, c.x - l.x)
, h = e.MercatorCoordinate.fromLngLat(r);
h.y = e.clamp(h.y, -.999975, .999975);
const d = h.toLngLat()
, p = t.project(d.lng, d.lat)
, f = e.MercatorCoordinate.fromLngLat(d);
f.x += Wr;
const m = f.toLngLat()
, _ = t.project(m.lng, m.lat)
, g = Hr(_.x - p.x, _.y - p.y, u)
, y = e.MercatorCoordinate.fromLngLat(d);
y.y += Wr;
const x = y.toLngLat()
, v = t.project(x.lng, x.lat)
, b = Hr(v.x - p.x, v.y - p.y, u)
, w = Math.abs(g.x) / Math.abs(b.y)
, T = e.identity([]);
e.rotateZ(T, T, -u * (1 - (o ? 0 : n)));
const E = e.identity([]);
return e.scale(E, E, [1, 1 - (1 - w) * n, 1]),
E[4] = -b.x / b.y * n,
e.rotateZ(E, E, u),
e.multiply(E, T, E),
E
}(t.projection, 0, t.center, r, i)
, o = qr(t);
return e.scale(n, n, [o, o, 1]),
n
}
function qr(t) {
const i = t.projection
, r = Zr(t.projection, t.zoom, t.width, t.height)
, n = Xr(i, t.center)
, o = Xr(i, e.LngLat.convert(i.center));
return Math.pow(2, n * r + (1 - r) * o)
}
function Zr(t, i, r, n, o=1 / 0) {
const s = t.range;
if (!s)
return 0;
const a = Math.min(o, Math.max(r, n))
, l = Math.log(a / 1024) / Math.LN2;
return e.smoothstep(s[0] + l, s[1] + l, i)
}
const Wr = 1 / 4e4;
function Xr(t, i) {
const r = e.clamp(i.lat, -e.MAX_MERCATOR_LATITUDE, e.MAX_MERCATOR_LATITUDE)
, n = new e.LngLat(i.lng - 180 * Wr,r)
, o = new e.LngLat(i.lng + 180 * Wr,r)
, s = t.project(n.lng, r)
, a = t.project(o.lng, r)
, l = e.MercatorCoordinate.fromLngLat(n)
, c = e.MercatorCoordinate.fromLngLat(o)
, u = a.x - s.x
, h = a.y - s.y
, d = c.x - l.x
, p = c.y - l.y
, f = Math.sqrt((d * d + p * p) / (u * u + h * h));
return Math.log(f) / Math.LN2
}
function Hr(e, t, i) {
const r = Math.cos(i)
, n = Math.sin(i);
return {
x: e * r - t * n,
y: e * n + t * r
}
}
class Yr {
constructor(t, i, r, n, o, s, a) {
this.tileSize = 512,
this._renderWorldCopies = void 0 === o || o,
this._minZoom = t || 0,
this._maxZoom = i || 22,
this._minPitch = null == r ? 0 : r,
this._maxPitch = null == n ? 60 : n,
this.setProjection(s),
this.setMaxBounds(a),
this.width = 0,
this.height = 0,
this._center = new e.LngLat(0,0),
this.zoom = 0,
this.angle = 0,
this._fov = .6435011087932844,
this._pitch = 0,
this._nearZ = 0,
this._farZ = 0,
this._unmodified = !0,
this._edgeInsets = new Fr,
this._projMatrixCache = {},
this._alignedProjMatrixCache = {},
this._fogTileMatrixCache = {},
this._distanceTileDataCache = {},
this._camera = new Gr,
this._centerAltitude = 0,
this._averageElevation = 0,
this.cameraElevationReference = "ground",
this._pixelsPerMercatorPixel = 1,
this.globeRadius = 0,
this.globeCenterInViewSpace = [0, 0, 0],
this._horizonShift = .1
}
clone() {
const e = new Yr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());
return e._elevation = this._elevation,
e._centerAltitude = this._centerAltitude,
e._centerAltitudeValidForExaggeration = this._centerAltitudeValidForExaggeration,
e.tileSize = this.tileSize,
e.width = this.width,
e.height = this.height,
e.cameraElevationReference = this.cameraElevationReference,
e._center = this._center,
e._setZoom(this.zoom),
e._seaLevelZoom = this._seaLevelZoom,
e.angle = this.angle,
e._fov = this._fov,
e._pitch = this._pitch,
e._nearZ = this._nearZ,
e._farZ = this._farZ,
e._averageElevation = this._averageElevation,
e._unmodified = this._unmodified,
e._edgeInsets = this._edgeInsets.clone(),
e._camera = this._camera.clone(),
e._calcMatrices(),
e.freezeTileCoverage = this.freezeTileCoverage,
e.frustumCorners = this.frustumCorners,
e
}
get elevation() {
return this._elevation
}
set elevation(e) {
this._elevation !== e && (this._elevation = e,
this._updateCameraOnTerrain(),
this._calcMatrices())
}
updateElevation(e) {
const t = this._elevation && this._elevation.exaggeration() !== this._centerAltitudeValidForExaggeration;
(null == this._seaLevelZoom || t) && this._updateCameraOnTerrain(),
(e || t) && this._constrainCameraAltitude(),
this._calcMatrices()
}
getProjection() {
return e.pick(this.projection, ["name", "center", "parallels"])
}
setProjection(i) {
this.projectionOptions = i || {
name: "mercator"
};
const r = this.projection ? this.getProjection() : void 0;
this.projection = e.getProjection(this.projectionOptions);
const n = !t(r, this.getProjection());
return n && this._calcMatrices(),
this.mercatorFromTransition = !1,
n
}
setMercatorFromTransition() {
const t = this.projection.name;
this.mercatorFromTransition = !0,
this.projectionOptions = {
name: "mercator"
},
this.projection = e.getProjection({
name: "mercator"
});
const i = t !== this.projection.name;
return i && this._calcMatrices(),
i
}
get minZoom() {
return this._minZoom
}
set minZoom(e) {
this._minZoom !== e && (this._minZoom = e,
this.zoom = Math.max(this.zoom, e))
}
get maxZoom() {
return this._maxZoom
}
set maxZoom(e) {
this._maxZoom !== e && (this._maxZoom = e,
this.zoom = Math.min(this.zoom, e))
}
get minPitch() {
return this._minPitch
}
set minPitch(e) {
this._minPitch !== e && (this._minPitch = e,
this.pitch = Math.max(this.pitch, e))
}
get maxPitch() {
return this._maxPitch
}
set maxPitch(e) {
this._maxPitch !== e && (this._maxPitch = e,
this.pitch = Math.min(this.pitch, e))
}
get renderWorldCopies() {
return this._renderWorldCopies && !0 === this.projection.supportsWorldCopies
}
set renderWorldCopies(e) {
void 0 === e ? e = !0 : null === e && (e = !1),
this._renderWorldCopies = e
}
get worldSize() {
return this.tileSize * this.scale
}
get cameraWorldSize() {
const e = Math.max(this._camera.getDistanceToElevation(this._averageElevation), Number.EPSILON);
return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))
}
get pixelsPerMeter() {
return this.projection.pixelsPerMeter(this.center.lat, this.worldSize)
}
get cameraPixelsPerMeter() {
return e.mercatorZfromAltitude(this.center.lat, this.cameraWorldSize)
}
get centerOffset() {
return this.centerPoint._sub(this.size._div(2))
}
get size() {
return new e.pointGeometry(this.width,this.height)
}
get bearing() {
return e.wrap(this.rotation, -180, 180)
}
set bearing(e) {
this.rotation = e
}
get rotation() {
return -this.angle / Math.PI * 180
}
set rotation(t) {
const i = -t * Math.PI / 180;
var r;
this.angle !== i && (this._unmodified = !1,
this.angle = i,
this._calcMatrices(),
this.rotationMatrix = (r = new e.ARRAY_TYPE(4),
e.ARRAY_TYPE != Float32Array && (r[1] = 0,
r[2] = 0),
r[0] = 1,
r[3] = 1,
r),
function(e, t, i) {
var r = t[0]
, n = t[1]
, o = t[2]
, s = t[3]
, a = Math.sin(i)
, l = Math.cos(i);
e[0] = r * l + o * a,
e[1] = n * l + s * a,
e[2] = r * -a + o * l,
e[3] = n * -a + s * l
}(this.rotationMatrix, this.rotationMatrix, this.angle))
}
get pitch() {
return this._pitch / Math.PI * 180
}
set pitch(t) {
const i = e.clamp(t, this.minPitch, this.maxPitch) / 180 * Math.PI;
this._pitch !== i && (this._unmodified = !1,
this._pitch = i,
this._calcMatrices())
}
get fov() {
return this._fov / Math.PI * 180
}
set fov(e) {
e = Math.max(.01, Math.min(60, e)),
this._fov !== e && (this._unmodified = !1,
this._fov = e / 180 * Math.PI,
this._calcMatrices())
}
get averageElevation() {
return this._averageElevation
}
set averageElevation(e) {
this._averageElevation = e,
this._calcFogMatrices(),
this._distanceTileDataCache = {}
}
get zoom() {
return this._zoom
}
set zoom(e) {
const t = Math.min(Math.max(e, this.minZoom), this.maxZoom);
this._zoom !== t && (this._unmodified = !1,
this._setZoom(t),
this._updateSeaLevelZoom(),
this._constrain(),
this._calcMatrices())
}
_setZoom(e) {
this._zoom = e,
this.scale = this.zoomScale(e),
this.tileZoom = Math.floor(e),
this.zoomFraction = e - this.tileZoom
}
_updateCameraOnTerrain() {
if (!this._elevation || !this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))
return this._centerAltitude = 0,
this._seaLevelZoom = null,
void (this._centerAltitudeValidForExaggeration = void 0);
const e = this._elevation;
this._centerAltitude = e.getAtPointOrZero(this.locationCoordinate(this.center)),
this._centerAltitudeValidForExaggeration = e.exaggeration(),
this._updateSeaLevelZoom()
}
_updateSeaLevelZoom() {
void 0 !== this._centerAltitudeValidForExaggeration && (this._seaLevelZoom = this._zoomFromMercatorZ((this.pixelsPerMeter * this._centerAltitude + this.cameraToCenterDistance) / this.worldSize))
}
sampleAverageElevation() {
if (!this._elevation)
return 0;
const t = this._elevation
, i = [[.5, .2], [.3, .5], [.5, .5], [.7, .5], [.5, .8]]
, r = this.horizonLineFromTop();
let n = 0
, o = 0;
for (let s = 0; s < i.length; s++) {
const a = new e.pointGeometry(i[s][0] * this.width,r + i[s][1] * (this.height - r))
, l = t.pointCoordinate(a);
if (!l)
continue;
const c = 1 / Math.hypot(l[0] - this._camera.position[0], l[1] - this._camera.position[1]);
n += l[3] * c,
o += c
}
return 0 === o ? NaN : n / o
}
get center() {
return this._center
}
set center(e) {
e.lat === this._center.lat && e.lng === this._center.lng || (this._unmodified = !1,
this._center = e,
this._terrainEnabled() && ("ground" === this.cameraElevationReference ? this._updateCameraOnTerrain() : this._updateZoomFromElevation()),
this._constrain(),
this._calcMatrices())
}
_updateZoomFromElevation() {
if (null == this._seaLevelZoom || !this._elevation)
return;
const e = this._seaLevelZoom
, t = this._elevation.getAtPointOrZero(this.locationCoordinate(this.center))
, i = this.pixelsPerMeter / this.worldSize * t
, r = this._mercatorZfromZoom(e)
, n = this._mercatorZfromZoom(this._maxZoom)
, o = Math.max(r - i, n);
this._setZoom(this._zoomFromMercatorZ(o))
}
get padding() {
return this._edgeInsets.toJSON()
}
set padding(e) {
this._edgeInsets.equals(e) || (this._unmodified = !1,
this._edgeInsets.interpolate(this._edgeInsets, e, 1),
this._calcMatrices())
}
computeZoomRelativeTo(t) {
const i = this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint, t.toAltitude()));
let r;
r = t.z < this._camera.position[2] ? [i.x, i.y, i.z] : [t.x, t.y, t.z];
const n = e.length(e.sub([], this._camera.position, r));
return e.clamp(this._zoomFromMercatorZ(n), this._minZoom, this._maxZoom)
}
setFreeCameraOptions(t) {
if (!this.height)
return;
if (!t.position && !t.orientation)
return;
this._updateCameraState();
let i = !1;
if (t.orientation && !e.exactEquals(t.orientation, this._camera.orientation) && (i = this._setCameraOrientation(t.orientation)),
t.position) {
const r = [t.position.x, t.position.y, t.position.z];
e.exactEquals$1(r, this._camera.position) || (this._setCameraPosition(r),
i = !0)
}
i && (this._updateStateFromCamera(),
this.recenterOnTerrain())
}
getFreeCameraOptions() {
this._updateCameraState();
const t = this._camera.position
, i = new Nr;
return i.position = new e.MercatorCoordinate(t[0],t[1],t[2]),
i.orientation = this._camera.orientation,
i._elevation = this.elevation,
i._renderWorldCopies = this.renderWorldCopies,
i
}
_setCameraOrientation(t) {
if (!e.length$1(t))
return !1;
e.normalize$1(t, t);
const i = e.transformQuat([], [0, 0, -1], t)
, r = e.transformQuat([], [0, -1, 0], t);
if (r[2] < 0)
return !1;
const n = jr(i, r);
return !!n && (this._camera.orientation = n,
!0)
}
_setCameraPosition(t) {
const i = this.zoomScale(this.minZoom) * this.tileSize
, r = this.zoomScale(this.maxZoom) * this.tileSize
, n = this.cameraToCenterDistance;
t[2] = e.clamp(t[2], n / r, n / i),
this._camera.position = t
}
get centerPoint() {
return this._edgeInsets.getCenter(this.width, this.height)
}
get fovAboveCenter() {
return this._fov * (.5 + this.centerOffset.y / this.height)
}
isPaddingEqual(e) {
return this._edgeInsets.equals(e)
}
interpolatePadding(e, t, i) {
this._unmodified = !1,
this._edgeInsets.interpolate(e, t, i),
this._constrain(),
this._calcMatrices()
}
coveringZoomLevel(e) {
const t = (e.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / e.tileSize));
return Math.max(0, t)
}
getVisibleUnwrappedCoordinates(t) {
const i = [new e.UnwrappedTileID(0,t)];
if (this.renderWorldCopies) {
const r = this.pointCoordinate(new e.pointGeometry(0,0))
, n = this.pointCoordinate(new e.pointGeometry(this.width,0))
, o = this.pointCoordinate(new e.pointGeometry(this.width,this.height))
, s = this.pointCoordinate(new e.pointGeometry(0,this.height))
, a = Math.floor(Math.min(r.x, n.x, o.x, s.x))
, l = Math.floor(Math.max(r.x, n.x, o.x, s.x))
, c = 1;
for (let r = a - c; r <= l + c; r++)
0 !== r && i.push(new e.UnwrappedTileID(r,t))
}
return i
}
coveringTiles(t) {
let i = this.coveringZoomLevel(t);
const r = i
, n = this.elevation && !t.isTerrainDEM
, o = "mercator" === this.projection.name;
if (void 0 !== t.minzoom && i < t.minzoom)
return [];
void 0 !== t.maxzoom && i > t.maxzoom && (i = t.maxzoom);
const s = this.locationCoordinate(this.center)
, a = this.center.lat
, l = 1 << i
, c = [l * s.x, l * s.y, 0]
, u = "globe" === this.projection.name
, h = !u
, d = e.Frustum.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, i, h)
, p = u ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint())
, f = l * e.mercatorZfromAltitude(1, this.center.lat)
, m = this._camera.position[2] / e.mercatorZfromAltitude(1, this.center.lat)
, _ = [l * p.x, l * p.y, m * (h ? 1 : f)]
, g = this.cameraToCenterDistance / t.tileSize * (t.roundZoom ? 1 : .502)
, y = this.pitch <= 60 && this._edgeInsets.top <= this._edgeInsets.bottom && !this._elevation && !this.projection.isReprojectedInTileSpace ? i : 0
, x = t.isTerrainDEM && this._elevation ? 1e4 * this._elevation.exaggeration() : this._centerAltitude
, v = t.isTerrainDEM ? -x : this._elevation ? this._elevation.getMinElevationBelowMSL() : 0
, b = this.projection.isReprojectedInTileSpace ? qr(this) : 1
, w = t=>{
const i = 1 / 4e4
, r = new e.MercatorCoordinate(t.x + i,t.y,t.z)
, n = new e.MercatorCoordinate(t.x,t.y + i,t.z)
, o = t.toLngLat()
, s = r.toLngLat()
, a = n.toLngLat()
, l = this.locationCoordinate(o)
, c = this.locationCoordinate(s)
, u = this.locationCoordinate(a)
, h = Math.hypot(c.x - l.x, c.y - l.y)
, d = Math.hypot(u.x - l.x, u.y - l.y);
return Math.sqrt(h * d) * b / i
}
, T = t=>{
const i = x
, r = v;
return {
aabb: e.tileAABB(this, l, 0, 0, 0, t, r, i, this.projection),
zoom: 0,
x: 0,
y: 0,
minZ: r,
maxZ: i,
wrap: t,
fullyVisible: !1
}
}
, E = [];
let S = [];
const C = i
, M = t.reparseOverscaled ? r : i
, A = e=>e * e
, I = A((m - this._centerAltitude) * f)
, z = e=>{
if (!this._elevation || !e.tileID || !o)
return;
const t = this._elevation.getMinMaxForTile(e.tileID)
, i = e.aabb;
t ? (i.min[2] = t.min,
i.max[2] = t.max,
i.center[2] = (i.min[2] + i.max[2]) / 2) : (e.shouldSplit = k(e),
e.shouldSplit || (i.min[2] = i.max[2] = i.center[2] = this._centerAltitude))
}
, k = t=>{
if (t.zoom < y)
return !0;
if (t.zoom === C)
return !1;
if (null != t.shouldSplit)
return t.shouldSplit;
const i = t.aabb.distanceX(_)
, o = t.aabb.distanceY(_);
let s = I
, l = 1;
if (u) {
s = A(t.aabb.distanceZ(_));
const i = Math.pow(2, t.zoom)
, r = e.latFromMercatorY((t.y + 1) / i)
, n = e.latFromMercatorY(t.y / i)
, o = Math.min(Math.max(a, r), n)
, c = e.circumferenceAtLatitude(o) / e.circumferenceAtLatitude(a);
if (l = o === a ? 1 / Math.max(1, this._mercatorScaleRatio - .3) : Math.min(1, c / this._mercatorScaleRatio),
this.zoom <= e.GLOBE_ZOOM_THRESHOLD_MIN && t.zoom === C - 1 && c >= .9)
return !0
} else if (n && (s = A(t.aabb.distanceZ(_) * f)),
this.projection.isReprojectedInTileSpace && r <= 5) {
const i = Math.pow(2, t.zoom)
, r = w(new e.MercatorCoordinate((t.x + .5) / i,(t.y + .5) / i));
l = r > .85 ? 1 : r
}
const c = i * i + o * o + s;
return c < A((1 << C - t.zoom) * g * l * ((e,t)=>{
if (t * A(.707) < e)
return 1;
const i = Math.sqrt(t / e);
return i / (1.4144271570014144 + (Math.pow(1.1, i - 1.4144271570014144 + 1) - 1) / (1.1 - 1) - 1)
}
)(Math.max(s, I), c))
}
;
if (this.renderWorldCopies)
for (let e = 1; e <= 3; e++)
E.push(T(-e)),
E.push(T(e));
for (E.push(T(0)); E.length > 0; ) {
const r = E.pop()
, s = r.x
, a = r.y;
let h = r.fullyVisible;
if (!h) {
const e = r.aabb.intersects(d);
if (0 === e)
continue;
h = 2 === e
}
if (r.zoom !== C && k(r))
for (let t = 0; t < 4; t++) {
const i = (s << 1) + t % 2
, c = (a << 1) + (t >> 1)
, d = {
aabb: o ? r.aabb.quadrant(t) : e.tileAABB(this, l, r.zoom + 1, i, c, r.wrap, r.minZ, r.maxZ, this.projection),
zoom: r.zoom + 1,
x: i,
y: c,
wrap: r.wrap,
fullyVisible: h,
tileID: void 0,
shouldSplit: void 0,
minZ: r.minZ,
maxZ: r.maxZ
};
n && !u && (d.tileID = new e.OverscaledTileID(r.zoom + 1 === C ? M : r.zoom + 1,r.wrap,r.zoom + 1,i,c),
z(d)),
E.push(d)
}
else {
const n = r.zoom === C ? M : r.zoom;
if (t.minzoom && t.minzoom > n)
continue;
const o = c[0] - (.5 + s + (r.wrap << r.zoom)) * (1 << i - r.zoom)
, l = c[1] - .5 - a
, u = r.tileID ? r.tileID : new e.OverscaledTileID(n,r.wrap,r.zoom,s,a);
S.push({
tileID: u,
distanceSq: o * o + l * l
})
}
}
if (this.fogCullDistSq) {
const i = this.fogCullDistSq
, r = this.horizonLineFromTop();
S = S.filter((n=>{
const o = [0, 0, 0, 1]
, s = [e.EXTENT, e.EXTENT, 0, 1]
, a = this.calculateFogTileMatrix(n.tileID.toUnwrapped());
e.transformMat4$1(o, o, a),
e.transformMat4$1(s, s, a);
const l = e.getAABBPointSquareDist(o, s);
if (0 === l)
return !0;
let c = !1;
const u = this._elevation;
if (u && l > i && 0 !== r) {
const i = this.calculateProjMatrix(n.tileID.toUnwrapped());
let o;
t.isTerrainDEM || (o = u.getMinMaxForTile(n.tileID)),
o || (o = {
min: v,
max: x
});
const s = e.furthestTileCorner(this.rotation)
, a = [s[0] * e.EXTENT, s[1] * e.EXTENT, o.max];
e.transformMat4(a, a, i),
c = (1 - a[1]) * this.height * .5 < r
}
return l < i || c
}
))
}
return S.sort(((e,t)=>e.distanceSq - t.distanceSq)).map((e=>e.tileID))
}
resize(e, t) {
this.width = e,
this.height = t,
this.pixelsToGLUnits = [2 / e, -2 / t],
this._constrain(),
this._calcMatrices()
}
get unmodified() {
return this._unmodified
}
zoomScale(e) {
return Math.pow(2, e)
}
scaleZoom(e) {
return Math.log(e) / Math.LN2
}
project(t) {
const i = e.clamp(t.lat, -e.MAX_MERCATOR_LATITUDE, e.MAX_MERCATOR_LATITUDE)
, r = this.projection.project(t.lng, i);
return new e.pointGeometry(r.x * this.worldSize,r.y * this.worldSize)
}
unproject(e) {
return this.projection.unproject(e.x / this.worldSize, e.y / this.worldSize)
}
get point() {
return this.project(this.center)
}
setLocationAtPoint(t, i) {
let r, n;
const o = this.centerPoint;
if ("globe" === this.projection.name) {
const e = this.worldSize;
r = (i.x - o.x) / e,
n = (i.y - o.y) / e
} else {
const e = this.pointCoordinate(i)
, t = this.pointCoordinate(o);
r = e.x - t.x,
n = e.y - t.y
}
const s = this.locationCoordinate(t);
this.setLocation(new e.MercatorCoordinate(s.x - r,s.y - n))
}
setLocation(e) {
this.center = this.coordinateLocation(e),
this.projection.wrap && (this.center = this.center.wrap())
}
locationPoint(e) {
return this.projection.locationPoint(this, e)
}
locationPoint3D(e) {
return this.projection.locationPoint(this, e, !0)
}
pointLocation(e) {
return this.coordinateLocation(this.pointCoordinate(e))
}
pointLocation3D(e) {
return this.coordinateLocation(this.pointCoordinate3D(e))
}
locationCoordinate(t, i) {
const r = i ? e.mercatorZfromAltitude(i, t.lat) : void 0
, n = this.projection.project(t.lng, t.lat);
return new e.MercatorCoordinate(n.x,n.y,r)
}
coordinateLocation(e) {
return this.projection.unproject(e.x, e.y)
}
pointRayIntersection(t, i) {
const r = null != i ? i : this._centerAltitude
, n = [t.x, t.y, 0, 1]
, o = [t.x, t.y, 1, 1];
e.transformMat4$1(n, n, this.pixelMatrixInverse),
e.transformMat4$1(o, o, this.pixelMatrixInverse);
const s = o[3];
e.scale$1(n, n, 1 / n[3]),
e.scale$1(o, o, 1 / s);
const a = n[2]
, l = o[2];
return {
p0: n,
p1: o,
t: a === l ? 0 : (r - a) / (l - a)
}
}
screenPointToMercatorRay(t) {
const i = [t.x, t.y, 0, 1]
, r = [t.x, t.y, 1, 1];
return e.transformMat4$1(i, i, this.pixelMatrixInverse),
e.transformMat4$1(r, r, this.pixelMatrixInverse),
e.scale$1(i, i, 1 / i[3]),
e.scale$1(r, r, 1 / r[3]),
i[2] = e.mercatorZfromAltitude(i[2], this._center.lat) * this.worldSize,
r[2] = e.mercatorZfromAltitude(r[2], this._center.lat) * this.worldSize,
e.scale$1(i, i, 1 / this.worldSize),
e.scale$1(r, r, 1 / this.worldSize),
new e.Ray([i[0], i[1], i[2]],e.normalize([], e.sub([], r, i)))
}
rayIntersectionCoordinate(t) {
const {p0: i, p1: r, t: n} = t
, o = e.mercatorZfromAltitude(i[2], this._center.lat)
, s = e.mercatorZfromAltitude(r[2], this._center.lat);
return new e.MercatorCoordinate(e.number(i[0], r[0], n) / this.worldSize,e.number(i[1], r[1], n) / this.worldSize,e.number(o, s, n))
}
pointCoordinate(e, t=this._centerAltitude) {
return this.projection.pointCoordinate(this, e.x, e.y, t)
}
pointCoordinate3D(t) {
if (!this.elevation)
return this.pointCoordinate(t);
let i = this.projection.pointCoordinate3D(this, t.x, t.y);
if (i)
return new e.MercatorCoordinate(i[0],i[1],i[2]);
let r = 0
, n = this.horizonLineFromTop();
if (t.y > n)
return this.pointCoordinate(t);
const o = .02 * n
, s = t.clone();
for (let t = 0; t < 10 && n - r > o; t++) {
s.y = e.number(r, n, .66);
const t = this.projection.pointCoordinate3D(this, s.x, s.y);
t ? (n = s.y,
i = t) : r = s.y
}
return i ? new e.MercatorCoordinate(i[0],i[1],i[2]) : this.pointCoordinate(t)
}
isPointAboveHorizon(e) {
return this.projection.isPointAboveHorizon(this, e)
}
_coordinatePoint(t, i) {
const r = i && this.elevation ? this.elevation.getAtPointOrZero(t, this._centerAltitude) : this._centerAltitude
, n = [t.x * this.worldSize, t.y * this.worldSize, r + t.toAltitude(), 1];
return e.transformMat4$1(n, n, this.pixelMatrix),
n[3] > 0 ? new e.pointGeometry(n[0] / n[3],n[1] / n[3]) : new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)
}
_getBounds(t, i) {
const r = new e.pointGeometry(this._edgeInsets.left,this._edgeInsets.top)
, n = new e.pointGeometry(this.width - this._edgeInsets.right,this._edgeInsets.top)
, o = new e.pointGeometry(this.width - this._edgeInsets.right,this.height - this._edgeInsets.bottom)
, s = new e.pointGeometry(this._edgeInsets.left,this.height - this._edgeInsets.bottom);
let a = this.pointCoordinate(r, t)
, l = this.pointCoordinate(n, t);
const c = this.pointCoordinate(o, i)
, u = this.pointCoordinate(s, i)
, h = (e,t)=>(t.y - e.y) / (t.x - e.x);
return a.y > 1 && l.y >= 0 ? a = new e.MercatorCoordinate((1 - u.y) / h(u, a) + u.x,1) : a.y < 0 && l.y <= 1 && (a = new e.MercatorCoordinate(-u.y / h(u, a) + u.x,0)),
l.y > 1 && a.y >= 0 ? l = new e.MercatorCoordinate((1 - c.y) / h(c, l) + c.x,1) : l.y < 0 && a.y <= 1 && (l = new e.MercatorCoordinate(-c.y / h(c, l) + c.x,0)),
(new e.LngLatBounds).extend(this.coordinateLocation(a)).extend(this.coordinateLocation(l)).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(c))
}
_getBounds3D() {
const e = this.elevation;
if (!e.visibleDemTiles.length)
return this._getBounds(0, 0);
const t = e.visibleDemTiles.reduce(((e,t)=>{
if (t.dem) {
const i = t.dem.tree;
e.min = Math.min(e.min, i.minimums[0]),
e.max = Math.max(e.max, i.maximums[0])
}
return e
}
), {
min: Number.MAX_VALUE,
max: 0
});
return this._getBounds(t.min * e.exaggeration(), t.max * e.exaggeration())
}
getBounds() {
return this._terrainEnabled() ? this._getBounds3D() : this._getBounds(0, 0)
}
horizonLineFromTop(e=!0) {
const t = this.height / 2 / Math.tan(this._fov / 2) / Math.tan(Math.max(this._pitch, .1)) + this.centerOffset.y
, i = this.height / 2 - t * (1 - this._horizonShift);
return e ? Math.max(0, i) : i
}
getMaxBounds() {
return this.maxBounds
}
setMaxBounds(t) {
this.maxBounds = t,
this.minLat = -e.MAX_MERCATOR_LATITUDE,
this.maxLat = e.MAX_MERCATOR_LATITUDE,
this.minLng = -180,
this.maxLng = 180,
t && (this.minLat = t.getSouth(),
this.maxLat = t.getNorth(),
this.minLng = t.getWest(),
this.maxLng = t.getEast(),
this.maxLng < this.minLng && (this.maxLng += 360)),
this.worldMinX = e.mercatorXfromLng(this.minLng) * this.tileSize,
this.worldMaxX = e.mercatorXfromLng(this.maxLng) * this.tileSize,
this.worldMinY = e.mercatorYfromLat(this.maxLat) * this.tileSize,
this.worldMaxY = e.mercatorYfromLat(this.minLat) * this.tileSize,
this._constrain()
}
calculatePosMatrix(e, t) {
return this.projection.createTileMatrix(this, t, e)
}
calculateDistanceTileData(t) {
const i = t.key
, r = this._distanceTileDataCache;
if (r[i])
return r[i];
const n = t.canonical
, o = 1 / this.height
, s = this.cameraWorldSize / this.zoomScale(n.z)
, a = (n.x + Math.pow(2, n.z) * t.wrap) * s
, l = n.y * s
, c = this.point
, u = this.angle
, h = Math.sin(-u)
, d = -Math.cos(-u);
return r[i] = {
bearing: [h, d],
center: [(c.x - a) * o, (c.y - l) * o],
scale: s / e.EXTENT * o
},
r[i]
}
calculateFogTileMatrix(t) {
const i = t.key
, r = this._fogTileMatrixCache;
if (r[i])
return r[i];
const n = this.projection.createTileMatrix(this, this.cameraWorldSize, t);
return e.multiply(n, this.worldToFogMatrix, n),
r[i] = new Float32Array(n),
r[i]
}
calculateProjMatrix(t, i=!1) {
const r = t.key
, n = i ? this._alignedProjMatrixCache : this._projMatrixCache;
if (n[r])
return n[r];
const o = this.calculatePosMatrix(t, this.worldSize);
return e.multiply(o, this.projection.isReprojectedInTileSpace ? this.mercatorMatrix : i ? this.alignedProjMatrix : this.projMatrix, o),
n[r] = new Float32Array(o),
n[r]
}
calculatePixelsToTileUnitsMatrix(t) {
const i = t.tileID.key
, r = this._pixelsToTileUnitsCache;
if (r[i])
return r[i];
const n = function(t, i) {
const {scale: r} = t.tileTransform
, n = r * e.EXTENT / (t.tileSize * Math.pow(2, i.zoom - t.tileID.overscaledZ + t.tileID.canonical.z));
return o = new Float32Array(4),
l = (s = i.inverseAdjustmentMatrix)[1],
c = s[2],
u = s[3],
d = (a = [n, n])[1],
o[0] = s[0] * (h = a[0]),
o[1] = l * h,
o[2] = c * d,
o[3] = u * d,
o;
var o, s, a, l, c, u, h, d
}(t, this);
return r[i] = n,
r[i]
}
customLayerMatrix() {
return this.mercatorMatrix.slice()
}
recenterOnTerrain() {
if (!this._elevation || "globe" === this.projection.name)
return;
const t = this._elevation;
this._updateCameraState();
const i = e.mercatorZfromAltitude(1, this._center.lat) * this.worldSize
, r = this._computeCameraPosition(i)
, n = this._camera.forward()
, o = e.mercatorZfromAltitude(1, this._center.lat);
r[2] /= o,
n[2] /= o,
e.normalize(n, n);
const s = t.raycast(r, n, t.exaggeration());
if (s) {
const t = e.scaleAndAdd([], r, n, s)
, i = new e.MercatorCoordinate(t[0],t[1],e.mercatorZfromAltitude(t[2], e.latFromMercatorY(t[1])))
, a = (i.z + e.length([i.x - r[0], i.y - r[1], i.z - r[2] * o])) * this._pixelsPerMercatorPixel;
this._seaLevelZoom = this._zoomFromMercatorZ(a),
this._centerAltitude = i.toAltitude(),
this._center = this.coordinateLocation(i),
this._updateZoomFromElevation(),
this._constrain(),
this._calcMatrices()
}
}
_constrainCameraAltitude() {
if (!this._elevation)
return;
const t = this._elevation;
this._updateCameraState();
const i = e.mercatorZfromAltitude(1, this._center.lat) * this.worldSize
, r = this._computeCameraPosition(i)
, n = t.getAtPointOrZero(new e.MercatorCoordinate(...r))
, o = this._minimumHeightOverTerrain() * Math.cos(e.degToRad(this._maxPitch))
, s = this._camera.position[2] - this.pixelsPerMeter / this.worldSize * n;
if (s < o) {
const t = this.locationCoordinate(this._center, this._centerAltitude)
, i = [t.x - r[0], t.y - r[1], t.z - r[2]]
, n = e.length(i);
i[2] -= (o - s) / this._pixelsPerMercatorPixel;
const a = e.length(i);
if (0 === a)
return;
e.scale$2(i, i, n / a * this._pixelsPerMercatorPixel),
this._camera.position = [t.x - i[0], t.y - i[1], t.z * this._pixelsPerMercatorPixel - i[2]],
this._camera.orientation = jr(i, this._camera.up()),
this._updateStateFromCamera()
}
}
_constrain() {
if (!this.center || !this.width || !this.height || this._constraining)
return;
this._constraining = !0;
const t = "globe" === this.projection.name || this.mercatorFromTransition;
if (this.projection.isReprojectedInTileSpace || t) {
const i = this.center;
return i.lat = e.clamp(i.lat, this.minLat, this.maxLat),
(this.maxBounds || !this.renderWorldCopies && !t) && (i.lng = e.clamp(i.lng, this.minLng, this.maxLng)),
this.center = i,
void (this._constraining = !1)
}
const i = this._unmodified
, {x: r, y: n} = this.point;
let o = 0
, s = r
, a = n;
const l = this.width / 2
, c = this.height / 2
, u = this.worldMinY * this.scale
, h = this.worldMaxY * this.scale;
if (n - c < u && (a = u + c),
n + c > h && (a = h - c),
h - u < this.height && (o = Math.max(o, this.height / (h - u)),
a = (h + u) / 2),
this.maxBounds || !this._renderWorldCopies || !this.projection.wrap) {
const e = this.worldMinX * this.scale
, t = this.worldMaxX * this.scale
, i = this.worldSize / 2 - (e + t) / 2;
s = (r + i + this.worldSize) % this.worldSize - i,
s - l < e && (s = e + l),
s + l > t && (s = t - l),
t - e < this.width && (o = Math.max(o, this.width / (t - e)),
s = (t + e) / 2)
}
s === r && a === n || (this.center = this.unproject(new e.pointGeometry(s,a))),
o && (this.zoom += this.scaleZoom(o)),
this._constrainCameraAltitude(),
this._unmodified = i,
this._constraining = !1
}
_minZoomForBounds() {
let e = Math.max(0, this.scaleZoom(this.height / (this.worldMaxY - this.worldMinY)));
return this.maxBounds && (e = Math.max(e, this.scaleZoom(this.width / (this.worldMaxX - this.worldMinX)))),
e
}
_maxCameraBoundsDistance() {
return this._mercatorZfromZoom(this._minZoomForBounds())
}
_calcMatrices() {
if (!this.height)
return;
const t = this.centerOffset
, i = this.pixelsPerMeter;
"globe" === this.projection.name && (this._mercatorScaleRatio = e.mercatorZfromAltitude(1, this.center.lat) / e.mercatorZfromAltitude(1, e.GLOBE_SCALE_MATCH_LATITUDE));
const r = Zr(this.projection, this.zoom, this.width, this.height, 1024);
this._pixelsPerMercatorPixel = this.projection.pixelSpaceConversion(this.center.lat, this.worldSize, r),
this.cameraToCenterDistance = .5 / Math.tan(.5 * this._fov) * this.height * this._pixelsPerMercatorPixel,
this._updateCameraState(),
this._farZ = this.projection.farthestPixelDistance(this),
this._nearZ = this.height / 50;
const n = this._camera.getWorldToCamera(this.worldSize, "meters" === this.projection.zAxisUnit ? i : 1)
, o = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, this._farZ);
o[8] = 2 * -t.x / this.width,
o[9] = 2 * t.y / this.height;
let s = e.mul([], o, n);
if (this.projection.isReprojectedInTileSpace) {
const t = this.locationCoordinate(this.center)
, i = e.identity([]);
e.translate(i, i, [t.x * this.worldSize, t.y * this.worldSize, 0]),
e.multiply(i, i, $r(this)),
e.translate(i, i, [-t.x * this.worldSize, -t.y * this.worldSize, 0]),
e.multiply(s, s, i),
this.inverseAdjustmentMatrix = function(e) {
const t = $r(e, !0);
return y([], [t[0], t[1], t[4], t[5]])
}(this)
} else
this.inverseAdjustmentMatrix = [1, 0, 0, 1];
this.mercatorMatrix = e.scale([], s, [this.worldSize, this.worldSize, this.worldSize / i, 1]),
this.projMatrix = s,
this.invProjMatrix = e.invert(new Float64Array(16), this.projMatrix);
const a = e.invert([], o);
this.frustumCorners = e.FrustumCorners.fromInvProjectionMatrix(a, this.horizonLineFromTop(), this.height);
const l = new Float32Array(16);
e.identity(l),
e.scale(l, l, [1, -1, 1]),
e.rotateX(l, l, this._pitch),
e.rotateZ(l, l, this.angle);
const c = e.perspective(new Float32Array(16), this._fov, this.width / this.height, this._nearZ, this._farZ)
, u = (Math.PI / 2 - this._pitch) * (this.height / this._fov) * this._horizonShift;
c[8] = 2 * -t.x / this.width,
c[9] = 2 * (t.y + u) / this.height,
this.skyboxMatrix = e.multiply(l, c, l);
const h = this.point
, d = h.x
, p = h.y
, f = this.width % 2 / 2
, m = this.height % 2 / 2
, _ = Math.cos(this.angle)
, g = Math.sin(this.angle)
, x = d - Math.round(d) + _ * f + g * m
, v = p - Math.round(p) + _ * m + g * f
, b = new Float64Array(s);
if (e.translate(b, b, [x > .5 ? x - 1 : x, v > .5 ? v - 1 : v, 0]),
this.alignedProjMatrix = b,
s = e.create(),
e.scale(s, s, [this.width / 2, -this.height / 2, 1]),
e.translate(s, s, [1, -1, 0]),
this.labelPlaneMatrix = s,
s = e.create(),
e.scale(s, s, [1, -1, 1]),
e.translate(s, s, [-1, -1, 0]),
e.scale(s, s, [2 / this.width, 2 / this.height, 1]),
this.glCoordMatrix = s,
this.pixelMatrix = e.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix),
this._calcFogMatrices(),
this._distanceTileDataCache = {},
s = e.invert(new Float64Array(16), this.pixelMatrix),
!s)
throw new Error("failed to invert matrix");
if (this.pixelMatrixInverse = s,
"globe" === this.projection.name || this.mercatorFromTransition) {
this.globeMatrix = e.calculateGlobeMatrix(this);
const t = [this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]];
this.globeCenterInViewSpace = e.transformMat4(t, t, n),
this.globeRadius = this.worldSize / 2 / Math.PI - 1
} else
this.globeMatrix = s;
this._projMatrixCache = {},
this._alignedProjMatrixCache = {},
this._pixelsToTileUnitsCache = {}
}
_calcFogMatrices() {
this._fogTileMatrixCache = {};
const t = this.cameraWorldSize
, i = this.cameraPixelsPerMeter
, r = this._camera.position
, n = 1 / this.height / this._pixelsPerMercatorPixel
, o = [t, t, i];
e.scale$2(o, o, n),
e.scale$2(r, r, -1),
e.multiply$2(r, r, o);
const s = e.create();
e.translate(s, s, r),
e.scale(s, s, o),
this.mercatorFogMatrix = s,
this.worldToFogMatrix = this._camera.getWorldToCameraPosition(t, i, n)
}
_computeCameraPosition(e) {
const t = (e = e || this.pixelsPerMeter) / this.pixelsPerMeter
, i = this._camera.forward()
, r = this.point
, n = this._mercatorZfromZoom(this._seaLevelZoom ? this._seaLevelZoom : this._zoom) * t - e / this.worldSize * this._centerAltitude;
return [r.x / this.worldSize - i[0] * n, r.y / this.worldSize - i[1] * n, e / this.worldSize * this._centerAltitude - i[2] * n]
}
_updateCameraState() {
this.height && (this._camera.setPitchBearing(this._pitch, this.angle),
this._camera.position = this._computeCameraPosition())
}
_translateCameraConstrained(t) {
const i = this._maxCameraBoundsDistance() * Math.cos(this._pitch)
, r = t[2];
let n = 1;
r > 0 && (n = Math.min((i - this._camera.position[2]) / r, 1)),
this._camera.position = e.scaleAndAdd([], this._camera.position, t, n),
this._updateStateFromCamera(),
this.projection.wrap && (this.center = this.center.wrap())
}
_updateStateFromCamera() {
const t = this._camera.position
, i = this._camera.forward()
, {pitch: r, bearing: n} = this._camera.getPitchBearing()
, o = e.mercatorZfromAltitude(this._centerAltitude, this.center.lat) * this._pixelsPerMercatorPixel
, s = this._mercatorZfromZoom(this._maxZoom) * Math.cos(e.degToRad(this._maxPitch))
, a = Math.max((t[2] - o) / Math.cos(r), s)
, l = this._zoomFromMercatorZ(a);
e.scaleAndAdd(t, t, i, a),
this._pitch = e.clamp(r, e.degToRad(this.minPitch), e.degToRad(this.maxPitch)),
this.angle = e.wrap(n, -Math.PI, Math.PI),
this._setZoom(e.clamp(l, this._minZoom, this._maxZoom)),
this._updateSeaLevelZoom(),
this._center = this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),
this._unmodified = !1,
this._constrain(),
this._calcMatrices()
}
_worldSizeFromZoom(e) {
return Math.pow(2, e) * this.tileSize
}
_mercatorZfromZoom(e) {
return this.cameraToCenterDistance / this._worldSizeFromZoom(e)
}
_minimumHeightOverTerrain() {
const e = Math.min((null != this._seaLevelZoom ? this._seaLevelZoom : this._zoom) + 2, this._maxZoom);
return this._mercatorZfromZoom(e)
}
_zoomFromMercatorZ(e) {
return this.scaleZoom(this.cameraToCenterDistance / (e * this.tileSize))
}
_terrainEnabled() {
return !(!this._elevation || !this.projection.supportsTerrain && (e.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),
1))
}
anyCornerOffEdge(t, i) {
const r = Math.min(t.x, i.x)
, n = Math.max(t.x, i.x)
, o = Math.min(t.y, i.y)
, s = Math.max(t.y, i.y);
if (o < this.horizonLineFromTop(!1))
return !0;
if ("mercator" !== this.projection.name)
return !1;
const a = [new e.pointGeometry(r,o), new e.pointGeometry(n,s), new e.pointGeometry(r,s), new e.pointGeometry(n,o)]
, l = this.renderWorldCopies ? -3 : 0
, c = this.renderWorldCopies ? 4 : 1;
for (const e of a) {
const t = this.pointRayIntersection(e);
if (t.t < 0)
return !0;
const i = this.rayIntersectionCoordinate(t);
if (i.x < l || i.y < 0 || i.x > c || i.y > 1)
return !0
}
return !1
}
isHorizonVisible() {
return this.pitch + e.radToDeg(this.fovAboveCenter) > 88 || this.anyCornerOffEdge(new e.pointGeometry(0,0), new e.pointGeometry(this.width,this.height))
}
zoomDeltaToMovement(t, i) {
const r = e.length(e.sub([], this._camera.position, t))
, n = this._zoomFromMercatorZ(r) + i;
return r - this._mercatorZfromZoom(n)
}
getCameraPoint() {
if ("globe" === this.projection.name) {
const t = function(t, i) {
const r = [t[0], t[1], t[2], 1];
e.transformMat4$1(r, r, i);
const n = Math.max(r[3], 1e-6);
return [r[0] / n, r[1] / n, r[2] / n, n]
}([this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]], this.pixelMatrix);
return new e.pointGeometry(t[0],t[1])
}
{
const t = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1);
return this.centerPoint.add(new e.pointGeometry(0,t))
}
}
getCameraToCenterDistance(e) {
const t = Zr(e, this.zoom, this.width, this.height, 1024)
, i = e.pixelSpaceConversion(this.center.lat, this.worldSize, t);
return .5 / Math.tan(.5 * this._fov) * this.height * i
}
}
function Kr(e, t) {
let i = !1
, r = null;
const n = ()=>{
r = null,
i && (e(),
r = setTimeout(n, t),
i = !1)
}
;
return ()=>(i = !0,
r || n(),
r)
}
class Jr {
constructor(t) {
this._hashName = t && encodeURIComponent(t),
e.bindAll(["_getCurrentHash", "_onHashChange", "_updateHash"], this),
this._updateHash = Kr(this._updateHashUnthrottled.bind(this), 300)
}
addTo(t) {
return this._map = t,
e.window.addEventListener("hashchange", this._onHashChange, !1),
t.on("moveend", this._updateHash),
this
}
remove() {
return this._map ? (this._map.off("moveend", this._updateHash),
e.window.removeEventListener("hashchange", this._onHashChange, !1),
clearTimeout(this._updateHash()),
this._map = void 0,
this) : this
}
getHashString() {
const t = this._map;
if (!t)
return "";
const i = Qr(t);
if (this._hashName) {
const t = this._hashName;
let r = !1;
const n = e.window.location.hash.slice(1).split("&").map((e=>{
const n = e.split("=")[0];
return n === t ? (r = !0,
`${n}=${i}`) : e
}
)).filter((e=>e));
return r || n.push(`${t}=${i}`),
`#${n.join("&")}`
}
return `#${i}`
}
_getCurrentHash() {
const t = e.window.location.hash.replace("#", "");
if (this._hashName) {
let e;
return t.split("&").map((e=>e.split("="))).forEach((t=>{
t[0] === this._hashName && (e = t)
}
)),
(e && e[1] || "").split("/")
}
return t.split("/")
}
_onHashChange() {
const e = this._map;
if (!e)
return !1;
const t = this._getCurrentHash();
if (t.length >= 3 && !t.some((e=>isNaN(e)))) {
const i = e.dragRotate.isEnabled() && e.touchZoomRotate.isEnabled() ? +(t[3] || 0) : e.getBearing();
return e.jumpTo({
center: [+t[2], +t[1]],
zoom: +t[0],
bearing: i,
pitch: +(t[4] || 0)
}),
!0
}
return !1
}
_updateHashUnthrottled() {
const t = e.window.location.href.replace(/(#.+)?$/, this.getHashString());
e.window.history.replaceState(e.window.history.state, null, t)
}
}
function Qr(e, t) {
const i = e.getCenter()
, r = Math.round(100 * e.getZoom()) / 100
, n = Math.ceil((r * Math.LN2 + Math.log(512 / 360 / .5)) / Math.LN10)
, o = Math.pow(10, n)
, s = Math.round(i.lng * o) / o
, a = Math.round(i.lat * o) / o
, l = e.getBearing()
, c = e.getPitch();
let u = t ? `/${s}/${a}/${r}` : `${r}/${a}/${s}`;
return (l || c) && (u += "/" + Math.round(10 * l) / 10),
c && (u += `/${Math.round(c)}`),
u
}
const en = {
linearity: .3,
easing: e.bezier(0, 0, .3, 1)
}
, tn = e.extend({
deceleration: 2500,
maxSpeed: 1400
}, en)
, rn = e.extend({
deceleration: 20,
maxSpeed: 1400
}, en)
, nn = e.extend({
deceleration: 1e3,
maxSpeed: 360
}, en)
, on = e.extend({
deceleration: 1e3,
maxSpeed: 90
}, en);
class sn {
constructor(e) {
this._map = e,
this.clear()
}
clear() {
this._inertiaBuffer = []
}
record(t) {
this._drainInertiaBuffer(),
this._inertiaBuffer.push({
time: e.exported.now(),
settings: t
})
}
_drainInertiaBuffer() {
const t = this._inertiaBuffer
, i = e.exported.now();
for (; t.length > 0 && i - t[0].time > 160; )
t.shift()
}
_onMoveEnd(t) {
if (this._drainInertiaBuffer(),
this._inertiaBuffer.length < 2)
return;
const i = {
zoom: 0,
bearing: 0,
pitch: 0,
pan: new e.pointGeometry(0,0),
pinchAround: void 0,
around: void 0
};
for (const {settings: e} of this._inertiaBuffer)
i.zoom += e.zoomDelta || 0,
i.bearing += e.bearingDelta || 0,
i.pitch += e.pitchDelta || 0,
e.panDelta && i.pan._add(e.panDelta),
e.around && (i.around = e.around),
e.pinchAround && (i.pinchAround = e.pinchAround);
const r = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time
, n = {};
if (i.pan.mag()) {
const o = ln(i.pan.mag(), r, e.extend({}, tn, t || {}));
n.offset = i.pan.mult(o.amount / i.pan.mag()),
n.center = this._map.transform.center,
an(n, o)
}
if (i.zoom) {
const e = ln(i.zoom, r, rn);
n.zoom = this._map.transform.zoom + e.amount,
an(n, e)
}
if (i.bearing) {
const t = ln(i.bearing, r, nn);
n.bearing = this._map.transform.bearing + e.clamp(t.amount, -179, 179),
an(n, t)
}
if (i.pitch) {
const e = ln(i.pitch, r, on);
n.pitch = this._map.transform.pitch + e.amount,
an(n, e)
}
if (n.zoom || n.bearing) {
const e = void 0 === i.pinchAround ? i.around : i.pinchAround;
n.around = e ? this._map.unproject(e) : this._map.getCenter()
}
return this.clear(),
n.noMoveStart = !0,
n
}
}
function an(e, t) {
(!e.duration || e.duration < t.duration) && (e.duration = t.duration,
e.easing = t.easing)
}
function ln(t, i, r) {
const {maxSpeed: n, linearity: o, deceleration: s} = r
, a = e.clamp(t * o / (i / 1e3), -n, n)
, l = Math.abs(a) / (s * o);
return {
easing: r.easing,
duration: 1e3 * l,
amount: a * (l / 2)
}
}
class cn extends e.Event {
preventDefault() {
this._defaultPrevented = !0
}
get defaultPrevented() {
return this._defaultPrevented
}
constructor(t, i, r, n={}) {
const o = f(i.getCanvasContainer(), r)
, s = i.unproject(o);
super(t, e.extend({
point: o,
lngLat: s,
originalEvent: r
}, n)),
this._defaultPrevented = !1,
this.target = i
}
}
class un extends e.Event {
preventDefault() {
this._defaultPrevented = !0
}
get defaultPrevented() {
return this._defaultPrevented
}
constructor(t, i, r) {
const n = "touchend" === t ? r.changedTouches : r.touches
, o = m(i.getCanvasContainer(), n)
, s = o.map((e=>i.unproject(e)))
, a = o.reduce(((e,t,i,r)=>e.add(t.div(r.length))), new e.pointGeometry(0,0));
super(t, {
points: o,
point: a,
lngLats: s,
lngLat: i.unproject(a),
originalEvent: r
}),
this._defaultPrevented = !1
}
}
class hn extends e.Event {
preventDefault() {
this._defaultPrevented = !0
}
get defaultPrevented() {
return this._defaultPrevented
}
constructor(e, t, i) {
super(e, {
originalEvent: i
}),
this._defaultPrevented = !1
}
}
class dn {
constructor(e, t) {
this._map = e,
this._clickTolerance = t.clickTolerance
}
reset() {
this._mousedownPos = void 0
}
wheel(e) {
return this._firePreventable(new hn(e.type,this._map,e))
}
mousedown(e, t) {
return this._mousedownPos = t,
this._firePreventable(new cn(e.type,this._map,e))
}
mouseup(e) {
this._map.fire(new cn(e.type,this._map,e))
}
preclick(t) {
const i = e.extend({}, t);
i.type = "preclick",
this._map.fire(new cn(i.type,this._map,i))
}
click(e, t) {
this._mousedownPos && this._mousedownPos.dist(t) >= this._clickTolerance || (this.preclick(e),
this._map.fire(new cn(e.type,this._map,e)))
}
dblclick(e) {
return this._firePreventable(new cn(e.type,this._map,e))
}
mouseover(e) {
this._map.fire(new cn(e.type,this._map,e))
}
mouseout(e) {
this._map.fire(new cn(e.type,this._map,e))
}
touchstart(e) {
return this._firePreventable(new un(e.type,this._map,e))
}
touchmove(e) {
this._map.fire(new un(e.type,this._map,e))
}
touchend(e) {
this._map.fire(new un(e.type,this._map,e))
}
touchcancel(e) {
this._map.fire(new un(e.type,this._map,e))
}
_firePreventable(e) {
if (this._map.fire(e),
e.defaultPrevented)
return {}
}
isEnabled() {
return !0
}
isActive() {
return !1
}
enable() {}
disable() {}
}
class pn {
constructor(e) {
this._map = e
}
reset() {
this._delayContextMenu = !1,
this._contextMenuEvent = void 0
}
mousemove(e) {
this._map.fire(new cn(e.type,this._map,e))
}
mousedown() {
this._delayContextMenu = !0
}
mouseup() {
this._delayContextMenu = !1,
this._contextMenuEvent && (this._map.fire(new cn("contextmenu",this._map,this._contextMenuEvent)),
delete this._contextMenuEvent)
}
contextmenu(e) {
this._delayContextMenu ? this._contextMenuEvent = e : this._map.fire(new cn(e.type,this._map,e)),
this._map.listens("contextmenu") && e.preventDefault()
}
isEnabled() {
return !0
}
isActive() {
return !1
}
enable() {}
disable() {}
}
class fn {
constructor(e, t) {
this._map = e,
this._el = e.getCanvasContainer(),
this._container = e.getContainer(),
this._clickTolerance = t.clickTolerance || 1
}
isEnabled() {
return !!this._enabled
}
isActive() {
return !!this._active
}
enable() {
this.isEnabled() || (this._enabled = !0)
}
disable() {
this.isEnabled() && (this._enabled = !1)
}
mousedown(e, t) {
this.isEnabled() && e.shiftKey && 0 === e.button && (u(),
this._startPos = this._lastPos = t,
this._active = !0)
}
mousemoveWindow(e, t) {
if (!this._active)
return;
const i = t;
if (this._lastPos.equals(i) || !this._box && i.dist(this._startPos) < this._clickTolerance)
return;
const r = this._startPos;
this._lastPos = i,
this._box || (this._box = o("div", "mapboxgl-boxzoom", this._container),
this._container.classList.add("mapboxgl-crosshair"),
this._fireEvent("boxzoomstart", e));
const n = Math.min(r.x, i.x)
, s = Math.max(r.x, i.x)
, a = Math.min(r.y, i.y)
, l = Math.max(r.y, i.y);
this._map._requestDomTask((()=>{
this._box && (this._box.style.transform = `translate(${n}px,${a}px)`,
this._box.style.width = s - n + "px",
this._box.style.height = l - a + "px")
}
))
}
mouseupWindow(t, i) {
if (!this._active)
return;
if (0 !== t.button)
return;
const r = this._startPos
, n = i;
if (this.reset(),
p(),
r.x !== n.x || r.y !== n.y)
return this._map.fire(new e.Event("boxzoomend",{
originalEvent: t
})),
{
cameraAnimation: e=>e.fitScreenCoordinates(r, n, this._map.getBearing(), {
linear: !1
})
};
this._fireEvent("boxzoomcancel", t)
}
keydown(e) {
this._active && 27 === e.keyCode && (this.reset(),
this._fireEvent("boxzoomcancel", e))
}
blur() {
this.reset()
}
reset() {
this._active = !1,
this._container.classList.remove("mapboxgl-crosshair"),
this._box && (this._box.remove(),
this._box = null),
h(),
delete this._startPos,
delete this._lastPos
}
_fireEvent(t, i) {
return this._map.fire(new e.Event(t,{
originalEvent: i
}))
}
}
function mn(e, t) {
const i = {};
for (let r = 0; r < e.length; r++)
i[e[r].identifier] = t[r];
return i
}
class _n {
constructor(e) {
this.reset(),
this.numTouches = e.numTouches
}
reset() {
this.centroid = void 0,
this.startTime = 0,
this.touches = {},
this.aborted = !1
}
touchstart(t, i, r) {
(this.centroid || r.length > this.numTouches) && (this.aborted = !0),
this.aborted || (0 === this.startTime && (this.startTime = t.timeStamp),
r.length === this.numTouches && (this.centroid = function(t) {
const i = new e.pointGeometry(0,0);
for (const e of t)
i._add(e);
return i.div(t.length)
}(i),
this.touches = mn(r, i)))
}
touchmove(e, t, i) {
if (this.aborted || !this.centroid)
return;
const r = mn(i, t);
for (const e in this.touches) {
const t = this.touches[e]
, i = r[e];
(!i || i.dist(t) > 30) && (this.aborted = !0)
}
}
touchend(e, t, i) {
if ((!this.centroid || e.timeStamp - this.startTime > 500) && (this.aborted = !0),
0 === i.length) {
const e = !this.aborted && this.centroid;
if (this.reset(),
e)
return e
}
}
}
class gn {
constructor(e) {
this.singleTap = new _n(e),
this.numTaps = e.numTaps,
this.reset()
}
reset() {
this.lastTime = 1 / 0,
this.lastTap = void 0,
this.count = 0,
this.singleTap.reset()
}
touchstart(e, t, i) {
this.singleTap.touchstart(e, t, i)
}
touchmove(e, t, i) {
this.singleTap.touchmove(e, t, i)
}
touchend(e, t, i) {
const r = this.singleTap.touchend(e, t, i);
if (r) {
const t = e.timeStamp - this.lastTime < 500
, i = !this.lastTap || this.lastTap.dist(r) < 30;
if (t && i || this.reset(),
this.count++,
this.lastTime = e.timeStamp,
this.lastTap = r,
this.count === this.numTaps)
return this.reset(),
r
}
}
}
class yn {
constructor() {
this._zoomIn = new gn({
numTouches: 1,
numTaps: 2
}),
this._zoomOut = new gn({
numTouches: 2,
numTaps: 1
}),
this.reset()
}
reset() {
this._active = !1,
this._zoomIn.reset(),
this._zoomOut.reset()
}
touchstart(e, t, i) {
this._zoomIn.touchstart(e, t, i),
this._zoomOut.touchstart(e, t, i)
}
touchmove(e, t, i) {
this._zoomIn.touchmove(e, t, i),
this._zoomOut.touchmove(e, t, i)
}
touchend(e, t, i) {
const r = this._zoomIn.touchend(e, t, i)
, n = this._zoomOut.touchend(e, t, i);
return r ? (this._active = !0,
e.preventDefault(),
setTimeout((()=>this.reset()), 0),
{
cameraAnimation: t=>t.easeTo({
duration: 300,
zoom: t.getZoom() + 1,
around: t.unproject(r)
}, {
originalEvent: e
})
}) : n ? (this._active = !0,
e.preventDefault(),
setTimeout((()=>this.reset()), 0),
{
cameraAnimation: t=>t.easeTo({
duration: 300,
zoom: t.getZoom() - 1,
around: t.unproject(n)
}, {
originalEvent: e
})
}) : void 0
}
touchcancel() {
this.reset()
}
enable() {
this._enabled = !0
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
}
const xn = {
0: 1,
2: 2
};
class vn {
constructor(e) {
this.reset(),
this._clickTolerance = e.clickTolerance || 1
}
blur() {
this.reset()
}
reset() {
this._active = !1,
this._moved = !1,
this._lastPoint = void 0,
this._eventButton = void 0
}
_correctButton(e, t) {
return !1
}
_move(e, t) {
return {}
}
mousedown(e, t) {
if (this._lastPoint)
return;
const i = _(e);
this._correctButton(e, i) && (this._lastPoint = t,
this._eventButton = i)
}
mousemoveWindow(e, t) {
const i = this._lastPoint;
if (i)
if (e.preventDefault(),
null != this._eventButton && function(e, t) {
const i = xn[t];
return void 0 === e.buttons || (e.buttons & i) !== i
}(e, this._eventButton))
this.reset();
else if (this._moved || !(t.dist(i) < this._clickTolerance))
return this._moved = !0,
this._lastPoint = t,
this._move(i, t)
}
mouseupWindow(e) {
this._lastPoint && _(e) === this._eventButton && (this._moved && p(),
this.reset())
}
enable() {
this._enabled = !0
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
}
class bn extends vn {
mousedown(e, t) {
super.mousedown(e, t),
this._lastPoint && (this._active = !0)
}
_correctButton(e, t) {
return 0 === t && !e.ctrlKey
}
_move(e, t) {
return {
around: t,
panDelta: t.sub(e)
}
}
}
class wn extends vn {
_correctButton(e, t) {
return 0 === t && e.ctrlKey || 2 === t
}
_move(e, t) {
const i = .8 * (t.x - e.x);
if (i)
return this._active = !0,
{
bearingDelta: i
}
}
contextmenu(e) {
e.preventDefault()
}
}
class Tn extends vn {
_correctButton(e, t) {
return 0 === t && e.ctrlKey || 2 === t
}
_move(e, t) {
const i = -.5 * (t.y - e.y);
if (i)
return this._active = !0,
{
pitchDelta: i
}
}
contextmenu(e) {
e.preventDefault()
}
}
class En {
constructor(t, i) {
this._map = t,
this._el = t.getCanvasContainer(),
this._minTouches = 1,
this._clickTolerance = i.clickTolerance || 1,
this.reset(),
e.bindAll(["_addTouchPanBlocker", "_showTouchPanBlockerAlert"], this)
}
reset() {
this._active = !1,
this._touches = {},
this._sum = new e.pointGeometry(0,0)
}
touchstart(e, t, i) {
return this._calculateTransform(e, t, i)
}
touchmove(t, i, r) {
if (this._active && !(r.length < this._minTouches)) {
if (this._map._cooperativeGestures && !this._map.isMoving()) {
if (1 === r.length && !e.isFullscreen())
return void this._showTouchPanBlockerAlert();
"hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden",
clearTimeout(this._alertTimer))
}
return t.cancelable && t.preventDefault(),
this._calculateTransform(t, i, r)
}
}
touchend(e, t, i) {
this._calculateTransform(e, t, i),
this._active && i.length < this._minTouches && this.reset()
}
touchcancel() {
this.reset()
}
_calculateTransform(t, i, r) {
r.length > 0 && (this._active = !0);
const n = mn(r, i)
, o = new e.pointGeometry(0,0)
, s = new e.pointGeometry(0,0);
let a = 0;
for (const e in n) {
const t = n[e]
, i = this._touches[e];
i && (o._add(t),
s._add(t.sub(i)),
a++,
n[e] = t)
}
if (this._touches = n,
a < this._minTouches || !s.mag())
return;
const l = s.div(a);
return this._sum._add(l),
this._sum.mag() < this._clickTolerance ? void 0 : {
around: o.div(a),
panDelta: l
}
}
enable() {
this._enabled = !0,
this._map._cooperativeGestures && (this._addTouchPanBlocker(),
this._el.classList.add("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page"))
}
disable() {
this._enabled = !1,
this._map._cooperativeGestures && (clearTimeout(this._alertTimer),
this._alertContainer.remove(),
this._el.classList.remove("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page")),
this.reset()
}
isEnabled() {
return !!this._enabled
}
isActive() {
return !!this._active
}
_addTouchPanBlocker() {
this._map && !this._alertContainer && (this._alertContainer = o("div", "mapboxgl-touch-pan-blocker", this._map._container),
this._alertContainer.textContent = this._map._getUIString("TouchPanBlocker.Message"),
this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth)))}px`)
}
_showTouchPanBlockerAlert() {
this._alertContainer.style.visibility = "visible",
this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),
this._alertContainer.setAttribute("role", "alert"),
clearTimeout(this._alertTimer),
this._alertTimer = setTimeout((()=>{
this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),
this._alertContainer.setAttribute("role", "null")
}
), 500)
}
}
class Sn {
constructor() {
this.reset()
}
reset() {
this._active = !1,
this._firstTwoTouches = void 0
}
_start(e) {}
_move(e, t, i) {
return {}
}
touchstart(e, t, i) {
this._firstTwoTouches || i.length < 2 || (this._firstTwoTouches = [i[0].identifier, i[1].identifier],
this._start([t[0], t[1]]))
}
touchmove(e, t, i) {
const r = this._firstTwoTouches;
if (!r)
return;
e.preventDefault();
const [n,o] = r
, s = Cn(i, t, n)
, a = Cn(i, t, o);
if (!s || !a)
return;
const l = this._aroundCenter ? null : s.add(a).div(2);
return this._move([s, a], l, e)
}
touchend(e, t, i) {
if (!this._firstTwoTouches)
return;
const [r,n] = this._firstTwoTouches
, o = Cn(i, t, r)
, s = Cn(i, t, n);
o && s || (this._active && p(),
this.reset())
}
touchcancel() {
this.reset()
}
enable(e) {
this._enabled = !0,
this._aroundCenter = !!e && "center" === e.around
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
}
function Cn(e, t, i) {
for (let r = 0; r < e.length; r++)
if (e[r].identifier === i)
return t[r]
}
function Mn(e, t) {
return Math.log(e / t) / Math.LN2
}
class An extends Sn {
reset() {
super.reset(),
this._distance = 0,
this._startDistance = 0
}
_start(e) {
this._startDistance = this._distance = e[0].dist(e[1])
}
_move(e, t) {
const i = this._distance;
if (this._distance = e[0].dist(e[1]),
this._active || !(Math.abs(Mn(this._distance, this._startDistance)) < .1))
return this._active = !0,
{
zoomDelta: Mn(this._distance, i),
pinchAround: t
}
}
}
function In(e, t) {
return 180 * e.angleWith(t) / Math.PI
}
class zn extends Sn {
reset() {
super.reset(),
this._minDiameter = 0,
this._startVector = void 0,
this._vector = void 0
}
_start(e) {
this._startVector = this._vector = e[0].sub(e[1]),
this._minDiameter = e[0].dist(e[1])
}
_move(e, t) {
const i = this._vector;
if (this._vector = e[0].sub(e[1]),
this._active || !this._isBelowThreshold(this._vector))
return this._active = !0,
{
bearingDelta: In(this._vector, i),
pinchAround: t
}
}
_isBelowThreshold(e) {
this._minDiameter = Math.min(this._minDiameter, e.mag());
const t = 25 / (Math.PI * this._minDiameter) * 360
, i = In(e, this._startVector);
return Math.abs(i) < t
}
}
function kn(e) {
return Math.abs(e.y) > Math.abs(e.x)
}
class Pn extends Sn {
constructor(e) {
super(),
this._map = e
}
reset() {
super.reset(),
this._valid = void 0,
this._firstMove = void 0,
this._lastPoints = void 0
}
_start(e) {
this._lastPoints = e,
kn(e[0].sub(e[1])) && (this._valid = !1)
}
_move(e, t, i) {
const r = this._lastPoints;
if (!r)
return;
const n = e[0].sub(r[0])
, o = e[1].sub(r[1]);
return this._map._cooperativeGestures && i.touches.length < 3 || (this._valid = this.gestureBeginsVertically(n, o, i.timeStamp),
!this._valid) ? void 0 : (this._lastPoints = e,
this._active = !0,
{
pitchDelta: (n.y + o.y) / 2 * -.5
})
}
gestureBeginsVertically(e, t, i) {
if (void 0 !== this._valid)
return this._valid;
const r = e.mag() >= 2
, n = t.mag() >= 2;
if (!r && !n)
return;
if (!r || !n)
return null == this._firstMove && (this._firstMove = i),
i - this._firstMove < 100 && void 0;
const o = e.y > 0 == t.y > 0;
return kn(e) && kn(t) && o
}
}
const Dn = {
panStep: 100,
bearingStep: 15,
pitchStep: 10
};
class Ln {
constructor() {
const e = Dn;
this._panStep = e.panStep,
this._bearingStep = e.bearingStep,
this._pitchStep = e.pitchStep,
this._rotationDisabled = !1
}
blur() {
this.reset()
}
reset() {
this._active = !1
}
keydown(e) {
if (e.altKey || e.ctrlKey || e.metaKey)
return;
let t = 0
, i = 0
, r = 0
, n = 0
, o = 0;
switch (e.keyCode) {
case 61:
case 107:
case 171:
case 187:
t = 1;
break;
case 189:
case 109:
case 173:
t = -1;
break;
case 37:
e.shiftKey ? i = -1 : (e.preventDefault(),
n = -1);
break;
case 39:
e.shiftKey ? i = 1 : (e.preventDefault(),
n = 1);
break;
case 38:
e.shiftKey ? r = 1 : (e.preventDefault(),
o = -1);
break;
case 40:
e.shiftKey ? r = -1 : (e.preventDefault(),
o = 1);
break;
default:
return
}
return this._rotationDisabled && (i = 0,
r = 0),
{
cameraAnimation: s=>{
const a = s.getZoom();
s.easeTo({
duration: 300,
easeId: "keyboardHandler",
easing: Bn,
zoom: t ? Math.round(a) + t * (e.shiftKey ? 2 : 1) : a,
bearing: s.getBearing() + i * this._bearingStep,
pitch: s.getPitch() + r * this._pitchStep,
offset: [-n * this._panStep, -o * this._panStep],
center: s.getCenter()
}, {
originalEvent: e
})
}
}
}
enable() {
this._enabled = !0
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
disableRotation() {
this._rotationDisabled = !0
}
enableRotation() {
this._rotationDisabled = !1
}
}
function Bn(e) {
return e * (2 - e)
}
const On = 4.000244140625;
class Rn {
constructor(t, i) {
this._map = t,
this._el = t.getCanvasContainer(),
this._handler = i,
this._delta = 0,
this._defaultZoomRate = .01,
this._wheelZoomRate = .0022222222222222222,
e.bindAll(["_onTimeout", "_addScrollZoomBlocker", "_showBlockerAlert"], this)
}
setZoomRate(e) {
this._defaultZoomRate = e
}
setWheelZoomRate(e) {
this._wheelZoomRate = e
}
isEnabled() {
return !!this._enabled
}
isActive() {
return this._active || void 0 !== this._finishTimeout
}
isZooming() {
return !!this._zooming
}
enable(e) {
this.isEnabled() || (this._enabled = !0,
this._aroundCenter = !!e && "center" === e.around,
this._map._cooperativeGestures && this._addScrollZoomBlocker())
}
disable() {
this.isEnabled() && (this._enabled = !1,
this._map._cooperativeGestures && (clearTimeout(this._alertTimer),
this._alertContainer.remove()))
}
wheel(t) {
if (!this.isEnabled())
return;
if (this._map._cooperativeGestures) {
if (!(t.ctrlKey || t.metaKey || this.isZooming() || e.isFullscreen()))
return void this._showBlockerAlert();
"hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden",
clearTimeout(this._alertTimer))
}
let i = t.deltaMode === e.window.WheelEvent.DOM_DELTA_LINE ? 40 * t.deltaY : t.deltaY;
const r = e.exported.now()
, n = r - (this._lastWheelEventTime || 0);
this._lastWheelEventTime = r,
0 !== i && i % On == 0 ? this._type = "wheel" : 0 !== i && Math.abs(i) < 4 ? this._type = "trackpad" : n > 400 ? (this._type = null,
this._lastValue = i,
this._timeout = setTimeout(this._onTimeout, 40, t)) : this._type || (this._type = Math.abs(n * i) < 200 ? "trackpad" : "wheel",
this._timeout && (clearTimeout(this._timeout),
this._timeout = null,
i += this._lastValue)),
t.shiftKey && i && (i /= 4),
this._type && (this._lastWheelEvent = t,
this._delta -= i,
this._active || this._start(t)),
t.preventDefault()
}
_onTimeout(e) {
this._type = "wheel",
this._delta -= this._lastValue,
this._active || this._start(e)
}
_start(e) {
if (!this._delta)
return;
this._frameId && (this._frameId = null),
this._active = !0,
this.isZooming() || (this._zooming = !0),
this._finishTimeout && (clearTimeout(this._finishTimeout),
delete this._finishTimeout);
const t = f(this._el, e);
this._aroundPoint = this._aroundCenter ? this._map.transform.centerPoint : t,
this._aroundCoord = this._map.transform.pointCoordinate3D(this._aroundPoint),
this._targetZoom = void 0,
this._frameId || (this._frameId = !0,
this._handler._triggerRenderFrame())
}
renderFrame() {
if (!this._frameId)
return;
if (this._frameId = null,
!this.isActive())
return;
const t = this._map.transform
, i = ()=>t._terrainEnabled() && this._aroundCoord ? t.computeZoomRelativeTo(this._aroundCoord) : t.zoom;
if (0 !== this._delta) {
const e = "wheel" === this._type && Math.abs(this._delta) > On ? this._wheelZoomRate : this._defaultZoomRate;
let r = 2 / (1 + Math.exp(-Math.abs(this._delta * e)));
this._delta < 0 && 0 !== r && (r = 1 / r);
const n = i()
, o = Math.pow(2, n)
, s = "number" == typeof this._targetZoom ? t.zoomScale(this._targetZoom) : o;
this._targetZoom = Math.min(t.maxZoom, Math.max(t.minZoom, t.scaleZoom(s * r))),
"wheel" === this._type && (this._startZoom = n,
this._easing = this._smoothOutEasing(200)),
this._delta = 0
}
const r = "number" == typeof this._targetZoom ? this._targetZoom : i()
, n = this._startZoom
, o = this._easing;
let s, a = !1;
if ("wheel" === this._type && n && o) {
const t = Math.min((e.exported.now() - this._lastWheelEventTime) / 200, 1)
, i = o(t);
s = e.number(n, r, i),
t < 1 ? this._frameId || (this._frameId = !0) : a = !0
} else
s = r,
a = !0;
return this._active = !0,
a && (this._active = !1,
this._finishTimeout = setTimeout((()=>{
this._zooming = !1,
this._handler._triggerRenderFrame(),
delete this._targetZoom,
delete this._finishTimeout
}
), 200)),
{
noInertia: !0,
needsRenderFrame: !a,
zoomDelta: s - i(),
around: this._aroundPoint,
aroundCoord: this._aroundCoord,
originalEvent: this._lastWheelEvent
}
}
_smoothOutEasing(t) {
let i = e.ease;
if (this._prevEase) {
const t = this._prevEase
, r = (e.exported.now() - t.start) / t.duration
, n = t.easing(r + .01) - t.easing(r)
, o = .27 / Math.sqrt(n * n + 1e-4) * .01
, s = Math.sqrt(.0729 - o * o);
i = e.bezier(o, s, .25, 1)
}
return this._prevEase = {
start: e.exported.now(),
duration: t,
easing: i
},
i
}
blur() {
this.reset()
}
reset() {
this._active = !1
}
_addScrollZoomBlocker() {
this._map && !this._alertContainer && (this._alertContainer = o("div", "mapboxgl-scroll-zoom-blocker", this._map._container),
this._alertContainer.textContent = /(Mac|iPad)/i.test(e.window.navigator.userAgent) ? this._map._getUIString("ScrollZoomBlocker.CmdMessage") : this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),
this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth)))}px`)
}
_showBlockerAlert() {
this._alertContainer.style.visibility = "visible",
this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),
this._alertContainer.setAttribute("role", "alert"),
clearTimeout(this._alertTimer),
this._alertTimer = setTimeout((()=>{
this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),
this._alertContainer.setAttribute("role", "null")
}
), 200)
}
}
class Fn {
constructor(e, t) {
this._clickZoom = e,
this._tapZoom = t
}
enable() {
this._clickZoom.enable(),
this._tapZoom.enable()
}
disable() {
this._clickZoom.disable(),
this._tapZoom.disable()
}
isEnabled() {
return this._clickZoom.isEnabled() && this._tapZoom.isEnabled()
}
isActive() {
return this._clickZoom.isActive() || this._tapZoom.isActive()
}
}
class Un {
constructor() {
this.reset()
}
reset() {
this._active = !1
}
blur() {
this.reset()
}
dblclick(e, t) {
return e.preventDefault(),
{
cameraAnimation: i=>{
i.easeTo({
duration: 300,
zoom: i.getZoom() + (e.shiftKey ? -1 : 1),
around: i.unproject(t)
}, {
originalEvent: e
})
}
}
}
enable() {
this._enabled = !0
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
}
class Vn {
constructor() {
this._tap = new gn({
numTouches: 1,
numTaps: 1
}),
this.reset()
}
reset() {
this._active = !1,
this._swipePoint = void 0,
this._swipeTouch = 0,
this._tapTime = 0,
this._tap.reset()
}
touchstart(e, t, i) {
this._swipePoint || (this._tapTime && e.timeStamp - this._tapTime > 500 && this.reset(),
this._tapTime ? i.length > 0 && (this._swipePoint = t[0],
this._swipeTouch = i[0].identifier) : this._tap.touchstart(e, t, i))
}
touchmove(e, t, i) {
if (this._tapTime) {
if (this._swipePoint) {
if (i[0].identifier !== this._swipeTouch)
return;
const r = t[0]
, n = r.y - this._swipePoint.y;
return this._swipePoint = r,
e.preventDefault(),
this._active = !0,
{
zoomDelta: n / 128
}
}
} else
this._tap.touchmove(e, t, i)
}
touchend(e, t, i) {
this._tapTime ? this._swipePoint && 0 === i.length && this.reset() : this._tap.touchend(e, t, i) && (this._tapTime = e.timeStamp)
}
touchcancel() {
this.reset()
}
enable() {
this._enabled = !0
}
disable() {
this._enabled = !1,
this.reset()
}
isEnabled() {
return this._enabled
}
isActive() {
return this._active
}
}
class jn {
constructor(e, t, i) {
this._el = e,
this._mousePan = t,
this._touchPan = i
}
enable(e) {
this._inertiaOptions = e || {},
this._mousePan.enable(),
this._touchPan.enable(),
this._el.classList.add("mapboxgl-touch-drag-pan")
}
disable() {
this._mousePan.disable(),
this._touchPan.disable(),
this._el.classList.remove("mapboxgl-touch-drag-pan")
}
isEnabled() {
return this._mousePan.isEnabled() && this._touchPan.isEnabled()
}
isActive() {
return this._mousePan.isActive() || this._touchPan.isActive()
}
}
class Nn {
constructor(e, t, i) {
this._pitchWithRotate = e.pitchWithRotate,
this._mouseRotate = t,
this._mousePitch = i
}
enable() {
this._mouseRotate.enable(),
this._pitchWithRotate && this._mousePitch.enable()
}
disable() {
this._mouseRotate.disable(),
this._mousePitch.disable()
}
isEnabled() {
return this._mouseRotate.isEnabled() && (!this._pitchWithRotate || this._mousePitch.isEnabled())
}
isActive() {
return this._mouseRotate.isActive() || this._mousePitch.isActive()
}
}
class Gn {
constructor(e, t, i, r) {
this._el = e,
this._touchZoom = t,
this._touchRotate = i,
this._tapDragZoom = r,
this._rotationDisabled = !1,
this._enabled = !0
}
enable(e) {
this._touchZoom.enable(e),
this._rotationDisabled || this._touchRotate.enable(e),
this._tapDragZoom.enable(),
this._el.classList.add("mapboxgl-touch-zoom-rotate")
}
disable() {
this._touchZoom.disable(),
this._touchRotate.disable(),
this._tapDragZoom.disable(),
this._el.classList.remove("mapboxgl-touch-zoom-rotate")
}
isEnabled() {
return this._touchZoom.isEnabled() && (this._rotationDisabled || this._touchRotate.isEnabled()) && this._tapDragZoom.isEnabled()
}
isActive() {
return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive()
}
disableRotation() {
this._rotationDisabled = !0,
this._touchRotate.disable()
}
enableRotation() {
this._rotationDisabled = !1,
this._touchZoom.isEnabled() && this._touchRotate.enable()
}
}
const $n = e=>e.zoom || e.drag || e.pitch || e.rotate;
class qn extends e.Event {
}
class Zn {
constructor() {
this.constants = [1, 1, .01],
this.radius = 0
}
setup(t, i) {
const r = e.sub([], i, t);
this.radius = e.length(r[2] < 0 ? e.div([], r, this.constants) : [r[0], r[1], 0])
}
projectRay(t) {
e.div(t, t, this.constants),
e.normalize(t, t),
e.mul$1(t, t, this.constants);
const i = e.scale$2([], t, this.radius);
if (i[2] > 0) {
const t = e.scale$2([], [0, 0, 1], e.dot(i, [0, 0, 1]))
, r = e.scale$2([], e.normalize([], [i[0], i[1], 0]), this.radius)
, n = e.add([], i, e.scale$2([], e.sub([], e.add([], r, t), i), 2));
i[0] = n[0],
i[1] = n[1]
}
return i
}
}
function Wn(e) {
return e.panDelta && e.panDelta.mag() || e.zoomDelta || e.bearingDelta || e.pitchDelta
}
class Xn {
constructor(t, i) {
this._map = t,
this._el = this._map.getCanvasContainer(),
this._handlers = [],
this._handlersById = {},
this._changes = [],
this._inertia = new sn(t),
this._bearingSnap = i.bearingSnap,
this._previousActiveHandlers = {},
this._trackingEllipsoid = new Zn,
this._dragOrigin = null,
this._eventsInProgress = {},
this._addDefaultHandlers(i),
e.bindAll(["handleEvent", "handleWindowEvent"], this);
const r = this._el;
this._listeners = [[r, "touchstart", {
passive: !0
}], [r, "touchmove", {
passive: !1
}], [r, "touchend", void 0], [r, "touchcancel", void 0], [r, "mousedown", void 0], [r, "mousemove", void 0], [r, "mouseup", void 0], [e.window.document, "mousemove", {
capture: !0
}], [e.window.document, "mouseup", void 0], [r, "mouseover", void 0], [r, "mouseout", void 0], [r, "dblclick", void 0], [r, "click", void 0], [r, "keydown", {
capture: !1
}], [r, "keyup", void 0], [r, "wheel", {
passive: !1
}], [r, "contextmenu", void 0], [e.window, "blur", void 0]];
for (const [t,i,r] of this._listeners)
t.addEventListener(i, t === e.window.document ? this.handleWindowEvent : this.handleEvent, r)
}
destroy() {
for (const [t,i,r] of this._listeners)
t.removeEventListener(i, t === e.window.document ? this.handleWindowEvent : this.handleEvent, r)
}
_addDefaultHandlers(e) {
const t = this._map
, i = t.getCanvasContainer();
this._add("mapEvent", new dn(t,e));
const r = t.boxZoom = new fn(t,e);
this._add("boxZoom", r);
const n = new yn
, o = new Un;
t.doubleClickZoom = new Fn(o,n),
this._add("tapZoom", n),
this._add("clickZoom", o);
const s = new Vn;
this._add("tapDragZoom", s);
const a = t.touchPitch = new Pn(t);
this._add("touchPitch", a);
const l = new wn(e)
, c = new Tn(e);
t.dragRotate = new Nn(e,l,c),
this._add("mouseRotate", l, ["mousePitch"]),
this._add("mousePitch", c, ["mouseRotate"]);
const u = new bn(e)
, h = new En(t,e);
t.dragPan = new jn(i,u,h),
this._add("mousePan", u),
this._add("touchPan", h, ["touchZoom", "touchRotate"]);
const d = new zn
, p = new An;
t.touchZoomRotate = new Gn(i,p,d,s),
this._add("touchRotate", d, ["touchPan", "touchZoom"]),
this._add("touchZoom", p, ["touchPan", "touchRotate"]),
this._add("blockableMapEvent", new pn(t));
const f = t.scrollZoom = new Rn(t,this);
this._add("scrollZoom", f, ["mousePan"]);
const m = t.keyboard = new Ln;
this._add("keyboard", m);
for (const i of ["boxZoom", "doubleClickZoom", "tapDragZoom", "touchPitch", "dragRotate", "dragPan", "touchZoomRotate", "scrollZoom", "keyboard"])
e.interactive && e[i] && t[i].enable(e[i])
}
_add(e, t, i) {
this._handlers.push({
handlerName: e,
handler: t,
allowed: i
}),
this._handlersById[e] = t
}
stop(e) {
if (!this._updatingCamera) {
for (const {handler: e} of this._handlers)
e.reset();
this._inertia.clear(),
this._fireEvents({}, {}, e),
this._changes = []
}
}
isActive() {
for (const {handler: e} of this._handlers)
if (e.isActive())
return !0;
return !1
}
isZooming() {
return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming()
}
isRotating() {
return !!this._eventsInProgress.rotate
}
isMoving() {
return !!$n(this._eventsInProgress) || this.isZooming()
}
_blockedByActive(e, t, i) {
for (const r in e)
if (r !== i && (!t || t.indexOf(r) < 0))
return !0;
return !1
}
handleWindowEvent(e) {
this.handleEvent(e, `${e.type}Window`)
}
_getMapTouches(e) {
const t = [];
for (const i of e)
this._el.contains(i.target) && t.push(i);
return t
}
handleEvent(e, t) {
this._updatingCamera = !0;
const i = "renderFrame" === e.type
, r = i ? void 0 : e
, n = {
needsRenderFrame: !1
}
, o = {}
, s = {}
, a = e.touches ? this._getMapTouches(e.touches) : void 0
, l = a ? m(this._el, a) : i ? void 0 : f(this._el, e);
for (const {handlerName: i, handler: c, allowed: u} of this._handlers) {
if (!c.isEnabled())
continue;
let h;
this._blockedByActive(s, u, i) ? c.reset() : c[t || e.type] && (h = c[t || e.type](e, l, a),
this.mergeHandlerResult(n, o, h, i, r),
h && h.needsRenderFrame && this._triggerRenderFrame()),
(h || c.isActive()) && (s[i] = c)
}
const c = {};
for (const e in this._previousActiveHandlers)
s[e] || (c[e] = r);
this._previousActiveHandlers = s,
(Object.keys(c).length || Wn(n)) && (this._changes.push([n, o, c]),
this._triggerRenderFrame()),
(Object.keys(s).length || Wn(n)) && this._map._stop(!0),
this._updatingCamera = !1;
const {cameraAnimation: u} = n;
u && (this._inertia.clear(),
this._fireEvents({}, {}, !0),
this._changes = [],
u(this._map))
}
mergeHandlerResult(t, i, r, n, o) {
if (!r)
return;
e.extend(t, r);
const s = {
handlerName: n,
originalEvent: r.originalEvent || o
};
void 0 !== r.zoomDelta && (i.zoom = s),
void 0 !== r.panDelta && (i.drag = s),
void 0 !== r.pitchDelta && (i.pitch = s),
void 0 !== r.bearingDelta && (i.rotate = s)
}
_applyChanges() {
const t = {}
, i = {}
, r = {};
for (const [n,o,s] of this._changes)
n.panDelta && (t.panDelta = (t.panDelta || new e.pointGeometry(0,0))._add(n.panDelta)),
n.zoomDelta && (t.zoomDelta = (t.zoomDelta || 0) + n.zoomDelta),
n.bearingDelta && (t.bearingDelta = (t.bearingDelta || 0) + n.bearingDelta),
n.pitchDelta && (t.pitchDelta = (t.pitchDelta || 0) + n.pitchDelta),
void 0 !== n.around && (t.around = n.around),
void 0 !== n.aroundCoord && (t.aroundCoord = n.aroundCoord),
void 0 !== n.pinchAround && (t.pinchAround = n.pinchAround),
n.noInertia && (t.noInertia = n.noInertia),
e.extend(i, o),
e.extend(r, s);
this._updateMapTransform(t, i, r),
this._changes = []
}
_updateMapTransform(t, i, r) {
const n = this._map
, o = n.transform
, s = e=>[e.x, e.y, e.z];
if ((e=>{
const t = this._eventsInProgress.drag;
return t && !this._handlersById[t.handlerName].isActive()
}
)() && !Wn(t)) {
const e = o.zoom;
o.cameraElevationReference = "sea",
o.recenterOnTerrain(),
o.cameraElevationReference = "ground",
e !== o.zoom && this._map._update(!0)
}
if (!Wn(t))
return void this._fireEvents(i, r, !0);
let {panDelta: a, zoomDelta: l, bearingDelta: c, pitchDelta: u, around: h, aroundCoord: d, pinchAround: p} = t;
void 0 !== p && (h = p),
(e=>i.drag && !this._eventsInProgress.drag)() && h && (this._dragOrigin = s(o.pointCoordinate3D(h)),
this._trackingEllipsoid.setup(o._camera.position, this._dragOrigin)),
o.cameraElevationReference = "sea",
n._stop(!0),
h = h || n.transform.centerPoint,
c && (o.bearing += c),
u && (o.pitch += u),
o._updateCameraState();
const f = [0, 0, 0];
if (a)
if ("mercator" === o.projection.name) {
const e = this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir)
, t = this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);
f[0] = t[0] - e[0],
f[1] = t[1] - e[1]
} else {
const t = o.pointCoordinate(h);
if ("globe" === o.projection.name) {
a = a.rotate(-o.angle);
const i = o._pixelsPerMercatorPixel / o.worldSize;
f[0] = -a.x * e.mercatorScale(e.latFromMercatorY(t.y)) * i,
f[1] = -a.y * e.mercatorScale(o.center.lat) * i
} else {
const e = o.pointCoordinate(h.sub(a));
t && e && (f[0] = e.x - t.x,
f[1] = e.y - t.y)
}
}
const m = o.zoom
, _ = [0, 0, 0];
if (l) {
const t = s(d || o.pointCoordinate3D(h))
, i = {
dir: e.normalize([], e.sub([], t, o._camera.position))
};
if (i.dir[2] < 0) {
const r = o.zoomDeltaToMovement(t, l);
e.scale$2(_, i.dir, r)
}
}
const g = e.add(f, f, _);
o._translateCameraConstrained(g),
l && Math.abs(o.zoom - m) > 1e-4 && o.recenterOnTerrain(),
o.cameraElevationReference = "ground",
this._map._update(),
t.noInertia || this._inertia.record(t),
this._fireEvents(i, r, !0)
}
_fireEvents(t, i, r) {
const n = $n(this._eventsInProgress)
, o = $n(t)
, s = {};
for (const e in t) {
const {originalEvent: i} = t[e];
this._eventsInProgress[e] || (s[`${e}start`] = i),
this._eventsInProgress[e] = t[e]
}
!n && o && this._fireEvent("movestart", o.originalEvent);
for (const e in s)
this._fireEvent(e, s[e]);
o && this._fireEvent("move", o.originalEvent);
for (const e in t) {
const {originalEvent: i} = t[e];
this._fireEvent(e, i)
}
const a = {};
let l;
for (const e in this._eventsInProgress) {
const {handlerName: t, originalEvent: r} = this._eventsInProgress[e];
this._handlersById[t].isActive() || (delete this._eventsInProgress[e],
l = i[t] || r,
a[`${e}end`] = l)
}
for (const e in a)
this._fireEvent(e, a[e]);
const c = $n(this._eventsInProgress);
if (r && (n || o) && !c) {
this._updatingCamera = !0;
const t = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions)
, i = e=>0 !== e && -this._bearingSnap < e && e < this._bearingSnap;
t ? (i(t.bearing || this._map.getBearing()) && (t.bearing = 0),
this._map.easeTo(t, {
originalEvent: l
})) : (this._map.fire(new e.Event("moveend",{
originalEvent: l
})),
i(this._map.getBearing()) && this._map.resetNorth()),
this._updatingCamera = !1
}
}
_fireEvent(t, i) {
this._map.fire(new e.Event(t,i ? {
originalEvent: i
} : {}))
}
_requestFrame() {
return this._map.triggerRepaint(),
this._map._renderTaskQueue.add((e=>{
this._frameId = void 0,
this.handleEvent(new qn("renderFrame",{
timeStamp: e
})),
this._applyChanges()
}
))
}
_triggerRenderFrame() {
void 0 === this._frameId && (this._frameId = this._requestFrame())
}
}
const Hn = "map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";
class Yn extends e.Evented {
constructor(t, i) {
super(),
this._moving = !1,
this._zooming = !1,
this.transform = t,
this._bearingSnap = i.bearingSnap,
e.bindAll(["_renderFrameCallback"], this)
}
getCenter() {
return new e.LngLat(this.transform.center.lng,this.transform.center.lat)
}
setCenter(e, t) {
return this.jumpTo({
center: e
}, t)
}
panBy(t, i, r) {
return t = e.pointGeometry.convert(t).mult(-1),
this.panTo(this.transform.center, e.extend({
offset: t
}, i), r)
}
panTo(t, i, r) {
return this.easeTo(e.extend({
center: t
}, i), r)
}
getZoom() {
return this.transform.zoom
}
setZoom(e, t) {
return this.jumpTo({
zoom: e
}, t),
this
}
zoomTo(t, i, r) {
return this.easeTo(e.extend({
zoom: t
}, i), r)
}
zoomIn(e, t) {
return this.zoomTo(this.getZoom() + 1, e, t),
this
}
zoomOut(e, t) {
return this.zoomTo(this.getZoom() - 1, e, t),
this
}
getBearing() {
return this.transform.bearing
}
setBearing(e, t) {
return this.jumpTo({
bearing: e
}, t),
this
}
getPadding() {
return this.transform.padding
}
setPadding(e, t) {
return this.jumpTo({
padding: e
}, t),
this
}
rotateTo(t, i, r) {
return this.easeTo(e.extend({
bearing: t
}, i), r)
}
resetNorth(t, i) {
return this.rotateTo(0, e.extend({
duration: 1e3
}, t), i),
this
}
resetNorthPitch(t, i) {
return this.easeTo(e.extend({
bearing: 0,
pitch: 0,
duration: 1e3
}, t), i),
this
}
snapToNorth(e, t) {
return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(e, t) : this
}
getPitch() {
return this.transform.pitch
}
setPitch(e, t) {
return this.jumpTo({
pitch: e
}, t),
this
}
cameraForBounds(t, i) {
"globe" === this.transform.projection.name && e.warnOnce('Globe projection does not support cameraForBounds API, this API may behave unexpectedly."'),
t = e.LngLatBounds.convert(t);
const r = i && i.bearing || 0;
return this._cameraForBoxAndBearing(t.getNorthWest(), t.getSouthEast(), r, i)
}
_extendCameraOptions(t) {
const i = {
top: 0,
bottom: 0,
right: 0,
left: 0
};
if ("number" == typeof (t = e.extend({
padding: i,
offset: [0, 0],
maxZoom: this.transform.maxZoom
}, t)).padding) {
const e = t.padding;
t.padding = {
top: e,
bottom: e,
right: e,
left: e
}
}
return t.padding = e.extend(i, t.padding),
t
}
_cameraForBoxAndBearing(t, i, r, n) {
const o = this._extendCameraOptions(n)
, s = this.transform
, a = s.padding
, l = s.project(e.LngLat.convert(t))
, c = s.project(e.LngLat.convert(i))
, u = new e.pointGeometry(l.x,c.y)
, h = new e.pointGeometry(c.x,l.y)
, d = -e.degToRad(r)
, p = l.rotate(d)
, f = c.rotate(d)
, m = u.rotate(d)
, _ = h.rotate(d)
, g = new e.pointGeometry(Math.max(p.x, f.x, m.x, _.x),Math.max(p.y, f.y, m.y, _.y))
, y = new e.pointGeometry(Math.min(p.x, f.x, m.x, _.x),Math.min(p.y, f.y, m.y, _.y))
, x = g.sub(y)
, v = (s.width - ((a.left || 0) + (a.right || 0) + o.padding.left + o.padding.right)) / x.x
, b = (s.height - ((a.top || 0) + (a.bottom || 0) + o.padding.top + o.padding.bottom)) / x.y;
if (b < 0 || v < 0)
return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
const w = Math.min(s.scaleZoom(s.scale * Math.min(v, b)), o.maxZoom)
, T = "number" == typeof o.offset.x && "number" == typeof o.offset.y ? new e.pointGeometry(o.offset.x,o.offset.y) : e.pointGeometry.convert(o.offset)
, E = new e.pointGeometry((o.padding.left - o.padding.right) / 2,(o.padding.top - o.padding.bottom) / 2).rotate(r * Math.PI / 180)
, S = T.add(E).mult(s.scale / s.zoomScale(w));
return {
center: s.unproject(l.add(c).div(2).sub(S)),
zoom: w,
bearing: r
}
}
_cameraForBox(t, i, r, n, o) {
const s = this._extendCameraOptions(o);
r = r || 0,
n = n || 0,
t = e.LngLat.convert(t),
i = e.LngLat.convert(i);
const a = this.transform.clone();
a.padding = s.padding;
const l = this.getFreeCameraOptions()
, c = new e.LngLat(.5 * (t.lng + i.lng),.5 * (t.lat + i.lat))
, u = .5 * (r + n);
if (a._camera.position[2] < e.mercatorZfromAltitude(u, c.lat))
return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");
l.lookAtPoint(c),
a.setFreeCameraOptions(l);
const h = e.MercatorCoordinate.fromLngLat(t)
, d = e.MercatorCoordinate.fromLngLat(i)
, p = a.pointRayIntersection(a.centerPoint, u)
, f = [(m = a.rayIntersectionCoordinate(p)).x, m.y, m.z];
var m;
const _ = a.screenPointToMercatorRay(a.centerPoint)
, g = "globe" !== a.projection.name;
let y, x = 0;
do {
const i = Math.floor(a.zoom)
, o = 1 << i
, s = Math.min(o * h.x, o * d.x)
, l = Math.min(o * h.y, o * d.y)
, c = Math.max(o * h.x, o * d.x)
, u = Math.max(o * h.y, o * d.y)
, p = new e.Aabb([s, l, r],[c, u, n])
, m = e.Frustum.fromInvProjectionMatrix(a.invProjMatrix, a.worldSize, i, g);
if (2 !== p.intersects(m)) {
y && (a._camera.position = e.scaleAndAdd([], a._camera.position, _.dir, -y),
a._updateStateFromCamera());
break
}
const x = e.sub([], a._camera.position, f);
y = .5 * e.length(x),
a._camera.position = e.scaleAndAdd([], a._camera.position, _.dir, y);
try {
a._updateStateFromCamera()
} catch (t) {
return void e.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")
}
} while (++x < 10);
return {
center: a.center,
zoom: a.zoom,
bearing: a.bearing,
pitch: a.pitch
}
}
fitBounds(t, i, r) {
return "globe" === this.transform.projection.name && e.warnOnce("Globe projection does not support fitBounds API, this API may behave unexpectedly."),
this._fitInternal(this.cameraForBounds(t, i), i, r)
}
_raycastElevationBox(t, i) {
const r = this.transform.elevation;
if (!r)
return;
const n = new e.pointGeometry(t.x,i.y)
, o = new e.pointGeometry(i.x,t.y)
, s = r.pointCoordinate(t);
if (!s)
return;
const a = r.pointCoordinate(i);
if (!a)
return;
const l = r.pointCoordinate(n);
if (!l)
return;
const c = r.pointCoordinate(o);
if (!c)
return;
const u = new e.MercatorCoordinate(s[0],s[1]).toLngLat()
, h = new e.MercatorCoordinate(a[0],a[1]).toLngLat()
, d = new e.MercatorCoordinate(l[0],l[1]).toLngLat()
, p = new e.MercatorCoordinate(c[0],c[1]).toLngLat()
, f = Math.min(u.lng, Math.min(h.lng, Math.min(d.lng, p.lng)))
, m = Math.min(u.lat, Math.min(h.lat, Math.min(d.lat, p.lat)))
, _ = Math.max(u.lng, Math.max(h.lng, Math.max(d.lng, p.lng)))
, g = Math.max(u.lat, Math.max(h.lat, Math.max(d.lat, p.lat)))
, y = Math.min(s[3], Math.min(a[3], Math.min(l[3], c[3])))
, x = Math.max(s[3], Math.max(a[3], Math.max(l[3], c[3])));
return {
minLngLat: new e.LngLat(f,m),
maxLngLat: new e.LngLat(_,g),
minAltitude: y,
maxAltitude: x
}
}
fitScreenCoordinates(t, i, r, n, o) {
let s, a, l, c;
"globe" === this.transform.projection.name && e.warnOnce("Globe projection does not support fitScreenCoordinates API, this API may behave unexpectedly.");
const u = e.pointGeometry.convert(t)
, h = e.pointGeometry.convert(i)
, d = this._raycastElevationBox(u, h);
if (d)
s = d.minLngLat,
a = d.maxLngLat,
l = d.minAltitude,
c = d.maxAltitude;
else {
if (this.transform.anyCornerOffEdge(u, h))
return this;
s = this.transform.pointLocation(u),
a = this.transform.pointLocation(h)
}
return this._fitInternal(0 === this.transform.pitch ? this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)), this.transform.pointLocation(e.pointGeometry.convert(i)), r, n) : this._cameraForBox(s, a, l, c, n), n, o)
}
_fitInternal(t, i, r) {
return t ? (delete (i = e.extend(t, i)).padding,
i.linear ? this.easeTo(i, r) : this.flyTo(i, r)) : this
}
jumpTo(t, i) {
this.stop();
const r = t.preloadOnly ? this.transform.clone() : this.transform;
let n = !1
, o = !1
, s = !1;
return "zoom"in t && r.zoom !== +t.zoom && (n = !0,
r.zoom = +t.zoom),
void 0 !== t.center && (r.center = e.LngLat.convert(t.center)),
"bearing"in t && r.bearing !== +t.bearing && (o = !0,
r.bearing = +t.bearing),
"pitch"in t && r.pitch !== +t.pitch && (s = !0,
r.pitch = +t.pitch),
null == t.padding || r.isPaddingEqual(t.padding) || (r.padding = t.padding),
t.preloadOnly ? (this._preloadTiles(r),
this) : (this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),
n && this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),
o && this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),
s && this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),
this.fire(new e.Event("moveend",i)))
}
getFreeCameraOptions() {
return this.transform.projection.supportsFreeCamera || e.warnOnce(Hn),
this.transform.getFreeCameraOptions()
}
setFreeCameraOptions(t, i) {
const r = this.transform;
if (!r.projection.supportsFreeCamera)
return e.warnOnce(Hn),
this;
this.stop();
const n = r.zoom
, o = r.pitch
, s = r.bearing;
r.setFreeCameraOptions(t);
const a = n !== r.zoom
, l = o !== r.pitch
, c = s !== r.bearing;
return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),
a && this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),
c && this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),
l && this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),
this.fire(new e.Event("moveend",i)),
this
}
easeTo(t, i) {
this._stop(!1, t.easeId),
(!1 === (t = e.extend({
offset: [0, 0],
duration: 500,
easing: e.ease
}, t)).animate || !t.essential && e.exported.prefersReducedMotion) && (t.duration = 0);
const r = this.transform
, n = this.getZoom()
, o = this.getBearing()
, s = this.getPitch()
, a = this.getPadding()
, l = "zoom"in t ? +t.zoom : n
, c = "bearing"in t ? this._normalizeBearing(t.bearing, o) : o
, u = "pitch"in t ? +t.pitch : s
, h = "padding"in t ? t.padding : r.padding
, d = e.pointGeometry.convert(t.offset);
let p, f, m;
if ("globe" === r.projection.name) {
const i = e.MercatorCoordinate.fromLngLat(r.center)
, n = d.rotate(-r.angle);
i.x += n.x / r.worldSize,
i.y += n.y / r.worldSize;
const o = i.toLngLat()
, s = e.LngLat.convert(t.center || o);
this._normalizeCenter(s),
p = r.centerPoint.add(n),
f = new e.pointGeometry(i.x,i.y).mult(r.worldSize),
m = new e.pointGeometry(e.mercatorXfromLng(s.lng),e.mercatorYfromLat(s.lat)).mult(r.worldSize).sub(f)
} else {
p = r.centerPoint.add(d);
const i = r.pointLocation(p)
, n = e.LngLat.convert(t.center || i);
this._normalizeCenter(n),
f = r.project(i),
m = r.project(n).sub(f)
}
const _ = r.zoomScale(l - n);
let g, y;
t.around && (g = e.LngLat.convert(t.around),
y = r.locationPoint(g));
const x = this._zooming || l !== n
, v = this._rotating || o !== c
, b = this._pitching || u !== s
, w = !r.isPaddingEqual(h)
, T = r=>T=>{
if (x && (r.zoom = e.number(n, l, T)),
v && (r.bearing = e.number(o, c, T)),
b && (r.pitch = e.number(s, u, T)),
w && (r.interpolatePadding(a, h, T),
p = r.centerPoint.add(d)),
g)
r.setLocationAtPoint(g, y);
else {
const e = r.zoomScale(r.zoom - n)
, t = l > n ? Math.min(2, _) : Math.max(.5, _)
, i = Math.pow(t, 1 - T)
, o = r.unproject(f.add(m.mult(T * i)).mult(e));
r.setLocationAtPoint(r.renderWorldCopies ? o.wrap() : o, p)
}
return t.preloadOnly || this._fireMoveEvents(i),
r
}
;
if (t.preloadOnly) {
const e = this._emulate(T, t.duration, r);
return this._preloadTiles(e),
this
}
const E = {
moving: this._moving,
zooming: this._zooming,
rotating: this._rotating,
pitching: this._pitching
};
return this._zooming = x,
this._rotating = v,
this._pitching = b,
this._padding = w,
this._easeId = t.easeId,
this._prepareEase(i, t.noMoveStart, E),
this._ease(T(r), (e=>{
r.recenterOnTerrain(),
this._afterEase(i, e)
}
), t),
this
}
_prepareEase(t, i, r={}) {
this._moving = !0,
this.transform.cameraElevationReference = "sea",
i || r.moving || this.fire(new e.Event("movestart",t)),
this._zooming && !r.zooming && this.fire(new e.Event("zoomstart",t)),
this._rotating && !r.rotating && this.fire(new e.Event("rotatestart",t)),
this._pitching && !r.pitching && this.fire(new e.Event("pitchstart",t))
}
_fireMoveEvents(t) {
this.fire(new e.Event("move",t)),
this._zooming && this.fire(new e.Event("zoom",t)),
this._rotating && this.fire(new e.Event("rotate",t)),
this._pitching && this.fire(new e.Event("pitch",t))
}
_afterEase(t, i) {
if (this._easeId && i && this._easeId === i)
return;
this._easeId = void 0,
this.transform.cameraElevationReference = "ground";
const r = this._zooming
, n = this._rotating
, o = this._pitching;
this._moving = !1,
this._zooming = !1,
this._rotating = !1,
this._pitching = !1,
this._padding = !1,
r && this.fire(new e.Event("zoomend",t)),
n && this.fire(new e.Event("rotateend",t)),
o && this.fire(new e.Event("pitchend",t)),
this.fire(new e.Event("moveend",t))
}
flyTo(t, i) {
if (!t.essential && e.exported.prefersReducedMotion) {
const r = e.pick(t, ["center", "zoom", "bearing", "pitch", "around"]);
return this.jumpTo(r, i)
}
this.stop(),
t = e.extend({
offset: [0, 0],
speed: 1.2,
curve: 1.42,
easing: e.ease
}, t);
const r = this.transform
, n = this.getZoom()
, o = this.getBearing()
, s = this.getPitch()
, a = this.getPadding()
, l = "zoom"in t ? e.clamp(+t.zoom, r.minZoom, r.maxZoom) : n
, c = "bearing"in t ? this._normalizeBearing(t.bearing, o) : o
, u = "pitch"in t ? +t.pitch : s
, h = "padding"in t ? t.padding : r.padding
, d = r.zoomScale(l - n)
, p = e.pointGeometry.convert(t.offset);
let f = r.centerPoint.add(p);
const m = r.pointLocation(f)
, _ = e.LngLat.convert(t.center || m);
this._normalizeCenter(_);
const g = r.project(m)
, y = r.project(_).sub(g);
let x = t.curve;
const v = Math.max(r.width, r.height)
, b = v / d
, w = y.mag();
if ("minZoom"in t) {
const i = e.clamp(Math.min(t.minZoom, n, l), r.minZoom, r.maxZoom)
, o = v / r.zoomScale(i - n);
x = Math.sqrt(o / w * 2)
}
const T = x * x;
function E(e) {
const t = (b * b - v * v + (e ? -1 : 1) * T * T * w * w) / (2 * (e ? b : v) * T * w);
return Math.log(Math.sqrt(t * t + 1) - t)
}
function S(e) {
return (Math.exp(e) - Math.exp(-e)) / 2
}
function C(e) {
return (Math.exp(e) + Math.exp(-e)) / 2
}
const M = E(0);
let A = function(e) {
return C(M) / C(M + x * e)
}
, I = function(e) {
return v * ((C(M) * (S(t = M + x * e) / C(t)) - S(M)) / T) / w;
var t
}
, z = (E(1) - M) / x;
if (Math.abs(w) < 1e-6 || !isFinite(z)) {
if (Math.abs(v - b) < 1e-6)
return this.easeTo(t, i);
const e = b < v ? -1 : 1;
z = Math.abs(Math.log(b / v)) / x,
I = function() {
return 0
}
,
A = function(t) {
return Math.exp(e * x * t)
}
}
t.duration = "duration"in t ? +t.duration : 1e3 * z / ("screenSpeed"in t ? +t.screenSpeed / x : +t.speed),
t.maxDuration && t.duration > t.maxDuration && (t.duration = 0);
const k = o !== c
, P = u !== s
, D = !r.isPaddingEqual(h)
, L = r=>d=>{
const m = d * z
, x = 1 / A(m);
r.zoom = 1 === d ? l : n + r.scaleZoom(x),
k && (r.bearing = e.number(o, c, d)),
P && (r.pitch = e.number(s, u, d)),
D && (r.interpolatePadding(a, h, d),
f = r.centerPoint.add(p));
const v = 1 === d ? _ : r.unproject(g.add(y.mult(I(m))).mult(x));
return r.setLocationAtPoint(r.renderWorldCopies ? v.wrap() : v, f),
r._updateCameraOnTerrain(),
t.preloadOnly || this._fireMoveEvents(i),
r
}
;
if (t.preloadOnly) {
const e = this._emulate(L, t.duration, r);
return this._preloadTiles(e),
this
}
return this._zooming = !0,
this._rotating = k,
this._pitching = P,
this._padding = D,
this._prepareEase(i, !1),
this._ease(L(r), (()=>this._afterEase(i)), t),
this
}
isEasing() {
return !!this._easeFrameId
}
stop() {
return this._stop()
}
_stop(e, t) {
if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId),
this._easeFrameId = void 0,
this._onEaseFrame = void 0),
this._onEaseEnd) {
const e = this._onEaseEnd;
this._onEaseEnd = void 0,
e.call(this, t)
}
if (!e) {
const e = this.handlers;
e && e.stop(!1)
}
return this
}
_ease(t, i, r) {
!1 === r.animate || 0 === r.duration ? (t(1),
i()) : (this._easeStart = e.exported.now(),
this._easeOptions = r,
this._onEaseFrame = t,
this._onEaseEnd = i,
this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback))
}
_renderFrameCallback() {
const t = Math.min((e.exported.now() - this._easeStart) / this._easeOptions.duration, 1)
, i = this._onEaseFrame;
i && i(this._easeOptions.easing(t)),
t < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop()
}
_normalizeBearing(t, i) {
t = e.wrap(t, -180, 180);
const r = Math.abs(t - i);
return Math.abs(t - 360 - i) < r && (t -= 360),
Math.abs(t + 360 - i) < r && (t += 360),
t
}
_normalizeCenter(e) {
const t = this.transform;
if (!t.renderWorldCopies || t.maxBounds)
return;
const i = e.lng - t.center.lng;
e.lng += i > 180 ? -360 : i < -180 ? 360 : 0
}
_emulate(e, t, i) {
const r = Math.ceil(15 * t / 1e3)
, n = []
, o = e(i.clone());
for (let e = 0; e <= r; e++) {
const t = o(e / r);
n.push(t.clone())
}
return n
}
}
class Kn {
constructor(t={}) {
this.options = t,
e.bindAll(["_toggleAttribution", "_updateEditLink", "_updateData", "_updateCompact"], this)
}
getDefaultPosition() {
return "bottom-right"
}
onAdd(e) {
const t = this.options && this.options.compact;
return this._map = e,
this._container = o("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"),
this._compactButton = o("button", "mapboxgl-ctrl-attrib-button", this._container),
o("span", "mapboxgl-ctrl-icon", this._compactButton).setAttribute("aria-hidden", "true"),
this._compactButton.type = "button",
this._compactButton.addEventListener("click", this._toggleAttribution),
this._setElementTitle(this._compactButton, "ToggleAttribution"),
this._innerContainer = o("div", "mapboxgl-ctrl-attrib-inner", this._container),
this._innerContainer.setAttribute("role", "list"),
t && this._container.classList.add("mapboxgl-compact"),
this._updateAttributions(),
this._updateEditLink(),
this._map.on("styledata", this._updateData),
this._map.on("sourcedata", this._updateData),
this._map.on("moveend", this._updateEditLink),
void 0 === t && (this._map.on("resize", this._updateCompact),
this._updateCompact()),
this._container
}
onRemove() {
this._container.remove(),
this._map.off("styledata", this._updateData),
this._map.off("sourcedata", this._updateData),
this._map.off("moveend", this._updateEditLink),
this._map.off("resize", this._updateCompact),
this._map = void 0,
this._attribHTML = void 0
}
_setElementTitle(e, t) {
const i = this._map._getUIString(`AttributionControl.${t}`);
e.setAttribute("aria-label", i),
e.removeAttribute("title"),
e.firstElementChild && e.firstElementChild.setAttribute("title", i)
}
_toggleAttribution() {
this._container.classList.contains("mapboxgl-compact-show") ? (this._container.classList.remove("mapboxgl-compact-show"),
this._compactButton.setAttribute("aria-expanded", "false")) : (this._container.classList.add("mapboxgl-compact-show"),
this._compactButton.setAttribute("aria-expanded", "true"))
}
_updateEditLink() {
let t = this._editLink;
t || (t = this._editLink = this._container.querySelector(".mapbox-improve-map"));
const i = [{
key: "owner",
value: this.styleOwner
}, {
key: "id",
value: this.styleId
}, {
key: "access_token",
value: this._map._requestManager._customAccessToken || e.config.ACCESS_TOKEN
}];
if (t) {
const r = i.reduce(((e,t,r)=>(t.value && (e += `${t.key}=${t.value}${r < i.length - 1 ? "&" : ""}`),
e)), "?");
t.href = `${e.config.FEEDBACK_URL}/${r}#${Qr(this._map, !0)}`,
t.rel = "noopener nofollow",
this._setElementTitle(t, "MapFeedback")
}
}
_updateData(e) {
!e || "metadata" !== e.sourceDataType && "visibility" !== e.sourceDataType && "style" !== e.dataType || (this._updateAttributions(),
this._updateEditLink())
}
_updateAttributions() {
if (!this._map.style)
return;
let e = [];
if (this._map.style.stylesheet) {
const e = this._map.style.stylesheet;
this.styleOwner = e.owner,
this.styleId = e.id
}
const t = this._map.style._sourceCaches;
for (const i in t) {
const r = t[i];
if (r.used) {
const t = r.getSource();
t.attribution && e.indexOf(t.attribution) < 0 && e.push(t.attribution)
}
}
e.sort(((e,t)=>e.length - t.length)),
e = e.filter(((t,i)=>{
for (let r = i + 1; r < e.length; r++)
if (e[r].indexOf(t) >= 0)
return !1;
return !0
}
)),
this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? e = [...this.options.customAttribution, ...e] : e.unshift(this.options.customAttribution));
const i = e.join(" | ");
i !== this._attribHTML && (this._attribHTML = i,
e.length ? (this._innerContainer.innerHTML = i,
this._container.classList.remove("mapboxgl-attrib-empty")) : this._container.classList.add("mapboxgl-attrib-empty"),
this._editLink = null)
}
_updateCompact() {
this._map.getCanvasContainer().offsetWidth <= 640 ? this._container.classList.add("mapboxgl-compact") : this._container.classList.remove("mapboxgl-compact", "mapboxgl-compact-show")
}
}
class Jn {
constructor() {
e.bindAll(["_updateLogo", "_updateCompact"], this)
}
onAdd(e) {
this._map = e,
this._container = o("div", "mapboxgl-ctrl");
const t = o("a", "mapboxgl-ctrl-logo");
return t.target = "_blank",
t.rel = "noopener nofollow",
t.href = "https://www.mapbox.com/",
t.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")),
t.setAttribute("rel", "noopener nofollow"),
this._container.appendChild(t),
this._container.style.display = "none",
this._map.on("sourcedata", this._updateLogo),
this._updateLogo(),
this._map.on("resize", this._updateCompact),
this._updateCompact(),
this._container
}
onRemove() {
this._container.remove(),
this._map.off("sourcedata", this._updateLogo),
this._map.off("resize", this._updateCompact)
}
getDefaultPosition() {
return "bottom-left"
}
_updateLogo(e) {
e && "metadata" !== e.sourceDataType || (this._container.style.display = this._logoRequired() ? "block" : "none")
}
_logoRequired() {
if (!this._map.style)
return !0;
const e = this._map.style._sourceCaches;
if (0 === Object.entries(e).length)
return !0;
for (const t in e) {
const i = e[t].getSource();
if (i.hasOwnProperty("mapbox_logo") && !i.mapbox_logo)
return !1
}
return !0
}
_updateCompact() {
const e = this._container.children;
if (e.length) {
const t = e[0];
this._map.getCanvasContainer().offsetWidth < 250 ? t.classList.add("mapboxgl-compact") : t.classList.remove("mapboxgl-compact")
}
}
}
class Qn {
constructor() {
this._queue = [],
this._id = 0,
this._cleared = !1,
this._currentlyRunning = !1
}
add(e) {
const t = ++this._id;
return this._queue.push({
callback: e,
id: t,
cancelled: !1
}),
t
}
remove(e) {
const t = this._currentlyRunning
, i = t ? this._queue.concat(t) : this._queue;
for (const t of i)
if (t.id === e)
return void (t.cancelled = !0)
}
run(e=0) {
const t = this._currentlyRunning = this._queue;
this._queue = [];
for (const i of t)
if (!i.cancelled && (i.callback(e),
this._cleared))
break;
this._cleared = !1,
this._currentlyRunning = !1
}
clear() {
this._currentlyRunning && (this._cleared = !0),
this._queue = []
}
}
function eo(t, i, r) {
if (t = new e.LngLat(t.lng,t.lat),
i) {
const n = new e.LngLat(t.lng - 360,t.lat)
, o = new e.LngLat(t.lng + 360,t.lat)
, s = 360 * Math.ceil(Math.abs(t.lng - r.center.lng) / 360)
, a = r.locationPoint(t).distSqr(i)
, l = i.x < 0 || i.y < 0 || i.x > r.width || i.y > r.height;
r.locationPoint(n).distSqr(i) < a && (l || Math.abs(n.lng - r.center.lng) < s) ? t = n : r.locationPoint(o).distSqr(i) < a && (l || Math.abs(o.lng - r.center.lng) < s) && (t = o)
}
for (; Math.abs(t.lng - r.center.lng) > 180; ) {
const e = r.locationPoint(t);
if (e.x >= 0 && e.y >= 0 && e.x <= r.width && e.y <= r.height)
break;
t.lng > r.center.lng ? t.lng -= 360 : t.lng += 360
}
return t
}
const to = {
center: "translate(-50%,-50%)",
top: "translate(-50%,0)",
"top-left": "translate(0,0)",
"top-right": "translate(-100%,0)",
bottom: "translate(-50%,-100%)",
"bottom-left": "translate(0,-100%)",
"bottom-right": "translate(-100%,-100%)",
left: "translate(0,-50%)",
right: "translate(-100%,-50%)"
};
class io extends e.Evented {
constructor(t, i) {
if (super(),
(t instanceof e.window.HTMLElement || i) && (t = e.extend({
element: t
}, i)),
e.bindAll(["_update", "_onMove", "_onUp", "_addDragHandler", "_onMapClick", "_onKeyPress", "_clearFadeTimer"], this),
this._anchor = t && t.anchor || "center",
this._color = t && t.color || "#3FB1CE",
this._scale = t && t.scale || 1,
this._draggable = t && t.draggable || !1,
this._clickTolerance = t && t.clickTolerance || 0,
this._isDragging = !1,
this._state = "inactive",
this._rotation = t && t.rotation || 0,
this._rotationAlignment = t && t.rotationAlignment || "auto",
this._pitchAlignment = t && t.pitchAlignment && t.pitchAlignment || "auto",
this._updateMoving = ()=>this._update(!0),
t && t.element)
this._element = t.element,
this._offset = e.pointGeometry.convert(t && t.offset || [0, 0]);
else {
this._defaultMarker = !0,
this._element = o("div");
const i = 41
, r = 27
, n = s("svg", {
display: "block",
height: i * this._scale + "px",
width: r * this._scale + "px",
viewBox: `0 0 ${r} ${i}`
}, this._element)
, a = s("radialGradient", {
id: "shadowGradient"
}, s("defs", {}, n));
s("stop", {
offset: "10%",
"stop-opacity": .4
}, a),
s("stop", {
offset: "100%",
"stop-opacity": .05
}, a),
s("ellipse", {
cx: 13.5,
cy: 34.8,
rx: 10.5,
ry: 5.25,
fill: "url(#shadowGradient)"
}, n),
s("path", {
fill: this._color,
d: "M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"
}, n),
s("path", {
opacity: .25,
d: "M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"
}, n),
s("circle", {
fill: "white",
cx: 13.5,
cy: 13.5,
r: 5.5
}, n),
this._offset = e.pointGeometry.convert(t && t.offset || [0, -14])
}
this._element.hasAttribute("aria-label") || this._element.setAttribute("aria-label", "Map marker"),
this._element.classList.add("mapboxgl-marker"),
this._element.addEventListener("dragstart", (e=>{
e.preventDefault()
}
)),
this._element.addEventListener("mousedown", (e=>{
e.preventDefault()
}
));
const r = this._element.classList;
for (const e in to)
r.remove(`mapboxgl-marker-anchor-${e}`);
r.add(`mapboxgl-marker-anchor-${this._anchor}`),
this._popup = null
}
addTo(e) {
return e === this._map || (this.remove(),
this._map = e,
e.getCanvasContainer().appendChild(this._element),
e.on("move", this._updateMoving),
e.on("moveend", this._update),
e.on("remove", this._clearFadeTimer),
e._addMarker(this),
this.setDraggable(this._draggable),
this._update(),
e.on("click", this._onMapClick)),
this
}
remove() {
const e = this._map;
return e && (e.off("click", this._onMapClick),
e.off("move", this._updateMoving),
e.off("moveend", this._update),
e.off("mousedown", this._addDragHandler),
e.off("touchstart", this._addDragHandler),
e.off("mouseup", this._onUp),
e.off("touchend", this._onUp),
e.off("mousemove", this._onMove),
e.off("touchmove", this._onMove),
e.off("remove", this._clearFadeTimer),
e._removeMarker(this),
this._map = void 0),
this._clearFadeTimer(),
this._element.remove(),
this._popup && this._popup.remove(),
this
}
getLngLat() {
return this._lngLat
}
setLngLat(t) {
return this._lngLat = e.LngLat.convert(t),
this._pos = null,
this._popup && this._popup.setLngLat(this._lngLat),
this._update(!0),
this
}
getElement() {
return this._element
}
setPopup(e) {
if (this._popup && (this._popup.remove(),
this._popup = null,
this._element.removeAttribute("role"),
this._element.removeEventListener("keypress", this._onKeyPress),
this._originalTabIndex || this._element.removeAttribute("tabindex")),
e) {
if (!("offset"in e.options)) {
const t = 38.1
, i = 13.5
, r = Math.sqrt(Math.pow(i, 2) / 2);
e.options.offset = this._defaultMarker ? {
top: [0, 0],
"top-left": [0, 0],
"top-right": [0, 0],
bottom: [0, -t],
"bottom-left": [r, -1 * (t - i + r)],
"bottom-right": [-r, -1 * (t - i + r)],
left: [i, -1 * (t - i)],
right: [-i, -1 * (t - i)]
} : this._offset
}
this._popup = e,
e._marker = this,
this._lngLat && this._popup.setLngLat(this._lngLat),
this._element.setAttribute("role", "button"),
this._originalTabIndex = this._element.getAttribute("tabindex"),
this._originalTabIndex || this._element.setAttribute("tabindex", "0"),
this._element.addEventListener("keypress", this._onKeyPress),
this._element.setAttribute("aria-expanded", "false")
}
return this
}
_onKeyPress(e) {
const t = e.code
, i = e.charCode || e.keyCode;
"Space" !== t && "Enter" !== t && 32 !== i && 13 !== i || this.togglePopup()
}
_onMapClick(e) {
const t = e.originalEvent.target
, i = this._element;
this._popup && (t === i || i.contains(t)) && this.togglePopup()
}
getPopup() {
return this._popup
}
togglePopup() {
const e = this._popup;
return e ? (e.isOpen() ? (e.remove(),
this._element.setAttribute("aria-expanded", "false")) : this._map && (e.addTo(this._map),
this._element.setAttribute("aria-expanded", "true")),
this) : this
}
_behindTerrain() {
const e = this._map;
if (!e)
return !1;
const t = e.unproject(this._pos)
, i = e.getFreeCameraOptions();
if (!i.position)
return !1;
const r = i.position.toLngLat();
return r.distanceTo(t) < .9 * r.distanceTo(this._lngLat)
}
_evaluateOpacity() {
const t = this._map;
if (!t)
return;
const i = this._pos;
if (!i || i.x < 0 || i.x > t.transform.width || i.y < 0 || i.y > t.transform.height)
return void this._clearFadeTimer();
const r = t.unproject(i);
let n;
t._showingGlobe() && e.isLngLatBehindGlobe(t.transform, this._lngLat) ? n = 0 : (n = 1 - t._queryFogOpacity(r),
t.transform._terrainEnabled() && t.getTerrain() && this._behindTerrain() && (n *= .2)),
this._element.style.opacity = `${n}`,
this._element.style.pointerEvents = n > 0 ? "auto" : "none",
this._popup && this._popup._setOpacity(n),
this._fadeTimer = null
}
_clearFadeTimer() {
this._fadeTimer && (clearTimeout(this._fadeTimer),
this._fadeTimer = null)
}
_updateDOM() {
const e = this._pos;
if (!e || !this._map)
return;
const t = this._offset.mult(this._scale);
this._element.style.transform = `\n translate(${e.x}px,${e.y}px)\n ${to[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `
}
_calculateXYTransform() {
const t = this._pos
, i = this._map
, r = this.getPitchAlignment();
if (!i || !t || "map" !== r)
return "";
if (!i._showingGlobe()) {
const e = i.getPitch();
return e ? `rotateX(${e}deg)` : ""
}
const n = e.radToDeg(e.globeTiltAtLngLat(i.transform, this._lngLat))
, o = t.sub(e.globeCenterToScreenPoint(i.transform))
, s = Math.abs(o.x) + Math.abs(o.y);
if (0 === s)
return "";
const a = n / s;
return `rotateX(${-o.y * a}deg) rotateY(${o.x * a}deg)`
}
_calculateZTransform() {
const t = this._pos
, i = this._map;
if (!i || !t)
return "";
let r = 0;
const n = this.getRotationAlignment();
if ("map" === n)
if (i._showingGlobe()) {
const t = i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat + .001))
, n = i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat - .001)).sub(t);
r = e.radToDeg(Math.atan2(n.y, n.x)) - 90
} else
r = -i.getBearing();
else if ("horizon" === n) {
const n = e.smoothstep(4, 6, i.getZoom())
, o = e.globeCenterToScreenPoint(i.transform);
o.y += n * i.transform.height;
const s = t.sub(o)
, a = e.radToDeg(Math.atan2(s.y, s.x));
r = (a > 90 ? a - 270 : a + 90) * (1 - n)
}
return r += this._rotation,
r ? `rotateZ(${r}deg)` : ""
}
_update(t) {
e.window.cancelAnimationFrame(this._updateFrameId);
const i = this._map;
i && (i.transform.renderWorldCopies && (this._lngLat = eo(this._lngLat, this._pos, i.transform)),
this._pos = i.project(this._lngLat),
!0 === t ? this._updateFrameId = e.window.requestAnimationFrame((()=>{
this._element && this._pos && this._anchor && (this._pos = this._pos.round(),
this._updateDOM())
}
)) : this._pos = this._pos.round(),
i._requestDomTask((()=>{
this._map && (this._element && this._pos && this._anchor && this._updateDOM(),
(i._showingGlobe() || i.getTerrain() || i.getFog()) && !this._fadeTimer && (this._fadeTimer = setTimeout(this._evaluateOpacity.bind(this), 60)))
}
)))
}
getOffset() {
return this._offset
}
setOffset(t) {
return this._offset = e.pointGeometry.convert(t),
this._update(),
this
}
_onMove(t) {
const i = this._map;
if (i) {
if (!this._isDragging) {
const e = this._clickTolerance || i._clickTolerance;
this._isDragging = t.point.dist(this._pointerdownPos) >= e
}
this._isDragging && (this._pos = t.point.sub(this._positionDelta),
this._lngLat = i.unproject(this._pos),
this.setLngLat(this._lngLat),
this._element.style.pointerEvents = "none",
"pending" === this._state && (this._state = "active",
this.fire(new e.Event("dragstart"))),
this.fire(new e.Event("drag")))
}
}
_onUp() {
this._element.style.pointerEvents = "auto",
this._positionDelta = null,
this._pointerdownPos = null,
this._isDragging = !1;
const t = this._map;
t && (t.off("mousemove", this._onMove),
t.off("touchmove", this._onMove)),
"active" === this._state && this.fire(new e.Event("dragend")),
this._state = "inactive"
}
_addDragHandler(e) {
const t = this._map;
t && this._element.contains(e.originalEvent.target) && (e.preventDefault(),
this._positionDelta = e.point.sub(this._pos),
this._pointerdownPos = e.point,
this._state = "pending",
t.on("mousemove", this._onMove),
t.on("touchmove", this._onMove),
t.once("mouseup", this._onUp),
t.once("touchend", this._onUp))
}
setDraggable(e) {
this._draggable = !!e;
const t = this._map;
return t && (e ? (t.on("mousedown", this._addDragHandler),
t.on("touchstart", this._addDragHandler)) : (t.off("mousedown", this._addDragHandler),
t.off("touchstart", this._addDragHandler))),
this
}
isDraggable() {
return this._draggable
}
setRotation(e) {
return this._rotation = e || 0,
this._update(),
this
}
getRotation() {
return this._rotation
}
setRotationAlignment(e) {
return this._rotationAlignment = e || "auto",
this._update(),
this
}
getRotationAlignment() {
return "auto" === this._rotationAlignment || "horizon" === this._rotationAlignment && this._map && !this._map._showingGlobe() ? "viewport" : this._rotationAlignment
}
setPitchAlignment(e) {
return this._pitchAlignment = e || "auto",
this._update(),
this
}
getPitchAlignment() {
return "auto" === this._pitchAlignment ? this.getRotationAlignment() : this._pitchAlignment
}
}
class ro {
constructor(e) {
this.jumpTo(e)
}
getValue(t) {
if (t <= this._startTime)
return this._start;
if (t >= this._endTime)
return this._end;
const i = e.easeCubicInOut((t - this._startTime) / (this._endTime - this._startTime));
return this._start * (1 - i) + this._end * i
}
isEasing(e) {
return e >= this._startTime && e <= this._endTime
}
jumpTo(e) {
this._startTime = -1 / 0,
this._endTime = -1 / 0,
this._start = e,
this._end = e
}
easeTo(e, t, i) {
this._start = this.getValue(t),
this._end = e,
this._startTime = t,
this._endTime = t + i
}
}
const no = {
"AttributionControl.ToggleAttribution": "Toggle attribution",
"AttributionControl.MapFeedback": "Map feedback",
"FullscreenControl.Enter": "Enter fullscreen",
"FullscreenControl.Exit": "Exit fullscreen",
"GeolocateControl.FindMyLocation": "Find my location",
"GeolocateControl.LocationNotAvailable": "Location not available",
"LogoControl.Title": "Mapbox logo",
"Map.Title": "Map",
"NavigationControl.ResetBearing": "Reset bearing to north",
"NavigationControl.ZoomIn": "Zoom in",
"NavigationControl.ZoomOut": "Zoom out",
"ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map",
"ScrollZoomBlocker.CmdMessage": "Use ⌘ + scroll to zoom the map",
"TouchPanBlocker.Message": "Use two fingers to move the map"
}
, oo = {
center: [0, 0],
zoom: 0,
bearing: 0,
pitch: 0,
minZoom: -2,
maxZoom: 22,
minPitch: 0,
maxPitch: 85,
interactive: !0,
scrollZoom: !0,
boxZoom: !0,
dragRotate: !0,
dragPan: !0,
keyboard: !0,
doubleClickZoom: !0,
touchZoomRotate: !0,
touchPitch: !0,
cooperativeGestures: !1,
bearingSnap: 7,
clickTolerance: 3,
pitchWithRotate: !0,
hash: !1,
attributionControl: !0,
failIfMajorPerformanceCaveat: !1,
preserveDrawingBuffer: !1,
trackResize: !0,
optimizeForTerrain: !0,
renderWorldCopies: !0,
refreshExpiredTiles: !0,
minTileCacheSize: null,
maxTileCacheSize: null,
localIdeographFontFamily: "sans-serif",
localFontFamily: null,
transformRequest: null,
accessToken: null,
fadeDuration: 300,
crossSourceCollisions: !0
};
function so(e) {
e.parentNode && e.parentNode.removeChild(e)
}
const ao = {
showCompass: !0,
showZoom: !0,
visualizePitch: !1
};
class lo {
constructor(t, i, r=!1) {
this._clickTolerance = 10,
this.element = i,
this.mouseRotate = new wn({
clickTolerance: t.dragRotate._mouseRotate._clickTolerance
}),
this.map = t,
r && (this.mousePitch = new Tn({
clickTolerance: t.dragRotate._mousePitch._clickTolerance
})),
e.bindAll(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "reset"], this),
i.addEventListener("mousedown", this.mousedown),
i.addEventListener("touchstart", this.touchstart, {
passive: !1
}),
i.addEventListener("touchmove", this.touchmove),
i.addEventListener("touchend", this.touchend),
i.addEventListener("touchcancel", this.reset)
}
down(e, t) {
this.mouseRotate.mousedown(e, t),
this.mousePitch && this.mousePitch.mousedown(e, t),
u()
}
move(e, t) {
const i = this.map
, r = this.mouseRotate.mousemoveWindow(e, t)
, n = r && r.bearingDelta;
if (n && i.setBearing(i.getBearing() + n),
this.mousePitch) {
const r = this.mousePitch.mousemoveWindow(e, t)
, n = r && r.pitchDelta;
n && i.setPitch(i.getPitch() + n)
}
}
off() {
const e = this.element;
e.removeEventListener("mousedown", this.mousedown),
e.removeEventListener("touchstart", this.touchstart, {
passive: !1
}),
e.removeEventListener("touchmove", this.touchmove),
e.removeEventListener("touchend", this.touchend),
e.removeEventListener("touchcancel", this.reset),
this.offTemp()
}
offTemp() {
h(),
e.window.removeEventListener("mousemove", this.mousemove),
e.window.removeEventListener("mouseup", this.mouseup)
}
mousedown(t) {
this.down(e.extend({}, t, {
ctrlKey: !0,
preventDefault: ()=>t.preventDefault()
}), f(this.element, t)),
e.window.addEventListener("mousemove", this.mousemove),
e.window.addEventListener("mouseup", this.mouseup)
}
mousemove(e) {
this.move(e, f(this.element, e))
}
mouseup(e) {
this.mouseRotate.mouseupWindow(e),
this.mousePitch && this.mousePitch.mouseupWindow(e),
this.offTemp()
}
touchstart(e) {
1 !== e.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = m(this.element, e.targetTouches)[0],
this.down({
type: "mousedown",
button: 0,
ctrlKey: !0,
preventDefault: ()=>e.preventDefault()
}, this._startPos))
}
touchmove(e) {
1 !== e.targetTouches.length ? this.reset() : (this._lastPos = m(this.element, e.targetTouches)[0],
this.move({
preventDefault: ()=>e.preventDefault()
}, this._lastPos))
}
touchend(e) {
0 === e.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(),
this.reset()
}
reset() {
this.mouseRotate.reset(),
this.mousePitch && this.mousePitch.reset(),
delete this._startPos,
delete this._lastPos,
this.offTemp()
}
}
const co = {
positionOptions: {
enableHighAccuracy: !1,
maximumAge: 0,
timeout: 6e3
},
fitBoundsOptions: {
maxZoom: 15
},
trackUserLocation: !1,
showAccuracyCircle: !0,
showUserLocation: !0,
showUserHeading: !1
}
, uo = {
maxWidth: 100,
unit: "metric"
};
function ho(e, t, i) {
const r = po(t)
, n = r / t
, o = {
kilometer: "km",
meter: "m",
mile: "mi",
foot: "ft",
"nautical-mile": "nm"
}[i];
this._map._requestDomTask((()=>{
this._container.style.width = e * n + "px",
this._container.innerHTML = `${r} ${o}`
}
))
}
function po(e) {
const t = Math.pow(10, `${Math.floor(e)}`.length - 1);
let i = e / t;
return i = i >= 10 ? 10 : i >= 5 ? 5 : i >= 3 ? 3 : i >= 2 ? 2 : i >= 1 ? 1 : function(e) {
const t = Math.pow(10, Math.ceil(-Math.log(e) / Math.LN10));
return Math.round(e * t) / t
}(i),
t * i
}
const fo = {
closeButton: !0,
closeOnClick: !0,
focusAfterOpen: !0,
className: "",
maxWidth: "240px"
}
, mo = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", ");
function _o(t=new e.pointGeometry(0,0), i="bottom") {
if ("number" == typeof t) {
const r = Math.round(Math.sqrt(.5 * Math.pow(t, 2)));
switch (i) {
case "top":
return new e.pointGeometry(0,t);
case "top-left":
return new e.pointGeometry(r,r);
case "top-right":
return new e.pointGeometry(-r,r);
case "bottom":
return new e.pointGeometry(0,-t);
case "bottom-left":
return new e.pointGeometry(r,-r);
case "bottom-right":
return new e.pointGeometry(-r,-r);
case "left":
return new e.pointGeometry(t,0);
case "right":
return new e.pointGeometry(-t,0)
}
return new e.pointGeometry(0,0)
}
return t instanceof e.pointGeometry || Array.isArray(t) ? e.pointGeometry.convert(t) : e.pointGeometry.convert(t[i] || [0, 0])
}
const go = {
version: e.version,
supported: i,
setRTLTextPlugin: e.setRTLTextPlugin,
getRTLTextPluginStatus: e.getRTLTextPluginStatus,
Map: class extends Yn {
constructor(t) {
if (null != (t = e.extend({}, oo, t)).minZoom && null != t.maxZoom && t.minZoom > t.maxZoom)
throw new Error("maxZoom must be greater than or equal to minZoom");
if (null != t.minPitch && null != t.maxPitch && t.minPitch > t.maxPitch)
throw new Error("maxPitch must be greater than or equal to minPitch");
if (null != t.minPitch && t.minPitch < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (null != t.maxPitch && t.maxPitch > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (t.antialias && e.isSafariWithAntialiasingBug(e.window) && (t.antialias = !1,
e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),
super(new Yr(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies), t),
this._interactive = t.interactive,
this._minTileCacheSize = t.minTileCacheSize,
this._maxTileCacheSize = t.maxTileCacheSize,
this._failIfMajorPerformanceCaveat = t.failIfMajorPerformanceCaveat,
this._preserveDrawingBuffer = t.preserveDrawingBuffer,
this._antialias = t.antialias,
this._trackResize = t.trackResize,
this._bearingSnap = t.bearingSnap,
this._refreshExpiredTiles = t.refreshExpiredTiles,
this._fadeDuration = t.fadeDuration,
this._isInitialLoad = !0,
this._crossSourceCollisions = t.crossSourceCollisions,
this._crossFadingFactor = 1,
this._collectResourceTiming = t.collectResourceTiming,
this._optimizeForTerrain = t.optimizeForTerrain,
this._language = "auto" === t.language ? e.window.navigator.language : t.language,
this._worldview = t.worldview,
this._renderTaskQueue = new Qn,
this._domRenderTaskQueue = new Qn,
this._controls = [],
this._markers = [],
this._mapId = e.uniqueId(),
this._locale = e.extend({}, no, t.locale),
this._clickTolerance = t.clickTolerance,
this._cooperativeGestures = t.cooperativeGestures,
this._containerWidth = 0,
this._containerHeight = 0,
this._averageElevationLastSampledAt = -1 / 0,
this._averageElevationExaggeration = 0,
this._averageElevation = new ro(0),
this._useExplicitProjection = !1,
this._requestManager = new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),
this._silenceAuthErrors = !!t.testMode,
"string" == typeof t.container) {
if (this._container = e.window.document.getElementById(t.container),
!this._container)
throw new Error(`Container '${t.container}' not found.`)
} else {
if (!(t.container instanceof e.window.HTMLElement))
throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
this._container = t.container
}
if (this._container.childNodes.length > 0 && e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),
t.maxBounds && this.setMaxBounds(t.maxBounds),
e.bindAll(["_onWindowOnline", "_onWindowResize", "_onMapScroll", "_contextLost", "_contextRestored"], this),
this._setupContainer(),
this._setupPainter(),
void 0 === this.painter)
throw new Error("Failed to initialize WebGL.");
this.on("move", (()=>this._update(!1))),
this.on("moveend", (()=>this._update(!1))),
this.on("zoom", (()=>this._update(!0))),
void 0 !== e.window && (e.window.addEventListener("online", this._onWindowOnline, !1),
e.window.addEventListener("resize", this._onWindowResize, !1),
e.window.addEventListener("orientationchange", this._onWindowResize, !1),
e.window.addEventListener("webkitfullscreenchange", this._onWindowResize, !1)),
this.handlers = new Xn(this,t),
this._localFontFamily = t.localFontFamily,
this._localIdeographFontFamily = t.localIdeographFontFamily,
t.style && this.setStyle(t.style, {
localFontFamily: this._localFontFamily,
localIdeographFontFamily: this._localIdeographFontFamily
}),
t.projection && this.setProjection(t.projection),
this._hash = t.hash && new Jr("string" == typeof t.hash && t.hash || void 0).addTo(this),
this._hash && this._hash._onHashChange() || (this.jumpTo({
center: t.center,
zoom: t.zoom,
bearing: t.bearing,
pitch: t.pitch
}),
t.bounds && (this.resize(),
this.fitBounds(t.bounds, e.extend({}, t.fitBoundsOptions, {
duration: 0
})))),
this.resize(),
t.attributionControl && this.addControl(new Kn({
customAttribution: t.customAttribution
})),
this._logoControl = new Jn,
this.addControl(this._logoControl, t.logoPosition),
this.on("style.load", (()=>{
this.transform.unmodified && this.jumpTo(this.style.stylesheet)
}
)),
this.on("data", (t=>{
this._update("style" === t.dataType),
this.fire(new e.Event(`${t.dataType}data`,t))
}
)),
this.on("dataloading", (t=>{
this.fire(new e.Event(`${t.dataType}dataloading`,t))
}
))
}
_getMapId() {
return this._mapId
}
addControl(t, i) {
if (void 0 === i && (i = t.getDefaultPosition ? t.getDefaultPosition() : "top-right"),
!t || !t.onAdd)
return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));
const r = t.onAdd(this);
this._controls.push(t);
const n = this._controlPositions[i];
return -1 !== i.indexOf("bottom") ? n.insertBefore(r, n.firstChild) : n.appendChild(r),
this
}
removeControl(t) {
if (!t || !t.onRemove)
return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));
const i = this._controls.indexOf(t);
return i > -1 && this._controls.splice(i, 1),
t.onRemove(this),
this
}
hasControl(e) {
return this._controls.indexOf(e) > -1
}
getContainer() {
return this._container
}
getCanvasContainer() {
return this._canvasContainer
}
getCanvas() {
return this._canvas
}
resize(t) {
if (this._updateContainerDimensions(),
this._containerWidth === this.transform.width && this._containerHeight === this.transform.height)
return this;
this._resizeCanvas(this._containerWidth, this._containerHeight),
this.transform.resize(this._containerWidth, this._containerHeight),
this.painter.resize(Math.ceil(this._containerWidth), Math.ceil(this._containerHeight));
const i = !this._moving;
return i && this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),
this.fire(new e.Event("resize",t)),
i && this.fire(new e.Event("moveend",t)),
this
}
getBounds() {
return "globe" === this.transform.projection.name && e.warnOnce('Globe projection does not support getBounds API, this API may behave unexpectedly."'),
this.transform.getBounds()
}
getMaxBounds() {
return this.transform.getMaxBounds() || null
}
setMaxBounds(t) {
return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),
this._update()
}
setMinZoom(t) {
if ((t = null == t ? -2 : t) >= -2 && t <= this.transform.maxZoom)
return this.transform.minZoom = t,
this._update(),
this.getZoom() < t ? this.setZoom(t) : this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),
this;
throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")
}
getMinZoom() {
return this.transform.minZoom
}
setMaxZoom(t) {
if ((t = null == t ? 22 : t) >= this.transform.minZoom)
return this.transform.maxZoom = t,
this._update(),
this.getZoom() > t ? this.setZoom(t) : this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),
this;
throw new Error("maxZoom must be greater than the current minZoom")
}
getMaxZoom() {
return this.transform.maxZoom
}
setMinPitch(t) {
if ((t = null == t ? 0 : t) < 0)
throw new Error("minPitch must be greater than or equal to 0");
if (t >= 0 && t <= this.transform.maxPitch)
return this.transform.minPitch = t,
this._update(),
this.getPitch() < t ? this.setPitch(t) : this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),
this;
throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")
}
getMinPitch() {
return this.transform.minPitch
}
setMaxPitch(t) {
if ((t = null == t ? 85 : t) > 85)
throw new Error("maxPitch must be less than or equal to 85");
if (t >= this.transform.minPitch)
return this.transform.maxPitch = t,
this._update(),
this.getPitch() > t ? this.setPitch(t) : this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),
this;
throw new Error("maxPitch must be greater than or equal to minPitch")
}
getMaxPitch() {
return this.transform.maxPitch
}
getRenderWorldCopies() {
return this.transform.renderWorldCopies
}
setRenderWorldCopies(e) {
return this.transform.renderWorldCopies = e,
this._update()
}
getLanguage() {
return this._language
}
setLanguage(t) {
if (this._language = "auto" === t ? e.window.navigator.language : t,
this.style)
for (const e in this.style._sourceCaches) {
const t = this.style._sourceCaches[e]._source;
t._setLanguage && t._setLanguage(this._language)
}
for (const e of this._controls)
e._setLanguage && e._setLanguage(this._language);
return this
}
getWorldview() {
return this._worldview
}
setWorldview(e) {
if (this._worldview = e,
this.style)
for (const t in this.style._sourceCaches) {
const i = this.style._sourceCaches[t]._source;
i._setWorldview && i._setWorldview(e)
}
return this
}
getProjection() {
return this.transform.mercatorFromTransition ? {
name: "globe",
center: [0, 0]
} : this.transform.getProjection()
}
_showingGlobe() {
return "globe" === this.transform.projection.name
}
setProjection(e) {
return this._lazyInitEmptyStyle(),
e ? "string" == typeof e && (e = {
name: e
}) : e = null,
this._useExplicitProjection = !!e,
this._prioritizeAndUpdateProjection(e, this.style.stylesheet ? this.style.stylesheet.projection : null)
}
_updateProjectionTransition() {
if ("globe" !== this.getProjection().name)
return;
const t = this.transform
, i = t.projection.name;
let r;
"globe" === i && t.zoom >= e.GLOBE_ZOOM_THRESHOLD_MAX ? (t.setMercatorFromTransition(),
r = !0) : "mercator" === i && t.zoom < e.GLOBE_ZOOM_THRESHOLD_MAX && (t.setProjection({
name: "globe"
}),
r = !0),
r && (this.style.applyProjectionUpdate(),
this.style._forceSymbolLayerUpdate())
}
_prioritizeAndUpdateProjection(e, t) {
return this._updateProjection(e || t || {
name: "mercator"
})
}
_updateProjection(t) {
let i;
if (i = "globe" === t.name && this.transform.zoom >= e.GLOBE_ZOOM_THRESHOLD_MAX ? this.transform.setMercatorFromTransition() : this.transform.setProjection(t),
this.style.applyProjectionUpdate(),
i) {
this.painter.clearBackgroundTiles();
for (const e in this.style._sourceCaches)
this.style._sourceCaches[e].clearTiles();
this._update(!0)
}
return this
}
project(t) {
return this.transform.locationPoint3D(e.LngLat.convert(t))
}
unproject(t) {
return this.transform.pointLocation3D(e.pointGeometry.convert(t))
}
isMoving() {
return this._moving || this.handlers && this.handlers.isMoving() || !1
}
isZooming() {
return this._zooming || this.handlers && this.handlers.isZooming() || !1
}
isRotating() {
return this._rotating || this.handlers && this.handlers.isRotating() || !1
}
_createDelegatedListener(e, t, i) {
if ("mouseenter" === e || "mouseover" === e) {
let r = !1;
const n = n=>{
const o = t.filter((e=>this.getLayer(e)))
, s = o.length ? this.queryRenderedFeatures(n.point, {
layers: o
}) : [];
s.length ? r || (r = !0,
i.call(this, new cn(e,this,n.originalEvent,{
features: s
}))) : r = !1
}
, o = ()=>{
r = !1
}
;
return {
layers: new Set(t),
listener: i,
delegates: {
mousemove: n,
mouseout: o
}
}
}
if ("mouseleave" === e || "mouseout" === e) {
let r = !1;
const n = n=>{
const o = t.filter((e=>this.getLayer(e)));
(o.length ? this.queryRenderedFeatures(n.point, {
layers: o
}) : []).length ? r = !0 : r && (r = !1,
i.call(this, new cn(e,this,n.originalEvent)))
}
, o = t=>{
r && (r = !1,
i.call(this, new cn(e,this,t.originalEvent)))
}
;
return {
layers: new Set(t),
listener: i,
delegates: {
mousemove: n,
mouseout: o
}
}
}
{
const r = e=>{
const r = t.filter((e=>this.getLayer(e)))
, n = r.length ? this.queryRenderedFeatures(e.point, {
layers: r
}) : [];
n.length && (e.features = n,
i.call(this, e),
delete e.features)
}
;
return {
layers: new Set(t),
listener: i,
delegates: {
[e]: r
}
}
}
}
on(e, t, i) {
if (void 0 === i)
return super.on(e, t);
Array.isArray(t) || (t = [t]);
const r = this._createDelegatedListener(e, t, i);
this._delegatedListeners = this._delegatedListeners || {},
this._delegatedListeners[e] = this._delegatedListeners[e] || [],
this._delegatedListeners[e].push(r);
for (const e in r.delegates)
this.on(e, r.delegates[e]);
return this
}
once(e, t, i) {
if (void 0 === i)
return super.once(e, t);
Array.isArray(t) || (t = [t]);
const r = this._createDelegatedListener(e, t, i);
for (const e in r.delegates)
this.once(e, r.delegates[e]);
return this
}
off(e, t, i) {
if (void 0 === i)
return super.off(e, t);
t = new Set(Array.isArray(t) ? t : [t]);
const r = (e,t)=>{
if (e.size !== t.size)
return !1;
for (const i of e)
if (!t.has(i))
return !1;
return !0
}
, n = this._delegatedListeners ? this._delegatedListeners[e] : void 0;
return n && (e=>{
for (let n = 0; n < e.length; n++) {
const o = e[n];
if (o.listener === i && r(o.layers, t)) {
for (const e in o.delegates)
this.off(e, o.delegates[e]);
return e.splice(n, 1),
this
}
}
}
)(n),
this
}
queryRenderedFeatures(t, i) {
return this.style ? (void 0 !== i || void 0 === t || t instanceof e.pointGeometry || Array.isArray(t) || (i = t,
t = void 0),
this.style.queryRenderedFeatures(t = t || [[0, 0], [this.transform.width, this.transform.height]], i = i || {}, this.transform)) : []
}
querySourceFeatures(e, t) {
return this.style.querySourceFeatures(e, t)
}
queryTerrainElevation(t, i) {
const r = this.transform.elevation;
return r ? (i = e.extend({}, {
exaggerated: !0
}, i),
r.getAtPoint(e.MercatorCoordinate.fromLngLat(t), null, i.exaggerated)) : null
}
setStyle(t, i) {
return !1 !== (i = e.extend({}, {
localIdeographFontFamily: this._localIdeographFontFamily,
localFontFamily: this._localFontFamily
}, i)).diff && i.localIdeographFontFamily === this._localIdeographFontFamily && i.localFontFamily === this._localFontFamily && this.style && t ? (this._diffStyle(t, i),
this) : (this._localIdeographFontFamily = i.localIdeographFontFamily,
this._localFontFamily = i.localFontFamily,
this._updateStyle(t, i))
}
_getUIString(e) {
const t = this._locale[e];
if (null == t)
throw new Error(`Missing UI string '${e}'`);
return t
}
_updateStyle(e, t) {
return this.style && (this.style.setEventedParent(null),
this.style._remove(),
this.style = void 0),
e && (this.style = new ei(this,t || {}),
this.style.setEventedParent(this, {
style: this.style
}),
"string" == typeof e ? this.style.loadURL(e) : this.style.loadJSON(e)),
this._updateTerrain(),
this
}
_lazyInitEmptyStyle() {
this.style || (this.style = new ei(this,{}),
this.style.setEventedParent(this, {
style: this.style
}),
this.style.loadEmpty())
}
_diffStyle(t, i) {
if ("string" == typeof t) {
const r = this._requestManager.normalizeStyleURL(t)
, n = this._requestManager.transformRequest(r, e.ResourceType.Style);
e.getJSON(n, ((t,r)=>{
t ? this.fire(new e.ErrorEvent(t)) : r && this._updateDiff(r, i)
}
))
} else
"object" == typeof t && this._updateDiff(t, i)
}
_updateDiff(t, i) {
try {
this.style.setState(t) && this._update(!0)
} catch (r) {
e.warnOnce(`Unable to perform style diff: ${r.message || r.error || r}. Rebuilding the style from scratch.`),
this._updateStyle(t, i)
}
}
getStyle() {
if (this.style)
return this.style.serialize()
}
isStyleLoaded() {
return this.style ? this.style.loaded() : (e.warnOnce("There is no style added to the map."),
!1)
}
addSource(e, t) {
return this._lazyInitEmptyStyle(),
this.style.addSource(e, t),
this._update(!0)
}
isSourceLoaded(e) {
return !!this.style && this.style._isSourceCacheLoaded(e)
}
areTilesLoaded() {
const e = this.style && this.style._sourceCaches;
for (const t in e) {
const i = e[t]._tiles;
for (const e in i) {
const t = i[e];
if ("loaded" !== t.state && "errored" !== t.state)
return !1
}
}
return !0
}
addSourceType(e, t, i) {
this._lazyInitEmptyStyle(),
this.style.addSourceType(e, t, i)
}
removeSource(e) {
return this.style.removeSource(e),
this._updateTerrain(),
this._update(!0)
}
getSource(e) {
return this.style.getSource(e)
}
addImage(t, i, {pixelRatio: r=1, sdf: n=!1, stretchX: o, stretchY: s, content: a}={}) {
if (this._lazyInitEmptyStyle(),
i instanceof e.window.HTMLImageElement || e.window.ImageBitmap && i instanceof e.window.ImageBitmap) {
const {width: l, height: c, data: u} = e.exported.getImageData(i);
this.style.addImage(t, {
data: new e.RGBAImage({
width: l,
height: c
},u),
pixelRatio: r,
stretchX: o,
stretchY: s,
content: a,
sdf: n,
version: 0
})
} else if (void 0 === i.width || void 0 === i.height)
this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));
else {
const {width: l, height: c} = i
, u = i;
this.style.addImage(t, {
data: new e.RGBAImage({
width: l,
height: c
},new Uint8Array(u.data)),
pixelRatio: r,
stretchX: o,
stretchY: s,
content: a,
sdf: n,
version: 0,
userImage: u
}),
u.onAdd && u.onAdd(this, t)
}
}
updateImage(t, i) {
const r = this.style.getImage(t);
if (!r)
return void this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));
const n = i instanceof e.window.HTMLImageElement || e.window.ImageBitmap && i instanceof e.window.ImageBitmap ? e.exported.getImageData(i) : i
, {width: o, height: s} = n;
void 0 !== o && void 0 !== s ? o === r.data.width && s === r.data.height ? (r.data.replace(n.data, !(i instanceof e.window.HTMLImageElement || e.window.ImageBitmap && i instanceof e.window.ImageBitmap)),
this.style.updateImage(t, r)) : this.fire(new e.ErrorEvent(new Error(`The width and height of the updated image (${o}, ${s})\n must be that same as the previous version of the image\n (${r.data.width}, ${r.data.height})`))) : this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))
}
hasImage(t) {
return t ? !!this.style.getImage(t) : (this.fire(new e.ErrorEvent(new Error("Missing required image id"))),
!1)
}
removeImage(e) {
this.style.removeImage(e)
}
loadImage(t, i) {
e.getImage(this._requestManager.transformRequest(t, e.ResourceType.Image), ((t,r)=>{
i(t, r instanceof e.window.HTMLImageElement ? e.exported.getImageData(r) : r)
}
))
}
listImages() {
return this.style.listImages()
}
addLayer(e, t) {
return this._lazyInitEmptyStyle(),
this.style.addLayer(e, t),
this._update(!0)
}
moveLayer(e, t) {
return this.style.moveLayer(e, t),
this._update(!0)
}
removeLayer(e) {
return this.style.removeLayer(e),
this._update(!0)
}
getLayer(e) {
return this.style.getLayer(e)
}
setLayerZoomRange(e, t, i) {
return this.style.setLayerZoomRange(e, t, i),
this._update(!0)
}
setFilter(e, t, i={}) {
return this.style.setFilter(e, t, i),
this._update(!0)
}
getFilter(e) {
return this.style.getFilter(e)
}
setPaintProperty(e, t, i, r={}) {
return this.style.setPaintProperty(e, t, i, r),
this._update(!0)
}
getPaintProperty(e, t) {
return this.style.getPaintProperty(e, t)
}
setLayoutProperty(e, t, i, r={}) {
return this.style.setLayoutProperty(e, t, i, r),
this._update(!0)
}
getLayoutProperty(e, t) {
return this.style.getLayoutProperty(e, t)
}
setLight(e, t={}) {
return this._lazyInitEmptyStyle(),
this.style.setLight(e, t),
this._update(!0)
}
getLight() {
return this.style.getLight()
}
setTerrain(e) {
return this._lazyInitEmptyStyle(),
!e && this.transform.projection.requiresDraping ? this.style.setTerrainForDraping() : this.style.setTerrain(e),
this._averageElevationLastSampledAt = -1 / 0,
this._update(!0)
}
getTerrain() {
return this.style ? this.style.getTerrain() : null
}
setFog(e) {
return this._lazyInitEmptyStyle(),
this.style.setFog(e),
this._update(!0)
}
getFog() {
return this.style ? this.style.getFog() : null
}
_queryFogOpacity(t) {
return this.style && this.style.fog ? this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t), this.transform) : 0
}
setFeatureState(e, t) {
return this.style.setFeatureState(e, t),
this._update()
}
removeFeatureState(e, t) {
return this.style.removeFeatureState(e, t),
this._update()
}
getFeatureState(e) {
return this.style.getFeatureState(e)
}
_updateContainerDimensions() {
if (!this._container)
return;
const t = this._container.getBoundingClientRect().width || 400
, i = this._container.getBoundingClientRect().height || 300;
let r, n, o, s = this._container;
for (; s && (!n || !o); ) {
const t = e.window.getComputedStyle(s).transform;
t && "none" !== t && (r = t.match(/matrix.*\((.+)\)/)[1].split(", "),
r[0] && "0" !== r[0] && "1" !== r[0] && (n = r[0]),
r[3] && "0" !== r[3] && "1" !== r[3] && (o = r[3])),
s = s.parentElement
}
this._containerWidth = n ? Math.abs(t / n) : t,
this._containerHeight = o ? Math.abs(i / o) : i
}
_detectMissingCSS() {
"rgb(250, 128, 114)" !== e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") && e.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")
}
_setupContainer() {
const e = this._container;
e.classList.add("mapboxgl-map"),
(this._missingCSSCanary = o("div", "mapboxgl-canary", e)).style.visibility = "hidden",
this._detectMissingCSS();
const t = this._canvasContainer = o("div", "mapboxgl-canvas-container", e);
this._interactive && t.classList.add("mapboxgl-interactive"),
this._canvas = o("canvas", "mapboxgl-canvas", t),
this._canvas.addEventListener("webglcontextlost", this._contextLost, !1),
this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1),
this._canvas.setAttribute("tabindex", "0"),
this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")),
this._canvas.setAttribute("role", "region"),
this._updateContainerDimensions(),
this._resizeCanvas(this._containerWidth, this._containerHeight);
const i = this._controlContainer = o("div", "mapboxgl-control-container", e)
, r = this._controlPositions = {};
["top-left", "top-right", "bottom-left", "bottom-right"].forEach((e=>{
r[e] = o("div", `mapboxgl-ctrl-${e}`, i)
}
)),
this._container.addEventListener("scroll", this._onMapScroll, !1)
}
_resizeCanvas(t, i) {
const r = e.exported.devicePixelRatio || 1;
this._canvas.width = r * Math.ceil(t),
this._canvas.height = r * Math.ceil(i),
this._canvas.style.width = `${t}px`,
this._canvas.style.height = `${i}px`
}
_addMarker(e) {
this._markers.push(e)
}
_removeMarker(e) {
const t = this._markers.indexOf(e);
-1 !== t && this._markers.splice(t, 1)
}
_setupPainter() {
const t = e.extend({}, i.webGLContextAttributes, {
failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat,
preserveDrawingBuffer: this._preserveDrawingBuffer,
antialias: this._antialias || !1
})
, r = this._canvas.getContext("webgl", t) || this._canvas.getContext("experimental-webgl", t);
r ? (e.storeAuthState(r, !0),
this.painter = new Rr(r,this.transform),
this.on("data", (e=>{
"source" === e.dataType && this.painter.setTileLoadedFlag(!0)
}
)),
e.exported$1.testSupport(r)) : this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))
}
_contextLost(t) {
t.preventDefault(),
this._frame && (this._frame.cancel(),
this._frame = null),
this.fire(new e.Event("webglcontextlost",{
originalEvent: t
}))
}
_contextRestored(t) {
this._setupPainter(),
this.resize(),
this._update(),
this.fire(new e.Event("webglcontextrestored",{
originalEvent: t
}))
}
_onMapScroll(e) {
if (e.target === this._container)
return this._container.scrollTop = 0,
this._container.scrollLeft = 0,
!1
}
loaded() {
return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded()
}
_update(e) {
return this.style ? (this._styleDirty = this._styleDirty || e,
this._sourcesDirty = !0,
this.triggerRepaint(),
this) : this
}
_requestRenderFrame(e) {
return this._update(),
this._renderTaskQueue.add(e)
}
_cancelRenderFrame(e) {
this._renderTaskQueue.remove(e)
}
_requestDomTask(e) {
!this.loaded() || this.loaded() && !this.isMoving() ? e() : this._domRenderTaskQueue.add(e)
}
_render(t) {
let i;
const r = this.painter.context.extTimerQuery
, n = e.exported.now();
if (this.listens("gpu-timing-frame") && (i = r.createQueryEXT(),
r.beginQueryEXT(r.TIME_ELAPSED_EXT, i)),
this.painter.context.setDirty(),
this.painter.setBaseState(),
this._renderTaskQueue.run(t),
this._domRenderTaskQueue.run(t),
this._removed)
return;
this._updateProjectionTransition();
let o = !1;
const s = this._isInitialLoad ? 0 : this._fadeDuration;
if (this.style && this._styleDirty) {
this._styleDirty = !1;
const t = this.transform.zoom
, i = this.transform.pitch
, r = e.exported.now();
this.style.zoomHistory.update(t, r);
const n = new e.EvaluationParameters(t,{
now: r,
fadeDuration: s,
pitch: i,
zoomHistory: this.style.zoomHistory,
transition: this.style.getTransition()
})
, a = n.crossFadingFactor();
1 === a && a === this._crossFadingFactor || (o = !0,
this._crossFadingFactor = a),
this.style.update(n)
}
this.style && this.style.fog && this.style.fog.hasTransition() && (this.style._markersNeedUpdate = !0,
this._sourcesDirty = !0);
let a = !1;
if (this.style && this._sourcesDirty ? (this._sourcesDirty = !1,
this.painter._updateFog(this.style),
this._updateTerrain(),
a = this._updateAverageElevation(n),
this.style._updateSources(this.transform),
this._forceMarkerUpdate()) : a = this._updateAverageElevation(n),
this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, s, this._crossSourceCollisions),
this.style && this.painter.render(this.style, {
showTileBoundaries: this.showTileBoundaries,
showTerrainWireframe: this.showTerrainWireframe,
showOverdrawInspector: this._showOverdrawInspector,
showQueryGeometry: !!this._showQueryGeometry,
rotating: this.isRotating(),
zooming: this.isZooming(),
moving: this.isMoving(),
fadeDuration: s,
isInitialLoad: this._isInitialLoad,
showPadding: this.showPadding,
gpuTiming: !!this.listens("gpu-timing-layer"),
gpuTimingDeferredRender: !!this.listens("gpu-timing-deferred-render"),
speedIndexTiming: this.speedIndexTiming
}),
this.fire(new e.Event("render")),
this.loaded() && !this._loaded && (this._loaded = !0,
this.fire(new e.Event("load"))),
this.style && (this.style.hasTransitions() || o) && (this._styleDirty = !0),
this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(),
i) {
const t = e.exported.now() - n;
r.endQueryEXT(r.TIME_ELAPSED_EXT, i),
setTimeout((()=>{
const o = r.getQueryObjectEXT(i, r.QUERY_RESULT_EXT) / 1e6;
r.deleteQueryEXT(i),
this.fire(new e.Event("gpu-timing-frame",{
cpuTime: t,
gpuTime: o
})),
e.window.performance.mark("frame-gpu", {
startTime: n,
detail: {
gpuTime: o
}
})
}
), 50)
}
if (this.listens("gpu-timing-layer")) {
const t = this.painter.collectGpuTimers();
setTimeout((()=>{
const i = this.painter.queryGpuTimers(t);
this.fire(new e.Event("gpu-timing-layer",{
layerTimes: i
}))
}
), 50)
}
if (this.listens("gpu-timing-deferred-render")) {
const t = this.painter.collectDeferredRenderGpuQueries();
setTimeout((()=>{
const i = this.painter.queryGpuTimeDeferredRender(t);
this.fire(new e.Event("gpu-timing-deferred-render",{
gpuTime: i
}))
}
), 50)
}
const l = this._sourcesDirty || this._styleDirty || this._placementDirty || a;
if (l || this._repaint)
this.triggerRepaint();
else {
const t = !this.isMoving() && this.loaded();
if (t && (a = this._updateAverageElevation(n, !0)),
a)
this.triggerRepaint();
else if (this._triggerFrame(!1),
t && (this.fire(new e.Event("idle")),
this._isInitialLoad = !1,
this.speedIndexTiming)) {
const t = this._calculateSpeedIndex();
this.fire(new e.Event("speedindexcompleted",{
speedIndex: t
})),
this.speedIndexTiming = !1
}
}
!this._loaded || this._fullyLoaded || l || (this._fullyLoaded = !0,
this._authenticate())
}
_forceMarkerUpdate() {
for (const e of this._markers)
e._update()
}
_updateAverageElevation(e, t=!1) {
const i = e=>(this.transform.averageElevation = e,
this._update(!1),
!0);
if (!this.painter.averageElevationNeedsEasing())
return 0 !== this.transform.averageElevation && i(0);
if ((t || e - this._averageElevationLastSampledAt > 500) && !this._averageElevation.isEasing(e)) {
const t = this.transform.averageElevation;
let r = this.transform.sampleAverageElevation()
, n = !1;
this.transform.elevation && (n = this.transform.elevation.exaggeration() !== this._averageElevationExaggeration,
this._averageElevationExaggeration = this.transform.elevation.exaggeration()),
isNaN(r) ? r = 0 : this._averageElevationLastSampledAt = e;
const o = Math.abs(t - r);
if (o > 1) {
if (this._isInitialLoad || n)
return this._averageElevation.jumpTo(r),
i(r);
this._averageElevation.easeTo(r, e, 300)
} else if (o > 1e-4)
return this._averageElevation.jumpTo(r),
i(r)
}
return !!this._averageElevation.isEasing(e) && i(this._averageElevation.getValue(e))
}
_authenticate() {
e.getMapSessionAPI(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (t=>{
if (t && (t.message === e.AUTH_ERR_MSG || 401 === t.status)) {
const t = this.painter.context.gl;
e.storeAuthState(t, !1),
this._logoControl instanceof Jn && this._logoControl._updateLogo(),
t && t.clear(t.DEPTH_BUFFER_BIT | t.COLOR_BUFFER_BIT | t.STENCIL_BUFFER_BIT),
this._silenceAuthErrors || this.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))
}
}
)),
e.postMapLoadEvent(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (()=>{}
))
}
_updateTerrain() {
this.painter.updateTerrain(this.style, this.isMoving() || this.isRotating() || this.isZooming())
}
_calculateSpeedIndex() {
const e = this.painter.canvasCopy()
, t = this.painter.getCanvasCopiesAndTimestamps();
t.timeStamps.push(performance.now());
const i = this.painter.context.gl
, r = i.createFramebuffer();
function n(e) {
i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, e, 0);
const t = new Uint8Array(i.drawingBufferWidth * i.drawingBufferHeight * 4);
return i.readPixels(0, 0, i.drawingBufferWidth, i.drawingBufferHeight, i.RGBA, i.UNSIGNED_BYTE, t),
t
}
return i.bindFramebuffer(i.FRAMEBUFFER, r),
this._canvasPixelComparison(n(e), t.canvasCopies.map(n), t.timeStamps)
}
_canvasPixelComparison(e, t, i) {
let r = i[1] - i[0];
const n = e.length / 4;
for (let o = 0; o < t.length; o++) {
const s = t[o];
let a = 0;
for (let t = 0; t < s.length; t += 4)
s[t] === e[t] && s[t + 1] === e[t + 1] && s[t + 2] === e[t + 2] && s[t + 3] === e[t + 3] && (a += 1);
r += (i[o + 2] - i[o + 1]) * (1 - a / n)
}
return r
}
remove() {
this._hash && this._hash.remove();
for (const e of this._controls)
e.onRemove(this);
this._controls = [],
this._frame && (this._frame.cancel(),
this._frame = null),
this._renderTaskQueue.clear(),
this._domRenderTaskQueue.clear(),
this.style && this.style.destroy(),
this.painter.destroy(),
this.handlers && this.handlers.destroy(),
this.handlers = void 0,
this.setStyle(null),
void 0 !== e.window && (e.window.removeEventListener("resize", this._onWindowResize, !1),
e.window.removeEventListener("orientationchange", this._onWindowResize, !1),
e.window.removeEventListener("webkitfullscreenchange", this._onWindowResize, !1),
e.window.removeEventListener("online", this._onWindowOnline, !1));
const t = this.painter.context.gl.getExtension("WEBGL_lose_context");
t && t.loseContext(),
so(this._canvasContainer),
so(this._controlContainer),
so(this._missingCSSCanary),
this._container.classList.remove("mapboxgl-map"),
e.removeAuthState(this.painter.context.gl),
this._removed = !0,
this.fire(new e.Event("remove"))
}
triggerRepaint() {
this._triggerFrame(!0)
}
_triggerFrame(t) {
this._renderNextFrame = this._renderNextFrame || t,
this.style && !this._frame && (this._frame = e.exported.frame((e=>{
const t = !!this._renderNextFrame;
this._frame = null,
this._renderNextFrame = null,
t && this._render(e)
}
)))
}
_preloadTiles(t) {
const i = this.style ? Object.values(this.style._sourceCaches) : [];
return e.asyncAll(i, ((e,i)=>e._preloadTiles(t, i)), (()=>{
this.triggerRepaint()
}
)),
this
}
_onWindowOnline() {
this._update()
}
_onWindowResize(e) {
this._trackResize && this.resize({
originalEvent: e
})._update()
}
get showTileBoundaries() {
return !!this._showTileBoundaries
}
set showTileBoundaries(e) {
this._showTileBoundaries !== e && (this._showTileBoundaries = e,
this._update())
}
get showTerrainWireframe() {
return !!this._showTerrainWireframe
}
set showTerrainWireframe(e) {
this._showTerrainWireframe !== e && (this._showTerrainWireframe = e,
this._update())
}
get speedIndexTiming() {
return !!this._speedIndexTiming
}
set speedIndexTiming(e) {
this._speedIndexTiming !== e && (this._speedIndexTiming = e,
this._update())
}
get showPadding() {
return !!this._showPadding
}
set showPadding(e) {
this._showPadding !== e && (this._showPadding = e,
this._update())
}
get showCollisionBoxes() {
return !!this._showCollisionBoxes
}
set showCollisionBoxes(e) {
this._showCollisionBoxes !== e && (this._showCollisionBoxes = e,
e ? this.style._generateCollisionBoxes() : this._update())
}
get showOverdrawInspector() {
return !!this._showOverdrawInspector
}
set showOverdrawInspector(e) {
this._showOverdrawInspector !== e && (this._showOverdrawInspector = e,
this._update())
}
get repaint() {
return !!this._repaint
}
set repaint(e) {
this._repaint !== e && (this._repaint = e,
this.triggerRepaint())
}
get vertices() {
return !!this._vertices
}
set vertices(e) {
this._vertices = e,
this._update()
}
_setCacheLimits(t, i) {
e.setCacheLimits(t, i)
}
get version() {
return e.version
}
}
,
NavigationControl: class {
constructor(t) {
this.options = e.extend({}, ao, t),
this._container = o("div", "mapboxgl-ctrl mapboxgl-ctrl-group"),
this._container.addEventListener("contextmenu", (e=>e.preventDefault())),
this.options.showZoom && (e.bindAll(["_setButtonTitle", "_updateZoomButtons"], this),
this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", (e=>{
this._map && this._map.zoomIn({}, {
originalEvent: e
})
}
)),
o("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"),
this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", (e=>{
this._map && this._map.zoomOut({}, {
originalEvent: e
})
}
)),
o("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")),
this.options.showCompass && (e.bindAll(["_rotateCompassArrow"], this),
this._compass = this._createButton("mapboxgl-ctrl-compass", (e=>{
const t = this._map;
t && (this.options.visualizePitch ? t.resetNorthPitch({}, {
originalEvent: e
}) : t.resetNorth({}, {
originalEvent: e
}))
}
)),
this._compassIcon = o("span", "mapboxgl-ctrl-icon", this._compass),
this._compassIcon.setAttribute("aria-hidden", "true"))
}
_updateZoomButtons() {
const e = this._map;
if (!e)
return;
const t = e.getZoom()
, i = t === e.getMaxZoom()
, r = t === e.getMinZoom();
this._zoomInButton.disabled = i,
this._zoomOutButton.disabled = r,
this._zoomInButton.setAttribute("aria-disabled", i.toString()),
this._zoomOutButton.setAttribute("aria-disabled", r.toString())
}
_rotateCompassArrow() {
const e = this._map;
if (!e)
return;
const t = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(e.transform.pitch * (Math.PI / 180)), .5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle * (180 / Math.PI)}deg)` : `rotate(${e.transform.angle * (180 / Math.PI)}deg)`;
e._requestDomTask((()=>{
this._compassIcon && (this._compassIcon.style.transform = t)
}
))
}
onAdd(e) {
return this._map = e,
this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"),
this._setButtonTitle(this._zoomOutButton, "ZoomOut"),
e.on("zoom", this._updateZoomButtons),
this._updateZoomButtons()),
this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"),
this.options.visualizePitch && e.on("pitch", this._rotateCompassArrow),
e.on("rotate", this._rotateCompassArrow),
this._rotateCompassArrow(),
this._handler = new lo(e,this._compass,this.options.visualizePitch)),
this._container
}
onRemove() {
const e = this._map;
e && (this._container.remove(),
this.options.showZoom && e.off("zoom", this._updateZoomButtons),
this.options.showCompass && (this.options.visualizePitch && e.off("pitch", this._rotateCompassArrow),
e.off("rotate", this._rotateCompassArrow),
this._handler && this._handler.off(),
this._handler = void 0),
this._map = void 0)
}
_createButton(e, t) {
const i = o("button", e, this._container);
return i.type = "button",
i.addEventListener("click", t),
i
}
_setButtonTitle(e, t) {
if (!this._map)
return;
const i = this._map._getUIString(`NavigationControl.${t}`);
e.setAttribute("aria-label", i),
e.firstElementChild && e.firstElementChild.setAttribute("title", i)
}
}
,
GeolocateControl: class extends e.Evented {
constructor(t) {
super(),
this.options = e.extend({
geolocation: e.window.navigator.geolocation
}, co, t),
e.bindAll(["_onSuccess", "_onError", "_onZoom", "_finish", "_setupUI", "_updateCamera", "_updateMarker", "_updateMarkerRotation", "_onDeviceOrientation"], this),
this._updateMarkerRotationThrottled = Kr(this._updateMarkerRotation, 20),
this._numberOfWatches = 0
}
onAdd(e) {
return this._map = e,
this._container = o("div", "mapboxgl-ctrl mapboxgl-ctrl-group"),
this._checkGeolocationSupport(this._setupUI),
this._container
}
onRemove() {
void 0 !== this._geolocationWatchID && (this.options.geolocation.clearWatch(this._geolocationWatchID),
this._geolocationWatchID = void 0),
this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(),
this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(),
this._container.remove(),
this._map.off("zoom", this._onZoom),
this._map = void 0,
this._numberOfWatches = 0,
this._noTimeout = !1
}
_checkGeolocationSupport(t) {
void 0 !== this._supportsGeolocation ? t(this._supportsGeolocation) : void 0 !== e.window.navigator.permissions ? e.window.navigator.permissions.query({
name: "geolocation"
}).then((e=>{
this._supportsGeolocation = "denied" !== e.state,
t(this._supportsGeolocation)
}
)) : (this._supportsGeolocation = !!this.options.geolocation,
t(this._supportsGeolocation))
}
_isOutOfMapMaxBounds(e) {
const t = this._map.getMaxBounds()
, i = e.coords;
return !!t && (i.longitude < t.getWest() || i.longitude > t.getEast() || i.latitude < t.getSouth() || i.latitude > t.getNorth())
}
_setErrorState() {
switch (this._watchState) {
case "WAITING_ACTIVE":
this._watchState = "ACTIVE_ERROR",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");
break;
case "ACTIVE_LOCK":
this._watchState = "ACTIVE_ERROR",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");
break;
case "BACKGROUND":
this._watchState = "BACKGROUND_ERROR",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")
}
}
_onSuccess(t) {
if (this._map) {
if (this._isOutOfMapMaxBounds(t))
return this._setErrorState(),
this.fire(new e.Event("outofmaxbounds",t)),
this._updateMarker(),
void this._finish();
if (this.options.trackUserLocation)
switch (this._lastKnownPosition = t,
this._watchState) {
case "WAITING_ACTIVE":
case "ACTIVE_LOCK":
case "ACTIVE_ERROR":
this._watchState = "ACTIVE_LOCK",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
break;
case "BACKGROUND":
case "BACKGROUND_ERROR":
this._watchState = "BACKGROUND",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")
}
this.options.showUserLocation && "OFF" !== this._watchState && this._updateMarker(t),
this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(t),
this.options.showUserLocation && this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),
this.fire(new e.Event("geolocate",t)),
this._finish()
}
}
_updateCamera(t) {
const i = new e.LngLat(t.coords.longitude,t.coords.latitude)
, r = t.coords.accuracy
, n = this._map.getBearing()
, o = e.extend({
bearing: n
}, this.options.fitBoundsOptions);
this._map.fitBounds(i.toBounds(r), o, {
geolocateSource: !0
})
}
_updateMarker(t) {
if (t) {
const i = new e.LngLat(t.coords.longitude,t.coords.latitude);
this._accuracyCircleMarker.setLngLat(i).addTo(this._map),
this._userLocationDotMarker.setLngLat(i).addTo(this._map),
this._accuracy = t.coords.accuracy,
this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius()
} else
this._userLocationDotMarker.remove(),
this._accuracyCircleMarker.remove()
}
_updateCircleRadius() {
const t = this._map.transform
, i = e.mercatorZfromAltitude(1, t._center.lat) * t.worldSize
, r = Math.ceil(2 * this._accuracy * i);
this._circleElement.style.width = `${r}px`,
this._circleElement.style.height = `${r}px`
}
_onZoom() {
this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius()
}
_updateMarkerRotation() {
this._userLocationDotMarker && "number" == typeof this._heading ? (this._userLocationDotMarker.setRotation(this._heading),
this._dotElement.classList.add("mapboxgl-user-location-show-heading")) : (this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),
this._userLocationDotMarker.setRotation(0))
}
_onError(t) {
if (this._map) {
if (this.options.trackUserLocation)
if (1 === t.code) {
this._watchState = "OFF",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),
this._geolocateButton.disabled = !0;
const e = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.setAttribute("aria-label", e),
this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e),
void 0 !== this._geolocationWatchID && this._clearWatch()
} else {
if (3 === t.code && this._noTimeout)
return;
this._setErrorState()
}
"OFF" !== this._watchState && this.options.showUserLocation && this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),
this.fire(new e.Event("error",t)),
this._finish()
}
}
_finish() {
this._timeoutId && clearTimeout(this._timeoutId),
this._timeoutId = void 0
}
_setupUI(t) {
if (this._container.addEventListener("contextmenu", (e=>e.preventDefault())),
this._geolocateButton = o("button", "mapboxgl-ctrl-geolocate", this._container),
o("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"),
this._geolocateButton.type = "button",
!1 === t) {
e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");
const t = this._map._getUIString("GeolocateControl.LocationNotAvailable");
this._geolocateButton.disabled = !0,
this._geolocateButton.setAttribute("aria-label", t),
this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", t)
} else {
const e = this._map._getUIString("GeolocateControl.FindMyLocation");
this._geolocateButton.setAttribute("aria-label", e),
this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e)
}
this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"),
this._watchState = "OFF"),
this.options.showUserLocation && (this._dotElement = o("div", "mapboxgl-user-location"),
this._dotElement.appendChild(o("div", "mapboxgl-user-location-dot")),
this._dotElement.appendChild(o("div", "mapboxgl-user-location-heading")),
this._userLocationDotMarker = new io({
element: this._dotElement,
rotationAlignment: "map",
pitchAlignment: "map"
}),
this._circleElement = o("div", "mapboxgl-user-location-accuracy-circle"),
this._accuracyCircleMarker = new io({
element: this._circleElement,
pitchAlignment: "map"
}),
this.options.trackUserLocation && (this._watchState = "OFF"),
this._map.on("zoom", this._onZoom)),
this._geolocateButton.addEventListener("click", this.trigger.bind(this)),
this._setup = !0,
this.options.trackUserLocation && this._map.on("movestart", (t=>{
t.geolocateSource || "ACTIVE_LOCK" !== this._watchState || t.originalEvent && "resize" === t.originalEvent.type || (this._watchState = "BACKGROUND",
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),
this.fire(new e.Event("trackuserlocationend")))
}
))
}
_onDeviceOrientation(e) {
this._userLocationDotMarker && (e.webkitCompassHeading ? this._heading = e.webkitCompassHeading : !0 === e.absolute && (this._heading = -1 * e.alpha),
this._updateMarkerRotationThrottled())
}
trigger() {
if (!this._setup)
return e.warnOnce("Geolocate control triggered before added to a map"),
!1;
if (this.options.trackUserLocation) {
switch (this._watchState) {
case "OFF":
this._watchState = "WAITING_ACTIVE",
this.fire(new e.Event("trackuserlocationstart"));
break;
case "WAITING_ACTIVE":
case "ACTIVE_LOCK":
case "ACTIVE_ERROR":
case "BACKGROUND_ERROR":
this._numberOfWatches--,
this._noTimeout = !1,
this._watchState = "OFF",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),
this.fire(new e.Event("trackuserlocationend"));
break;
case "BACKGROUND":
this._watchState = "ACTIVE_LOCK",
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),
this._lastKnownPosition && this._updateCamera(this._lastKnownPosition),
this.fire(new e.Event("trackuserlocationstart"))
}
switch (this._watchState) {
case "WAITING_ACTIVE":
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
break;
case "ACTIVE_LOCK":
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");
break;
case "ACTIVE_ERROR":
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");
break;
case "BACKGROUND":
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");
break;
case "BACKGROUND_ERROR":
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")
}
if ("OFF" === this._watchState && void 0 !== this._geolocationWatchID)
this._clearWatch();
else if (void 0 === this._geolocationWatchID) {
let e;
this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.setAttribute("aria-pressed", "true"),
this._numberOfWatches++,
this._numberOfWatches > 1 ? (e = {
maximumAge: 6e5,
timeout: 0
},
this._noTimeout = !0) : (e = this.options.positionOptions,
this._noTimeout = !1),
this._geolocationWatchID = this.options.geolocation.watchPosition(this._onSuccess, this._onError, e),
this.options.showUserHeading && this._addDeviceOrientationListener()
}
} else
this.options.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions),
this._timeoutId = setTimeout(this._finish, 1e4);
return !0
}
_addDeviceOrientationListener() {
const t = ()=>{
e.window.addEventListener("ondeviceorientationabsolute"in e.window ? "deviceorientationabsolute" : "deviceorientation", this._onDeviceOrientation)
}
;
void 0 !== e.window.DeviceMotionEvent && "function" == typeof e.window.DeviceMotionEvent.requestPermission ? DeviceOrientationEvent.requestPermission().then((e=>{
"granted" === e && t()
}
)).catch(console.error) : t()
}
_clearWatch() {
this.options.geolocation.clearWatch(this._geolocationWatchID),
e.window.removeEventListener("deviceorientation", this._onDeviceOrientation),
e.window.removeEventListener("deviceorientationabsolute", this._onDeviceOrientation),
this._geolocationWatchID = void 0,
this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),
this._geolocateButton.setAttribute("aria-pressed", "false"),
this.options.showUserLocation && this._updateMarker(null)
}
}
,
AttributionControl: Kn,
ScaleControl: class {
constructor(t) {
this.options = e.extend({}, uo, t),
function() {
try {
return new Intl.NumberFormat("en",{
style: "unit",
unitDisplay: "narrow",
unit: "meter"
}),
!0
} catch (e) {
return !1
}
}() || (this._setScale = ho.bind(this)),
e.bindAll(["_update", "_setScale", "setUnit"], this)
}
getDefaultPosition() {
return "bottom-left"
}
_update() {
const e = this.options.maxWidth || 100
, t = this._map
, i = t._containerHeight / 2
, r = t._containerWidth / 2 - e / 2
, n = t.unproject([r, i])
, o = t.unproject([r + e, i])
, s = n.distanceTo(o);
if ("imperial" === this.options.unit) {
const t = 3.2808 * s;
t > 5280 ? this._setScale(e, t / 5280, "mile") : this._setScale(e, t, "foot")
} else
"nautical" === this.options.unit ? this._setScale(e, s / 1852, "nautical-mile") : s >= 1e3 ? this._setScale(e, s / 1e3, "kilometer") : this._setScale(e, s, "meter")
}
_setScale(e, t, i) {
const r = po(t)
, n = r / t;
this._map._requestDomTask((()=>{
this._container.style.width = e * n + "px",
this._container.innerHTML = "nautical-mile" !== i ? new Intl.NumberFormat(this._language,{
style: "unit",
unitDisplay: "narrow",
unit: i
}).format(r) : `${r} nm`
}
))
}
onAdd(e) {
return this._map = e,
this._language = e.getLanguage(),
this._container = o("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", e.getContainer()),
this._container.dir = "auto",
this._map.on("move", this._update),
this._update(),
this._container
}
onRemove() {
this._container.remove(),
this._map.off("move", this._update),
this._map = void 0
}
_setLanguage(e) {
this._language = e,
this._update()
}
setUnit(e) {
this.options.unit = e,
this._update()
}
}
,
FullscreenControl: class {
constructor(t) {
this._fullscreen = !1,
t && t.container && (t.container instanceof e.window.HTMLElement ? this._container = t.container : e.warnOnce("Full screen control 'container' must be a DOM element.")),
e.bindAll(["_onClickFullscreen", "_changeIcon"], this),
"onfullscreenchange"in e.window.document ? this._fullscreenchange = "fullscreenchange" : "onwebkitfullscreenchange"in e.window.document && (this._fullscreenchange = "webkitfullscreenchange")
}
onAdd(t) {
return this._map = t,
this._container || (this._container = this._map.getContainer()),
this._controlContainer = o("div", "mapboxgl-ctrl mapboxgl-ctrl-group"),
this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none",
e.warnOnce("This device does not support fullscreen mode.")),
this._controlContainer
}
onRemove() {
this._controlContainer.remove(),
this._map = null,
e.window.document.removeEventListener(this._fullscreenchange, this._changeIcon)
}
_checkFullscreenSupport() {
return !(!e.window.document.fullscreenEnabled && !e.window.document.webkitFullscreenEnabled)
}
_setupUI() {
const t = this._fullscreenButton = o("button", "mapboxgl-ctrl-fullscreen", this._controlContainer);
o("span", "mapboxgl-ctrl-icon", t).setAttribute("aria-hidden", "true"),
t.type = "button",
this._updateTitle(),
this._fullscreenButton.addEventListener("click", this._onClickFullscreen),
e.window.document.addEventListener(this._fullscreenchange, this._changeIcon)
}
_updateTitle() {
const e = this._getTitle();
this._fullscreenButton.setAttribute("aria-label", e),
this._fullscreenButton.firstElementChild && this._fullscreenButton.firstElementChild.setAttribute("title", e)
}
_getTitle() {
return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter")
}
_isFullscreen() {
return this._fullscreen
}
_changeIcon() {
(e.window.document.fullscreenElement || e.window.document.webkitFullscreenElement) === this._container !== this._fullscreen && (this._fullscreen = !this._fullscreen,
this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),
this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),
this._updateTitle())
}
_onClickFullscreen() {
this._isFullscreen() ? e.window.document.exitFullscreen ? e.window.document.exitFullscreen() : e.window.document.webkitCancelFullScreen && e.window.document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen()
}
}
,
Popup: class extends e.Evented {
constructor(t) {
super(),
this.options = e.extend(Object.create(fo), t),
e.bindAll(["_update", "_onClose", "remove", "_onMouseEvent"], this),
this._classList = new Set(t && t.className ? t.className.trim().split(/\s+/) : [])
}
addTo(t) {
return this._map && this.remove(),
this._map = t,
this.options.closeOnClick && t.on("preclick", this._onClose),
this.options.closeOnMove && t.on("move", this._onClose),
t.on("remove", this.remove),
this._update(),
this._focusFirstElement(),
this._trackPointer ? (t.on("mousemove", this._onMouseEvent),
t.on("mouseup", this._onMouseEvent),
t._canvasContainer.classList.add("mapboxgl-track-pointer")) : t.on("move", this._update),
this.fire(new e.Event("open")),
this
}
isOpen() {
return !!this._map
}
remove() {
this._content && this._content.remove(),
this._container && (this._container.remove(),
this._container = void 0);
const t = this._map;
return t && (t.off("move", this._update),
t.off("move", this._onClose),
t.off("preclick", this._onClose),
t.off("click", this._onClose),
t.off("remove", this.remove),
t.off("mousemove", this._onMouseEvent),
t.off("mouseup", this._onMouseEvent),
t.off("drag", this._onMouseEvent),
this._map = void 0),
this.fire(new e.Event("close")),
this
}
getLngLat() {
return this._lngLat
}
setLngLat(t) {
this._lngLat = e.LngLat.convert(t),
this._pos = null,
this._trackPointer = !1,
this._update();
const i = this._map;
return i && (i.on("move", this._update),
i.off("mousemove", this._onMouseEvent),
i._canvasContainer.classList.remove("mapboxgl-track-pointer")),
this
}
trackPointer() {
this._trackPointer = !0,
this._pos = null,
this._update();
const e = this._map;
return e && (e.off("move", this._update),
e.on("mousemove", this._onMouseEvent),
e.on("drag", this._onMouseEvent),
e._canvasContainer.classList.add("mapboxgl-track-pointer")),
this
}
getElement() {
return this._container
}
setText(t) {
return this.setDOMContent(e.window.document.createTextNode(t))
}
setHTML(t) {
const i = e.window.document.createDocumentFragment()
, r = e.window.document.createElement("body");
let n;
for (r.innerHTML = t; n = r.firstChild,
n; )
i.appendChild(n);
return this.setDOMContent(i)
}
getMaxWidth() {
return this._container && this._container.style.maxWidth
}
setMaxWidth(e) {
return this.options.maxWidth = e,
this._update(),
this
}
setDOMContent(e) {
let t = this._content;
if (t)
for (; t.hasChildNodes(); )
t.firstChild && t.removeChild(t.firstChild);
else
t = this._content = o("div", "mapboxgl-popup-content", this._container || void 0);
if (t.appendChild(e),
this.options.closeButton) {
const e = this._closeButton = o("button", "mapboxgl-popup-close-button", t);
e.type = "button",
e.setAttribute("aria-label", "Close popup"),
e.setAttribute("aria-hidden", "true"),
e.innerHTML = "×",
e.addEventListener("click", this._onClose)
}
return this._update(),
this._focusFirstElement(),
this
}
addClassName(e) {
return this._classList.add(e),
this._updateClassList(),
this
}
removeClassName(e) {
return this._classList.delete(e),
this._updateClassList(),
this
}
setOffset(e) {
return this.options.offset = e,
this._update(),
this
}
toggleClassName(e) {
let t;
return this._classList.delete(e) ? t = !1 : (this._classList.add(e),
t = !0),
this._updateClassList(),
t
}
_onMouseEvent(e) {
this._update(e.point)
}
_getAnchor(e) {
if (this.options.anchor)
return this.options.anchor;
const t = this._map
, i = this._container
, r = this._pos;
if (!t || !i || !r)
return "bottom";
const n = i.offsetWidth
, o = i.offsetHeight
, s = r.x < n / 2
, a = r.x > t.transform.width - n / 2;
if (r.y + e < o)
return s ? "top-left" : a ? "top-right" : "top";
if (r.y > t.transform.height - o) {
if (s)
return "bottom-left";
if (a)
return "bottom-right"
}
return s ? "left" : a ? "right" : "bottom"
}
_updateClassList() {
const e = this._container;
if (!e)
return;
const t = [...this._classList];
t.push("mapboxgl-popup"),
this._anchor && t.push(`mapboxgl-popup-anchor-${this._anchor}`),
this._trackPointer && t.push("mapboxgl-popup-track-pointer"),
e.className = t.join(" ")
}
_update(t) {
const i = this._map
, r = this._content;
if (!i || !this._lngLat && !this._trackPointer || !r)
return;
let n = this._container;
if (n || (n = this._container = o("div", "mapboxgl-popup", i.getContainer()),
this._tip = o("div", "mapboxgl-popup-tip", n),
n.appendChild(r)),
this.options.maxWidth && n.style.maxWidth !== this.options.maxWidth && (n.style.maxWidth = this.options.maxWidth),
i.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = eo(this._lngLat, this._pos, i.transform)),
!this._trackPointer || t) {
const e = this._pos = this._trackPointer && t ? t : i.project(this._lngLat)
, r = _o(this.options.offset)
, n = this._anchor = this._getAnchor(r.y)
, o = _o(this.options.offset, n)
, s = e.add(o).round();
i._requestDomTask((()=>{
this._container && n && (this._container.style.transform = `${to[n]} translate(${s.x}px,${s.y}px)`)
}
))
}
if (!this._marker && i._showingGlobe()) {
const t = e.isLngLatBehindGlobe(i.transform, this._lngLat) ? 0 : 1;
this._setOpacity(t)
}
this._updateClassList()
}
_focusFirstElement() {
if (!this.options.focusAfterOpen || !this._container)
return;
const e = this._container.querySelector(mo);
e && e.focus()
}
_onClose() {
this.remove()
}
_setOpacity(e) {
this._container && (this._container.style.opacity = `${e}`),
this._content && (this._content.style.pointerEvents = e ? "auto" : "none")
}
}
,
Marker: io,
Style: ei,
LngLat: e.LngLat,
LngLatBounds: e.LngLatBounds,
Point: e.pointGeometry,
MercatorCoordinate: e.MercatorCoordinate,
FreeCameraOptions: Nr,
Evented: e.Evented,
config: e.config,
prewarm: function() {
je().acquire(Fe)
},
clearPrewarmedResources: function() {
const e = Ve;
e && (e.isPreloaded() && 1 === e.numActive() ? (e.release(Fe),
Ve = null) : console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))
},
get accessToken() {
return e.config.ACCESS_TOKEN
},
set accessToken(t) {
e.config.ACCESS_TOKEN = t
},
get baseApiUrl() {
return e.config.API_URL
},
set baseApiUrl(t) {
e.config.API_URL = t
},
get workerCount() {
return Ue.workerCount
},
set workerCount(e) {
Ue.workerCount = e
},
get maxParallelImageRequests() {
return e.config.MAX_PARALLEL_IMAGE_REQUESTS
},
set maxParallelImageRequests(t) {
e.config.MAX_PARALLEL_IMAGE_REQUESTS = t
},
clearStorage(t) {
e.clearTileCache(t)
},
workerUrl: "",
workerClass: null,
setNow: e.exported.setNow,
restoreNow: e.exported.restoreNow
};
return go
}
)),
i
}()
},
112: ()=>{}
,
155: e=>{
var t, i, r = e.exports = {};
function n() {
throw new Error("setTimeout has not been defined")
}
function o() {
throw new Error("clearTimeout has not been defined")
}
function s(e) {
if (t === setTimeout)
return setTimeout(e, 0);
if ((t === n || !t) && setTimeout)
return t = setTimeout,
setTimeout(e, 0);
try {
return t(e, 0)
} catch (i) {
try {
return t.call(null, e, 0)
} catch (i) {
return t.call(this, e, 0)
}
}
}
!function() {
try {
t = "function" == typeof setTimeout ? setTimeout : n
} catch (e) {
t = n
}
try {
i = "function" == typeof clearTimeout ? clearTimeout : o
} catch (e) {
i = o
}
}();
var a, l = [], c = !1, u = -1;
function h() {
c && a && (c = !1,
a.length ? l = a.concat(l) : u = -1,
l.length && d())
}
function d() {
if (!c) {
var e = s(h);
c = !0;
for (var t = l.length; t; ) {
for (a = l,
l = []; ++u < t; )
a && a[u].run();
u = -1,
t = l.length
}
a = null,
c = !1,
function(e) {
if (i === clearTimeout)
return clearTimeout(e);
if ((i === o || !i) && clearTimeout)
return i = clearTimeout,
clearTimeout(e);
try {
i(e)
} catch (t) {
try {
return i.call(null, e)
} catch (t) {
return i.call(this, e)
}
}
}(e)
}
}
function p(e, t) {
this.fun = e,
this.array = t
}
function f() {}
r.nextTick = function(e) {
var t = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var i = 1; i < arguments.length; i++)
t[i - 1] = arguments[i];
l.push(new p(e,t)),
1 !== l.length || c || s(d)
}
,
p.prototype.run = function() {
this.fun.apply(null, this.array)
}
,
r.title = "browser",
r.browser = !0,
r.env = {},
r.argv = [],
r.version = "",
r.versions = {},
r.on = f,
r.addListener = f,
r.once = f,
r.off = f,
r.removeListener = f,
r.removeAllListeners = f,
r.emit = f,
r.prependListener = f,
r.prependOnceListener = f,
r.listeners = function(e) {
return []
}
,
r.binding = function(e) {
throw new Error("process.binding is not supported")
}
,
r.cwd = function() {
return "/"
}
,
r.chdir = function(e) {
throw new Error("process.chdir is not supported")
}
,
r.umask = function() {
return 0
}
}
}, i = {};
function r(e) {
var n = i[e];
if (void 0 !== n)
return n.exports;
var o = i[e] = {
exports: {}
};
return t[e].call(o.exports, o, o.exports, r),
o.exports
}
r.m = t,
e = [],
r.O = (t,i,n,o)=>{
if (!i) {
var s = 1 / 0;
for (u = 0; u < e.length; u++) {
for (var [i,n,o] = e[u], a = !0, l = 0; l < i.length; l++)
(!1 & o || s >= o) && Object.keys(r.O).every((e=>r.O[e](i[l]))) ? i.splice(l--, 1) : (a = !1,
o < s && (s = o));
if (a) {
e.splice(u--, 1);
var c = n();
void 0 !== c && (t = c)
}
}
return t
}
o = o || 0;
for (var u = e.length; u > 0 && e[u - 1][2] > o; u--)
e[u] = e[u - 1];
e[u] = [i, n, o]
}
,
r.n = e=>{
var t = e && e.__esModule ? ()=>e.default : ()=>e;
return r.d(t, {
a: t
}),
t
}
,
r.d = (e,t)=>{
for (var i in t)
r.o(t, i) && !r.o(e, i) && Object.defineProperty(e, i, {
enumerable: !0,
get: t[i]
})
}
,
r.o = (e,t)=>Object.prototype.hasOwnProperty.call(e, t),
(()=>{
var e = {
522: 0,
870: 0
};
r.O.j = t=>0 === e[t];
var t = (t,i)=>{
var n, o, [s,a,l] = i, c = 0;
if (s.some((t=>0 !== e[t]))) {
for (n in a)
r.o(a, n) && (r.m[n] = a[n]);
if (l)
var u = l(r)
}
for (t && t(i); c < s.length; c++)
o = s[c],
r.o(e, o) && e[o] && e[o][0](),
e[o] = 0;
return r.O(u)
}
, i = self.webpackChunk = self.webpackChunk || [];
i.forEach(t.bind(null, 0)),
i.push = t.bind(null, i.push.bind(i))
}
)(),
r.O(void 0, [870], (()=>r(344)));
var n = r.O(void 0, [870], (()=>r(112)));
n = r.O(n)
}
)();


PK 99