From fc8c9b68ee26cf30a5cacf2ffc8956f3e17638d0 Mon Sep 17 00:00:00 2001 From: austaras Date: Thu, 28 Jul 2022 18:20:12 +0800 Subject: [PATCH] fix(es/minifier): calc function body cost when inline function --- crates/swc_ecma_minifier/src/analyzer/mod.rs | 2 +- .../src/analyzer/storage/normal.rs | 4 +- .../src/compress/optimize/iife.rs | 2 +- .../src/compress/optimize/inline.rs | 51 +- .../tests/fixture/issues/2257/full/output.js | 16 +- .../fixture/issues/emotion/react/1/output.js | 53 +- .../fixture/issues/firebase-core/1/output.js | 5 +- .../issues/firebase-firestore/1/output.js | 38 +- .../tests/fixture/issues/moment/1/output.js | 19 +- .../d6e1aeb5-38a8d7ae57119c23/output.js | 19 +- .../pages/index-cb36c1bf7f830e3c/output.js | 26 +- .../tests/fixture/next/36127/2/3/output.js | 55 +- .../tests/fixture/next/chakra/output.js | 7 +- .../next/feedback-2/codemirror/output.js | 44 +- .../pages/_app-72ad41192608e93a/output.js | 26 +- .../fixture/next/react-pdf-renderer/output.js | 1744 ++++++++--------- .../next/styled-components/1/output.js | 5 +- .../2c796e83-0724e2af5f19128a/output.js | 8 +- .../785-e1932cc99ac3bb67/output.js | 2 +- .../tests/projects/output/angular-1.2.5.js | 21 +- .../projects/output/jquery.mobile-1.4.2.js | 7 +- .../tests/projects/output/react-dom-17.0.2.js | 262 +-- .../compress/functions/issue_2783/output.js | 12 +- 23 files changed, 1137 insertions(+), 1291 deletions(-) diff --git a/crates/swc_ecma_minifier/src/analyzer/mod.rs b/crates/swc_ecma_minifier/src/analyzer/mod.rs index 211d1d796162..fa7545d7b70f 100644 --- a/crates/swc_ecma_minifier/src/analyzer/mod.rs +++ b/crates/swc_ecma_minifier/src/analyzer/mod.rs @@ -114,7 +114,7 @@ pub(crate) struct VarUsageInfo { pub no_side_effect_for_member_access: bool, - pub used_as_callee: bool, + pub callee_count: usize, pub used_as_arg: bool, diff --git a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs index 425d668bebbd..f60c1e87c838 100644 --- a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs +++ b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs @@ -70,7 +70,7 @@ impl Storage for ProgramData { e.get_mut().no_side_effect_for_member_access && var_info.no_side_effect_for_member_access; - e.get_mut().used_as_callee |= var_info.used_as_callee; + e.get_mut().callee_count += var_info.callee_count; e.get_mut().used_as_arg |= var_info.used_as_arg; e.get_mut().pure_fn |= var_info.pure_fn; @@ -247,7 +247,7 @@ impl VarDataLike for VarUsageInfo { } fn mark_used_as_callee(&mut self) { - self.used_as_callee = true; + self.callee_count += 1; } fn mark_used_as_arg(&mut self) { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs index aefa49a458fd..d991c5dd9f74 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/iife.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/iife.rs @@ -659,7 +659,7 @@ where self.data .vars .get(id) - .map(|usage| usage.ref_count == 1 && usage.used_as_callee) + .map(|usage| usage.ref_count == 1 && usage.callee_count > 0) .unwrap_or(false) }) { return true; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index a1973e8901a8..38608297b058 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -5,6 +5,7 @@ use swc_ecma_utils::{find_pat_ids, ExprExt, IdentUsageFinder}; use super::Optimizer; use crate::{ + analyzer::VarUsageInfo, compress::optimize::util::{class_has_side_effect, is_valid_for_lhs}, mode::Mode, util::{ @@ -311,7 +312,7 @@ where } } - if !usage.used_as_callee { + if usage.callee_count == 0 { if let Expr::Fn(..) | Expr::Arrow(..) = &**init { return; } @@ -365,8 +366,21 @@ where } /// Check if the body of a function is simple enough to inline. - fn is_fn_body_simple_enough_to_inline(&self, body: &BlockStmt, param_count: usize) -> bool { - let cost_limit = 3 + param_count * 2; + fn is_fn_body_simple_enough_to_inline( + &self, + body: &BlockStmt, + param_count: usize, + usage: &VarUsageInfo, + ) -> bool { + let param_cost = param_count * 2; + // if it's passed as value but not called, the function expr cannot be removed + let func_body_cost = if usage.ref_count == usage.callee_count { + // length of "function c(){}" + 14 / usage.usage_count + } else { + 0 + }; + let cost_limit = 3 + param_cost + func_body_cost; if body.stmts.len() == 1 { match &body.stmts[0] { @@ -490,6 +504,10 @@ where return; } + if usage.ref_count == 0 { + return; + } + // Inline very simple functions. match decl { Decl::Fn(f) if self.options.inline >= 2 && f.ident.sym != *"arguments" => { @@ -501,8 +519,14 @@ where && self.is_fn_body_simple_enough_to_inline( body, f.function.params.len(), + usage, ) { + if f.function.params.iter().any(|param| { + matches!(param.pat, Pat::Rest(..) | Pat::Assign(..)) + }) { + return; + } trace_op!( "inline: Decided to inline function '{}{:?}' as it's very \ simple", @@ -510,23 +534,12 @@ where f.ident.span.ctxt ); - if f.function.params.iter().any(|param| { - matches!(param.pat, Pat::Rest(..) | Pat::Assign(..)) - }) { - return; - } - self.vars.simple_functions.insert( i.to_id(), - match decl { - Decl::Fn(f) => Box::new(Expr::Fn(FnExpr { - ident: None, - function: f.function.clone(), - })), - _ => { - unreachable!() - } - }, + Box::new(Expr::Fn(FnExpr { + ident: None, + function: f.function.clone(), + })), ); return; } @@ -548,7 +561,7 @@ where // if (self.options.reduce_vars || self.options.collapse_vars || self.options.inline != 0) && usage.ref_count == 1 - && (usage.is_fn_local || (usage.used_as_callee && !usage.used_above_decl)) + && (usage.is_fn_local || (usage.callee_count > 0 && !usage.used_above_decl)) && !usage.executed_multiple_time && !usage.inline_prevented && (match decl { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js index 04ff9328d15a..6138f652e0b3 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js @@ -10152,9 +10152,6 @@ function escapeGroup(group) { return group.replace(/([=!:$\/()])/g, "\\$1"); } - function attachKeys(re, keys) { - return re.keys = keys, re; - } function flags(options) { return options && options.sensitive ? "" : "i"; } @@ -10168,13 +10165,13 @@ keys.push(token), token.repeat && (capture += "(?:" + prefix + capture + ")*"), route += capture = token.optional ? token.partial ? prefix + "(" + capture + ")?" : "(?:" + prefix + "(" + capture + "))?" : prefix + "(" + capture + ")"; } } - var delimiter = escapeString(options.delimiter || "/"), endsWithDelimiter = route.slice(-delimiter.length) === delimiter; - return strict || (route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + "(?:" + delimiter + "(?=$))?"), end ? route += "$" : route += strict && endsWithDelimiter ? "" : "(?=" + delimiter + "|$)", attachKeys(RegExp("^" + route, flags(options)), keys); + var re, keys1, delimiter = escapeString(options.delimiter || "/"), endsWithDelimiter = route.slice(-delimiter.length) === delimiter; + return strict || (route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + "(?:" + delimiter + "(?=$))?"), end ? route += "$" : route += strict && endsWithDelimiter ? "" : "(?=" + delimiter + "|$)", re = RegExp("^" + route, flags(options)), keys1 = keys, re.keys = keys1, re; } function pathToRegexp(path, keys, options) { var path1, keys1, options1; return (isarray(keys) || (options = keys || options, keys = []), options = options || {}, path instanceof RegExp) ? function(path, keys) { - var groups = path.source.match(/\((?!\?)/g); + var re, keys1, groups = path.source.match(/\((?!\?)/g); if (groups) for(var i = 0; i < groups.length; i++)keys.push({ name: i, prefix: null, @@ -10185,11 +10182,10 @@ asterisk: !1, pattern: null }); - return attachKeys(path, keys); + return re = path, keys1 = keys, re.keys = keys1, re; }(path, keys) : isarray(path) ? function(path, keys, options) { - for(var parts = [], i = 0; i < path.length; i++)parts.push(pathToRegexp(path[i], keys, options).source); - var regexp = RegExp("(?:" + parts.join("|") + ")", flags(options)); - return attachKeys(regexp, keys); + for(var re, keys1, parts = [], i = 0; i < path.length; i++)parts.push(pathToRegexp(path[i], keys, options).source); + return re = RegExp("(?:" + parts.join("|") + ")", flags(options)), keys1 = keys, re.keys = keys1, re; }(path, keys, options) : (path1 = path, keys1 = keys, tokensToRegExp(parse(path1, options1 = options), keys1, options1)); } }, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js index f0eaadf1d437..4346ee5c27dc 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/output.js @@ -43,15 +43,9 @@ }), this.tags = [], this.ctr = 0; }, StyleSheet; }(), abs = Math.abs, Utility_from = String.fromCharCode; - function trim(value) { - return value.trim(); - } function replace(value, pattern, replacement) { return value.replace(pattern, replacement); } - function indexof(value, search) { - return value.indexOf(search); - } function Utility_charat(value, index) { return 0 | value.charCodeAt(index); } @@ -61,9 +55,6 @@ function Utility_strlen(value) { return value.length; } - function Utility_sizeof(value) { - return value.length; - } function Utility_append(value, array) { return array.push(value), value; } @@ -94,9 +85,6 @@ function peek() { return Utility_charat(characters, position); } - function slice(begin, end) { - return Utility_substr(characters, begin, end); - } function token(type) { switch(type){ case 0: @@ -132,11 +120,9 @@ function alloc(value) { return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, []; } - function dealloc(value) { - return characters = "", value; - } function delimit(type) { - return trim(slice(position - 1, delimiter(91 === type ? type + 2 : 40 === type ? type + 1 : type))); + var begin, end; + return (begin = position - 1, end = delimiter(91 === type ? type + 2 : 40 === type ? type + 1 : type), Utility_substr(characters, begin, end)).trim(); } function whitespace(type) { for(; character = peek();)if (character < 33) next(); @@ -144,8 +130,8 @@ return token(type) > 2 || token(character) > 3 ? "" : " "; } function escaping(index, count) { - for(; --count && next() && !(character < 48) && !(character > 102) && (!(character > 57) || !(character < 65)) && (!(character > 70) || !(character < 97));); - return slice(index, position + (count < 6 && 32 == peek() && 32 == next())); + for(var begin, end; --count && next() && !(character < 48) && !(character > 102) && (!(character > 57) || !(character < 65)) && (!(character > 70) || !(character < 97));); + return begin = index, end = position + (count < 6 && 32 == peek() && 32 == next()), Utility_substr(characters, begin, end); } function delimiter(type) { for(; next();)switch(character){ @@ -165,15 +151,15 @@ function commenter(type, index) { for(; next();)if (type + character === 57) break; else if (type + character === 84 && 47 === peek()) break; - return "/*" + slice(index, position - 1) + "*" + Utility_from(47 === type ? type : next()); + return "/*" + Utility_substr(characters, index, position - 1) + "*" + Utility_from(47 === type ? type : next()); } function identifier(index) { for(; !token(peek());)next(); - return slice(index, position); + return Utility_substr(characters, index, position); } var MS = "-ms-", MOZ = "-moz-", WEBKIT = "-webkit-", COMMENT = "comm", Enum_RULESET = "rule", DECLARATION = "decl"; function serialize(children, callback) { - for(var output = "", length = Utility_sizeof(children), i = 0; i < length; i++)output += callback(children[i], i, children, callback) || ""; + for(var output = "", length = children.length, i = 0; i < length; i++)output += callback(children[i], i, children, callback) || ""; return output; } function stringify(element, index, children, callback) { @@ -189,7 +175,7 @@ return Utility_strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : ""; } function prefix(value, length) { - var value1; + var value1, search, search1; switch((((length << 2 ^ Utility_charat(value1 = value, 0)) << 2 ^ Utility_charat(value1, 1)) << 2 ^ Utility_charat(value1, 2)) << 2 ^ Utility_charat(value1, 3)){ case 5103: return WEBKIT + "print-" + value + value; @@ -274,13 +260,13 @@ case 102: return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (108 == Utility_charat(value, length + 3) ? "$3" : "$2-$3")) + value; case 115: - return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length) + value : value; + return ~(search = "stretch", value.indexOf(search)) ? prefix(replace(value, "stretch", "fill-available"), length) + value : value; } break; case 4949: if (115 !== Utility_charat(value, length + 1)) break; case 6444: - switch(Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, "!important") && 10))){ + switch(Utility_charat(value, Utility_strlen(value) - 3 - (~(search1 = "!important", value.indexOf(search1)) && 10))){ case 107: return replace(value, ":", ":" + WEBKIT) + value; case 101: @@ -385,7 +371,7 @@ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length) { for(var post = offset - 1, rule = 0 === offset ? rules : [ "" - ], size = Utility_sizeof(rule), i = 0, j = 0, k = 0; i < index; ++i)for(var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)(z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) && (props[k++] = z); + ], size = rule.length, i = 0, j = 0, k = 0; i < index; ++i)for(var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)(z = (j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x])).trim()) && (props[k++] = z); return node(value, root, parent, 0 === offset ? Enum_RULESET : type, props, children, length); } function comment(value, root, parent) { @@ -396,7 +382,7 @@ } var identifierWithPointTracking = function(begin, points, index) { for(var previous = 0, character = 0; previous = character, character = peek(), 38 === previous && 12 === character && (points[index] = 1), !token(character);)next(); - return slice(begin, position); + return Utility_substr(characters, begin, position); }, toRules = function(parsed, points) { var index = -1, character = 44; do switch(token(character)){ @@ -416,12 +402,15 @@ } while (character = next()) return parsed; + }, getRules = function(value, points) { + var value1; + return value1 = toRules(alloc(value), points), characters = "", value1; }, fixedElements = new WeakMap(), compat = function(element) { if ("rule" === element.type && element.parent && element.length) { for(var value = element.value, parent = element.parent, isImplicitRule = element.column === parent.column && element.line === parent.line; "rule" !== parent.type;)if (!(parent = parent.parent)) return; if ((1 !== element.props.length || 58 === value.charCodeAt(0) || fixedElements.get(parent)) && !isImplicitRule) { fixedElements.set(element, !0); - for(var value1, points, points1 = [], rules = (value1 = value, points = points1, dealloc(toRules(alloc(value1), points))), parentRules = parent.props, i = 0, k = 0; i < rules.length; i++)for(var j = 0; j < parentRules.length; j++, k++)element.props[k] = points1[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; + for(var points = [], rules = getRules(value, points), parentRules = parent.props, i = 0, k = 0; i < rules.length; i++)for(var j = 0; j < parentRules.length; j++, k++)element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i]; } } }, removeLabel = function(element) { @@ -632,19 +621,19 @@ }(function(rule) { currentSheet.insert(rule); }), - ], serializer = (collection = [ + ], serializer = (length = (collection = [ compat, removeLabel - ].concat(stylisPlugins, finalizingPlugins), length = Utility_sizeof(collection), function(element, index, children, callback) { + ].concat(stylisPlugins, finalizingPlugins)).length, function(element, index, children, callback) { for(var output = "", i = 0; i < length; i++)output += collection[i](element, index, children, callback) || ""; return output; }), stylis = function(styles) { - var value; - return serialize(dealloc(parse("", null, null, null, [ + var value, value1; + return serialize((value1 = parse("", null, null, null, [ "" ], value = alloc(value = styles), 0, [ 0 - ], value)), serializer); + ], value), characters = "", value1), serializer); }; _insert = function(selector, serialized, sheet, shouldCache) { currentSheet = sheet, stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles), shouldCache && (cache.inserted[serialized.name] = !0); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js index 08cc40c608c8..1146bb6a2b8e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js @@ -20,12 +20,9 @@ default: return source; } - for(const prop in source)source.hasOwnProperty(prop) && isValidKey(prop) && (target[prop] = deepExtend(target[prop], source[prop])); + for(const prop in source)source.hasOwnProperty(prop) && "__proto__" !== prop && (target[prop] = deepExtend(target[prop], source[prop])); return target; } - function isValidKey(key) { - return "__proto__" !== key; - } function getUA() { return "undefined" != typeof navigator && "string" == typeof navigator.userAgent ? navigator.userAgent : ""; } diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js index b7a1a4301b2c..0cc6e1d1a4d0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js @@ -1020,9 +1020,6 @@ this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s, this.limit = i, this.limitType = r, this.startAt = o, this.endAt = c, this.V = null, this.S = null, this.startAt, this.endAt; } } - function we(t) { - return new fe(t); - } function _e(t) { return !At(t.limit) && "F" === t.limitType; } @@ -2189,8 +2186,8 @@ } function Es(t) { let e = ""; - for(let n = 0; n < t.length; n++)e.length > 0 && (e = As(e)), e = Is(t.get(n), e); - return As(e); + for(let n = 0; n < t.length; n++)e.length > 0 && (e += ""), e = Is(t.get(n), e); + return e + ""; } function Is(t, e) { let n = e; @@ -2210,9 +2207,6 @@ } return n; } - function As(t) { - return t + ""; - } function Rs(t) { const e = t.length; if (e >= 2 || L(), 2 === e) return "" === t.charAt(0) && "" === t.charAt(1) || L(), ht.emptyPath(); @@ -2934,7 +2928,7 @@ return Vi(t, this.userId, e); } ee(t) { - return Ci(t).get(this.userId).next((t)=>t || new vs(this.userId, -1, "")); + return ei(t, vs.store).get(this.userId).next((t)=>t || new vs(this.userId, -1, "")); } } function Vi(t, e, n) { @@ -2954,9 +2948,6 @@ function Di(t) { return ei(t, Ss.store); } - function Ci(t) { - return ei(t, vs.store); - } class Ni { constructor(t){ this.ne = t; @@ -4040,9 +4031,6 @@ function Jr() { return "undefined" != typeof document ? document : null; } - function Yr(t) { - return new Bn(t, !0); - } class Xr { constructor(t, e, n = 1e3, s = 1.5, i = 6e4){ this.Oe = t, this.timerId = e, this.Qi = n, this.Wi = s, this.Gi = i, this.zi = 0, this.Hi = null, this.Ji = Date.now(), this.reset(); @@ -4445,16 +4433,13 @@ function wo(t) { return 0 === t.Wr.size; } - function _o(t) { - t.Jr = void 0; - } async function mo(t) { t.Qr.forEach((e, n)=>{ uo(t, e); }); } async function go(t, e) { - _o(t), fo(t) ? (t.Hr.qr(e), lo(t)) : t.Hr.set("Unknown"); + t.Jr = void 0, fo(t) ? (t.Hr.qr(e), lo(t)) : t.Hr.set("Unknown"); } async function yo(t, e, n) { if (t.Hr.set("Online"), e instanceof xn && 2 === e.state && e.cause) try { @@ -4580,7 +4565,7 @@ Ci: go.bind(null, t), Rr: yo.bind(null, t) }), t.Gr.push(async (e)=>{ - e ? (t.Yr.dr(), fo(t) ? lo(t) : t.Hr.set("Unknown")) : (await t.Yr.stop(), _o(t)); + e ? (t.Yr.dr(), fo(t) ? lo(t) : t.Hr.set("Unknown")) : (await t.Yr.stop(), t.Jr = void 0); })), t.Yr; } function No(t) { @@ -5103,10 +5088,11 @@ } function yc(t) { for(; t.Mo.size > 0 && t.Lo.size < t.maxConcurrentLimboResolutions;){ + var t1; const e = t.Mo.values().next().value; t.Mo.delete(e); const n = new Pt(ht.fromString(e)), s = t.jo.next(); - t.Bo.set(s, new tc(n)), t.Lo = t.Lo.insert(n, s), co(t.remoteStore, new ii(Ee(we(n.path)), s, 2, X.T)); + t.Bo.set(s, new tc(n)), t.Lo = t.Lo.insert(n, s), co(t.remoteStore, new ii(Ee((t1 = n.path, new fe(t1))), s, 2, X.T)); } } async function pc(t, e, n) { @@ -5172,7 +5158,8 @@ this.synchronizeTabs = !1; } async initialize(t) { - this.N = Yr(t.databaseInfo.databaseId), this.sharedClientState = this.Ho(t), this.persistence = this.Jo(t), await this.persistence.start(), this.gcScheduler = this.Yo(t), this.localStore = this.Xo(t); + var t1; + this.N = (t1 = t.databaseInfo.databaseId, new Bn(t1, !0)), this.sharedClientState = this.Ho(t), this.persistence = this.Jo(t), await this.persistence.start(), this.gcScheduler = this.Yo(t), this.localStore = this.Xo(t); } Yo(t) { return null; @@ -5199,8 +5186,8 @@ return new Lo(); } createDatastore(t) { - var s, t1, e, n; - const e1 = Yr(t.databaseInfo.databaseId), n1 = (s = t.databaseInfo, new zr(s)); + var s, t1, e, n, t2; + const e1 = (t2 = t.databaseInfo.databaseId, new Bn(t2, !0)), n1 = (s = t.databaseInfo, new zr(s)); return t1 = t.credentials, e = n1, n = e1, new no(t1, e, n); } createRemoteStore(t) { @@ -5467,7 +5454,8 @@ } class Ra extends Aa { constructor(t, e, n){ - super(t, e, we(n)), this._path = n, this.type = "collection"; + var t1; + super(t, e, (t1 = n, new fe(t1))), this._path = n, this.type = "collection"; } get id() { return this._query.path.lastSegment(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js index 5d9298914f71..301c73eeed70 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/output.js @@ -1010,9 +1010,6 @@ function localeData() { return this._locale; } - function mod$1(dividend, divisor) { - return (dividend % divisor + divisor) % divisor; - } function localStartOfDate(y, m, d) { return y < 100 && y >= 0 ? new Date(y + 400, m, d) - 12622780800000 : new Date(y, m, d).valueOf(); } @@ -1274,7 +1271,7 @@ } return asFloat ? output : absFloor(output); }, proto.endOf = function(units) { - var time, startOfDate; + var time, startOfDate, divisor, divisor1, divisor2; if (void 0 === (units = normalizeUnits(units)) || "millisecond" === units || !this.isValid()) return this; switch(startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate, units){ case "year": @@ -1297,13 +1294,13 @@ time = startOfDate(this.year(), this.month(), this.date() + 1) - 1; break; case "hour": - time = this._d.valueOf(), time += 3600000 - mod$1(time + (this._isUTC ? 0 : 60000 * this.utcOffset()), 3600000) - 1; + time = this._d.valueOf(), time += 3600000 - ((time + (this._isUTC ? 0 : 60000 * this.utcOffset())) % (divisor = 3600000) + divisor) % divisor - 1; break; case "minute": - time = this._d.valueOf(), time += 60000 - mod$1(time, 60000) - 1; + time = this._d.valueOf(), time += 60000 - (time % (divisor1 = 60000) + divisor1) % divisor1 - 1; break; case "second": - time = this._d.valueOf(), time += 1000 - mod$1(time, 1000) - 1; + time = this._d.valueOf(), time += 1000 - (time % (divisor2 = 1000) + divisor2) % divisor2 - 1; } return this._d.setTime(time), hooks.updateOffset(this, !0), this; }, proto.format = function(inputString) { @@ -1364,7 +1361,7 @@ } else if (isFunction(this[units = normalizeUnits(units)])) return this[units](value); return this; }, proto.startOf = function(units) { - var time, startOfDate; + var time, startOfDate, divisor, divisor1, divisor2; if (void 0 === (units = normalizeUnits(units)) || "millisecond" === units || !this.isValid()) return this; switch(startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate, units){ case "year": @@ -1387,13 +1384,13 @@ time = startOfDate(this.year(), this.month(), this.date()); break; case "hour": - time = this._d.valueOf(), time -= mod$1(time + (this._isUTC ? 0 : 60000 * this.utcOffset()), 3600000); + time = this._d.valueOf(), time -= ((time + (this._isUTC ? 0 : 60000 * this.utcOffset())) % (divisor = 3600000) + divisor) % divisor; break; case "minute": - time = this._d.valueOf(), time -= mod$1(time, 60000); + time = this._d.valueOf(), time -= (time % (divisor1 = 60000) + divisor1) % divisor1; break; case "second": - time = this._d.valueOf(), time -= mod$1(time, 1000); + time = this._d.valueOf(), time -= (time % (divisor2 = 1000) + divisor2) % divisor2; } return this._d.setTime(time), hooks.updateOffset(this, !0), this; }, proto.subtract = subtract, proto.toArray = function() { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index 4168b18d8fbc..bb40ca7bff4d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -407,16 +407,13 @@ }, setTextContent = function(el, content) { el.styleSheet ? el.styleSheet.cssText = content : el.textContent = content; }, _guid = 3; - function newGUID() { - return _guid++; - } global_window__WEBPACK_IMPORTED_MODULE_0___default().WeakMap || (FakeWeakMap = function() { function FakeWeakMap() { this.vdata = "vdata" + Math.floor(global_window__WEBPACK_IMPORTED_MODULE_0___default().performance && global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now() || Date.now()), this.data = {}; } var _proto = FakeWeakMap.prototype; return _proto.set = function(key, value) { - var access = key[this.vdata] || newGUID(); + var access = key[this.vdata] || _guid++; return key[this.vdata] || (key[this.vdata] = access), this.data[access] = value, this; }, _proto.get = function(key) { var access = key[this.vdata]; @@ -487,7 +484,7 @@ if (Array.isArray(type)) return _handleMultipleEvents(on, elem, type, fn); DomData.has(elem) || DomData.set(elem, {}); var data = DomData.get(elem); - if (data.handlers || (data.handlers = {}), data.handlers[type] || (data.handlers[type] = []), fn.guid || (fn.guid = newGUID()), data.handlers[type].push(fn), data.dispatcher || (data.disabled = !1, data.dispatcher = function(event, hash) { + if (data.handlers || (data.handlers = {}), data.handlers[type] || (data.handlers[type] = []), fn.guid || (fn.guid = _guid++), data.handlers[type].push(fn), data.dispatcher || (data.disabled = !1, data.dispatcher = function(event, hash) { if (!data.disabled) { event = fixEvent(event); var handlers = data.handlers[event.type]; @@ -548,13 +545,13 @@ var func = function func() { off(elem, type, func), fn.apply(this, arguments); }; - func.guid = fn.guid = fn.guid || newGUID(), on(elem, type, func); + func.guid = fn.guid = fn.guid || _guid++, on(elem, type, func); } function any(elem, type, fn) { var func = function func() { off(elem, type, func), fn.apply(this, arguments); }; - func.guid = fn.guid = fn.guid || newGUID(), on(elem, type, func); + func.guid = fn.guid = fn.guid || _guid++, on(elem, type, func); } var Events = Object.freeze({ __proto__: null, @@ -565,7 +562,7 @@ one: one, any: any }), bind = function(context, fn, uid) { - fn.guid || (fn.guid = newGUID()); + fn.guid || (fn.guid = _guid++); var bound = fn.bind(context); return bound.guid = uid ? uid + "_" + fn.guid : fn.guid, bound; }, throttle = function(fn, wait) { @@ -798,7 +795,7 @@ function Component(player, options, ready) { if (!player && this.play ? this.player_ = player = this : this.player_ = player, this.isDisposed_ = !1, this.parentComponent_ = null, this.options_ = mergeOptions$3({}, this.options_), options = this.options_ = mergeOptions$3(this.options_, options), this.id_ = options.id || options.el && options.el.id, !this.id_) { var id = player && player.id && player.id() || "no_player"; - this.id_ = id + "_component_" + newGUID(); + this.id_ = id + "_component_" + _guid++; } this.name_ = options.name || null, options.el ? this.el_ = options.el : !1 !== options.createEl && (this.el_ = this.createEl()), !1 !== options.evented && (evented(this, { eventBusKey: this.el_ ? "el_" : null @@ -1508,7 +1505,7 @@ function Track(options) { void 0 === options && (options = {}), _this = _EventTarget.call(this) || this; var _this, trackProps = { - id: options.id || "vjs_track_" + newGUID(), + id: options.id || "vjs_track_" + _guid++, kind: options.kind || "", language: options.language || "" }, label = options.label || "", _loop = function(key) { @@ -5201,7 +5198,7 @@ huge: 1 / 0 }, Player = function(_Component) { function Player(tag, options, ready) { - if (tag.id = tag.id || options.id || "vjs_video_" + newGUID(), (options = assign(Player.getTagSettings(tag), options)).initChildren = !1, options.createEl = !1, options.evented = !1, options.reportTouchActivity = !1, !options.language) { + if (tag.id = tag.id || options.id || "vjs_video_" + _guid++, (options = assign(Player.getTagSettings(tag), options)).initChildren = !1, options.createEl = !1, options.evented = !1, options.reportTouchActivity = !1, !options.language) { if ("function" == typeof tag.closest) { var _this, closest = tag.closest("[lang]"); closest && closest.getAttribute && (options.language = closest.getAttribute("lang")); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index ded72e704197..e71b110299f3 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -5344,17 +5344,9 @@ } return i; } - function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); - } - function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); - } - function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); - } - function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); + function latin1Write(buf, string, offset, length) { + var buf1, string1, offset1, length1; + return buf1 = buf, string1 = string, offset1 = offset, length1 = length, blitBuffer(asciiToBytes(string1), buf1, offset1, length1); } function base64Slice(buf, start, end) { return 0 === start && end === buf.length ? base64.fromByteArray(buf) : base64.fromByteArray(buf.slice(start, end)); @@ -5543,7 +5535,7 @@ else if (void 0 === length && "string" == typeof offset) encoding = offset, length = this.length, offset = 0; else if (isFinite(offset)) offset >>>= 0, isFinite(length) ? (length >>>= 0, void 0 === encoding && (encoding = "utf8")) : (encoding = length, length = void 0); else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - var buf, remaining = this.length - offset; + var buf, string1, offset1, length1, buf1, string2, offset2, length2, buf2, string3, offset3, length3, buf3, string4, offset4, length4, remaining = this.length - offset; if ((void 0 === length || length > remaining) && (length = remaining), string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw RangeError("Attempt to write outside buffer bounds"); encoding || (encoding = "utf8"); for(var loweredCase = !1;;)switch(encoding){ @@ -5551,19 +5543,19 @@ return hexWrite(this, string, offset, length); case "utf8": case "utf-8": - return utf8Write(this, string, offset, length); + return buf = this, string1 = string, offset1 = offset, length1 = length, blitBuffer(utf8ToBytes(string1, buf.length - offset1), buf, offset1, length1); case "ascii": - return asciiWrite(this, string, offset, length); + return buf1 = this, string2 = string, offset2 = offset, length2 = length, blitBuffer(asciiToBytes(string2), buf1, offset2, length2); case "latin1": case "binary": - return buf = this, asciiWrite(buf, string, offset, length); + return latin1Write(this, string, offset, length); case "base64": - return base64Write(this, string, offset, length); + return buf2 = this, string3 = string, offset3 = offset, length3 = length, blitBuffer(base64ToBytes(string3), buf2, offset3, length3); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": - return ucs2Write(this, string, offset, length); + return buf3 = this, string4 = string, offset4 = offset, length4 = length, blitBuffer(utf16leToBytes(string4, buf3.length - offset4), buf3, offset4, length4); default: if (loweredCase) throw TypeError("Unknown encoding: " + encoding); encoding = ("" + encoding).toLowerCase(), loweredCase = !0; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/output.js b/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/output.js index 885a5d1d2331..38655fffa2c8 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/output.js @@ -22,17 +22,17 @@ export class Text { eq(a) { if (a == this) return !0; if (a.length != this.length || a.lines != this.lines) return !1; - let b = this.scanIdentical(a, 1), c = this.length - this.scanIdentical(a, -1), d = new e(this), f = new e(a); + let b = this.scanIdentical(a, 1), c = this.length - this.scanIdentical(a, -1), e = new d(this), f = new d(a); for(let g = b, h = b;;){ - if (d.next(g), f.next(g), g = 0, d.lineBreak != f.lineBreak || d.done != f.done || d.value != f.value) return !1; - if (h += d.value.length, d.done || h >= c) return !0; + if (e.next(g), f.next(g), g = 0, e.lineBreak != f.lineBreak || e.done != f.done || e.value != f.value) return !1; + if (h += e.value.length, e.done || h >= c) return !0; } } iter(a = 1) { - return new e(this, a); + return new d(this, a); } iterRange(a, b = this.length) { - return new f(this, a, b); + return new e(this, a, b); } iterLines(a, b) { let c; @@ -42,7 +42,7 @@ export class Text { let d = this.line(a).from; c = this.iterRange(d, Math.max(d, b == this.lines + 1 ? this.length : b <= 1 ? 0 : this.line(b - 1).to)); } - return new g(c); + return new f(c); } toString() { return this.sliceString(0); @@ -77,21 +77,25 @@ class a extends Text { d = g + 1, c++; } } - decompose(b, e, f, g) { - let h = b <= 0 && e >= this.length ? this : new a(d(this.text, b, e), Math.min(e, this.length) - Math.max(0, b)); - if (1 & g) { - let i = f.pop(), j = c(h.text, i.text.slice(), 0, h.length); - if (j.length <= 32) f.push(new a(j, i.length + h.length)); + decompose(b, d, e, f) { + let g = b <= 0 && d >= this.length ? this : new a(c(this.text, [ + "" + ], b, d), Math.min(d, this.length) - Math.max(0, b)); + if (1 & f) { + let h = e.pop(), i = c(g.text, h.text.slice(), 0, g.length); + if (i.length <= 32) e.push(new a(i, h.length + g.length)); else { - let k = j.length >> 1; - f.push(new a(j.slice(0, k)), new a(j.slice(k))); + let j = i.length >> 1; + e.push(new a(i.slice(0, j)), new a(i.slice(j))); } - } else f.push(h); + } else e.push(g); } - replace(e, f, g) { - if (!(g instanceof a)) return super.replace(e, f, g); - let h = c(this.text, c(g.text, d(this.text, 0, e)), f), i = this.length + g.length - (f - e); - return h.length <= 32 ? new a(h, i) : b.from(a.split(h, []), i); + replace(d, e, f) { + if (!(f instanceof a)) return super.replace(d, e, f); + let g = c(this.text, c(f.text, c(this.text, [ + "" + ], 0, d)), e), h = this.length + f.length - (e - d); + return g.length <= 32 ? new a(g, h) : b.from(a.split(g, []), h); } sliceString(a, b = this.length, c = "\n") { let d = ""; @@ -208,15 +212,10 @@ function c(a, b, c = 0, d = 1e9) { } return b; } -function d(a, b, d) { - return c(a, [ - "" - ], b, d); -} Text.empty = new a([ "" ], 0); -class e { +class d { constructor(b, c = 1){ this.dir = c, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [ b @@ -247,9 +246,9 @@ class e { return a < 0 && (this.nextInner(-a, -this.dir), a = this.value.length), this.nextInner(a, this.dir); } } -class f { +class e { constructor(a, b, c){ - this.value = "", this.done = !1, this.cursor = new e(a, b > c ? -1 : 1), this.pos = b > c ? a.length : 0, this.from = Math.min(b, c), this.to = Math.max(b, c); + this.value = "", this.done = !1, this.cursor = new d(a, b > c ? -1 : 1), this.pos = b > c ? a.length : 0, this.from = Math.min(b, c), this.to = Math.max(b, c); } nextInner(a, b) { if (b < 0 ? this.pos <= this.from : this.pos >= this.to) return this.value = "", this.done = !0, this; @@ -266,7 +265,7 @@ class f { return this.cursor.lineBreak && "" != this.value; } } -class g { +class f { constructor(a){ this.inner = a, this.afterBreak = !0, this.value = "", this.done = !1; } @@ -280,7 +279,7 @@ class g { } "undefined" != typeof Symbol && (Text.prototype[Symbol.iterator] = function() { return this.iter(); -}, e.prototype[Symbol.iterator] = f.prototype[Symbol.iterator] = g.prototype[Symbol.iterator] = function() { +}, d.prototype[Symbol.iterator] = e.prototype[Symbol.iterator] = f.prototype[Symbol.iterator] = function() { return this; }); export class Line { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js index 6b61ba2c3535..bbd473f2aac2 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js @@ -387,9 +387,6 @@ ]; return allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) ? hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) : hex.join(""); } - function convertHexToDecimal(h) { - return parseIntFromHex(h) / 255; - } function parseIntFromHex(val) { return parseInt(val, 16); } @@ -613,7 +610,7 @@ r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), + a: parseIntFromHex(match[4]) / 255, format: named ? "name" : "hex8" } : (match = matchers.hex6.exec(color)) ? { r: parseIntFromHex(match[1]), @@ -624,7 +621,7 @@ r: parseIntFromHex(match[1] + match[1]), g: parseIntFromHex(match[2] + match[2]), b: parseIntFromHex(match[3] + match[3]), - a: convertHexToDecimal(match[4] + match[4]), + a: parseIntFromHex(match[4] + match[4]) / 255, format: named ? "name" : "hex8" } : !!(match = matchers.hex3.exec(color)) && { r: parseIntFromHex(match[1] + match[1]), diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js index 8c1ae1c58d82..3a6bfc7f39cf 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js @@ -808,12 +808,6 @@ if (sps) for(var sp = void 0, i = 0; i < sps.length; ++i)(sp = sps[i]).marker.collapsed && (start ? sp.from : sp.to) == null && (!found || 0 > compareCollapsedMarkers(found, sp.marker)) && (found = sp.marker); return found; } - function collapsedSpanAtStart(line) { - return collapsedSpanAtSide(line, !0); - } - function collapsedSpanAtEnd(line) { - return collapsedSpanAtSide(line, !1); - } function collapsedSpanAround(line, ch) { var found, sps = sawCollapsedSpans && line.markedSpans; if (sps) for(var i = 0; i < sps.length; ++i){ @@ -833,7 +827,7 @@ } } function visualLine(line) { - for(var merged; merged = collapsedSpanAtStart(line);)line = merged.find(-1, !0).line; + for(var merged; merged = collapsedSpanAtSide(line, !0);)line = merged.find(-1, !0).line; return line; } function visualLineNo(doc, lineN) { @@ -844,7 +838,7 @@ if (lineN > doc.lastLine()) return lineN; var merged, line = getLine(doc, lineN); if (!lineIsHidden(doc, line)) return lineN; - for(; merged = collapsedSpanAtEnd(line);)line = merged.find(1, !0).line; + for(; merged = collapsedSpanAtSide(line, !1);)line = merged.find(1, !0).line; return lineNo(line) + 1; } function lineIsHidden(doc, line) { @@ -877,11 +871,11 @@ } function lineLength(line) { if (0 == line.height) return 0; - for(var merged, len = line.text.length, cur = line; merged = collapsedSpanAtStart(cur);){ + for(var merged, len = line.text.length, cur = line; merged = collapsedSpanAtSide(cur, !0);){ var found = merged.find(0, !0); cur = found.from.line, len += found.from.ch - found.to.ch; } - for(cur = line; merged = collapsedSpanAtEnd(cur);){ + for(cur = line; merged = collapsedSpanAtSide(cur, !1);){ var found$1 = merged.find(0, !0); len -= cur.text.length - found$1.from.ch, cur = found$1.to.line, len += cur.text.length - found$1.to.ch; } @@ -897,9 +891,6 @@ var Line = function(text, markedSpans, estimateHeight) { this.text = text, attachMarkedSpans(this, markedSpans), this.height = estimateHeight ? estimateHeight(this) : 1; }; - function cleanUpLine(line) { - line.parent = null, detachMarkedSpans(line); - } Line.prototype.lineNo = function() { return lineNo(this); }, eventMixin(Line); @@ -1042,7 +1033,7 @@ } function LineView(doc, line, lineN) { this.line = line, this.rest = function(line) { - for(var merged, lines; merged = collapsedSpanAtEnd(line);)line = merged.find(1, !0).line, (lines || (lines = [])).push(line); + for(var merged, lines; merged = collapsedSpanAtSide(line, !1);)line = merged.find(1, !0).line, (lines || (lines = [])).push(line); return lines; }(line), this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1, this.node = this.text = null, this.hidden = lineIsHidden(doc, line); } @@ -1200,9 +1191,6 @@ }; } } - function measureChar(cm, line, ch, bias) { - return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias); - } function findViewForLine(cm, lineN) { if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) return cm.display.view[findViewIndex(cm, lineN)]; var ext = cm.display.externalMeasured; @@ -1367,7 +1355,8 @@ }; } function charCoords(cm, pos, context, lineObj, bias) { - return lineObj || (lineObj = getLine(cm.doc, pos.line)), intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context); + var cm1, line, ch, bias1; + return lineObj || (lineObj = getLine(cm.doc, pos.line)), intoCoordSystem(cm, lineObj, (cm1 = cm, line = lineObj, ch = pos.ch, bias1 = bias, measureCharPrepared(cm1, prepareMeasureForLine(cm1, line), ch, bias1)), context); } function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) { function get(ch, right) { @@ -1981,8 +1970,8 @@ op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update); } function endOperation_R2(op) { - var cm = op.cm, display = cm.display; - op.updatedDisplay && updateHeightsInViewport(cm), op.barMeasure = measureForScrollbars(cm), display.maxLineChanged && !cm.options.lineWrapping && (op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3, cm.display.sizerWidth = op.adjustWidthTo, op.barMeasure.scrollWidth = Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth), op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))), (op.updatedDisplay || op.selectionChanged) && (op.preparedSelection = display.input.prepareSelection()); + var cm, line, ch, cm1 = op.cm, display = cm1.display; + op.updatedDisplay && updateHeightsInViewport(cm1), op.barMeasure = measureForScrollbars(cm1), display.maxLineChanged && !cm1.options.lineWrapping && (op.adjustWidthTo = (cm = cm1, line = display.maxLine, ch = display.maxLine.text.length, measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, void 0)).left + 3, cm1.display.sizerWidth = op.adjustWidthTo, op.barMeasure.scrollWidth = Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm1) + cm1.display.barWidth), op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm1))), (op.updatedDisplay || op.selectionChanged) && (op.preparedSelection = display.input.prepareSelection()); } function endOperation_W2(op) { var cm = op.cm; @@ -2546,9 +2535,6 @@ var ranges = doc.sel.ranges.slice(0); ranges[i] = range, setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options); } - function setSimpleSelection(doc, anchor, head, options) { - setSelection(doc, simpleSelection(anchor, head), options); - } function setSelectionReplaceHistory(doc, sel, options) { var done = doc.history.done, last = lst(done); last && last.ranges ? (done[done.length - 1] = sel, setSelectionNoUndo(doc, sel, options)) : setSelection(doc, sel, options); @@ -2876,8 +2862,8 @@ }, removeInner: function(at, n) { for(var i = at, e = at + n; i < e; ++i){ - var line = this.lines[i]; - this.height -= line.height, cleanUpLine(line), signalLater(line, "delete"); + var line, line1 = this.lines[i]; + this.height -= line1.height, (line = line1).parent = null, detachMarkedSpans(line), signalLater(line1, "delete"); } this.lines.splice(at, n); }, @@ -3206,10 +3192,12 @@ return this.sel.somethingSelected(); }, setCursor: docMethodOp(function(line, ch, options) { - setSimpleSelection(this, clipPos(this, "number" == typeof line ? Pos(line, ch || 0) : line), null, options); + var doc, anchor, options1; + doc = this, anchor = clipPos(this, "number" == typeof line ? Pos(line, ch || 0) : line), options1 = options, setSelection(doc, simpleSelection(anchor, null), options1); }), setSelection: docMethodOp(function(anchor, head, options) { - setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options); + var doc, anchor1, head1, options1; + doc = this, anchor1 = clipPos(this, anchor), head1 = clipPos(this, head || anchor), options1 = options, setSelection(doc, simpleSelection(anchor1, head1), options1); }), extendSelection: docMethodOp(function(head, other, options) { extendSelection(this, clipPos(this, head), other && clipPos(this, other), options); @@ -4073,7 +4061,7 @@ } function lineEnd(cm, lineN) { var line = getLine(cm.doc, lineN), visual = function(line) { - for(var merged; merged = collapsedSpanAtEnd(line);)line = merged.find(1, !0).line; + for(var merged; merged = collapsedSpanAtSide(line, !1);)line = merged.find(1, !0).line; return line; }(line); return visual != line && (lineN = lineNo(visual)), endOfLine(!0, cm, line, lineN, -1); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js index 27bb1eb7c5a7..1374a63ad1ec 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js @@ -307,17 +307,9 @@ } return o; } - function utf8Write(e, r, t, f) { - return blitBuffer(utf8ToBytes(r, e.length - t), e, t, f); - } - function asciiWrite(e, r, t, f) { - return blitBuffer(asciiToBytes(r), e, t, f); - } - function base64Write(e, r, t, f) { - return blitBuffer(base64ToBytes(r), e, t, f); - } - function ucs2Write(e, r, t, f) { - return blitBuffer(utf16leToBytes(r, e.length - t), e, t, f); + function latin1Write(e, r, t, f) { + var e1, r1, t1, f1; + return e1 = e, r1 = r, t1 = t, f1 = f, blitBuffer(asciiToBytes(r1), e1, t1, f1); } function base64Slice(e, r, t) { return 0 === r && t === e.length ? f.fromByteArray(e) : f.fromByteArray(e.slice(r, t)); @@ -506,7 +498,7 @@ else if (void 0 === t && "string" == typeof r) f = r, t = this.length, r = 0; else if (isFinite(r)) r >>>= 0, isFinite(t) ? (t >>>= 0, void 0 === f && (f = "utf8")) : (f = t, t = void 0); else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - var e1, n = this.length - r; + var e1, r1, t1, f1, e2, r2, t2, f2, e3, r3, t3, f3, e4, r4, t4, f4, n = this.length - r; if ((void 0 === t || t > n) && (t = n), e.length > 0 && (t < 0 || r < 0) || r > this.length) throw RangeError("Attempt to write outside buffer bounds"); f || (f = "utf8"); for(var i = !1;;)switch(f){ @@ -514,19 +506,19 @@ return hexWrite(this, e, r, t); case "utf8": case "utf-8": - return utf8Write(this, e, r, t); + return e1 = this, r1 = e, t1 = r, f1 = t, blitBuffer(utf8ToBytes(r1, e1.length - t1), e1, t1, f1); case "ascii": - return asciiWrite(this, e, r, t); + return e2 = this, r2 = e, t2 = r, f2 = t, blitBuffer(asciiToBytes(r2), e2, t2, f2); case "latin1": case "binary": - return e1 = this, asciiWrite(e1, e, r, t); + return latin1Write(this, e, r, t); case "base64": - return base64Write(this, e, r, t); + return e3 = this, r3 = e, t3 = r, f3 = t, blitBuffer(base64ToBytes(r3), e3, t3, f3); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": - return ucs2Write(this, e, r, t); + return e4 = this, r4 = e, t4 = r, f4 = t, blitBuffer(utf16leToBytes(r4, e4.length - t4), e4, t4, f4); default: if (i) throw TypeError("Unknown encoding: " + f); f = ("" + f).toLowerCase(), i = !0; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index 262d49640d12..efd6f7158489 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -8928,36 +8928,33 @@ var d = c(2215), e = c(2584), f = c(609), g = c(8420), h = c(2847), i = c(8923), j = Date.prototype.getTime; function k(a, b, c) { var d = c || {}; - return (d.strict ? !!f(a, b) : a === b) || (a && b && ("object" == typeof a || "object" == typeof b) ? n(a, b, d) : d.strict ? f(a, b) : a == b); + return (d.strict ? !!f(a, b) : a === b) || (a && b && ("object" == typeof a || "object" == typeof b) ? m(a, b, d) : d.strict ? f(a, b) : a == b); } function l(a) { - return null == a; - } - function m(a) { return !!a && "object" == typeof a && "number" == typeof a.length && "function" == typeof a.copy && "function" == typeof a.slice && (!(a.length > 0) || "number" == typeof a[0]); } - function n(a, b, c) { - if (typeof a != typeof b || l(a) || l(b) || a.prototype !== b.prototype || e(a) !== e(b)) return !1; - var f, n, o = g(a), p = g(b); - if (o !== p) return !1; - if (o || p) return a.source === b.source && h(a) === h(b); + function m(a, b, c) { + if (typeof a != typeof b || null == a || null == b || a.prototype !== b.prototype || e(a) !== e(b)) return !1; + var f, m, n = g(a), o = g(b); + if (n !== o) return !1; + if (n || o) return a.source === b.source && h(a) === h(b); if (i(a) && i(b)) return j.call(a) === j.call(b); - var q = m(a), r = m(b); - if (q !== r) return !1; - if (q || r) { + var p = l(a), q = l(b); + if (p !== q) return !1; + if (p || q) { if (a.length !== b.length) return !1; for(f = 0; f < a.length; f++)if (a[f] !== b[f]) return !1; return !0; } if (typeof a != typeof b) return !1; try { - var s = d(a), t = d(b); - } catch (u) { + var r = d(a), s = d(b); + } catch (t) { return !1; } - if (s.length !== t.length) return !1; - for(s.sort(), t.sort(), f = s.length - 1; f >= 0; f--)if (s[f] != t[f]) return !1; - for(f = s.length - 1; f >= 0; f--)if (!k(a[n = s[f]], b[n], c)) return !1; + if (r.length !== s.length) return !1; + for(r.sort(), s.sort(), f = r.length - 1; f >= 0; f--)if (r[f] != s[f]) return !1; + for(f = r.length - 1; f >= 0; f--)if (!k(a[m = r[f]], b[m], c)) return !1; return !0; } a.exports = k; @@ -9448,18 +9445,14 @@ }, 6119: function(a, b, c) { var d = c(7507); - function e(a, b) { - return a > b ? b : a; - } - function f(a, b) { - return a < b ? b : a; - } a.exports = function(a, b, c) { + var e, f, g, h, i, j, k, l; return a = function(a) { - for(a = f(a = e(a, 1e7), -10000000); a < 0;)a += 360; + var b, c, d, e; + for(a = (d = a = (c = 1e7, (b = a) > c ? c : b)) < (e = -10000000) ? e : d; a < 0;)a += 360; for(; a > 359;)a -= 360; return a; - }(a), b = f(e(b, 100), 0), c = f(e(c, 100), 0), b /= 100, "#" + d(a, b, c /= 100).map(function(a) { + }(a), b = (g = (f = 100, (e = b) > f ? f : e)) < (h = 0) ? h : g, c = (k = (j = 100, (i = c) > j ? j : i)) < (l = 0) ? l : k, "#" + d(a, b /= 100, c /= 100).map(function(a) { return (256 + a).toString(16).substr(-2); }).join(""); }; @@ -20102,7 +20095,7 @@ if ("string" == typeof a) return l(a, b); if (ArrayBuffer.isView(a)) return m(a); if (null == a) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a); - if (S(a, ArrayBuffer) || a && S(a.buffer, ArrayBuffer) || "undefined" != typeof SharedArrayBuffer && (S(a, SharedArrayBuffer) || a && S(a.buffer, SharedArrayBuffer))) return n(a, b, c); + if (P(a, ArrayBuffer) || a && P(a.buffer, ArrayBuffer) || "undefined" != typeof SharedArrayBuffer && (P(a, SharedArrayBuffer) || a && P(a.buffer, SharedArrayBuffer))) return n(a, b, c); if ("number" == typeof a) throw TypeError('The "value" argument must not be of type number. Received type number'); var d = a.valueOf && a.valueOf(); if (null != d && d !== a) return h.from(d, b, c); @@ -20146,7 +20139,7 @@ } function q(a, b) { if (h.isBuffer(a)) return a.length; - if (ArrayBuffer.isView(a) || S(a, ArrayBuffer)) return a.byteLength; + if (ArrayBuffer.isView(a) || P(a, ArrayBuffer)) return a.byteLength; if ("string" != typeof a) throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof a); var c = a.length, d = arguments.length > 2 && !0 === arguments[2]; if (!d && 0 === c) return 0; @@ -20157,7 +20150,7 @@ return c; case "utf8": case "utf-8": - return N(a).length; + return K(a).length; case "ucs2": case "ucs-2": case "utf16le": @@ -20166,9 +20159,9 @@ case "hex": return c >>> 1; case "base64": - return Q(a).length; + return N(a).length; default: - if (e) return d ? -1 : N(a).length; + if (e) return d ? -1 : K(a).length; b = ("" + b).toLowerCase(), e = !0; } } @@ -20177,22 +20170,22 @@ if ((void 0 === b || b < 0) && (b = 0), b > this.length || ((void 0 === c || c > this.length) && (c = this.length), c <= 0 || (c >>>= 0) <= (b >>>= 0))) return ""; for(a || (a = "utf8");;)switch(a){ case "hex": - return F(this, b, c); + return C(this, b, c); case "utf8": case "utf-8": - return B(this, b, c); + return y(this, b, c); case "ascii": - return D(this, b, c); + return A(this, b, c); case "latin1": case "binary": - return E(this, b, c); + return B(this, b, c); case "base64": - return A(this, b, c); + return x(this, b, c); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": - return G(this, b, c); + return D(this, b, c); default: if (d) throw TypeError("Unknown encoding: " + a); a = (a + "").toLowerCase(), d = !0; @@ -20255,21 +20248,13 @@ return g; } function w(a, b, c, d) { - return R(N(b, a.length - c), a, c, d); - } - function x(a, b, c, d) { - return R(O(b), a, c, d); - } - function y(a, b, c, d) { - return R(Q(b), a, c, d); + var e, f, g, h; + return e = a, f = b, g = c, h = d, O(L(f), e, g, h); } - function z(a, b, c, d) { - return R(P(b, a.length - c), a, c, d); - } - function A(a, b, c) { + function x(a, b, c) { return 0 === b && c === a.length ? d.fromByteArray(a) : d.fromByteArray(a.slice(b, c)); } - function B(a, b, c) { + function y(a, b, c) { c = Math.min(a.length, c); for(var d = [], e = b; e < c;){ var f, g, h, i, j = a[e], k = null, l = j > 239 ? 4 : j > 223 ? 3 : j > 191 ? 2 : 1; @@ -20288,53 +20273,53 @@ } null === k ? (k = 65533, l = 1) : k > 65535 && (k -= 65536, d.push(k >>> 10 & 1023 | 55296), k = 56320 | 1023 & k), d.push(k), e += l; } - return C(d); + return z(d); } - function C(a) { + function z(a) { var b = a.length; if (b <= 4096) return String.fromCharCode.apply(String, a); for(var c = "", d = 0; d < b;)c += String.fromCharCode.apply(String, a.slice(d, d += 4096)); return c; } - function D(a, b, c) { + function A(a, b, c) { var d = ""; c = Math.min(a.length, c); for(var e = b; e < c; ++e)d += String.fromCharCode(127 & a[e]); return d; } - function E(a, b, c) { + function B(a, b, c) { var d = ""; c = Math.min(a.length, c); for(var e = b; e < c; ++e)d += String.fromCharCode(a[e]); return d; } - function F(a, b, c) { + function C(a, b, c) { var d = a.length; (!b || b < 0) && (b = 0), (!c || c < 0 || c > d) && (c = d); - for(var e = "", f = b; f < c; ++f)e += T[a[f]]; + for(var e = "", f = b; f < c; ++f)e += Q[a[f]]; return e; } - function G(a, b, c) { + function D(a, b, c) { for(var d = a.slice(b, c), e = "", f = 0; f < d.length; f += 2)e += String.fromCharCode(d[f] + 256 * d[f + 1]); return e; } - function H(a, b, c) { + function E(a, b, c) { if (a % 1 != 0 || a < 0) throw RangeError("offset is not uint"); if (a + b > c) throw RangeError("Trying to access beyond buffer length"); } - function I(a, b, c, d, e, f) { + function F(a, b, c, d, e, f) { if (!h.isBuffer(a)) throw TypeError('"buffer" argument must be a Buffer instance'); if (b > e || b < f) throw RangeError('"value" argument is out of bounds'); if (c + d > a.length) throw RangeError("Index out of range"); } - function J(a, b, c, d, e, f) { + function G(a, b, c, d, e, f) { if (c + d > a.length || c < 0) throw RangeError("Index out of range"); } - function K(a, b, c, d, f) { - return b = +b, c >>>= 0, f || J(a, b, c, 4, 34028234663852886e22, -340282346638528860000000000000000000000), e.write(a, b, c, d, 23, 4), c + 4; + function H(a, b, c, d, f) { + return b = +b, c >>>= 0, f || G(a, b, c, 4, 34028234663852886e22, -340282346638528860000000000000000000000), e.write(a, b, c, d, 23, 4), c + 4; } - function L(a, b, c, d, f) { - return b = +b, c >>>= 0, f || J(a, b, c, 8, 17976931348623157e292, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000), e.write(a, b, c, d, 52, 8), c + 8; + function I(a, b, c, d, f) { + return b = +b, c >>>= 0, f || G(a, b, c, 8, 17976931348623157e292, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000), e.write(a, b, c, d, 52, 8), c + 8; } b.Buffer = h, b.SlowBuffer = function(a) { return +a != a && (a = 0), h.alloc(+a); @@ -20371,7 +20356,7 @@ }, h.isBuffer = function(a) { return null != a && !0 === a._isBuffer && a !== h.prototype; }, h.compare = function(a, b) { - if (S(a, Uint8Array) && (a = h.from(a, a.offset, a.byteLength)), S(b, Uint8Array) && (b = h.from(b, b.offset, b.byteLength)), !h.isBuffer(a) || !h.isBuffer(b)) throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); + if (P(a, Uint8Array) && (a = h.from(a, a.offset, a.byteLength)), P(b, Uint8Array) && (b = h.from(b, b.offset, b.byteLength)), !h.isBuffer(a) || !h.isBuffer(b)) throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); if (a === b) return 0; for(var c = a.length, d = b.length, e = 0, f = Math.min(c, d); e < f; ++e)if (a[e] !== b[e]) { c = a[e], d = b[e]; @@ -20402,7 +20387,7 @@ var c, d = h.allocUnsafe(b), e = 0; for(c = 0; c < a.length; ++c){ var f = a[c]; - if (S(f, Uint8Array) && (f = h.from(f)), !h.isBuffer(f)) throw TypeError('"list" argument must be an Array of Buffers'); + if (P(f, Uint8Array) && (f = h.from(f)), !h.isBuffer(f)) throw TypeError('"list" argument must be an Array of Buffers'); f.copy(d, e), e += f.length; } return d; @@ -20423,7 +20408,7 @@ return this; }, h.prototype.toString = function() { var a = this.length; - return 0 === a ? "" : 0 === arguments.length ? B(this, 0, a) : r.apply(this, arguments); + return 0 === a ? "" : 0 === arguments.length ? y(this, 0, a) : r.apply(this, arguments); }, h.prototype.toLocaleString = h.prototype.toString, h.prototype.equals = function(a) { if (!h.isBuffer(a)) throw TypeError("Argument must be a Buffer"); return this === a || 0 === h.compare(this, a); @@ -20431,7 +20416,7 @@ var a = "", c = b.INSPECT_MAX_BYTES; return a = this.toString("hex", 0, c).replace(/(.{2})/g, "$1 ").trim(), this.length > c && (a += " ... "), ""; }, f && (h.prototype[f] = h.prototype.inspect), h.prototype.compare = function(a, b, c, d, e) { - if (S(a, Uint8Array) && (a = h.from(a, a.offset, a.byteLength)), !h.isBuffer(a)) throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof a); + if (P(a, Uint8Array) && (a = h.from(a, a.offset, a.byteLength)), !h.isBuffer(a)) throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof a); if (void 0 === b && (b = 0), void 0 === c && (c = a ? a.length : 0), void 0 === d && (d = 0), void 0 === e && (e = this.length), b < 0 || c > a.length || d < 0 || e > this.length) throw RangeError("out of range index"); if (d >= e && b >= c) return 0; if (d >= e) return -1; @@ -20453,30 +20438,30 @@ else if (void 0 === c && "string" == typeof b) d = b, c = this.length, b = 0; else if (isFinite(b)) b >>>= 0, isFinite(c) ? (c >>>= 0, void 0 === d && (d = "utf8")) : (d = c, c = void 0); else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); - var e, f = this.length - b; - if ((void 0 === c || c > f) && (c = f), a.length > 0 && (c < 0 || b < 0) || b > this.length) throw RangeError("Attempt to write outside buffer bounds"); + var e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u = this.length - b; + if ((void 0 === c || c > u) && (c = u), a.length > 0 && (c < 0 || b < 0) || b > this.length) throw RangeError("Attempt to write outside buffer bounds"); d || (d = "utf8"); - for(var g = !1;;)switch(d){ + for(var x = !1;;)switch(d){ case "hex": return v(this, a, b, c); case "utf8": case "utf-8": - return w(this, a, b, c); + return e = this, f = a, g = b, h = c, O(K(f, e.length - g), e, g, h); case "ascii": - return x(this, a, b, c); + return i = this, j = a, k = b, l = c, O(L(j), i, k, l); case "latin1": case "binary": - return e = this, x(e, a, b, c); + return w(this, a, b, c); case "base64": - return y(this, a, b, c); + return m = this, n = a, o = b, p = c, O(N(n), m, o, p); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": - return z(this, a, b, c); + return q = this, r = a, s = b, t = c, O(M(r, q.length - s), q, s, t); default: - if (g) throw TypeError("Unknown encoding: " + d); - d = ("" + d).toLowerCase(), g = !0; + if (x) throw TypeError("Unknown encoding: " + d); + d = ("" + d).toLowerCase(), x = !0; } }, h.prototype.toJSON = function() { return { @@ -20489,57 +20474,57 @@ var d = this.subarray(a, b); return Object.setPrototypeOf(d, h.prototype), d; }, h.prototype.readUIntLE = function(a, b, c) { - a >>>= 0, b >>>= 0, c || H(a, b, this.length); + a >>>= 0, b >>>= 0, c || E(a, b, this.length); for(var d = this[a], e = 1, f = 0; ++f < b && (e *= 256);)d += this[a + f] * e; return d; }, h.prototype.readUIntBE = function(a, b, c) { - a >>>= 0, b >>>= 0, c || H(a, b, this.length); + a >>>= 0, b >>>= 0, c || E(a, b, this.length); for(var d = this[a + --b], e = 1; b > 0 && (e *= 256);)d += this[a + --b] * e; return d; }, h.prototype.readUInt8 = function(a, b) { - return a >>>= 0, b || H(a, 1, this.length), this[a]; + return a >>>= 0, b || E(a, 1, this.length), this[a]; }, h.prototype.readUInt16LE = function(a, b) { - return a >>>= 0, b || H(a, 2, this.length), this[a] | this[a + 1] << 8; + return a >>>= 0, b || E(a, 2, this.length), this[a] | this[a + 1] << 8; }, h.prototype.readUInt16BE = function(a, b) { - return a >>>= 0, b || H(a, 2, this.length), this[a] << 8 | this[a + 1]; + return a >>>= 0, b || E(a, 2, this.length), this[a] << 8 | this[a + 1]; }, h.prototype.readUInt32LE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), (this[a] | this[a + 1] << 8 | this[a + 2] << 16) + 16777216 * this[a + 3]; + return a >>>= 0, b || E(a, 4, this.length), (this[a] | this[a + 1] << 8 | this[a + 2] << 16) + 16777216 * this[a + 3]; }, h.prototype.readUInt32BE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), 16777216 * this[a] + (this[a + 1] << 16 | this[a + 2] << 8 | this[a + 3]); + return a >>>= 0, b || E(a, 4, this.length), 16777216 * this[a] + (this[a + 1] << 16 | this[a + 2] << 8 | this[a + 3]); }, h.prototype.readIntLE = function(a, b, c) { - a >>>= 0, b >>>= 0, c || H(a, b, this.length); + a >>>= 0, b >>>= 0, c || E(a, b, this.length); for(var d = this[a], e = 1, f = 0; ++f < b && (e *= 256);)d += this[a + f] * e; return d >= (e *= 128) && (d -= Math.pow(2, 8 * b)), d; }, h.prototype.readIntBE = function(a, b, c) { - a >>>= 0, b >>>= 0, c || H(a, b, this.length); + a >>>= 0, b >>>= 0, c || E(a, b, this.length); for(var d = b, e = 1, f = this[a + --d]; d > 0 && (e *= 256);)f += this[a + --d] * e; return f >= (e *= 128) && (f -= Math.pow(2, 8 * b)), f; }, h.prototype.readInt8 = function(a, b) { - return (a >>>= 0, b || H(a, 1, this.length), 128 & this[a]) ? -((255 - this[a] + 1) * 1) : this[a]; + return (a >>>= 0, b || E(a, 1, this.length), 128 & this[a]) ? -((255 - this[a] + 1) * 1) : this[a]; }, h.prototype.readInt16LE = function(a, b) { - a >>>= 0, b || H(a, 2, this.length); + a >>>= 0, b || E(a, 2, this.length); var c = this[a] | this[a + 1] << 8; return 32768 & c ? 4294901760 | c : c; }, h.prototype.readInt16BE = function(a, b) { - a >>>= 0, b || H(a, 2, this.length); + a >>>= 0, b || E(a, 2, this.length); var c = this[a + 1] | this[a] << 8; return 32768 & c ? 4294901760 | c : c; }, h.prototype.readInt32LE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), this[a] | this[a + 1] << 8 | this[a + 2] << 16 | this[a + 3] << 24; + return a >>>= 0, b || E(a, 4, this.length), this[a] | this[a + 1] << 8 | this[a + 2] << 16 | this[a + 3] << 24; }, h.prototype.readInt32BE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), this[a] << 24 | this[a + 1] << 16 | this[a + 2] << 8 | this[a + 3]; + return a >>>= 0, b || E(a, 4, this.length), this[a] << 24 | this[a + 1] << 16 | this[a + 2] << 8 | this[a + 3]; }, h.prototype.readFloatLE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), e.read(this, a, !0, 23, 4); + return a >>>= 0, b || E(a, 4, this.length), e.read(this, a, !0, 23, 4); }, h.prototype.readFloatBE = function(a, b) { - return a >>>= 0, b || H(a, 4, this.length), e.read(this, a, !1, 23, 4); + return a >>>= 0, b || E(a, 4, this.length), e.read(this, a, !1, 23, 4); }, h.prototype.readDoubleLE = function(a, b) { - return a >>>= 0, b || H(a, 8, this.length), e.read(this, a, !0, 52, 8); + return a >>>= 0, b || E(a, 8, this.length), e.read(this, a, !0, 52, 8); }, h.prototype.readDoubleBE = function(a, b) { - return a >>>= 0, b || H(a, 8, this.length), e.read(this, a, !1, 52, 8); + return a >>>= 0, b || E(a, 8, this.length), e.read(this, a, !1, 52, 8); }, h.prototype.writeUIntLE = function(a, b, c, d) { if (a = +a, b >>>= 0, c >>>= 0, !d) { var e = Math.pow(2, 8 * c) - 1; - I(this, a, b, c, e, 0); + F(this, a, b, c, e, 0); } var f = 1, g = 0; for(this[b] = 255 & a; ++g < c && (f *= 256);)this[b + g] = a / f & 255; @@ -20547,25 +20532,25 @@ }, h.prototype.writeUIntBE = function(a, b, c, d) { if (a = +a, b >>>= 0, c >>>= 0, !d) { var e = Math.pow(2, 8 * c) - 1; - I(this, a, b, c, e, 0); + F(this, a, b, c, e, 0); } var f = c - 1, g = 1; for(this[b + f] = 255 & a; --f >= 0 && (g *= 256);)this[b + f] = a / g & 255; return b + c; }, h.prototype.writeUInt8 = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 1, 255, 0), this[b] = 255 & a, b + 1; + return a = +a, b >>>= 0, c || F(this, a, b, 1, 255, 0), this[b] = 255 & a, b + 1; }, h.prototype.writeUInt16LE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 2, 65535, 0), this[b] = 255 & a, this[b + 1] = a >>> 8, b + 2; + return a = +a, b >>>= 0, c || F(this, a, b, 2, 65535, 0), this[b] = 255 & a, this[b + 1] = a >>> 8, b + 2; }, h.prototype.writeUInt16BE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 2, 65535, 0), this[b] = a >>> 8, this[b + 1] = 255 & a, b + 2; + return a = +a, b >>>= 0, c || F(this, a, b, 2, 65535, 0), this[b] = a >>> 8, this[b + 1] = 255 & a, b + 2; }, h.prototype.writeUInt32LE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 4, 4294967295, 0), this[b + 3] = a >>> 24, this[b + 2] = a >>> 16, this[b + 1] = a >>> 8, this[b] = 255 & a, b + 4; + return a = +a, b >>>= 0, c || F(this, a, b, 4, 4294967295, 0), this[b + 3] = a >>> 24, this[b + 2] = a >>> 16, this[b + 1] = a >>> 8, this[b] = 255 & a, b + 4; }, h.prototype.writeUInt32BE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 4, 4294967295, 0), this[b] = a >>> 24, this[b + 1] = a >>> 16, this[b + 2] = a >>> 8, this[b + 3] = 255 & a, b + 4; + return a = +a, b >>>= 0, c || F(this, a, b, 4, 4294967295, 0), this[b] = a >>> 24, this[b + 1] = a >>> 16, this[b + 2] = a >>> 8, this[b + 3] = 255 & a, b + 4; }, h.prototype.writeIntLE = function(a, b, c, d) { if (a = +a, b >>>= 0, !d) { var e = Math.pow(2, 8 * c - 1); - I(this, a, b, c, e - 1, -e); + F(this, a, b, c, e - 1, -e); } var f = 0, g = 1, h = 0; for(this[b] = 255 & a; ++f < c && (g *= 256);)a < 0 && 0 === h && 0 !== this[b + f - 1] && (h = 1), this[b + f] = (a / g >> 0) - h & 255; @@ -20573,29 +20558,29 @@ }, h.prototype.writeIntBE = function(a, b, c, d) { if (a = +a, b >>>= 0, !d) { var e = Math.pow(2, 8 * c - 1); - I(this, a, b, c, e - 1, -e); + F(this, a, b, c, e - 1, -e); } var f = c - 1, g = 1, h = 0; for(this[b + f] = 255 & a; --f >= 0 && (g *= 256);)a < 0 && 0 === h && 0 !== this[b + f + 1] && (h = 1), this[b + f] = (a / g >> 0) - h & 255; return b + c; }, h.prototype.writeInt8 = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 1, 127, -128), a < 0 && (a = 255 + a + 1), this[b] = 255 & a, b + 1; + return a = +a, b >>>= 0, c || F(this, a, b, 1, 127, -128), a < 0 && (a = 255 + a + 1), this[b] = 255 & a, b + 1; }, h.prototype.writeInt16LE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 2, 32767, -32768), this[b] = 255 & a, this[b + 1] = a >>> 8, b + 2; + return a = +a, b >>>= 0, c || F(this, a, b, 2, 32767, -32768), this[b] = 255 & a, this[b + 1] = a >>> 8, b + 2; }, h.prototype.writeInt16BE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 2, 32767, -32768), this[b] = a >>> 8, this[b + 1] = 255 & a, b + 2; + return a = +a, b >>>= 0, c || F(this, a, b, 2, 32767, -32768), this[b] = a >>> 8, this[b + 1] = 255 & a, b + 2; }, h.prototype.writeInt32LE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 4, 2147483647, -2147483648), this[b] = 255 & a, this[b + 1] = a >>> 8, this[b + 2] = a >>> 16, this[b + 3] = a >>> 24, b + 4; + return a = +a, b >>>= 0, c || F(this, a, b, 4, 2147483647, -2147483648), this[b] = 255 & a, this[b + 1] = a >>> 8, this[b + 2] = a >>> 16, this[b + 3] = a >>> 24, b + 4; }, h.prototype.writeInt32BE = function(a, b, c) { - return a = +a, b >>>= 0, c || I(this, a, b, 4, 2147483647, -2147483648), a < 0 && (a = 4294967295 + a + 1), this[b] = a >>> 24, this[b + 1] = a >>> 16, this[b + 2] = a >>> 8, this[b + 3] = 255 & a, b + 4; + return a = +a, b >>>= 0, c || F(this, a, b, 4, 2147483647, -2147483648), a < 0 && (a = 4294967295 + a + 1), this[b] = a >>> 24, this[b + 1] = a >>> 16, this[b + 2] = a >>> 8, this[b + 3] = 255 & a, b + 4; }, h.prototype.writeFloatLE = function(a, b, c) { - return K(this, a, b, !0, c); + return H(this, a, b, !0, c); }, h.prototype.writeFloatBE = function(a, b, c) { - return K(this, a, b, !1, c); + return H(this, a, b, !1, c); }, h.prototype.writeDoubleLE = function(a, b, c) { - return L(this, a, b, !0, c); + return I(this, a, b, !0, c); }, h.prototype.writeDoubleBE = function(a, b, c) { - return L(this, a, b, !1, c); + return I(this, a, b, !1, c); }, h.prototype.copy = function(a, b, c, d) { if (!h.isBuffer(a)) throw TypeError("argument should be a Buffer"); if (c || (c = 0), d || 0 === d || (d = this.length), b >= a.length && (b = a.length), b || (b = 0), d > 0 && d < c && (d = c), d === c || 0 === a.length || 0 === this.length) return 0; @@ -20627,8 +20612,8 @@ } return this; }; - var M = /[^+/0-9A-Za-z-_]/g; - function N(a, b) { + var J = /[^+/0-9A-Za-z-_]/g; + function K(a, b) { b = b || 1 / 0; for(var c, d = a.length, e = null, f = [], g = 0; g < d; ++g){ if ((c = a.charCodeAt(g)) > 55295 && c < 57344) { @@ -20662,29 +20647,29 @@ } return f; } - function O(a) { + function L(a) { for(var b = [], c = 0; c < a.length; ++c)b.push(255 & a.charCodeAt(c)); return b; } - function P(a, b) { + function M(a, b) { for(var c, d, e, f = [], g = 0; g < a.length && !((b -= 2) < 0); ++g)d = (c = a.charCodeAt(g)) >> 8, e = c % 256, f.push(e), f.push(d); return f; } - function Q(a) { + function N(a) { return d.toByteArray(function(a) { - if ((a = (a = a.split("=")[0]).trim().replace(M, "")).length < 2) return ""; + if ((a = (a = a.split("=")[0]).trim().replace(J, "")).length < 2) return ""; for(; a.length % 4 != 0;)a += "="; return a; }(a)); } - function R(a, b, c, d) { + function O(a, b, c, d) { for(var e = 0; e < d && !(e + c >= b.length) && !(e >= a.length); ++e)b[e + c] = a[e]; return e; } - function S(a, b) { + function P(a, b) { return a instanceof b || null != a && null != a.constructor && null != a.constructor.name && a.constructor.name === b.name; } - var T = function() { + var Q = function() { for(var a = "0123456789abcdef", b = Array(256), c = 0; c < 16; ++c)for(var d = 16 * c, e = 0; e < 16; ++e)b[d + e] = a[c] + a[e]; return b; }(); @@ -24821,22 +24806,19 @@ function bh(a, b) { return a = bg(a), aY(a, b); } - function bi(a, b, c) { - return a = bg(a), aZ(a, b, c); - } - function bj(a) { + function bi(a) { return null === ba ? (ba = [ a - ], bb = aZ(a3, bl)) : ba.push(a), a8; + ], bb = aZ(a3, bk)) : ba.push(a), a8; } - function bk() { + function bj() { if (null !== bb) { var a = bb; bb = null, a$(a); } - bl(); + bk(); } - function bl() { + function bk() { if (!bc && null !== ba) { bc = !0; var a = 0; @@ -24850,46 +24832,46 @@ } }), ba = null; } catch (c) { - throw null !== ba && (ba = ba.slice(a + 1)), aZ(a3, bk), c; + throw null !== ba && (ba = ba.slice(a + 1)), aZ(a3, bj), c; } finally{ bc = !1; } } } - var bm = 3; - function bn(a, b, c) { + var bl = 3; + function bm(a, b, c) { return 1073741821 - (((1073741821 - a + b / 10) / (c /= 10) | 0) + 1) * c; } - var bo = "function" == typeof Object.is ? Object.is : function(a, b) { + var bn = "function" == typeof Object.is ? Object.is : function(a, b) { return a === b && (0 !== a || 1 / a == 1 / b) || a != a && b != b; - }, bp = Object.prototype.hasOwnProperty; - function bq(a, b) { - if (bo(a, b)) return !0; + }, bo = Object.prototype.hasOwnProperty; + function bp(a, b) { + if (bn(a, b)) return !0; if ("object" != typeof a || null === a || "object" != typeof b || null === b) return !1; var c = Object.keys(a), d = Object.keys(b); if (c.length !== d.length) return !1; - for(d = 0; d < c.length; d++)if (!bp.call(b, c[d]) || !bo(a[c[d]], b[c[d]])) return !1; + for(d = 0; d < c.length; d++)if (!bo.call(b, c[d]) || !bn(a[c[d]], b[c[d]])) return !1; return !0; } - function br(a, b) { + function bq(a, b) { if (a && a.defaultProps) for(var c in b = j({}, b), a = a.defaultProps)void 0 === b[c] && (b[c] = a[c]); return b; } - var bs = { + var br = { current: null - }, bt = null, bu = null, bv = null; - function bw() { - bv = bu = bt = null; + }, bs = null, bt = null, bu = null; + function bv() { + bu = bt = bs = null; } - function bx(a, b) { + function bw(a, b) { var c = a.type._context; - Y ? (aL(bs, c._currentValue, a), c._currentValue = b) : (aL(bs, c._currentValue2, a), c._currentValue2 = b); + Y ? (aL(br, c._currentValue, a), c._currentValue = b) : (aL(br, c._currentValue2, a), c._currentValue2 = b); } - function by(a) { - var b = bs.current; - aK(bs, a), a = a.type._context, Y ? a._currentValue = b : a._currentValue2 = b; + function bx(a) { + var b = br.current; + aK(br, a), a = a.type._context, Y ? a._currentValue = b : a._currentValue2 = b; } - function bz(a, b) { + function by(a, b) { for(; null !== a;){ var c = a.alternate; if (a.childExpirationTime < b) a.childExpirationTime = b, null !== c && c.childExpirationTime < b && (c.childExpirationTime = b); @@ -24898,28 +24880,28 @@ a = a.return; } } - function bA(a, b) { - bt = a, bv = bu = null, null !== (a = a.dependencies) && null !== a.firstContext && (a.expirationTime >= b && (cY = !0), a.firstContext = null); + function bz(a, b) { + bs = a, bu = bt = null, null !== (a = a.dependencies) && null !== a.firstContext && (a.expirationTime >= b && (cX = !0), a.firstContext = null); } - function bB(a, b) { - if (bv !== a && !1 !== b && 0 !== b) { - if (("number" != typeof b || 1073741823 === b) && (bv = a, b = 1073741823), b = { + function bA(a, b) { + if (bu !== a && !1 !== b && 0 !== b) { + if (("number" != typeof b || 1073741823 === b) && (bu = a, b = 1073741823), b = { context: a, observedBits: b, next: null - }, null === bu) { - if (null === bt) throw Error(m(308)); - bu = b, bt.dependencies = { + }, null === bt) { + if (null === bs) throw Error(m(308)); + bt = b, bs.dependencies = { expirationTime: 0, firstContext: b, responders: null }; - } else bu = bu.next = b; + } else bt = bt.next = b; } return Y ? a._currentValue : a._currentValue2; } - var bC = !1; - function bD(a) { + var bB = !1; + function bC(a) { return { baseState: a, firstUpdate: null, @@ -24932,7 +24914,7 @@ lastCapturedEffect: null }; } - function bE(a) { + function bD(a) { return { baseState: a.baseState, firstUpdate: a.firstUpdate, @@ -24945,7 +24927,7 @@ lastCapturedEffect: null }; } - function bF(a, b) { + function bE(a, b) { return { expirationTime: a, suspenseConfig: b, @@ -24956,26 +24938,26 @@ nextEffect: null }; } - function bG(a, b) { + function bF(a, b) { null === a.lastUpdate ? a.firstUpdate = a.lastUpdate = b : (a.lastUpdate.next = b, a.lastUpdate = b); } - function bH(a, b) { + function bG(a, b) { var c = a.alternate; if (null === c) { var d = a.updateQueue, e = null; - null === d && (d = a.updateQueue = bD(a.memoizedState)); - } else d = a.updateQueue, e = c.updateQueue, null === d ? null === e ? (d = a.updateQueue = bD(a.memoizedState), e = c.updateQueue = bD(c.memoizedState)) : d = a.updateQueue = bE(e) : null === e && (e = c.updateQueue = bE(d)); - null === e || d === e ? bG(d, b) : null === d.lastUpdate || null === e.lastUpdate ? (bG(d, b), bG(e, b)) : (bG(d, b), e.lastUpdate = b); + null === d && (d = a.updateQueue = bC(a.memoizedState)); + } else d = a.updateQueue, e = c.updateQueue, null === d ? null === e ? (d = a.updateQueue = bC(a.memoizedState), e = c.updateQueue = bC(c.memoizedState)) : d = a.updateQueue = bD(e) : null === e && (e = c.updateQueue = bD(d)); + null === e || d === e ? bF(d, b) : null === d.lastUpdate || null === e.lastUpdate ? (bF(d, b), bF(e, b)) : (bF(d, b), e.lastUpdate = b); } - function bI(a, b) { + function bH(a, b) { var c = a.updateQueue; - null === (c = null === c ? a.updateQueue = bD(a.memoizedState) : bJ(a, c)).lastCapturedUpdate ? c.firstCapturedUpdate = c.lastCapturedUpdate = b : (c.lastCapturedUpdate.next = b, c.lastCapturedUpdate = b); + null === (c = null === c ? a.updateQueue = bC(a.memoizedState) : bI(a, c)).lastCapturedUpdate ? c.firstCapturedUpdate = c.lastCapturedUpdate = b : (c.lastCapturedUpdate.next = b, c.lastCapturedUpdate = b); } - function bJ(a, b) { + function bI(a, b) { var c = a.alternate; - return null !== c && b === c.updateQueue && (b = a.updateQueue = bE(b)), b; + return null !== c && b === c.updateQueue && (b = a.updateQueue = bD(b)), b; } - function bK(a, b, c, d, e, f) { + function bJ(a, b, c, d, e, f) { switch(c.tag){ case 1: return "function" == typeof (a = c.payload) ? a.call(f, d, e) : a; @@ -24985,26 +24967,26 @@ if (null == (e = "function" == typeof (a = c.payload) ? a.call(f, d, e) : a)) break; return j({}, d, e); case 2: - bC = !0; + bB = !0; } return d; } - function bL(a, b, c, d, e) { - bC = !1, b = bJ(a, b); + function bK(a, b, c, d, e) { + bB = !1, b = bI(a, b); for(var f = b.baseState, g = null, h = 0, i = b.firstUpdate, j = f; null !== i;){ var k = i.expirationTime; - k < e ? (null === g && (g = i, f = j), h < k && (h = k)) : (el(k, i.suspenseConfig), j = bK(a, b, i, j, c, d), null !== i.callback && (a.effectTag |= 32, i.nextEffect = null, null === b.lastEffect ? b.firstEffect = b.lastEffect = i : (b.lastEffect.nextEffect = i, b.lastEffect = i))), i = i.next; + k < e ? (null === g && (g = i, f = j), h < k && (h = k)) : (ek(k, i.suspenseConfig), j = bJ(a, b, i, j, c, d), null !== i.callback && (a.effectTag |= 32, i.nextEffect = null, null === b.lastEffect ? b.firstEffect = b.lastEffect = i : (b.lastEffect.nextEffect = i, b.lastEffect = i))), i = i.next; } for(k = null, i = b.firstCapturedUpdate; null !== i;){ var l = i.expirationTime; - l < e ? (null === k && (k = i, null === g && (f = j)), h < l && (h = l)) : (j = bK(a, b, i, j, c, d), null !== i.callback && (a.effectTag |= 32, i.nextEffect = null, null === b.lastCapturedEffect ? b.firstCapturedEffect = b.lastCapturedEffect = i : (b.lastCapturedEffect.nextEffect = i, b.lastCapturedEffect = i))), i = i.next; + l < e ? (null === k && (k = i, null === g && (f = j)), h < l && (h = l)) : (j = bJ(a, b, i, j, c, d), null !== i.callback && (a.effectTag |= 32, i.nextEffect = null, null === b.lastCapturedEffect ? b.firstCapturedEffect = b.lastCapturedEffect = i : (b.lastCapturedEffect.nextEffect = i, b.lastCapturedEffect = i))), i = i.next; } - null === g && (b.lastUpdate = null), null === k ? b.lastCapturedUpdate = null : a.effectTag |= 32, null === g && null === k && (f = j), b.baseState = f, b.firstUpdate = g, b.firstCapturedUpdate = k, em(h), a.expirationTime = h, a.memoizedState = j; + null === g && (b.lastUpdate = null), null === k ? b.lastCapturedUpdate = null : a.effectTag |= 32, null === g && null === k && (f = j), b.baseState = f, b.firstUpdate = g, b.firstCapturedUpdate = k, el(h), a.expirationTime = h, a.memoizedState = j; } - function bM(a, b, c) { - null !== b.firstCapturedUpdate && (null !== b.lastUpdate && (b.lastUpdate.next = b.firstCapturedUpdate, b.lastUpdate = b.lastCapturedUpdate), b.firstCapturedUpdate = b.lastCapturedUpdate = null), bN(b.firstEffect, c), b.firstEffect = b.lastEffect = null, bN(b.firstCapturedEffect, c), b.firstCapturedEffect = b.lastCapturedEffect = null; + function bL(a, b, c) { + null !== b.firstCapturedUpdate && (null !== b.lastUpdate && (b.lastUpdate.next = b.firstCapturedUpdate, b.lastUpdate = b.lastCapturedUpdate), b.firstCapturedUpdate = b.lastCapturedUpdate = null), bM(b.firstEffect, c), b.firstEffect = b.lastEffect = null, bM(b.firstCapturedEffect, c), b.firstCapturedEffect = b.lastCapturedEffect = null; } - function bN(a, b) { + function bM(a, b) { for(; null !== a;){ var c = a.callback; if (null !== c) { @@ -25016,48 +24998,48 @@ a = a.nextEffect; } } - var bO = n.ReactCurrentBatchConfig, bP = new k.Component().refs; - function bQ(a, b, c, d) { + var bN = n.ReactCurrentBatchConfig, bO = new k.Component().refs; + function bP(a, b, c, d) { c = null == (c = c(d, b = a.memoizedState)) ? b : j({}, b, c), a.memoizedState = c, d = a.updateQueue, null !== d && 0 === a.expirationTime && (d.baseState = c); } - var bR = { + var bQ = { isMounted: function(a) { return !!(a = a._reactInternalFiber) && F(a) === a; }, enqueueSetState: function(a, b, c) { a = a._reactInternalFiber; - var d = d9(), e = bO.suspense; - d = ea(d, a, e), (e = bF(d, e)).payload = b, null != c && (e.callback = c), bH(a, e), eb(a, d); + var d = d8(), e = bN.suspense; + d = d9(d, a, e), (e = bE(d, e)).payload = b, null != c && (e.callback = c), bG(a, e), ea(a, d); }, enqueueReplaceState: function(a, b, c) { a = a._reactInternalFiber; - var d = d9(), e = bO.suspense; - d = ea(d, a, e), (e = bF(d, e)).tag = 1, e.payload = b, null != c && (e.callback = c), bH(a, e), eb(a, d); + var d = d8(), e = bN.suspense; + d = d9(d, a, e), (e = bE(d, e)).tag = 1, e.payload = b, null != c && (e.callback = c), bG(a, e), ea(a, d); }, enqueueForceUpdate: function(a, b) { a = a._reactInternalFiber; - var c = d9(), d = bO.suspense; - c = ea(c, a, d), (d = bF(c, d)).tag = 2, null != b && (d.callback = b), bH(a, d), eb(a, c); + var c = d8(), d = bN.suspense; + c = d9(c, a, d), (d = bE(c, d)).tag = 2, null != b && (d.callback = b), bG(a, d), ea(a, c); } }; - function bS(a, b, c, d, e, f, g) { - return "function" == typeof (a = a.stateNode).shouldComponentUpdate ? a.shouldComponentUpdate(d, f, g) : !b.prototype || !b.prototype.isPureReactComponent || !bq(c, d) || !bq(e, f); + function bR(a, b, c, d, e, f, g) { + return "function" == typeof (a = a.stateNode).shouldComponentUpdate ? a.shouldComponentUpdate(d, f, g) : !b.prototype || !b.prototype.isPureReactComponent || !bp(c, d) || !bp(e, f); } - function bT(a, b, c) { + function bS(a, b, c) { var d = !1, e = aM, f = b.contextType; - return "object" == typeof f && null !== f ? f = bB(f) : (e = aR(b) ? aP : aN.current, d = b.contextTypes, f = (d = null != d) ? aQ(a, e) : aM), b = new b(c, f), a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null, b.updater = bR, a.stateNode = b, b._reactInternalFiber = a, d && ((a = a.stateNode).__reactInternalMemoizedUnmaskedChildContext = e, a.__reactInternalMemoizedMaskedChildContext = f), b; + return "object" == typeof f && null !== f ? f = bA(f) : (e = aR(b) ? aP : aN.current, d = b.contextTypes, f = (d = null != d) ? aQ(a, e) : aM), b = new b(c, f), a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null, b.updater = bQ, a.stateNode = b, b._reactInternalFiber = a, d && ((a = a.stateNode).__reactInternalMemoizedUnmaskedChildContext = e, a.__reactInternalMemoizedMaskedChildContext = f), b; } - function bU(a, b, c, d) { - a = b.state, "function" == typeof b.componentWillReceiveProps && b.componentWillReceiveProps(c, d), "function" == typeof b.UNSAFE_componentWillReceiveProps && b.UNSAFE_componentWillReceiveProps(c, d), b.state !== a && bR.enqueueReplaceState(b, b.state, null); + function bT(a, b, c, d) { + a = b.state, "function" == typeof b.componentWillReceiveProps && b.componentWillReceiveProps(c, d), "function" == typeof b.UNSAFE_componentWillReceiveProps && b.UNSAFE_componentWillReceiveProps(c, d), b.state !== a && bQ.enqueueReplaceState(b, b.state, null); } - function bV(a, b, c, d) { + function bU(a, b, c, d) { var e = a.stateNode; - e.props = c, e.state = a.memoizedState, e.refs = bP; + e.props = c, e.state = a.memoizedState, e.refs = bO; var f = b.contextType; - "object" == typeof f && null !== f ? e.context = bB(f) : (f = aR(b) ? aP : aN.current, e.context = aQ(a, f)), null !== (f = a.updateQueue) && (bL(a, f, c, e, d), e.state = a.memoizedState), "function" == typeof (f = b.getDerivedStateFromProps) && (bQ(a, b, f, c), e.state = a.memoizedState), "function" == typeof b.getDerivedStateFromProps || "function" == typeof e.getSnapshotBeforeUpdate || "function" != typeof e.UNSAFE_componentWillMount && "function" != typeof e.componentWillMount || (b = e.state, "function" == typeof e.componentWillMount && e.componentWillMount(), "function" == typeof e.UNSAFE_componentWillMount && e.UNSAFE_componentWillMount(), b !== e.state && bR.enqueueReplaceState(e, e.state, null), f = a.updateQueue, null !== f && (bL(a, f, c, e, d), e.state = a.memoizedState)), "function" == typeof e.componentDidMount && (a.effectTag |= 4); + "object" == typeof f && null !== f ? e.context = bA(f) : (f = aR(b) ? aP : aN.current, e.context = aQ(a, f)), null !== (f = a.updateQueue) && (bK(a, f, c, e, d), e.state = a.memoizedState), "function" == typeof (f = b.getDerivedStateFromProps) && (bP(a, b, f, c), e.state = a.memoizedState), "function" == typeof b.getDerivedStateFromProps || "function" == typeof e.getSnapshotBeforeUpdate || "function" != typeof e.UNSAFE_componentWillMount && "function" != typeof e.componentWillMount || (b = e.state, "function" == typeof e.componentWillMount && e.componentWillMount(), "function" == typeof e.UNSAFE_componentWillMount && e.UNSAFE_componentWillMount(), b !== e.state && bQ.enqueueReplaceState(e, e.state, null), f = a.updateQueue, null !== f && (bK(a, f, c, e, d), e.state = a.memoizedState)), "function" == typeof e.componentDidMount && (a.effectTag |= 4); } - var bW = Array.isArray; - function bX(a, b, c) { + var bV = Array.isArray; + function bW(a, b, c) { if (null !== (a = c.ref) && "function" != typeof a && "object" != typeof a) { if (c._owner) { if (c = c._owner) { @@ -25068,7 +25050,7 @@ var e = "" + a; return null !== b && null !== b.ref && "function" == typeof b.ref && b.ref._stringRef === e ? b.ref : ((b = function(a) { var b = d.refs; - b === bP && (b = d.refs = {}), null === a ? delete b[e] : b[e] = a; + b === bO && (b = d.refs = {}), null === a ? delete b[e] : b[e] = a; })._stringRef = e, b); } if ("string" != typeof a) throw Error(m(284)); @@ -25076,10 +25058,10 @@ } return a; } - function bY(a, b) { + function bX(a, b) { if ("textarea" !== a.type) throw Error(m(31, "[object Object]" === Object.prototype.toString.call(b) ? "object with keys {" + Object.keys(b).join(", ") + "}" : b, "")); } - function bZ(a) { + function bY(a) { function b(b, c) { if (a) { var d = b.lastEffect; @@ -25096,7 +25078,7 @@ return a; } function e(a, b, c) { - return (a = eH(a, b, c)).index = 0, a.sibling = null, a; + return (a = eG(a, b, c)).index = 0, a.sibling = null, a; } function f(b, c, d) { return (b.index = d, a) ? null !== (d = b.alternate) ? (d = d.index) < c ? (b.effectTag = 2, c) : d : (b.effectTag = 2, c) : c; @@ -25105,28 +25087,28 @@ return a && null === b.alternate && (b.effectTag = 2), b; } function h(a, b, c, d) { - return null === b || 6 !== b.tag ? ((b = eK(c, a.mode, d)).return = a, b) : ((b = e(b, c, d)).return = a, b); + return null === b || 6 !== b.tag ? ((b = eJ(c, a.mode, d)).return = a, b) : ((b = e(b, c, d)).return = a, b); } function i(a, b, c, d) { - return null !== b && b.elementType === c.type ? ((d = e(b, c.props, d)).ref = bX(a, b, c), d.return = a, d) : ((d = eI(c.type, c.key, c.props, null, a.mode, d)).ref = bX(a, b, c), d.return = a, d); + return null !== b && b.elementType === c.type ? ((d = e(b, c.props, d)).ref = bW(a, b, c), d.return = a, d) : ((d = eH(c.type, c.key, c.props, null, a.mode, d)).ref = bW(a, b, c), d.return = a, d); } function j(a, b, c, d) { - return null === b || 4 !== b.tag || b.stateNode.containerInfo !== c.containerInfo || b.stateNode.implementation !== c.implementation ? ((b = eL(c, a.mode, d)).return = a, b) : ((b = e(b, c.children || [], d)).return = a, b); + return null === b || 4 !== b.tag || b.stateNode.containerInfo !== c.containerInfo || b.stateNode.implementation !== c.implementation ? ((b = eK(c, a.mode, d)).return = a, b) : ((b = e(b, c.children || [], d)).return = a, b); } function k(a, b, c, d, f) { - return null === b || 7 !== b.tag ? ((b = eJ(c, a.mode, d, f)).return = a, b) : ((b = e(b, c, d)).return = a, b); + return null === b || 7 !== b.tag ? ((b = eI(c, a.mode, d, f)).return = a, b) : ((b = e(b, c, d)).return = a, b); } function l(a, b, c) { - if ("string" == typeof b || "number" == typeof b) return (b = eK("" + b, a.mode, c)).return = a, b; + if ("string" == typeof b || "number" == typeof b) return (b = eJ("" + b, a.mode, c)).return = a, b; if ("object" == typeof b && null !== b) { switch(b.$$typeof){ case p: - return (c = eI(b.type, b.key, b.props, null, a.mode, c)).ref = bX(a, null, b), c.return = a, c; + return (c = eH(b.type, b.key, b.props, null, a.mode, c)).ref = bW(a, null, b), c.return = a, c; case q: - return (b = eL(b, a.mode, c)).return = a, b; + return (b = eK(b, a.mode, c)).return = a, b; } - if (bW(b) || D(b)) return (b = eJ(b, a.mode, c, null)).return = a, b; - bY(a, b); + if (bV(b) || D(b)) return (b = eI(b, a.mode, c, null)).return = a, b; + bX(a, b); } return null; } @@ -25140,8 +25122,8 @@ case q: return c.key === e ? j(a, b, c, d) : null; } - if (bW(c) || D(c)) return null !== e ? null : k(a, b, c, d, null); - bY(a, c); + if (bV(c) || D(c)) return null !== e ? null : k(a, b, c, d, null); + bX(a, c); } return null; } @@ -25154,8 +25136,8 @@ case q: return j(b, a = a.get(null === d.key ? c : d.key) || null, d, e); } - if (bW(d) || D(d)) return k(b, a = a.get(c) || null, d, e, null); - bY(b, d); + if (bV(d) || D(d)) return k(b, a = a.get(c) || null, d, e, null); + bX(b, d); } return null; } @@ -25169,7 +25151,7 @@ for(t = j.key, s = i; null !== s;){ if (s.key === t) { if (7 === s.tag ? j.type === r : s.elementType === j.type) { - c(h, s.sibling), (i = e(s, j.type === r ? j.props.children : j.props, k)).ref = bX(h, s, j), i.return = h, h = i; + c(h, s.sibling), (i = e(s, j.type === r ? j.props.children : j.props, k)).ref = bW(h, s, j), i.return = h, h = i; break a; } c(h, s); @@ -25177,7 +25159,7 @@ } b(h, s), s = s.sibling; } - j.type === r ? ((i = eJ(j.props.children, h.mode, k, j.key)).return = h, h = i) : ((k = eI(j.type, j.key, j.props, null, h.mode, k)).ref = bX(h, i, j), k.return = h, h = k); + j.type === r ? ((i = eI(j.props.children, h.mode, k, j.key)).return = h, h = i) : ((k = eH(j.type, j.key, j.props, null, h.mode, k)).ref = bW(h, i, j), k.return = h, h = k); } return g(h); case q: @@ -25193,12 +25175,12 @@ } b(h, i), i = i.sibling; } - (i = eL(j, h.mode, k)).return = h, h = i; + (i = eK(j, h.mode, k)).return = h, h = i; } return g(h); } - if ("string" == typeof j || "number" == typeof j) return j = "" + j, null !== i && 6 === i.tag ? (c(h, i.sibling), (i = e(i, j, k)).return = h, h = i) : (c(h, i), (i = eK(j, h.mode, k)).return = h, h = i), g(h); - if (bW(j)) return function(e, g, h, i) { + if ("string" == typeof j || "number" == typeof j) return j = "" + j, null !== i && 6 === i.tag ? (c(h, i.sibling), (i = e(i, j, k)).return = h, h = i) : (c(h, i), (i = eJ(j, h.mode, k)).return = h, h = i), g(h); + if (bV(j)) return function(e, g, h, i) { for(var j = null, k = null, m = g, p = g = 0, q = null; null !== m && p < h.length; p++){ m.index > p ? (q = m, m = null) : q = m.sibling; var r = n(e, m, h[p], i); @@ -25241,7 +25223,7 @@ return b(e, a); }), j; }(h, i, j, k); - if (t && bY(h, j), void 0 === j && !s) switch(h.tag){ + if (t && bX(h, j), void 0 === j && !s) switch(h.tag){ case 1: case 0: throw Error(m(152, (h = h.type).displayName || h.name || "Component")); @@ -25249,34 +25231,34 @@ return c(h, i); }; } - var b$ = bZ(!0), b_ = bZ(!1), b0 = {}, b1 = { - current: b0 + var bZ = bY(!0), b$ = bY(!1), b_ = {}, b0 = { + current: b_ + }, b1 = { + current: b_ }, b2 = { - current: b0 - }, b3 = { - current: b0 + current: b_ }; - function b4(a) { - if (a === b0) throw Error(m(174)); + function b3(a) { + if (a === b_) throw Error(m(174)); return a; } - function b5(a, b) { - aL(b3, b, a), aL(b2, a, a), aL(b1, b0, a), b = K(b), aK(b1, a), aL(b1, b, a); + function b4(a, b) { + aL(b2, b, a), aL(b1, a, a), aL(b0, b_, a), b = K(b), aK(b0, a), aL(b0, b, a); + } + function b5(a) { + aK(b0, a), aK(b1, a), aK(b2, a); } function b6(a) { - aK(b1, a), aK(b2, a), aK(b3, a); + var b = b3(b2.current), c = b3(b0.current); + b = L(c, a.type, b), c !== b && (aL(b1, a, a), aL(b0, b, a)); } function b7(a) { - var b = b4(b3.current), c = b4(b1.current); - b = L(c, a.type, b), c !== b && (aL(b2, a, a), aL(b1, b, a)); - } - function b8(a) { - b2.current === a && (aK(b1, a), aK(b2, a)); + b1.current === a && (aK(b0, a), aK(b1, a)); } - var b9 = { + var b8 = { current: 0 }; - function ca(a) { + function b9(a) { for(var b = a; null !== b;){ if (13 === b.tag) { var c = b.memoizedState; @@ -25296,34 +25278,34 @@ } return null; } - function cb(a, b) { + function ca(a, b) { return { responder: a, props: b }; } - var cc = n.ReactCurrentDispatcher, cd = n.ReactCurrentBatchConfig, ce = 0, cf = null, cg = null, ch = null, ci = null, cj = null, ck = null, cl = 0, cm = null, cn = 0, co = !1, cp = null, cq = 0; - function cr() { + var cb = n.ReactCurrentDispatcher, cc = n.ReactCurrentBatchConfig, cd = 0, ce = null, cf = null, cg = null, ch = null, ci = null, cj = null, ck = 0, cl = null, cm = 0, cn = !1, co = null, cp = 0; + function cq() { throw Error(m(321)); } - function cs(a, b) { + function cr(a, b) { if (null === b) return !1; - for(var c = 0; c < b.length && c < a.length; c++)if (!bo(a[c], b[c])) return !1; + for(var c = 0; c < b.length && c < a.length; c++)if (!bn(a[c], b[c])) return !1; return !0; } - function ct(a, b, c, d, e, f) { - if (ce = f, cf = b, ch = null !== a ? a.memoizedState : null, cc.current = null === ch ? cM : cN, b = c(d, e), co) { - do co = !1, cq += 1, ch = null !== a ? a.memoizedState : null, ck = ci, cm = cj = cg = null, cc.current = cN, b = c(d, e); - while (co) - cp = null, cq = 0; + function cs(a, b, c, d, e, f) { + if (cd = f, ce = b, cg = null !== a ? a.memoizedState : null, cb.current = null === cg ? cL : cM, b = c(d, e), cn) { + do cn = !1, cp += 1, cg = null !== a ? a.memoizedState : null, cj = ch, cl = ci = cf = null, cb.current = cM, b = c(d, e); + while (cn) + co = null, cp = 0; } - if (cc.current = cL, (a = cf).memoizedState = ci, a.expirationTime = cl, a.updateQueue = cm, a.effectTag |= cn, a = null !== cg && null !== cg.next, ce = 0, ck = cj = ci = ch = cg = cf = null, cl = 0, cm = null, cn = 0, a) throw Error(m(300)); + if (cb.current = cK, (a = ce).memoizedState = ch, a.expirationTime = ck, a.updateQueue = cl, a.effectTag |= cm, a = null !== cf && null !== cf.next, cd = 0, cj = ci = ch = cg = cf = ce = null, ck = 0, cl = null, cm = 0, a) throw Error(m(300)); return b; } - function cu() { - cc.current = cL, ce = 0, ck = cj = ci = ch = cg = cf = null, cl = 0, cm = null, cn = 0, co = !1, cp = null, cq = 0; + function ct() { + cb.current = cK, cd = 0, cj = ci = ch = cg = cf = ce = null, ck = 0, cl = null, cm = 0, cn = !1, co = null, cp = 0; } - function cv() { + function cu() { var a = { memoizedState: null, baseState: null, @@ -25331,39 +25313,39 @@ baseUpdate: null, next: null }; - return null === cj ? ci = cj = a : cj = cj.next = a, cj; + return null === ci ? ch = ci = a : ci = ci.next = a, ci; } - function cw() { - if (null !== ck) ck = (cj = ck).next, ch = null !== (cg = ch) ? cg.next : null; + function cv() { + if (null !== cj) cj = (ci = cj).next, cg = null !== (cf = cg) ? cf.next : null; else { - if (null === ch) throw Error(m(310)); + if (null === cg) throw Error(m(310)); var a = { - memoizedState: (cg = ch).memoizedState, - baseState: cg.baseState, - queue: cg.queue, - baseUpdate: cg.baseUpdate, + memoizedState: (cf = cg).memoizedState, + baseState: cf.baseState, + queue: cf.queue, + baseUpdate: cf.baseUpdate, next: null }; - cj = null === cj ? ci = a : cj.next = a, ch = cg.next; + ci = null === ci ? ch = a : ci.next = a, cg = cf.next; } - return cj; + return ci; } - function cx(a, b) { + function cw(a, b) { return "function" == typeof b ? b(a) : b; } - function cy(a) { - var b = cw(), c = b.queue; + function cx(a) { + var b = cv(), c = b.queue; if (null === c) throw Error(m(311)); - if (c.lastRenderedReducer = a, 0 < cq) { + if (c.lastRenderedReducer = a, 0 < cp) { var d = c.dispatch; - if (null !== cp) { - var e = cp.get(c); + if (null !== co) { + var e = co.get(c); if (void 0 !== e) { - cp.delete(c); + co.delete(c); var f = b.memoizedState; do f = a(f, e.action), e = e.next; while (null !== e) - return bo(f, b.memoizedState) || (cY = !0), b.memoizedState = f, b.baseUpdate === c.last && (b.baseState = f), c.lastRenderedState = f, [ + return bn(f, b.memoizedState) || (cX = !0), b.memoizedState = f, b.baseUpdate === c.last && (b.baseState = f), c.lastRenderedState = f, [ f, d ]; @@ -25380,107 +25362,107 @@ var h = e = null, i = d, j = !1; do { var k = i.expirationTime; - k < ce ? (j || (j = !0, h = g, e = f), k > cl && em(cl = k)) : (el(k, i.suspenseConfig), f = i.eagerReducer === a ? i.eagerState : a(f, i.action)), g = i, i = i.next; + k < cd ? (j || (j = !0, h = g, e = f), k > ck && el(ck = k)) : (ek(k, i.suspenseConfig), f = i.eagerReducer === a ? i.eagerState : a(f, i.action)), g = i, i = i.next; }while (null !== i && i !== d) - j || (h = g, e = f), bo(f, b.memoizedState) || (cY = !0), b.memoizedState = f, b.baseUpdate = h, b.baseState = e, c.lastRenderedState = f; + j || (h = g, e = f), bn(f, b.memoizedState) || (cX = !0), b.memoizedState = f, b.baseUpdate = h, b.baseState = e, c.lastRenderedState = f; } return [ b.memoizedState, c.dispatch ]; } - function cz(a) { - var b = cv(); + function cy(a) { + var b = cu(); return "function" == typeof a && (a = a()), b.memoizedState = b.baseState = a, a = (a = b.queue = { last: null, dispatch: null, - lastRenderedReducer: cx, + lastRenderedReducer: cw, lastRenderedState: a - }).dispatch = cK.bind(null, cf, a), [ + }).dispatch = cJ.bind(null, ce, a), [ b.memoizedState, a ]; } - function cA(a) { - return cy(cx, a); + function cz(a) { + return cx(cw, a); } - function cB(a, b, c, d) { + function cA(a, b, c, d) { return a = { tag: a, create: b, destroy: c, deps: d, next: null - }, null === cm ? (cm = { + }, null === cl ? (cl = { lastEffect: null - }).lastEffect = a.next = a : null === (b = cm.lastEffect) ? cm.lastEffect = a.next = a : (c = b.next, b.next = a, a.next = c, cm.lastEffect = a), a; + }).lastEffect = a.next = a : null === (b = cl.lastEffect) ? cl.lastEffect = a.next = a : (c = b.next, b.next = a, a.next = c, cl.lastEffect = a), a; + } + function cB(a, b, c, d) { + var e = cu(); + cm |= a, e.memoizedState = cA(b, c, void 0, void 0 === d ? null : d); } function cC(a, b, c, d) { var e = cv(); - cn |= a, e.memoizedState = cB(b, c, void 0, void 0 === d ? null : d); - } - function cD(a, b, c, d) { - var e = cw(); d = void 0 === d ? null : d; var f = void 0; - if (null !== cg) { - var g = cg.memoizedState; - if (f = g.destroy, null !== d && cs(d, g.deps)) { - cB(0, c, f, d); + if (null !== cf) { + var g = cf.memoizedState; + if (f = g.destroy, null !== d && cr(d, g.deps)) { + cA(0, c, f, d); return; } } - cn |= a, e.memoizedState = cB(b, c, f, d); + cm |= a, e.memoizedState = cA(b, c, f, d); + } + function cD(a, b) { + return cB(516, 192, a, b); } function cE(a, b) { return cC(516, 192, a, b); } function cF(a, b) { - return cD(516, 192, a, b); - } - function cG(a, b) { return "function" == typeof b ? (b(a = a()), function() { b(null); }) : null != b ? (a = a(), b.current = a, function() { b.current = null; }) : void 0; } - function cH() {} - function cI(a, b) { - return cv().memoizedState = [ + function cG() {} + function cH(a, b) { + return cu().memoizedState = [ a, void 0 === b ? null : b ], a; } - function cJ(a, b) { - var c = cw(); + function cI(a, b) { + var c = cv(); b = void 0 === b ? null : b; var d = c.memoizedState; - return null !== d && null !== b && cs(b, d[1]) ? d[0] : (c.memoizedState = [ + return null !== d && null !== b && cr(b, d[1]) ? d[0] : (c.memoizedState = [ a, b ], a); } - function cK(a, b, c) { - if (!(25 > cq)) throw Error(m(301)); + function cJ(a, b, c) { + if (!(25 > cp)) throw Error(m(301)); var d = a.alternate; - if (a === cf || null !== d && d === cf) { - if (co = !0, a = { - expirationTime: ce, + if (a === ce || null !== d && d === ce) { + if (cn = !0, a = { + expirationTime: cd, suspenseConfig: null, action: c, eagerReducer: null, eagerState: null, next: null - }, null === cp && (cp = new Map()), void 0 === (c = cp.get(b))) cp.set(b, a); + }, null === co && (co = new Map()), void 0 === (c = co.get(b))) co.set(b, a); else { for(b = c; null !== b.next;)b = b.next; b.next = a; } } else { - var e = d9(), f = bO.suspense; + var e = d8(), f = bN.suspense; f = { - expirationTime: e = ea(e, a, f), + expirationTime: e = d9(e, a, f), suspenseConfig: f, action: c, eagerReducer: null, @@ -25495,77 +25477,77 @@ } if (b.last = f, 0 === a.expirationTime && (null === d || 0 === d.expirationTime) && null !== (d = b.lastRenderedReducer)) try { var i = b.lastRenderedState, j = d(i, c); - if (f.eagerReducer = d, f.eagerState = j, bo(j, i)) return; + if (f.eagerReducer = d, f.eagerState = j, bn(j, i)) return; } catch (k) {} finally{} - eb(a, e); + ea(a, e); } } - var cL = { - readContext: bB, - useCallback: cr, - useContext: cr, - useEffect: cr, - useImperativeHandle: cr, - useLayoutEffect: cr, - useMemo: cr, - useReducer: cr, - useRef: cr, - useState: cr, - useDebugValue: cr, - useResponder: cr, - useDeferredValue: cr, - useTransition: cr - }, cM = { - readContext: bB, - useCallback: cI, - useContext: bB, - useEffect: cE, + var cK = { + readContext: bA, + useCallback: cq, + useContext: cq, + useEffect: cq, + useImperativeHandle: cq, + useLayoutEffect: cq, + useMemo: cq, + useReducer: cq, + useRef: cq, + useState: cq, + useDebugValue: cq, + useResponder: cq, + useDeferredValue: cq, + useTransition: cq + }, cL = { + readContext: bA, + useCallback: cH, + useContext: bA, + useEffect: cD, useImperativeHandle: function(a, b, c) { return c = null != c ? c.concat([ a - ]) : null, cC(4, 36, cG.bind(null, b, a), c); + ]) : null, cB(4, 36, cF.bind(null, b, a), c); }, useLayoutEffect: function(a, b) { - return cC(4, 36, a, b); + return cB(4, 36, a, b); }, useMemo: function(a, b) { - var c = cv(); + var c = cu(); return b = void 0 === b ? null : b, a = a(), c.memoizedState = [ a, b ], a; }, useReducer: function(a, b, c) { - var d = cv(); + var d = cu(); return b = void 0 !== c ? c(b) : b, d.memoizedState = d.baseState = b, a = (a = d.queue = { last: null, dispatch: null, lastRenderedReducer: a, lastRenderedState: b - }).dispatch = cK.bind(null, cf, a), [ + }).dispatch = cJ.bind(null, ce, a), [ d.memoizedState, a ]; }, useRef: function(a) { - var b = cv(); + var b = cu(); return a = { current: a }, b.memoizedState = a; }, - useState: cz, - useDebugValue: cH, - useResponder: cb, + useState: cy, + useDebugValue: cG, + useResponder: ca, useDeferredValue: function(a, b) { - var c = cz(a), d = c[0], e = c[1]; - return cE(function() { + var c = cy(a), d = c[0], e = c[1]; + return cD(function() { l.unstable_next(function() { - var c = cd.suspense; - cd.suspense = void 0 === b ? null : b; + var c = cc.suspense; + cc.suspense = void 0 === b ? null : b; try { e(a); } finally{ - cd.suspense = c; + cc.suspense = c; } }); }, [ @@ -25574,16 +25556,16 @@ ]), d; }, useTransition: function(a) { - var b = cz(!1), c = b[0], d = b[1]; + var b = cy(!1), c = b[0], d = b[1]; return [ - cI(function(b) { + cH(function(b) { d(!0), l.unstable_next(function() { - var c = cd.suspense; - cd.suspense = void 0 === a ? null : a; + var c = cc.suspense; + cc.suspense = void 0 === a ? null : a; try { d(!1), b(); } finally{ - cd.suspense = c; + cc.suspense = c; } }); }, [ @@ -25593,45 +25575,45 @@ c, ]; } - }, cN = { - readContext: bB, - useCallback: cJ, - useContext: bB, - useEffect: cF, + }, cM = { + readContext: bA, + useCallback: cI, + useContext: bA, + useEffect: cE, useImperativeHandle: function(a, b, c) { return c = null != c ? c.concat([ a - ]) : null, cD(4, 36, cG.bind(null, b, a), c); + ]) : null, cC(4, 36, cF.bind(null, b, a), c); }, useLayoutEffect: function(a, b) { - return cD(4, 36, a, b); + return cC(4, 36, a, b); }, useMemo: function(a, b) { - var c = cw(); + var c = cv(); b = void 0 === b ? null : b; var d = c.memoizedState; - return null !== d && null !== b && cs(b, d[1]) ? d[0] : (a = a(), c.memoizedState = [ + return null !== d && null !== b && cr(b, d[1]) ? d[0] : (a = a(), c.memoizedState = [ a, b ], a); }, - useReducer: cy, + useReducer: cx, useRef: function() { - return cw().memoizedState; + return cv().memoizedState; }, - useState: cA, - useDebugValue: cH, - useResponder: cb, + useState: cz, + useDebugValue: cG, + useResponder: ca, useDeferredValue: function(a, b) { - var c = cA(a), d = c[0], e = c[1]; - return cF(function() { + var c = cz(a), d = c[0], e = c[1]; + return cE(function() { l.unstable_next(function() { - var c = cd.suspense; - cd.suspense = void 0 === b ? null : b; + var c = cc.suspense; + cc.suspense = void 0 === b ? null : b; try { e(a); } finally{ - cd.suspense = c; + cc.suspense = c; } }); }, [ @@ -25640,16 +25622,16 @@ ]), d; }, useTransition: function(a) { - var b = cA(!1), c = b[0], d = b[1]; + var b = cz(!1), c = b[0], d = b[1]; return [ - cJ(function(b) { + cI(function(b) { d(!0), l.unstable_next(function() { - var c = cd.suspense; - cd.suspense = void 0 === a ? null : a; + var c = cc.suspense; + cc.suspense = void 0 === a ? null : a; try { d(!1), b(); } finally{ - cd.suspense = c; + cc.suspense = c; } }); }, [ @@ -25659,12 +25641,12 @@ c, ]; } - }, cO = null, cP = null, cQ = !1; - function cR(a, b) { - var c = eE(5, null, null, 0); + }, cN = null, cO = null, cP = !1; + function cQ(a, b) { + var c = eD(5, null, null, 0); c.elementType = "DELETED", c.type = "DELETED", c.stateNode = b, c.return = a, c.effectTag = 8, null !== a.lastEffect ? (a.lastEffect.nextEffect = c, a.lastEffect = c) : a.firstEffect = a.lastEffect = c; } - function cS(a, b) { + function cR(a, b) { switch(a.tag){ case 5: return null !== (b = av(b, a.type, a.pendingProps)) && (a.stateNode = b, !0); @@ -25674,132 +25656,132 @@ return !1; } } - function cT(a) { - if (cQ) { - var b = cP; + function cS(a) { + if (cP) { + var b = cO; if (b) { var c = b; - if (!cS(a, b)) { - if (!(b = az(c)) || !cS(a, b)) { - a.effectTag = -1025 & a.effectTag | 2, cQ = !1, cO = a; + if (!cR(a, b)) { + if (!(b = az(c)) || !cR(a, b)) { + a.effectTag = -1025 & a.effectTag | 2, cP = !1, cN = a; return; } - cR(cO, c); + cQ(cN, c); } - cO = a, cP = aA(b); - } else a.effectTag = -1025 & a.effectTag | 2, cQ = !1, cO = a; + cN = a, cO = aA(b); + } else a.effectTag = -1025 & a.effectTag | 2, cP = !1, cN = a; } } - function cU(a) { + function cT(a) { for(a = a.return; null !== a && 5 !== a.tag && 3 !== a.tag && 13 !== a.tag;)a = a.return; - cO = a; + cN = a; } - function cV(a) { - if (!_ || a !== cO) return !1; - if (!cQ) return cU(a), cQ = !0, !1; + function cU(a) { + if (!_ || a !== cN) return !1; + if (!cP) return cT(a), cP = !0, !1; var b = a.type; - if (5 !== a.tag || "head" !== b && "body" !== b && !S(b, a.memoizedProps)) for(b = cP; b;)cR(a, b), b = az(b); - if (cU(a), 13 === a.tag) { + if (5 !== a.tag || "head" !== b && "body" !== b && !S(b, a.memoizedProps)) for(b = cO; b;)cQ(a, b), b = az(b); + if (cT(a), 13 === a.tag) { if (!_) throw Error(m(316)); if (!(a = null !== (a = a.memoizedState) ? a.dehydrated : null)) throw Error(m(317)); - cP = aD(a); - } else cP = cO ? az(a.stateNode) : null; + cO = aD(a); + } else cO = cN ? az(a.stateNode) : null; return !0; } - function cW() { - _ && (cP = cO = null, cQ = !1); + function cV() { + _ && (cO = cN = null, cP = !1); } - var cX = n.ReactCurrentOwner, cY = !1; - function cZ(a, b, c, d) { - b.child = null === a ? b_(b, null, c, d) : b$(b, a.child, c, d); + var cW = n.ReactCurrentOwner, cX = !1; + function cY(a, b, c, d) { + b.child = null === a ? b$(b, null, c, d) : bZ(b, a.child, c, d); } - function c$(a, b, c, d, e) { + function cZ(a, b, c, d, e) { c = c.render; var f = b.ref; - return (bA(b, e), d = ct(a, b, c, d, f, e), null === a || cY) ? (b.effectTag |= 1, cZ(a, b, d, e), b.child) : (b.updateQueue = a.updateQueue, b.effectTag &= -517, a.expirationTime <= e && (a.expirationTime = 0), db(a, b, e)); + return (bz(b, e), d = cs(a, b, c, d, f, e), null === a || cX) ? (b.effectTag |= 1, cY(a, b, d, e), b.child) : (b.updateQueue = a.updateQueue, b.effectTag &= -517, a.expirationTime <= e && (a.expirationTime = 0), da(a, b, e)); } - function c_(a, b, c, d, e, f) { + function c$(a, b, c, d, e, f) { if (null === a) { var g = c.type; - return "function" != typeof g || eF(g) || void 0 !== g.defaultProps || null !== c.compare || void 0 !== c.defaultProps ? ((a = eI(c.type, null, d, null, b.mode, f)).ref = b.ref, a.return = b, b.child = a) : (b.tag = 15, b.type = g, c0(a, b, g, d, e, f)); + return "function" != typeof g || eE(g) || void 0 !== g.defaultProps || null !== c.compare || void 0 !== c.defaultProps ? ((a = eH(c.type, null, d, null, b.mode, f)).ref = b.ref, a.return = b, b.child = a) : (b.tag = 15, b.type = g, c_(a, b, g, d, e, f)); } - return (g = a.child, e < f && (e = g.memoizedProps, (c = null !== (c = c.compare) ? c : bq)(e, d) && a.ref === b.ref)) ? db(a, b, f) : (b.effectTag |= 1, (a = eH(g, d, f)).ref = b.ref, a.return = b, b.child = a); + return (g = a.child, e < f && (e = g.memoizedProps, (c = null !== (c = c.compare) ? c : bp)(e, d) && a.ref === b.ref)) ? da(a, b, f) : (b.effectTag |= 1, (a = eG(g, d, f)).ref = b.ref, a.return = b, b.child = a); } - function c0(a, b, c, d, e, f) { - return null !== a && bq(a.memoizedProps, d) && a.ref === b.ref && (cY = !1, e < f) ? db(a, b, f) : c2(a, b, c, d, f); + function c_(a, b, c, d, e, f) { + return null !== a && bp(a.memoizedProps, d) && a.ref === b.ref && (cX = !1, e < f) ? da(a, b, f) : c1(a, b, c, d, f); } - function c1(a, b) { + function c0(a, b) { var c = b.ref; (null === a && null !== c || null !== a && a.ref !== c) && (b.effectTag |= 128); } - function c2(a, b, c, d, e) { + function c1(a, b, c, d, e) { var f = aR(c) ? aP : aN.current; - return (f = aQ(b, f), bA(b, e), c = ct(a, b, c, d, f, e), null === a || cY) ? (b.effectTag |= 1, cZ(a, b, c, e), b.child) : (b.updateQueue = a.updateQueue, b.effectTag &= -517, a.expirationTime <= e && (a.expirationTime = 0), db(a, b, e)); + return (f = aQ(b, f), bz(b, e), c = cs(a, b, c, d, f, e), null === a || cX) ? (b.effectTag |= 1, cY(a, b, c, e), b.child) : (b.updateQueue = a.updateQueue, b.effectTag &= -517, a.expirationTime <= e && (a.expirationTime = 0), da(a, b, e)); } - function c3(a, b, c, d, e) { + function c2(a, b, c, d, e) { if (aR(c)) { var f = !0; aW(b); } else f = !1; - if (bA(b, e), null === b.stateNode) null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), bT(b, c, d, e), bV(b, c, d, e), d = !0; + if (bz(b, e), null === b.stateNode) null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), bS(b, c, d, e), bU(b, c, d, e), d = !0; else if (null === a) { var g = b.stateNode, h = b.memoizedProps; g.props = h; var i = g.context, j = c.contextType; - "object" == typeof j && null !== j ? j = bB(j) : (j = aR(c) ? aP : aN.current, j = aQ(b, j)); + "object" == typeof j && null !== j ? j = bA(j) : (j = aR(c) ? aP : aN.current, j = aQ(b, j)); var k = c.getDerivedStateFromProps, l = "function" == typeof k || "function" == typeof g.getSnapshotBeforeUpdate; - l || "function" != typeof g.UNSAFE_componentWillReceiveProps && "function" != typeof g.componentWillReceiveProps || (h !== d || i !== j) && bU(b, g, d, j), bC = !1; + l || "function" != typeof g.UNSAFE_componentWillReceiveProps && "function" != typeof g.componentWillReceiveProps || (h !== d || i !== j) && bT(b, g, d, j), bB = !1; var m = b.memoizedState; i = g.state = m; var n = b.updateQueue; - null !== n && (bL(b, n, d, g, e), i = b.memoizedState), h !== d || m !== i || aO.current || bC ? ("function" == typeof k && (bQ(b, c, k, d), i = b.memoizedState), (h = bC || bS(b, c, h, d, m, i, j)) ? (l || "function" != typeof g.UNSAFE_componentWillMount && "function" != typeof g.componentWillMount || ("function" == typeof g.componentWillMount && g.componentWillMount(), "function" == typeof g.UNSAFE_componentWillMount && g.UNSAFE_componentWillMount()), "function" == typeof g.componentDidMount && (b.effectTag |= 4)) : ("function" == typeof g.componentDidMount && (b.effectTag |= 4), b.memoizedProps = d, b.memoizedState = i), g.props = d, g.state = i, g.context = j, d = h) : ("function" == typeof g.componentDidMount && (b.effectTag |= 4), d = !1); - } else g = b.stateNode, h = b.memoizedProps, g.props = b.type === b.elementType ? h : br(b.type, h), i = g.context, j = c.contextType, "object" == typeof j && null !== j ? j = bB(j) : (j = aR(c) ? aP : aN.current, j = aQ(b, j)), k = c.getDerivedStateFromProps, (l = "function" == typeof k || "function" == typeof g.getSnapshotBeforeUpdate) || "function" != typeof g.UNSAFE_componentWillReceiveProps && "function" != typeof g.componentWillReceiveProps || (h !== d || i !== j) && bU(b, g, d, j), bC = !1, i = b.memoizedState, m = g.state = i, n = b.updateQueue, null !== n && (bL(b, n, d, g, e), m = b.memoizedState), h !== d || i !== m || aO.current || bC ? ("function" == typeof k && (bQ(b, c, k, d), m = b.memoizedState), (k = bC || bS(b, c, h, d, i, m, j)) ? (l || "function" != typeof g.UNSAFE_componentWillUpdate && "function" != typeof g.componentWillUpdate || ("function" == typeof g.componentWillUpdate && g.componentWillUpdate(d, m, j), "function" == typeof g.UNSAFE_componentWillUpdate && g.UNSAFE_componentWillUpdate(d, m, j)), "function" == typeof g.componentDidUpdate && (b.effectTag |= 4), "function" == typeof g.getSnapshotBeforeUpdate && (b.effectTag |= 256)) : ("function" != typeof g.componentDidUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 4), "function" != typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 256), b.memoizedProps = d, b.memoizedState = m), g.props = d, g.state = m, g.context = j, d = k) : ("function" != typeof g.componentDidUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 4), "function" != typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 256), d = !1); - return c4(a, b, c, d, f, e); + null !== n && (bK(b, n, d, g, e), i = b.memoizedState), h !== d || m !== i || aO.current || bB ? ("function" == typeof k && (bP(b, c, k, d), i = b.memoizedState), (h = bB || bR(b, c, h, d, m, i, j)) ? (l || "function" != typeof g.UNSAFE_componentWillMount && "function" != typeof g.componentWillMount || ("function" == typeof g.componentWillMount && g.componentWillMount(), "function" == typeof g.UNSAFE_componentWillMount && g.UNSAFE_componentWillMount()), "function" == typeof g.componentDidMount && (b.effectTag |= 4)) : ("function" == typeof g.componentDidMount && (b.effectTag |= 4), b.memoizedProps = d, b.memoizedState = i), g.props = d, g.state = i, g.context = j, d = h) : ("function" == typeof g.componentDidMount && (b.effectTag |= 4), d = !1); + } else g = b.stateNode, h = b.memoizedProps, g.props = b.type === b.elementType ? h : bq(b.type, h), i = g.context, j = c.contextType, "object" == typeof j && null !== j ? j = bA(j) : (j = aR(c) ? aP : aN.current, j = aQ(b, j)), k = c.getDerivedStateFromProps, (l = "function" == typeof k || "function" == typeof g.getSnapshotBeforeUpdate) || "function" != typeof g.UNSAFE_componentWillReceiveProps && "function" != typeof g.componentWillReceiveProps || (h !== d || i !== j) && bT(b, g, d, j), bB = !1, i = b.memoizedState, m = g.state = i, n = b.updateQueue, null !== n && (bK(b, n, d, g, e), m = b.memoizedState), h !== d || i !== m || aO.current || bB ? ("function" == typeof k && (bP(b, c, k, d), m = b.memoizedState), (k = bB || bR(b, c, h, d, i, m, j)) ? (l || "function" != typeof g.UNSAFE_componentWillUpdate && "function" != typeof g.componentWillUpdate || ("function" == typeof g.componentWillUpdate && g.componentWillUpdate(d, m, j), "function" == typeof g.UNSAFE_componentWillUpdate && g.UNSAFE_componentWillUpdate(d, m, j)), "function" == typeof g.componentDidUpdate && (b.effectTag |= 4), "function" == typeof g.getSnapshotBeforeUpdate && (b.effectTag |= 256)) : ("function" != typeof g.componentDidUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 4), "function" != typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 256), b.memoizedProps = d, b.memoizedState = m), g.props = d, g.state = m, g.context = j, d = k) : ("function" != typeof g.componentDidUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 4), "function" != typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && i === a.memoizedState || (b.effectTag |= 256), d = !1); + return c3(a, b, c, d, f, e); } - function c4(a, b, c, d, e, f) { - c1(a, b); + function c3(a, b, c, d, e, f) { + c0(a, b); var g = 0 != (64 & b.effectTag); - if (!d && !g) return e && aX(b, c, !1), db(a, b, f); - d = b.stateNode, cX.current = b; + if (!d && !g) return e && aX(b, c, !1), da(a, b, f); + d = b.stateNode, cW.current = b; var h = g && "function" != typeof c.getDerivedStateFromError ? null : d.render(); - return b.effectTag |= 1, null !== a && g ? (b.child = b$(b, a.child, null, f), b.child = b$(b, null, h, f)) : cZ(a, b, h, f), b.memoizedState = d.state, e && aX(b, c, !0), b.child; + return b.effectTag |= 1, null !== a && g ? (b.child = bZ(b, a.child, null, f), b.child = bZ(b, null, h, f)) : cY(a, b, h, f), b.memoizedState = d.state, e && aX(b, c, !0), b.child; } - function c5(a) { + function c4(a) { var b = a.stateNode; - b.pendingContext ? aU(a, b.pendingContext, b.pendingContext !== b.context) : b.context && aU(a, b.context, !1), b5(a, b.containerInfo); + b.pendingContext ? aU(a, b.pendingContext, b.pendingContext !== b.context) : b.context && aU(a, b.context, !1), b4(a, b.containerInfo); } - var c6 = { + var c5 = { dehydrated: null, retryTime: 0 }; - function c7(a, b, c) { - var d, e = b.mode, f = b.pendingProps, g = b9.current, h = !1; - if ((d = 0 != (64 & b.effectTag)) || (d = 0 != (2 & g) && (null === a || null !== a.memoizedState)), d ? (h = !0, b.effectTag &= -65) : null !== a && null === a.memoizedState || void 0 === f.fallback || !0 === f.unstable_avoidThisFallback || (g |= 1), aL(b9, 1 & g, b), null === a) { - if (void 0 !== f.fallback && cT(b), h) { - if (h = f.fallback, (f = eJ(null, e, 0, null)).return = b, 0 == (2 & b.mode)) for(a = null !== b.memoizedState ? b.child.child : b.child, f.child = a; null !== a;)a.return = f, a = a.sibling; - return (c = eJ(h, e, c, null)).return = b, f.sibling = c, b.memoizedState = c6, b.child = f, c; - } - return e = f.children, b.memoizedState = null, b.child = b_(b, null, e, c); + function c6(a, b, c) { + var d, e = b.mode, f = b.pendingProps, g = b8.current, h = !1; + if ((d = 0 != (64 & b.effectTag)) || (d = 0 != (2 & g) && (null === a || null !== a.memoizedState)), d ? (h = !0, b.effectTag &= -65) : null !== a && null === a.memoizedState || void 0 === f.fallback || !0 === f.unstable_avoidThisFallback || (g |= 1), aL(b8, 1 & g, b), null === a) { + if (void 0 !== f.fallback && cS(b), h) { + if (h = f.fallback, (f = eI(null, e, 0, null)).return = b, 0 == (2 & b.mode)) for(a = null !== b.memoizedState ? b.child.child : b.child, f.child = a; null !== a;)a.return = f, a = a.sibling; + return (c = eI(h, e, c, null)).return = b, f.sibling = c, b.memoizedState = c5, b.child = f, c; + } + return e = f.children, b.memoizedState = null, b.child = b$(b, null, e, c); } if (null !== a.memoizedState) { if (e = (a = a.child).sibling, h) { - if (f = f.fallback, (c = eH(a, a.pendingProps, 0)).return = b, 0 == (2 & b.mode) && (h = null !== b.memoizedState ? b.child.child : b.child) !== a.child) for(c.child = h; null !== h;)h.return = c, h = h.sibling; - return (e = eH(e, f, e.expirationTime)).return = b, c.sibling = e, c.childExpirationTime = 0, b.memoizedState = c6, b.child = c, e; + if (f = f.fallback, (c = eG(a, a.pendingProps, 0)).return = b, 0 == (2 & b.mode) && (h = null !== b.memoizedState ? b.child.child : b.child) !== a.child) for(c.child = h; null !== h;)h.return = c, h = h.sibling; + return (e = eG(e, f, e.expirationTime)).return = b, c.sibling = e, c.childExpirationTime = 0, b.memoizedState = c5, b.child = c, e; } - return c = b$(b, a.child, f.children, c), b.memoizedState = null, b.child = c; + return c = bZ(b, a.child, f.children, c), b.memoizedState = null, b.child = c; } if (a = a.child, h) { - if (h = f.fallback, (f = eJ(null, e, 0, null)).return = b, f.child = a, null !== a && (a.return = f), 0 == (2 & b.mode)) for(a = null !== b.memoizedState ? b.child.child : b.child, f.child = a; null !== a;)a.return = f, a = a.sibling; - return (c = eJ(h, e, c, null)).return = b, f.sibling = c, c.effectTag |= 2, f.childExpirationTime = 0, b.memoizedState = c6, b.child = f, c; + if (h = f.fallback, (f = eI(null, e, 0, null)).return = b, f.child = a, null !== a && (a.return = f), 0 == (2 & b.mode)) for(a = null !== b.memoizedState ? b.child.child : b.child, f.child = a; null !== a;)a.return = f, a = a.sibling; + return (c = eI(h, e, c, null)).return = b, f.sibling = c, c.effectTag |= 2, f.childExpirationTime = 0, b.memoizedState = c5, b.child = f, c; } - return b.memoizedState = null, b.child = b$(b, a, f.children, c); + return b.memoizedState = null, b.child = bZ(b, a, f.children, c); } - function c8(a, b) { + function c7(a, b) { a.expirationTime < b && (a.expirationTime = b); var c = a.alternate; - null !== c && c.expirationTime < b && (c.expirationTime = b), bz(a.return, b); + null !== c && c.expirationTime < b && (c.expirationTime = b), by(a.return, b); } - function c9(a, b, c, d, e, f) { + function c8(a, b, c, d, e, f) { var g = a.memoizedState; null === g ? a.memoizedState = { isBackwards: b, @@ -25811,13 +25793,13 @@ lastEffect: f } : (g.isBackwards = b, g.rendering = null, g.last = d, g.tail = c, g.tailExpiration = 0, g.tailMode = e, g.lastEffect = f); } - function da(a, b, c) { + function c9(a, b, c) { var d = b.pendingProps, e = d.revealOrder, f = d.tail; - if (cZ(a, b, d.children, c), 0 != (2 & (d = b9.current))) d = 1 & d | 2, b.effectTag |= 64; + if (cY(a, b, d.children, c), 0 != (2 & (d = b8.current))) d = 1 & d | 2, b.effectTag |= 64; else { if (null !== a && 0 != (64 & a.effectTag)) a: for(a = b.child; null !== a;){ - if (13 === a.tag) null !== a.memoizedState && c8(a, c); - else if (19 === a.tag) c8(a, c); + if (13 === a.tag) null !== a.memoizedState && c7(a, c); + else if (19 === a.tag) c7(a, c); else if (null !== a.child) { a.child.return = a, a = a.child; continue; @@ -25831,42 +25813,42 @@ } d &= 1; } - if (aL(b9, d, b), 0 == (2 & b.mode)) b.memoizedState = null; + if (aL(b8, d, b), 0 == (2 & b.mode)) b.memoizedState = null; else switch(e){ case "forwards": - for(e = null, c = b.child; null !== c;)null !== (a = c.alternate) && null === ca(a) && (e = c), c = c.sibling; - null === (c = e) ? (e = b.child, b.child = null) : (e = c.sibling, c.sibling = null), c9(b, !1, e, c, f, b.lastEffect); + for(e = null, c = b.child; null !== c;)null !== (a = c.alternate) && null === b9(a) && (e = c), c = c.sibling; + null === (c = e) ? (e = b.child, b.child = null) : (e = c.sibling, c.sibling = null), c8(b, !1, e, c, f, b.lastEffect); break; case "backwards": for(c = null, e = b.child, b.child = null; null !== e;){ - if (null !== (a = e.alternate) && null === ca(a)) { + if (null !== (a = e.alternate) && null === b9(a)) { b.child = e; break; } a = e.sibling, e.sibling = c, c = e, e = a; } - c9(b, !0, c, null, f, b.lastEffect); + c8(b, !0, c, null, f, b.lastEffect); break; case "together": - c9(b, !1, null, null, void 0, b.lastEffect); + c8(b, !1, null, null, void 0, b.lastEffect); break; default: b.memoizedState = null; } return b.child; } - function db(a, b, c) { + function da(a, b, c) { null !== a && (b.dependencies = a.dependencies); var d = b.expirationTime; - if (0 !== d && em(d), b.childExpirationTime < c) return null; + if (0 !== d && el(d), b.childExpirationTime < c) return null; if (null !== a && b.child !== a.child) throw Error(m(153)); if (null !== b.child) { - for(c = eH(a = b.child, a.pendingProps, a.expirationTime), b.child = c, c.return = b; null !== a.sibling;)a = a.sibling, (c = c.sibling = eH(a, a.pendingProps, a.expirationTime)).return = b; + for(c = eG(a = b.child, a.pendingProps, a.expirationTime), b.child = c, c.return = b; null !== a.sibling;)a = a.sibling, (c = c.sibling = eG(a, a.pendingProps, a.expirationTime)).return = b; c.sibling = null; } return b.child; } - function dc(a) { + function db(a) { a.effectTag |= 4; } if (Z) e = function(a, b) { @@ -25885,11 +25867,11 @@ } }, f = function() {}, g = function(a, b, c, d, e) { if ((a = a.memoizedProps) !== d) { - var f = b.stateNode, g = b4(b1.current); - c = R(f, c, a, d, e, g), (b.updateQueue = c) && dc(b); + var f = b.stateNode, g = b3(b0.current); + c = R(f, c, a, d, e, g), (b.updateQueue = c) && db(b); } }, h = function(a, b, c, d) { - c !== d && dc(b); + c !== d && db(b); }; else if ($) { e = function(a, b, c, d) { @@ -25919,7 +25901,7 @@ f.sibling.return = f.return, f = f.sibling; } }; - var dd = function(a, b, c, d) { + var dc = function(a, b, c, d) { for(var e = b.child; null !== e;){ if (5 === e.tag) { var f = e.stateNode; @@ -25928,7 +25910,7 @@ else if (4 !== e.tag) { if (13 === e.tag && 0 != (4 & e.effectTag) && (f = null !== e.memoizedState)) { var g = e.child; - if (null !== g && (null !== g.child && (g.child.return = g, dd(a, g, !0, f)), null !== (f = g.sibling))) { + if (null !== g && (null !== g.child && (g.child.return = g, dc(a, g, !0, f)), null !== (f = g.sibling))) { f.return = e, e = f; continue; } @@ -25950,20 +25932,20 @@ var b = a.stateNode; if (null !== a.firstEffect) { var c = b.containerInfo, d = ap(c); - dd(d, a, !1, !1), b.pendingChildren = d, dc(a), ar(c, d); + dc(d, a, !1, !1), b.pendingChildren = d, db(a), ar(c, d); } }, g = function(a, b, c, d, f) { var g = a.stateNode, h = a.memoizedProps; if ((a = null === b.firstEffect) && h === d) b.stateNode = g; else { - var i = b.stateNode, j = b4(b1.current), k = null; - h !== d && (k = R(i, c, h, d, f, j)), a && null === k ? b.stateNode = g : (g = ao(g, k, c, h, d, b, a, i), Q(g, c, d, f, j) && dc(b), b.stateNode = g, a ? dc(b) : e(g, b, !1, !1)); + var i = b.stateNode, j = b3(b0.current), k = null; + h !== d && (k = R(i, c, h, d, f, j)), a && null === k ? b.stateNode = g : (g = ao(g, k, c, h, d, b, a, i), Q(g, c, d, f, j) && db(b), b.stateNode = g, a ? db(b) : e(g, b, !1, !1)); } }, h = function(a, b, c, d) { - c !== d && (a = b4(b3.current), c = b4(b1.current), b.stateNode = U(d, a, c, b), dc(b)); + c !== d && (a = b3(b2.current), c = b3(b0.current), b.stateNode = U(d, a, c, b), db(b)); }; } else f = function() {}, g = function() {}, h = function() {}; - function de(a, b) { + function dd(a, b) { switch(a.tailMode){ case "hidden": b = a.tail; @@ -25976,38 +25958,38 @@ null === d ? b || null === a.tail ? a.tail = null : a.tail.sibling = null : d.sibling = null; } } - function df(a) { + function de(a) { switch(a.tag){ case 1: aR(a.type) && aS(a); var b = a.effectTag; return 4096 & b ? (a.effectTag = -4097 & b | 64, a) : null; case 3: - if (b6(a), aT(a), 0 != (64 & (b = a.effectTag))) throw Error(m(285)); + if (b5(a), aT(a), 0 != (64 & (b = a.effectTag))) throw Error(m(285)); return a.effectTag = -4097 & b | 64, a; case 5: - return b8(a), null; + return b7(a), null; case 13: - return aK(b9, a), 4096 & (b = a.effectTag) ? (a.effectTag = -4097 & b | 64, a) : null; + return aK(b8, a), 4096 & (b = a.effectTag) ? (a.effectTag = -4097 & b | 64, a) : null; case 19: - return aK(b9, a), null; + return aK(b8, a), null; case 4: - return b6(a), null; + return b5(a), null; case 10: - return by(a), null; + return bx(a), null; default: return null; } } - function dg(a, b) { + function df(a, b) { return { value: a, source: b, stack: aH(b) }; } - var dh = "function" == typeof WeakSet ? WeakSet : Set; - function di(a, b) { + var dg = "function" == typeof WeakSet ? WeakSet : Set; + function dh(a, b) { var c = b.source, d = b.stack; null === d && null !== c && (d = aH(c)), null !== c && E(c.type), b = b.value, null !== a && 1 === a.tag && E(a.type); try { @@ -26018,28 +26000,28 @@ }); } } - function dj(a) { + function di(a) { var b = a.ref; if (null !== b) { if ("function" == typeof b) try { b(null); } catch (c) { - ey(a, c); + ex(a, c); } else b.current = null; } } - function dk(a, b) { + function dj(a, b) { switch(b.tag){ case 0: case 11: case 15: - dl(2, 0, b); + dk(2, 0, b); break; case 1: if (256 & b.effectTag && null !== a) { var c = a.memoizedProps, d = a.memoizedState; - b = (a = b.stateNode).getSnapshotBeforeUpdate(b.elementType === b.type ? c : br(b.type, c), d), a.__reactInternalSnapshotBeforeUpdate = b; + b = (a = b.stateNode).getSnapshotBeforeUpdate(b.elementType === b.type ? c : bq(b.type, c), d), a.__reactInternalSnapshotBeforeUpdate = b; } break; case 3: @@ -26052,7 +26034,7 @@ throw Error(m(163)); } } - function dl(a, b, c) { + function dk(a, b, c) { if (null !== (c = null !== (c = c.updateQueue) ? c.lastEffect : null)) { var d = c = c.next; do { @@ -26064,8 +26046,8 @@ }while (d !== c) } } - function dm(a, b, c) { - switch("function" == typeof eC && eC(b), b.tag){ + function dl(a, b, c) { + switch("function" == typeof eB && eB(b), b.tag){ case 0: case 11: case 14: @@ -26081,7 +26063,7 @@ try { c(); } catch (f) { - ey(e, f); + ex(e, f); } } a = a.next; @@ -26090,23 +26072,23 @@ } break; case 1: - dj(b), "function" == typeof (c = b.stateNode).componentWillUnmount && function(a, b) { + di(b), "function" == typeof (c = b.stateNode).componentWillUnmount && function(a, b) { try { b.props = a.memoizedProps, b.state = a.memoizedState, b.componentWillUnmount(); } catch (c) { - ey(a, c); + ex(a, c); } }(b, c); break; case 5: - dj(b); + di(b); break; case 4: - Z ? dt(a, b, c) : $ && dq(b); + Z ? ds(a, b, c) : $ && dp(b); } } - function dn(a, b, c) { - for(var d = b;;)if (dm(a, d, c), null === d.child || Z && 4 === d.tag) { + function dm(a, b, c) { + for(var d = b;;)if (dl(a, d, c), null === d.child || Z && 4 === d.tag) { if (d === b) break; for(; null === d.sibling;){ if (null === d.return || d.return === b) return; @@ -26115,24 +26097,24 @@ d.sibling.return = d.return, d = d.sibling; } else d.child.return = d, d = d.child; } - function dp(a) { + function dn(a) { var b = a.alternate; - a.return = null, a.child = null, a.memoizedState = null, a.updateQueue = null, a.dependencies = null, a.alternate = null, a.firstEffect = null, a.lastEffect = null, a.pendingProps = null, a.memoizedProps = null, null !== b && dp(b); + a.return = null, a.child = null, a.memoizedState = null, a.updateQueue = null, a.dependencies = null, a.alternate = null, a.firstEffect = null, a.lastEffect = null, a.pendingProps = null, a.memoizedProps = null, null !== b && dn(b); } - function dq(a) { + function dp(a) { if ($) { var b = ap(a = a.stateNode.containerInfo); as(a, b); } } - function dr(a) { + function dq(a) { return 5 === a.tag || 3 === a.tag || 4 === a.tag; } - function ds(a) { + function dr(a) { if (Z) { a: { for(var b = a.return; null !== b;){ - if (dr(b)) { + if (dq(b)) { var c = b; break a; } @@ -26154,7 +26136,7 @@ 16 & c.effectTag && (aj(b), c.effectTag &= -17); a: b: for(c = a;;){ for(; null === c.sibling;){ - if (null === c.return || dr(c.return)) { + if (null === c.return || dq(c.return)) { c = null; break a; } @@ -26185,7 +26167,7 @@ } } } - function dt(a, b, c) { + function ds(a, b, c) { for(var d, e, f = b, g = !1;;){ if (!g) { g = f.return; @@ -26204,13 +26186,13 @@ } g = !0; } - if (5 === f.tag || 6 === f.tag) dn(a, f, c), e ? ai(d, f.stateNode) : ah(d, f.stateNode); + if (5 === f.tag || 6 === f.tag) dm(a, f, c), e ? ai(d, f.stateNode) : ah(d, f.stateNode); else if (4 === f.tag) { if (null !== f.child) { d = f.stateNode.containerInfo, e = !0, f.child.return = f, f = f.child; continue; } - } else if (dm(a, f, c), null !== f.child) { + } else if (dl(a, f, c), null !== f.child) { f.child.return = f, f = f.child; continue; } @@ -26222,13 +26204,13 @@ f.sibling.return = f.return, f = f.sibling; } } - function du(a, b) { + function dt(a, b) { if (Z) switch(b.tag){ case 0: case 11: case 14: case 15: - dl(4, 8, b); + dk(4, 8, b); break; case 1: case 12: @@ -26253,10 +26235,10 @@ _ && (b = b.stateNode).hydrate && (b.hydrate = !1, aE(b.containerInfo)); break; case 13: - dv(b), dw(b); + du(b), dv(b); break; case 19: - dw(b); + dv(b); break; default: throw Error(m(163)); @@ -26267,15 +26249,15 @@ case 11: case 14: case 15: - dl(4, 8, b); + dk(4, 8, b); return; case 12: return; case 13: - dv(b), dw(b); + du(b), dv(b); return; case 19: - dw(b); + dv(b); return; case 3: _ && (c = b.stateNode).hydrate && (c.hydrate = !1, aE(c.containerInfo)); @@ -26295,10 +26277,10 @@ } } } - function dv(a) { + function du(a) { var b = a; if (null === a.memoizedState) var c = !1; - else c = !0, b = a.child, dY = be(); + else c = !0, b = a.child, dX = be(); if (Z && null !== b) { a: if (a = b, Z) for(b = a;;){ if (5 === b.tag) { @@ -26321,67 +26303,67 @@ } } } - function dw(a) { + function dv(a) { var b = a.updateQueue; if (null !== b) { a.updateQueue = null; var c = a.stateNode; - null === c && (c = a.stateNode = new dh()), b.forEach(function(b) { - var d = eA.bind(null, a, b); + null === c && (c = a.stateNode = new dg()), b.forEach(function(b) { + var d = ez.bind(null, a, b); c.has(b) || (c.add(b), b.then(d, d)); }); } } - var dx = "function" == typeof WeakMap ? WeakMap : Map; - function dy(a, b, c) { - (c = bF(c, null)).tag = 3, c.payload = { + var dw = "function" == typeof WeakMap ? WeakMap : Map; + function dx(a, b, c) { + (c = bE(c, null)).tag = 3, c.payload = { element: null }; var d = b.value; return c.callback = function() { - d_ || (d_ = !0, d0 = d), di(a, b); + d$ || (d$ = !0, d_ = d), dh(a, b); }, c; } - function dz(a, b, c) { - (c = bF(c, null)).tag = 3; + function dy(a, b, c) { + (c = bE(c, null)).tag = 3; var d = a.type.getDerivedStateFromError; if ("function" == typeof d) { var e = b.value; c.payload = function() { - return di(a, b), d(e); + return dh(a, b), d(e); }; } var f = a.stateNode; return null !== f && "function" == typeof f.componentDidCatch && (c.callback = function() { - "function" != typeof d && (null === d1 ? d1 = new Set([ + "function" != typeof d && (null === d0 ? d0 = new Set([ this - ]) : d1.add(this), di(a, b)); + ]) : d0.add(this), dh(a, b)); var c = b.stack; this.componentDidCatch(b.value, { componentStack: null !== c ? c : "" }); }), c; } - var dA = Math.ceil, dB = n.ReactCurrentDispatcher, dC = n.ReactCurrentOwner, dD = 0, dE = 8, dF = 16, dG = 32, dH = 0, dI = 1, dJ = 2, dK = 3, dL = 4, dM = 5, dN = dD, dO = null, dP = null, dQ = 0, dR = dH, dS = null, dT = 1073741823, dU = 1073741823, dV = null, dW = 0, dX = !1, dY = 0, dZ = 500, d$ = null, d_ = !1, d0 = null, d1 = null, d2 = !1, d3 = null, d4 = 90, d5 = null, d6 = 0, d7 = null, d8 = 0; - function d9() { - return (dN & (dF | dG)) !== dD ? 1073741821 - (be() / 10 | 0) : 0 !== d8 ? d8 : d8 = 1073741821 - (be() / 10 | 0); + var dz = Math.ceil, dA = n.ReactCurrentDispatcher, dB = n.ReactCurrentOwner, dC = 0, dD = 8, dE = 16, dF = 32, dG = 0, dH = 1, dI = 2, dJ = 3, dK = 4, dL = 5, dM = dC, dN = null, dO = null, dP = 0, dQ = dG, dR = null, dS = 1073741823, dT = 1073741823, dU = null, dV = 0, dW = !1, dX = 0, dY = 500, dZ = null, d$ = !1, d_ = null, d0 = null, d1 = !1, d2 = null, d3 = 90, d4 = null, d5 = 0, d6 = null, d7 = 0; + function d8() { + return (dM & (dE | dF)) !== dC ? 1073741821 - (be() / 10 | 0) : 0 !== d7 ? d7 : d7 = 1073741821 - (be() / 10 | 0); } - function ea(a, b, c) { + function d9(a, b, c) { if (0 == (2 & (b = b.mode))) return 1073741823; var d = bf(); if (0 == (4 & b)) return 99 === d ? 1073741823 : 1073741822; - if ((dN & dF) !== dD) return dQ; - if (null !== c) a = bn(a, 0 | c.timeoutMs || 5e3, 250); + if ((dM & dE) !== dC) return dP; + if (null !== c) a = bm(a, 0 | c.timeoutMs || 5e3, 250); else switch(d){ case 99: a = 1073741823; break; case 98: - a = bn(a, 150, 100); + a = bm(a, 150, 100); break; case 97: case 96: - a = bn(a, 5e3, 250); + a = bm(a, 5e3, 250); break; case 95: a = 2; @@ -26389,21 +26371,21 @@ default: throw Error(m(326)); } - return null !== dO && a === dQ && --a, a; + return null !== dN && a === dP && --a, a; } - function eb(a, b) { - if (50 < d6) throw d6 = 0, d7 = null, Error(m(185)); - if (null !== (a = ec(a, b))) { + function ea(a, b) { + if (50 < d5) throw d5 = 0, d6 = null, Error(m(185)); + if (null !== (a = eb(a, b))) { var c = bf(); - 1073741823 === b ? (dN & dE) !== dD && (dN & (dF | dG)) === dD ? eg(a) : (ee(a), dN === dD && bk()) : ee(a), (4 & dN) === dD || 98 !== c && 99 !== c || (null === d5 ? d5 = new Map([ + 1073741823 === b ? (dM & dD) !== dC && (dM & (dE | dF)) === dC ? ef(a) : (ed(a), dM === dC && bj()) : ed(a), (4 & dM) === dC || 98 !== c && 99 !== c || (null === d4 ? d4 = new Map([ [ a, b ] - ]) : (void 0 === (c = d5.get(a)) || c > b) && d5.set(a, b)); + ]) : (void 0 === (c = d4.get(a)) || c > b) && d4.set(a, b)); } } - function ec(a, b) { + function eb(a, b) { a.expirationTime < b && (a.expirationTime = b); var c = a.alternate; null !== c && c.expirationTime < b && (c.expirationTime = b); @@ -26416,174 +26398,174 @@ } d = d.return; } - return null !== e && (dO === e && (em(b), dR === dL && eO(e, dQ)), eP(e, b)), e; + return null !== e && (dN === e && (el(b), dQ === dK && eN(e, dP)), eO(e, b)), e; } - function ed(a) { + function ec(a) { var b = a.lastExpiredTime; - return 0 !== b ? b : (b = a.firstPendingTime, eN(a, b)) ? (b = a.lastPingedTime, a = a.nextKnownPendingLevel, b > a ? b : a) : b; + return 0 !== b ? b : (b = a.firstPendingTime, eM(a, b)) ? (b = a.lastPingedTime, a = a.nextKnownPendingLevel, b > a ? b : a) : b; } - function ee(a) { - if (0 !== a.lastExpiredTime) a.callbackExpirationTime = 1073741823, a.callbackPriority = 99, a.callbackNode = bj(eg.bind(null, a)); + function ed(a) { + if (0 !== a.lastExpiredTime) a.callbackExpirationTime = 1073741823, a.callbackPriority = 99, a.callbackNode = bi(ef.bind(null, a)); else { - var b = ed(a), c = a.callbackNode; + var b = ec(a), c = a.callbackNode; if (0 === b) null !== c && (a.callbackNode = null, a.callbackExpirationTime = 0, a.callbackPriority = 90); else { - var d = d9(); - if (d = 1073741823 === b ? 99 : 1 === b || 2 === b ? 95 : 0 >= (d = 10 * (1073741821 - b) - 10 * (1073741821 - d)) ? 99 : 250 >= d ? 98 : 5250 >= d ? 97 : 95, null !== c) { - var e = a.callbackPriority; - if (a.callbackExpirationTime === b && e >= d) return; + var d, e, f, g = d8(); + if (g = 1073741823 === b ? 99 : 1 === b || 2 === b ? 95 : 0 >= (g = 10 * (1073741821 - b) - 10 * (1073741821 - g)) ? 99 : 250 >= g ? 98 : 5250 >= g ? 97 : 95, null !== c) { + var h = a.callbackPriority; + if (a.callbackExpirationTime === b && h >= g) return; c !== a8 && a$(c); } - a.callbackExpirationTime = b, a.callbackPriority = d, b = 1073741823 === b ? bj(eg.bind(null, a)) : bi(d, ef.bind(null, a), { + a.callbackExpirationTime = b, a.callbackPriority = g, b = 1073741823 === b ? bi(ef.bind(null, a)) : (d = g, e = ee.bind(null, a), f = { timeout: 10 * (1073741821 - b) - be() - }), a.callbackNode = b; + }, d = bg(d), aZ(d, e, f)), a.callbackNode = b; } } } - function ef(a, b) { - if (d8 = 0, b) return b = d9(), eQ(a, b), ee(a), null; - var c = ed(a); + function ee(a, b) { + if (d7 = 0, b) return b = d8(), eP(a, b), ed(a), null; + var c = ec(a); if (0 !== c) { - if (b = a.callbackNode, (dN & (dF | dG)) !== dD) throw Error(m(327)); - if (ev(), a === dO && c === dQ || ei(a, c), null !== dP) { - var d = dN; - dN |= dF; - for(var e = ek(a);;)try { - eo(); + if (b = a.callbackNode, (dM & (dE | dF)) !== dC) throw Error(m(327)); + if (eu(), a === dN && c === dP || eh(a, c), null !== dO) { + var d = dM; + dM |= dE; + for(var e = ej(a);;)try { + en(); break; } catch (f) { - ej(a, f); + ei(a, f); } - if (bw(), dN = d, dB.current = e, dR === dI) throw b = dS, ei(a, c), eO(a, c), ee(a), b; - if (null === dP) switch(e = a.finishedWork = a.current.alternate, a.finishedExpirationTime = c, d = dR, dO = null, d){ + if (bv(), dM = d, dA.current = e, dQ === dH) throw b = dR, eh(a, c), eN(a, c), ed(a), b; + if (null === dO) switch(e = a.finishedWork = a.current.alternate, a.finishedExpirationTime = c, d = dQ, dN = null, d){ + case dG: case dH: - case dI: throw Error(m(345)); - case dJ: - eQ(a, 2 < c ? 2 : c); + case dI: + eP(a, 2 < c ? 2 : c); break; - case dK: - if (eO(a, c), c === (d = a.lastSuspendedTime) && (a.nextKnownPendingLevel = er(e)), 1073741823 === dT && 10 < (e = dY + dZ - be())) { - if (dX) { + case dJ: + if (eN(a, c), c === (d = a.lastSuspendedTime) && (a.nextKnownPendingLevel = eq(e)), 1073741823 === dS && 10 < (e = dX + dY - be())) { + if (dW) { var g = a.lastPingedTime; if (0 === g || g >= c) { - a.lastPingedTime = c, ei(a, c); + a.lastPingedTime = c, eh(a, c); break; } } - if (0 !== (g = ed(a)) && g !== c) break; + if (0 !== (g = ec(a)) && g !== c) break; if (0 !== d && d !== c) { a.lastPingedTime = d; break; } - a.timeoutHandle = V(es.bind(null, a), e); + a.timeoutHandle = V(er.bind(null, a), e); break; } - es(a); + er(a); break; - case dL: - if (eO(a, c), c === (d = a.lastSuspendedTime) && (a.nextKnownPendingLevel = er(e)), dX && (0 === (e = a.lastPingedTime) || e >= c)) { - a.lastPingedTime = c, ei(a, c); + case dK: + if (eN(a, c), c === (d = a.lastSuspendedTime) && (a.nextKnownPendingLevel = eq(e)), dW && (0 === (e = a.lastPingedTime) || e >= c)) { + a.lastPingedTime = c, eh(a, c); break; } - if (0 !== (e = ed(a)) && e !== c) break; + if (0 !== (e = ec(a)) && e !== c) break; if (0 !== d && d !== c) { a.lastPingedTime = d; break; } - if (1073741823 !== dU ? d = 10 * (1073741821 - dU) - be() : 1073741823 === dT ? d = 0 : (d = 10 * (1073741821 - dT) - 5e3, e = be(), c = 10 * (1073741821 - c) - e, d = e - d, 0 > d && (d = 0), d = (120 > d ? 120 : 480 > d ? 480 : 1080 > d ? 1080 : 1920 > d ? 1920 : 3e3 > d ? 3e3 : 4320 > d ? 4320 : 1960 * dA(d / 1960)) - d, c < d && (d = c)), 10 < d) { - a.timeoutHandle = V(es.bind(null, a), d); + if (1073741823 !== dT ? d = 10 * (1073741821 - dT) - be() : 1073741823 === dS ? d = 0 : (d = 10 * (1073741821 - dS) - 5e3, e = be(), c = 10 * (1073741821 - c) - e, d = e - d, 0 > d && (d = 0), d = (120 > d ? 120 : 480 > d ? 480 : 1080 > d ? 1080 : 1920 > d ? 1920 : 3e3 > d ? 3e3 : 4320 > d ? 4320 : 1960 * dz(d / 1960)) - d, c < d && (d = c)), 10 < d) { + a.timeoutHandle = V(er.bind(null, a), d); break; } - es(a); + er(a); break; - case dM: - if (1073741823 !== dT && null !== dV) { - g = dT; - var h = dV; + case dL: + if (1073741823 !== dS && null !== dU) { + g = dS; + var h = dU; if (0 >= (d = 0 | h.busyMinDurationMs) ? d = 0 : (e = 0 | h.busyDelayMs, d = (g = be() - (10 * (1073741821 - g) - (0 | h.timeoutMs || 5e3))) <= e ? 0 : e + d - g), 10 < d) { - eO(a, c), a.timeoutHandle = V(es.bind(null, a), d); + eN(a, c), a.timeoutHandle = V(er.bind(null, a), d); break; } } - es(a); + er(a); break; default: throw Error(m(329)); } - if (ee(a), a.callbackNode === b) return ef.bind(null, a); + if (ed(a), a.callbackNode === b) return ee.bind(null, a); } } return null; } - function eg(a) { + function ef(a) { var b = a.lastExpiredTime; - if (b = 0 !== b ? b : 1073741823, a.finishedExpirationTime === b) es(a); + if (b = 0 !== b ? b : 1073741823, a.finishedExpirationTime === b) er(a); else { - if ((dN & (dF | dG)) !== dD) throw Error(m(327)); - if (ev(), a === dO && b === dQ || ei(a, b), null !== dP) { - var c = dN; - dN |= dF; - for(var d = ek(a);;)try { - en(); + if ((dM & (dE | dF)) !== dC) throw Error(m(327)); + if (eu(), a === dN && b === dP || eh(a, b), null !== dO) { + var c = dM; + dM |= dE; + for(var d = ej(a);;)try { + em(); break; } catch (e) { - ej(a, e); + ei(a, e); } - if (bw(), dN = c, dB.current = d, dR === dI) throw c = dS, ei(a, b), eO(a, b), ee(a), c; - if (null !== dP) throw Error(m(261)); - a.finishedWork = a.current.alternate, a.finishedExpirationTime = b, dO = null, es(a), ee(a); + if (bv(), dM = c, dA.current = d, dQ === dH) throw c = dR, eh(a, b), eN(a, b), ed(a), c; + if (null !== dO) throw Error(m(261)); + a.finishedWork = a.current.alternate, a.finishedExpirationTime = b, dN = null, er(a), ed(a); } } return null; } - function eh(a, b) { - if ((dN & (dF | dG)) !== dD) throw Error(m(187)); - var c = dN; - dN |= 1; + function eg(a, b) { + if ((dM & (dE | dF)) !== dC) throw Error(m(187)); + var c = dM; + dM |= 1; try { return bh(99, a.bind(null, b)); } finally{ - dN = c, bk(); + dM = c, bj(); } } - function ei(a, b) { + function eh(a, b) { a.finishedWork = null, a.finishedExpirationTime = 0; var c = a.timeoutHandle; - if (c !== X && (a.timeoutHandle = X, W(c)), null !== dP) for(c = dP.return; null !== c;){ + if (c !== X && (a.timeoutHandle = X, W(c)), null !== dO) for(c = dO.return; null !== c;){ var d = c; switch(d.tag){ case 1: null != d.type.childContextTypes && aS(d); break; case 3: - b6(d), aT(d); + b5(d), aT(d); break; case 5: - b8(d); + b7(d); break; case 4: - b6(d); + b5(d); break; case 13: case 19: - aK(b9, d); + aK(b8, d); break; case 10: - by(d); + bx(d); } c = c.return; } - dO = a, dP = eH(a.current, null, b), dQ = b, dR = dH, dS = null, dU = dT = 1073741823, dV = null, dW = 0, dX = !1; + dN = a, dO = eG(a.current, null, b), dP = b, dQ = dG, dR = null, dT = dS = 1073741823, dU = null, dV = 0, dW = !1; } - function ej(a, b) { + function ei(a, b) { for(;;){ try { - if (bw(), cu(), null === dP || null === dP.return) return dR = dI, dS = b, null; + if (bv(), ct(), null === dO || null === dO.return) return dQ = dH, dR = b, null; a: { - var c = a, d = dP.return, e = dP, f = b; - if (b = dQ, e.effectTag |= 2048, e.firstEffect = e.lastEffect = null, null !== f && "object" == typeof f && "function" == typeof f.then) { - var g, h = f, i = 0 != (1 & b9.current), j = d; + var c = a, d = dO.return, e = dO, f = b; + if (b = dP, e.effectTag |= 2048, e.firstEffect = e.lastEffect = null, null !== f && "object" == typeof f && "function" == typeof f.then) { + var g, h = f, i = 0 != (1 & b8.current), j = d; do { if (g = 13 === j.tag) { var k = j.memoizedState; @@ -26603,8 +26585,8 @@ if (j.effectTag |= 64, e.effectTag &= -2981, 1 === e.tag) { if (null === e.alternate) e.tag = 17; else { - var o = bF(1073741823, null); - o.tag = 2, bH(e, o); + var o = bE(1073741823, null); + o.tag = 2, bG(e, o); } } e.expirationTime = 1073741823; @@ -26612,9 +26594,9 @@ } f = void 0, e = b; var p = c.pingCache; - if (null === p ? (p = c.pingCache = new dx(), f = new Set(), p.set(h, f)) : (f = p.get(h), void 0 === f && (f = new Set(), p.set(h, f))), !f.has(e)) { + if (null === p ? (p = c.pingCache = new dw(), f = new Set(), p.set(h, f)) : (f = p.get(h), void 0 === f && (f = new Set(), p.set(h, f))), !f.has(e)) { f.add(e); - var q = ez.bind(null, c, h, e); + var q = ey.bind(null, c, h, e); h.then(q, q); } j.effectTag |= 4096, j.expirationTime = b; @@ -26624,28 +26606,28 @@ }while (null !== j) f = Error((E(e.type) || "A React component") + " suspended while rendering, but no fallback UI was specified.\n\nAdd a component higher in the tree to provide a loading indicator or placeholder to display." + aH(e)); } - dR !== dM && (dR = dJ), f = dg(f, e), j = d; + dQ !== dL && (dQ = dI), f = df(f, e), j = d; do { switch(j.tag){ case 3: h = f, j.effectTag |= 4096, j.expirationTime = b; - var r = dy(j, h, b); - bI(j, r); + var r = dx(j, h, b); + bH(j, r); break a; case 1: h = f; var s = j.type, t = j.stateNode; - if (0 == (64 & j.effectTag) && ("function" == typeof s.getDerivedStateFromError || null !== t && "function" == typeof t.componentDidCatch && (null === d1 || !d1.has(t)))) { + if (0 == (64 & j.effectTag) && ("function" == typeof s.getDerivedStateFromError || null !== t && "function" == typeof t.componentDidCatch && (null === d0 || !d0.has(t)))) { j.effectTag |= 4096, j.expirationTime = b; - var u = dz(j, h, b); - bI(j, u); + var u = dy(j, h, b); + bH(j, u); break a; } } j = j.return; }while (null !== j) } - dP = eq(dP); + dO = ep(dO); } catch (v) { b = v; continue; @@ -26653,33 +26635,33 @@ break; } } - function ek() { - var a = dB.current; - return dB.current = cL, null === a ? cL : a; + function ej() { + var a = dA.current; + return dA.current = cK, null === a ? cK : a; + } + function ek(a, b) { + a < dS && 2 < a && (dS = a), null !== b && a < dT && 2 < a && (dT = a, dU = b); } - function el(a, b) { - a < dT && 2 < a && (dT = a), null !== b && a < dU && 2 < a && (dU = a, dV = b); + function el(a) { + a > dV && (dV = a); } - function em(a) { - a > dW && (dW = a); + function em() { + for(; null !== dO;)dO = eo(dO); } function en() { - for(; null !== dP;)dP = ep(dP); + for(; null !== dO && !a_();)dO = eo(dO); } - function eo() { - for(; null !== dP && !a_();)dP = ep(dP); + function eo(a) { + var b = i(a.alternate, a, dP); + return a.memoizedProps = a.pendingProps, null === b && (b = ep(a)), dB.current = null, b; } function ep(a) { - var b = i(a.alternate, a, dQ); - return a.memoizedProps = a.pendingProps, null === b && (b = eq(a)), dC.current = null, b; - } - function eq(a) { - dP = a; + dO = a; do { - var b = dP.alternate; - if (a = dP.return, 0 == (2048 & dP.effectTag)) { + var b = dO.alternate; + if (a = dO.return, 0 == (2048 & dO.effectTag)) { a: { - var c = b, d = dQ, i = (b = dP).pendingProps; + var c = b, d = dP, i = (b = dO).pendingProps; switch(b.tag){ case 2: case 16: @@ -26699,19 +26681,19 @@ aR(b.type) && aS(b); break; case 3: - b6(b), aT(b), (i = b.stateNode).pendingContext && (i.context = i.pendingContext, i.pendingContext = null), (null === c || null === c.child) && cV(b) && dc(b), f(b); + b5(b), aT(b), (i = b.stateNode).pendingContext && (i.context = i.pendingContext, i.pendingContext = null), (null === c || null === c.child) && cU(b) && db(b), f(b); break; case 5: - b8(b); - var j = b4(b3.current); + b7(b); + var j = b3(b2.current); if (d = b.type, null !== c && null != b.stateNode) g(c, b, d, i, j), c.ref !== b.ref && (b.effectTag |= 128); else if (i) { - if (c = b4(b1.current), cV(b)) { + if (c = b3(b0.current), cU(b)) { if (i = b, !_) throw Error(m(175)); - c = aB(i.stateNode, i.type, i.memoizedProps, j, c, i), i.updateQueue = c, c = null !== c, c && dc(b); + c = aB(i.stateNode, i.type, i.memoizedProps, j, c, i), i.updateQueue = c, c = null !== c, c && db(b); } else { var k = O(d, i, j, c, b); - e(k, b, !1, !1), b.stateNode = k, Q(k, d, i, j, c) && dc(b); + e(k, b, !1, !1), b.stateNode = k, Q(k, d, i, j, c) && db(b); } null !== b.ref && (b.effectTag |= 128); } else if (null === b.stateNode) throw Error(m(166)); @@ -26720,54 +26702,54 @@ if (c && null != b.stateNode) h(c, b, c.memoizedProps, i); else { if ("string" != typeof i && null === b.stateNode) throw Error(m(166)); - if (c = b4(b3.current), j = b4(b1.current), cV(b)) { + if (c = b3(b2.current), j = b3(b0.current), cU(b)) { if (c = b, !_) throw Error(m(176)); - (c = aC(c.stateNode, c.memoizedProps, c)) && dc(b); + (c = aC(c.stateNode, c.memoizedProps, c)) && db(b); } else b.stateNode = U(i, c, j, b); } break; case 13: - if (aK(b9, b), i = b.memoizedState, 0 != (64 & b.effectTag)) { + if (aK(b8, b), i = b.memoizedState, 0 != (64 & b.effectTag)) { b.expirationTime = d; break a; } - i = null !== i, j = !1, null === c ? void 0 !== b.memoizedProps.fallback && cV(b) : (j = null !== (d = c.memoizedState), i || null === d || null !== (d = c.child.sibling) && (null !== (k = b.firstEffect) ? (b.firstEffect = d, d.nextEffect = k) : (b.firstEffect = b.lastEffect = d, d.nextEffect = null), d.effectTag = 8)), i && !j && 0 != (2 & b.mode) && (null === c && !0 !== b.memoizedProps.unstable_avoidThisFallback || 0 != (1 & b9.current) ? dR === dH && (dR = dK) : ((dR === dH || dR === dK) && (dR = dL), 0 !== dW && null !== dO && (eO(dO, dQ), eP(dO, dW)))), $ && i && (b.effectTag |= 4), Z && (i || j) && (b.effectTag |= 4); + i = null !== i, j = !1, null === c ? void 0 !== b.memoizedProps.fallback && cU(b) : (j = null !== (d = c.memoizedState), i || null === d || null !== (d = c.child.sibling) && (null !== (k = b.firstEffect) ? (b.firstEffect = d, d.nextEffect = k) : (b.firstEffect = b.lastEffect = d, d.nextEffect = null), d.effectTag = 8)), i && !j && 0 != (2 & b.mode) && (null === c && !0 !== b.memoizedProps.unstable_avoidThisFallback || 0 != (1 & b8.current) ? dQ === dG && (dQ = dJ) : ((dQ === dG || dQ === dJ) && (dQ = dK), 0 !== dV && null !== dN && (eN(dN, dP), eO(dN, dV)))), $ && i && (b.effectTag |= 4), Z && (i || j) && (b.effectTag |= 4); break; case 4: - b6(b), f(b); + b5(b), f(b); break; case 10: - by(b); + bx(b); break; case 19: - if (aK(b9, b), null === (i = b.memoizedState)) break; + if (aK(b8, b), null === (i = b.memoizedState)) break; if (j = 0 != (64 & b.effectTag), null === (k = i.rendering)) { - if (j) de(i, !1); - else if (dR !== dH || null !== c && 0 != (64 & c.effectTag)) for(c = b.child; null !== c;){ - if (null !== (k = ca(c))) { - for(b.effectTag |= 64, de(i, !1), null !== (c = k.updateQueue) && (b.updateQueue = c, b.effectTag |= 4), null === i.lastEffect && (b.firstEffect = null), b.lastEffect = i.lastEffect, c = d, i = b.child; null !== i;)j = i, d = c, j.effectTag &= 2, j.nextEffect = null, j.firstEffect = null, j.lastEffect = null, null === (k = j.alternate) ? (j.childExpirationTime = 0, j.expirationTime = d, j.child = null, j.memoizedProps = null, j.memoizedState = null, j.updateQueue = null, j.dependencies = null) : (j.childExpirationTime = k.childExpirationTime, j.expirationTime = k.expirationTime, j.child = k.child, j.memoizedProps = k.memoizedProps, j.memoizedState = k.memoizedState, j.updateQueue = k.updateQueue, d = k.dependencies, j.dependencies = null === d ? null : { + if (j) dd(i, !1); + else if (dQ !== dG || null !== c && 0 != (64 & c.effectTag)) for(c = b.child; null !== c;){ + if (null !== (k = b9(c))) { + for(b.effectTag |= 64, dd(i, !1), null !== (c = k.updateQueue) && (b.updateQueue = c, b.effectTag |= 4), null === i.lastEffect && (b.firstEffect = null), b.lastEffect = i.lastEffect, c = d, i = b.child; null !== i;)j = i, d = c, j.effectTag &= 2, j.nextEffect = null, j.firstEffect = null, j.lastEffect = null, null === (k = j.alternate) ? (j.childExpirationTime = 0, j.expirationTime = d, j.child = null, j.memoizedProps = null, j.memoizedState = null, j.updateQueue = null, j.dependencies = null) : (j.childExpirationTime = k.childExpirationTime, j.expirationTime = k.expirationTime, j.child = k.child, j.memoizedProps = k.memoizedProps, j.memoizedState = k.memoizedState, j.updateQueue = k.updateQueue, d = k.dependencies, j.dependencies = null === d ? null : { expirationTime: d.expirationTime, firstContext: d.firstContext, responders: d.responders }), i = i.sibling; - aL(b9, 1 & b9.current | 2, b), b = b.child; + aL(b8, 1 & b8.current | 2, b), b = b.child; break a; } c = c.sibling; } } else { if (!j) { - if (null !== (c = ca(k))) { - if (b.effectTag |= 64, j = !0, null !== (c = c.updateQueue) && (b.updateQueue = c, b.effectTag |= 4), de(i, !0), null === i.tail && "hidden" === i.tailMode) { + if (null !== (c = b9(k))) { + if (b.effectTag |= 64, j = !0, null !== (c = c.updateQueue) && (b.updateQueue = c, b.effectTag |= 4), dd(i, !0), null === i.tail && "hidden" === i.tailMode) { null !== (b = b.lastEffect = i.lastEffect) && (b.nextEffect = null); break; } - } else be() > i.tailExpiration && 1 < d && (b.effectTag |= 64, j = !0, de(i, !1), b.expirationTime = b.childExpirationTime = d - 1); + } else be() > i.tailExpiration && 1 < d && (b.effectTag |= 64, j = !0, dd(i, !1), b.expirationTime = b.childExpirationTime = d - 1); } i.isBackwards ? (k.sibling = b.child, b.child = k) : (null !== (c = i.last) ? c.sibling = k : b.child = k, i.last = k); } if (null !== i.tail) { - 0 === i.tailExpiration && (i.tailExpiration = be() + 500), c = i.tail, i.rendering = c, i.tail = c.sibling, i.lastEffect = b.lastEffect, c.sibling = null, i = b9.current, i = j ? 1 & i | 2 : 1 & i, aL(b9, i, b), b = c; + 0 === i.tailExpiration && (i.tailExpiration = be() + 500), c = i.tail, i.rendering = c, i.tail = c.sibling, i.lastEffect = b.lastEffect, c.sibling = null, i = b8.current, i = j ? 1 & i | 2 : 1 & i, aL(b8, i, b), b = c; break a; } break; @@ -26776,52 +26758,52 @@ } b = null; } - if (c = dP, 1 === dQ || 1 !== c.childExpirationTime) { + if (c = dO, 1 === dP || 1 !== c.childExpirationTime) { for(i = 0, j = c.child; null !== j;)d = j.expirationTime, k = j.childExpirationTime, d > i && (i = d), k > i && (i = k), j = j.sibling; c.childExpirationTime = i; } if (null !== b) return b; - null !== a && 0 == (2048 & a.effectTag) && (null === a.firstEffect && (a.firstEffect = dP.firstEffect), null !== dP.lastEffect && (null !== a.lastEffect && (a.lastEffect.nextEffect = dP.firstEffect), a.lastEffect = dP.lastEffect), 1 < dP.effectTag && (null !== a.lastEffect ? a.lastEffect.nextEffect = dP : a.firstEffect = dP, a.lastEffect = dP)); + null !== a && 0 == (2048 & a.effectTag) && (null === a.firstEffect && (a.firstEffect = dO.firstEffect), null !== dO.lastEffect && (null !== a.lastEffect && (a.lastEffect.nextEffect = dO.firstEffect), a.lastEffect = dO.lastEffect), 1 < dO.effectTag && (null !== a.lastEffect ? a.lastEffect.nextEffect = dO : a.firstEffect = dO, a.lastEffect = dO)); } else { - if (null !== (b = df(dP, dQ))) return b.effectTag &= 2047, b; + if (null !== (b = de(dO, dP))) return b.effectTag &= 2047, b; null !== a && (a.firstEffect = a.lastEffect = null, a.effectTag |= 2048); } - if (null !== (b = dP.sibling)) return b; - dP = a; - }while (null !== dP) - return dR === dH && (dR = dM), null; + if (null !== (b = dO.sibling)) return b; + dO = a; + }while (null !== dO) + return dQ === dG && (dQ = dL), null; } - function er(a) { + function eq(a) { var b = a.expirationTime; return b > (a = a.childExpirationTime) ? b : a; } - function es(a) { + function er(a) { var b = bf(); - return bh(99, et.bind(null, a, b)), null; + return bh(99, es.bind(null, a, b)), null; } - function et(a, b) { - if (ev(), (dN & (dF | dG)) !== dD) throw Error(m(327)); + function es(a, b) { + if (eu(), (dM & (dE | dF)) !== dC) throw Error(m(327)); var c = a.finishedWork, d = a.finishedExpirationTime; if (null === c) return null; if (a.finishedWork = null, a.finishedExpirationTime = 0, c === a.current) throw Error(m(177)); a.callbackNode = null, a.callbackExpirationTime = 0, a.callbackPriority = 90, a.nextKnownPendingLevel = 0; - var e = er(c); - if (a.firstPendingTime = e, d <= a.lastSuspendedTime ? a.firstSuspendedTime = a.lastSuspendedTime = a.nextKnownPendingLevel = 0 : d <= a.firstSuspendedTime && (a.firstSuspendedTime = d - 1), d <= a.lastPingedTime && (a.lastPingedTime = 0), d <= a.lastExpiredTime && (a.lastExpiredTime = 0), a === dO && (dP = dO = null, dQ = 0), 1 < c.effectTag ? null !== c.lastEffect ? (c.lastEffect.nextEffect = c, e = c.firstEffect) : e = c : e = c.firstEffect, null !== e) { - var f = dN; - dN |= dG, dC.current = null, M(a.containerInfo), d$ = e; + var e = eq(c); + if (a.firstPendingTime = e, d <= a.lastSuspendedTime ? a.firstSuspendedTime = a.lastSuspendedTime = a.nextKnownPendingLevel = 0 : d <= a.firstSuspendedTime && (a.firstSuspendedTime = d - 1), d <= a.lastPingedTime && (a.lastPingedTime = 0), d <= a.lastExpiredTime && (a.lastExpiredTime = 0), a === dN && (dO = dN = null, dP = 0), 1 < c.effectTag ? null !== c.lastEffect ? (c.lastEffect.nextEffect = c, e = c.firstEffect) : e = c : e = c.firstEffect, null !== e) { + var f = dM; + dM |= dF, dB.current = null, M(a.containerInfo), dZ = e; do try { - eu(); + et(); } catch (g) { - if (null === d$) throw Error(m(330)); - ey(d$, g), d$ = d$.nextEffect; + if (null === dZ) throw Error(m(330)); + ex(dZ, g), dZ = dZ.nextEffect; } - while (null !== d$) - d$ = e; + while (null !== dZ) + dZ = e; do try { - for(var h = a, i = b; null !== d$;){ - var j = d$.effectTag; - if (16 & j && Z && aj(d$.stateNode), 128 & j) { - var k = d$.alternate; + for(var h = a, i = b; null !== dZ;){ + var j = dZ.effectTag; + if (16 & j && Z && aj(dZ.stateNode), 128 & j) { + var k = dZ.alternate; if (null !== k) { var l = k.ref; null !== l && ("function" == typeof l ? l(null) : l.current = null); @@ -26829,54 +26811,54 @@ } switch(1038 & j){ case 2: - ds(d$), d$.effectTag &= -3; + dr(dZ), dZ.effectTag &= -3; break; case 6: - ds(d$), d$.effectTag &= -3, du(d$.alternate, d$); + dr(dZ), dZ.effectTag &= -3, dt(dZ.alternate, dZ); break; case 1024: - d$.effectTag &= -1025; + dZ.effectTag &= -1025; break; case 1028: - d$.effectTag &= -1025, du(d$.alternate, d$); + dZ.effectTag &= -1025, dt(dZ.alternate, dZ); break; case 4: - du(d$.alternate, d$); + dt(dZ.alternate, dZ); break; case 8: - var n = h, o = d$, p = i; - Z ? dt(n, o, p) : dn(n, o, p), dp(o); + var n = h, o = dZ, p = i; + Z ? ds(n, o, p) : dm(n, o, p), dn(o); } - d$ = d$.nextEffect; + dZ = dZ.nextEffect; } } catch (q) { - if (null === d$) throw Error(m(330)); - ey(d$, q), d$ = d$.nextEffect; + if (null === dZ) throw Error(m(330)); + ex(dZ, q), dZ = dZ.nextEffect; } - while (null !== d$) - N(a.containerInfo), a.current = c, d$ = e; + while (null !== dZ) + N(a.containerInfo), a.current = c, dZ = e; do try { - for(j = d; null !== d$;){ - var r = d$.effectTag; + for(j = d; null !== dZ;){ + var r = dZ.effectTag; if (36 & r) { - var s = d$.alternate; - switch(k = d$, l = j, k.tag){ + var s = dZ.alternate; + switch(k = dZ, l = j, k.tag){ case 0: case 11: case 15: - dl(16, 32, k); + dk(16, 32, k); break; case 1: var t = k.stateNode; if (4 & k.effectTag) { if (null === s) t.componentDidMount(); else { - var u = k.elementType === k.type ? s.memoizedProps : br(k.type, s.memoizedProps); + var u = k.elementType === k.type ? s.memoizedProps : bq(k.type, s.memoizedProps); t.componentDidUpdate(u, s.memoizedState, t.__reactInternalSnapshotBeforeUpdate); } } var v = k.updateQueue; - null !== v && bM(k, v, t, l); + null !== v && bL(k, v, t, l); break; case 3: var w = k.updateQueue; @@ -26888,7 +26870,7 @@ case 1: h = k.child.stateNode; } - bM(k, w, h, l); + bL(k, w, h, l); } break; case 5: @@ -26921,143 +26903,145 @@ } if (128 & r) { k = void 0; - var B = d$.ref; + var B = dZ.ref; if (null !== B) { - var C = d$.stateNode; - k = 5 === d$.tag ? J(C) : C, "function" == typeof B ? B(k) : B.current = k; + var C = dZ.stateNode; + k = 5 === dZ.tag ? J(C) : C, "function" == typeof B ? B(k) : B.current = k; } } - d$ = d$.nextEffect; + dZ = dZ.nextEffect; } } catch (D) { - if (null === d$) throw Error(m(330)); - ey(d$, D), d$ = d$.nextEffect; + if (null === dZ) throw Error(m(330)); + ex(dZ, D), dZ = dZ.nextEffect; } - while (null !== d$) - d$ = null, a9(), dN = f; + while (null !== dZ) + dZ = null, a9(), dM = f; } else a.current = c; - if (d2) d2 = !1, d3 = a, d4 = b; - else for(d$ = e; null !== d$;)b = d$.nextEffect, d$.nextEffect = null, d$ = b; - if (0 === (b = a.firstPendingTime) && (d1 = null), 1073741823 === b ? a === d7 ? d6++ : (d6 = 0, d7 = a) : d6 = 0, "function" == typeof eB && eB(c.stateNode, d), ee(a), d_) throw d_ = !1, a = d0, d0 = null, a; - return (dN & dE) !== dD || bk(), null; + if (d1) d1 = !1, d2 = a, d3 = b; + else for(dZ = e; null !== dZ;)b = dZ.nextEffect, dZ.nextEffect = null, dZ = b; + if (0 === (b = a.firstPendingTime) && (d0 = null), 1073741823 === b ? a === d6 ? d5++ : (d5 = 0, d6 = a) : d5 = 0, "function" == typeof eA && eA(c.stateNode, d), ed(a), d$) throw d$ = !1, a = d_, d_ = null, a; + return (dM & dD) !== dC || bj(), null; + } + function et() { + for(; null !== dZ;){ + var a = dZ.effectTag; + 0 != (256 & a) && dj(dZ.alternate, dZ), 0 == (512 & a) || d1 || (d1 = !0, function(a, b, c) { + a = bg(a), aZ(a, b, void 0); + }(97, function() { + return eu(), null; + })), dZ = dZ.nextEffect; + } } function eu() { - for(; null !== d$;){ - var a = d$.effectTag; - 0 != (256 & a) && dk(d$.alternate, d$), 0 == (512 & a) || d2 || (d2 = !0, bi(97, function() { - return ev(), null; - })), d$ = d$.nextEffect; + if (90 !== d3) { + var a = 97 < d3 ? 97 : d3; + return d3 = 90, bh(a, ev); } } function ev() { - if (90 !== d4) { - var a = 97 < d4 ? 97 : d4; - return d4 = 90, bh(a, ew); - } - } - function ew() { - if (null === d3) return !1; - var a = d3; - if (d3 = null, (dN & (dF | dG)) !== dD) throw Error(m(331)); - var b = dN; - for(dN |= dG, a = a.current.firstEffect; null !== a;){ + if (null === d2) return !1; + var a = d2; + if (d2 = null, (dM & (dE | dF)) !== dC) throw Error(m(331)); + var b = dM; + for(dM |= dF, a = a.current.firstEffect; null !== a;){ try { var c = a; if (0 != (512 & c.effectTag)) switch(c.tag){ case 0: case 11: case 15: - dl(128, 0, c), dl(0, 64, c); + dk(128, 0, c), dk(0, 64, c); } } catch (d) { if (null === a) throw Error(m(330)); - ey(a, d); + ex(a, d); } c = a.nextEffect, a.nextEffect = null, a = c; } - return dN = b, bk(), !0; + return dM = b, bj(), !0; } - function ex(a, b, c) { - b = dg(c, b), b = dy(a, b, 1073741823), bH(a, b), null !== (a = ec(a, 1073741823)) && ee(a); + function ew(a, b, c) { + b = df(c, b), b = dx(a, b, 1073741823), bG(a, b), null !== (a = eb(a, 1073741823)) && ed(a); } - function ey(a, b) { - if (3 === a.tag) ex(a, a, b); + function ex(a, b) { + if (3 === a.tag) ew(a, a, b); else for(var c = a.return; null !== c;){ if (3 === c.tag) { - ex(c, a, b); + ew(c, a, b); break; } if (1 === c.tag) { var d = c.stateNode; - if ("function" == typeof c.type.getDerivedStateFromError || "function" == typeof d.componentDidCatch && (null === d1 || !d1.has(d))) { - a = dg(b, a), a = dz(c, a, 1073741823), bH(c, a), null !== (c = ec(c, 1073741823)) && ee(c); + if ("function" == typeof c.type.getDerivedStateFromError || "function" == typeof d.componentDidCatch && (null === d0 || !d0.has(d))) { + a = df(b, a), a = dy(c, a, 1073741823), bG(c, a), null !== (c = eb(c, 1073741823)) && ed(c); break; } } c = c.return; } } - function ez(a, b, c) { + function ey(a, b, c) { var d = a.pingCache; - null !== d && d.delete(b), dO === a && dQ === c ? dR === dL || dR === dK && 1073741823 === dT && be() - dY < dZ ? ei(a, dQ) : dX = !0 : eN(a, c) && (0 !== (b = a.lastPingedTime) && b < c || (a.lastPingedTime = c, a.finishedExpirationTime === c && (a.finishedExpirationTime = 0, a.finishedWork = null), ee(a))); + null !== d && d.delete(b), dN === a && dP === c ? dQ === dK || dQ === dJ && 1073741823 === dS && be() - dX < dY ? eh(a, dP) : dW = !0 : eM(a, c) && (0 !== (b = a.lastPingedTime) && b < c || (a.lastPingedTime = c, a.finishedExpirationTime === c && (a.finishedExpirationTime = 0, a.finishedWork = null), ed(a))); } - function eA(a, b) { + function ez(a, b) { var c = a.stateNode; - null !== c && c.delete(b), 0 == (b = 0) && (b = d9(), b = ea(b, a, null)), null !== (a = ec(a, b)) && ee(a); + null !== c && c.delete(b), 0 == (b = 0) && (b = d8(), b = d9(b, a, null)), null !== (a = eb(a, b)) && ed(a); } i = function(a, b, c) { var d = b.expirationTime; if (null !== a) { var e = b.pendingProps; - if (a.memoizedProps !== e || aO.current) cY = !0; + if (a.memoizedProps !== e || aO.current) cX = !0; else { if (d < c) { - switch(cY = !1, b.tag){ + switch(cX = !1, b.tag){ case 3: - c5(b), cW(); + c4(b), cV(); break; case 5: - if (b7(b), 4 & b.mode && 1 !== c && T(b.type, e)) return b.expirationTime = b.childExpirationTime = 1, null; + if (b6(b), 4 & b.mode && 1 !== c && T(b.type, e)) return b.expirationTime = b.childExpirationTime = 1, null; break; case 1: aR(b.type) && aW(b); break; case 4: - b5(b, b.stateNode.containerInfo); + b4(b, b.stateNode.containerInfo); break; case 10: - bx(b, b.memoizedProps.value); + bw(b, b.memoizedProps.value); break; case 13: if (null !== b.memoizedState) { - if (0 !== (d = b.child.childExpirationTime) && d >= c) return c7(a, b, c); - return aL(b9, 1 & b9.current, b), null !== (b = db(a, b, c)) ? b.sibling : null; + if (0 !== (d = b.child.childExpirationTime) && d >= c) return c6(a, b, c); + return aL(b8, 1 & b8.current, b), null !== (b = da(a, b, c)) ? b.sibling : null; } - aL(b9, 1 & b9.current, b); + aL(b8, 1 & b8.current, b); break; case 19: if (d = b.childExpirationTime >= c, 0 != (64 & a.effectTag)) { - if (d) return da(a, b, c); + if (d) return c9(a, b, c); b.effectTag |= 64; } - if (null !== (e = b.memoizedState) && (e.rendering = null, e.tail = null), aL(b9, b9.current, b), !d) return null; + if (null !== (e = b.memoizedState) && (e.rendering = null, e.tail = null), aL(b8, b8.current, b), !d) return null; } - return db(a, b, c); + return da(a, b, c); } - cY = !1; + cX = !1; } - } else cY = !1; + } else cX = !1; switch(b.expirationTime = 0, b.tag){ case 2: - if (d = b.type, null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), a = b.pendingProps, e = aQ(b, aN.current), bA(b, c), e = ct(null, b, d, a, e, c), b.effectTag |= 1, "object" == typeof e && null !== e && "function" == typeof e.render && void 0 === e.$$typeof) { - if (b.tag = 1, cu(), aR(d)) { + if (d = b.type, null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), a = b.pendingProps, e = aQ(b, aN.current), bz(b, c), e = cs(null, b, d, a, e, c), b.effectTag |= 1, "object" == typeof e && null !== e && "function" == typeof e.render && void 0 === e.$$typeof) { + if (b.tag = 1, ct(), aR(d)) { var f = !0; aW(b); } else f = !1; b.memoizedState = null !== e.state && void 0 !== e.state ? e.state : null; var g = d.getDerivedStateFromProps; - "function" == typeof g && bQ(b, d, g, a), e.updater = bR, b.stateNode = e, e._reactInternalFiber = b, bV(b, d, a, c), b = c4(null, b, d, !0, f, c); - } else b.tag = 0, cZ(null, b, e, c), b = b.child; + "function" == typeof g && bP(b, d, g, a), e.updater = bQ, b.stateNode = e, e._reactInternalFiber = b, bU(b, d, a, c), b = c3(null, b, d, !0, f, c); + } else b.tag = 0, cY(null, b, e, c), b = b.child; return b; case 16: if (e = b.elementType, null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), a = b.pendingProps, !function(a) { @@ -27071,58 +27055,58 @@ }); } }(e), 1 !== e._status) throw e._result; - switch(e = e._result, b.type = e, f = b.tag = eG(e), a = br(e, a), f){ + switch(e = e._result, b.type = e, f = b.tag = eF(e), a = bq(e, a), f){ case 0: - b = c2(null, b, e, a, c); + b = c1(null, b, e, a, c); break; case 1: - b = c3(null, b, e, a, c); + b = c2(null, b, e, a, c); break; case 11: - b = c$(null, b, e, a, c); + b = cZ(null, b, e, a, c); break; case 14: - b = c_(null, b, e, br(e.type, a), d, c); + b = c$(null, b, e, bq(e.type, a), d, c); break; default: throw Error(m(306, e, "")); } return b; case 0: - return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : br(d, e), c2(a, b, d, e, c); + return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : bq(d, e), c1(a, b, d, e, c); case 1: - return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : br(d, e), c3(a, b, d, e, c); + return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : bq(d, e), c2(a, b, d, e, c); case 3: - if (c5(b), null === (d = b.updateQueue)) throw Error(m(282)); - if (e = null !== (e = b.memoizedState) ? e.element : null, bL(b, d, b.pendingProps, null, c), d = b.memoizedState.element, d === e) cW(), b = db(a, b, c); + if (c4(b), null === (d = b.updateQueue)) throw Error(m(282)); + if (e = null !== (e = b.memoizedState) ? e.element : null, bK(b, d, b.pendingProps, null, c), d = b.memoizedState.element, d === e) cV(), b = da(a, b, c); else { - if ((e = b.stateNode.hydrate) && (_ ? (cP = aA(b.stateNode.containerInfo), cO = b, e = cQ = !0) : e = !1), e) for(c = b_(b, null, d, c), b.child = c; c;)c.effectTag = -3 & c.effectTag | 1024, c = c.sibling; - else cZ(a, b, d, c), cW(); + if ((e = b.stateNode.hydrate) && (_ ? (cO = aA(b.stateNode.containerInfo), cN = b, e = cP = !0) : e = !1), e) for(c = b$(b, null, d, c), b.child = c; c;)c.effectTag = -3 & c.effectTag | 1024, c = c.sibling; + else cY(a, b, d, c), cV(); b = b.child; } return b; case 5: - return b7(b), null === a && cT(b), d = b.type, e = b.pendingProps, f = null !== a ? a.memoizedProps : null, g = e.children, S(d, e) ? g = null : null !== f && S(d, f) && (b.effectTag |= 16), c1(a, b), 4 & b.mode && 1 !== c && T(d, e) ? (b.expirationTime = b.childExpirationTime = 1, b = null) : (cZ(a, b, g, c), b = b.child), b; + return b6(b), null === a && cS(b), d = b.type, e = b.pendingProps, f = null !== a ? a.memoizedProps : null, g = e.children, S(d, e) ? g = null : null !== f && S(d, f) && (b.effectTag |= 16), c0(a, b), 4 & b.mode && 1 !== c && T(d, e) ? (b.expirationTime = b.childExpirationTime = 1, b = null) : (cY(a, b, g, c), b = b.child), b; case 6: - return null === a && cT(b), null; + return null === a && cS(b), null; case 13: - return c7(a, b, c); + return c6(a, b, c); case 4: - return b5(b, b.stateNode.containerInfo), d = b.pendingProps, null === a ? b.child = b$(b, null, d, c) : cZ(a, b, d, c), b.child; + return b4(b, b.stateNode.containerInfo), d = b.pendingProps, null === a ? b.child = bZ(b, null, d, c) : cY(a, b, d, c), b.child; case 11: - return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : br(d, e), c$(a, b, d, e, c); + return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : bq(d, e), cZ(a, b, d, e, c); case 7: - return cZ(a, b, b.pendingProps, c), b.child; + return cY(a, b, b.pendingProps, c), b.child; case 8: case 12: - return cZ(a, b, b.pendingProps.children, c), b.child; + return cY(a, b, b.pendingProps.children, c), b.child; case 10: a: { - if (d = b.type._context, e = b.pendingProps, g = b.memoizedProps, f = e.value, bx(b, f), null !== g) { + if (d = b.type._context, e = b.pendingProps, g = b.memoizedProps, f = e.value, bw(b, f), null !== g) { var h = g.value; - if (0 == (f = bo(h, f) ? 0 : ("function" == typeof d._calculateChangedBits ? d._calculateChangedBits(h, f) : 1073741823) | 0)) { + if (0 == (f = bn(h, f) ? 0 : ("function" == typeof d._calculateChangedBits ? d._calculateChangedBits(h, f) : 1073741823) | 0)) { if (g.children === e.children && !aO.current) { - b = db(a, b, c); + b = da(a, b, c); break a; } } else for(null !== (h = b.child) && (h.return = b); null !== h;){ @@ -27131,7 +27115,7 @@ g = h.child; for(var j = i.firstContext; null !== j;){ if (j.context === d && 0 != (j.observedBits & f)) { - 1 === h.tag && ((j = bF(c, null)).tag = 2, bH(h, j)), h.expirationTime < c && (h.expirationTime = c), null !== (j = h.alternate) && j.expirationTime < c && (j.expirationTime = c), bz(h.return, c), i.expirationTime < c && (i.expirationTime = c); + 1 === h.tag && ((j = bE(c, null)).tag = 2, bG(h, j)), h.expirationTime < c && (h.expirationTime = c), null !== (j = h.alternate) && j.expirationTime < c && (j.expirationTime = c), by(h.return, c), i.expirationTime < c && (i.expirationTime = c); break; } j = j.next; @@ -27152,55 +27136,55 @@ h = g; } } - cZ(a, b, e.children, c), b = b.child; + cY(a, b, e.children, c), b = b.child; } return b; case 9: - return e = b.type, f = b.pendingProps, d = f.children, bA(b, c), e = bB(e, f.unstable_observedBits), d = d(e), b.effectTag |= 1, cZ(a, b, d, c), b.child; + return e = b.type, f = b.pendingProps, d = f.children, bz(b, c), e = bA(e, f.unstable_observedBits), d = d(e), b.effectTag |= 1, cY(a, b, d, c), b.child; case 14: - return f = br(e = b.type, b.pendingProps), f = br(e.type, f), c_(a, b, e, f, d, c); + return f = bq(e = b.type, b.pendingProps), f = bq(e.type, f), c$(a, b, e, f, d, c); case 15: - return c0(a, b, b.type, b.pendingProps, d, c); + return c_(a, b, b.type, b.pendingProps, d, c); case 17: - return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : br(d, e), null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), b.tag = 1, aR(d) ? (a = !0, aW(b)) : a = !1, bA(b, c), bT(b, d, e, c), bV(b, d, e, c), c4(null, b, d, !0, a, c); + return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : bq(d, e), null !== a && (a.alternate = null, b.alternate = null, b.effectTag |= 2), b.tag = 1, aR(d) ? (a = !0, aW(b)) : a = !1, bz(b, c), bS(b, d, e, c), bU(b, d, e, c), c3(null, b, d, !0, a, c); case 19: - return da(a, b, c); + return c9(a, b, c); } throw Error(m(156, b.tag)); }; - var eB = null, eC = null; - function eD(a, b, c, d) { + var eA = null, eB = null; + function eC(a, b, c, d) { this.tag = a, this.key = c, this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null, this.index = 0, this.ref = null, this.pendingProps = b, this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null, this.mode = d, this.effectTag = 0, this.lastEffect = this.firstEffect = this.nextEffect = null, this.childExpirationTime = this.expirationTime = 0, this.alternate = null; } - function eE(a, b, c, d) { - return new eD(a, b, c, d); + function eD(a, b, c, d) { + return new eC(a, b, c, d); } - function eF(a) { + function eE(a) { return !(!(a = a.prototype) || !a.isReactComponent); } - function eG(a) { - if ("function" == typeof a) return eF(a) ? 1 : 0; + function eF(a) { + if ("function" == typeof a) return eE(a) ? 1 : 0; if (null != a) { if ((a = a.$$typeof) === x) return 11; if (a === A) return 14; } return 2; } - function eH(a, b) { + function eG(a, b) { var c = a.alternate; - return null === c ? ((c = eE(a.tag, b, a.key, a.mode)).elementType = a.elementType, c.type = a.type, c.stateNode = a.stateNode, c.alternate = a, a.alternate = c) : (c.pendingProps = b, c.effectTag = 0, c.nextEffect = null, c.firstEffect = null, c.lastEffect = null), c.childExpirationTime = a.childExpirationTime, c.expirationTime = a.expirationTime, c.child = a.child, c.memoizedProps = a.memoizedProps, c.memoizedState = a.memoizedState, c.updateQueue = a.updateQueue, b = a.dependencies, c.dependencies = null === b ? null : { + return null === c ? ((c = eD(a.tag, b, a.key, a.mode)).elementType = a.elementType, c.type = a.type, c.stateNode = a.stateNode, c.alternate = a, a.alternate = c) : (c.pendingProps = b, c.effectTag = 0, c.nextEffect = null, c.firstEffect = null, c.lastEffect = null), c.childExpirationTime = a.childExpirationTime, c.expirationTime = a.expirationTime, c.child = a.child, c.memoizedProps = a.memoizedProps, c.memoizedState = a.memoizedState, c.updateQueue = a.updateQueue, b = a.dependencies, c.dependencies = null === b ? null : { expirationTime: b.expirationTime, firstContext: b.firstContext, responders: b.responders }, c.sibling = a.sibling, c.index = a.index, c.ref = a.ref, c; } - function eI(a, b, c, d, e, f) { + function eH(a, b, c, d, e, f) { var g = 2; - if (d = a, "function" == typeof a) eF(a) && (g = 1); + if (d = a, "function" == typeof a) eE(a) && (g = 1); else if ("string" == typeof a) g = 5; else a: switch(a){ case r: - return eJ(c.children, e, f, b); + return eI(c.children, e, f, b); case w: g = 8, e |= 7; break; @@ -27208,11 +27192,11 @@ g = 8, e |= 1; break; case t: - return (a = eE(12, c, b, 8 | e)).elementType = t, a.type = t, a.expirationTime = f, a; + return (a = eD(12, c, b, 8 | e)).elementType = t, a.type = t, a.expirationTime = f, a; case y: - return (a = eE(13, c, b, e)).type = y, a.elementType = y, a.expirationTime = f, a; + return (a = eD(13, c, b, e)).type = y, a.elementType = y, a.expirationTime = f, a; case z: - return (a = eE(19, c, b, e)).elementType = z, a.expirationTime = f, a; + return (a = eD(19, c, b, e)).elementType = z, a.expirationTime = f, a; default: if ("object" == typeof a && null !== a) switch(a.$$typeof){ case u: @@ -27233,42 +27217,42 @@ } throw Error(m(130, null == a ? a : typeof a, "")); } - return (b = eE(g, c, b, e)).elementType = a, b.type = d, b.expirationTime = f, b; + return (b = eD(g, c, b, e)).elementType = a, b.type = d, b.expirationTime = f, b; } - function eJ(a, b, c, d) { - return (a = eE(7, a, d, b)).expirationTime = c, a; + function eI(a, b, c, d) { + return (a = eD(7, a, d, b)).expirationTime = c, a; } - function eK(a, b, c) { - return (a = eE(6, a, null, b)).expirationTime = c, a; + function eJ(a, b, c) { + return (a = eD(6, a, null, b)).expirationTime = c, a; } - function eL(a, b, c) { - return (b = eE(4, null !== a.children ? a.children : [], a.key, b)).expirationTime = c, b.stateNode = { + function eK(a, b, c) { + return (b = eD(4, null !== a.children ? a.children : [], a.key, b)).expirationTime = c, b.stateNode = { containerInfo: a.containerInfo, pendingChildren: null, implementation: a.implementation }, b; } - function eM(a, b, c) { + function eL(a, b, c) { this.tag = b, this.current = null, this.containerInfo = a, this.pingCache = this.pendingChildren = null, this.finishedExpirationTime = 0, this.finishedWork = null, this.timeoutHandle = X, this.pendingContext = this.context = null, this.hydrate = c, this.callbackNode = null, this.callbackPriority = 90, this.lastExpiredTime = this.lastPingedTime = this.nextKnownPendingLevel = this.lastSuspendedTime = this.firstSuspendedTime = this.firstPendingTime = 0; } - function eN(a, b) { + function eM(a, b) { var c = a.firstSuspendedTime; return a = a.lastSuspendedTime, 0 !== c && c >= b && a <= b; } - function eO(a, b) { + function eN(a, b) { var c = a.firstSuspendedTime, d = a.lastSuspendedTime; c < b && (a.firstSuspendedTime = b), (d > b || 0 === c) && (a.lastSuspendedTime = b), b <= a.lastPingedTime && (a.lastPingedTime = 0), b <= a.lastExpiredTime && (a.lastExpiredTime = 0); } - function eP(a, b) { + function eO(a, b) { b > a.firstPendingTime && (a.firstPendingTime = b); var c = a.firstSuspendedTime; 0 !== c && (b >= c ? a.firstSuspendedTime = a.lastSuspendedTime = a.nextKnownPendingLevel = 0 : b >= a.lastSuspendedTime && (a.lastSuspendedTime = b + 1), b > a.nextKnownPendingLevel && (a.nextKnownPendingLevel = b)); } - function eQ(a, b) { + function eP(a, b) { var c = a.lastExpiredTime; (0 === c || c > b) && (a.lastExpiredTime = b); } - function eR(a) { + function eQ(a) { var b = a._reactInternalFiber; if (void 0 === b) { if ("function" == typeof a.render) throw Error(m(188)); @@ -27276,19 +27260,19 @@ } return null === (a = I(b)) ? null : a.stateNode; } - function eS(a, b) { + function eR(a, b) { null !== (a = a.memoizedState) && null !== a.dehydrated && a.retryTime < b && (a.retryTime = b); } - function eT(a, b) { - eS(a, b), (a = a.alternate) && eS(a, b); + function eS(a, b) { + eR(a, b), (a = a.alternate) && eR(a, b); } - var eU = { + var eT = { createContainer: function(a, b, c) { - return a = new eM(a, b, c), b = eE(3, null, null, 2 === b ? 7 : 1 === b ? 3 : 0), a.current = b, b.stateNode = a; + return a = new eL(a, b, c), b = eD(3, null, null, 2 === b ? 7 : 1 === b ? 3 : 0), a.current = b, b.stateNode = a; }, updateContainer: function(a, b, c, d) { - var e = b.current, f = d9(), g = bO.suspense; - f = ea(f, e, g); + var e = b.current, f = d8(), g = bN.suspense; + f = d9(f, e, g); a: if (c) { c = c._reactInternalFiber; b: { @@ -27318,35 +27302,35 @@ } c = h; } else c = aM; - return null === b.context ? b.context = c : b.pendingContext = c, (b = bF(f, g)).payload = { + return null === b.context ? b.context = c : b.pendingContext = c, (b = bE(f, g)).payload = { element: a - }, null !== (d = void 0 === d ? null : d) && (b.callback = d), bH(e, b), eb(e, f), f; + }, null !== (d = void 0 === d ? null : d) && (b.callback = d), bG(e, b), ea(e, f), f; }, batchedEventUpdates: function(a, b) { - var c = dN; - dN |= 2; + var c = dM; + dM |= 2; try { return a(b); } finally{ - (dN = c) === dD && bk(); + (dM = c) === dC && bj(); } }, batchedUpdates: function(a, b) { - var c = dN; - dN |= 1; + var c = dM; + dM |= 1; try { return a(b); } finally{ - (dN = c) === dD && bk(); + (dM = c) === dC && bj(); } }, unbatchedUpdates: function(a, b) { - var c = dN; - dN &= -2, dN |= dE; + var c = dM; + dM &= -2, dM |= dD; try { return a(b); } finally{ - (dN = c) === dD && bk(); + (dM = c) === dC && bj(); } }, deferredUpdates: function(a) { @@ -27356,35 +27340,35 @@ return bh(99, a.bind(null, b, c, d)); }, discreteUpdates: function(a, b, c, d) { - var e = dN; - dN |= 4; + var e = dM; + dM |= 4; try { return bh(98, a.bind(null, b, c, d)); } finally{ - (dN = e) === dD && bk(); + (dM = e) === dC && bj(); } }, flushDiscreteUpdates: function() { - (dN & (1 | dF | dG)) === dD && (function() { - if (null !== d5) { - var a = d5; - d5 = null, a.forEach(function(a, b) { - eQ(b, a), ee(b); - }), bk(); - } - }(), ev()); + (dM & (1 | dE | dF)) === dC && (function() { + if (null !== d4) { + var a = d4; + d4 = null, a.forEach(function(a, b) { + eP(b, a), ed(b); + }), bj(); + } + }(), eu()); }, flushControlled: function(a) { - var b = dN; - dN |= 1; + var b = dM; + dM |= 1; try { bh(99, a); } finally{ - (dN = b) === dD && bk(); + (dM = b) === dC && bj(); } }, - flushSync: eh, - flushPassiveEffects: ev, + flushSync: eg, + flushPassiveEffects: eu, IsThisRendererActing: { current: !1 }, @@ -27395,36 +27379,36 @@ switch(a.tag){ case 3: var b, c, d = a.stateNode; - d.hydrate && (b = d, c = d.firstPendingTime, eQ(b, c), ee(b), (dN & (dF | dG)) === dD && bk()); + d.hydrate && (b = d, c = d.firstPendingTime, eP(b, c), ed(b), (dM & (dE | dF)) === dC && bj()); break; case 13: - eh(function() { - return eb(a, 1073741823); - }), d = bn(d9(), 150, 100), eT(a, d); + eg(function() { + return ea(a, 1073741823); + }), d = bm(d8(), 150, 100), eS(a, d); } }, attemptUserBlockingHydration: function(a) { if (13 === a.tag) { - var b = bn(d9(), 150, 100); - eb(a, b), eT(a, b); + var b = bm(d8(), 150, 100); + ea(a, b), eS(a, b); } }, attemptContinuousHydration: function(a) { if (13 === a.tag) { - d9(); - var b = bm++; - eb(a, b), eT(a, b); + d8(); + var b = bl++; + ea(a, b), eS(a, b); } }, attemptHydrationAtCurrentPriority: function(a) { if (13 === a.tag) { - var b = d9(); - b = ea(b, a, null), eb(a, b), eT(a, b); + var b = d8(); + b = d9(b, a, null), ea(a, b), eS(a, b); } }, - findHostInstance: eR, + findHostInstance: eQ, findHostInstanceWithWarning: function(a) { - return eR(a); + return eQ(a); }, findHostInstanceWithNoPortals: function(a) { return null === (a = function(a) { @@ -27455,11 +27439,11 @@ if (b.isDisabled || !b.supportsFiber) return !0; try { var c = b.inject(a); - eB = function(a) { + eA = function(a) { try { b.onCommitFiberRoot(c, a, void 0, 64 == (64 & a.current.effectTag)); } catch (d) {} - }, eC = function(a) { + }, eB = function(a) { try { b.onCommitFiberUnmount(c, a); } catch (d) {} @@ -27486,9 +27470,9 @@ })); } }; - a.exports = eU.default || eU; - var eV = a.exports; - return a.exports = b, eV; + a.exports = eT.default || eT; + var eU = a.exports; + return a.exports = b, eU; }; }, 8448: function(a, b, c) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js index f1532b3a3076..88f9d0fa889a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js @@ -3465,12 +3465,9 @@ } function isSpecial(value) { var stringValue = Object.prototype.toString.call(value); - return "[object RegExp]" === stringValue || "[object Date]" === stringValue || isReactElement(value); + return "[object RegExp]" === stringValue || "[object Date]" === stringValue || value.$$typeof === REACT_ELEMENT_TYPE; } var REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol.for ? Symbol.for("react.element") : 0xeac7; - function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; - } function cloneUnlessOtherwiseSpecified(value, options) { return !1 !== options.clone && options.isMergeableObject(value) ? deepmerge(Array.isArray(value) ? [] : {}, value, options) : value; } diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js index 347ee0423740..a55e9006f0b6 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/2c796e83-0724e2af5f19128a/output.js @@ -1,11 +1,11 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(a,b,c){var d=c(3454);!function(b,c){a.exports=c()}(this,function(){"use strict";var a,b,c;function f(d,f){if(a){if(b){var g="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 = {}; ("+a+")(sharedChunk); ("+b+")(sharedChunk); self.onerror = null;",h={};a(h),c=f(h),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(c.workerUrl=window.URL.createObjectURL(new Blob([g],{type:"text/javascript"})))}else b=f}else a=f}return f(["exports"],function(a){var b="2.7.0",c=f;function f(a,b,c,d){this.cx=3*a,this.bx=3*(c-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*b,this.by=3*(d-b)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=d,this.p2x=c,this.p2y=d}f.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},f.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},f.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},f.prototype.solveCurveX=function(a,b){var c,d,f,g,h;for(void 0===b&&(b=1e-6),f=a,h=0;h<8;h++){if(Math.abs(g=this.sampleCurveX(f)-a)Math.abs(i))break;f-=g/i}if((f=a)<(c=0))return c;if(f>(d=1))return d;for(;cg?c=f:d=f,f=.5*(d-c)+c;return f},f.prototype.solve=function(a,b){return this.sampleCurveY(this.solveCurveX(a,b))};var g=h;function h(a,b){this.x=a,this.y=b}h.prototype={clone:function(){return new h(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,b){return this.clone()._rotateAround(a,b)},matMult:function(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var b=a.x-this.x,c=a.y-this.y;return b*b+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,b){return Math.atan2(this.x*b-this.y*a,this.x*a+this.y*b)},_matMult:function(a){var b=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=b,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=c*this.x+b*this.y;return this.x=b*this.x-c*this.y,this.y=d,this},_rotateAround:function(a,b){var c=Math.cos(a),d=Math.sin(a),f=b.y+d*(this.x-b.x)+c*(this.y-b.y);return this.x=b.x+c*(this.x-b.x)-d*(this.y-b.y),this.y=f,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},h.convert=function(a){return a instanceof h?a:Array.isArray(a)?new h(a[0],a[1]):a};var i="undefined"!=typeof self?self:{},j="undefined"!=typeof Float32Array?Float32Array:Array;function k(){var a=new j(9);return j!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function l(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function m(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=b[9],o=b[10],p=b[11],q=b[12],r=b[13],s=b[14],u=b[15],v=c[0],w=c[1],x=c[2],y=c[3];return a[0]=v*d+w*i+x*m+y*q,a[1]=v*f+w*j+x*n+y*r,a[2]=v*g+w*k+x*o+y*s,a[3]=v*h+w*l+x*p+y*u,a[4]=(v=c[4])*d+(w=c[5])*i+(x=c[6])*m+(y=c[7])*q,a[5]=v*f+w*j+x*n+y*r,a[6]=v*g+w*k+x*o+y*s,a[7]=v*h+w*l+x*p+y*u,a[8]=(v=c[8])*d+(w=c[9])*i+(x=c[10])*m+(y=c[11])*q,a[9]=v*f+w*j+x*n+y*r,a[10]=v*g+w*k+x*o+y*s,a[11]=v*h+w*l+x*p+y*u,a[12]=(v=c[12])*d+(w=c[13])*i+(x=c[14])*m+(y=c[15])*q,a[13]=v*f+w*j+x*n+y*r,a[14]=v*g+w*k+x*o+y*s,a[15]=v*h+w*l+x*p+y*u,a}function n(a,b,c){var d,f,g,h,i,j,k,l,m,n,o,p,q=c[0],r=c[1],s=c[2];return b===a?(a[12]=b[0]*q+b[4]*r+b[8]*s+b[12],a[13]=b[1]*q+b[5]*r+b[9]*s+b[13],a[14]=b[2]*q+b[6]*r+b[10]*s+b[14],a[15]=b[3]*q+b[7]*r+b[11]*s+b[15]):(f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=b[9],o=b[10],p=b[11],a[0]=d=b[0],a[1]=f,a[2]=g,a[3]=h,a[4]=i,a[5]=j,a[6]=k,a[7]=l,a[8]=m,a[9]=n,a[10]=o,a[11]=p,a[12]=d*q+i*r+m*s+b[12],a[13]=f*q+j*r+n*s+b[13],a[14]=g*q+k*r+o*s+b[14],a[15]=h*q+l*r+p*s+b[15]),a}function o(a,b,c){var d=c[0],f=c[1],g=c[2];return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a[4]=b[4]*f,a[5]=b[5]*f,a[6]=b[6]*f,a[7]=b[7]*f,a[8]=b[8]*g,a[9]=b[9]*g,a[10]=b[10]*g,a[11]=b[11]*g,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function p(a,b,c){var d=Math.sin(c),f=Math.cos(c),g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],n=b[11];return b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=g*f+k*d,a[5]=h*f+l*d,a[6]=i*f+m*d,a[7]=j*f+n*d,a[8]=k*f-g*d,a[9]=l*f-h*d,a[10]=m*f-i*d,a[11]=n*f-j*d,a}function q(a,b,c){var d=Math.sin(c),f=Math.cos(c),g=b[0],h=b[1],i=b[2],j=b[3],k=b[8],l=b[9],m=b[10],n=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=g*f-k*d,a[1]=h*f-l*d,a[2]=i*f-m*d,a[3]=j*f-n*d,a[8]=g*d+k*f,a[9]=h*d+l*f,a[10]=i*d+m*f,a[11]=j*d+n*f,a}Math.hypot||(Math.hypot=function(){for(var a=0,b=arguments.length;b--;)a+=arguments[b]*arguments[b];return Math.sqrt(a)});var r=m;function s(){var a=new j(3);return j!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function u(a){var b=new j(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b}function v(a){return Math.hypot(a[0],a[1],a[2])}function w(a,b,c){var d=new j(3);return d[0]=a,d[1]=b,d[2]=c,d}function x(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a}function y(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}function z(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a}function A(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a}function B(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a}function C(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a}function D(a,b){var c=b[0],d=b[1],f=b[2],g=c*c+d*d+f*f;return g>0&&(g=1/Math.sqrt(g)),a[0]=b[0]*g,a[1]=b[1]*g,a[2]=b[2]*g,a}function E(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function F(a,b,c){var d=b[0],f=b[1],g=b[2],h=c[0],i=c[1],j=c[2];return a[0]=f*j-g*i,a[1]=g*h-d*j,a[2]=d*i-f*h,a}function G(a,b,c){var d=b[0],f=b[1],g=b[2],h=c[3]*d+c[7]*f+c[11]*g+c[15];return a[0]=(c[0]*d+c[4]*f+c[8]*g+c[12])/(h=h||1),a[1]=(c[1]*d+c[5]*f+c[9]*g+c[13])/h,a[2]=(c[2]*d+c[6]*f+c[10]*g+c[14])/h,a}function H(a,b,c){var d=c[0],f=c[1],g=c[2],h=b[0],i=b[1],j=b[2],k=f*j-g*i,l=g*h-d*j,m=d*i-f*h,n=f*m-g*l,o=g*k-d*m,p=d*l-f*k,q=2*c[3];return l*=q,m*=q,o*=2,p*=2,a[0]=h+(k*=q)+(n*=2),a[1]=i+l+o,a[2]=j+m+p,a}var I,J=y;function K(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3];return a[0]=c[0]*d+c[4]*f+c[8]*g+c[12]*h,a[1]=c[1]*d+c[5]*f+c[9]*g+c[13]*h,a[2]=c[2]*d+c[6]*f+c[10]*g+c[14]*h,a[3]=c[3]*d+c[7]*f+c[11]*g+c[15]*h,a}function L(){var a=new j(4);return j!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function M(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function N(a,b,c){c*=.5;var d=b[0],f=b[1],g=b[2],h=b[3],i=Math.sin(c),j=Math.cos(c);return a[0]=d*j+h*i,a[1]=f*j+g*i,a[2]=g*j-f*i,a[3]=h*j-d*i,a}function O(a,b){return a[0]===b[0]&&a[1]===b[1]}s(),I=new j(4),j!=Float32Array&&(I[0]=0,I[1]=0,I[2]=0,I[3]=0),s(),w(1,0,0),w(0,1,0),L(),L(),k(),lr=new j(2),j!=Float32Array&&(lr[0]=0,lr[1]=0);const P=Math.PI/180,Q=180/Math.PI;function R(a){return a*P}function S(a){return a*Q}const T=[[0,0],[1,0],[1,1],[0,1],];function U(a){if(a<=0)return 0;if(a>=1)return 1;const b=a*a,c=b*a;return 4*(a<.5?c:3*(a-b)+c-.75)}function V(a,b,d,f){const g=new c(a,b,d,f);return function(a){return g.solve(a)}}const W=V(.25,.1,.25,1);function X(a,b,c){return Math.min(c,Math.max(b,a))}function Y(a,b,c){return(c=X((c-a)/(b-a),0,1))*c*(3-2*c)}function Z(a,b,c){const d=c-b,f=((a-b)%d+d)%d+b;return f===b?c:f}function $(a,b,c){if(!a.length)return c(null,[]);let d=a.length;const f=Array(a.length);let g=null;a.forEach((a,h)=>{b(a,(a,b)=>{a&&(g=a),f[h]=b,0== --d&&c(g,f)})})}function _(a){const b=[];for(const c in a)b.push(a[c]);return b}function aa(a,...b){for(const c of b)for(const d in c)a[d]=c[d];return a}let ab=1;function ac(){return ab++}function ad(){return function a(b){return b?(b^16*Math.random()>>b/4).toString(16):([1e7]+ -[1e3]+ -4e3+ -8e3+ -1e11).replace(/[018]/g,a)}()}function ae(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function af(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)}function ag(a,b){a.forEach(a=>{b[a]&&(b[a]=b[a].bind(b))})}function ah(a,b){return -1!==a.indexOf(b,a.length-b.length)}function ai(a,b,c){const d={};for(const f in a)d[f]=b.call(c||this,a[f],f,a);return d}function aj(a,b,c){const d={};for(const f in a)b.call(c||this,a[f],f,a)&&(d[f]=a[f]);return d}function ak(a){return Array.isArray(a)?a.map(ak):"object"==typeof a&&a?ai(a,ak):a}const al={};function am(a){al[a]||("undefined"!=typeof console&&console.warn(a),al[a]=!0)}function an(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)}function ao(a){let b=0;for(let c,d,f=0,g=a.length,h=g-1;f@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,c,d,f)=>{const g=d||f;return b[c]=!g||g.toLowerCase(),""}),b["max-age"]){const c=parseInt(b["max-age"],10);isNaN(c)?delete b["max-age"]:b["max-age"]=c}return b}let ar,as,at,au=null;function av(a){if(null==au){const b=a.navigator?a.navigator.userAgent:null;au=!!a.safari||!(!b||!(/\b(iPad|iPhone|iPod)\b/.test(b)||b.match("Safari")&&!b.match("Chrome")))}return au}function aw(a){try{const b=i[a];return b.setItem("_mapbox_test_",1),b.removeItem("_mapbox_test_"),!0}catch(c){return!1}}const ax={now:()=>void 0!==at?at:i.performance.now(),setNow(a){at=a},restoreNow(){at=void 0},frame(a){const b=i.requestAnimationFrame(a);return{cancel:()=>i.cancelAnimationFrame(b)}},getImageData(a,b=0){const c=i.document.createElement("canvas"),d=c.getContext("2d");if(!d)throw Error("failed to create canvas 2d context");return c.width=a.width,c.height=a.height,d.drawImage(a,0,0,a.width,a.height),d.getImageData(-b,-b,a.width+2*b,a.height+2*b)},resolveURL:a=>(ar||(ar=i.document.createElement("a")),ar.href=a,ar.href),get devicePixelRatio(){return i.devicePixelRatio},get prefersReducedMotion(){return!!i.matchMedia&&(null==as&&(as=i.matchMedia("(prefers-reduced-motion: reduce)")),as.matches)}};let ay;const az={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==ay){const aA=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{ay=null!=d.env.API_URL_REGEX?RegExp(d.env.API_URL_REGEX):aA}catch(aB){ay=aA}}return ay},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},aC={supported:!1,testSupport:function(a){!aF&&aE&&(aG?aH(a):aD=a)}};let aD,aE,aF=!1,aG=!1;function aH(a){const b=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,aE),a.isContextLost())return;aC.supported=!0}catch(c){}a.deleteTexture(b),aF=!0}i.document&&((aE=i.document.createElement("img")).onload=function(){aD&&aH(aD),aD=null,aG=!0},aE.onerror=function(){aF=!0,aD=null},aE.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const aI="NO_ACCESS_TOKEN";function aJ(a){return 0===a.indexOf("mapbox:")}function aK(a){return az.API_URL_REGEX.test(a)}const aL=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function aM(a){const b=a.match(aL);if(!b)throw Error("Unable to parse URL object");return{protocol:b[1],authority:b[2],path:b[3]||"/",params:b[4]?b[4].split("&"):[]}}function aN(a){const b=a.params.length?`?${a.params.join("&")}`:"";return`${a.protocol}://${a.authority}${a.path}${b}`}function aO(a){if(!a)return null;const b=a.split(".");if(!b||3!==b.length)return null;try{return JSON.parse(decodeURIComponent(i.atob(b[1]).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(c){return null}}class aP{constructor(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(a){const b=aO(az.ACCESS_TOKEN);let c="";return c=b&&b.u?i.btoa(encodeURIComponent(b.u).replace(/%([0-9A-F]{2})/g,(a,b)=>String.fromCharCode(Number("0x"+b)))):az.ACCESS_TOKEN||"",a?`mapbox.eventData.${a}:${c}`:`mapbox.eventData:${c}`}fetchEventData(){const a=aw("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{const d=i.localStorage.getItem(b);d&&(this.eventData=JSON.parse(d));const f=i.localStorage.getItem(c);f&&(this.anonId=f)}catch(g){am("Unable to read from LocalStorage")}}saveEventData(){const a=aw("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{i.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&i.localStorage.setItem(b,JSON.stringify(this.eventData))}catch(d){am("Unable to write to LocalStorage")}}processRequests(a){}postEvent(a,c,d,f){if(!az.EVENTS_URL)return;const g=aM(az.EVENTS_URL);g.params.push(`access_token=${f||az.ACCESS_TOKEN||""}`);const h={event:this.type,created:new Date(a).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:b,skuId:"01",userId:this.anonId},i=c?aa(h,c):h,j={url:aN(g),headers:{"Content-Type":"text/plain"},body:JSON.stringify([i])};this.pendingRequest=a8(j,a=>{this.pendingRequest=null,d(a),this.saveEventData(),this.processRequests(f)})}queueRequest(a,b){this.queue.push(a),this.processRequests(b)}}const aQ=new class extends aP{constructor(a){super("appUserTurnstile"),this._customAccessToken=a}postTurnstileEvent(a,b){az.EVENTS_URL&&az.ACCESS_TOKEN&&Array.isArray(a)&&a.some(a=>aJ(a)||aK(a))&&this.queueRequest(Date.now(),b)}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const b=aO(az.ACCESS_TOKEN),c=b?b.u:az.ACCESS_TOKEN;let d=c!==this.eventData.tokenU;af(this.anonId)||(this.anonId=ad(),d=!0);const f=this.queue.shift();if(this.eventData.lastSuccess){const g=new Date(this.eventData.lastSuccess),h=new Date(f),i=(f-this.eventData.lastSuccess)/864e5;d=d||i>=1||i< -1||g.getDate()!==h.getDate()}else d=!0;if(!d)return this.processRequests();this.postEvent(f,{"enabled.telemetry":!1},a=>{a||(this.eventData.lastSuccess=f,this.eventData.tokenU=c)},a)}},aR=aQ.postTurnstileEvent.bind(aQ),aS=new class extends aP{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(a,b,c,d){this.skuToken=b,this.errorCb=d,az.EVENTS_URL&&(c||az.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},c):this.errorCb(Error(aI)))}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;const{id:b,timestamp:c}=this.queue.shift();b&&this.success[b]||(this.anonId||this.fetchEventData(),af(this.anonId)||(this.anonId=ad()),this.postEvent(c,{skuToken:this.skuToken},a=>{a?this.errorCb(a):b&&(this.success[b]=!0)},a))}},aT=aS.postMapLoadEvent.bind(aS),aU=new class extends aP{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(a,b,c,d){if(!az.API_URL||!az.SESSION_PATH)return;const f=aM(az.API_URL+az.SESSION_PATH);f.params.push(`sku=${b||""}`),f.params.push(`access_token=${d||az.ACCESS_TOKEN||""}`);const g={url:aN(f),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a9(g,a=>{this.pendingRequest=null,c(a),this.saveEventData(),this.processRequests(d)})}getSessionAPI(a,b,c,d){this.skuToken=b,this.errorCb=d,az.SESSION_PATH&&az.API_URL&&(c||az.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},c):this.errorCb(Error(aI)))}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;const{id:b,timestamp:c}=this.queue.shift();b&&this.success[b]||this.getSession(c,this.skuToken,a=>{a?this.errorCb(a):b&&(this.success[b]=!0)},a)}},aV=aU.getSessionAPI.bind(aU),aW=new Set,aX="mapbox-tiles";let aY,aZ,a$=500,a_=50;function a0(){i.caches&&!aY&&(aY=i.caches.open(aX))}function a1(a){const b=a.indexOf("?");return b<0?a:a.slice(0,b)}let a2=1/0;const a3={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(a3);class a4 extends Error{constructor(a,b,c){401===b&&aK(c)&&(a+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(a),this.status=b,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const a5=ap()?()=>self.worker&&self.worker.referrer:()=>("blob:"===i.location.protocol?i.parent:i).location.href,a6=function(a,b){var c;if(!(/^file:/.test(c=a.url)||/^file:/.test(a5())&&!/^\w+:/.test(c))){if(i.fetch&&i.Request&&i.AbortController&&i.Request.prototype.hasOwnProperty("signal"))return function(a,b){var c;const d=new i.AbortController,f=new i.Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,referrer:a5(),signal:d.signal});let g=!1,h=!1;const j=(c=f.url).indexOf("sku=")>0&&aK(c);"json"===a.type&&f.headers.set("Accept","application/json");const k=(c,d,g)=>{if(h)return;if(c&&"SecurityError"!==c.message&&am(c),d&&g)return l(d);const k=Date.now();i.fetch(f).then(c=>{if(c.ok){const d=j?c.clone():null;return l(c,d,k)}return b(new a4(c.statusText,c.status,a.url))}).catch(a=>{20!==a.code&&b(Error(a.message))})},l=(c,d,j)=>{("arrayBuffer"===a.type?c.arrayBuffer():"json"===a.type?c.json():c.text()).then(a=>{h||(d&&j&&function(a,b,c){if(a0(),!aY)return;const d={status:b.status,statusText:b.statusText,headers:new i.Headers};b.headers.forEach((a,b)=>d.headers.set(b,a));const f=aq(b.headers.get("Cache-Control")||"");f["no-store"]||(f["max-age"]&&d.headers.set("Expires",new Date(c+1e3*f["max-age"]).toUTCString()),new Date(d.headers.get("Expires")).getTime()-c<42e4||function(a,b){if(void 0===aZ)try{new Response(new ReadableStream),aZ=!0}catch(c){aZ=!1}aZ?b(a.body):a.blob().then(b)}(b,b=>{const c=new i.Response(b,d);a0(),aY&&aY.then(b=>b.put(a1(a.url),c)).catch(a=>am(a.message))}))}(f,d,j),g=!0,b(null,a,c.headers.get("Cache-Control"),c.headers.get("Expires")))}).catch(a=>{h||b(Error(a.message))})};return j?function(a,b){if(a0(),!aY)return b(null);const c=a1(a.url);aY.then(a=>{a.match(c).then(d=>{const f=function(a){if(!a)return!1;const b=new Date(a.headers.get("Expires")||0),c=aq(a.headers.get("Cache-Control")||"");return b>Date.now()&&!c["no-cache"]}(d);a.delete(c),f&&a.put(c,d.clone()),b(null,d,f)}).catch(b)}).catch(b)}(f,k):k(null,null),{cancel:()=>{h=!0,g||d.abort()}}}(a,b);if(ap()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,b,void 0,!0)}return function(a,b){const c=new i.XMLHttpRequest;for(const d in c.open(a.method||"GET",a.url,!0),"arrayBuffer"===a.type&&(c.responseType="arraybuffer"),a.headers)c.setRequestHeader(d,a.headers[d]);return"json"===a.type&&(c.responseType="text",c.setRequestHeader("Accept","application/json")),c.withCredentials="include"===a.credentials,c.onerror=()=>{b(Error(c.statusText))},c.onload=()=>{if((c.status>=200&&c.status<300||0===c.status)&&null!==c.response){let d=c.response;if("json"===a.type)try{d=JSON.parse(c.response)}catch(f){return b(f)}b(null,d,c.getResponseHeader("Cache-Control"),c.getResponseHeader("Expires"))}else b(new a4(c.statusText,c.status,a.url))},c.send(a.body),{cancel:()=>c.abort()}}(a,b)},a7=function(a,b){return a6(aa(a,{type:"arrayBuffer"}),b)},a8=function(a,b){return a6(aa(a,{method:"POST"}),b)},a9=function(a,b){return a6(aa(a,{method:"GET"}),b)};function ba(a){const b=i.document.createElement("a");return b.href=a,b.protocol===i.document.location.protocol&&b.host===i.document.location.host}const bb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let bc,bd;bc=[],bd=0;const be=function(a,b){if(aC.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),bd>=az.MAX_PARALLEL_IMAGE_REQUESTS){const c={requestParameters:a,callback:b,cancelled:!1,cancel(){this.cancelled=!0}};return bc.push(c),c}bd++;let d=!1;const f=()=>{if(!d)for(d=!0,bd--;bc.length&&bd{f(),a?b(a):c&&(i.createImageBitmap?function(a,b){const c=new i.Blob([new Uint8Array(a)],{type:"image/png"});i.createImageBitmap(c).then(a=>{b(null,a)}).catch(a=>{b(Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(c,(a,c)=>b(a,c,d,g)):function(a,b){const c=new i.Image,d=i.URL;c.onload=()=>{b(null,c),d.revokeObjectURL(c.src),c.onload=null,i.requestAnimationFrame(()=>{c.src=bb})},c.onerror=()=>b(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 f=new i.Blob([new Uint8Array(a)],{type:"image/png"});c.src=a.byteLength?d.createObjectURL(f):bb}(c,(a,c)=>b(a,c,d,g)))});return{cancel:()=>{g.cancel(),f()}}};function bf(a,b,c){c[a]&& -1!==c[a].indexOf(b)||(c[a]=c[a]||[],c[a].push(b))}function bg(a,b,c){if(c&&c[a]){const d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}}class bh{constructor(a,b={}){aa(this,b),this.type=a}}class bi extends bh{constructor(a,b={}){super("error",aa({error:a},b))}}class bj{on(a,b){return this._listeners=this._listeners||{},bf(a,b,this._listeners),this}off(a,b){return bg(a,b,this._listeners),bg(a,b,this._oneTimeListeners),this}once(a,b){return b?(this._oneTimeListeners=this._oneTimeListeners||{},bf(a,b,this._oneTimeListeners),this):new Promise(b=>this.once(a,b))}fire(a,b){"string"==typeof a&&(a=new bh(a,b||{}));const c=a.type;if(this.listens(c)){a.target=this;const d=this._listeners&&this._listeners[c]?this._listeners[c].slice():[];for(const f of d)f.call(this,a);const g=this._oneTimeListeners&&this._oneTimeListeners[c]?this._oneTimeListeners[c].slice():[];for(const h of g)bg(c,h,this._oneTimeListeners),h.call(this,a);const i=this._eventedParent;i&&(aa(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(a))}else a instanceof bi&&console.error(a.error);return this}listens(a){return!!(this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a))}setEventedParent(a,b){return this._eventedParent=a,this._eventedParentData=b,this}}var bk=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"}},"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},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"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":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","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}},"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"}},"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"}},"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"}}}');class bl{constructor(a,b,c,d){this.message=(a?`${a}: `:"")+c,d&&(this.identifier=d),null!=b&&b.__line__&&(this.line=b.__line__)}}function bm(a){const b=a.value;return b?[new bl(a.key,b,"constants have been deprecated as of v8"),]:[]}function bn(a,...b){for(const c of b)for(const d in c)a[d]=c[d];return a}function bo(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function bp(a){if(Array.isArray(a))return a.map(bp);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const b={};for(const c in a)b[c]=bp(a[c]);return b}return bo(a)}class bq extends Error{constructor(a,b){super(b),this.message=b,this.key=a}}class br{constructor(a,b=[]){for(const[c,d]of(this.parent=a,this.bindings={},b))this.bindings[c]=d}concat(a){return new br(this,a)}get(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw Error(`${a} not found in scope.`)}has(a){return!!this.bindings[a]|| !!this.parent&&this.parent.has(a)}}const bs={kind:"null"},bt={kind:"number"},bu={kind:"string"},bv={kind:"boolean"},bw={kind:"color"},bx={kind:"object"},by={kind:"value"},bz={kind:"collator"},bA={kind:"formatted"},bB={kind:"resolvedImage"};function bC(a,b){return{kind:"array",itemType:a,N:b}}function bD(a){if("array"===a.kind){const b=bD(a.itemType);return"number"==typeof a.N?`array<${b}, ${a.N}>`:"value"===a.itemType.kind?"array":`array<${b}>`}return a.kind}const bE=[bs,bt,bu,bv,bw,bA,bx,bC(by),bB];function bF(a,b){if("error"===b.kind)return null;if("array"===a.kind){if("array"===b.kind&&(0===b.N&&"value"===b.itemType.kind||!bF(a.itemType,b.itemType))&&("number"!=typeof a.N||a.N===b.N))return null}else{if(a.kind===b.kind)return null;if("value"===a.kind){for(const c of bE)if(!bF(c,b))return null}}return`Expected ${bD(a)} but found ${bD(b)} instead.`}function bG(a,b){return b.some(b=>b.kind===a.kind)}function bH(a,b){return b.some(b=>"null"===b?null===a:"array"===b?Array.isArray(a):"object"===b?a&&!Array.isArray(a)&&"object"==typeof a:b===typeof a)}function bI(a){var b={exports:{}};return a(b,b.exports),b.exports}var bJ=bI(function(a,b){var c={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 d(a){return(a=Math.round(a))<0?0:a>255?255:a}function f(a){return d("%"===a[a.length-1]?parseFloat(a)/100*255:parseInt(a))}function g(a){var b;return(b="%"===a[a.length-1]?parseFloat(a)/100:parseFloat(a))<0?0:b>1?1:b}function h(a,b,c){return c<0?c+=1:c>1&&(c-=1),6*c<1?a+(b-a)*c*6:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}try{b.parseCSSColor=function(a){var b,i=a.replace(/ /g,"").toLowerCase();if(i in c)return c[i].slice();if("#"===i[0])return 4===i.length?(b=parseInt(i.substr(1),16))>=0&&b<=4095?[(3840&b)>>4|(3840&b)>>8,240&b|(240&b)>>4,15&b|(15&b)<<4,1,]:null:7===i.length&&(b=parseInt(i.substr(1),16))>=0&&b<=16777215?[(16711680&b)>>16,(65280&b)>>8,255&b,1,]:null;var j=i.indexOf("("),k=i.indexOf(")");if(-1!==j&&k+1===i.length){var l=i.substr(0,j),m=i.substr(j+1,k-(j+1)).split(","),n=1;switch(l){case"rgba":if(4!==m.length)break;n=g(m.pop());case"rgb":return 3!==m.length?null:[f(m[0]),f(m[1]),f(m[2]),n,];case"hsla":if(4!==m.length)break;n=g(m.pop());case"hsl":if(3!==m.length)break;var o=(parseFloat(m[0])%360+360)%360/360,p=g(m[1]),q=g(m[2]),r=q<=.5?q*(p+1):q+p-q*p,s=2*q-r;return[d(255*h(s,r,o+1/3)),d(255*h(s,r,o)),d(255*h(s,r,o-1/3)),n,]}}return null}}catch(i){}});class bK{constructor(a,b,c,d=1){this.r=a,this.g=b,this.b=c,this.a=d}static parse(a){if(!a)return;if(a instanceof bK)return a;if("string"!=typeof a)return;const b=bJ.parseCSSColor(a);return b?new bK(b[0]/255*b[3],b[1]/255*b[3],b[2]/255*b[3],b[3]):void 0}toString(){const[a,b,c,d]=this.toArray();return`rgba(${Math.round(a)},${Math.round(b)},${Math.round(c)},${d})`}toArray(){const{r:a,g:b,b:c,a:d}=this;return 0===d?[0,0,0,0]:[255*a/d,255*b/d,255*c/d,d,]}}bK.black=new bK(0,0,0,1),bK.white=new bK(1,1,1,1),bK.transparent=new bK(0,0,0,0),bK.red=new bK(1,0,0,1),bK.blue=new bK(0,0,1,1);class bL{constructor(a,b,c){this.sensitivity=a?b?"variant":"case":b?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(a,b){return this.collator.compare(a,b)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class bM{constructor(a,b,c,d,f){this.text=a.normalize?a.normalize():a,this.image=b,this.scale=c,this.fontStack=d,this.textColor=f}}class bN{constructor(a){this.sections=a}static fromString(a){return new bN([new bM(a,null,null,null,null),])}isEmpty(){return 0===this.sections.length||!this.sections.some(a=>0!==a.text.length||a.image&&0!==a.image.name.length)}static factory(a){return a instanceof bN?a:bN.fromString(a)}toString(){return 0===this.sections.length?"":this.sections.map(a=>a.text).join("")}serialize(){const a=["format"];for(const b of this.sections){if(b.image){a.push(["image",b.image.name]);continue}a.push(b.text);const c={};b.fontStack&&(c["text-font"]=["literal",b.fontStack.split(","),]),b.scale&&(c["font-scale"]=b.scale),b.textColor&&(c["text-color"]=["rgba"].concat(b.textColor.toArray())),a.push(c)}return a}}class bO{constructor(a){this.name=a.name,this.available=a.available}toString(){return this.name}static fromString(a){return a?new bO({name:a,available:!1}):null}serialize(){return["image",this.name]}}function bP(a,b,c,d){return"number"==typeof a&&a>=0&&a<=255&&"number"==typeof b&&b>=0&&b<=255&&"number"==typeof c&&c>=0&&c<=255?void 0===d||"number"==typeof d&&d>=0&&d<=1?null:`Invalid rgba value [${[a,b,c,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof d?[a,b,c,d]:[a,b,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bQ(a){if(null===a||"string"==typeof a||"boolean"==typeof a||"number"==typeof a||a instanceof bK||a instanceof bL||a instanceof bN||a instanceof bO)return!0;if(Array.isArray(a)){for(const b of a)if(!bQ(b))return!1;return!0}if("object"==typeof a){for(const c in a)if(!bQ(a[c]))return!1;return!0}return!1}function bR(a){if(null===a)return bs;if("string"==typeof a)return bu;if("boolean"==typeof a)return bv;if("number"==typeof a)return bt;if(a instanceof bK)return bw;if(a instanceof bL)return bz;if(a instanceof bN)return bA;if(a instanceof bO)return bB;if(Array.isArray(a)){const b=a.length;let c;for(const d of a){const f=bR(d);if(c){if(c===f)continue;c=by;break}c=f}return bC(c||by,b)}return bx}function bS(a){const b=typeof a;return null===a?"":"string"===b||"number"===b||"boolean"===b?String(a):a instanceof bK||a instanceof bN||a instanceof bO?a.toString():JSON.stringify(a)}class bT{constructor(a,b){this.type=a,this.value=b}static parse(a,b){if(2!==a.length)return b.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!bQ(a[1]))return b.error("invalid value");const c=a[1];let d=bR(c);const f=b.expectedType;return"array"===d.kind&&0===d.N&&f&&"array"===f.kind&&("number"!=typeof f.N||0===f.N)&&(d=f),new bT(d,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof bK?["rgba"].concat(this.value.toArray()):this.value instanceof bN?this.value.serialize():this.value}}class bU{constructor(a){this.name="ExpressionEvaluationError",this.message=a}toJSON(){return this.message}}const bV={string:bu,number:bt,boolean:bv,object:bx};class bW{constructor(a,b){this.type=a,this.args=b}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");let c,d=1;const f=a[0];if("array"===f){let g,h;if(a.length>2){const i=a[1];if("string"!=typeof i||!(i in bV)||"object"===i)return b.error('The item type argument of "array" must be one of string, number, boolean',1);g=bV[i],d++}else g=by;if(a.length>3){if(null!==a[2]&&("number"!=typeof a[2]||a[2]<0||a[2]!==Math.floor(a[2])))return b.error('The length argument to "array" must be a positive integer literal',2);h=a[2],d++}c=bC(g,h)}else c=bV[f];const j=[];for(;da.outputDefined())}serialize(){const a=this.type,b=[a.kind];if("array"===a.kind){const c=a.itemType;if("string"===c.kind||"number"===c.kind||"boolean"===c.kind){b.push(c.kind);const d=a.N;("number"==typeof d||this.args.length>1)&&b.push(d)}}return b.concat(this.args.map(a=>a.serialize()))}}class bX{constructor(a){this.type=bA,this.sections=a}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");const c=a[1];if(!Array.isArray(c)&&"object"==typeof c)return b.error("First argument must be an image or text section.");const d=[];let f=!1;for(let g=1;g<=a.length-1;++g){const h=a[g];if(f&&"object"==typeof h&&!Array.isArray(h)){f=!1;let i=null;if(h["font-scale"]&&!(i=b.parse(h["font-scale"],1,bt)))return null;let j=null;if(h["text-font"]&&!(j=b.parse(h["text-font"],1,bC(bu))))return null;let k=null;if(h["text-color"]&&!(k=b.parse(h["text-color"],1,bw)))return null;const l=d[d.length-1];l.scale=i,l.font=j,l.textColor=k}else{const m=b.parse(a[g],1,by);if(!m)return null;const n=m.type.kind;if("string"!==n&&"value"!==n&&"null"!==n&&"resolvedImage"!==n)return b.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,d.push({content:m,scale:null,font:null,textColor:null})}}return new bX(d)}evaluate(a){return new bN(this.sections.map(b=>{const c=b.content.evaluate(a);return bR(c)===bB?new bM("",c,null,null,null):new bM(bS(c),null,b.scale?b.scale.evaluate(a):null,b.font?b.font.evaluate(a).join(","):null,b.textColor?b.textColor.evaluate(a):null)}))}eachChild(a){for(const b of this.sections)a(b.content),b.scale&&a(b.scale),b.font&&a(b.font),b.textColor&&a(b.textColor)}outputDefined(){return!1}serialize(){const a=["format"];for(const b of this.sections){a.push(b.content.serialize());const c={};b.scale&&(c["font-scale"]=b.scale.serialize()),b.font&&(c["text-font"]=b.font.serialize()),b.textColor&&(c["text-color"]=b.textColor.serialize()),a.push(c)}return a}}class bY{constructor(a){this.type=bB,this.input=a}static parse(a,b){if(2!==a.length)return b.error("Expected two arguments.");const c=b.parse(a[1],1,bu);return c?new bY(c):b.error("No image name provided.")}evaluate(a){const b=this.input.evaluate(a),c=bO.fromString(b);return c&&a.availableImages&&(c.available=a.availableImages.indexOf(b)> -1),c}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const bZ={"to-boolean":bv,"to-color":bw,"to-number":bt,"to-string":bu};class b${constructor(a,b){this.type=a,this.args=b}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");const c=a[0];if(("to-boolean"===c||"to-string"===c)&&2!==a.length)return b.error("Expected one argument.");const d=bZ[c],f=[];for(let g=1;g4?`Invalid rbga value ${JSON.stringify(b)}: expected an array containing either three or four numeric values.`:bP(b[0],b[1],b[2],b[3])))return new bK(b[0]/255,b[1]/255,b[2]/255,b[3])}throw new bU(c||`Could not parse color from value '${"string"==typeof b?b:String(JSON.stringify(b))}'`)}if("number"===this.type.kind){let g=null;for(const h of this.args){if(null===(g=h.evaluate(a)))return 0;const i=Number(g);if(!isNaN(i))return i}throw new bU(`Could not convert ${JSON.stringify(g)} to number.`)}return"formatted"===this.type.kind?bN.fromString(bS(this.args[0].evaluate(a))):"resolvedImage"===this.type.kind?bO.fromString(bS(this.args[0].evaluate(a))):bS(this.args[0].evaluate(a))}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){if("formatted"===this.type.kind)return new bX([{content:this.args[0],scale:null,font:null,textColor:null},]).serialize();if("resolvedImage"===this.type.kind)return new bY(this.args[0]).serialize();const a=[`to-${this.type.kind}`];return this.eachChild(b=>{a.push(b.serialize())}),a}}const b_=["Unknown","Point","LineString","Polygon",];class b0{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&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?b_[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 a=this.featureDistanceData.center,b=this.featureDistanceData.scale,{x:c,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*b-a[0])+this.featureDistanceData.bearing[1]*(d*b-a[1])}return 0}parseColor(a){let b=this._parseColorCache[a];return b||(b=this._parseColorCache[a]=bK.parse(a)),b}}class b1{constructor(a,b,c,d){this.name=a,this.type=b,this._evaluate=c,this.args=d}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(a=>a.serialize()))}static parse(a,b){const c=a[0],d=b1.definitions[c];if(!d)return b.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const f=Array.isArray(d)?d[0]:d.type,g=Array.isArray(d)?[[d[1],d[2]]]:d.overloads,h=g.filter(([b])=>!Array.isArray(b)||b.length===a.length-1);let i=null;for(const[j,k]of h){i=new cn(b.registry,b.path,null,b.scope);const l=[];let m=!1;for(let n=1;n{var b;return Array.isArray(b=a)?`(${b.map(bD).join(", ")})`:`(${bD(b.type)}...)`}).join(" | "),w=[];for(let x=1;x=b[2]||a[1]<=b[1]||a[3]>=b[3])}function b5(a,b){const c=(180+a[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,f=Math.pow(2,b.z);return[Math.round(c*f*8192),Math.round(d*f*8192),]}function b6(a,b,c){const d=a[0]-b[0],f=a[1]-b[1],g=a[0]-c[0],h=a[1]-c[1];return d*h-g*f==0&&d*g<=0&&f*h<=0}function b7(a,b){var c,d,f;let g=!1;for(let h=0,i=b.length;h(c=a)[1]!=(f=j[k+1])[1]>c[1]&&c[0]<(f[0]-d[0])*(c[1]-d[1])/(f[1]-d[1])+d[0]&&(g=!g)}}return g}function b8(a,b){for(let c=0;c0&&i<0||h<0&&i>0}function ca(a,b,c){var d,f,g,h,i,j;for(const k of c)for(let l=0;lc[2]){const f=.5*d;let g=a[0]-c[0]>f?-d:c[0]-a[0]>f?d:0;0===g&&(g=a[0]-c[2]>f?-d:c[2]-a[0]>f?d:0),a[0]+=g}b3(b,a)}function cg(a,b,c,d){const f=8192*Math.pow(2,d.z),g=[8192*d.x,8192*d.y],h=[];for(const i of a)for(const j of i){const k=[j.x+g[0],j.y+g[1]];cf(k,b,c,f),h.push(k)}return h}function ch(a,b,c,d){var f;const g=8192*Math.pow(2,d.z),h=[8192*d.x,8192*d.y],i=[];for(const j of a){const k=[];for(const l of j){const m=[l.x+h[0],l.y+h[1]];b3(b,m),k.push(m)}i.push(k)}if(b[2]-b[0]<=g/2)for(const n of((f=b)[0]=f[1]=1/0,f[2]=f[3]=-1/0,i))for(const o of n)cf(o,b,c,g);return i}class ci{constructor(a,b){this.type=bv,this.geojson=a,this.geometries=b}static parse(a,b){if(2!==a.length)return b.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(bQ(a[1])){const c=a[1];if("FeatureCollection"===c.type)for(let d=0;d{b&&!cj(a)&&(b=!1)}),b}function ck(a){if(a instanceof b1&&"feature-state"===a.name)return!1;let b=!0;return a.eachChild(a=>{b&&!ck(a)&&(b=!1)}),b}function cl(a,b){if(a instanceof b1&&b.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(a=>{c&&!cl(a,b)&&(c=!1)}),c}class cm{constructor(a,b){this.type=b.type,this.name=a,this.boundExpression=b}static parse(a,b){if(2!==a.length||"string"!=typeof a[1])return b.error("'var' expression requires exactly one string literal argument.");const c=a[1];return b.scope.has(c)?new cm(c,b.scope.get(c)):b.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class cn{constructor(a,b=[],c,d=new br,f=[]){this.registry=a,this.path=b,this.key=b.map(a=>`[${a}]`).join(""),this.scope=d,this.errors=f,this.expectedType=c}parse(a,b,c,d,f={}){return b?this.concat(b,c,d)._parse(a,f):this._parse(a,f)}_parse(a,b){function c(a,b,c){return"assert"===c?new bW(b,[a]):"coerce"===c?new b$(b,[a]):a}if(null!==a&&"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a||(a=["literal",a]),Array.isArray(a)){if(0===a.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=a[0];if("string"!=typeof d)return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const f=this.registry[d];if(f){let g=f.parse(a,this);if(!g)return null;if(this.expectedType){const h=this.expectedType,i=g.type;if("string"!==h.kind&&"number"!==h.kind&&"boolean"!==h.kind&&"object"!==h.kind&&"array"!==h.kind||"value"!==i.kind){if("color"!==h.kind&&"formatted"!==h.kind&&"resolvedImage"!==h.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(h,i))return null}else g=c(g,h,b.typeAnnotation||"coerce")}else g=c(g,h,b.typeAnnotation||"assert")}if(!(g instanceof bT)&&"resolvedImage"!==g.type.kind&&co(g)){const j=new b0;try{g=new bT(g.type,g.evaluate(j))}catch(k){return this.error(k.message),null}}return g}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===a?"'undefined' value invalid. Use null instead.":"object"==typeof a?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,b,c){const d="number"==typeof a?this.path.concat(a):this.path,f=c?this.scope.concat(c):this.scope;return new cn(this.registry,d,b||null,f,this.errors)}error(a,...b){const c=`${this.key}${b.map(a=>`[${a}]`).join("")}`;this.errors.push(new bq(c,a))}checkSubtype(a,b){const c=bF(a,b);return c&&this.error(c),c}}function co(a){if(a instanceof cm)return co(a.boundExpression);if(a instanceof b1&&"error"===a.name||a instanceof b2||a instanceof ci)return!1;const b=a instanceof b$||a instanceof bW;let c=!0;return a.eachChild(a=>{c=b?c&&co(a):c&&a instanceof bT}),!!c&&cj(a)&&cl(a,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center",])}function cp(a,b){const c=a.length-1;let d,f,g=0,h=c,i=0;for(;g<=h;)if(d=a[i=Math.floor((g+h)/2)],f=a[i+1],d<=b){if(i===c||bb))throw new bU("Input is not a number.");h=i-1}return 0}class cq{constructor(a,b,c){for(const[d,f]of(this.type=a,this.input=b,this.labels=[],this.outputs=[],c))this.labels.push(d),this.outputs.push(f)}static parse(a,b){if(a.length-1<4)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return b.error("Expected an even number of arguments.");const c=b.parse(a[1],1,bt);if(!c)return null;const d=[];let f=null;b.expectedType&&"value"!==b.expectedType.kind&&(f=b.expectedType);for(let g=1;g=h)return b.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',j);const l=b.parse(i,k,f);if(!l)return null;f=f||l.type,d.push([h,l])}return new cq(f,c,d)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const f=b.length;return d>=b[f-1]?c[f-1].evaluate(a):c[cp(b,d)].evaluate(a)}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){const a=["step",this.input.serialize()];for(let b=0;b0&&a.push(this.labels[b]),a.push(this.outputs[b].serialize());return a}}function cr(a,b,c){return a*(1-c)+b*c}var cs=Object.freeze({__proto__:null,number:cr,color:function(a,b,c){return new bK(cr(a.r,b.r,c),cr(a.g,b.g,c),cr(a.b,b.b,c),cr(a.a,b.a,c))},array:function(a,b,c){return a.map((a,d)=>cr(a,b[d],c))}});const ct=4/29,cu=6/29,cv=3*cu*cu,cw=Math.PI/180,cx=180/Math.PI;function cy(a){return a>.008856451679035631?Math.pow(a,1/3):a/cv+ct}function cz(a){return a>cu?a*a*a:cv*(a-ct)}function cA(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function cB(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function cC(a){const b=cB(a.r),c=cB(a.g),d=cB(a.b),f=cy((.4124564*b+.3575761*c+.1804375*d)/.95047),g=cy((.2126729*b+.7151522*c+.072175*d)/1);return{l:116*g-16,a:500*(f-g),b:200*(g-cy((.0193339*b+.119192*c+.9503041*d)/1.08883)),alpha:a.a}}function cD(a){let b=(a.l+16)/116,c=isNaN(a.a)?b:b+a.a/500,d=isNaN(a.b)?b:b-a.b/200;return b=1*cz(b),c=.95047*cz(c),d=1.08883*cz(d),new bK(cA(3.2404542*c-1.5371385*b-.4985314*d),cA(-.969266*c+1.8760108*b+.041556*d),cA(.0556434*c-.2040259*b+1.0572252*d),a.alpha)}const cE={forward:cC,reverse:cD,interpolate:function(a,b,c){return{l:cr(a.l,b.l,c),a:cr(a.a,b.a,c),b:cr(a.b,b.b,c),alpha:cr(a.alpha,b.alpha,c)}}},cF={forward:function(a){const{l:b,a:c,b:d}=cC(a),f=Math.atan2(d,c)*cx;return{h:f<0?f+360:f,c:Math.sqrt(c*c+d*d),l:b,alpha:a.a}},reverse:function(a){const b=a.h*cw,c=a.c;return cD({l:a.l,a:Math.cos(b)*c,b:Math.sin(b)*c,alpha:a.alpha})},interpolate:function(a,b,c){return{h:function(a,b,c){const d=b-a;return a+c*(d>180||d< -180?d-360*Math.round(d/360):d)}(a.h,b.h,c),c:cr(a.c,b.c,c),l:cr(a.l,b.l,c),alpha:cr(a.alpha,b.alpha,c)}}};var cG=Object.freeze({__proto__:null,lab:cE,hcl:cF});class cH{constructor(a,b,c,d,f){for(const[g,h]of(this.type=a,this.operator=b,this.interpolation=c,this.input=d,this.labels=[],this.outputs=[],f))this.labels.push(g),this.outputs.push(h)}static interpolationFactor(a,b,d,f){let g=0;if("exponential"===a.name)g=cI(b,a.base,d,f);else if("linear"===a.name)g=cI(b,1,d,f);else if("cubic-bezier"===a.name){const h=a.controlPoints;g=new c(h[0],h[1],h[2],h[3]).solve(cI(b,1,d,f))}return g}static parse(a,b){let[c,d,f,...g]=a;if(!Array.isArray(d)||0===d.length)return b.error("Expected an interpolation type expression.",1);if("linear"===d[0])d={name:"linear"};else if("exponential"===d[0]){const h=d[1];if("number"!=typeof h)return b.error("Exponential interpolation requires a numeric base.",1,1);d={name:"exponential",base:h}}else{if("cubic-bezier"!==d[0])return b.error(`Unknown interpolation type ${String(d[0])}`,1,0);{const i=d.slice(1);if(4!==i.length||i.some(a=>"number"!=typeof a||a<0||a>1))return b.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);d={name:"cubic-bezier",controlPoints:i}}}if(a.length-1<4)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return b.error("Expected an even number of arguments.");if(!(f=b.parse(f,2,bt)))return null;const j=[];let k=null;"interpolate-hcl"===c||"interpolate-lab"===c?k=bw:b.expectedType&&"value"!==b.expectedType.kind&&(k=b.expectedType);for(let l=0;l=m)return b.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const q=b.parse(n,p,k);if(!q)return null;k=k||q.type,j.push([m,q])}return"number"===k.kind||"color"===k.kind||"array"===k.kind&&"number"===k.itemType.kind&&"number"==typeof k.N?new cH(k,c,d,f,j):b.error(`Type ${bD(k)} is not interpolatable.`)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const f=b.length;if(d>=b[f-1])return c[f-1].evaluate(a);const g=cp(b,d),h=cH.interpolationFactor(this.interpolation,d,b[g],b[g+1]),i=c[g].evaluate(a),j=c[g+1].evaluate(a);return"interpolate"===this.operator?cs[this.type.kind.toLowerCase()](i,j,h):"interpolate-hcl"===this.operator?cF.reverse(cF.interpolate(cF.forward(i),cF.forward(j),h)):cE.reverse(cE.interpolate(cE.forward(i),cE.forward(j),h))}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){let a;a="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 b=[this.operator,a,this.input.serialize(),];for(let c=0;cbF(d,a.type));return new cJ(i?by:c,f)}evaluate(a){let b,c=null,d=0;for(const f of this.args){if(d++,(c=f.evaluate(a))&&c instanceof bO&&!c.available&&(b||(b=c),c=null,d===this.args.length))return b;if(null!==c)break}return c}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){const a=["coalesce"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cK{constructor(a,b){this.type=b.type,this.bindings=[].concat(a),this.result=b}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(const b of this.bindings)a(b[1]);a(this.result)}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);const c=[];for(let d=1;d=c.length)throw new bU(`Array index out of bounds: ${b} > ${c.length-1}.`);if(b!==Math.floor(b))throw new bU(`Array index must be an integer, but found ${b} instead.`);return c[b]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize(),]}}class cM{constructor(a,b){this.type=bv,this.needle=a,this.haystack=b}static parse(a,b){if(3!==a.length)return b.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,by);return c&&d?bG(c.type,[bv,bu,bt,bs,by])?new cM(c,d):b.error(`Expected first argument to be of type boolean, string, number or null, but found ${bD(c.type)} instead`):null}evaluate(a){const b=this.needle.evaluate(a),c=this.haystack.evaluate(a);if(!c)return!1;if(!bH(b,["boolean","string","number","null",]))throw new bU(`Expected first argument to be of type boolean, string, number or null, but found ${bD(bR(b))} instead.`);if(!bH(c,["string","array"]))throw new bU(`Expected second argument to be of type array or string, but found ${bD(bR(c))} instead.`);return c.indexOf(b)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize(),]}}class cN{constructor(a,b,c){this.type=bt,this.needle=a,this.haystack=b,this.fromIndex=c}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,by);if(!c||!d)return null;if(!bG(c.type,[bv,bu,bt,bs,by]))return b.error(`Expected first argument to be of type boolean, string, number or null, but found ${bD(c.type)} instead`);if(4===a.length){const f=b.parse(a[3],3,bt);return f?new cN(c,d,f):null}return new cN(c,d)}evaluate(a){const b=this.needle.evaluate(a),c=this.haystack.evaluate(a);if(!bH(b,["boolean","string","number","null",]))throw new bU(`Expected first argument to be of type boolean, string, number or null, but found ${bD(bR(b))} instead.`);if(!bH(c,["string","array"]))throw new bU(`Expected second argument to be of type array or string, but found ${bD(bR(c))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(a);return c.indexOf(b,d)}return c.indexOf(b)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&& void 0!==this.fromIndex){const a=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),a,]}return["index-of",this.needle.serialize(),this.haystack.serialize(),]}}class cO{constructor(a,b,c,d,f,g){this.inputType=a,this.type=b,this.input=c,this.cases=d,this.outputs=f,this.otherwise=g}static parse(a,b){if(a.length<5)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!=1)return b.error("Expected an even number of arguments.");let c,d;b.expectedType&&"value"!==b.expectedType.kind&&(d=b.expectedType);const f={},g=[];for(let h=2;hNumber.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof l&&Math.floor(l)!==l)return k.error("Numeric branch labels must be integer values.");if(c){if(k.checkSubtype(c,bR(l)))return null}else c=bR(l);if(void 0!==f[String(l)])return k.error("Branch labels must be unique.");f[String(l)]=g.length}const m=b.parse(j,h,d);if(!m)return null;d=d||m.type,g.push(m)}const n=b.parse(a[1],1,by);if(!n)return null;const o=b.parse(a[a.length-1],a.length-1,d);return o?"value"!==n.type.kind&&b.concat(1).checkSubtype(c,n.type)?null:new cO(c,d,n,f,g,o):null}evaluate(a){const b=this.input.evaluate(a);return(bR(b)===this.inputType&&this.outputs[this.cases[b]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["match",this.input.serialize()],b=Object.keys(this.cases).sort(),c=[],d={};for(const f of b){const g=d[this.cases[f]];void 0===g?(d[this.cases[f]]=c.length,c.push([this.cases[f],[f]])):c[g][1].push(f)}const h=a=>"number"===this.inputType.kind?Number(a):a;for(const[i,j]of c)a.push(1===j.length?h(j[0]):j.map(h)),a.push(this.outputs[i].serialize());return a.push(this.otherwise.serialize()),a}}class cP{constructor(a,b,c){this.type=a,this.branches=b,this.otherwise=c}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return b.error("Expected an odd number of arguments.");let c;b.expectedType&&"value"!==b.expectedType.kind&&(c=b.expectedType);const d=[];for(let f=1;fb.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["case"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cQ{constructor(a,b,c,d){this.type=a,this.input=b,this.beginIndex=c,this.endIndex=d}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,bt);if(!c||!d)return null;if(!bG(c.type,[bC(by),bu,by]))return b.error(`Expected first argument to be of type array or string, but found ${bD(c.type)} instead`);if(4===a.length){const f=b.parse(a[3],3,bt);return f?new cQ(c.type,c,d,f):null}return new cQ(c.type,c,d)}evaluate(a){const b=this.input.evaluate(a),c=this.beginIndex.evaluate(a);if(!bH(b,["string","array"]))throw new bU(`Expected first argument to be of type array or string, but found ${bD(bR(b))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(a);return b.slice(c,d)}return b.slice(c)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&& void 0!==this.endIndex){const a=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),a,]}return["slice",this.input.serialize(),this.beginIndex.serialize(),]}}function cR(a,b){return"=="===a||"!="===a?"boolean"===b.kind||"string"===b.kind||"number"===b.kind||"null"===b.kind||"value"===b.kind:"string"===b.kind||"number"===b.kind||"value"===b.kind}function cS(a,b,c,d){return 0===d.compare(b,c)}function cT(a,b,c){const d="=="!==a&&"!="!==a;return class f{constructor(a,b,c){this.type=bv,this.lhs=a,this.rhs=b,this.collator=c,this.hasUntypedArgument="value"===a.type.kind||"value"===b.type.kind}static parse(a,b){if(3!==a.length&&4!==a.length)return b.error("Expected two or three arguments.");const c=a[0];let g=b.parse(a[1],1,by);if(!g)return null;if(!cR(c,g.type))return b.concat(1).error(`"${c}" comparisons are not supported for type '${bD(g.type)}'.`);let h=b.parse(a[2],2,by);if(!h)return null;if(!cR(c,h.type))return b.concat(2).error(`"${c}" comparisons are not supported for type '${bD(h.type)}'.`);if(g.type.kind!==h.type.kind&&"value"!==g.type.kind&&"value"!==h.type.kind)return b.error(`Cannot compare types '${bD(g.type)}' and '${bD(h.type)}'.`);d&&("value"===g.type.kind&&"value"!==h.type.kind?g=new bW(h.type,[g]):"value"!==g.type.kind&&"value"===h.type.kind&&(h=new bW(g.type,[h])));let i=null;if(4===a.length){if("string"!==g.type.kind&&"string"!==h.type.kind&&"value"!==g.type.kind&&"value"!==h.type.kind)return b.error("Cannot use collator to compare non-string types.");if(!(i=b.parse(a[3],3,bz)))return null}return new f(g,h,i)}evaluate(f){const g=this.lhs.evaluate(f),h=this.rhs.evaluate(f);if(d&&this.hasUntypedArgument){const i=bR(g),j=bR(h);if(i.kind!==j.kind||"string"!==i.kind&&"number"!==i.kind)throw new bU(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${i.kind}, ${j.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=bR(g),l=bR(h);if("string"!==k.kind||"string"!==l.kind)return b(f,g,h)}return this.collator?c(f,g,h,this.collator.evaluate(f)):b(f,g,h)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}serialize(){const b=[a];return this.eachChild(a=>{b.push(a.serialize())}),b}}}const cU=cT("==",function(a,b,c){return b===c},cS),cV=cT("!=",function(a,b,c){return b!==c},function(a,b,c,d){return!cS(0,b,c,d)}),cW=cT("<",function(a,b,c){return bd.compare(b,c)}),cX=cT(">",function(a,b,c){return b>c},function(a,b,c,d){return d.compare(b,c)>0}),cY=cT("<=",function(a,b,c){return b<=c},function(a,b,c,d){return 0>=d.compare(b,c)}),cZ=cT(">=",function(a,b,c){return b>=c},function(a,b,c,d){return d.compare(b,c)>=0});class c${constructor(a,b,c,d,f){this.type=bu,this.number=a,this.locale=b,this.currency=c,this.minFractionDigits=d,this.maxFractionDigits=f}static parse(a,b){if(3!==a.length)return b.error("Expected two arguments.");const c=b.parse(a[1],1,bt);if(!c)return null;const d=a[2];if("object"!=typeof d||Array.isArray(d))return b.error("NumberFormat options argument must be an object.");let f=null;if(d.locale&&!(f=b.parse(d.locale,1,bu)))return null;let g=null;if(d.currency&&!(g=b.parse(d.currency,1,bu)))return null;let h=null;if(d["min-fraction-digits"]&&!(h=b.parse(d["min-fraction-digits"],1,bt)))return null;let i=null;return!d["max-fraction-digits"]||(i=b.parse(d["max-fraction-digits"],1,bt))?new c$(c,f,g,h,i):null}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const a={};return this.locale&&(a.locale=this.locale.serialize()),this.currency&&(a.currency=this.currency.serialize()),this.minFractionDigits&&(a["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(a["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),a,]}}class c_{constructor(a){this.type=bt,this.input=a}static parse(a,b){if(2!==a.length)return b.error(`Expected 1 argument, but found ${a.length-1} instead.`);const c=b.parse(a[1],1);return c?"array"!==c.type.kind&&"string"!==c.type.kind&&"value"!==c.type.kind?b.error(`Expected argument of type string or array, but found ${bD(c.type)} instead.`):new c_(c):null}evaluate(a){const b=this.input.evaluate(a);if("string"==typeof b||Array.isArray(b))return b.length;throw new bU(`Expected value to be of type string or array, but found ${bD(bR(b))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){const a=["length"];return this.eachChild(b=>{a.push(b.serialize())}),a}}const c0={"==":cU,"!=":cV,">":cX,"<":cW,">=":cZ,"<=":cY,array:bW,at:cL,boolean:bW,case:cP,coalesce:cJ,collator:b2,format:bX,image:bY,in:cM,"index-of":cN,interpolate:cH,"interpolate-hcl":cH,"interpolate-lab":cH,length:c_,let:cK,literal:bT,match:cO,number:bW,"number-format":c$,object:bW,slice:cQ,step:cq,string:bW,"to-boolean":b$,"to-color":b$,"to-number":b$,"to-string":b$,var:cm,within:ci};function c1(a,[b,c,d,f]){b=b.evaluate(a),c=c.evaluate(a),d=d.evaluate(a);const g=f?f.evaluate(a):1,h=bP(b,c,d,g);if(h)throw new bU(h);return new bK(b/255*g,c/255*g,d/255*g,g)}function c2(a,b){const c=b[a];return void 0===c?null:c}function c3(a){return{type:a}}function c4(a){return{result:"success",value:a}}function c5(a){return{result:"error",value:a}}function c6(a){return"data-driven"===a["property-type"]||"cross-faded-data-driven"===a["property-type"]}function c7(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")> -1}function c8(a){return!!a.expression&&a.expression.interpolated}function c9(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":null===a?"null":typeof a}function da(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function db(a){return a}function dc(a,b){const c="color"===b.type,d=a.stops&&"object"==typeof a.stops[0][0],f=d||!(d|| void 0!==a.property),g=a.type||(c8(b)?"exponential":"interval");if(c&&((a=bn({},a)).stops&&(a.stops=a.stops.map(a=>[a[0],bK.parse(a[1]),])),a.default=bK.parse(a.default?a.default:b.default)),a.colorSpace&&"rgb"!==a.colorSpace&&!cG[a.colorSpace])throw Error(`Unknown color space: ${a.colorSpace}`);let h,i,j;if("exponential"===g)h=dg;else if("interval"===g)h=df;else if("categorical"===g){for(const k of(h=de,i=Object.create(null),a.stops))i[k[0]]=k[1];j=typeof a.stops[0][0]}else{if("identity"!==g)throw Error(`Unknown function type "${g}"`);h=dh}if(d){const l={},m=[];for(let n=0;na[0]),evaluate:({zoom:c},d)=>dg({stops:q,base:a.base},b,c).evaluate(c,d)}}if(f){const u="exponential"===g?{name:"exponential",base:void 0!==a.base?a.base:1}:null;return{kind:"camera",interpolationType:u,interpolationFactor:cH.interpolationFactor.bind(void 0,u),zoomStops:a.stops.map(a=>a[0]),evaluate:({zoom:c})=>h(a,b,c,i,j)}}return{kind:"source",evaluate(c,d){const f=d&&d.properties?d.properties[a.property]:void 0;return void 0===f?dd(a.default,b.default):h(a,b,f,i,j)}}}function dd(a,b,c){return void 0!==a?a:void 0!==b?b:void 0!==c?c:void 0}function de(a,b,c,d,f){return dd(typeof c===f?d[c]:void 0,a.default,b.default)}function df(a,b,c){if("number"!==c9(c))return dd(a.default,b.default);const d=a.stops.length;if(1===d||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[d-1][0])return a.stops[d-1][1];const f=cp(a.stops.map(a=>a[0]),c);return a.stops[f][1]}function dg(a,b,c){const d=void 0!==a.base?a.base:1;if("number"!==c9(c))return dd(a.default,b.default);const f=a.stops.length;if(1===f||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[f-1][0])return a.stops[f-1][1];const g=cp(a.stops.map(a=>a[0]),c),h=function(a,b,c,d){const f=d-c,g=a-c;return 0===f?0:1===b?g/f:(Math.pow(b,g)-1)/(Math.pow(b,f)-1)}(c,d,a.stops[g][0],a.stops[g+1][0]),i=a.stops[g][1],j=a.stops[g+1][1];let k=cs[b.type]||db;if(a.colorSpace&&"rgb"!==a.colorSpace){const l=cG[a.colorSpace];k=(a,b)=>l.reverse(l.interpolate(l.forward(a),l.forward(b),h))}return"function"==typeof i.evaluate?{evaluate(...a){const b=i.evaluate.apply(void 0,a),c=j.evaluate.apply(void 0,a);if(void 0!==b&& void 0!==c)return k(b,c,h)}}:k(i,j,h)}function dh(a,b,c){return"color"===b.type?c=bK.parse(c):"formatted"===b.type?c=bN.fromString(c.toString()):"resolvedImage"===b.type?c=bO.fromString(c.toString()):c9(c)===b.type||"enum"===b.type&&b.values[c]||(c=void 0),dd(c,a.default,b.default)}b1.register(c0,{error:[{kind:"error"},[bu],(a,[b])=>{throw new bU(b.evaluate(a))},],typeof:[bu,[by],(a,[b])=>bD(bR(b.evaluate(a))),],"to-rgba":[bC(bt,4),[bw],(a,[b])=>b.evaluate(a).toArray(),],rgb:[bw,[bt,bt,bt],c1],rgba:[bw,[bt,bt,bt,bt],c1],has:{type:bv,overloads:[[[bu],(a,[b])=>{var c,d;return c=b.evaluate(a),d=a.properties(),c in d},],[[bu,bx],(a,[b,c])=>b.evaluate(a) in c.evaluate(a),],]},get:{type:by,overloads:[[[bu],(a,[b])=>c2(b.evaluate(a),a.properties()),],[[bu,bx],(a,[b,c])=>c2(b.evaluate(a),c.evaluate(a)),],]},"feature-state":[by,[bu],(a,[b])=>c2(b.evaluate(a),a.featureState||{}),],properties:[bx,[],a=>a.properties()],"geometry-type":[bu,[],a=>a.geometryType()],id:[by,[],a=>a.id()],zoom:[bt,[],a=>a.globals.zoom],pitch:[bt,[],a=>a.globals.pitch||0],"distance-from-center":[bt,[],a=>a.distanceFromCenter(),],"heatmap-density":[bt,[],a=>a.globals.heatmapDensity||0,],"line-progress":[bt,[],a=>a.globals.lineProgress||0,],"sky-radial-progress":[bt,[],a=>a.globals.skyRadialProgress||0,],accumulated:[by,[],a=>void 0===a.globals.accumulated?null:a.globals.accumulated,],"+":[bt,c3(bt),(a,b)=>{let c=0;for(const d of b)c+=d.evaluate(a);return c},],"*":[bt,c3(bt),(a,b)=>{let c=1;for(const d of b)c*=d.evaluate(a);return c},],"-":{type:bt,overloads:[[[bt,bt],(a,[b,c])=>b.evaluate(a)-c.evaluate(a),],[[bt],(a,[b])=>-b.evaluate(a)],]},"/":[bt,[bt,bt],(a,[b,c])=>b.evaluate(a)/c.evaluate(a),],"%":[bt,[bt,bt],(a,[b,c])=>b.evaluate(a)%c.evaluate(a),],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(a,[b,c])=>Math.pow(b.evaluate(a),c.evaluate(a)),],sqrt:[bt,[bt],(a,[b])=>Math.sqrt(b.evaluate(a)),],log10:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))/Math.LN10,],ln:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))],log2:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))/Math.LN2,],sin:[bt,[bt],(a,[b])=>Math.sin(b.evaluate(a)),],cos:[bt,[bt],(a,[b])=>Math.cos(b.evaluate(a)),],tan:[bt,[bt],(a,[b])=>Math.tan(b.evaluate(a)),],asin:[bt,[bt],(a,[b])=>Math.asin(b.evaluate(a)),],acos:[bt,[bt],(a,[b])=>Math.acos(b.evaluate(a)),],atan:[bt,[bt],(a,[b])=>Math.atan(b.evaluate(a)),],min:[bt,c3(bt),(a,b)=>Math.min(...b.map(b=>b.evaluate(a))),],max:[bt,c3(bt),(a,b)=>Math.max(...b.map(b=>b.evaluate(a))),],abs:[bt,[bt],(a,[b])=>Math.abs(b.evaluate(a)),],round:[bt,[bt],(a,[b])=>{const c=b.evaluate(a);return c<0?-Math.round(-c):Math.round(c)},],floor:[bt,[bt],(a,[b])=>Math.floor(b.evaluate(a)),],ceil:[bt,[bt],(a,[b])=>Math.ceil(b.evaluate(a)),],"filter-==":[bv,[bu,by],(a,[b,c])=>a.properties()[b.value]===c.value,],"filter-id-==":[bv,[by],(a,[b])=>a.id()===b.value,],"filter-type-==":[bv,[bu],(a,[b])=>a.geometryType()===b.value,],"filter-<":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d{const c=a.id(),d=b.value;return typeof c==typeof d&&c":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d>f},],"filter-id->":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c>d},],"filter-<=":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d<=f},],"filter-id-<=":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c<=d},],"filter->=":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d>=f},],"filter-id->=":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c>=d},],"filter-has":[bv,[by],(a,[b])=>b.value in a.properties(),],"filter-has-id":[bv,[],a=>null!==a.id()&& void 0!==a.id(),],"filter-type-in":[bv,[bC(bu)],(a,[b])=>b.value.indexOf(a.geometryType())>=0,],"filter-id-in":[bv,[bC(by)],(a,[b])=>b.value.indexOf(a.id())>=0,],"filter-in-small":[bv,[bu,bC(by)],(a,[b,c])=>c.value.indexOf(a.properties()[b.value])>=0,],"filter-in-large":[bv,[bu,bC(by)],(a,[b,c])=>(function(a,b,c,d){for(;c<=d;){const f=c+d>>1;if(b[f]===a)return!0;b[f]>a?d=f-1:c=f+1}return!1})(a.properties()[b.value],c.value,0,c.value.length-1),],all:{type:bv,overloads:[[[bv,bv],(a,[b,c])=>b.evaluate(a)&&c.evaluate(a),],[c3(bv),(a,b)=>{for(const c of b)if(!c.evaluate(a))return!1;return!0},],]},any:{type:bv,overloads:[[[bv,bv],(a,[b,c])=>b.evaluate(a)||c.evaluate(a),],[c3(bv),(a,b)=>{for(const c of b)if(c.evaluate(a))return!0;return!1},],]},"!":[bv,[bv],(a,[b])=>!b.evaluate(a)],"is-supported-script":[bv,[bu],(a,[b])=>{const c=a.globals&&a.globals.isSupportedScript;return!c||c(b.evaluate(a))},],upcase:[bu,[bu],(a,[b])=>b.evaluate(a).toUpperCase(),],downcase:[bu,[bu],(a,[b])=>b.evaluate(a).toLowerCase(),],concat:[bu,c3(by),(a,b)=>b.map(b=>bS(b.evaluate(a))).join(""),],"resolved-locale":[bu,[bz],(a,[b])=>b.evaluate(a).resolvedLocale(),]});class di{constructor(a,b){var c;this.expression=a,this._warningHistory={},this._evaluator=new b0,this._defaultValue=b?"color"===(c=b).type&&da(c.default)?new bK(0,0,0,0):"color"===c.type?bK.parse(c.default)||null:void 0===c.default?null:c.default:null,this._enumValues=b&&"enum"===b.type?b.values:null}evaluateWithoutErrorHandling(a,b,c,d,f,g,h,i){return this._evaluator.globals=a,this._evaluator.feature=b,this._evaluator.featureState=c,this._evaluator.canonical=d,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=g,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=i||null,this.expression.evaluate(this._evaluator)}evaluate(a,b,c,d,f,g,h,i){this._evaluator.globals=a,this._evaluator.feature=b||null,this._evaluator.featureState=c||null,this._evaluator.canonical=d,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=g||null,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=i||null;try{const j=this.expression.evaluate(this._evaluator);if(null==j||"number"==typeof j&&j!=j)return this._defaultValue;if(this._enumValues&&!(j in this._enumValues))throw new bU(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(j)} instead.`);return j}catch(k){return this._warningHistory[k.message]||(this._warningHistory[k.message]=!0,"undefined"!=typeof console&&console.warn(k.message)),this._defaultValue}}}function dj(a){return Array.isArray(a)&&a.length>0&&"string"==typeof a[0]&&a[0]in c0}function dk(a,b){const c=new cn(c0,[],b?function(a){const b={color:bw,string:bu,number:bt,enum:bu,boolean:bv,formatted:bA,resolvedImage:bB};return"array"===a.type?bC(b[a.value]||by,a.length):b[a.type]}(b):void 0),d=c.parse(a,void 0,void 0,void 0,b&&"string"===b.type?{typeAnnotation:"coerce"}:void 0);return d?c4(new di(d,b)):c5(c.errors)}class dl{constructor(a,b){this.kind=a,this._styleExpression=b,this.isStateDependent="constant"!==a&&!ck(b.expression)}evaluateWithoutErrorHandling(a,b,c,d,f,g){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,f,g)}evaluate(a,b,c,d,f,g){return this._styleExpression.evaluate(a,b,c,d,f,g)}}class dm{constructor(a,b,c,d){this.kind=a,this.zoomStops=c,this._styleExpression=b,this.isStateDependent="camera"!==a&&!ck(b.expression),this.interpolationType=d}evaluateWithoutErrorHandling(a,b,c,d,f,g){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,f,g)}evaluate(a,b,c,d,f,g){return this._styleExpression.evaluate(a,b,c,d,f,g)}interpolationFactor(a,b,c){return this.interpolationType?cH.interpolationFactor(this.interpolationType,a,b,c):0}}function dn(a,b){if("error"===(a=dk(a,b)).result)return a;const c=a.value.expression,d=cj(c);if(!d&&!c6(b))return c5([new bq("","data expressions not supported"),]);const f=cl(c,["zoom","pitch","distance-from-center",]);if(!f&&!c7(b))return c5([new bq("","zoom expressions not supported"),]);const g=dq(c);return g||f?g instanceof bq?c5([g]):g instanceof cH&&!c8(b)?c5([new bq("",'"interpolate" expressions cannot be used with this property'),]):c4(g?new dm(d?"camera":"composite",a.value,g.labels,g instanceof cH?g.interpolation:void 0):new dl(d?"constant":"source",a.value)):c5([new bq("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'),])}class dp{constructor(a,b){this._parameters=a,this._specification=b,bn(this,dc(this._parameters,this._specification))}static deserialize(a){return new dp(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function dq(a){let b=null;if(a instanceof cK)b=dq(a.result);else if(a instanceof cJ){for(const c of a.args)if(b=dq(c))break}else(a instanceof cq||a instanceof cH)&&a.input instanceof b1&&"zoom"===a.input.name&&(b=a);return b instanceof bq||a.eachChild(a=>{const c=dq(a);c instanceof bq?b=c:!b&&c?b=new bq("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):b&&c&&b!==c&&(b=new bq("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),b}function dr(a){const b=a.key,c=a.value,d=a.valueSpec||{},f=a.objectElementValidators||{},g=a.style,h=a.styleSpec;let i=[];const j=c9(c);if("object"!==j)return[new bl(b,c,`object expected, ${j} found`),];for(const k in c){const l=k.split(".")[0],m=d[l]||d["*"];let n;if(f[l])n=f[l];else if(d[l])n=dY;else if(f["*"])n=f["*"];else{if(!d["*"]){i.push(new bl(b,c[k],`unknown property "${k}"`));continue}n=dY}i=i.concat(n({key:(b?`${b}.`:b)+k,value:c[k],valueSpec:m,style:g,styleSpec:h,object:c,objectKey:k},c))}for(const o in d)f[o]||d[o].required&& void 0===d[o].default&& void 0===c[o]&&i.push(new bl(b,c,`missing required property "${o}"`));return i}function ds(a){const b=a.value,c=a.valueSpec,d=a.style,f=a.styleSpec,g=a.key,h=a.arrayElementValidator||dY;if("array"!==c9(b))return[new bl(g,b,`array expected, ${c9(b)} found`),];if(c.length&&b.length!==c.length)return[new bl(g,b,`array length ${c.length} expected, length ${b.length} found`),];if(c["min-length"]&&b.lengthh)return[new bl(b,c,`${c} is greater than the maximum value ${h}`),]}return[]}function du(a){const b=a.valueSpec,c=bo(a.value.type);let d,f,g,h={};const i="categorical"!==c&& void 0===a.value.property,j="array"===c9(a.value.stops)&&"array"===c9(a.value.stops[0])&&"object"===c9(a.value.stops[0][0]),k=dr({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(a){if("identity"===c)return[new bl(a.key,a.value,'identity function may not have a "stops" property'),];let b=[];const d=a.value;return b=b.concat(ds({key:a.key,value:d,valueSpec:a.valueSpec,style:a.style,styleSpec:a.styleSpec,arrayElementValidator:l})),"array"===c9(d)&&0===d.length&&b.push(new bl(a.key,d,"array must have at least one stop")),b},default:function(a){return dY({key:a.key,value:a.value,valueSpec:b,style:a.style,styleSpec:a.styleSpec})}}});return"identity"===c&&i&&k.push(new bl(a.key,a.value,'missing required property "property"')),"identity"===c||a.value.stops||k.push(new bl(a.key,a.value,'missing required property "stops"')),"exponential"===c&&a.valueSpec.expression&&!c8(a.valueSpec)&&k.push(new bl(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(i||c6(a.valueSpec)?i&&!c7(a.valueSpec)&&k.push(new bl(a.key,a.value,"zoom functions not supported")):k.push(new bl(a.key,a.value,"property functions not supported"))),("categorical"===c||j)&& void 0===a.value.property&&k.push(new bl(a.key,a.value,'"property" property is required')),k;function l(a){let c=[];const d=a.value,i=a.key;if("array"!==c9(d))return[new bl(i,d,`array expected, ${c9(d)} found`),];if(2!==d.length)return[new bl(i,d,`array length 2 expected, length ${d.length} found`),];if(j){if("object"!==c9(d[0]))return[new bl(i,d,`object expected, ${c9(d[0])} found`),];if(void 0===d[0].zoom)return[new bl(i,d,"object stop key must have zoom"),];if(void 0===d[0].value)return[new bl(i,d,"object stop key must have value"),];if(g&&g>bo(d[0].zoom))return[new bl(i,d[0].zoom,"stop zoom values must appear in ascending order"),];bo(d[0].zoom)!==g&&(g=bo(d[0].zoom),f=void 0,h={}),c=c.concat(dr({key:`${i}[0]`,value:d[0],valueSpec:{zoom:{}},style:a.style,styleSpec:a.styleSpec,objectElementValidators:{zoom:dt,value:m}}))}else c=c.concat(m({key:`${i}[0]`,value:d[0],valueSpec:{},style:a.style,styleSpec:a.styleSpec},d));return dj(bp(d[1]))?c.concat([new bl(`${i}[1]`,d[1],"expressions are not allowed in function stops."),]):c.concat(dY({key:`${i}[1]`,value:d[1],valueSpec:b,style:a.style,styleSpec:a.styleSpec}))}function m(a,g){const i=c9(a.value),j=bo(a.value),k=null!==a.value?a.value:g;if(d){if(i!==d)return[new bl(a.key,k,`${i} stop domain type must match previous stop domain type ${d}`),]}else d=i;if("number"!==i&&"string"!==i&&"boolean"!==i)return[new bl(a.key,k,"stop domain value must be a number, string, or boolean"),];if("number"!==i&&"categorical"!==c){let l=`number expected, ${i} found`;return c6(b)&& void 0===c&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new bl(a.key,k,l)]}return"categorical"!==c||"number"!==i||isFinite(j)&&Math.floor(j)===j?"categorical"!==c&&"number"===i&& void 0!==f&&jnew bl(`${a.key}${b.key}`,a.value,b.message));const c=b.value.expression||b.value._styleExpression.expression;if("property"===a.expressionContext&&"text-font"===a.propertyKey&&!c.outputDefined())return[new bl(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`),];if("property"===a.expressionContext&&"layout"===a.propertyType&&!ck(c))return[new bl(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.'),];if("filter"===a.expressionContext)return dw(c,a);if(a.expressionContext&&0===a.expressionContext.indexOf("cluster")){if(!cl(c,["zoom","feature-state"]))return[new bl(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.'),];if("cluster-initial"===a.expressionContext&&!cj(c))return[new bl(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties."),]}return[]}function dw(a,b){const c=new Set(["zoom","feature-state","pitch","distance-from-center",]);for(const d of b.valueSpec.expression.parameters)c.delete(d);if(0===c.size)return[];const f=[];return a instanceof b1&&c.has(a.name)?[new bl(b.key,b.value,`["${a.name}"] expression is not supported in a filter for a ${b.object.type} layer with id: ${b.object.id}`),]:(a.eachChild(a=>{f.push(...dw(a,b))}),f)}function dx(a){const b=a.key,c=a.value,d=a.valueSpec,f=[];return Array.isArray(d.values)?-1===d.values.indexOf(bo(c))&&f.push(new bl(b,c,`expected one of [${d.values.join(", ")}], ${JSON.stringify(c)} found`)):-1===Object.keys(d.values).indexOf(bo(c))&&f.push(new bl(b,c,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(c)} found`)),f}function dy(a){if(!0===a|| !1===a)return!0;if(!Array.isArray(a)||0===a.length)return!1;switch(a[0]){case"has":return a.length>=2&&"$id"!==a[1]&&"$type"!==a[1];case"in":return a.length>=3&&("string"!=typeof a[1]||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==a.length||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const b of a.slice(1))if(!dy(b)&&"boolean"!=typeof b)return!1;return!0;default:return!0}}function dz(a,b="fill"){if(null==a)return{filter:()=>!0,needGeometry:!1,needFeature:!1};dy(a)||(a=dG(a));const c=a;let d=!0;try{d=function(a){if(!dC(a))return a;let b=bp(a);return dB(b),b=dA(b)}(c)}catch(f){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[634],{6158:function(a,b,c){var d=c(3454);!function(b,c){a.exports=c()}(this,function(){"use strict";var a,b,c;function f(d,f){if(a){if(b){var g="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 = {}; ("+a+")(sharedChunk); ("+b+")(sharedChunk); self.onerror = null;",h={};a(h),c=f(h),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(c.workerUrl=window.URL.createObjectURL(new Blob([g],{type:"text/javascript"})))}else b=f}else a=f}return f(["exports"],function(a){var b="2.7.0",c=f;function f(a,b,c,d){this.cx=3*a,this.bx=3*(c-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*b,this.by=3*(d-b)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=d,this.p2x=c,this.p2y=d}f.prototype.sampleCurveX=function(a){return((this.ax*a+this.bx)*a+this.cx)*a},f.prototype.sampleCurveY=function(a){return((this.ay*a+this.by)*a+this.cy)*a},f.prototype.sampleCurveDerivativeX=function(a){return(3*this.ax*a+2*this.bx)*a+this.cx},f.prototype.solveCurveX=function(a,b){var c,d,f,g,h;for(void 0===b&&(b=1e-6),f=a,h=0;h<8;h++){if(Math.abs(g=this.sampleCurveX(f)-a)Math.abs(i))break;f-=g/i}if((f=a)<(c=0))return c;if(f>(d=1))return d;for(;cg?c=f:d=f,f=.5*(d-c)+c;return f},f.prototype.solve=function(a,b){return this.sampleCurveY(this.solveCurveX(a,b))};var g=h;function h(a,b){this.x=a,this.y=b}h.prototype={clone:function(){return new h(this.x,this.y)},add:function(a){return this.clone()._add(a)},sub:function(a){return this.clone()._sub(a)},multByPoint:function(a){return this.clone()._multByPoint(a)},divByPoint:function(a){return this.clone()._divByPoint(a)},mult:function(a){return this.clone()._mult(a)},div:function(a){return this.clone()._div(a)},rotate:function(a){return this.clone()._rotate(a)},rotateAround:function(a,b){return this.clone()._rotateAround(a,b)},matMult:function(a){return this.clone()._matMult(a)},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(a){return this.x===a.x&&this.y===a.y},dist:function(a){return Math.sqrt(this.distSqr(a))},distSqr:function(a){var b=a.x-this.x,c=a.y-this.y;return b*b+c*c},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(a){return Math.atan2(this.y-a.y,this.x-a.x)},angleWith:function(a){return this.angleWithSep(a.x,a.y)},angleWithSep:function(a,b){return Math.atan2(this.x*b-this.y*a,this.x*a+this.y*b)},_matMult:function(a){var b=a[2]*this.x+a[3]*this.y;return this.x=a[0]*this.x+a[1]*this.y,this.y=b,this},_add:function(a){return this.x+=a.x,this.y+=a.y,this},_sub:function(a){return this.x-=a.x,this.y-=a.y,this},_mult:function(a){return this.x*=a,this.y*=a,this},_div:function(a){return this.x/=a,this.y/=a,this},_multByPoint:function(a){return this.x*=a.x,this.y*=a.y,this},_divByPoint:function(a){return this.x/=a.x,this.y/=a.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var a=this.y;return this.y=this.x,this.x=-a,this},_rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=c*this.x+b*this.y;return this.x=b*this.x-c*this.y,this.y=d,this},_rotateAround:function(a,b){var c=Math.cos(a),d=Math.sin(a),f=b.y+d*(this.x-b.x)+c*(this.y-b.y);return this.x=b.x+c*(this.x-b.x)-d*(this.y-b.y),this.y=f,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},h.convert=function(a){return a instanceof h?a:Array.isArray(a)?new h(a[0],a[1]):a};var i="undefined"!=typeof self?self:{},j="undefined"!=typeof Float32Array?Float32Array:Array;function k(){var a=new j(9);return j!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[5]=0,a[6]=0,a[7]=0),a[0]=1,a[4]=1,a[8]=1,a}function l(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a}function m(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=b[9],o=b[10],p=b[11],q=b[12],r=b[13],s=b[14],u=b[15],v=c[0],w=c[1],x=c[2],y=c[3];return a[0]=v*d+w*i+x*m+y*q,a[1]=v*f+w*j+x*n+y*r,a[2]=v*g+w*k+x*o+y*s,a[3]=v*h+w*l+x*p+y*u,a[4]=(v=c[4])*d+(w=c[5])*i+(x=c[6])*m+(y=c[7])*q,a[5]=v*f+w*j+x*n+y*r,a[6]=v*g+w*k+x*o+y*s,a[7]=v*h+w*l+x*p+y*u,a[8]=(v=c[8])*d+(w=c[9])*i+(x=c[10])*m+(y=c[11])*q,a[9]=v*f+w*j+x*n+y*r,a[10]=v*g+w*k+x*o+y*s,a[11]=v*h+w*l+x*p+y*u,a[12]=(v=c[12])*d+(w=c[13])*i+(x=c[14])*m+(y=c[15])*q,a[13]=v*f+w*j+x*n+y*r,a[14]=v*g+w*k+x*o+y*s,a[15]=v*h+w*l+x*p+y*u,a}function n(a,b,c){var d,f,g,h,i,j,k,l,m,n,o,p,q=c[0],r=c[1],s=c[2];return b===a?(a[12]=b[0]*q+b[4]*r+b[8]*s+b[12],a[13]=b[1]*q+b[5]*r+b[9]*s+b[13],a[14]=b[2]*q+b[6]*r+b[10]*s+b[14],a[15]=b[3]*q+b[7]*r+b[11]*s+b[15]):(f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=b[9],o=b[10],p=b[11],a[0]=d=b[0],a[1]=f,a[2]=g,a[3]=h,a[4]=i,a[5]=j,a[6]=k,a[7]=l,a[8]=m,a[9]=n,a[10]=o,a[11]=p,a[12]=d*q+i*r+m*s+b[12],a[13]=f*q+j*r+n*s+b[13],a[14]=g*q+k*r+o*s+b[14],a[15]=h*q+l*r+p*s+b[15]),a}function o(a,b,c){var d=c[0],f=c[1],g=c[2];return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a[4]=b[4]*f,a[5]=b[5]*f,a[6]=b[6]*f,a[7]=b[7]*f,a[8]=b[8]*g,a[9]=b[9]*g,a[10]=b[10]*g,a[11]=b[11]*g,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function p(a,b,c){var d=Math.sin(c),f=Math.cos(c),g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],n=b[11];return b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=g*f+k*d,a[5]=h*f+l*d,a[6]=i*f+m*d,a[7]=j*f+n*d,a[8]=k*f-g*d,a[9]=l*f-h*d,a[10]=m*f-i*d,a[11]=n*f-j*d,a}function q(a,b,c){var d=Math.sin(c),f=Math.cos(c),g=b[0],h=b[1],i=b[2],j=b[3],k=b[8],l=b[9],m=b[10],n=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=g*f-k*d,a[1]=h*f-l*d,a[2]=i*f-m*d,a[3]=j*f-n*d,a[8]=g*d+k*f,a[9]=h*d+l*f,a[10]=i*d+m*f,a[11]=j*d+n*f,a}Math.hypot||(Math.hypot=function(){for(var a=0,b=arguments.length;b--;)a+=arguments[b]*arguments[b];return Math.sqrt(a)});var r=m;function s(){var a=new j(3);return j!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a}function u(a){var b=new j(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b}function v(a){return Math.hypot(a[0],a[1],a[2])}function w(a,b,c){var d=new j(3);return d[0]=a,d[1]=b,d[2]=c,d}function x(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a}function y(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a}function z(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a}function A(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a}function B(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a}function C(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a}function D(a,b){var c=b[0],d=b[1],f=b[2],g=c*c+d*d+f*f;return g>0&&(g=1/Math.sqrt(g)),a[0]=b[0]*g,a[1]=b[1]*g,a[2]=b[2]*g,a}function E(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function F(a,b,c){var d=b[0],f=b[1],g=b[2],h=c[0],i=c[1],j=c[2];return a[0]=f*j-g*i,a[1]=g*h-d*j,a[2]=d*i-f*h,a}function G(a,b,c){var d=b[0],f=b[1],g=b[2],h=c[3]*d+c[7]*f+c[11]*g+c[15];return a[0]=(c[0]*d+c[4]*f+c[8]*g+c[12])/(h=h||1),a[1]=(c[1]*d+c[5]*f+c[9]*g+c[13])/h,a[2]=(c[2]*d+c[6]*f+c[10]*g+c[14])/h,a}function H(a,b,c){var d=c[0],f=c[1],g=c[2],h=b[0],i=b[1],j=b[2],k=f*j-g*i,l=g*h-d*j,m=d*i-f*h,n=f*m-g*l,o=g*k-d*m,p=d*l-f*k,q=2*c[3];return l*=q,m*=q,o*=2,p*=2,a[0]=h+(k*=q)+(n*=2),a[1]=i+l+o,a[2]=j+m+p,a}var I,J=y;function K(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3];return a[0]=c[0]*d+c[4]*f+c[8]*g+c[12]*h,a[1]=c[1]*d+c[5]*f+c[9]*g+c[13]*h,a[2]=c[2]*d+c[6]*f+c[10]*g+c[14]*h,a[3]=c[3]*d+c[7]*f+c[11]*g+c[15]*h,a}function L(){var a=new j(4);return j!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0),a[3]=1,a}function M(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a}function N(a,b,c){c*=.5;var d=b[0],f=b[1],g=b[2],h=b[3],i=Math.sin(c),j=Math.cos(c);return a[0]=d*j+h*i,a[1]=f*j+g*i,a[2]=g*j-f*i,a[3]=h*j-d*i,a}function O(a,b){return a[0]===b[0]&&a[1]===b[1]}s(),I=new j(4),j!=Float32Array&&(I[0]=0,I[1]=0,I[2]=0,I[3]=0),s(),w(1,0,0),w(0,1,0),L(),L(),k(),ln=new j(2),j!=Float32Array&&(ln[0]=0,ln[1]=0);const P=Math.PI/180,Q=180/Math.PI;function R(a){return a*P}function S(a){return a*Q}const T=[[0,0],[1,0],[1,1],[0,1],];function U(a){if(a<=0)return 0;if(a>=1)return 1;const b=a*a,c=b*a;return 4*(a<.5?c:3*(a-b)+c-.75)}function V(a,b,d,f){const g=new c(a,b,d,f);return function(a){return g.solve(a)}}const W=V(.25,.1,.25,1);function X(a,b,c){return Math.min(c,Math.max(b,a))}function Y(a,b,c){return(c=X((c-a)/(b-a),0,1))*c*(3-2*c)}function Z(a,b,c){const d=c-b,f=((a-b)%d+d)%d+b;return f===b?c:f}function $(a,b,c){if(!a.length)return c(null,[]);let d=a.length;const f=Array(a.length);let g=null;a.forEach((a,h)=>{b(a,(a,b)=>{a&&(g=a),f[h]=b,0== --d&&c(g,f)})})}function _(a){const b=[];for(const c in a)b.push(a[c]);return b}function aa(a,...b){for(const c of b)for(const d in c)a[d]=c[d];return a}let ab=1;function ac(){return ab++}function ad(){return function a(b){return b?(b^16*Math.random()>>b/4).toString(16):([1e7]+ -[1e3]+ -4e3+ -8e3+ -1e11).replace(/[018]/g,a)}()}function ae(a){return a<=1?1:Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))}function af(a){return!!a&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(a)}function ag(a,b){a.forEach(a=>{b[a]&&(b[a]=b[a].bind(b))})}function ah(a,b){return -1!==a.indexOf(b,a.length-b.length)}function ai(a,b,c){const d={};for(const f in a)d[f]=b.call(c||this,a[f],f,a);return d}function aj(a,b,c){const d={};for(const f in a)b.call(c||this,a[f],f,a)&&(d[f]=a[f]);return d}function ak(a){return Array.isArray(a)?a.map(ak):"object"==typeof a&&a?ai(a,ak):a}const al={};function am(a){al[a]||("undefined"!=typeof console&&console.warn(a),al[a]=!0)}function an(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)}function ao(a){let b=0;for(let c,d,f=0,g=a.length,h=g-1;f@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,c,d,f)=>{const g=d||f;return b[c]=!g||g.toLowerCase(),""}),b["max-age"]){const c=parseInt(b["max-age"],10);isNaN(c)?delete b["max-age"]:b["max-age"]=c}return b}let ar,as,at,au=null;function av(a){if(null==au){const b=a.navigator?a.navigator.userAgent:null;au=!!a.safari||!(!b||!(/\b(iPad|iPhone|iPod)\b/.test(b)||b.match("Safari")&&!b.match("Chrome")))}return au}function aw(a){try{const b=i[a];return b.setItem("_mapbox_test_",1),b.removeItem("_mapbox_test_"),!0}catch(c){return!1}}const ax={now:()=>void 0!==at?at:i.performance.now(),setNow(a){at=a},restoreNow(){at=void 0},frame(a){const b=i.requestAnimationFrame(a);return{cancel:()=>i.cancelAnimationFrame(b)}},getImageData(a,b=0){const c=i.document.createElement("canvas"),d=c.getContext("2d");if(!d)throw Error("failed to create canvas 2d context");return c.width=a.width,c.height=a.height,d.drawImage(a,0,0,a.width,a.height),d.getImageData(-b,-b,a.width+2*b,a.height+2*b)},resolveURL:a=>(ar||(ar=i.document.createElement("a")),ar.href=a,ar.href),get devicePixelRatio(){return i.devicePixelRatio},get prefersReducedMotion(){return!!i.matchMedia&&(null==as&&(as=i.matchMedia("(prefers-reduced-motion: reduce)")),as.matches)}};let ay;const az={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==ay){const aA=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{ay=null!=d.env.API_URL_REGEX?RegExp(d.env.API_URL_REGEX):aA}catch(aB){ay=aA}}return ay},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},aC={supported:!1,testSupport:function(a){!aF&&aE&&(aG?aH(a):aD=a)}};let aD,aE,aF=!1,aG=!1;function aH(a){const b=a.createTexture();a.bindTexture(a.TEXTURE_2D,b);try{if(a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,aE),a.isContextLost())return;aC.supported=!0}catch(c){}a.deleteTexture(b),aF=!0}i.document&&((aE=i.document.createElement("img")).onload=function(){aD&&aH(aD),aD=null,aG=!0},aE.onerror=function(){aF=!0,aD=null},aE.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const aI="NO_ACCESS_TOKEN";function aJ(a){return 0===a.indexOf("mapbox:")}function aK(a){return az.API_URL_REGEX.test(a)}const aL=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function aM(a){const b=a.match(aL);if(!b)throw Error("Unable to parse URL object");return{protocol:b[1],authority:b[2],path:b[3]||"/",params:b[4]?b[4].split("&"):[]}}function aN(a){const b=a.params.length?`?${a.params.join("&")}`:"";return`${a.protocol}://${a.authority}${a.path}${b}`}function aO(a){if(!a)return null;const b=a.split(".");if(!b||3!==b.length)return null;try{return JSON.parse(decodeURIComponent(i.atob(b[1]).split("").map(a=>"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(c){return null}}class aP{constructor(a){this.type=a,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(a){const b=aO(az.ACCESS_TOKEN);let c="";return c=b&&b.u?i.btoa(encodeURIComponent(b.u).replace(/%([0-9A-F]{2})/g,(a,b)=>String.fromCharCode(Number("0x"+b)))):az.ACCESS_TOKEN||"",a?`mapbox.eventData.${a}:${c}`:`mapbox.eventData:${c}`}fetchEventData(){const a=aw("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{const d=i.localStorage.getItem(b);d&&(this.eventData=JSON.parse(d));const f=i.localStorage.getItem(c);f&&(this.anonId=f)}catch(g){am("Unable to read from LocalStorage")}}saveEventData(){const a=aw("localStorage"),b=this.getStorageKey(),c=this.getStorageKey("uuid");if(a)try{i.localStorage.setItem(c,this.anonId),Object.keys(this.eventData).length>=1&&i.localStorage.setItem(b,JSON.stringify(this.eventData))}catch(d){am("Unable to write to LocalStorage")}}processRequests(a){}postEvent(a,c,d,f){if(!az.EVENTS_URL)return;const g=aM(az.EVENTS_URL);g.params.push(`access_token=${f||az.ACCESS_TOKEN||""}`);const h={event:this.type,created:new Date(a).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:b,skuId:"01",userId:this.anonId},i=c?aa(h,c):h,j={url:aN(g),headers:{"Content-Type":"text/plain"},body:JSON.stringify([i])};this.pendingRequest=a8(j,a=>{this.pendingRequest=null,d(a),this.saveEventData(),this.processRequests(f)})}queueRequest(a,b){this.queue.push(a),this.processRequests(b)}}const aQ=new class extends aP{constructor(a){super("appUserTurnstile"),this._customAccessToken=a}postTurnstileEvent(a,b){az.EVENTS_URL&&az.ACCESS_TOKEN&&Array.isArray(a)&&a.some(a=>aJ(a)||aK(a))&&this.queueRequest(Date.now(),b)}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const b=aO(az.ACCESS_TOKEN),c=b?b.u:az.ACCESS_TOKEN;let d=c!==this.eventData.tokenU;af(this.anonId)||(this.anonId=ad(),d=!0);const f=this.queue.shift();if(this.eventData.lastSuccess){const g=new Date(this.eventData.lastSuccess),h=new Date(f),i=(f-this.eventData.lastSuccess)/864e5;d=d||i>=1||i< -1||g.getDate()!==h.getDate()}else d=!0;if(!d)return this.processRequests();this.postEvent(f,{"enabled.telemetry":!1},a=>{a||(this.eventData.lastSuccess=f,this.eventData.tokenU=c)},a)}},aR=aQ.postTurnstileEvent.bind(aQ),aS=new class extends aP{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(a,b,c,d){this.skuToken=b,this.errorCb=d,az.EVENTS_URL&&(c||az.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},c):this.errorCb(Error(aI)))}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;const{id:b,timestamp:c}=this.queue.shift();b&&this.success[b]||(this.anonId||this.fetchEventData(),af(this.anonId)||(this.anonId=ad()),this.postEvent(c,{skuToken:this.skuToken},a=>{a?this.errorCb(a):b&&(this.success[b]=!0)},a))}},aT=aS.postMapLoadEvent.bind(aS),aU=new class extends aP{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(a,b,c,d){if(!az.API_URL||!az.SESSION_PATH)return;const f=aM(az.API_URL+az.SESSION_PATH);f.params.push(`sku=${b||""}`),f.params.push(`access_token=${d||az.ACCESS_TOKEN||""}`);const g={url:aN(f),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a9(g,a=>{this.pendingRequest=null,c(a),this.saveEventData(),this.processRequests(d)})}getSessionAPI(a,b,c,d){this.skuToken=b,this.errorCb=d,az.SESSION_PATH&&az.API_URL&&(c||az.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},c):this.errorCb(Error(aI)))}processRequests(a){if(this.pendingRequest||0===this.queue.length)return;const{id:b,timestamp:c}=this.queue.shift();b&&this.success[b]||this.getSession(c,this.skuToken,a=>{a?this.errorCb(a):b&&(this.success[b]=!0)},a)}},aV=aU.getSessionAPI.bind(aU),aW=new Set,aX="mapbox-tiles";let aY,aZ,a$=500,a_=50;function a0(){i.caches&&!aY&&(aY=i.caches.open(aX))}function a1(a){const b=a.indexOf("?");return b<0?a:a.slice(0,b)}let a2=1/0;const a3={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(a3);class a4 extends Error{constructor(a,b,c){401===b&&aK(c)&&(a+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),super(a),this.status=b,this.url=c}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const a5=ap()?()=>self.worker&&self.worker.referrer:()=>("blob:"===i.location.protocol?i.parent:i).location.href,a6=function(a,b){var c;if(!(/^file:/.test(c=a.url)||/^file:/.test(a5())&&!/^\w+:/.test(c))){if(i.fetch&&i.Request&&i.AbortController&&i.Request.prototype.hasOwnProperty("signal"))return function(a,b){var c;const d=new i.AbortController,f=new i.Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,referrer:a5(),signal:d.signal});let g=!1,h=!1;const j=(c=f.url).indexOf("sku=")>0&&aK(c);"json"===a.type&&f.headers.set("Accept","application/json");const k=(c,d,g)=>{if(h)return;if(c&&"SecurityError"!==c.message&&am(c),d&&g)return l(d);const k=Date.now();i.fetch(f).then(c=>{if(c.ok){const d=j?c.clone():null;return l(c,d,k)}return b(new a4(c.statusText,c.status,a.url))}).catch(a=>{20!==a.code&&b(Error(a.message))})},l=(c,d,j)=>{("arrayBuffer"===a.type?c.arrayBuffer():"json"===a.type?c.json():c.text()).then(a=>{h||(d&&j&&function(a,b,c){if(a0(),!aY)return;const d={status:b.status,statusText:b.statusText,headers:new i.Headers};b.headers.forEach((a,b)=>d.headers.set(b,a));const f=aq(b.headers.get("Cache-Control")||"");f["no-store"]||(f["max-age"]&&d.headers.set("Expires",new Date(c+1e3*f["max-age"]).toUTCString()),new Date(d.headers.get("Expires")).getTime()-c<42e4||function(a,b){if(void 0===aZ)try{new Response(new ReadableStream),aZ=!0}catch(c){aZ=!1}aZ?b(a.body):a.blob().then(b)}(b,b=>{const c=new i.Response(b,d);a0(),aY&&aY.then(b=>b.put(a1(a.url),c)).catch(a=>am(a.message))}))}(f,d,j),g=!0,b(null,a,c.headers.get("Cache-Control"),c.headers.get("Expires")))}).catch(a=>{h||b(Error(a.message))})};return j?function(a,b){if(a0(),!aY)return b(null);const c=a1(a.url);aY.then(a=>{a.match(c).then(d=>{const f=function(a){if(!a)return!1;const b=new Date(a.headers.get("Expires")||0),c=aq(a.headers.get("Cache-Control")||"");return b>Date.now()&&!c["no-cache"]}(d);a.delete(c),f&&a.put(c,d.clone()),b(null,d,f)}).catch(b)}).catch(b)}(f,k):k(null,null),{cancel:()=>{h=!0,g||d.abort()}}}(a,b);if(ap()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",a,b,void 0,!0)}return function(a,b){const c=new i.XMLHttpRequest;for(const d in c.open(a.method||"GET",a.url,!0),"arrayBuffer"===a.type&&(c.responseType="arraybuffer"),a.headers)c.setRequestHeader(d,a.headers[d]);return"json"===a.type&&(c.responseType="text",c.setRequestHeader("Accept","application/json")),c.withCredentials="include"===a.credentials,c.onerror=()=>{b(Error(c.statusText))},c.onload=()=>{if((c.status>=200&&c.status<300||0===c.status)&&null!==c.response){let d=c.response;if("json"===a.type)try{d=JSON.parse(c.response)}catch(f){return b(f)}b(null,d,c.getResponseHeader("Cache-Control"),c.getResponseHeader("Expires"))}else b(new a4(c.statusText,c.status,a.url))},c.send(a.body),{cancel:()=>c.abort()}}(a,b)},a7=function(a,b){return a6(aa(a,{type:"arrayBuffer"}),b)},a8=function(a,b){return a6(aa(a,{method:"POST"}),b)},a9=function(a,b){return a6(aa(a,{method:"GET"}),b)};function ba(a){const b=i.document.createElement("a");return b.href=a,b.protocol===i.document.location.protocol&&b.host===i.document.location.host}const bb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let bc,bd;bc=[],bd=0;const be=function(a,b){if(aC.supported&&(a.headers||(a.headers={}),a.headers.accept="image/webp,*/*"),bd>=az.MAX_PARALLEL_IMAGE_REQUESTS){const c={requestParameters:a,callback:b,cancelled:!1,cancel(){this.cancelled=!0}};return bc.push(c),c}bd++;let d=!1;const f=()=>{if(!d)for(d=!0,bd--;bc.length&&bd{f(),a?b(a):c&&(i.createImageBitmap?function(a,b){const c=new i.Blob([new Uint8Array(a)],{type:"image/png"});i.createImageBitmap(c).then(a=>{b(null,a)}).catch(a=>{b(Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(c,(a,c)=>b(a,c,d,g)):function(a,b){const c=new i.Image,d=i.URL;c.onload=()=>{b(null,c),d.revokeObjectURL(c.src),c.onload=null,i.requestAnimationFrame(()=>{c.src=bb})},c.onerror=()=>b(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 f=new i.Blob([new Uint8Array(a)],{type:"image/png"});c.src=a.byteLength?d.createObjectURL(f):bb}(c,(a,c)=>b(a,c,d,g)))});return{cancel:()=>{g.cancel(),f()}}};function bf(a,b,c){c[a]&& -1!==c[a].indexOf(b)||(c[a]=c[a]||[],c[a].push(b))}function bg(a,b,c){if(c&&c[a]){const d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}}class bh{constructor(a,b={}){aa(this,b),this.type=a}}class bi extends bh{constructor(a,b={}){super("error",aa({error:a},b))}}class bj{on(a,b){return this._listeners=this._listeners||{},bf(a,b,this._listeners),this}off(a,b){return bg(a,b,this._listeners),bg(a,b,this._oneTimeListeners),this}once(a,b){return b?(this._oneTimeListeners=this._oneTimeListeners||{},bf(a,b,this._oneTimeListeners),this):new Promise(b=>this.once(a,b))}fire(a,b){"string"==typeof a&&(a=new bh(a,b||{}));const c=a.type;if(this.listens(c)){a.target=this;const d=this._listeners&&this._listeners[c]?this._listeners[c].slice():[];for(const f of d)f.call(this,a);const g=this._oneTimeListeners&&this._oneTimeListeners[c]?this._oneTimeListeners[c].slice():[];for(const h of g)bg(c,h,this._oneTimeListeners),h.call(this,a);const i=this._eventedParent;i&&(aa(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(a))}else a instanceof bi&&console.error(a.error);return this}listens(a){return!!(this._listeners&&this._listeners[a]&&this._listeners[a].length>0||this._oneTimeListeners&&this._oneTimeListeners[a]&&this._oneTimeListeners[a].length>0||this._eventedParent&&this._eventedParent.listens(a))}setEventedParent(a,b){return this._eventedParent=a,this._eventedParentData=b,this}}var bk=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"}},"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},"horizon-blend":{"type":"number","property-type":"data-constant","default":0.1,"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":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","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}},"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"}},"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"}},"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"}}}');class bl{constructor(a,b,c,d){this.message=(a?`${a}: `:"")+c,d&&(this.identifier=d),null!=b&&b.__line__&&(this.line=b.__line__)}}function bm(a){const b=a.value;return b?[new bl(a.key,b,"constants have been deprecated as of v8"),]:[]}function bn(a,...b){for(const c of b)for(const d in c)a[d]=c[d];return a}function bo(a){return a instanceof Number||a instanceof String||a instanceof Boolean?a.valueOf():a}function bp(a){if(Array.isArray(a))return a.map(bp);if(a instanceof Object&&!(a instanceof Number||a instanceof String||a instanceof Boolean)){const b={};for(const c in a)b[c]=bp(a[c]);return b}return bo(a)}class bq extends Error{constructor(a,b){super(b),this.message=b,this.key=a}}class br{constructor(a,b=[]){for(const[c,d]of(this.parent=a,this.bindings={},b))this.bindings[c]=d}concat(a){return new br(this,a)}get(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw Error(`${a} not found in scope.`)}has(a){return!!this.bindings[a]|| !!this.parent&&this.parent.has(a)}}const bs={kind:"null"},bt={kind:"number"},bu={kind:"string"},bv={kind:"boolean"},bw={kind:"color"},bx={kind:"object"},by={kind:"value"},bz={kind:"collator"},bA={kind:"formatted"},bB={kind:"resolvedImage"};function bC(a,b){return{kind:"array",itemType:a,N:b}}function bD(a){if("array"===a.kind){const b=bD(a.itemType);return"number"==typeof a.N?`array<${b}, ${a.N}>`:"value"===a.itemType.kind?"array":`array<${b}>`}return a.kind}const bE=[bs,bt,bu,bv,bw,bA,bx,bC(by),bB];function bF(a,b){if("error"===b.kind)return null;if("array"===a.kind){if("array"===b.kind&&(0===b.N&&"value"===b.itemType.kind||!bF(a.itemType,b.itemType))&&("number"!=typeof a.N||a.N===b.N))return null}else{if(a.kind===b.kind)return null;if("value"===a.kind){for(const c of bE)if(!bF(c,b))return null}}return`Expected ${bD(a)} but found ${bD(b)} instead.`}function bG(a,b){return b.some(b=>b.kind===a.kind)}function bH(a,b){return b.some(b=>"null"===b?null===a:"array"===b?Array.isArray(a):"object"===b?a&&!Array.isArray(a)&&"object"==typeof a:b===typeof a)}function bI(a){var b={exports:{}};return a(b,b.exports),b.exports}var bJ=bI(function(a,b){var c={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 d(a){return(a=Math.round(a))<0?0:a>255?255:a}function f(a){return d("%"===a[a.length-1]?parseFloat(a)/100*255:parseInt(a))}function g(a){var b;return(b="%"===a[a.length-1]?parseFloat(a)/100:parseFloat(a))<0?0:b>1?1:b}function h(a,b,c){return c<0?c+=1:c>1&&(c-=1),6*c<1?a+(b-a)*c*6:2*c<1?b:3*c<2?a+(b-a)*(2/3-c)*6:a}try{b.parseCSSColor=function(a){var b,i=a.replace(/ /g,"").toLowerCase();if(i in c)return c[i].slice();if("#"===i[0])return 4===i.length?(b=parseInt(i.substr(1),16))>=0&&b<=4095?[(3840&b)>>4|(3840&b)>>8,240&b|(240&b)>>4,15&b|(15&b)<<4,1,]:null:7===i.length&&(b=parseInt(i.substr(1),16))>=0&&b<=16777215?[(16711680&b)>>16,(65280&b)>>8,255&b,1,]:null;var j=i.indexOf("("),k=i.indexOf(")");if(-1!==j&&k+1===i.length){var l=i.substr(0,j),m=i.substr(j+1,k-(j+1)).split(","),n=1;switch(l){case"rgba":if(4!==m.length)break;n=g(m.pop());case"rgb":return 3!==m.length?null:[f(m[0]),f(m[1]),f(m[2]),n,];case"hsla":if(4!==m.length)break;n=g(m.pop());case"hsl":if(3!==m.length)break;var o=(parseFloat(m[0])%360+360)%360/360,p=g(m[1]),q=g(m[2]),r=q<=.5?q*(p+1):q+p-q*p,s=2*q-r;return[d(255*h(s,r,o+1/3)),d(255*h(s,r,o)),d(255*h(s,r,o-1/3)),n,]}}return null}}catch(i){}});class bK{constructor(a,b,c,d=1){this.r=a,this.g=b,this.b=c,this.a=d}static parse(a){if(!a)return;if(a instanceof bK)return a;if("string"!=typeof a)return;const b=bJ.parseCSSColor(a);return b?new bK(b[0]/255*b[3],b[1]/255*b[3],b[2]/255*b[3],b[3]):void 0}toString(){const[a,b,c,d]=this.toArray();return`rgba(${Math.round(a)},${Math.round(b)},${Math.round(c)},${d})`}toArray(){const{r:a,g:b,b:c,a:d}=this;return 0===d?[0,0,0,0]:[255*a/d,255*b/d,255*c/d,d,]}}bK.black=new bK(0,0,0,1),bK.white=new bK(1,1,1,1),bK.transparent=new bK(0,0,0,0),bK.red=new bK(1,0,0,1),bK.blue=new bK(0,0,1,1);class bL{constructor(a,b,c){this.sensitivity=a?b?"variant":"case":b?"accent":"base",this.locale=c,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(a,b){return this.collator.compare(a,b)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class bM{constructor(a,b,c,d,f){this.text=a.normalize?a.normalize():a,this.image=b,this.scale=c,this.fontStack=d,this.textColor=f}}class bN{constructor(a){this.sections=a}static fromString(a){return new bN([new bM(a,null,null,null,null),])}isEmpty(){return 0===this.sections.length||!this.sections.some(a=>0!==a.text.length||a.image&&0!==a.image.name.length)}static factory(a){return a instanceof bN?a:bN.fromString(a)}toString(){return 0===this.sections.length?"":this.sections.map(a=>a.text).join("")}serialize(){const a=["format"];for(const b of this.sections){if(b.image){a.push(["image",b.image.name]);continue}a.push(b.text);const c={};b.fontStack&&(c["text-font"]=["literal",b.fontStack.split(","),]),b.scale&&(c["font-scale"]=b.scale),b.textColor&&(c["text-color"]=["rgba"].concat(b.textColor.toArray())),a.push(c)}return a}}class bO{constructor(a){this.name=a.name,this.available=a.available}toString(){return this.name}static fromString(a){return a?new bO({name:a,available:!1}):null}serialize(){return["image",this.name]}}function bP(a,b,c,d){return"number"==typeof a&&a>=0&&a<=255&&"number"==typeof b&&b>=0&&b<=255&&"number"==typeof c&&c>=0&&c<=255?void 0===d||"number"==typeof d&&d>=0&&d<=1?null:`Invalid rgba value [${[a,b,c,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof d?[a,b,c,d]:[a,b,c]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function bQ(a){if(null===a||"string"==typeof a||"boolean"==typeof a||"number"==typeof a||a instanceof bK||a instanceof bL||a instanceof bN||a instanceof bO)return!0;if(Array.isArray(a)){for(const b of a)if(!bQ(b))return!1;return!0}if("object"==typeof a){for(const c in a)if(!bQ(a[c]))return!1;return!0}return!1}function bR(a){if(null===a)return bs;if("string"==typeof a)return bu;if("boolean"==typeof a)return bv;if("number"==typeof a)return bt;if(a instanceof bK)return bw;if(a instanceof bL)return bz;if(a instanceof bN)return bA;if(a instanceof bO)return bB;if(Array.isArray(a)){const b=a.length;let c;for(const d of a){const f=bR(d);if(c){if(c===f)continue;c=by;break}c=f}return bC(c||by,b)}return bx}function bS(a){const b=typeof a;return null===a?"":"string"===b||"number"===b||"boolean"===b?String(a):a instanceof bK||a instanceof bN||a instanceof bO?a.toString():JSON.stringify(a)}class bT{constructor(a,b){this.type=a,this.value=b}static parse(a,b){if(2!==a.length)return b.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!bQ(a[1]))return b.error("invalid value");const c=a[1];let d=bR(c);const f=b.expectedType;return"array"===d.kind&&0===d.N&&f&&"array"===f.kind&&("number"!=typeof f.N||0===f.N)&&(d=f),new bT(d,c)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof bK?["rgba"].concat(this.value.toArray()):this.value instanceof bN?this.value.serialize():this.value}}class bU{constructor(a){this.name="ExpressionEvaluationError",this.message=a}toJSON(){return this.message}}const bV={string:bu,number:bt,boolean:bv,object:bx};class bW{constructor(a,b){this.type=a,this.args=b}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");let c,d=1;const f=a[0];if("array"===f){let g,h;if(a.length>2){const i=a[1];if("string"!=typeof i||!(i in bV)||"object"===i)return b.error('The item type argument of "array" must be one of string, number, boolean',1);g=bV[i],d++}else g=by;if(a.length>3){if(null!==a[2]&&("number"!=typeof a[2]||a[2]<0||a[2]!==Math.floor(a[2])))return b.error('The length argument to "array" must be a positive integer literal',2);h=a[2],d++}c=bC(g,h)}else c=bV[f];const j=[];for(;da.outputDefined())}serialize(){const a=this.type,b=[a.kind];if("array"===a.kind){const c=a.itemType;if("string"===c.kind||"number"===c.kind||"boolean"===c.kind){b.push(c.kind);const d=a.N;("number"==typeof d||this.args.length>1)&&b.push(d)}}return b.concat(this.args.map(a=>a.serialize()))}}class bX{constructor(a){this.type=bA,this.sections=a}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");const c=a[1];if(!Array.isArray(c)&&"object"==typeof c)return b.error("First argument must be an image or text section.");const d=[];let f=!1;for(let g=1;g<=a.length-1;++g){const h=a[g];if(f&&"object"==typeof h&&!Array.isArray(h)){f=!1;let i=null;if(h["font-scale"]&&!(i=b.parse(h["font-scale"],1,bt)))return null;let j=null;if(h["text-font"]&&!(j=b.parse(h["text-font"],1,bC(bu))))return null;let k=null;if(h["text-color"]&&!(k=b.parse(h["text-color"],1,bw)))return null;const l=d[d.length-1];l.scale=i,l.font=j,l.textColor=k}else{const m=b.parse(a[g],1,by);if(!m)return null;const n=m.type.kind;if("string"!==n&&"value"!==n&&"null"!==n&&"resolvedImage"!==n)return b.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,d.push({content:m,scale:null,font:null,textColor:null})}}return new bX(d)}evaluate(a){return new bN(this.sections.map(b=>{const c=b.content.evaluate(a);return bR(c)===bB?new bM("",c,null,null,null):new bM(bS(c),null,b.scale?b.scale.evaluate(a):null,b.font?b.font.evaluate(a).join(","):null,b.textColor?b.textColor.evaluate(a):null)}))}eachChild(a){for(const b of this.sections)a(b.content),b.scale&&a(b.scale),b.font&&a(b.font),b.textColor&&a(b.textColor)}outputDefined(){return!1}serialize(){const a=["format"];for(const b of this.sections){a.push(b.content.serialize());const c={};b.scale&&(c["font-scale"]=b.scale.serialize()),b.font&&(c["text-font"]=b.font.serialize()),b.textColor&&(c["text-color"]=b.textColor.serialize()),a.push(c)}return a}}class bY{constructor(a){this.type=bB,this.input=a}static parse(a,b){if(2!==a.length)return b.error("Expected two arguments.");const c=b.parse(a[1],1,bu);return c?new bY(c):b.error("No image name provided.")}evaluate(a){const b=this.input.evaluate(a),c=bO.fromString(b);return c&&a.availableImages&&(c.available=a.availableImages.indexOf(b)> -1),c}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const bZ={"to-boolean":bv,"to-color":bw,"to-number":bt,"to-string":bu};class b${constructor(a,b){this.type=a,this.args=b}static parse(a,b){if(a.length<2)return b.error("Expected at least one argument.");const c=a[0];if(("to-boolean"===c||"to-string"===c)&&2!==a.length)return b.error("Expected one argument.");const d=bZ[c],f=[];for(let g=1;g4?`Invalid rbga value ${JSON.stringify(b)}: expected an array containing either three or four numeric values.`:bP(b[0],b[1],b[2],b[3])))return new bK(b[0]/255,b[1]/255,b[2]/255,b[3])}throw new bU(c||`Could not parse color from value '${"string"==typeof b?b:String(JSON.stringify(b))}'`)}if("number"===this.type.kind){let g=null;for(const h of this.args){if(null===(g=h.evaluate(a)))return 0;const i=Number(g);if(!isNaN(i))return i}throw new bU(`Could not convert ${JSON.stringify(g)} to number.`)}return"formatted"===this.type.kind?bN.fromString(bS(this.args[0].evaluate(a))):"resolvedImage"===this.type.kind?bO.fromString(bS(this.args[0].evaluate(a))):bS(this.args[0].evaluate(a))}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){if("formatted"===this.type.kind)return new bX([{content:this.args[0],scale:null,font:null,textColor:null},]).serialize();if("resolvedImage"===this.type.kind)return new bY(this.args[0]).serialize();const a=[`to-${this.type.kind}`];return this.eachChild(b=>{a.push(b.serialize())}),a}}const b_=["Unknown","Point","LineString","Polygon",];class b0{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&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?b_[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 a=this.featureDistanceData.center,b=this.featureDistanceData.scale,{x:c,y:d}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(c*b-a[0])+this.featureDistanceData.bearing[1]*(d*b-a[1])}return 0}parseColor(a){let b=this._parseColorCache[a];return b||(b=this._parseColorCache[a]=bK.parse(a)),b}}class b1{constructor(a,b,c,d){this.name=a,this.type=b,this._evaluate=c,this.args=d}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(a=>a.serialize()))}static parse(a,b){const c=a[0],d=b1.definitions[c];if(!d)return b.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0);const f=Array.isArray(d)?d[0]:d.type,g=Array.isArray(d)?[[d[1],d[2]]]:d.overloads,h=g.filter(([b])=>!Array.isArray(b)||b.length===a.length-1);let i=null;for(const[j,k]of h){i=new cn(b.registry,b.path,null,b.scope);const l=[];let m=!1;for(let n=1;n{var b;return Array.isArray(b=a)?`(${b.map(bD).join(", ")})`:`(${bD(b.type)}...)`}).join(" | "),w=[];for(let x=1;x=b[2]||a[1]<=b[1]||a[3]>=b[3])}function b5(a,b){const c=(180+a[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a[1]*Math.PI/360)))/360,f=Math.pow(2,b.z);return[Math.round(c*f*8192),Math.round(d*f*8192),]}function b6(a,b,c){const d=a[0]-b[0],f=a[1]-b[1],g=a[0]-c[0],h=a[1]-c[1];return d*h-g*f==0&&d*g<=0&&f*h<=0}function b7(a,b){var c,d,f;let g=!1;for(let h=0,i=b.length;h(c=a)[1]!=(f=j[k+1])[1]>c[1]&&c[0]<(f[0]-d[0])*(c[1]-d[1])/(f[1]-d[1])+d[0]&&(g=!g)}}return g}function b8(a,b){for(let c=0;c0&&i<0||h<0&&i>0}function ca(a,b,c){var d,f,g,h,i,j;for(const k of c)for(let l=0;lc[2]){const f=.5*d;let g=a[0]-c[0]>f?-d:c[0]-a[0]>f?d:0;0===g&&(g=a[0]-c[2]>f?-d:c[2]-a[0]>f?d:0),a[0]+=g}b3(b,a)}function cg(a,b,c,d){const f=8192*Math.pow(2,d.z),g=[8192*d.x,8192*d.y],h=[];for(const i of a)for(const j of i){const k=[j.x+g[0],j.y+g[1]];cf(k,b,c,f),h.push(k)}return h}function ch(a,b,c,d){var f;const g=8192*Math.pow(2,d.z),h=[8192*d.x,8192*d.y],i=[];for(const j of a){const k=[];for(const l of j){const m=[l.x+h[0],l.y+h[1]];b3(b,m),k.push(m)}i.push(k)}if(b[2]-b[0]<=g/2)for(const n of((f=b)[0]=f[1]=1/0,f[2]=f[3]=-1/0,i))for(const o of n)cf(o,b,c,g);return i}class ci{constructor(a,b){this.type=bv,this.geojson=a,this.geometries=b}static parse(a,b){if(2!==a.length)return b.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(bQ(a[1])){const c=a[1];if("FeatureCollection"===c.type)for(let d=0;d{b&&!cj(a)&&(b=!1)}),b}function ck(a){if(a instanceof b1&&"feature-state"===a.name)return!1;let b=!0;return a.eachChild(a=>{b&&!ck(a)&&(b=!1)}),b}function cl(a,b){if(a instanceof b1&&b.indexOf(a.name)>=0)return!1;let c=!0;return a.eachChild(a=>{c&&!cl(a,b)&&(c=!1)}),c}class cm{constructor(a,b){this.type=b.type,this.name=a,this.boundExpression=b}static parse(a,b){if(2!==a.length||"string"!=typeof a[1])return b.error("'var' expression requires exactly one string literal argument.");const c=a[1];return b.scope.has(c)?new cm(c,b.scope.get(c)):b.error(`Unknown variable "${c}". Make sure "${c}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class cn{constructor(a,b=[],c,d=new br,f=[]){this.registry=a,this.path=b,this.key=b.map(a=>`[${a}]`).join(""),this.scope=d,this.errors=f,this.expectedType=c}parse(a,b,c,d,f={}){return b?this.concat(b,c,d)._parse(a,f):this._parse(a,f)}_parse(a,b){function c(a,b,c){return"assert"===c?new bW(b,[a]):"coerce"===c?new b$(b,[a]):a}if(null!==a&&"string"!=typeof a&&"boolean"!=typeof a&&"number"!=typeof a||(a=["literal",a]),Array.isArray(a)){if(0===a.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=a[0];if("string"!=typeof d)return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const f=this.registry[d];if(f){let g=f.parse(a,this);if(!g)return null;if(this.expectedType){const h=this.expectedType,i=g.type;if("string"!==h.kind&&"number"!==h.kind&&"boolean"!==h.kind&&"object"!==h.kind&&"array"!==h.kind||"value"!==i.kind){if("color"!==h.kind&&"formatted"!==h.kind&&"resolvedImage"!==h.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(h,i))return null}else g=c(g,h,b.typeAnnotation||"coerce")}else g=c(g,h,b.typeAnnotation||"assert")}if(!(g instanceof bT)&&"resolvedImage"!==g.type.kind&&co(g)){const j=new b0;try{g=new bT(g.type,g.evaluate(j))}catch(k){return this.error(k.message),null}}return g}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===a?"'undefined' value invalid. Use null instead.":"object"==typeof a?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof a} instead.`)}concat(a,b,c){const d="number"==typeof a?this.path.concat(a):this.path,f=c?this.scope.concat(c):this.scope;return new cn(this.registry,d,b||null,f,this.errors)}error(a,...b){const c=`${this.key}${b.map(a=>`[${a}]`).join("")}`;this.errors.push(new bq(c,a))}checkSubtype(a,b){const c=bF(a,b);return c&&this.error(c),c}}function co(a){if(a instanceof cm)return co(a.boundExpression);if(a instanceof b1&&"error"===a.name||a instanceof b2||a instanceof ci)return!1;const b=a instanceof b$||a instanceof bW;let c=!0;return a.eachChild(a=>{c=b?c&&co(a):c&&a instanceof bT}),!!c&&cj(a)&&cl(a,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center",])}function cp(a,b){const c=a.length-1;let d,f,g=0,h=c,i=0;for(;g<=h;)if(d=a[i=Math.floor((g+h)/2)],f=a[i+1],d<=b){if(i===c||bb))throw new bU("Input is not a number.");h=i-1}return 0}class cq{constructor(a,b,c){for(const[d,f]of(this.type=a,this.input=b,this.labels=[],this.outputs=[],c))this.labels.push(d),this.outputs.push(f)}static parse(a,b){if(a.length-1<4)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return b.error("Expected an even number of arguments.");const c=b.parse(a[1],1,bt);if(!c)return null;const d=[];let f=null;b.expectedType&&"value"!==b.expectedType.kind&&(f=b.expectedType);for(let g=1;g=h)return b.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',j);const l=b.parse(i,k,f);if(!l)return null;f=f||l.type,d.push([h,l])}return new cq(f,c,d)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const f=b.length;return d>=b[f-1]?c[f-1].evaluate(a):c[cp(b,d)].evaluate(a)}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){const a=["step",this.input.serialize()];for(let b=0;b0&&a.push(this.labels[b]),a.push(this.outputs[b].serialize());return a}}function cr(a,b,c){return a*(1-c)+b*c}var cs=Object.freeze({__proto__:null,number:cr,color:function(a,b,c){return new bK(cr(a.r,b.r,c),cr(a.g,b.g,c),cr(a.b,b.b,c),cr(a.a,b.a,c))},array:function(a,b,c){return a.map((a,d)=>cr(a,b[d],c))}});const ct=4/29,cu=6/29,cv=3*cu*cu,cw=Math.PI/180,cx=180/Math.PI;function cy(a){return a>.008856451679035631?Math.pow(a,1/3):a/cv+ct}function cz(a){return a>cu?a*a*a:cv*(a-ct)}function cA(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function cB(a){return(a/=255)<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function cC(a){const b=cB(a.r),c=cB(a.g),d=cB(a.b),f=cy((.4124564*b+.3575761*c+.1804375*d)/.95047),g=cy((.2126729*b+.7151522*c+.072175*d)/1);return{l:116*g-16,a:500*(f-g),b:200*(g-cy((.0193339*b+.119192*c+.9503041*d)/1.08883)),alpha:a.a}}function cD(a){let b=(a.l+16)/116,c=isNaN(a.a)?b:b+a.a/500,d=isNaN(a.b)?b:b-a.b/200;return b=1*cz(b),c=.95047*cz(c),d=1.08883*cz(d),new bK(cA(3.2404542*c-1.5371385*b-.4985314*d),cA(-.969266*c+1.8760108*b+.041556*d),cA(.0556434*c-.2040259*b+1.0572252*d),a.alpha)}const cE={forward:cC,reverse:cD,interpolate:function(a,b,c){return{l:cr(a.l,b.l,c),a:cr(a.a,b.a,c),b:cr(a.b,b.b,c),alpha:cr(a.alpha,b.alpha,c)}}},cF={forward:function(a){const{l:b,a:c,b:d}=cC(a),f=Math.atan2(d,c)*cx;return{h:f<0?f+360:f,c:Math.sqrt(c*c+d*d),l:b,alpha:a.a}},reverse:function(a){const b=a.h*cw,c=a.c;return cD({l:a.l,a:Math.cos(b)*c,b:Math.sin(b)*c,alpha:a.alpha})},interpolate:function(a,b,c){return{h:function(a,b,c){const d=b-a;return a+c*(d>180||d< -180?d-360*Math.round(d/360):d)}(a.h,b.h,c),c:cr(a.c,b.c,c),l:cr(a.l,b.l,c),alpha:cr(a.alpha,b.alpha,c)}}};var cG=Object.freeze({__proto__:null,lab:cE,hcl:cF});class cH{constructor(a,b,c,d,f){for(const[g,h]of(this.type=a,this.operator=b,this.interpolation=c,this.input=d,this.labels=[],this.outputs=[],f))this.labels.push(g),this.outputs.push(h)}static interpolationFactor(a,b,d,f){let g=0;if("exponential"===a.name)g=cI(b,a.base,d,f);else if("linear"===a.name)g=cI(b,1,d,f);else if("cubic-bezier"===a.name){const h=a.controlPoints;g=new c(h[0],h[1],h[2],h[3]).solve(cI(b,1,d,f))}return g}static parse(a,b){let[c,d,f,...g]=a;if(!Array.isArray(d)||0===d.length)return b.error("Expected an interpolation type expression.",1);if("linear"===d[0])d={name:"linear"};else if("exponential"===d[0]){const h=d[1];if("number"!=typeof h)return b.error("Exponential interpolation requires a numeric base.",1,1);d={name:"exponential",base:h}}else{if("cubic-bezier"!==d[0])return b.error(`Unknown interpolation type ${String(d[0])}`,1,0);{const i=d.slice(1);if(4!==i.length||i.some(a=>"number"!=typeof a||a<0||a>1))return b.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);d={name:"cubic-bezier",controlPoints:i}}}if(a.length-1<4)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!=0)return b.error("Expected an even number of arguments.");if(!(f=b.parse(f,2,bt)))return null;const j=[];let k=null;"interpolate-hcl"===c||"interpolate-lab"===c?k=bw:b.expectedType&&"value"!==b.expectedType.kind&&(k=b.expectedType);for(let l=0;l=m)return b.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);const q=b.parse(n,p,k);if(!q)return null;k=k||q.type,j.push([m,q])}return"number"===k.kind||"color"===k.kind||"array"===k.kind&&"number"===k.itemType.kind&&"number"==typeof k.N?new cH(k,c,d,f,j):b.error(`Type ${bD(k)} is not interpolatable.`)}evaluate(a){const b=this.labels,c=this.outputs;if(1===b.length)return c[0].evaluate(a);const d=this.input.evaluate(a);if(d<=b[0])return c[0].evaluate(a);const f=b.length;if(d>=b[f-1])return c[f-1].evaluate(a);const g=cp(b,d),h=cH.interpolationFactor(this.interpolation,d,b[g],b[g+1]),i=c[g].evaluate(a),j=c[g+1].evaluate(a);return"interpolate"===this.operator?cs[this.type.kind.toLowerCase()](i,j,h):"interpolate-hcl"===this.operator?cF.reverse(cF.interpolate(cF.forward(i),cF.forward(j),h)):cE.reverse(cE.interpolate(cE.forward(i),cE.forward(j),h))}eachChild(a){for(const b of(a(this.input),this.outputs))a(b)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}serialize(){let a;a="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 b=[this.operator,a,this.input.serialize(),];for(let c=0;cbF(d,a.type));return new cJ(i?by:c,f)}evaluate(a){let b,c=null,d=0;for(const f of this.args){if(d++,(c=f.evaluate(a))&&c instanceof bO&&!c.available&&(b||(b=c),c=null,d===this.args.length))return b;if(null!==c)break}return c}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}serialize(){const a=["coalesce"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cK{constructor(a,b){this.type=b.type,this.bindings=[].concat(a),this.result=b}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(const b of this.bindings)a(b[1]);a(this.result)}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);const c=[];for(let d=1;d=c.length)throw new bU(`Array index out of bounds: ${b} > ${c.length-1}.`);if(b!==Math.floor(b))throw new bU(`Array index must be an integer, but found ${b} instead.`);return c[b]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize(),]}}class cM{constructor(a,b){this.type=bv,this.needle=a,this.haystack=b}static parse(a,b){if(3!==a.length)return b.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,by);return c&&d?bG(c.type,[bv,bu,bt,bs,by])?new cM(c,d):b.error(`Expected first argument to be of type boolean, string, number or null, but found ${bD(c.type)} instead`):null}evaluate(a){const b=this.needle.evaluate(a),c=this.haystack.evaluate(a);if(!c)return!1;if(!bH(b,["boolean","string","number","null",]))throw new bU(`Expected first argument to be of type boolean, string, number or null, but found ${bD(bR(b))} instead.`);if(!bH(c,["string","array"]))throw new bU(`Expected second argument to be of type array or string, but found ${bD(bR(c))} instead.`);return c.indexOf(b)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize(),]}}class cN{constructor(a,b,c){this.type=bt,this.needle=a,this.haystack=b,this.fromIndex=c}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,by);if(!c||!d)return null;if(!bG(c.type,[bv,bu,bt,bs,by]))return b.error(`Expected first argument to be of type boolean, string, number or null, but found ${bD(c.type)} instead`);if(4===a.length){const f=b.parse(a[3],3,bt);return f?new cN(c,d,f):null}return new cN(c,d)}evaluate(a){const b=this.needle.evaluate(a),c=this.haystack.evaluate(a);if(!bH(b,["boolean","string","number","null",]))throw new bU(`Expected first argument to be of type boolean, string, number or null, but found ${bD(bR(b))} instead.`);if(!bH(c,["string","array"]))throw new bU(`Expected second argument to be of type array or string, but found ${bD(bR(c))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(a);return c.indexOf(b,d)}return c.indexOf(b)}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&& void 0!==this.fromIndex){const a=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),a,]}return["index-of",this.needle.serialize(),this.haystack.serialize(),]}}class cO{constructor(a,b,c,d,f,g){this.inputType=a,this.type=b,this.input=c,this.cases=d,this.outputs=f,this.otherwise=g}static parse(a,b){if(a.length<5)return b.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!=1)return b.error("Expected an even number of arguments.");let c,d;b.expectedType&&"value"!==b.expectedType.kind&&(d=b.expectedType);const f={},g=[];for(let h=2;hNumber.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof l&&Math.floor(l)!==l)return k.error("Numeric branch labels must be integer values.");if(c){if(k.checkSubtype(c,bR(l)))return null}else c=bR(l);if(void 0!==f[String(l)])return k.error("Branch labels must be unique.");f[String(l)]=g.length}const m=b.parse(j,h,d);if(!m)return null;d=d||m.type,g.push(m)}const n=b.parse(a[1],1,by);if(!n)return null;const o=b.parse(a[a.length-1],a.length-1,d);return o?"value"!==n.type.kind&&b.concat(1).checkSubtype(c,n.type)?null:new cO(c,d,n,f,g,o):null}evaluate(a){const b=this.input.evaluate(a);return(bR(b)===this.inputType&&this.outputs[this.cases[b]]||this.otherwise).evaluate(a)}eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["match",this.input.serialize()],b=Object.keys(this.cases).sort(),c=[],d={};for(const f of b){const g=d[this.cases[f]];void 0===g?(d[this.cases[f]]=c.length,c.push([this.cases[f],[f]])):c[g][1].push(f)}const h=a=>"number"===this.inputType.kind?Number(a):a;for(const[i,j]of c)a.push(1===j.length?h(j[0]):j.map(h)),a.push(this.outputs[i].serialize());return a.push(this.otherwise.serialize()),a}}class cP{constructor(a,b,c){this.type=a,this.branches=b,this.otherwise=c}static parse(a,b){if(a.length<4)return b.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!=0)return b.error("Expected an odd number of arguments.");let c;b.expectedType&&"value"!==b.expectedType.kind&&(c=b.expectedType);const d=[];for(let f=1;fb.outputDefined())&&this.otherwise.outputDefined()}serialize(){const a=["case"];return this.eachChild(b=>{a.push(b.serialize())}),a}}class cQ{constructor(a,b,c,d){this.type=a,this.input=b,this.beginIndex=c,this.endIndex=d}static parse(a,b){if(a.length<=2||a.length>=5)return b.error(`Expected 3 or 4 arguments, but found ${a.length-1} instead.`);const c=b.parse(a[1],1,by),d=b.parse(a[2],2,bt);if(!c||!d)return null;if(!bG(c.type,[bC(by),bu,by]))return b.error(`Expected first argument to be of type array or string, but found ${bD(c.type)} instead`);if(4===a.length){const f=b.parse(a[3],3,bt);return f?new cQ(c.type,c,d,f):null}return new cQ(c.type,c,d)}evaluate(a){const b=this.input.evaluate(a),c=this.beginIndex.evaluate(a);if(!bH(b,["string","array"]))throw new bU(`Expected first argument to be of type array or string, but found ${bD(bR(b))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(a);return b.slice(c,d)}return b.slice(c)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&& void 0!==this.endIndex){const a=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),a,]}return["slice",this.input.serialize(),this.beginIndex.serialize(),]}}function cR(a,b){return"=="===a||"!="===a?"boolean"===b.kind||"string"===b.kind||"number"===b.kind||"null"===b.kind||"value"===b.kind:"string"===b.kind||"number"===b.kind||"value"===b.kind}function cS(a,b,c,d){return 0===d.compare(b,c)}function cT(a,b,c){const d="=="!==a&&"!="!==a;return class f{constructor(a,b,c){this.type=bv,this.lhs=a,this.rhs=b,this.collator=c,this.hasUntypedArgument="value"===a.type.kind||"value"===b.type.kind}static parse(a,b){if(3!==a.length&&4!==a.length)return b.error("Expected two or three arguments.");const c=a[0];let g=b.parse(a[1],1,by);if(!g)return null;if(!cR(c,g.type))return b.concat(1).error(`"${c}" comparisons are not supported for type '${bD(g.type)}'.`);let h=b.parse(a[2],2,by);if(!h)return null;if(!cR(c,h.type))return b.concat(2).error(`"${c}" comparisons are not supported for type '${bD(h.type)}'.`);if(g.type.kind!==h.type.kind&&"value"!==g.type.kind&&"value"!==h.type.kind)return b.error(`Cannot compare types '${bD(g.type)}' and '${bD(h.type)}'.`);d&&("value"===g.type.kind&&"value"!==h.type.kind?g=new bW(h.type,[g]):"value"!==g.type.kind&&"value"===h.type.kind&&(h=new bW(g.type,[h])));let i=null;if(4===a.length){if("string"!==g.type.kind&&"string"!==h.type.kind&&"value"!==g.type.kind&&"value"!==h.type.kind)return b.error("Cannot use collator to compare non-string types.");if(!(i=b.parse(a[3],3,bz)))return null}return new f(g,h,i)}evaluate(f){const g=this.lhs.evaluate(f),h=this.rhs.evaluate(f);if(d&&this.hasUntypedArgument){const i=bR(g),j=bR(h);if(i.kind!==j.kind||"string"!==i.kind&&"number"!==i.kind)throw new bU(`Expected arguments for "${a}" to be (string, string) or (number, number), but found (${i.kind}, ${j.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=bR(g),l=bR(h);if("string"!==k.kind||"string"!==l.kind)return b(f,g,h)}return this.collator?c(f,g,h,this.collator.evaluate(f)):b(f,g,h)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}serialize(){const b=[a];return this.eachChild(a=>{b.push(a.serialize())}),b}}}const cU=cT("==",function(a,b,c){return b===c},cS),cV=cT("!=",function(a,b,c){return b!==c},function(a,b,c,d){return!cS(0,b,c,d)}),cW=cT("<",function(a,b,c){return bd.compare(b,c)}),cX=cT(">",function(a,b,c){return b>c},function(a,b,c,d){return d.compare(b,c)>0}),cY=cT("<=",function(a,b,c){return b<=c},function(a,b,c,d){return 0>=d.compare(b,c)}),cZ=cT(">=",function(a,b,c){return b>=c},function(a,b,c,d){return d.compare(b,c)>=0});class c${constructor(a,b,c,d,f){this.type=bu,this.number=a,this.locale=b,this.currency=c,this.minFractionDigits=d,this.maxFractionDigits=f}static parse(a,b){if(3!==a.length)return b.error("Expected two arguments.");const c=b.parse(a[1],1,bt);if(!c)return null;const d=a[2];if("object"!=typeof d||Array.isArray(d))return b.error("NumberFormat options argument must be an object.");let f=null;if(d.locale&&!(f=b.parse(d.locale,1,bu)))return null;let g=null;if(d.currency&&!(g=b.parse(d.currency,1,bu)))return null;let h=null;if(d["min-fraction-digits"]&&!(h=b.parse(d["min-fraction-digits"],1,bt)))return null;let i=null;return!d["max-fraction-digits"]||(i=b.parse(d["max-fraction-digits"],1,bt))?new c$(c,f,g,h,i):null}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const a={};return this.locale&&(a.locale=this.locale.serialize()),this.currency&&(a.currency=this.currency.serialize()),this.minFractionDigits&&(a["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(a["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),a,]}}class c_{constructor(a){this.type=bt,this.input=a}static parse(a,b){if(2!==a.length)return b.error(`Expected 1 argument, but found ${a.length-1} instead.`);const c=b.parse(a[1],1);return c?"array"!==c.type.kind&&"string"!==c.type.kind&&"value"!==c.type.kind?b.error(`Expected argument of type string or array, but found ${bD(c.type)} instead.`):new c_(c):null}evaluate(a){const b=this.input.evaluate(a);if("string"==typeof b||Array.isArray(b))return b.length;throw new bU(`Expected value to be of type string or array, but found ${bD(bR(b))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}serialize(){const a=["length"];return this.eachChild(b=>{a.push(b.serialize())}),a}}const c0={"==":cU,"!=":cV,">":cX,"<":cW,">=":cZ,"<=":cY,array:bW,at:cL,boolean:bW,case:cP,coalesce:cJ,collator:b2,format:bX,image:bY,in:cM,"index-of":cN,interpolate:cH,"interpolate-hcl":cH,"interpolate-lab":cH,length:c_,let:cK,literal:bT,match:cO,number:bW,"number-format":c$,object:bW,slice:cQ,step:cq,string:bW,"to-boolean":b$,"to-color":b$,"to-number":b$,"to-string":b$,var:cm,within:ci};function c1(a,[b,c,d,f]){b=b.evaluate(a),c=c.evaluate(a),d=d.evaluate(a);const g=f?f.evaluate(a):1,h=bP(b,c,d,g);if(h)throw new bU(h);return new bK(b/255*g,c/255*g,d/255*g,g)}function c2(a,b){const c=b[a];return void 0===c?null:c}function c3(a){return{type:a}}function c4(a){return{result:"success",value:a}}function c5(a){return{result:"error",value:a}}function c6(a){return"data-driven"===a["property-type"]||"cross-faded-data-driven"===a["property-type"]}function c7(a){return!!a.expression&&a.expression.parameters.indexOf("zoom")> -1}function c8(a){return!!a.expression&&a.expression.interpolated}function c9(a){return a instanceof Number?"number":a instanceof String?"string":a instanceof Boolean?"boolean":Array.isArray(a)?"array":null===a?"null":typeof a}function da(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function db(a){return a}function dc(a,b){const c="color"===b.type,d=a.stops&&"object"==typeof a.stops[0][0],f=d||!(d|| void 0!==a.property),g=a.type||(c8(b)?"exponential":"interval");if(c&&((a=bn({},a)).stops&&(a.stops=a.stops.map(a=>[a[0],bK.parse(a[1]),])),a.default=bK.parse(a.default?a.default:b.default)),a.colorSpace&&"rgb"!==a.colorSpace&&!cG[a.colorSpace])throw Error(`Unknown color space: ${a.colorSpace}`);let h,i,j;if("exponential"===g)h=dg;else if("interval"===g)h=df;else if("categorical"===g){for(const k of(h=de,i=Object.create(null),a.stops))i[k[0]]=k[1];j=typeof a.stops[0][0]}else{if("identity"!==g)throw Error(`Unknown function type "${g}"`);h=dh}if(d){const l={},m=[];for(let n=0;na[0]),evaluate:({zoom:c},d)=>dg({stops:q,base:a.base},b,c).evaluate(c,d)}}if(f){const u="exponential"===g?{name:"exponential",base:void 0!==a.base?a.base:1}:null;return{kind:"camera",interpolationType:u,interpolationFactor:cH.interpolationFactor.bind(void 0,u),zoomStops:a.stops.map(a=>a[0]),evaluate:({zoom:c})=>h(a,b,c,i,j)}}return{kind:"source",evaluate(c,d){const f=d&&d.properties?d.properties[a.property]:void 0;return void 0===f?dd(a.default,b.default):h(a,b,f,i,j)}}}function dd(a,b,c){return void 0!==a?a:void 0!==b?b:void 0!==c?c:void 0}function de(a,b,c,d,f){return dd(typeof c===f?d[c]:void 0,a.default,b.default)}function df(a,b,c){if("number"!==c9(c))return dd(a.default,b.default);const d=a.stops.length;if(1===d||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[d-1][0])return a.stops[d-1][1];const f=cp(a.stops.map(a=>a[0]),c);return a.stops[f][1]}function dg(a,b,c){const d=void 0!==a.base?a.base:1;if("number"!==c9(c))return dd(a.default,b.default);const f=a.stops.length;if(1===f||c<=a.stops[0][0])return a.stops[0][1];if(c>=a.stops[f-1][0])return a.stops[f-1][1];const g=cp(a.stops.map(a=>a[0]),c),h=function(a,b,c,d){const f=d-c,g=a-c;return 0===f?0:1===b?g/f:(Math.pow(b,g)-1)/(Math.pow(b,f)-1)}(c,d,a.stops[g][0],a.stops[g+1][0]),i=a.stops[g][1],j=a.stops[g+1][1];let k=cs[b.type]||db;if(a.colorSpace&&"rgb"!==a.colorSpace){const l=cG[a.colorSpace];k=(a,b)=>l.reverse(l.interpolate(l.forward(a),l.forward(b),h))}return"function"==typeof i.evaluate?{evaluate(...a){const b=i.evaluate.apply(void 0,a),c=j.evaluate.apply(void 0,a);if(void 0!==b&& void 0!==c)return k(b,c,h)}}:k(i,j,h)}function dh(a,b,c){return"color"===b.type?c=bK.parse(c):"formatted"===b.type?c=bN.fromString(c.toString()):"resolvedImage"===b.type?c=bO.fromString(c.toString()):c9(c)===b.type||"enum"===b.type&&b.values[c]||(c=void 0),dd(c,a.default,b.default)}b1.register(c0,{error:[{kind:"error"},[bu],(a,[b])=>{throw new bU(b.evaluate(a))},],typeof:[bu,[by],(a,[b])=>bD(bR(b.evaluate(a))),],"to-rgba":[bC(bt,4),[bw],(a,[b])=>b.evaluate(a).toArray(),],rgb:[bw,[bt,bt,bt],c1],rgba:[bw,[bt,bt,bt,bt],c1],has:{type:bv,overloads:[[[bu],(a,[b])=>{var c,d;return c=b.evaluate(a),d=a.properties(),c in d},],[[bu,bx],(a,[b,c])=>b.evaluate(a) in c.evaluate(a),],]},get:{type:by,overloads:[[[bu],(a,[b])=>c2(b.evaluate(a),a.properties()),],[[bu,bx],(a,[b,c])=>c2(b.evaluate(a),c.evaluate(a)),],]},"feature-state":[by,[bu],(a,[b])=>c2(b.evaluate(a),a.featureState||{}),],properties:[bx,[],a=>a.properties()],"geometry-type":[bu,[],a=>a.geometryType()],id:[by,[],a=>a.id()],zoom:[bt,[],a=>a.globals.zoom],pitch:[bt,[],a=>a.globals.pitch||0],"distance-from-center":[bt,[],a=>a.distanceFromCenter(),],"heatmap-density":[bt,[],a=>a.globals.heatmapDensity||0,],"line-progress":[bt,[],a=>a.globals.lineProgress||0,],"sky-radial-progress":[bt,[],a=>a.globals.skyRadialProgress||0,],accumulated:[by,[],a=>void 0===a.globals.accumulated?null:a.globals.accumulated,],"+":[bt,c3(bt),(a,b)=>{let c=0;for(const d of b)c+=d.evaluate(a);return c},],"*":[bt,c3(bt),(a,b)=>{let c=1;for(const d of b)c*=d.evaluate(a);return c},],"-":{type:bt,overloads:[[[bt,bt],(a,[b,c])=>b.evaluate(a)-c.evaluate(a),],[[bt],(a,[b])=>-b.evaluate(a)],]},"/":[bt,[bt,bt],(a,[b,c])=>b.evaluate(a)/c.evaluate(a),],"%":[bt,[bt,bt],(a,[b,c])=>b.evaluate(a)%c.evaluate(a),],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(a,[b,c])=>Math.pow(b.evaluate(a),c.evaluate(a)),],sqrt:[bt,[bt],(a,[b])=>Math.sqrt(b.evaluate(a)),],log10:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))/Math.LN10,],ln:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))],log2:[bt,[bt],(a,[b])=>Math.log(b.evaluate(a))/Math.LN2,],sin:[bt,[bt],(a,[b])=>Math.sin(b.evaluate(a)),],cos:[bt,[bt],(a,[b])=>Math.cos(b.evaluate(a)),],tan:[bt,[bt],(a,[b])=>Math.tan(b.evaluate(a)),],asin:[bt,[bt],(a,[b])=>Math.asin(b.evaluate(a)),],acos:[bt,[bt],(a,[b])=>Math.acos(b.evaluate(a)),],atan:[bt,[bt],(a,[b])=>Math.atan(b.evaluate(a)),],min:[bt,c3(bt),(a,b)=>Math.min(...b.map(b=>b.evaluate(a))),],max:[bt,c3(bt),(a,b)=>Math.max(...b.map(b=>b.evaluate(a))),],abs:[bt,[bt],(a,[b])=>Math.abs(b.evaluate(a)),],round:[bt,[bt],(a,[b])=>{const c=b.evaluate(a);return c<0?-Math.round(-c):Math.round(c)},],floor:[bt,[bt],(a,[b])=>Math.floor(b.evaluate(a)),],ceil:[bt,[bt],(a,[b])=>Math.ceil(b.evaluate(a)),],"filter-==":[bv,[bu,by],(a,[b,c])=>a.properties()[b.value]===c.value,],"filter-id-==":[bv,[by],(a,[b])=>a.id()===b.value,],"filter-type-==":[bv,[bu],(a,[b])=>a.geometryType()===b.value,],"filter-<":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d{const c=a.id(),d=b.value;return typeof c==typeof d&&c":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d>f},],"filter-id->":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c>d},],"filter-<=":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d<=f},],"filter-id-<=":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c<=d},],"filter->=":[bv,[bu,by],(a,[b,c])=>{const d=a.properties()[b.value],f=c.value;return typeof d==typeof f&&d>=f},],"filter-id->=":[bv,[by],(a,[b])=>{const c=a.id(),d=b.value;return typeof c==typeof d&&c>=d},],"filter-has":[bv,[by],(a,[b])=>b.value in a.properties(),],"filter-has-id":[bv,[],a=>null!==a.id()&& void 0!==a.id(),],"filter-type-in":[bv,[bC(bu)],(a,[b])=>b.value.indexOf(a.geometryType())>=0,],"filter-id-in":[bv,[bC(by)],(a,[b])=>b.value.indexOf(a.id())>=0,],"filter-in-small":[bv,[bu,bC(by)],(a,[b,c])=>c.value.indexOf(a.properties()[b.value])>=0,],"filter-in-large":[bv,[bu,bC(by)],(a,[b,c])=>(function(a,b,c,d){for(;c<=d;){const f=c+d>>1;if(b[f]===a)return!0;b[f]>a?d=f-1:c=f+1}return!1})(a.properties()[b.value],c.value,0,c.value.length-1),],all:{type:bv,overloads:[[[bv,bv],(a,[b,c])=>b.evaluate(a)&&c.evaluate(a),],[c3(bv),(a,b)=>{for(const c of b)if(!c.evaluate(a))return!1;return!0},],]},any:{type:bv,overloads:[[[bv,bv],(a,[b,c])=>b.evaluate(a)||c.evaluate(a),],[c3(bv),(a,b)=>{for(const c of b)if(c.evaluate(a))return!0;return!1},],]},"!":[bv,[bv],(a,[b])=>!b.evaluate(a)],"is-supported-script":[bv,[bu],(a,[b])=>{const c=a.globals&&a.globals.isSupportedScript;return!c||c(b.evaluate(a))},],upcase:[bu,[bu],(a,[b])=>b.evaluate(a).toUpperCase(),],downcase:[bu,[bu],(a,[b])=>b.evaluate(a).toLowerCase(),],concat:[bu,c3(by),(a,b)=>b.map(b=>bS(b.evaluate(a))).join(""),],"resolved-locale":[bu,[bz],(a,[b])=>b.evaluate(a).resolvedLocale(),]});class di{constructor(a,b){var c;this.expression=a,this._warningHistory={},this._evaluator=new b0,this._defaultValue=b?"color"===(c=b).type&&da(c.default)?new bK(0,0,0,0):"color"===c.type?bK.parse(c.default)||null:void 0===c.default?null:c.default:null,this._enumValues=b&&"enum"===b.type?b.values:null}evaluateWithoutErrorHandling(a,b,c,d,f,g,h,i){return this._evaluator.globals=a,this._evaluator.feature=b,this._evaluator.featureState=c,this._evaluator.canonical=d,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=g,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=i||null,this.expression.evaluate(this._evaluator)}evaluate(a,b,c,d,f,g,h,i){this._evaluator.globals=a,this._evaluator.feature=b||null,this._evaluator.featureState=c||null,this._evaluator.canonical=d,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=g||null,this._evaluator.featureTileCoord=h||null,this._evaluator.featureDistanceData=i||null;try{const j=this.expression.evaluate(this._evaluator);if(null==j||"number"==typeof j&&j!=j)return this._defaultValue;if(this._enumValues&&!(j in this._enumValues))throw new bU(`Expected value to be one of ${Object.keys(this._enumValues).map(a=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(j)} instead.`);return j}catch(k){return this._warningHistory[k.message]||(this._warningHistory[k.message]=!0,"undefined"!=typeof console&&console.warn(k.message)),this._defaultValue}}}function dj(a){return Array.isArray(a)&&a.length>0&&"string"==typeof a[0]&&a[0]in c0}function dk(a,b){const c=new cn(c0,[],b?function(a){const b={color:bw,string:bu,number:bt,enum:bu,boolean:bv,formatted:bA,resolvedImage:bB};return"array"===a.type?bC(b[a.value]||by,a.length):b[a.type]}(b):void 0),d=c.parse(a,void 0,void 0,void 0,b&&"string"===b.type?{typeAnnotation:"coerce"}:void 0);return d?c4(new di(d,b)):c5(c.errors)}class dl{constructor(a,b){this.kind=a,this._styleExpression=b,this.isStateDependent="constant"!==a&&!ck(b.expression)}evaluateWithoutErrorHandling(a,b,c,d,f,g){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,f,g)}evaluate(a,b,c,d,f,g){return this._styleExpression.evaluate(a,b,c,d,f,g)}}class dm{constructor(a,b,c,d){this.kind=a,this.zoomStops=c,this._styleExpression=b,this.isStateDependent="camera"!==a&&!ck(b.expression),this.interpolationType=d}evaluateWithoutErrorHandling(a,b,c,d,f,g){return this._styleExpression.evaluateWithoutErrorHandling(a,b,c,d,f,g)}evaluate(a,b,c,d,f,g){return this._styleExpression.evaluate(a,b,c,d,f,g)}interpolationFactor(a,b,c){return this.interpolationType?cH.interpolationFactor(this.interpolationType,a,b,c):0}}function dn(a,b){if("error"===(a=dk(a,b)).result)return a;const c=a.value.expression,d=cj(c);if(!d&&!c6(b))return c5([new bq("","data expressions not supported"),]);const f=cl(c,["zoom","pitch","distance-from-center",]);if(!f&&!c7(b))return c5([new bq("","zoom expressions not supported"),]);const g=dq(c);return g||f?g instanceof bq?c5([g]):g instanceof cH&&!c8(b)?c5([new bq("",'"interpolate" expressions cannot be used with this property'),]):c4(g?new dm(d?"camera":"composite",a.value,g.labels,g instanceof cH?g.interpolation:void 0):new dl(d?"constant":"source",a.value)):c5([new bq("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'),])}class dp{constructor(a,b){this._parameters=a,this._specification=b,bn(this,dc(this._parameters,this._specification))}static deserialize(a){return new dp(a._parameters,a._specification)}static serialize(a){return{_parameters:a._parameters,_specification:a._specification}}}function dq(a){let b=null;if(a instanceof cK)b=dq(a.result);else if(a instanceof cJ){for(const c of a.args)if(b=dq(c))break}else(a instanceof cq||a instanceof cH)&&a.input instanceof b1&&"zoom"===a.input.name&&(b=a);return b instanceof bq||a.eachChild(a=>{const c=dq(a);c instanceof bq?b=c:!b&&c?b=new bq("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):b&&c&&b!==c&&(b=new bq("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),b}function dr(a){const b=a.key,c=a.value,d=a.valueSpec||{},f=a.objectElementValidators||{},g=a.style,h=a.styleSpec;let i=[];const j=c9(c);if("object"!==j)return[new bl(b,c,`object expected, ${j} found`),];for(const k in c){const l=k.split(".")[0],m=d[l]||d["*"];let n;if(f[l])n=f[l];else if(d[l])n=dY;else if(f["*"])n=f["*"];else{if(!d["*"]){i.push(new bl(b,c[k],`unknown property "${k}"`));continue}n=dY}i=i.concat(n({key:(b?`${b}.`:b)+k,value:c[k],valueSpec:m,style:g,styleSpec:h,object:c,objectKey:k},c))}for(const o in d)f[o]||d[o].required&& void 0===d[o].default&& void 0===c[o]&&i.push(new bl(b,c,`missing required property "${o}"`));return i}function ds(a){const b=a.value,c=a.valueSpec,d=a.style,f=a.styleSpec,g=a.key,h=a.arrayElementValidator||dY;if("array"!==c9(b))return[new bl(g,b,`array expected, ${c9(b)} found`),];if(c.length&&b.length!==c.length)return[new bl(g,b,`array length ${c.length} expected, length ${b.length} found`),];if(c["min-length"]&&b.lengthh)return[new bl(b,c,`${c} is greater than the maximum value ${h}`),]}return[]}function du(a){const b=a.valueSpec,c=bo(a.value.type);let d,f,g,h={};const i="categorical"!==c&& void 0===a.value.property,j="array"===c9(a.value.stops)&&"array"===c9(a.value.stops[0])&&"object"===c9(a.value.stops[0][0]),k=dr({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(a){if("identity"===c)return[new bl(a.key,a.value,'identity function may not have a "stops" property'),];let b=[];const d=a.value;return b=b.concat(ds({key:a.key,value:d,valueSpec:a.valueSpec,style:a.style,styleSpec:a.styleSpec,arrayElementValidator:l})),"array"===c9(d)&&0===d.length&&b.push(new bl(a.key,d,"array must have at least one stop")),b},default:function(a){return dY({key:a.key,value:a.value,valueSpec:b,style:a.style,styleSpec:a.styleSpec})}}});return"identity"===c&&i&&k.push(new bl(a.key,a.value,'missing required property "property"')),"identity"===c||a.value.stops||k.push(new bl(a.key,a.value,'missing required property "stops"')),"exponential"===c&&a.valueSpec.expression&&!c8(a.valueSpec)&&k.push(new bl(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(i||c6(a.valueSpec)?i&&!c7(a.valueSpec)&&k.push(new bl(a.key,a.value,"zoom functions not supported")):k.push(new bl(a.key,a.value,"property functions not supported"))),("categorical"===c||j)&& void 0===a.value.property&&k.push(new bl(a.key,a.value,'"property" property is required')),k;function l(a){let c=[];const d=a.value,i=a.key;if("array"!==c9(d))return[new bl(i,d,`array expected, ${c9(d)} found`),];if(2!==d.length)return[new bl(i,d,`array length 2 expected, length ${d.length} found`),];if(j){if("object"!==c9(d[0]))return[new bl(i,d,`object expected, ${c9(d[0])} found`),];if(void 0===d[0].zoom)return[new bl(i,d,"object stop key must have zoom"),];if(void 0===d[0].value)return[new bl(i,d,"object stop key must have value"),];if(g&&g>bo(d[0].zoom))return[new bl(i,d[0].zoom,"stop zoom values must appear in ascending order"),];bo(d[0].zoom)!==g&&(g=bo(d[0].zoom),f=void 0,h={}),c=c.concat(dr({key:`${i}[0]`,value:d[0],valueSpec:{zoom:{}},style:a.style,styleSpec:a.styleSpec,objectElementValidators:{zoom:dt,value:m}}))}else c=c.concat(m({key:`${i}[0]`,value:d[0],valueSpec:{},style:a.style,styleSpec:a.styleSpec},d));return dj(bp(d[1]))?c.concat([new bl(`${i}[1]`,d[1],"expressions are not allowed in function stops."),]):c.concat(dY({key:`${i}[1]`,value:d[1],valueSpec:b,style:a.style,styleSpec:a.styleSpec}))}function m(a,g){const i=c9(a.value),j=bo(a.value),k=null!==a.value?a.value:g;if(d){if(i!==d)return[new bl(a.key,k,`${i} stop domain type must match previous stop domain type ${d}`),]}else d=i;if("number"!==i&&"string"!==i&&"boolean"!==i)return[new bl(a.key,k,"stop domain value must be a number, string, or boolean"),];if("number"!==i&&"categorical"!==c){let l=`number expected, ${i} found`;return c6(b)&& void 0===c&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new bl(a.key,k,l)]}return"categorical"!==c||"number"!==i||isFinite(j)&&Math.floor(j)===j?"categorical"!==c&&"number"===i&& void 0!==f&&jnew bl(`${a.key}${b.key}`,a.value,b.message));const c=b.value.expression||b.value._styleExpression.expression;if("property"===a.expressionContext&&"text-font"===a.propertyKey&&!c.outputDefined())return[new bl(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`),];if("property"===a.expressionContext&&"layout"===a.propertyType&&!ck(c))return[new bl(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.'),];if("filter"===a.expressionContext)return dw(c,a);if(a.expressionContext&&0===a.expressionContext.indexOf("cluster")){if(!cl(c,["zoom","feature-state"]))return[new bl(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.'),];if("cluster-initial"===a.expressionContext&&!cj(c))return[new bl(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties."),]}return[]}function dw(a,b){const c=new Set(["zoom","feature-state","pitch","distance-from-center",]);for(const d of b.valueSpec.expression.parameters)c.delete(d);if(0===c.size)return[];const f=[];return a instanceof b1&&c.has(a.name)?[new bl(b.key,b.value,`["${a.name}"] expression is not supported in a filter for a ${b.object.type} layer with id: ${b.object.id}`),]:(a.eachChild(a=>{f.push(...dw(a,b))}),f)}function dx(a){const b=a.key,c=a.value,d=a.valueSpec,f=[];return Array.isArray(d.values)?-1===d.values.indexOf(bo(c))&&f.push(new bl(b,c,`expected one of [${d.values.join(", ")}], ${JSON.stringify(c)} found`)):-1===Object.keys(d.values).indexOf(bo(c))&&f.push(new bl(b,c,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(c)} found`)),f}function dy(a){if(!0===a|| !1===a)return!0;if(!Array.isArray(a)||0===a.length)return!1;switch(a[0]){case"has":return a.length>=2&&"$id"!==a[1]&&"$type"!==a[1];case"in":return a.length>=3&&("string"!=typeof a[1]||Array.isArray(a[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==a.length||Array.isArray(a[1])||Array.isArray(a[2]);case"any":case"all":for(const b of a.slice(1))if(!dy(b)&&"boolean"!=typeof b)return!1;return!0;default:return!0}}function dz(a,b="fill"){if(null==a)return{filter:()=>!0,needGeometry:!1,needFeature:!1};dy(a)||(a=dG(a));const c=a;let d=!0;try{d=function(a){if(!dC(a))return a;let b=bp(a);return dB(b),b=dA(b)}(c)}catch(f){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(c,null,2)} `)}const g=bk[`filter_${b}`],h=dk(d,g);let i=null;if("error"===h.result)throw Error(h.value.map(a=>`${a.key}: ${a.message}`).join(", "));i=(a,b,c)=>h.value.evaluate(a,b,{},c);let j=null,k=null;if(d!==c){const l=dk(c,g);if("error"===l.result)throw Error(l.value.map(a=>`${a.key}: ${a.message}`).join(", "));j=(a,b,c,d,f)=>l.value.evaluate(a,b,{},c,void 0,void 0,d,f),k=!cj(l.value.expression)}return{filter:i,dynamicFilter:j||void 0,needGeometry:dF(d),needFeature:!!k}}function dA(a){if(!Array.isArray(a))return a;const b=function(a){if(dD.has(a[0])){for(let b=1;bdA(a))}function dB(a){let b=!1;const c=[];if("case"===a[0]){for(let d=1;d",">=","<","<=","to-boolean",]);function dE(a,b){return ab?1:0}function dF(a){if(!Array.isArray(a))return!1;if("within"===a[0])return!0;for(let b=1;b"===b||"<="===b||">="===b?dH(a[1],a[2],b):"any"===b?["any"].concat(a.slice(1).map(dG)):"all"===b?["all"].concat(a.slice(1).map(dG)):"none"===b?["all"].concat(a.slice(1).map(dG).map(dK)):"in"===b?dI(a[1],a.slice(2)):"!in"===b?dK(dI(a[1],a.slice(2))):"has"===b?dJ(a[1]):"!has"===b?dK(dJ(a[1])):"within"!==b||a}function dH(a,b,c){switch(a){case"$type":return[`filter-type-${c}`,b];case"$id":return[`filter-id-${c}`,b];default:return[`filter-${c}`,a,b]}}function dI(a,b){if(0===b.length)return!1;switch(a){case"$type":return["filter-type-in",["literal",b]];case"$id":return["filter-id-in",["literal",b]];default:return b.length>200&&!b.some(a=>typeof a!=typeof b[0])?["filter-in-large",a,["literal",b.sort(dE)],]:["filter-in-small",a,["literal",b],]}}function dJ(a){switch(a){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",a]}}function dK(a){return["!",a]}function dL(a){if(dy(bp(a.value))){const b=bp(a.layerType);return dv(bn({},a,{expressionContext:"filter",valueSpec:a.styleSpec[`filter_${b||"fill"}`]}))}return dM(a)}function dM(a){const b=a.value,c=a.key;if("array"!==c9(b))return[new bl(c,b,`array expected, ${c9(b)} found`),];const d=a.styleSpec;let f,g=[];if(b.length<1)return[new bl(c,b,"filter array must have at least 1 element"),];switch(g=g.concat(dx({key:`${c}[0]`,value:b[0],valueSpec:d.filter_operator,style:a.style,styleSpec:a.styleSpec})),bo(b[0])){case"<":case"<=":case">":case">=":b.length>=2&&"$type"===bo(b[1])&&g.push(new bl(c,b,`"$type" cannot be use with operator "${b[0]}"`));case"==":case"!=":3!==b.length&&g.push(new bl(c,b,`filter array for operator "${b[0]}" must have 3 elements`));case"in":case"!in":b.length>=2&&"string"!==(f=c9(b[1]))&&g.push(new bl(`${c}[1]`,b[1],`string expected, ${f} found`));for(let h=2;h{a in c&&b.push(new bl(d,c[a],`"${a}" is prohibited for ref layers`))}),f.layers.forEach(a=>{bo(a.id)===i&&(m=a)}),m?m.ref?b.push(new bl(d,c.ref,"ref cannot reference another ref layer")):h=bo(m.type):b.push(new bl(d,c.ref,`ref layer "${i}" not found`))}else if("background"!==h&&"sky"!==h){if(c.source){const n=f.sources&&f.sources[c.source],o=n&&bo(n.type);n?"vector"===o&&"raster"===h?b.push(new bl(d,c.source,`layer "${c.id}" requires a raster source`)):"raster"===o&&"raster"!==h?b.push(new bl(d,c.source,`layer "${c.id}" requires a vector source`)):"vector"!==o||c["source-layer"]?"raster-dem"===o&&"hillshade"!==h?b.push(new bl(d,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===h&&c.paint&&c.paint["line-gradient"]&&("geojson"!==o||!n.lineMetrics)&&b.push(new bl(d,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):b.push(new bl(d,c,`layer "${c.id}" must specify a "source-layer"`)):b.push(new bl(d,c.source,`source "${c.source}" not found`))}else b.push(new bl(d,c,'missing required property "source"'))}return b=b.concat(dr({key:d,value:c,valueSpec:g.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":()=>[],type:()=>dY({key:`${d}.type`,value:c.type,valueSpec:g.layer.type,style:a.style,styleSpec:a.styleSpec,object:c,objectKey:"type"}),filter:a=>dL(bn({layerType:h},a)),layout:a=>dr({layer:c,key:a.key,value:a.value,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":a=>dP(bn({layerType:h},a))}}),paint:a=>dr({layer:c,key:a.key,value:a.value,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":a=>dO(bn({layerType:h},a))}})}}))}function dR(a){const b=a.value,c=a.key,d=c9(b);return"string"!==d?[new bl(c,b,`string expected, ${d} found`)]:[]}const dS={promoteId:function({key:a,value:b}){if("string"===c9(b))return dR({key:a,value:b});{const c=[];for(const d in b)c.push(...dR({key:`${a}.${d}`,value:b[d]}));return c}}};function dT(a){const b=a.value,c=a.key,d=a.styleSpec,f=a.style;if(!b.type)return[new bl(c,b,'"type" is required')];const g=bo(b.type);let h;switch(g){case"vector":case"raster":case"raster-dem":return dr({key:c,value:b,valueSpec:d[`source_${g.replace("-","_")}`],style:a.style,styleSpec:d,objectElementValidators:dS});case"geojson":if(h=dr({key:c,value:b,valueSpec:d.source_geojson,style:f,styleSpec:d,objectElementValidators:dS}),b.cluster)for(const i in b.clusterProperties){const[j,k]=b.clusterProperties[i],l="string"==typeof j?[j,["accumulated"],["get",i],]:j;h.push(...dv({key:`${c}.${i}.map`,value:k,expressionContext:"cluster-map"})),h.push(...dv({key:`${c}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}return h;case"video":return dr({key:c,value:b,valueSpec:d.source_video,style:f,styleSpec:d});case"image":return dr({key:c,value:b,valueSpec:d.source_image,style:f,styleSpec:d});case"canvas":return[new bl(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return dx({key:`${c}.type`,value:b.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:f,styleSpec:d})}}function dU(a){const b=a.value,c=a.styleSpec,d=c.light,f=a.style;let g=[];const h=c9(b);if(void 0===b)return g;if("object"!==h)return g.concat([new bl("light",b,`object expected, ${h} found`),]);for(const i in b){const j=i.match(/^(.*)-transition$/);g=g.concat(j&&d[j[1]]&&d[j[1]].transition?dY({key:i,value:b[i],valueSpec:c.transition,style:f,styleSpec:c}):d[i]?dY({key:i,value:b[i],valueSpec:d[i],style:f,styleSpec:c}):[new bl(i,b[i],`unknown property "${i}"`),])}return g}function dV(a){const b=a.value,c=a.key,d=a.style,f=a.styleSpec,g=f.terrain;let h=[];const i=c9(b);if(void 0===b)return h;if("object"!==i)return h.concat([new bl("terrain",b,`object expected, ${i} found`),]);for(const j in b){const k=j.match(/^(.*)-transition$/);h=h.concat(k&&g[k[1]]&&g[k[1]].transition?dY({key:j,value:b[j],valueSpec:f.transition,style:d,styleSpec:f}):g[j]?dY({key:j,value:b[j],valueSpec:g[j],style:d,styleSpec:f}):[new bl(j,b[j],`unknown property "${j}"`),])}if(b.source){const l=d.sources&&d.sources[b.source],m=l&&bo(l.type);l?"raster-dem"!==m&&h.push(new bl(c,b.source,`terrain cannot be used with a source of type ${m}, it only be used with a "raster-dem" source type`)):h.push(new bl(c,b.source,`source "${b.source}" not found`))}else h.push(new bl(c,b,'terrain is missing required property "source"'));return h}function dW(a){const b=a.value,c=a.style,d=a.styleSpec,f=d.fog;let g=[];const h=c9(b);if(void 0===b)return g;if("object"!==h)return g.concat([new bl("fog",b,`object expected, ${h} found`),]);for(const i in b){const j=i.match(/^(.*)-transition$/);g=g.concat(j&&f[j[1]]&&f[j[1]].transition?dY({key:i,value:b[i],valueSpec:d.transition,style:c,styleSpec:d}):f[i]?dY({key:i,value:b[i],valueSpec:f[i],style:c,styleSpec:d}):[new bl(i,b[i],`unknown property "${i}"`),])}return g}const dX={"*":()=>[],array:ds,boolean:function(a){const b=a.value,c=a.key,d=c9(b);return"boolean"!==d?[new bl(c,b,`boolean expected, ${d} found`),]:[]},number:dt,color:function(a){const b=a.key,c=a.value,d=c9(c);return"string"!==d?[new bl(b,c,`color expected, ${d} found`),]:null===bJ.parseCSSColor(c)?[new bl(b,c,`color expected, "${c}" found`),]:[]},constants:bm,enum:dx,filter:dL,function:du,layer:dQ,object:dr,source:dT,light:dU,terrain:dV,fog:dW,string:dR,formatted:function(a){return 0===dR(a).length?[]:dv(a)},resolvedImage:function(a){return 0===dR(a).length?[]:dv(a)},projection:function(a){const b=a.value,c=a.styleSpec,d=c.projection,f=a.style;let g=[];const h=c9(b);if("object"===h)for(const i in b)g=g.concat(dY({key:i,value:b[i],valueSpec:d[i],style:f,styleSpec:c}));else"string"!==h&&(g=g.concat([new bl("projection",b,`object or string expected, ${h} found`),]));return g}};function dY(a){const b=a.value,c=a.valueSpec,d=a.styleSpec;return c.expression&&da(bo(b))?du(a):c.expression&&dj(bp(b))?dv(a):c.type&&dX[c.type]?dX[c.type](a):dr(bn({},a,{valueSpec:c.type?d[c.type]:c}))}function dZ(a){const b=a.value,c=a.key,d=dR(a);return d.length||(-1===b.indexOf("{fontstack}")&&d.push(new bl(c,b,'"glyphs" url must include a "{fontstack}" token')),-1===b.indexOf("{range}")&&d.push(new bl(c,b,'"glyphs" url must include a "{range}" token'))),d}function d$(a,b=bk){let c=[];return c=c.concat(dY({key:"",value:a,valueSpec:b.$root,styleSpec:b,style:a,objectElementValidators:{glyphs:dZ,"*":()=>[]}})),a.constants&&(c=c.concat(bm({key:"constants",value:a.constants,style:a,styleSpec:b}))),d_(c)}function d_(a){return[].concat(a).sort((a,b)=>a.line-b.line)}function d0(a){return function(...b){return d_(a.apply(this,b))}}d$.source=d0(dT),d$.light=d0(dU),d$.terrain=d0(dV),d$.fog=d0(dW),d$.layer=d0(dQ),d$.filter=d0(dL),d$.paintProperty=d0(dO),d$.layoutProperty=d0(dP);const d1=d$,d2=d1.light,d3=d1.fog,d4=d1.paintProperty,d5=d1.layoutProperty;function d6(a,b){let c=!1;if(b&&b.length)for(const d of b)a.fire(new bi(Error(d.message))),c=!0;return c}var d7=d8;function d8(a,b,c){var d=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;var f=new Int32Array(this.arrayBuffer);a=f[0],this.d=(b=f[1])+2*(c=f[2]);for(var g=0;g=l[o+0]&&d>=l[o+1])?(h[n]=!0,g.push(k[n])):h[n]=!1}}},d8.prototype._forEachCell=function(a,b,c,d,f,g,h,i){for(var j=this._convertToCellCoord(a),k=this._convertToCellCoord(b),l=this._convertToCellCoord(c),m=this._convertToCellCoord(d),n=j;n<=l;n++)for(var o=k;o<=m;o++){var p=this.d*o+n;if((!i||i(this._convertFromCellCoord(n),this._convertFromCellCoord(o),this._convertFromCellCoord(n+1),this._convertFromCellCoord(o+1)))&&f.call(this,a,b,c,d,p,g,h,i))return}},d8.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},d8.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},d8.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var a=this.cells,b=3+this.cells.length+1+1,c=0,d=0;d=0)continue;const k=a[j];i[j]=eb[h].shallow.indexOf(j)>=0?k:eg(k,b)}a instanceof Error&&(i.message=a.message)}if(i.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==h&&(i.$name=h),i}throw Error("can't serialize object of type "+typeof a)}function eh(a){if(null==a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||ee(a)||ef(a)||ArrayBuffer.isView(a)||a instanceof d9)return a;if(Array.isArray(a))return a.map(eh);if("object"==typeof a){const b=a.$name||"Object",{klass:c}=eb[b];if(!c)throw Error(`can't deserialize unregistered class ${b}`);if(c.deserialize)return c.deserialize(a);const d=Object.create(c.prototype);for(const f of Object.keys(a)){if("$name"===f)continue;const g=a[f];d[f]=eb[b].shallow.indexOf(f)>=0?g:eh(g)}return d}throw Error("can't deserialize object of type "+typeof a)}class ei{constructor(){this.first=!0}update(a,b){const c=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=c,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=c,!0):(this.lastFloorZoom>c?(this.lastIntegerZoom=c+1,this.lastIntegerZoomTime=b):this.lastFloorZooma>=1536&&a<=1791,ek=a=>a>=1872&&a<=1919,el=a=>a>=2208&&a<=2303,em=a=>a>=11904&&a<=12031,en=a=>a>=12032&&a<=12255,eo=a=>a>=12272&&a<=12287,ep=a=>a>=12288&&a<=12351,eq=a=>a>=12352&&a<=12447,er=a=>a>=12448&&a<=12543,es=a=>a>=12544&&a<=12591,et=a=>a>=12704&&a<=12735,eu=a=>a>=12736&&a<=12783,ev=a=>a>=12784&&a<=12799,ew=a=>a>=12800&&a<=13055,ex=a=>a>=13056&&a<=13311,ey=a=>a>=13312&&a<=19903,ez=a=>a>=19968&&a<=40959,eA=a=>a>=40960&&a<=42127,eB=a=>a>=42128&&a<=42191,eC=a=>a>=44032&&a<=55215,eD=a=>a>=63744&&a<=64255,eE=a=>a>=64336&&a<=65023,eF=a=>a>=65040&&a<=65055,eG=a=>a>=65072&&a<=65103,eH=a=>a>=65104&&a<=65135,eI=a=>a>=65136&&a<=65279,eJ=a=>a>=65280&&a<=65519;function eK(a){for(const b of a)if(eN(b.charCodeAt(0)))return!0;return!1}function eL(a){for(const b of a)if(!eM(b.charCodeAt(0)))return!1;return!0}function eM(a){return!(ej(a)||ek(a)||el(a)||eE(a)||eI(a))}function eN(a){var b,c,d,f,g,h,i,j;return!(746!==a&&747!==a&&(a<4352||!(et(a)||es(a)||eG(a)&&!(a>=65097&&a<=65103)||eD(a)||ex(a)||em(a)||eu(a)||!(!ep(a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||ey(a)||ez(a)||ew(a)||(b=a)>=12592&&b<=12687||(c=a)>=43360&&c<=43391||(d=a)>=55216&&d<=55295||(f=a)>=4352&&f<=4607||eC(a)||eq(a)||eo(a)||(g=a)>=12688&&g<=12703||en(a)||ev(a)||er(a)&&12540!==a||!(!eJ(a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||!(!eH(a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(h=a)>=5120&&h<=5759||(i=a)>=6320&&i<=6399||eF(a)||(j=a)>=19904&&j<=19967||eA(a)||eB(a))))}function eO(a){var b,c,d,f,g,h,i,j,k,l,m,n,o;return!(eN(a)||(c=b=a)>=128&&c<=255&&(167===b||169===b||174===b||177===b||188===b||189===b||190===b||215===b||247===b)||(d=b)>=8192&&d<=8303&&(8214===b||8224===b||8225===b||8240===b||8241===b||8251===b||8252===b||8258===b||8263===b||8264===b||8265===b||8273===b)||(f=b)>=8448&&f<=8527||(g=b)>=8528&&g<=8591||(h=b)>=8960&&h<=9215&&(b>=8960&&b<=8967||b>=8972&&b<=8991||b>=8996&&b<=9e3||9003===b||b>=9085&&b<=9114||b>=9150&&b<=9165||9167===b||b>=9169&&b<=9179||b>=9186&&b<=9215)||(i=b)>=9216&&i<=9279&&9251!==b||(j=b)>=9280&&j<=9311||(k=b)>=9312&&k<=9471||(l=b)>=9632&&l<=9727||(m=b)>=9728&&m<=9983&&!(b>=9754&&b<=9759)||(n=b)>=11008&&n<=11263&&(b>=11026&&b<=11055||b>=11088&&b<=11097||b>=11192&&b<=11243)||ep(b)||er(b)||(o=b)>=57344&&o<=63743||eG(b)||eH(b)||eJ(b)||8734===b||8756===b||8757===b||b>=9984&&b<=10087||b>=10102&&b<=10131||65532===b||65533===b)}function eP(a){return a>=1424&&a<=2303||eE(a)||eI(a)}function eQ(a,b){var c;return!(!b&&eP(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||(c=a)>=6016&&c<=6143)}function eR(a){for(const b of a)if(eP(b.charCodeAt(0)))return!0;return!1}const eS="deferred",eT="loading",eU="loaded";let eV=null,eW="unavailable",eX=null;const eY=function(a){a&&"string"==typeof a&&a.indexOf("NetworkError")> -1&&(eW="error"),eV&&eV(a)};function eZ(){e$.fire(new bh("pluginStateChange",{pluginStatus:eW,pluginURL:eX}))}const e$=new bj,e_=function(){return eW},e0=function(){if(eW!==eS||!eX)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");eW=eT,eZ(),eX&&a7({url:eX},a=>{a?eY(a):(eW=eU,eZ())})},e1={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>eW===eU||null!=e1.applyArabicShaping,isLoading:()=>eW===eT,setState(a){eW=a.pluginStatus,eX=a.pluginURL},isParsed:()=>null!=e1.applyArabicShaping&&null!=e1.processBidirectionalText&&null!=e1.processStyledBidirectionalText,getPluginURL:()=>eX};class e2{constructor(a,b){this.zoom=a,b?(this.now=b.now,this.fadeDuration=b.fadeDuration,this.zoomHistory=b.zoomHistory,this.transition=b.transition,this.pitch=b.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ei,this.transition={},this.pitch=0)}isSupportedScript(a){return function(a,b){for(const c of a)if(!eQ(c.charCodeAt(0),b))return!1;return!0}(a,e1.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const a=this.zoom,b=a-Math.floor(a),c=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:b+(1-b)*c}:{fromScale:.5,toScale:1,t:1-(1-c)*b}}}class e3{constructor(a,b){this.property=a,this.value=b,this.expression=function(a,b){if(da(a))return new dp(a,b);if(dj(a)){const c=dn(a,b);if("error"===c.result)throw Error(c.value.map(a=>`${a.key}: ${a.message}`).join(", "));return c.value}{let d=a;return"string"==typeof a&&"color"===b.type&&(d=bK.parse(a)),{kind:"constant",evaluate:()=>d}}}(void 0===b?a.specification.default:b,a.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(a,b,c){return this.property.possiblyEvaluate(this,a,b,c)}}class e4{constructor(a){this.property=a,this.value=new e3(a,void 0)}transitioned(a,b){return new e6(this.property,this.value,b,aa({},a.transition,this.transition),a.now)}untransitioned(){return new e6(this.property,this.value,null,{},0)}}class e5{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return ak(this._values[a].value.value)}setValue(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new e4(this._values[a].property)),this._values[a].value=new e3(this._values[a].property,null===b?void 0:ak(b))}getTransition(a){return ak(this._values[a].transition)}setTransition(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new e4(this._values[a].property)),this._values[a].transition=ak(b)||void 0}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c);const d=this.getTransition(b);void 0!==d&&(a[`${b}-transition`]=d)}return a}transitioned(a,b){const c=new e7(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].transitioned(a,b._values[d]);return c}untransitioned(){const a=new e7(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].untransitioned();return a}}class e6{constructor(a,b,c,d,f){const g=d.delay||0,h=d.duration||0;f=f||0,this.property=a,this.value=b,this.begin=f+g,this.end=this.begin+h,a.specification.transition&&(d.delay||d.duration)&&(this.prior=c)}possiblyEvaluate(a,b,c){const d=a.now||0,f=this.value.possiblyEvaluate(a,b,c),g=this.prior;if(g){if(d>this.end||this.value.isDataDriven())return this.prior=null,f;if(dd.zoomHistory.lastIntegerZoom?{from:a,to:b,other:c}:{from:c,to:b,other:a}}interpolate(a){return a}}class fd{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){if(void 0!==a.value){if("constant"===a.expression.kind){const f=a.expression.evaluate(b,null,{},c,d);return this._calculate(f,f,f,b)}return this._calculate(a.expression.evaluate(new e2(Math.floor(b.zoom-1),b)),a.expression.evaluate(new e2(Math.floor(b.zoom),b)),a.expression.evaluate(new e2(Math.floor(b.zoom+1),b)),b)}}_calculate(a,b,c,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:a,to:b}:{from:c,to:b}}interpolate(a){return a}}class fe{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){return!!a.expression.evaluate(b,null,{},c,d)}interpolate(){return!1}}class ff{constructor(a){for(const b in this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],a){const c=a[b];c.specification.overridable&&this.overridableProperties.push(b);const d=this.defaultPropertyValues[b]=new e3(c,void 0),f=this.defaultTransitionablePropertyValues[b]=new e4(c);this.defaultTransitioningPropertyValues[b]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[b]=d.possiblyEvaluate({})}}}function fg(a,b){return 256*(a=X(Math.floor(a),0,255))+X(Math.floor(b),0,255)}ec("DataDrivenProperty",fb),ec("DataConstantProperty",fa),ec("CrossFadedDataDrivenProperty",fc),ec("CrossFadedProperty",fd),ec("ColorRampProperty",fe);const fh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fi{constructor(a,b){this._structArray=a,this._pos1=b*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class fj{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,b){return a._trim(),b&&(a.isTransferred=!0,b.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(a){const b=Object.create(this.prototype);return b.arrayBuffer=a.arrayBuffer,b.length=a.length,b.capacity=a.arrayBuffer.byteLength/b.bytesPerElement,b._refreshViews(),b}_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(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const b=this.uint8;this._refreshViews(),b&&this.uint8.set(b)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function fk(a,b=1){let c=0,d=0;return{members:a.map(a=>{const f=fh[a.type].BYTES_PER_ELEMENT,g=c=fl(c,Math.max(b,f)),h=a.components||1;return d=Math.max(d,f),c+=f*h,{name:a.name,type:a.type,components:h,offset:g}}),size:fl(c,Math.max(d,b)),alignment:b}}function fl(a,b){return Math.ceil(a/b)*b}class fm extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.int16[d+0]=b,this.int16[d+1]=c,a}}fm.prototype.bytesPerElement=4,ec("StructArrayLayout2i4",fm);class fn extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=4*a;return this.int16[g+0]=b,this.int16[g+1]=c,this.int16[g+2]=d,this.int16[g+3]=f,a}}fn.prototype.bytesPerElement=8,ec("StructArrayLayout4i8",fn);class fo extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=6*a,k=12*a,l=3*a;return this.int16[j+0]=b,this.int16[j+1]=c,this.uint8[k+4]=d,this.uint8[k+5]=f,this.uint8[k+6]=g,this.uint8[k+7]=h,this.float32[l+2]=i,a}}fo.prototype.bytesPerElement=12,ec("StructArrayLayout2i4ub1f12",fo);class fp extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.float32[f+0]=b,this.float32[f+1]=c,this.float32[f+2]=d,a}}fp.prototype.bytesPerElement=12,ec("StructArrayLayout3f12",fp);class fq extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i,j,k){const l=this.length;return this.resize(l+1),this.emplace(l,a,b,c,d,f,g,h,i,j,k)}emplace(a,b,c,d,f,g,h,i,j,k,l){const m=10*a;return this.uint16[m+0]=b,this.uint16[m+1]=c,this.uint16[m+2]=d,this.uint16[m+3]=f,this.uint16[m+4]=g,this.uint16[m+5]=h,this.uint16[m+6]=i,this.uint16[m+7]=j,this.uint16[m+8]=k,this.uint16[m+9]=l,a}}fq.prototype.bytesPerElement=20,ec("StructArrayLayout10ui20",fq);class fr extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i){const j=this.length;return this.resize(j+1),this.emplace(j,a,b,c,d,f,g,h,i)}emplace(a,b,c,d,f,g,h,i,j){const k=8*a;return this.uint16[k+0]=b,this.uint16[k+1]=c,this.uint16[k+2]=d,this.uint16[k+3]=f,this.uint16[k+4]=g,this.uint16[k+5]=h,this.uint16[k+6]=i,this.uint16[k+7]=j,a}}fr.prototype.bytesPerElement=16,ec("StructArrayLayout8ui16",fr);class fs extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q){const r=this.length;return this.resize(r+1),this.emplace(r,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r){const s=16*a;return this.int16[s+0]=b,this.int16[s+1]=c,this.int16[s+2]=d,this.int16[s+3]=f,this.uint16[s+4]=g,this.uint16[s+5]=h,this.uint16[s+6]=i,this.uint16[s+7]=j,this.int16[s+8]=k,this.int16[s+9]=l,this.int16[s+10]=m,this.int16[s+11]=n,this.int16[s+12]=o,this.int16[s+13]=p,this.int16[s+14]=q,this.int16[s+15]=r,a}}fs.prototype.bytesPerElement=32,ec("StructArrayLayout4i4ui4i4i32",fs);class ft extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.uint32[1*a+0]=b,a}}ft.prototype.bytesPerElement=4,ec("StructArrayLayout1ul4",ft);class fu extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n){const o=this.length;return this.resize(o+1),this.emplace(o,a,b,c,d,f,g,h,i,j,k,l,m,n)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o){const p=20*a,q=10*a;return this.int16[p+0]=b,this.int16[p+1]=c,this.int16[p+2]=d,this.int16[p+3]=f,this.int16[p+4]=g,this.float32[q+3]=h,this.float32[q+4]=i,this.float32[q+5]=j,this.float32[q+6]=k,this.int16[p+14]=l,this.uint32[q+8]=m,this.uint16[p+18]=n,this.uint16[p+19]=o,a}}fu.prototype.bytesPerElement=40,ec("StructArrayLayout5i4f1i1ul2ui40",fu);class fv extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=8*a;return this.int16[j+0]=b,this.int16[j+1]=c,this.int16[j+2]=d,this.int16[j+4]=f,this.int16[j+5]=g,this.int16[j+6]=h,this.int16[j+7]=i,a}}fv.prototype.bytesPerElement=16,ec("StructArrayLayout3i2i2i16",fv);class fw extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f){const g=this.length;return this.resize(g+1),this.emplace(g,a,b,c,d,f)}emplace(a,b,c,d,f,g){const h=4*a,i=8*a;return this.float32[h+0]=b,this.float32[h+1]=c,this.float32[h+2]=d,this.int16[i+6]=f,this.int16[i+7]=g,a}}fw.prototype.bytesPerElement=16,ec("StructArrayLayout2f1f2i16",fw);class fx extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=12*a,h=3*a;return this.uint8[g+0]=b,this.uint8[g+1]=c,this.float32[h+1]=d,this.float32[h+2]=f,a}}fx.prototype.bytesPerElement=12,ec("StructArrayLayout2ub2f12",fx);class fy extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.uint16[f+0]=b,this.uint16[f+1]=c,this.uint16[f+2]=d,a}}fy.prototype.bytesPerElement=6,ec("StructArrayLayout3ui6",fy);class fz extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w){const x=this.length;return this.resize(x+1),this.emplace(x,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x){const y=30*a,z=15*a,A=60*a;return this.int16[y+0]=b,this.int16[y+1]=c,this.int16[y+2]=d,this.float32[z+2]=f,this.float32[z+3]=g,this.uint16[y+8]=h,this.uint16[y+9]=i,this.uint32[z+5]=j,this.uint32[z+6]=k,this.uint32[z+7]=l,this.uint16[y+16]=m,this.uint16[y+17]=n,this.uint16[y+18]=o,this.float32[z+10]=p,this.float32[z+11]=q,this.uint8[A+48]=r,this.uint8[A+49]=s,this.uint8[A+50]=u,this.uint32[z+13]=v,this.int16[y+28]=w,this.uint8[A+58]=x,a}}fz.prototype.bytesPerElement=60,ec("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",fz);class fA extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F){const G=this.length;return this.resize(G+1),this.emplace(G,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F,G){const H=38*a,I=19*a;return this.int16[H+0]=b,this.int16[H+1]=c,this.int16[H+2]=d,this.float32[I+2]=f,this.float32[I+3]=g,this.int16[H+8]=h,this.int16[H+9]=i,this.int16[H+10]=j,this.int16[H+11]=k,this.int16[H+12]=l,this.int16[H+13]=m,this.uint16[H+14]=n,this.uint16[H+15]=o,this.uint16[H+16]=p,this.uint16[H+17]=q,this.uint16[H+18]=r,this.uint16[H+19]=s,this.uint16[H+20]=u,this.uint16[H+21]=v,this.uint16[H+22]=w,this.uint16[H+23]=x,this.uint16[H+24]=y,this.uint16[H+25]=z,this.uint16[H+26]=A,this.uint16[H+27]=B,this.uint16[H+28]=C,this.uint32[I+15]=D,this.float32[I+16]=E,this.float32[I+17]=F,this.float32[I+18]=G,a}}fA.prototype.bytesPerElement=76,ec("StructArrayLayout3i2f6i15ui1ul3f76",fA);class fB extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.float32[1*a+0]=b,a}}fB.prototype.bytesPerElement=4,ec("StructArrayLayout1f4",fB);class fC extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.int16[f+0]=b,this.int16[f+1]=c,this.int16[f+2]=d,a}}fC.prototype.bytesPerElement=6,ec("StructArrayLayout3i6",fC);class fD extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=7*a;return this.float32[j+0]=b,this.float32[j+1]=c,this.float32[j+2]=d,this.float32[j+3]=f,this.float32[j+4]=g,this.float32[j+5]=h,this.float32[j+6]=i,a}}fD.prototype.bytesPerElement=28,ec("StructArrayLayout7f28",fD);class fE extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=6*a;return this.uint32[3*a+0]=b,this.uint16[g+2]=c,this.uint16[g+3]=d,this.uint16[g+4]=f,a}}fE.prototype.bytesPerElement=12,ec("StructArrayLayout1ul3ui12",fE);class fF extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.uint16[d+0]=b,this.uint16[d+1]=c,a}}fF.prototype.bytesPerElement=4,ec("StructArrayLayout2ui4",fF);class fG extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.uint16[1*a+0]=b,a}}fG.prototype.bytesPerElement=2,ec("StructArrayLayout1ui2",fG);class fH extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.float32[d+0]=b,this.float32[d+1]=c,a}}fH.prototype.bytesPerElement=8,ec("StructArrayLayout2f8",fH);class fI extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=4*a;return this.float32[g+0]=b,this.float32[g+1]=c,this.float32[g+2]=d,this.float32[g+3]=f,a}}fI.prototype.bytesPerElement=16,ec("StructArrayLayout4f16",fI);class fJ extends fi{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]}}fJ.prototype.size=40;class fK extends fu{get(a){return new fJ(this,a)}}ec("CollisionBoxArray",fK);class fL extends fi{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(a){this._structArray.uint8[this._pos1+49]=a}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(a){this._structArray.uint8[this._pos1+50]=a}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(a){this._structArray.uint32[this._pos4+13]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(a){this._structArray.uint8[this._pos1+58]=a}}fL.prototype.size=60;class fM extends fz{get(a){return new fL(this,a)}}ec("PlacedSymbolArray",fM);class fN extends fi{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(a){this._structArray.uint32[this._pos4+15]=a}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]}}fN.prototype.size=76;class fO extends fA{get(a){return new fN(this,a)}}ec("SymbolInstanceArray",fO);class fP extends fB{getoffsetX(a){return this.float32[1*a+0]}}ec("GlyphOffsetArray",fP);class fQ extends fC{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}ec("SymbolLineVertexArray",fQ);class fR extends fi{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]}}fR.prototype.size=12;class fS extends fE{get(a){return new fR(this,a)}}ec("FeatureIndexArray",fS);class fT extends fi{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}fT.prototype.size=4;class fU extends fF{get(a){return new fT(this,a)}}ec("FillExtrusionCentroidArray",fU);const fV=fk([{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"},]),fW=fk([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var fX=bI(function(a){a.exports=function(a,b){var c,d,f,g,h,i,j,k;for(d=a.length-(c=3&a.length),f=b,h=3432918353,i=461845907,k=0;k>>16)*h&65535)<<16)&4294967295)<<15|j>>>17))*i+(((j>>>16)*i&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(j=0,c){case 3:j^=(255&a.charCodeAt(k+2))<<16;case 2:j^=(255&a.charCodeAt(k+1))<<8;case 1:f^=j=(65535&(j=(j=(65535&(j^=255&a.charCodeAt(k)))*h+(((j>>>16)*h&65535)<<16)&4294967295)<<15|j>>>17))*i+(((j>>>16)*i&65535)<<16)&4294967295}return f^=a.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0}}),fY=bI(function(a){a.exports=function(a,b){for(var c,d=a.length,f=b^d,g=0;d>=4;)c=1540483477*(65535&(c=255&a.charCodeAt(g)|(255&a.charCodeAt(++g))<<8|(255&a.charCodeAt(++g))<<16|(255&a.charCodeAt(++g))<<24))+((1540483477*(c>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++g;switch(d){case 3:f^=(255&a.charCodeAt(g+2))<<16;case 2:f^=(255&a.charCodeAt(g+1))<<8;case 1:f=1540483477*(65535&(f^=255&a.charCodeAt(g)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0}}),fZ=fX;fZ.murmur3=fX,fZ.murmur2=fY;class f${constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,b,c,d){this.ids.push(f_(a)),this.positions.push(b,c,d)}getPositions(a){const b=f_(a);let c=0,d=this.ids.length-1;for(;c>1;this.ids[f]>=b?d=f:c=f+1}const g=[];for(;this.ids[c]===b;)g.push({index:this.positions[3*c],start:this.positions[3*c+1],end:this.positions[3*c+2]}),c++;return g}static serialize(a,b){const c=new Float64Array(a.ids),d=new Uint32Array(a.positions);return f0(c,d,0,c.length-1),b&&b.push(c.buffer,d.buffer),{ids:c,positions:d}}static deserialize(a){const b=new f$;return b.ids=a.ids,b.positions=a.positions,b.indexed=!0,b}}function f_(a){const b=+a;return!isNaN(b)&&Number.MIN_SAFE_INTEGER<=b&&b<=Number.MAX_SAFE_INTEGER?b:fZ(String(a))}function f0(a,b,c,d){for(;c>1];let g=c-1,h=d+1;for(;;){do g++;while(a[g]f)if(g>=h)break;f1(a,g,h),f1(b,3*g,3*h),f1(b,3*g+1,3*h+1),f1(b,3*g+2,3*h+2)}h-c`u_${a}`),this.type=c}setUniform(a,b,c){a.set(c.constantOr(this.value))}getBinding(a,b,c){return"color"===this.type?new f5(a,b):new f3(a,b)}}class gb{constructor(a,b){this.uniformNames=b.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,b){this.pixelRatioFrom=b.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=b.tl.concat(b.br),this.patternTo=a.tl.concat(a.br)}setUniform(a,b,c,d){const f="u_pattern_to"===d||"u_dash_to"===d?this.patternTo:"u_pattern_from"===d||"u_dash_from"===d?this.patternFrom:"u_pixel_ratio_to"===d?this.pixelRatioTo:"u_pixel_ratio_from"===d?this.pixelRatioFrom:null;f&&a.set(f)}getBinding(a,b,c){return"u_pattern_from"===c||"u_pattern_to"===c||"u_dash_from"===c||"u_dash_to"===c?new f4(a,b):new f3(a,b)}}class gc{constructor(a,b,c,d){this.expression=a,this.type=c,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(a,b,c,d,f,g){const h=this.paintVertexArray.length,i=this.expression.evaluate(new e2(0),b,{},f,d,g);this.paintVertexArray.resize(a),this._setPaintValue(h,a,i)}updatePaintArray(a,b,c,d,f){const g=this.expression.evaluate({zoom:0},c,d,void 0,f);this._setPaintValue(a,b,g)}_setPaintValue(a,b,c){if("color"===this.type){const d=f9(c);for(let f=a;f`u_${a}_t`),this.type=c,this.useIntegerZoom=d,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?4:2,offset:0})),this.paintVertexArray=new g}populatePaintArray(a,b,c,d,f,g){const h=this.expression.evaluate(new e2(this.zoom),b,{},f,d,g),i=this.expression.evaluate(new e2(this.zoom+1),b,{},f,d,g),j=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(j,a,h,i)}updatePaintArray(a,b,c,d,f){const g=this.expression.evaluate({zoom:this.zoom},c,d,void 0,f),h=this.expression.evaluate({zoom:this.zoom+1},c,d,void 0,f);this._setPaintValue(a,b,g,h)}_setPaintValue(a,b,c,d){if("color"===this.type){const f=f9(c),g=f9(d);for(let h=a;h!0){this.binders={},this._buffers=[];const d=[];for(const f in a.paint._values){if(!c(f))continue;const g=a.paint.get(f);if(!(g instanceof e8&&c6(g.property.specification)))continue;const h=gi(f,a.type),i=g.value,j=g.property.specification.type,k=g.property.useIntegerZoom,l=g.property.specification["property-type"],m="cross-faded"===l||"cross-faded-data-driven"===l,n="line-dasharray"===String(f)&&"constant"!==a.layout.get("line-cap").value.kind;if("constant"!==i.kind||n){if("source"===i.kind||n||m){const o=gl(f,j,"source");this.binders[f]=m?new ge(i,h,j,k,b,o,a.id):new gc(i,h,j,o),d.push(`/a_${f}`)}else{const p=gl(f,j,"composite");this.binders[f]=new gd(i,h,j,k,b,p),d.push(`/z_${f}`)}}else this.binders[f]=m?new gb(i.value,h):new ga(i.value,h,j),d.push(`/u_${f}`)}this.cacheKey=d.sort().join("")}getMaxValue(a){const b=this.binders[a];return b instanceof gc||b instanceof gd?b.maxValue:0}populatePaintArrays(a,b,c,d,f,g){for(const h in this.binders){const i=this.binders[h];(i instanceof gc||i instanceof gd||i instanceof ge)&&i.populatePaintArray(a,b,c,d,f,g)}}setConstantPatternPositions(a,b){for(const c in this.binders){const d=this.binders[c];d instanceof gb&&d.setConstantPatternPositions(a,b)}}updatePaintArrays(a,b,c,d,f,g){let h=!1;for(const i in a){const j=b.getPositions(i);for(const k of j){const l=c.feature(k.index);for(const m in this.binders){const n=this.binders[m];if((n instanceof gc||n instanceof gd||n instanceof ge)&& !0===n.expression.isStateDependent){const o=d.paint.get(m);n.expression=o.value,n.updatePaintArray(k.start,k.end,l,a[i],f,g),h=!0}}}}return h}defines(){const a=[];for(const b in this.binders){const c=this.binders[b];(c instanceof ga||c instanceof gb)&&a.push(...c.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return a}getBinderAttributes(){const a=[];for(const b in this.binders){const c=this.binders[b];if(c instanceof gc||c instanceof gd||c instanceof ge)for(let d=0;d!0){for(const d of(this.programConfigurations={},a))this.programConfigurations[d.id]=new gf(d,b,c);this.needsUpload=!1,this._featureMap=new f$,this._bufferOffset=0}populatePaintArrays(a,b,c,d,f,g,h){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(a,b,d,f,g,h);void 0!==b.id&&this._featureMap.add(b.id,c,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,b,c,d,f){for(const g of c)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(a,this._featureMap,b,g,d,f)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(const b in this.programConfigurations)this.programConfigurations[b].upload(a);this.needsUpload=!1}}destroy(){for(const a in this.programConfigurations)this.programConfigurations[a].destroy()}}const gh={"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 gi(a,b){return gh[a]||[a.replace(`${b}-`,"").replace(/-/g,"_"),]}const gj={"line-pattern":{source:fq,composite:fq},"fill-pattern":{source:fq,composite:fq},"fill-extrusion-pattern":{source:fq,composite:fq},"line-dasharray":{source:fr,composite:fr}},gk={color:{source:fH,composite:fI},number:{source:fB,composite:fH}};function gl(a,b,c){const d=gj[a];return d&&d[c]||gk[b][c]}ec("ConstantBinder",ga),ec("CrossFadedConstantBinder",gb),ec("SourceExpressionBinder",gc),ec("CrossFadedCompositeBinder",ge),ec("CompositeExpressionBinder",gd),ec("ProgramConfiguration",gf,{omit:["_buffers"]}),ec("ProgramConfigurationSet",gg);const gm="-transition";class gn extends bj{constructor(a,b){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==a.type&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,"background"!==a.type&&"sky"!==a.type&&(this.source=a.source,this.sourceLayer=a["source-layer"],this.filter=a.filter),b.layout&&(this._unevaluatedLayout=new class{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}getValue(a){return ak(this._values[a].value)}setValue(a,b){this._values[a]=new e3(this._values[a].property,null===b?void 0:ak(b))}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c)}return a}possiblyEvaluate(a,b,c){const d=new e9(this._properties);for(const f of Object.keys(this._values))d._values[f]=this._values[f].possiblyEvaluate(a,b,c);return d}}(b.layout)),b.paint)){for(const c in this._transitionablePaint=new e5(b.paint),a.paint)this.setPaintProperty(c,a.paint[c],{validate:!1});for(const d in a.layout)this.setLayoutProperty(d,a.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new e9(b.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return"visibility"===a?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,b,c={}){null!=b&&this._validate(d5,`layers.${this.id}.layout.${a}`,a,b,c)||("visibility"!==a?this._unevaluatedLayout.setValue(a,b):this.visibility=b)}getPaintProperty(a){return ah(a,gm)?this._transitionablePaint.getTransition(a.slice(0,-gm.length)):this._transitionablePaint.getValue(a)}setPaintProperty(a,b,c={}){if(null!=b&&this._validate(d4,`layers.${this.id}.paint.${a}`,a,b,c))return!1;if(ah(a,gm))return this._transitionablePaint.setTransition(a.slice(0,-gm.length),b||void 0),!1;{const d=this._transitionablePaint._values[a],f="cross-faded-data-driven"===d.property.specification["property-type"],g=d.value.isDataDriven(),h=d.value;this._transitionablePaint.setValue(a,b),this._handleSpecialPaintPropertyUpdate(a);const i=this._transitionablePaint._values[a].value;return i.isDataDriven()||g||f||this._handleOverridablePaintPropertyUpdate(a,h,i)}}_handleSpecialPaintPropertyUpdate(a){}getProgramIds(){return null}getProgramConfiguration(a){return null}_handleOverridablePaintPropertyUpdate(a,b,c){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||"none"===this.visibility}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,b){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,b)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,b)}serialize(){const a={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&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),aj(a,(a,b)=>!(void 0===a||"layout"===b&&!Object.keys(a).length||"paint"===b&&!Object.keys(a).length))}_validate(a,b,c,d,f={}){return(!f|| !1!==f.validate)&&d6(this,a.call(d1,{key:b,layerType:this.type,objectKey:c,value:d,styleSpec:bk,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const a in this.paint._values){const b=this.paint.get(a);if(b instanceof e8&&c6(b.property.specification)&&("source"===b.value.kind||"composite"===b.value.kind)&&b.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=dz(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const go=fk([{name:"a_pos",components:2,type:"Int16"},],4),{members:gp}=go;class gq{constructor(a=[]){this.segments=a}prepareSegment(a,b,c,d){let f=this.segments[this.segments.length-1];return a>gq.MAX_VERTEX_ARRAY_LENGTH&&am(`Max vertices per segment is ${gq.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!f||f.vertexLength+a>gq.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==d)&&(f={vertexOffset:b.length,primitiveOffset:c.length,vertexLength:0,primitiveLength:0},void 0!==d&&(f.sortKey=d),this.segments.push(f)),f}get(){return this.segments}destroy(){for(const a of this.segments)for(const b in a.vaos)a.vaos[b].destroy()}static simpleSegment(a,b,c,d){return new gq([{vertexOffset:a,primitiveOffset:b,vertexLength:c,primitiveLength:d,vaos:{},sortKey:0},])}}gq.MAX_VERTEX_ARRAY_LENGTH=65535,ec("SegmentVector",gq);class gr{constructor(a,b){a&&(b?this.setSouthWest(a).setNorthEast(b):4===a.length?this.setSouthWest([a[0],a[1],]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))}setNorthEast(a){return this._ne=a instanceof gs?new gs(a.lng,a.lat):gs.convert(a),this}setSouthWest(a){return this._sw=a instanceof gs?new gs(a.lng,a.lat):gs.convert(a),this}extend(a){const b=this._sw,c=this._ne;let d,f;if(a instanceof gs)d=a,f=a;else{if(!(a instanceof gr))return Array.isArray(a)?4===a.length||a.every(Array.isArray)?this.extend(gr.convert(a)):this.extend(gs.convert(a)):this;if(d=a._sw,f=a._ne,!d||!f)return this}return b||c?(b.lng=Math.min(d.lng,b.lng),b.lat=Math.min(d.lat,b.lat),c.lng=Math.max(f.lng,c.lng),c.lat=Math.max(f.lat,c.lat)):(this._sw=new gs(d.lng,d.lat),this._ne=new gs(f.lng,f.lat)),this}getCenter(){return new gs((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 gs(this.getWest(),this.getNorth())}getSouthEast(){return new gs(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(a){const{lng:b,lat:c}=gs.convert(a);let d=this._sw.lng<=b&&b<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=b&&b>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&d}static convert(a){return!a||a instanceof gr?a:new gr(a)}}class gs{constructor(a,b){if(isNaN(a)||isNaN(b))throw Error(`Invalid LngLat object: (${a}, ${b})`);if(this.lng=+a,this.lat=+b,this.lat>90||this.lat< -90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new gs(Z(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(a){const b=Math.PI/180,c=this.lat*b,d=a.lat*b,f=Math.sin(c)*Math.sin(d)+Math.cos(c)*Math.cos(d)*Math.cos((a.lng-this.lng)*b);return 6371008.8*Math.acos(Math.min(f,1))}toBounds(a=0){const b=360*a/40075017,c=b/Math.cos(Math.PI/180*this.lat);return new gr(new gs(this.lng-c,this.lat-b),new gs(this.lng+c,this.lat+b))}static convert(a){if(a instanceof gs)return a;if(Array.isArray(a)&&(2===a.length||3===a.length))return new gs(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&"object"==typeof a&&null!==a)return new gs(Number("lng"in a?a.lng:a.lon),Number(a.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const gt=2*Math.PI*6371008.8;function gu(a){return gt*Math.cos(a*Math.PI/180)}function gv(a){return(180+a)/360}function gw(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function gx(a,b){return a/gu(b)}function gy(a){return 360*a-180}function gz(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function gA(a,b){return a*gu(gz(b))}class gB{constructor(a,b,c=0){this.x=+a,this.y=+b,this.z=+c}static fromLngLat(a,b=0){const c=gs.convert(a);return new gB(gv(c.lng),gw(c.lat),b/gu(c.lat))}toLngLat(){return new gs(gy(this.x),gz(this.y))}toAltitude(){return gA(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/gt*(1/Math.cos(gz(this.y)*Math.PI/180))}}function gC(a,b,c,d,f,h,i,j,k){const l=(b+d)/2,m=(c+f)/2,n=new g(l,m);j(n),function(a,b,c,d,f,g){const h=c-f,i=d-g;return Math.abs((d-b)*h-(c-a)*i)/Math.hypot(h,i)}(n.x,n.y,h.x,h.y,i.x,i.y)>=k?(gC(a,b,c,l,m,h,n,j,k),gC(a,l,m,d,f,n,i,j,k)):a.push(i)}function gD(a,b,c){const d=[];let f,g,h;for(const i of a){const{x:j,y:k}=i;b(i),h?gC(d,f,g,j,k,h,i,b,c):d.push(i),f=j,g=k,h=i}return d}const gE=-16383-1;function gF(a,b){const c=Math.round(a.x*b),d=Math.round(a.y*b);return a.x=X(c,gE,16383),a.y=X(d,gE,16383),(ca.x+1||da.y+1)&&am("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function gG(a,b,c){const d=a.loadGeometry(),f=a.extent,g=8192/f;if(b&&c&&c.projection.isReprojectedInTileSpace){const h=1<{const c=gy((b.x+a.x/f)/h),d=gz((b.y+a.y/f)/h),g=l.project(c,d);a.x=(g.x*i-j)*f,a.y=(g.y*i-k)*f};for(let n=0;n=f||p.y<0||p.y>=f||(m(p),o.push(p));d[n]=o}}for(const q of d)for(const r of q)gF(r,g);return d}function gH(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?gG(a):[]}}function gI(a,b,c,d,f){a.emplaceBack(2*b+(d+1)/2,2*c+(f+1)/2)}class gJ{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new fm,this.indexArray=new fy,this.segments=new gq,this.programConfigurations=new gg(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){const f=this.layers[0],g=[];let h=null;for(const{feature:i,id:j,index:k,sourceLayerIndex:l}of("circle"===f.type&&(h=f.layout.get("circle-sort-key")),a)){const m=this.layers[0]._featureFilter.needGeometry,n=gH(i,m);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),n,c))continue;const o=h?h.evaluate(n,{},c):void 0,p={id:j,properties:i.properties,type:i.type,sourceLayerIndex:l,index:k,geometry:m?n.geometry:gG(i,c,d),patterns:{},sortKey:o};g.push(p)}for(const q of(h&&g.sort((a,b)=>a.sortKey-b.sortKey),g)){const{geometry:r,index:s,sourceLayerIndex:u}=q,v=a[s].feature;this.addFeature(q,r,s,b.availableImages,c),b.featureIndex.insert(v,r,s,u,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,gp),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(a,b,c,d,f){for(const g of b)for(const h of g){const i=h.x,j=h.y;if(i<0||i>=8192||j<0||j>=8192)continue;const k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),l=k.vertexLength;gI(this.layoutVertexArray,i,j,-1,-1),gI(this.layoutVertexArray,i,j,1,-1),gI(this.layoutVertexArray,i,j,1,1),gI(this.layoutVertexArray,i,j,-1,1),this.indexArray.emplaceBack(l,l+1,l+2),this.indexArray.emplaceBack(l,l+3,l+2),k.vertexLength+=4,k.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,{},d,f)}}function gK(a,b){for(let c=0;c1){if(gO(a,b))return!0;for(let d=0;d1?c:c.sub(b)._mult(f)._add(b))}function gS(a,b){let c,d,f,g=!1;for(let h=0;hb.y!=f.y>b.y&&b.x<(f.x-d.x)*(b.y-d.y)/(f.y-d.y)+d.x&&(g=!g)}return g}function gT(a,b){let c=!1;for(let d=0,f=a.length-1;db.y!=h.y>b.y&&b.x<(h.x-g.x)*(b.y-g.y)/(h.y-g.y)+g.x&&(c=!c)}return c}function gU(a,b,c,d,f){for(const h of a)if(b<=h.x&&c<=h.y&&d>=h.x&&f>=h.y)return!0;const i=[new g(b,c),new g(b,f),new g(d,f),new g(d,c),];if(a.length>2){for(const j of i)if(gT(a,j))return!0}for(let k=0;kf.x&&b.x>f.x||a.yf.y&&b.y>f.y)return!1;const g=an(a,b,c[0]);return g!==an(a,b,c[1])||g!==an(a,b,c[2])||g!==an(a,b,c[3])}function gW(a,b,c){const d=b.paint.get(a).value;return"constant"===d.kind?d.value:c.programConfigurations.get(b.id).getMaxValue(a)}function gX(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function gY(a,b,c,d,f){if(!b[0]&&!b[1])return a;const h=g.convert(b)._mult(f);"viewport"===c&&h._rotate(-d);const i=[];for(let j=0;j{var g,h,i;const j=K([],c,a),k=1/j[3]/b*f;return g=j,h=j,i=[k,k,d?1/j[3]:k,k],g[0]=h[0]*i[0],g[1]=h[1]*i[1],g[2]=h[2]*i[2],g[3]=h[3]*i[3],g}),h=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(a=>{const b=D([],F([],J([],g[a[0]],g[a[1]]),J([],g[a[2]],g[a[1]]))),c=-E(b,g[a[1]]);return b.concat(c)});return new g0(g,h)}}class g1{constructor(a,b){this.min=a,this.max=b,this.center=B([],x([],this.min,this.max),.5)}quadrant(a){const b=[a%2==0,a<2],c=u(this.min),d=u(this.max);for(let f=0;f=0;if(0===g)return 0;g!==b.length&&(c=!1)}if(c)return 2;for(let i=0;i<3;i++){let j=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(let l=0;lthis.max[i]-this.min[i])return 0}return 1}}function g2(a,b,c,d,f,g,h,i,j){if(g&&a.queryGeometry.isAboveHorizon)return!1;for(const k of(g&&(j*=a.pixelToTileUnitsFactor),b))for(const l of k){const m=l.add(i),n=f&&c.elevation?c.elevation.exaggeration()*f.getElevationAt(m.x,m.y,!0):0,o=g?m:g3(m,n,d),p=g?a.tilespaceRays.map(a=>g6(a,n)):a.queryGeometry.screenGeometry,q=K([],[l.x,l.y,n,1],d);if(!h&&g?j*=q[3]/c.cameraToCenterDistance:h&&!g&&(j*=c.cameraToCenterDistance/q[3]),gL(p,o,j))return!0}return!1}function g3(a,b,c){const d=K([],[a.x,a.y,b,1],c);return new g(d[0]/d[3],d[1]/d[3])}const g4=w(0,0,0),g5=w(0,0,1);function g6(a,b){const c=s();return g4[2]=b,a.intersectsPlane(g4,g5,c),new g(c[0],c[1])}class g7 extends gJ{}function g8(a,{width:b,height:c},d,f){if(f){if(f instanceof Uint8ClampedArray)f=new Uint8Array(f.buffer);else if(f.length!==b*c*d)throw RangeError("mismatched image size")}else f=new Uint8Array(b*c*d);return a.width=b,a.height=c,a.data=f,a}function g9(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const f=g8({},{width:b,height:c},d);ha(a,f,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,b),height:Math.min(a.height,c)},d),a.width=b,a.height=c,a.data=f.data}function ha(a,b,c,d,f,g){if(0===f.width||0===f.height)return b;if(f.width>a.width||f.height>a.height||c.x>a.width-f.width||c.y>a.height-f.height)throw RangeError("out of range source coordinates for image copy");if(f.width>b.width||f.height>b.height||d.x>b.width-f.width||d.y>b.height-f.height)throw RangeError("out of range destination coordinates for image copy");const h=a.data,i=b.data;for(let j=0;j{b[a.evaluationKey]=g;const h=a.expression.evaluate(b);f.data[c+d+0]=Math.floor(255*h.r/h.a),f.data[c+d+1]=Math.floor(255*h.g/h.a),f.data[c+d+2]=Math.floor(255*h.b/h.a),f.data[c+d+3]=Math.floor(255*h.a)};if(a.clips)for(let h=0,i=0;h80*c){d=g=a[0],f=h=a[1];for(var p=c;pg&&(g=i),j>h&&(h=j);k=0!==(k=Math.max(g-d,h-f))?1/k:0}return hm(n,o,c,d,f,k),o}function hk(a,b,c,d,f){var g,h;if(f===hI(a,b,c,d)>0)for(g=b;g=b;g-=d)h=hF(g,a[g],a[g+1],h);return h&&hz(h,h.next)&&(hG(h),h=h.next),h}function hl(a,b){if(!a)return a;b||(b=a);var c,d=a;do if(c=!1,d.steiner|| !hz(d,d.next)&&0!==hy(d.prev,d,d.next))d=d.next;else{if(hG(d),(d=b=d.prev)===d.next)break;c=!0}while(c||d!==b)return b}function hm(a,b,c,d,f,g,h){if(a){!h&&g&&function(a,b,c,d){var f=a;do null===f.z&&(f.z=hu(f.x,f.y,b,c,d)),f.prevZ=f.prev,f.nextZ=f.next,f=f.next;while(f!==a)f.prevZ.nextZ=null,f.prevZ=null,function(a){var b,c,d,f,g,h,i,j,k=1;do{for(c=a,a=null,g=null,h=0;c;){for(h++,d=c,i=0,b=0;b0||j>0&&d;)0!==i&&(0===j||!d||c.z<=d.z)?(f=c,c=c.nextZ,i--):(f=d,d=d.nextZ,j--),g?g.nextZ=f:a=f,f.prevZ=g,g=f;c=d}g.nextZ=null,k*=2}while(h>1)}(f)}(a,d,f,g);for(var i,j,k=a;a.prev!==a.next;)if(i=a.prev,j=a.next,g?ho(a,d,f,g):hn(a))b.push(i.i/c),b.push(a.i/c),b.push(j.i/c),hG(a),a=j.next,k=j.next;else if((a=j)===k){h?1===h?hm(a=hp(hl(a),b,c),b,c,d,f,g,2):2===h&&hq(a,b,c,d,f,g):hm(hl(a),b,c,d,f,g,1);break}}}function hn(a){var b=a.prev,c=a,d=a.next;if(hy(b,c,d)>=0)return!1;for(var f=a.next.next;f!==a.prev;){if(hw(b.x,b.y,c.x,c.y,d.x,d.y,f.x,f.y)&&hy(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function ho(a,b,c,d){var f=a.prev,g=a,h=a.next;if(hy(f,g,h)>=0)return!1;for(var i=f.x>g.x?f.x>h.x?f.x:h.x:g.x>h.x?g.x:h.x,j=f.y>g.y?f.y>h.y?f.y:h.y:g.y>h.y?g.y:h.y,k=hu(f.x=k&&n&&n.z<=l;){if(m!==a.prev&&m!==a.next&&hw(f.x,f.y,g.x,g.y,h.x,h.y,m.x,m.y)&&hy(m.prev,m,m.next)>=0||(m=m.prevZ,n!==a.prev&&n!==a.next&&hw(f.x,f.y,g.x,g.y,h.x,h.y,n.x,n.y)&&hy(n.prev,n,n.next)>=0))return!1;n=n.nextZ}for(;m&&m.z>=k;){if(m!==a.prev&&m!==a.next&&hw(f.x,f.y,g.x,g.y,h.x,h.y,m.x,m.y)&&hy(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;n&&n.z<=l;){if(n!==a.prev&&n!==a.next&&hw(f.x,f.y,g.x,g.y,h.x,h.y,n.x,n.y)&&hy(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}function hp(a,b,c){var d=a;do{var f=d.prev,g=d.next.next;!hz(f,g)&&hA(f,d,d.next,g)&&hD(f,g)&&hD(g,f)&&(b.push(f.i/c),b.push(d.i/c),b.push(g.i/c),hG(d),hG(d.next),d=a=g),d=d.next}while(d!==a)return hl(d)}function hq(a,b,c,d,f,g){var h=a;do{for(var i=h.next.next;i!==h.prev;){if(h.i!==i.i&&hx(h,i)){var j=hE(h,i);return h=hl(h,h.next),j=hl(j,j.next),hm(h,b,c,d,f,g),void hm(j,b,c,d,f,g)}i=i.next}h=h.next}while(h!==a)}function hr(a,b){return a.x-b.x}function hs(a,b){var c=function(a,b){var c,d=b,f=a.x,g=a.y,h=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){var i=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(i<=f&&i>h){if(h=i,i===f){if(g===d.y)return d;if(g===d.next.y)return d.next}c=d.x=d.x&&d.x>=l&&f!==d.x&&hw(gc.x||d.x===c.x&&ht(c,d)))&&(c=d,n=j)),d=d.next;while(d!==k)return c}(a,b);if(!c)return b;var d=hE(c,a),f=hl(c,c.next);return hl(d,d.next),b===c?f:b}function ht(a,b){return 0>hy(a.prev,a,b.prev)&&0>hy(b.next,a,a.next)}function hu(a,b,c,d,f){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-c)*f)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-d)*f)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function hv(a){var b=a,c=a;do(b.x=0&&(a-h)*(d-i)-(c-h)*(b-i)>=0&&(c-h)*(g-i)-(f-h)*(d-i)>=0}function hx(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var c=a;do{if(c.i!==a.i&&c.next.i!==a.i&&c.i!==b.i&&c.next.i!==b.i&&hA(c,c.next,a,b))return!0;c=c.next}while(c!==a)return!1}(a,b)&&(hD(a,b)&&hD(b,a)&&function(a,b){var c=a,d=!1,f=(a.x+b.x)/2,g=(a.y+b.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&f<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==a)return d}(a,b)&&(hy(a.prev,a,b.prev)||hy(a,b.prev,b))||hz(a,b)&&hy(a.prev,a,a.next)>0&&hy(b.prev,b,b.next)>0)}function hy(a,b,c){return(b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y)}function hz(a,b){return a.x===b.x&&a.y===b.y}function hA(a,b,c,d){var f=hC(hy(a,b,c)),g=hC(hy(a,b,d)),h=hC(hy(c,d,a)),i=hC(hy(c,d,b));return f!==g&&h!==i||!(0!==f||!hB(a,c,b))||!(0!==g||!hB(a,d,b))||!(0!==h||!hB(c,a,d))||!(0!==i||!hB(c,b,d))}function hB(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function hC(a){return a>0?1:a<0?-1:0}function hD(a,b){return 0>hy(a.prev,a,a.next)?hy(a,b,a.next)>=0&&hy(a,a.prev,b)>=0:0>hy(a,b,a.prev)||0>hy(a,a.next,b)}function hE(a,b){var c=new hH(a.i,a.x,a.y),d=new hH(b.i,b.x,b.y),f=a.next,g=b.prev;return a.next=b,b.prev=a,c.next=f,f.prev=c,d.next=c,c.prev=d,g.next=d,d.prev=g,d}function hF(a,b,c,d){var f=new hH(a,b,c);return d?(f.next=d.next,f.prev=d,d.next.prev=f,d.next=f):(f.prev=f,f.next=f),f}function hG(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function hH(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hI(a,b,c,d){for(var f=0,g=b,h=c-d;gc;){if(d-c>600){var g=d-c+1,h=b-c+1,i=Math.log(g),j=.5*Math.exp(2*i/3),k=.5*Math.sqrt(i*j*(g-j)/g)*(h-g/2<0?-1:1);hK(a,b,Math.max(c,Math.floor(b-h*j/g+k)),Math.min(d,Math.floor(b+(g-h)*j/g+k)),f)}var l=a[b],m=c,n=d;for(hL(a,c,b),f(a[d],l)>0&&hL(a,c,d);mf(a[m],l);)m++;for(;f(a[n],l)>0;)n--}0===f(a[c],l)?hL(a,c,n):hL(a,++n,d),n<=b&&(c=n+1),b<=n&&(d=n-1)}}function hL(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function hM(a,b){return ab?1:0}function hN(a,b){const c=a.length;if(c<=1)return[a];const d=[];let f,g;for(let h=0;h1)for(let j=0;j0&&c.holes.push(d+=a[f-1].length)}return c},hi.default=hj;class hR{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new fm,this.indexArray=new fy,this.indexArray2=new fF,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.segments2=new gq,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){this.hasPattern=hP("fill",this.layers,b);const f=this.layers[0].layout.get("fill-sort-key"),g=[];for(const{feature:h,id:i,index:j,sourceLayerIndex:k}of a){const l=this.layers[0]._featureFilter.needGeometry,m=gH(h,l);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),m,c))continue;const n=f?f.evaluate(m,{},c,b.availableImages):void 0,o={id:i,properties:h.properties,type:h.type,sourceLayerIndex:k,index:j,geometry:l?m.geometry:gG(h,c,d),patterns:{},sortKey:n};g.push(o)}for(const p of(f&&g.sort((a,b)=>a.sortKey-b.sortKey),g)){const{geometry:q,index:r,sourceLayerIndex:s}=p;if(this.hasPattern){const u=hQ("fill",this.layers,p,this.zoom,b);this.patternFeatures.push(u)}else this.addFeature(p,q,r,c,{},b.availableImages);b.featureIndex.insert(a[r].feature,q,r,s,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(a,b,c,d){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,hh),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),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(a,b,c,d,f,g=[]){for(const h of hN(b,500)){let i=0;for(const j of h)i+=j.length;const k=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),l=k.vertexLength,m=[],n=[];for(const o of h){if(0===o.length)continue;o!==h[0]&&n.push(m.length/2);const p=this.segments2.prepareSegment(o.length,this.layoutVertexArray,this.indexArray2),q=p.vertexLength;this.layoutVertexArray.emplaceBack(o[0].x,o[0].y),this.indexArray2.emplaceBack(q+o.length-1,q),m.push(o[0].x),m.push(o[0].y);for(let r=1;r>3}if(f--,1===d||2===d)h+=a.readSVarint(),i+=a.readSVarint(),1===d&&(b&&j.push(b),b=[]),b.push(new g(h,i));else{if(7!==d)throw Error("unknown command "+d);b&&b.push(b[0].clone())}}return b&&j.push(b),j},hY.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var b=a.readVarint()+a.pos,c=1,d=0,f=0,g=0,h=1/0,i=-1/0,j=1/0,k=-1/0;a.pos>3}if(d--,1===c||2===c)(f+=a.readSVarint())i&&(i=f),(g+=a.readSVarint())k&&(k=g);else if(7!==c)throw Error("unknown command "+c)}return[h,j,i,k]},hY.prototype.toGeoJSON=function(a,b,c){var d,f,g=this.extent*Math.pow(2,c),h=this.extent*a,i=this.extent*b,j=this.loadGeometry(),k=hY.types[this.type];function l(a){for(var b=0;b>3;b=1===d?a.readString():2===d?a.readFloat():3===d?a.readDouble():4===d?a.readVarint64():5===d?a.readVarint():6===d?a.readSVarint():7===d?a.readBoolean():null}return b}(c))}function h2(a,b,c){if(3===a){var d=new h_(c,c.readVarint()+c.pos);d.length&&(b[d.name]=d)}}h0.prototype.feature=function(a){if(a<0||a>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[a];var b=this._pbf.readVarint()+this._pbf.pos;return new hX(this._pbf,b,this.extent,this._keys,this._values)};var h3={VectorTile:function(a,b){this.layers=a.readFields(h2,{},b)},VectorTileFeature:hX,VectorTileLayer:h_};const h4=h3.VectorTileFeature.types;function h5(a,b,c,d,f,g,h,i){a.emplaceBack((b<<1)+h,(c<<1)+g,(Math.floor(8192*d)<<1)+f,Math.round(i))}class h6{constructor(){this.acc=new g(0,0),this.polyCount=[]}startRing(a){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new g(a.x,a.y),this.max=new g(a.x,a.y))}append(a,b){this.currentPolyCount.edges++,this.acc._add(a);let c=!!this.borders;const d=this.min,f=this.max;a.xf.x&&(f.x=a.x,c=!0),a.yf.y&&(f.y=a.y,c=!0),((0===a.x||8192===a.x)&&a.x===b.x)!=((0===a.y||8192===a.y)&&a.y===b.y)&&this.processBorderOverlap(a,b),c&&this.checkBorderIntersection(a,b)}checkBorderIntersection(a,b){b.x<0!=a.x<0&&this.addBorderIntersection(0,cr(b.y,a.y,(0-b.x)/(a.x-b.x))),b.x>8192!=a.x>8192&&this.addBorderIntersection(1,cr(b.y,a.y,(8192-b.x)/(a.x-b.x))),b.y<0!=a.y<0&&this.addBorderIntersection(2,cr(b.x,a.x,(0-b.y)/(a.y-b.y))),b.y>8192!=a.y>8192&&this.addBorderIntersection(3,cr(b.x,a.x,(8192-b.y)/(a.y-b.y)))}addBorderIntersection(a,b){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 c=this.borders[a];bc[1]&&(c[1]=b)}processBorderOverlap(a,b){if(a.x===b.x){if(a.y===b.y)return;const c=0===a.x?0:1;this.addBorderIntersection(c,b.y),this.addBorderIntersection(c,a.y)}else{const d=0===a.y?2:3;this.addBorderIntersection(d,b.x),this.addBorderIntersection(d,a.x)}}centroid(){const a=this.polyCount.reduce((a,b)=>a+b.edges,0);return 0!==a?this.acc.div(a)._round():new g(0,0)}span(){return new g(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((a,b)=>a+ +(b[0]!==Number.MAX_VALUE),0)}}class h7{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new fn,this.centroidVertexArray=new fU,this.indexArray=new fy,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.enableTerrain=a.enableTerrain}populate(a,b,c,d){for(const{feature:f,id:g,index:h,sourceLayerIndex:i}of(this.features=[],this.hasPattern=hP("fill-extrusion",this.layers,b),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(a){const b=Math.exp(Math.PI*(1-a.y/(1<a.x<=0)||h.every(a=>a.x>=8192)||h.every(a=>a.y<=0)||h.every(a=>a.y>=8192))continue;for(let m=0;m=1){const r=n[p-1];if(!h8(q,r)){i&&i.append(q,r),l.vertexLength+4>gq.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const s=q.sub(r)._perp(),u=s.x/(Math.abs(s.x)+Math.abs(s.y)),v=s.y>0?1:0,w=r.dist(q);o+w>32768&&(o=0),h5(this.layoutVertexArray,q.x,q.y,u,v,0,0,o),h5(this.layoutVertexArray,q.x,q.y,u,v,0,1,o),o+=w,h5(this.layoutVertexArray,r.x,r.y,u,v,0,0,o),h5(this.layoutVertexArray,r.x,r.y,u,v,0,1,o);const x=l.vertexLength;this.indexArray.emplaceBack(x,x+2,x+1),this.indexArray.emplaceBack(x+1,x+2,x+3),l.vertexLength+=4,l.primitiveLength+=2}}}}if(l.vertexLength+k>gq.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),"Polygon"!==h4[a.type])continue;const y=[],z=[],A=l.vertexLength;for(let B=0;B0){if(i.borders){i.vertexArrayOffset=this.centroidVertexArray.length;const H=i.borders,I=this.featuresOnBorder.push(i)-1;for(let J=0;J<4;J++)H[J][0]!==Number.MAX_VALUE&&this.borders[J].push(I)}this.encodeCentroid(i.borders?void 0:i.centroid(),i)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,f,g,d)}sortBorders(){for(let a=0;a<4;a++)this.borders[a].sort((b,c)=>this.featuresOnBorder[b].borders[a][0]-this.featuresOnBorder[c].borders[a][0])}encodeCentroid(a,b,c=!0){let d,f;if(a){if(0!==a.y){const g=b.span()._mult(this.tileToMeter);d=(Math.max(a.x,1)<<3)+Math.min(7,Math.round(g.x/10)),f=(Math.max(a.y,1)<<3)+Math.min(7,Math.round(g.y/10))}else d=Math.ceil(7*(a.x+450)),f=0}else d=0,f=+c;let h=c?this.centroidVertexArray.length:b.vertexArrayOffset;for(const i of b.polyCount){c&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*i.edges+i.top);for(let j=0;j<2*i.edges;j++)this.centroidVertexArray.emplace(h++,0,f),this.centroidVertexArray.emplace(h++,d,f);for(let k=0;k8192)||a.y===b.y&&(a.y<0||a.y>8192)}ec("FillExtrusionBucket",h7,{omit:["layers","features"]}),ec("PartMetadata",h6);var h9={paint:new ff({"fill-extrusion-opacity":new fa(bk["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new fb(bk["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new fa(bk["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new fa(bk["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new fc(bk["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new fb(bk["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new fb(bk["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new fa(bk["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function ia(a,b){return a.x*b.x+a.y*b.y}function ib(a,b){if(1===a.length){let c=0;const d=b[c++];let f;for(;!f||d.equals(f);)if(!(f=b[c++]))return 1/0;for(;ca.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new fo,this.layoutVertexArray2=new fp,this.indexArray=new fy,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){this.hasPattern=hP("line",this.layers,b);const f=this.layers[0].layout.get("line-sort-key"),g=[];for(const{feature:h,id:i,index:j,sourceLayerIndex:k}of a){const l=this.layers[0]._featureFilter.needGeometry,m=gH(h,l);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),m,c))continue;const n=f?f.evaluate(m,{},c):void 0,o={id:i,properties:h.properties,type:h.type,sourceLayerIndex:k,index:j,geometry:l?m.geometry:gG(h,c,d),patterns:{},sortKey:n};g.push(o)}f&&g.sort((a,b)=>a.sortKey-b.sortKey);const{lineAtlas:p,featureIndex:q}=b,r=this.addConstantDashes(p);for(const s of g){const{geometry:u,index:v,sourceLayerIndex:w}=s;if(r&&this.addFeatureDashes(s,p),this.hasPattern){const x=hQ("line",this.layers,s,this.zoom,b);this.patternFeatures.push(x)}else this.addFeature(s,u,v,c,p.positions,b.availableImages);q.insert(a[v].feature,u,v,w,this.index)}}addConstantDashes(a){let b=!1;for(const c of this.layers){const d=c.paint.get("line-dasharray").value,f=c.layout.get("line-cap").value;if("constant"!==d.kind||"constant"!==f.kind)b=!0;else{const g=f.value,h=d.value;if(!h)continue;a.addDash(h.from,g),a.addDash(h.to,g),h.other&&a.addDash(h.other,g)}}return b}addFeatureDashes(a,b){const c=this.zoom;for(const d of this.layers){const f=d.paint.get("line-dasharray").value,g=d.layout.get("line-cap").value;if("constant"===f.kind&&"constant"===g.kind)continue;let h,i,j,k,l,m;if("constant"===f.kind){const n=f.value;if(!n)continue;h=n.other||n.to,i=n.to,j=n.from}else h=f.evaluate({zoom:c-1},a),i=f.evaluate({zoom:c},a),j=f.evaluate({zoom:c+1},a);"constant"===g.kind?k=l=m=g.value:(k=g.evaluate({zoom:c-1},a),l=g.evaluate({zoom:c},a),m=g.evaluate({zoom:c+1},a)),b.addDash(h,k),b.addDash(i,l),b.addDash(j,m);const o=b.getKey(h,k),p=b.getKey(i,l),q=b.getKey(j,m);a.patterns[d.id]={min:o,mid:p,max:q}}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(a,b,c,d){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,ii)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,ig),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&a.properties.hasOwnProperty("mapbox_clip_start")&&a.properties.hasOwnProperty("mapbox_clip_end"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,b,c,d,f,g){const h=this.layers[0].layout,i=h.get("line-join").evaluate(a,{}),j=h.get("line-cap").evaluate(a,{}),k=h.get("line-miter-limit"),l=h.get("line-round-limit");for(const m of(this.lineClips=this.lineFeatureClips(a),b))this.addLine(m,a,i,j,k,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,f,g,d)}addLine(a,b,c,d,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let h=0;h=2&&a[j-1].equals(a[j-2]);)j--;let k=0;for(;k0;if(z&&s>k){const B=n.dist(o);if(B>2*l){const C=n.sub(n.sub(o)._mult(l/B)._round());this.updateDistance(o,C),this.addCurrentVertex(C,q,0,0,m),o=C}}const D=o&&p;let E=D?c:i?"butt":d;if(D&&"round"===E&&(xf&&(E="bevel"),"bevel"===E&&(x>2&&(E="flipbevel"),x100)u=r.mult(-1);else{const F=x*q.add(r).mag()/q.sub(r).mag();u._perp()._mult(F*(A?-1:1))}this.addCurrentVertex(n,u,0,0,m),this.addCurrentVertex(n,u.mult(-1),0,0,m)}else if("bevel"===E||"fakeround"===E){const G=-Math.sqrt(x*x-1),H=A?G:0,I=A?0:G;if(o&&this.addCurrentVertex(n,q,H,I,m),"fakeround"===E){const J=Math.round(180*y/Math.PI/20);for(let K=1;K2*l){const Q=n.add(p.sub(n)._mult(l/P)._round());this.updateDistance(n,Q),this.addCurrentVertex(Q,r,0,0,m),n=Q}}}}addCurrentVertex(a,b,c,d,f,g=!1){const h=b.y*d-b.x,i=-b.y-b.x*d;this.addHalfVertex(a,b.x+b.y*c,b.y-b.x*c,g,!1,c,f),this.addHalfVertex(a,h,i,g,!0,-d,f)}addHalfVertex({x:a,y:b},c,d,f,g,h,i){this.layoutVertexArray.emplaceBack((a<<1)+(f?1:0),(b<<1)+(g?1:0),Math.round(63*c)+128,Math.round(63*d)+128,1+(0===h?0:h<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const j=i.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,j),i.primitiveLength++),g?this.e2=j:this.e1=j}updateScaledDistance(){if(this.lineClips){const a=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=a*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(a,b){this.distance+=a.dist(b),this.updateScaledDistance()}}ec("LineBucket",il,{omit:["layers","patternFeatures"]});const im=new ff({"line-cap":new fb(bk.layout_line["line-cap"]),"line-join":new fb(bk.layout_line["line-join"]),"line-miter-limit":new fa(bk.layout_line["line-miter-limit"]),"line-round-limit":new fa(bk.layout_line["line-round-limit"]),"line-sort-key":new fb(bk.layout_line["line-sort-key"])});var io={paint:new ff({"line-opacity":new fb(bk.paint_line["line-opacity"]),"line-color":new fb(bk.paint_line["line-color"]),"line-translate":new fa(bk.paint_line["line-translate"]),"line-translate-anchor":new fa(bk.paint_line["line-translate-anchor"]),"line-width":new fb(bk.paint_line["line-width"]),"line-gap-width":new fb(bk.paint_line["line-gap-width"]),"line-offset":new fb(bk.paint_line["line-offset"]),"line-blur":new fb(bk.paint_line["line-blur"]),"line-dasharray":new fc(bk.paint_line["line-dasharray"]),"line-pattern":new fc(bk.paint_line["line-pattern"]),"line-gradient":new fe(bk.paint_line["line-gradient"])}),layout:im};const ip=new class extends fb{possiblyEvaluate(a,b){return b=new e2(Math.floor(b.zoom),{now:b.now,fadeDuration:b.fadeDuration,zoomHistory:b.zoomHistory,transition:b.transition}),super.possiblyEvaluate(a,b)}evaluate(a,b,c,d){return b=aa({},b,{zoom:Math.floor(b.zoom)}),super.evaluate(a,b,c,d)}}(io.paint.properties["line-width"].specification);function iq(a,b){return b>0?b+2*a:a}ip.useIntegerZoom=!0;const ir=fk([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"},],4),is=fk([{name:"a_projected_pos",components:3,type:"Float32"},],4);fk([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const it=fk([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),iu=fk([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);fk([{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 iv=fk([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),iw=fk([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function ix(a,b){const{expression:c}=b;if("constant"===c.kind)return{kind:"constant",layoutSize:c.evaluate(new e2(a+1))};if("source"===c.kind)return{kind:"source"};{const{zoomStops:d,interpolationType:f}=c;let g=0;for(;g{a.text=function(a,b,c){const d=b.layout.get("text-transform").evaluate(c,{});return"uppercase"===d?a=a.toLocaleUpperCase():"lowercase"===d&&(a=a.toLocaleLowerCase()),e1.applyArabicShaping&&(a=e1.applyArabicShaping(a)),a}(a.text,b,c)}),a}const iC={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function iD(a){return"︶"===a||"﹈"===a||"︸"===a||"﹄"===a||"﹂"===a||"︾"===a||"︼"===a||"︺"===a||"︘"===a||"﹀"===a||"︐"===a||"︓"===a||"︔"===a||"`"===a||" ̄"===a||"︑"===a||"︒"===a}function iE(a){return"︵"===a||"﹇"===a||"︷"===a||"﹃"===a||"﹁"===a||"︽"===a||"︻"===a||"︹"===a||"︗"===a||"︿"===a}var iF=function(a,b,c,d,f){var g,h,i=8*f-d-1,j=(1<>1,l=-7,m=c?f-1:0,n=c?-1:1,o=a[b+m];for(m+=n,g=o&(1<< -l)-1,o>>=-l,l+=i;l>0;g=256*g+a[b+m],m+=n,l-=8);for(h=g&(1<< -l)-1,g>>=-l,l+=d;l>0;h=256*h+a[b+m],m+=n,l-=8);if(0===g)g=1-k;else{if(g===j)return h?NaN:1/0*(o?-1:1);h+=Math.pow(2,d),g-=k}return(o?-1:1)*h*Math.pow(2,g-d)},iG=function(a,b,c,d,f,g){var h,i,j,k=8*g-f-1,l=(1<>1,n=23===f?5960464477539062e-23:0,o=d?0:g-1,p=d?1:-1,q=b<0||0===b&&1/b<0?1:0;for(isNaN(b=Math.abs(b))||b===1/0?(i=isNaN(b)?1:0,h=l):(h=Math.floor(Math.log(b)/Math.LN2),b*(j=Math.pow(2,-h))<1&&(h--,j*=2),(b+=h+m>=1?n/j:n*Math.pow(2,1-m))*j>=2&&(h++,j/=2),h+m>=l?(i=0,h=l):h+m>=1?(i=(b*j-1)*Math.pow(2,f),h+=m):(i=b*Math.pow(2,m-1)*Math.pow(2,f),h=0));f>=8;a[c+o]=255&i,o+=p,i/=256,f-=8);for(h=h<0;a[c+o]=255&h,o+=p,h/=256,k-=8);a[c+o-p]|=128*q},iH=iI;function iI(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}iI.Varint=0,iI.Fixed64=1,iI.Bytes=2,iI.Fixed32=5;var iJ="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function iK(a){return a.type===iI.Bytes?a.readVarint()+a.pos:a.pos+1}function iL(a,b,c){var d=b<=16383?1:b<=2097151?2:b<=268435455?3:Math.floor(Math.log(b)/(7*Math.LN2));c.realloc(d);for(var f=c.pos-1;f>=a;f--)c.buf[f+d]=c.buf[f]}function iM(a,b){for(var c=0;c>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function iX(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function iY(a,b,c){b.glyphs=[],1===a&&c.readMessage(iZ,b)}function iZ(a,b,c){if(3===a){const{id:d,bitmap:f,width:g,height:h,left:i,top:j,advance:k}=c.readMessage(i$,{});b.glyphs.push({id:d,bitmap:new hb({width:g+6,height:h+6},f),metrics:{width:g,height:h,left:i,top:j,advance:k}})}else 4===a?b.ascender=c.readSVarint():5===a&&(b.descender=c.readSVarint())}function i$(a,b,c){1===a?b.id=c.readVarint():2===a?b.bitmap=c.readBytes():3===a?b.width=c.readVarint():4===a?b.height=c.readVarint():5===a?b.left=c.readSVarint():6===a?b.top=c.readSVarint():7===a&&(b.advance=c.readVarint())}function i_(a){let b=0,c=0;for(const d of a)b+=d.w*d.h,c=Math.max(c,d.w);a.sort((a,b)=>b.h-a.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(b/.95)),c),h:1/0},];let g=0,h=0;for(const i of a)for(let j=f.length-1;j>=0;j--){const k=f[j];if(!(i.w>k.w||i.h>k.h)){if(i.x=k.x,i.y=k.y,h=Math.max(h,i.y+i.h),g=Math.max(g,i.x+i.w),i.w===k.w&&i.h===k.h){const l=f.pop();j>3,g=this.pos;this.type=7&d,a(f,b,this),this.pos===g&&this.skip(d)}return b},readMessage:function(a,b){return this.readFields(a,b,this.readVarint()+this.pos)},readFixed32:function(){var a=iV(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=iX(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=iV(this.buf,this.pos)+4294967296*iV(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=iV(this.buf,this.pos)+4294967296*iX(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=iF(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=iF(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var b,c,d=this.buf;return b=127&(c=d[this.pos++]),c<128?b:(b|=(127&(c=d[this.pos++]))<<7,c<128?b:(b|=(127&(c=d[this.pos++]))<<14,c<128?b:(b|=(127&(c=d[this.pos++]))<<21,c<128?b:function(a,b,c){var d,f,g,h,i=c.buf;if(g=(112&(h=i[c.pos++]))>>4,h<128||(g|=(127&(h=i[c.pos++]))<<3,h<128)||(g|=(127&(h=i[c.pos++]))<<10,h<128)||(g|=(127&(h=i[c.pos++]))<<17,h<128)||(g|=(127&(h=i[c.pos++]))<<24,h<128)||(g|=(1&(h=i[c.pos++]))<<31,h<128))return d=a,f=g,b?4294967296*f+(d>>>0):4294967296*(f>>>0)+(d>>>0);throw Error("Expected varint not more than 10 bytes")}(b|=(15&(c=d[this.pos]))<<28,a,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?-((a+1)/2):a/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var a,b,c,d=this.readVarint()+this.pos,f=this.pos;return this.pos=d,d-f>=12&&iJ?(a=this.buf,b=f,c=d,iJ.decode(a.subarray(b,c))):function(a,b,c){for(var d="",f=b;f239?4:j>223?3:j>191?2:1;if(f+l>c)break;1===l?j<128&&(k=j):2===l?128==(192&(g=a[f+1]))&&(k=(31&j)<<6|63&g)<=127&&(k=null):3===l?(h=a[f+2],128==(192&(g=a[f+1]))&&128==(192&h)&&((k=(15&j)<<12|(63&g)<<6|63&h)<=2047||k>=55296&&k<=57343)&&(k=null)):4===l&&(h=a[f+2],i=a[f+3],128==(192&(g=a[f+1]))&&128==(192&h)&&128==(192&i)&&((k=(15&j)<<18|(63&g)<<12|(63&h)<<6|63&i)<=65535||k>=1114112)&&(k=null)),null===k?(k=65533,l=1):k>65535&&(k-=65536,d+=String.fromCharCode(k>>>10&1023|55296),k=56320|1023&k),d+=String.fromCharCode(k),f+=l}return d}(this.buf,f,d)},readBytes:function(){var a=this.readVarint()+this.pos,b=this.buf.subarray(this.pos,a);return this.pos=a,b},readPackedVarint:function(a,b){if(this.type!==iI.Bytes)return a.push(this.readVarint(b));var c=iK(this);for(a=a||[];this.pos127;);else if(b===iI.Bytes)this.pos=this.readVarint()+this.pos;else if(b===iI.Fixed32)this.pos+=4;else{if(b!==iI.Fixed64)throw Error("Unimplemented type: "+b);this.pos+=8}},writeTag:function(a,b){this.writeVarint(a<<3|b)},realloc:function(a){for(var b=this.length||16;b268435455||a<0?function(a,b){var c,d,f,g,h,i,j;if(a>=0?(c=a%4294967296|0,d=a/4294967296|0):(d=~(-a/4294967296),4294967295^(c=~(-a%4294967296))?c=c+1|0:(c=0,d=d+1|0)),a>=18446744073709552e3||a< -18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");b.realloc(10),f=c,(g=b).buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,g.buf[g.pos]=127&(f>>>=7),h=d,i=b,j=(7&h)<<4,i.buf[i.pos++]|=j|((h>>>=3)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h)))))}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?-(2*a)-1:2*a)},writeBoolean:function(a){this.writeVarint(Boolean(a))},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var b=this.pos;this.pos=function(a,b,c){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===b.length?(a[c++]=239,a[c++]=191,a[c++]=189):f=d;continue}if(d<56320){a[c++]=239,a[c++]=191,a[c++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[c++]=239,a[c++]=191,a[c++]=189,f=null);d<128?a[c++]=d:(d<2048?a[c++]=d>>6|192:(d<65536?a[c++]=d>>12|224:(a[c++]=d>>18|240,a[c++]=d>>12&63|128),a[c++]=d>>6&63|128),a[c++]=63&d|128)}return c}(this.buf,a,this.pos);var c=this.pos-b;c>=128&&iL(b,c,this),this.pos=b-1,this.writeVarint(c),this.pos+=c},writeFloat:function(a){this.realloc(4),iG(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),iG(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var b=a.length;this.writeVarint(b),this.realloc(b);for(var c=0;c=128&&iL(c,d,this),this.pos=c-1,this.writeVarint(d),this.pos+=d},writeMessage:function(a,b,c){this.writeTag(a,iI.Bytes),this.writeRawMessage(b,c)},writePackedVarint:function(a,b){b.length&&this.writeMessage(a,iM,b)},writePackedSVarint:function(a,b){b.length&&this.writeMessage(a,iN,b)},writePackedBoolean:function(a,b){b.length&&this.writeMessage(a,iQ,b)},writePackedFloat:function(a,b){b.length&&this.writeMessage(a,iO,b)},writePackedDouble:function(a,b){b.length&&this.writeMessage(a,iP,b)},writePackedFixed32:function(a,b){b.length&&this.writeMessage(a,iR,b)},writePackedSFixed32:function(a,b){b.length&&this.writeMessage(a,iS,b)},writePackedFixed64:function(a,b){b.length&&this.writeMessage(a,iT,b)},writePackedSFixed64:function(a,b){b.length&&this.writeMessage(a,iU,b)},writeBytesField:function(a,b){this.writeTag(a,iI.Bytes),this.writeBytes(b)},writeFixed32Field:function(a,b){this.writeTag(a,iI.Fixed32),this.writeFixed32(b)},writeSFixed32Field:function(a,b){this.writeTag(a,iI.Fixed32),this.writeSFixed32(b)},writeFixed64Field:function(a,b){this.writeTag(a,iI.Fixed64),this.writeFixed64(b)},writeSFixed64Field:function(a,b){this.writeTag(a,iI.Fixed64),this.writeSFixed64(b)},writeVarintField:function(a,b){this.writeTag(a,iI.Varint),this.writeVarint(b)},writeSVarintField:function(a,b){this.writeTag(a,iI.Varint),this.writeSVarint(b)},writeStringField:function(a,b){this.writeTag(a,iI.Bytes),this.writeString(b)},writeFloatField:function(a,b){this.writeTag(a,iI.Fixed32),this.writeFloat(b)},writeDoubleField:function(a,b){this.writeTag(a,iI.Fixed64),this.writeDouble(b)},writeBooleanField:function(a,b){this.writeVarintField(a,Boolean(b))}};class i0{constructor(a,{pixelRatio:b,version:c,stretchX:d,stretchY:f,content:g}){this.paddedRect=a,this.pixelRatio=b,this.stretchX=d,this.stretchY=f,this.content=g,this.version=c}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 i1{constructor(a,b){const c={},d={};this.haveRenderCallbacks=[];const f=[];this.addImages(a,c,f),this.addImages(b,d,f);const{w:g,h:h}=i_(f),i=new hc({width:g||1,height:h||1});for(const j in a){const k=a[j],l=c[j].paddedRect;hc.copy(k.data,i,{x:0,y:0},{x:l.x+1,y:l.y+1},k.data)}for(const m in b){const n=b[m],o=d[m].paddedRect,p=o.x+1,q=o.y+1,r=n.data.width,s=n.data.height;hc.copy(n.data,i,{x:0,y:0},{x:p,y:q},n.data),hc.copy(n.data,i,{x:0,y:s-1},{x:p,y:q-1},{width:r,height:1}),hc.copy(n.data,i,{x:0,y:0},{x:p,y:q+s},{width:r,height:1}),hc.copy(n.data,i,{x:r-1,y:0},{x:p-1,y:q},{width:1,height:s}),hc.copy(n.data,i,{x:0,y:0},{x:p+r,y:q},{width:1,height:s})}this.image=i,this.iconPositions=c,this.patternPositions=d}addImages(a,b,c){for(const d in a){const f=a[d],g={x:0,y:0,w:f.data.width+2,h:f.data.height+2};c.push(g),b[d]=new i0(g,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(d)}}patchUpdatedImages(a,b){for(const c in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[c],a.getImage(c),b),this.patchUpdatedImage(this.patternPositions[c],a.getImage(c),b)}patchUpdatedImage(a,b,c){if(!a||!b||a.version===b.version)return;a.version=b.version;const[d,f]=a.tl;c.update(b.data,void 0,{x:d,y:f})}}ec("ImagePosition",i0),ec("ImageAtlas",i1);const i2={horizontal:1,vertical:2,horizontalOnly:3};class i3{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(a,b){const c=new i3;return c.scale=a||1,c.fontStack=b,c}static forImage(a){const b=new i3;return b.imageName=a,b}}class i4{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(a,b){const c=new i4;for(let d=0;d=0&&d>=a&&i6[this.text.charCodeAt(d)];d--)c--;this.text=this.text.substring(a,c),this.sectionIndex=this.sectionIndex.slice(a,c)}substring(a,b){const c=new i4;return c.text=this.text.substring(a,b),c.sectionIndex=this.sectionIndex.slice(a,b),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,b)=>Math.max(a,this.sections[b].scale),0)}addTextSection(a,b){this.text+=a.text,this.sections.push(i3.forText(a.scale,a.fontStack||b));const c=this.sections.length-1;for(let d=0;d=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function i5(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q){const r=i4.fromFeature(a,f);let s;m===i2.vertical&&r.verticalizePunctuation(n);const{processBidirectionalText:u,processStyledBidirectionalText:v}=e1;if(u&&1===r.sections.length){s=[];const w=u(r.toString(),jd(r,k,g,b,d,o,p));for(const x of w){const y=new i4;y.text=x,y.sections=r.sections;for(let z=0;z0&&U>E&&(E=U)}else{const V=c[I.fontStack];if(!V)continue;V[K]&&(N=V[K]);const W=b[I.fontStack];if(!W)continue;const X=W.glyphs[K];if(!X)continue;if(M=X.metrics,P=8203!==K?24:0,s){const Y=void 0!==W.ascender?Math.abs(W.ascender):0,Z=void 0!==W.descender?Math.abs(W.descender):0,$=(Y+Z)*L;F<$&&(F=$,G=(Y-Z)/2*L),Q=-Y*L}else Q=(A-L)*24-17}R?(a.verticalizable=!0,D.push({glyph:K,imageName:O,x:o,y:p+Q,vertical:R,scale:L,localGlyph:M.localGlyph,fontStack:I.fontStack,sectionIndex:J,metrics:M,rect:N}),o+=P*L+k):(D.push({glyph:K,imageName:O,x:o,y:p+Q,vertical:R,scale:L,localGlyph:M.localGlyph,fontStack:I.fontStack,sectionIndex:J,metrics:M,rect:N}),o+=M.advance*L+k)}0!==D.length&&(q=Math.max(o-k,q),s?jf(D,r,E,G,g*A/2):jf(D,r,E,0,g/2)),o=0;const _=g*A+E;C.lineOffset=Math.max(E,B),p+=_,++y}const aa=p,{horizontalAlign:ab,verticalAlign:ac}=je(h);(function(a,b,c,d,f,g){const h=(b-c)*f,i=-g*d;for(const j of a)for(const k of j.positionedGlyphs)k.x+=h,k.y+=i})(a.positionedLines,r,ab,ac,q,aa),a.top+=-ac*aa,a.bottom=a.top+aa,a.left+=-ab*q,a.right=a.left+q,a.hasBaseline=s}(E,b,c,d,s,h,i,j,m,k,n,q),!function(a){for(const b of a)if(0!==b.positionedGlyphs.length)return!1;return!0}(D)&&E}const i6={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},i7={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 i8(a,b,c,d,f,g){if(b.imageName){const h=d[b.imageName];return h?h.displaySize[0]*b.scale*24/g+f:0}{const i=c[b.fontStack],j=i&&i.glyphs[a];return j?j.metrics.advance*b.scale+f:0}}function i9(a,b,c,d){const f=Math.pow(a-b,2);return d?a=0;let m=0;for(let n=0;n -c/2;){if(--h<0)return!1;i-=a[h].dist(g),g=a[h]}i+=a[h].dist(a[h+1]),h++;const j=[];let k=0;for(;id;)k-=j.shift().angleDelta;if(k>f)return!1;h++,i+=l.dist(m)}return!0}function jk(a){let b=0;for(let c=0;ck){const p=(k-j)/o,q=cr(m.x,n.x,p),r=cr(m.y,n.y,p),s=new ji(q,r,0,n.angleTo(m),l);return!h||jj(a,s,i,h,b)?s:void 0}j+=o}}function jo(a,b,c,d,f,g,h,i,j){const k=jl(d,g,h),l=jm(d,f),m=l*h,n=0===a[0].x||a[0].x===j||0===a[0].y||a[0].y===j;return b-m=0&&w=0&&x=0&&n+k<=l){const y=new ji(w,x,0,u,p);y._round(),d&&!jj(a,y,g,d,f)||o.push(y)}}m+=s}return i||o.length||h||(o=jp(a,m/2,c,d,f,g,h,!0,j)),o}function jq(a,b,c,d,f){const h=[];for(let i=0;i=d&&n.x>=d||(m.x>=d?m=new g(d,m.y+(d-m.x)/(n.x-m.x)*(n.y-m.y))._round():n.x>=d&&(n=new g(d,m.y+(d-m.x)/(n.x-m.x)*(n.y-m.y))._round()),m.y>=f&&n.y>=f||(m.y>=f?m=new g(m.x+(f-m.y)/(n.y-m.y)*(n.x-m.x),f)._round():n.y>=f&&(n=new g(m.x+(f-m.y)/(n.y-m.y)*(n.x-m.x),f)._round()),k&&m.equals(k[k.length-1])||(k=[m],h.push(k)),k.push(n)))))}}return h}function jr(a,b,c,d,f,g,h,i,j){for(let k=b;k -1)g[++j]=i,h[j]=k,h[j+1]=1e20}for(let n=0,o=0;n{let d=this.entries[a];d||(d=this.entries[a]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let f=d.glyphs[b];if(void 0!==f)return void c(null,{stack:a,id:b,glyph:f});if(f=this._tinySDF(d,a,b))return d.glyphs[b]=f,void c(null,{stack:a,id:b,glyph:f});const g=Math.floor(b/256);if(256*g>65535)return void c(Error("glyphs > 65535 not supported"));if(d.ranges[g])return void c(null,{stack:a,id:b,glyph:f});let h=d.requests[g];h||(h=d.requests[g]=[],ju.loadGlyphRange(a,g,this.url,this.requestManager,(a,b)=>{if(b){for(const c in d.ascender=b.ascender,d.descender=b.descender,b.glyphs)this._doesCharSupportLocalGlyph(+c)||(d.glyphs[+c]=b.glyphs[+c]);d.ranges[g]=!0}for(const f of h)f(a,b);delete d.requests[g]})),h.push((d,f)=>{d?c(d):f&&c(null,{stack:a,id:b,glyph:f.glyphs[b]||null})})},(a,c)=>{if(a)b(a);else if(c){const d={};for(const{stack:f,id:g,glyph:h}of c)void 0===d[f]&&(d[f]={}),void 0===d[f].glyphs&&(d[f].glyphs={}),d[f].glyphs[g]=h&&{id:h.id,bitmap:h.bitmap.clone(),metrics:h.metrics},d[f].ascender=this.entries[f].ascender,d[f].descender=this.entries[f].descender;b(null,d)}})}_doesCharSupportLocalGlyph(a){return this.localGlyphMode!==jt.none&&(this.localGlyphMode===jt.all?!!this.localFontFamily:!!this.localFontFamily&&(ez(a)||eC(a)||eq(a)||er(a))||ep(a))}_tinySDF(a,b,c){const d=this.localFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let f=a.tinySDF;if(!f){let g="400";/bold/i.test(b)?g="900":/medium/i.test(b)?g="500":/light/i.test(b)&&(g="200"),(f=a.tinySDF=new ju.TinySDF({fontFamily:d,fontWeight:g,fontSize:48,buffer:6,radius:16})).fontWeight=g}if(this.localGlyphs[f.fontWeight][c])return this.localGlyphs[f.fontWeight][c];const h=String.fromCharCode(c),{data:i,width:j,height:k,glyphWidth:l,glyphHeight:m,glyphLeft:n,glyphTop:o,glyphAdvance:p}=f.draw(h);return this.localGlyphs[f.fontWeight][c]={id:c,bitmap:new hb({width:j,height:k},i),metrics:{width:l/2,height:m/2,left:n/2,top:o/2-27,advance:p/2,localGlyph:!0}}}}function jv(a,b,c,d){const f=[],h=a.image,i=h.pixelRatio,j=h.paddedRect.w-2,k=h.paddedRect.h-2,l=a.right-a.left,m=a.bottom-a.top,n=h.stretchX||[[0,j]],o=h.stretchY||[[0,k]],p=(a,b)=>a+b[1]-b[0],q=n.reduce(p,0),r=o.reduce(p,0),s=j-q,u=k-r;let v=0,w=q,x=0,y=r,z=0,A=s,B=0,C=u;if(h.content&&d){const D=h.content;v=jw(n,0,D[0]),x=jw(o,0,D[1]),w=jw(n,D[0],D[2]),y=jw(o,D[1],D[3]),z=D[0]-v,B=D[1]-x,A=D[2]-D[0]-w,C=D[3]-D[1]-y}const E=(d,f,j,k)=>{const n=(d.stretch-v)/w*l+a.left,o=d.fixed-z-A*d.stretch/q,p=(f.stretch-x)/y*m+a.top,s=f.fixed-B-C*f.stretch/r,u=(j.stretch-v)/w*l+a.left,D=j.fixed-z-A*j.stretch/q,E=(k.stretch-x)/y*m+a.top,F=k.fixed-B-C*k.stretch/r,G=new g(n,p),H=new g(u,p),I=new g(u,E),J=new g(n,E),K=new g(o/i,s/i),L=new g(D/i,F/i),M=b*Math.PI/180;if(M){const N=Math.sin(M),O=Math.cos(M),P=[O,-N,N,O];G._matMult(P),H._matMult(P),J._matMult(P),I._matMult(P)}const Q=d.stretch+d.fixed,R=f.stretch+f.fixed;return{tl:G,tr:H,bl:J,br:I,tex:{x:h.paddedRect.x+1+Q,y:h.paddedRect.y+1+R,w:j.stretch+j.fixed-Q,h:k.stretch+k.fixed-R},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:L,minFontScaleX:A/i/l,minFontScaleY:C/i/m,isSDF:c}};if(d&&(h.stretchX||h.stretchY)){const F=jx(n,s,q),G=jx(o,u,r);for(let H=0;H{if(a)f(a);else if(b){var c;const d={},g=(c=b,new iH(c).readFields(iY,{}));for(const h of g.glyphs)d[h.id]=h;f(null,{glyphs:d,ascender:g.ascender,descender:g.descender})}})},ju.TinySDF=class{constructor({fontSize:a=24,buffer:b=3,radius:c=8,cutoff:d=.25,fontFamily:f="sans-serif",fontWeight:g="normal",fontStyle:h="normal"}){this.buffer=b,this.cutoff=d,this.radius=c;const i=this.size=a+4*b,j=this._createCanvas(i),k=this.ctx=j.getContext("2d",{willReadFrequently:!0});k.font=`${h} ${g} ${a}px ${f}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(i*i),this.gridInner=new Float64Array(i*i),this.f=new Float64Array(i),this.z=new Float64Array(i+1),this.v=new Uint16Array(i)}_createCanvas(a){const b=document.createElement("canvas");return b.width=b.height=a,b}draw(a){const{width:b,actualBoundingBoxAscent:c,actualBoundingBoxDescent:d,actualBoundingBoxLeft:f,actualBoundingBoxRight:g}=this.ctx.measureText(a),h=Math.floor(c),i=Math.min(this.size-this.buffer,Math.ceil(g-f)),j=Math.min(this.size-this.buffer,Math.ceil(c)+Math.ceil(d)),k=i+2*this.buffer,l=j+2*this.buffer,m=k*l,n=new Uint8ClampedArray(m),o={data:n,width:k,height:l,glyphWidth:i,glyphHeight:j,glyphTop:h,glyphLeft:0,glyphAdvance:b};if(0===i||0===j)return o;const{ctx:p,buffer:q,gridInner:r,gridOuter:s}=this;p.clearRect(q,q,i,j),p.fillText(a,q,q+h+1);const u=p.getImageData(q,q,i,j);s.fill(1e20,0,m),r.fill(0,0,m);for(let v=0;v0?z*z:0,r[y]=z<0?z*z:0}}jr(s,0,0,k,l,k,this.f,this.v,this.z),jr(r,q,q,i,j,k,this.f,this.v,this.z);for(let A=0;Ab?1:0}){if(this.data=a,this.length=this.data.length,this.compare=b,this.length>0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const a=this.data[0],b=this.data.pop();return this.length--,this.length>0&&(this.data[0]=b,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:b,compare:c}=this,d=b[a];for(;a>0;){const f=a-1>>1,g=b[f];if(c(d,g)>=0)break;b[a]=g,a=f}b[a]=d}_down(a){const{data:b,compare:c}=this,d=this.length>>1,f=b[a];for(;ac(b[i],h)&&(g=i,h=b[i]),c(h,f)>=0)break;b[a]=h,a=g}b[a]=f}}function jA(a,b=1,c=!1){let d=1/0,f=1/0,h=-1/0,i=-1/0;const j=a[0];for(let k=0;kh)&&(h=l.x),(!k||l.y>i)&&(i=l.y)}const m=Math.min(h-d,i-f);let n=m/2;const o=new jz([],jB);if(0===m)return new g(d,f);for(let p=d;pr.d||!r.d)&&(r=u,c&&console.log("found best %d after %d probes",Math.round(1e4*u.d)/1e4,s)),u.max-r.d<=b||(n=u.h/2,o.push(new jC(u.p.x-n,u.p.y-n,n,a)),o.push(new jC(u.p.x+n,u.p.y-n,n,a)),o.push(new jC(u.p.x-n,u.p.y+n,n,a)),o.push(new jC(u.p.x+n,u.p.y+n,n,a)),s+=4)}return c&&(console.log(`num probes: ${s}`),console.log(`best distance: ${r.d}`)),r.p}function jB(a,b){return b.max-a.max}function jC(a,b,c,d){this.p=new g(a,b),this.h=c,this.d=function(a,b){let c=!1,d=1/0;for(let f=0;fa.y!=l.y>a.y&&a.x<(l.x-k.x)*(a.y-k.y)/(l.y-k.y)+k.x&&(c=!c),d=Math.min(d,gR(a,k,l))}}return(c?1:-1)*Math.sqrt(d)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const jD=Number.POSITIVE_INFINITY,jE=Math.sqrt(2);function jF(a,b){return b[1]!==jD?function(a,b,c){let d=0,f=0;switch(b=Math.abs(b),c=Math.abs(c),a){case"top-right":case"top-left":case"top":f=c-7;break;case"bottom-right":case"bottom-left":case"bottom":f=7-c}switch(a){case"top-right":case"bottom-right":case"right":d=-b;break;case"top-left":case"bottom-left":case"left":d=b}return[d,f]}(a,b[0],b[1]):function(a,b){let c=0,d=0;b<0&&(b=0);const f=b/jE;switch(a){case"top-right":case"top-left":d=f-7;break;case"bottom-right":case"bottom-left":d=7-f;break;case"bottom":d=7-b;break;case"top":d=b-7}switch(a){case"top-right":case"bottom-right":c=-f;break;case"top-left":case"bottom-left":c=f;break;case"left":c=b;break;case"right":c=-b}return[c,d]}(a,b[0])}function jG(a,b,c,d,f,g,h,i,j,k){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const l=a.layers[0].layout,m=a.layers[0]._unevaluatedLayout._values,n={};if("composite"===a.textSizeData.kind){const{minZoom:o,maxZoom:p}=a.textSizeData;n.compositeTextSizes=[m["text-size"].possiblyEvaluate(new e2(o),i),m["text-size"].possiblyEvaluate(new e2(p),i),]}if("composite"===a.iconSizeData.kind){const{minZoom:q,maxZoom:r}=a.iconSizeData;n.compositeIconSizes=[m["icon-size"].possiblyEvaluate(new e2(q),i),m["icon-size"].possiblyEvaluate(new e2(r),i),]}n.layoutTextSize=m["text-size"].possiblyEvaluate(new e2(j+1),i),n.layoutIconSize=m["icon-size"].possiblyEvaluate(new e2(j+1),i),n.textMaxSize=m["text-size"].possiblyEvaluate(new e2(18),i);const s="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),u=l.get("text-size");for(const v of a.features){const w=l.get("text-font").evaluate(v,{},i).join(","),x=u.evaluate(v,{},i),y=n.layoutTextSize.evaluate(v,{},i),z=(n.layoutIconSize.evaluate(v,{},i),{horizontal:{},vertical:void 0}),A=v.text;let B,C=[0,0];if(A){const D=A.toString(),E=24*l.get("text-letter-spacing").evaluate(v,{},i),F=24*l.get("text-line-height").evaluate(v,{},i),G=eL(D)?E:0,H=l.get("text-anchor").evaluate(v,{},i),I=l.get("text-variable-anchor");if(!I){const J=l.get("text-radial-offset").evaluate(v,{},i);C=J?jF(H,[24*J,jD]):l.get("text-offset").evaluate(v,{},i).map(a=>24*a)}let K=s?"center":l.get("text-justify").evaluate(v,{},i);const L=l.get("symbol-placement"),M="point"===L,N="point"===L?24*l.get("text-max-width").evaluate(v,{},i):0,O=d=>{a.allowVerticalPlacement&&eK(D)&&(z.vertical=i5(A,b,c,f,w,N,F,H,d,G,C,i2.vertical,!0,L,y,x))};if(!s&&I){const P="auto"===K?I.map(a=>jH(a)):[K];let Q=!1;for(let R=0;R=0||!eK(D)){const U=i5(A,b,c,f,w,N,F,H,K,G,C,i2.horizontal,!1,L,y,x);U&&(z.horizontal[K]=U)}O("point"===L?"left":K)}}let V=!1;if(v.icon&&v.icon.name){const W=d[v.icon.name];W&&(B=jg(f[v.icon.name],l.get("icon-offset").evaluate(v,{},i),l.get("icon-anchor").evaluate(v,{},i)),V=W.sdf,void 0===a.sdfIcons?a.sdfIcons=W.sdf:a.sdfIcons!==W.sdf&&am("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(W.pixelRatio!==a.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(a.iconsNeedLinear=!0))}const X=jL(z.horizontal)||z.vertical;a.iconsInText||(a.iconsInText=!!X&&X.iconsInText),(X||B)&&jI(a,v,z,B,d,n,y,0,C,V,h,i,k)}g&&a.generateCollisionDebugBuffers(j,a.collisionBoxArray)}function jH(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function jI(a,b,c,d,f,g,h,i,j,k,l,m,n){let o=g.textMaxSize.evaluate(b,{},m);void 0===o&&(o=h);const p=a.layers[0].layout,q=p.get("icon-offset").evaluate(b,{},m),r=jL(c.horizontal)||c.vertical,s=h/24,u=a.tilePixelRatio*o/24,v=a.tilePixelRatio*p.get("symbol-spacing"),w=p.get("text-padding")*a.tilePixelRatio,x=p.get("icon-padding")*a.tilePixelRatio,y=p.get("text-max-angle")*P,z="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),A="map"===p.get("icon-rotation-alignment")&&"point"!==p.get("symbol-placement"),B=p.get("symbol-placement"),C=v/2,D=p.get("icon-text-fit");let E;d&&"none"!==D&&(a.allowVerticalPlacement&&c.vertical&&(E=jh(d,c.vertical,D,p.get("icon-text-fit-padding"),q,s)),r&&(d=jh(d,r,D,p.get("icon-text-fit-padding"),q,s)));const F=(h,i,o)=>{if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)return;const{x:p,y:r,z:s}=n.projectTilePoint(i.x,i.y,o),u=new ji(p,r,s,0,void 0);!function(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A){const B=a.addToLineVertexArray(b,d);let C,D,E,F,G,H,I,J=0,K=0,L=0,M=0,N=-1,O=-1;const P={};let Q=fZ(""),R=0,S=0;if(void 0===j._unevaluatedLayout.getValue("text-radial-offset")?[R,S]=j.layout.get("text-offset").evaluate(w,{},A).map(a=>24*a):(R=24*j.layout.get("text-radial-offset").evaluate(w,{},A),S=jD),a.allowVerticalPlacement&&f.vertical){const T=f.vertical;if(p)H=jN(T),i&&(I=jN(i));else{const U=j.layout.get("text-rotate").evaluate(w,{},A)+90;E=jM(k,c,b,l,m,n,T,o,U,q),i&&(F=jM(k,c,b,l,m,n,i,s,U))}}if(g){const V=j.layout.get("icon-rotate").evaluate(w,{},A),W="none"!==j.layout.get("icon-text-fit"),X=jv(g,V,y,W),Y=i?jv(i,V,y,W):void 0;D=jM(k,c,b,l,m,n,g,s,V),J=4*X.length;const Z=a.iconSizeData;let $=null;"source"===Z.kind?($=[128*j.layout.get("icon-size").evaluate(w,{},A),])[0]>jJ&&am(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Z.kind&&(($=[128*x.compositeIconSizes[0].evaluate(w,{},A),128*x.compositeIconSizes[1].evaluate(w,{},A),])[0]>jJ||$[1]>jJ)&&am(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),a.addSymbols(a.icon,X,$,v,u,w,!1,c,b,B.lineStartIndex,B.lineLength,-1,z,A),N=a.icon.placedSymbolArray.length-1,Y&&(K=4*Y.length,a.addSymbols(a.icon,Y,$,v,u,w,i2.vertical,c,b,B.lineStartIndex,B.lineLength,-1,z,A),O=a.icon.placedSymbolArray.length-1)}for(const _ in f.horizontal){const aa=f.horizontal[_];C||(Q=fZ(aa.text),p?G=jN(aa):C=jM(k,c,b,l,m,n,aa,o,j.layout.get("text-rotate").evaluate(w,{},A),q));const ab=1===aa.positionedLines.length;if(L+=jK(a,c,b,aa,h,j,p,w,q,B,f.vertical?i2.horizontal:i2.horizontalOnly,ab?Object.keys(f.horizontal):[_],P,N,x,z,A),ab)break}f.vertical&&(M+=jK(a,c,b,f.vertical,h,j,p,w,q,B,i2.vertical,["vertical"],P,O,x,z,A));let ac=-1;const ad=(a,b)=>a?Math.max(a,b):b;ac=ad(G,ac),ac=ad(H,ac),ac=ad(I,ac);const ae=ac> -1?1:0;a.glyphOffsetArray.length>=jW.MAX_GLYPHS&&am("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&a.addToSortKeyRanges(a.symbolInstances.length,w.sortKey),a.symbolInstances.emplaceBack(c.x,c.y,c.z,b.x,b.y,P.right>=0?P.right:-1,P.center>=0?P.center:-1,P.left>=0?P.left:-1,P.vertical>=0?P.vertical:-1,N,O,Q,void 0!==C?C:a.collisionBoxArray.length,void 0!==C?C+1:a.collisionBoxArray.length,void 0!==E?E:a.collisionBoxArray.length,void 0!==E?E+1:a.collisionBoxArray.length,void 0!==D?D:a.collisionBoxArray.length,void 0!==D?D+1:a.collisionBoxArray.length,F||a.collisionBoxArray.length,F?F+1:a.collisionBoxArray.length,l,L,M,J,K,ae,0,R,S,ac)}(a,i,u,h,c,d,f,E,a.layers[0],a.collisionBoxArray,b.index,b.sourceLayerIndex,a.index,w,z,j,0,x,A,q,b,g,k,l,m)};if("line"===B)for(const G of jq(b.geometry,0,0,8192,8192)){const H=jo(G,v,y,c.vertical||r,d,24,u,a.overscaling,8192);for(const I of H){const J=r;J&&jO(a,J.text,C,I)||F(G,I,m)}}else if("line-center"===B){for(const K of b.geometry)if(K.length>1){const L=jn(K,y,c.vertical||r,d,24,u);L&&F(K,L,m)}}else if("Polygon"===b.type)for(const M of hN(b.geometry,0)){const N=jA(M,16);F(M[0],new ji(N.x,N.y,0,0,void 0),m)}else if("LineString"===b.type)for(const O of b.geometry)F(O,new ji(O[0].x,O[0].y,0,0,void 0),m);else if("Point"===b.type)for(const Q of b.geometry)for(const R of Q)F([R],new ji(R.x,R.y,0,0,void 0),m)}const jJ=32640;function jK(a,b,c,d,f,h,i,j,k,l,m,n,o,p,q,r,s){const u=function(a,b,c,d,f,h,i,j){const k=[];if(0===b.positionedLines.length)return k;const l=d.layout.get("text-rotate").evaluate(h,{})*Math.PI/180,m=function(a){const b=a[0],c=a[1],d=b*c;return d>0?[b,-c]:d<0?[-b,c]:0===b?[c,b]:[c,-b]}(c);let n=Math.abs(b.top-b.bottom);for(const o of b.positionedLines)n-=o.lineOffset;const p=b.positionedLines.length,q=n/p;let r=b.top-c[1];for(let s=0;sjJ&&am(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((w=[128*q.compositeTextSizes[0].evaluate(j,{},s),128*q.compositeTextSizes[1].evaluate(j,{},s),])[0]>jJ||w[1]>jJ)&&am(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),a.addSymbols(a.text,u,w,k,i,j,m,b,c,l.lineStartIndex,l.lineLength,p,r,s),n))o[x]=a.text.placedSymbolArray.length-1;return 4*u.length}function jL(a){for(const b in a)return a[b];return null}function jM(a,b,c,d,f,h,i,j,k,l){let m=i.top,n=i.bottom,o=i.left,p=i.right;const q=i.collisionPadding;if(q&&(o-=q[0],m-=q[1],p+=q[2],n+=q[3]),k){const r=new g(o,m),s=new g(p,m),u=new g(o,n),v=new g(p,n),w=k*P;let x=new g(0,0);l&&(x=new g(l[0],l[1])),r._rotateAround(w,x),s._rotateAround(w,x),u._rotateAround(w,x),v._rotateAround(w,x),o=Math.min(r.x,s.x,u.x,v.x),p=Math.max(r.x,s.x,u.x,v.x),m=Math.min(r.y,s.y,u.y,v.y),n=Math.max(r.y,s.y,u.y,v.y)}return a.emplaceBack(b.x,b.y,b.z,c.x,c.y,o,m,p,n,j,d,f,h),a.length-1}function jN(a){a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const b=a.bottom-a.top;return b>0?Math.max(10,b):null}function jO(a,b,c,d){const f=a.compareText;if(b in f){const g=f[b];for(let h=g.length-1;h>=0;h--)if(d.dist(g[h])a.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=l([]),this.placementViewportMatrix=l([]);const b=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ix(this.zoom,b["text-size"]),this.iconSizeData=ix(this.zoom,b["icon-size"]);const c=this.layers[0].layout,d=c.get("symbol-sort-key"),f=c.get("symbol-z-order");this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==f&& void 0!==d.constantOr(1),this.sortFeaturesByY=("viewport-y"===f||"auto"===f&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(a=>i2[a]),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.sourceID=a.sourceID}createArrays(){this.text=new jU(new gg(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new jU(new gg(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new fP,this.lineVertexArray=new fQ,this.symbolInstances=new fO}calculateGlyphDependencies(a,b,c,d,f){for(let g=0;g0)&&("constant"!==h.value.kind||h.value.value.length>0),l="constant"!==j.value.kind||!!j.value.value||Object.keys(j.parameters).length>0,m=g.get("symbol-sort-key");if(this.features=[],!k&&!l)return;const n=b.iconDependencies,o=b.glyphDependencies,p=b.availableImages,q=new e2(this.zoom);for(const{feature:r,id:s,index:u,sourceLayerIndex:v}of a){const w=f._featureFilter.needGeometry,x=gH(r,w);if(!f._featureFilter.filter(q,x,c))continue;let y,z;if(w||(x.geometry=gG(r,c,d)),k){const A=f.getValueAndResolveTokens("text-field",x,c,p),B=bN.factory(A);jT(B)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===e_()||this.hasRTLText&&e1.isParsed())&&(y=iB(B,f,x))}if(l){const C=f.getValueAndResolveTokens("icon-image",x,c,p);z=C instanceof bO?C:bO.fromString(C)}if(!y&&!z)continue;const D=this.sortFeaturesByKey?m.evaluate(x,{},c):void 0;if(this.features.push({id:s,text:y,icon:z,index:u,sourceLayerIndex:v,geometry:x.geometry,properties:r.properties,type:jP[r.type],sortKey:D}),z&&(n[z.name]=!0),y){const E=h.evaluate(x,{},c).join(","),F="map"===g.get("text-rotation-alignment")&&"point"!==g.get("symbol-placement");for(const G of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(i2.vertical)>=0,y.sections))if(G.image)n[G.image.name]=!0;else{const H=eK(y.toString()),I=G.fontStack||E,J=o[I]=o[I]||{};this.calculateGlyphDependencies(G.text,J,F,this.allowVerticalPlacement,H)}}}"line"===g.get("symbol-placement")&&(this.features=function(a){const b={},c={},d=[];let f=0;function g(b){d.push(a[b]),f++}function h(a,b,f){const g=c[a];return delete c[a],c[b]=g,d[g].geometry[0].pop(),d[g].geometry[0]=d[g].geometry[0].concat(f[0]),g}function i(a,c,f){const g=b[c];return delete b[c],b[a]=g,d[g].geometry[0].shift(),d[g].geometry[0]=f[0].concat(d[g].geometry[0]),g}function j(a,b,c){const d=c?b[0][b[0].length-1]:b[0][0];return`${a}:${d.x}:${d.y}`}for(let k=0;ka.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((a,b)=>a.sortKey-b.sortKey)}update(a,b,c,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,b,this.layers,c,d),this.icon.programConfigurations.updatePaintArrays(a,b,this.layers,c,d))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(a,b){const c=this.lineVertexArray.length;if(void 0!==a.segment){let d=a.dist(b[a.segment+1]),f=a.dist(b[a.segment]);const g={};for(let h=a.segment+1;h=0;i--)g[i]={x:b[i].x,y:b[i].y,tileUnitDistanceFromAnchor:f},i>0&&(f+=b[i-1].dist(b[i]));for(let j=0;j=0?b.rightJustifiedTextSymbolIndex:b.centerJustifiedTextSymbolIndex>=0?b.centerJustifiedTextSymbolIndex:b.leftJustifiedTextSymbolIndex>=0?b.leftJustifiedTextSymbolIndex:b.verticalPlacedTextSymbolIndex>=0?b.verticalPlacedTextSymbolIndex:d),g=iy(this.textSizeData,a,f)/24;return this.tilePixelRatio*g}getSymbolInstanceIconSize(a,b,c){const d=this.icon.placedSymbolArray.get(c),f=iy(this.iconSizeData,a,d);return this.tilePixelRatio*f}_commitDebugCollisionVertexUpdate(a,b,c){a.emplaceBack(b,-c,-c),a.emplaceBack(b,c,-c),a.emplaceBack(b,c,c),a.emplaceBack(b,-c,c)}_updateTextDebugCollisionBoxes(a,b,c,d,f,g){for(let h=d;h0}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(a,b){const c=a.placedSymbolArray.get(b),d=c.vertexStartIndex+4*c.numGlyphs;for(let f=c.vertexStartIndex;fd[a]-d[b]||f[b]-f[a]),g}addToSortKeyRanges(a,b){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===b?c.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:b,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(a){if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const b of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const c=this.symbolInstances.get(b);this.featureSortOrder.push(c.featureIndex),[c.rightJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.leftJustifiedTextSymbolIndex,].forEach((a,b,c)=>{a>=0&&c.indexOf(a)===b&&this.addIndicesForPlacedSymbol(this.text,a)}),c.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,c.verticalPlacedTextSymbolIndex),c.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,c.placedIconSymbolIndex),c.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,c.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ec("SymbolBucket",jW,{omit:["layers","collisionBoxArray","features","compareText",]}),jW.MAX_GLYPHS=65535,jW.addDynamicAttributes=jS;const jX=new ff({"symbol-placement":new fa(bk.layout_symbol["symbol-placement"]),"symbol-spacing":new fa(bk.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new fa(bk.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new fb(bk.layout_symbol["symbol-sort-key"]),"symbol-z-order":new fa(bk.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new fa(bk.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new fa(bk.layout_symbol["icon-ignore-placement"]),"icon-optional":new fa(bk.layout_symbol["icon-optional"]),"icon-rotation-alignment":new fa(bk.layout_symbol["icon-rotation-alignment"]),"icon-size":new fb(bk.layout_symbol["icon-size"]),"icon-text-fit":new fa(bk.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new fa(bk.layout_symbol["icon-text-fit-padding"]),"icon-image":new fb(bk.layout_symbol["icon-image"]),"icon-rotate":new fb(bk.layout_symbol["icon-rotate"]),"icon-padding":new fa(bk.layout_symbol["icon-padding"]),"icon-keep-upright":new fa(bk.layout_symbol["icon-keep-upright"]),"icon-offset":new fb(bk.layout_symbol["icon-offset"]),"icon-anchor":new fb(bk.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new fa(bk.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new fa(bk.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new fa(bk.layout_symbol["text-rotation-alignment"]),"text-field":new fb(bk.layout_symbol["text-field"]),"text-font":new fb(bk.layout_symbol["text-font"]),"text-size":new fb(bk.layout_symbol["text-size"]),"text-max-width":new fb(bk.layout_symbol["text-max-width"]),"text-line-height":new fb(bk.layout_symbol["text-line-height"]),"text-letter-spacing":new fb(bk.layout_symbol["text-letter-spacing"]),"text-justify":new fb(bk.layout_symbol["text-justify"]),"text-radial-offset":new fb(bk.layout_symbol["text-radial-offset"]),"text-variable-anchor":new fa(bk.layout_symbol["text-variable-anchor"]),"text-anchor":new fb(bk.layout_symbol["text-anchor"]),"text-max-angle":new fa(bk.layout_symbol["text-max-angle"]),"text-writing-mode":new fa(bk.layout_symbol["text-writing-mode"]),"text-rotate":new fb(bk.layout_symbol["text-rotate"]),"text-padding":new fa(bk.layout_symbol["text-padding"]),"text-keep-upright":new fa(bk.layout_symbol["text-keep-upright"]),"text-transform":new fb(bk.layout_symbol["text-transform"]),"text-offset":new fb(bk.layout_symbol["text-offset"]),"text-allow-overlap":new fa(bk.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new fa(bk.layout_symbol["text-ignore-placement"]),"text-optional":new fa(bk.layout_symbol["text-optional"])});var jY={paint:new ff({"icon-opacity":new fb(bk.paint_symbol["icon-opacity"]),"icon-color":new fb(bk.paint_symbol["icon-color"]),"icon-halo-color":new fb(bk.paint_symbol["icon-halo-color"]),"icon-halo-width":new fb(bk.paint_symbol["icon-halo-width"]),"icon-halo-blur":new fb(bk.paint_symbol["icon-halo-blur"]),"icon-translate":new fa(bk.paint_symbol["icon-translate"]),"icon-translate-anchor":new fa(bk.paint_symbol["icon-translate-anchor"]),"text-opacity":new fb(bk.paint_symbol["text-opacity"]),"text-color":new fb(bk.paint_symbol["text-color"],{runtimeType:bw,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new fb(bk.paint_symbol["text-halo-color"]),"text-halo-width":new fb(bk.paint_symbol["text-halo-width"]),"text-halo-blur":new fb(bk.paint_symbol["text-halo-blur"]),"text-translate":new fa(bk.paint_symbol["text-translate"]),"text-translate-anchor":new fa(bk.paint_symbol["text-translate-anchor"])}),layout:jX};class jZ{constructor(a){this.type=a.property.overrides?a.property.overrides.runtimeType:bs,this.defaultValue=a}evaluate(a){if(a.formattedSection){const b=this.defaultValue.property.overrides;if(b&&b.hasOverride(a.formattedSection))return b.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ec("FormatSectionOverride",jZ,{omit:["defaultValue"]});class j$ extends gn{constructor(a){super(a,jY)}recalculate(a,b){super.recalculate(a,b),"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 c=this.layout.get("text-writing-mode");if(c){const d=[];for(const f of c)0>d.indexOf(f)&&d.push(f);this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(a,b,c,d){var f;const g=this.layout.get(a).evaluate(b,{},c,d),h=this._unevaluatedLayout._values[a];return h.isDataDriven()||dj(h.value)||!g?g:(f=b.properties,g.replace(/{([^{}]+)}/g,(a,b)=>b in f?String(f[b]):""))}createBucket(a){return new jW(a)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const a of jY.paint.overridableProperties){if(!j$.hasPaintOverride(this.layout,a))continue;const b=this.paint.get(a),c=new jZ(b),d=new di(c,b.property.specification);let f=null;f="constant"===b.value.kind||"source"===b.value.kind?new dl("source",d):new dm("composite",d,b.value.zoomStops,b.value._interpolationType),this.paint._values[a]=new e8(b.property,f,b.parameters)}}_handleOverridablePaintPropertyUpdate(a,b,c){return!(!this.layout||b.isDataDriven()||c.isDataDriven())&&j$.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,b){const c=a.get("text-field"),d=jY.paint.properties[b];let f=!1;const g=a=>{for(const b of a)if(d.overrides&&d.overrides.hasOverride(b))return void(f=!0)};if("constant"===c.value.kind&&c.value.value instanceof bN)g(c.value.value.sections);else if("source"===c.value.kind){const h=a=>{f||(a instanceof bT&&bR(a.value)===bA?g(a.value.sections):a instanceof bX?g(a.sections):a.eachChild(h))},i=c.value;i._styleExpression&&h(i._styleExpression.expression)}return f}getProgramConfiguration(a){return new gf(this,a)}}var j_={paint:new ff({"background-color":new fa(bk.paint_background["background-color"]),"background-pattern":new fd(bk.paint_background["background-pattern"]),"background-opacity":new fa(bk.paint_background["background-opacity"])})},j0={paint:new ff({"raster-opacity":new fa(bk.paint_raster["raster-opacity"]),"raster-hue-rotate":new fa(bk.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new fa(bk.paint_raster["raster-brightness-min"]),"raster-brightness-max":new fa(bk.paint_raster["raster-brightness-max"]),"raster-saturation":new fa(bk.paint_raster["raster-saturation"]),"raster-contrast":new fa(bk.paint_raster["raster-contrast"]),"raster-resampling":new fa(bk.paint_raster["raster-resampling"]),"raster-fade-duration":new fa(bk.paint_raster["raster-fade-duration"])})};class j1 extends gn{constructor(a){super(a,{}),this.implementation=a}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(a){this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)}onRemove(a){this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)}}var j2={paint:new ff({"sky-type":new fa(bk.paint_sky["sky-type"]),"sky-atmosphere-sun":new fa(bk.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new fa(bk.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new fa(bk.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new fa(bk.paint_sky["sky-gradient-radius"]),"sky-gradient":new fe(bk.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new fa(bk.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new fa(bk.paint_sky["sky-atmosphere-color"]),"sky-opacity":new fa(bk.paint_sky["sky-opacity"])})};function j3(a,b,c){var d,f,g,h,i,j,k,l,m;const n=w(0,0,1),o=M(L());return d=o,f=o,g=c?-(a*P)+Math.PI:a*P,g*=.5,h=f[0],i=f[1],j=f[2],k=f[3],l=Math.sin(g),m=Math.cos(g),d[0]=h*m-j*l,d[1]=i*m+k*l,d[2]=j*m+h*l,d[3]=k*m-i*l,N(o,o,-(b*P)),H(n,n,o),D(n,n)}const j4={circle:class extends gn{constructor(a){super(a,g_)}createBucket(a){return new gJ(a)}queryRadius(a){const b=a;return gW("circle-radius",this,b)+gW("circle-stroke-width",this,b)+gX(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,d,f,g,h,i){const j=gZ(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),g.angle,a.pixelToTileUnitsFactor),k=this.paint.get("circle-radius").evaluate(b,c)+this.paint.get("circle-stroke-width").evaluate(b,c);return g2(a,d,g,h,i,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),j,k)}getProgramIds(){return["circle"]}getProgramConfiguration(a){return new gf(this,a)}},heatmap:class extends gn{createBucket(a){return new g7(a)}constructor(a){super(a,hd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){"heatmap-color"===a&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=he({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(a){return gW("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,f,h,i,j){const k=this.paint.get("heatmap-radius").evaluate(b,c);return g2(a,d,h,i,j,!0,!0,new g(0,0),k)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(a){return new gf(this,a)}},hillshade:class extends gn{constructor(a){super(a,hf)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(a){return new gf(this,a)}},fill:class extends gn{constructor(a){super(a,hT)}getProgramIds(){const a=this.paint.get("fill-pattern"),b=a&&a.constantOr(1),c=[b?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&c.push(b&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),c}getProgramConfiguration(a){return new gf(this,a)}recalculate(a,b){super.recalculate(a,b);const c=this.paint._values["fill-outline-color"];"constant"===c.value.kind&& void 0===c.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(a){return new hR(a)}queryRadius(){return gX(this.paint.get("fill-translate"))}queryIntersectsFeature(a,b,c,d,f,g){return!a.queryGeometry.isAboveHorizon&&gM(gY(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),g.angle,a.pixelToTileUnitsFactor),d)}isTileClipped(){return!0}},"fill-extrusion":class extends gn{constructor(a){super(a,h9)}createBucket(a){return new h7(a)}queryRadius(){return gX(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(a){return new gf(this,a)}queryIntersectsFeature(a,b,c,d,f,h,i,j,k){var l,m,n,o,p,q,r,s,u;const v=gZ(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,a.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(b,c),x=this.paint.get("fill-extrusion-base").evaluate(b,c),y=[0,0],z=j&&h.elevation,A=h.elevation?h.elevation.exaggeration():1;if(z){const B=a.tile.getBucket(this).centroidVertexArray,C=k+1;if(C=3){for(let g=0;g1&&(i=a[++h]);const k=Math.abs(j-i.left),l=Math.abs(j-i.right),m=Math.min(k,l);let n;const o=f/c*(d+1);if(i.isDash){const p=d-Math.abs(o);n=Math.sqrt(m*m+p*p)}else n=d-Math.sqrt(m*m+o*o);this.image.data[g+j]=Math.max(0,Math.min(255,n+128))}}}addRegularDash(a,b){for(let c=a.length-1;c>=0;--c){const d=a[c],f=a[c+1];d.zeroLength?a.splice(c,1):f&&f.isDash===d.isDash&&(f.left=d.left,a.splice(c,1))}const g=a[0],h=a[a.length-1];g.isDash===h.isDash&&(g.left=h.left-this.width,h.right=g.right+this.width);const i=this.width*this.nextRow;let j=0,k=a[j];for(let l=0;l1&&(k=a[++j]);const m=Math.abs(l-k.left),n=Math.abs(l-k.right),o=Math.min(m,n);this.image.data[i+l]=Math.max(0,Math.min(255,(k.isDash?o:-o)+b+128))}}addDash(a,b){const c=this.getKey(a,b);if(this.positions[c])return this.positions[c];const d="round"===b,f=d?7:0,g=2*f+1;if(this.nextRow+g>this.height)return am("LineAtlas out of space"),null;0===a.length&&a.push(1);let h=0;for(let i=0;i0;g--)f+=(b&(d=1<this.canonical.z?new kh(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new kh(a,this.wrap,a,this.canonical.x>>b,this.canonical.y>>b)}calculateScaledKey(a,b=!0){if(this.overscaledZ===a&&b)return this.key;if(a>this.canonical.z)return ki(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return ki(this.wrap*+b,a,a,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(a){if(a.wrap!==this.wrap)return!1;const b=this.canonical.z-a.canonical.z;return 0===a.overscaledZ||a.overscaledZ>b&&a.canonical.y===this.canonical.y>>b}children(a){if(this.overscaledZ>=a)return[new kh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const b=this.canonical.z+1,c=2*this.canonical.x,d=2*this.canonical.y;return[new kh(b,this.wrap,b,c,d),new kh(b,this.wrap,b,c+1,d),new kh(b,this.wrap,b,c,d+1),new kh(b,this.wrap,b,c+1,d+1),]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.yMath.abs(d[h])){if(c[h]b[h])return null}else{const i=1/d[h];let j=(a[h]-c[h])*i,k=(b[h]-c[h])*i;if(j>k){const l=j;j=k,k=l}if(j>f&&(f=j),kg)return null}return f}function kr(a,b,c,d,f,g,h,i,j,k,l){const m=d-a,n=f-b,o=g-c,p=h-a,q=i-b,r=j-c,s=l[1]*r-l[2]*q,u=l[2]*p-l[0]*r,v=l[0]*q-l[1]*p,w=m*s+n*u+o*v;if(1e-15>Math.abs(w))return null;const x=1/w,y=k[0]-a,z=k[1]-b,A=k[2]-c,B=(y*s+z*u+A*v)*x;if(B<0||B>1)return null;const C=z*o-A*n,D=A*m-y*o,E=y*n-z*m,F=(l[0]*C+l[1]*D+l[2]*E)*x;return F<0||B+F>1?null:(p*C+q*D+r*E)*x}function ks(a,b,c,d,f,g,h,i,j){const k=1<{const g=d?1:0,h=(a+1)*c-g,i=b*c,j=(b+1)*c-g;f[0]=a*c,f[1]=i,f[2]=h,f[3]=j};let h=new kp(d);const i=[];for(let j=0;j=1;d/=2){const o=c[c.length-1];h=new kp(d);for(let p=0;p0;){const{idx:o,t:p,nodex:q,nodey:r,depth:s}=n.pop();if(this.leaves[o]){ks(q,r,s,a,b,c,d,l,m);const u=1<=J[2])return p}continue}let K=0;for(let L=0;L=j[k[P]]&&(k.splice(P,0,L),O=!0);O||(k[K]=L),K++}}for(let Q=0;Q=this.dim+1||b< -1||b>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(b+1)*this.stride+(a+1)}_unpackMapbox(a,b,c){return(256*a*256+256*b+c)/10-1e4}_unpackTerrarium(a,b,c){return 256*a+b+c/256-32768}static pack(a,b){const c=[0,0,0,0],d=kx.getUnpackVector(b);let f=Math.floor((a+d[3])/d[2]);return c[2]=f%256,f=Math.floor(f/256),c[1]=f%256,f=Math.floor(f/256),c[0]=f,c}getPixels(){return new hc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,b,c){if(this.dim!==a.dim)throw Error("dem dimension mismatch");let d=b*this.dim,f=b*this.dim+this.dim,g=c*this.dim,h=c*this.dim+this.dim;switch(b){case -1:d=f-1;break;case 1:f=d+1}switch(c){case -1:g=h-1;break;case 1:h=g+1}const i=-b*this.dim,j=-c*this.dim;for(let k=g;k{"source"===a.dataType&&"metadata"===a.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===a.dataType&&"content"===a.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),b.on("error",()=>{this._sourceErrored=!0}),this._source=b,this._tiles={},this._cache=new class{constructor(a,b){this.max=a,this.onRemove=b,this.reset()}reset(){for(const a in this.data)for(const b of this.data[a])b.timeout&&clearTimeout(b.timeout),this.onRemove(b.value);return this.data={},this.order=[],this}add(a,b,c){const d=a.wrapped().key;void 0===this.data[d]&&(this.data[d]=[]);const f={value:b,timeout:void 0};if(void 0!==c&&(f.timeout=setTimeout(()=>{this.remove(a,f)},c)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const b=this.data[a].shift();return b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),b.value}getByKey(a){const b=this.data[a];return b?b[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(a,b){if(!this.has(a))return this;const c=a.wrapped().key,d=void 0===b?0:this.data[c].indexOf(b),f=this.data[c][d];return this.data[c].splice(d,1),f.timeout&&clearTimeout(f.timeout),0===this.data[c].length&&delete this.data[c],this.onRemove(f.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(a){for(this.max=a;this.order.length>this.max;){const b=this._getAndRemoveByKey(this.order[0]);b&&this.onRemove(b)}return this}filter(a){const b=[];for(const c in this.data)for(const d of this.data[c])a(d.value)||b.push(d);for(const f of b)this.remove(f.value.tileID,f)}}(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,b,c){const d=String(b);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][d]=this.stateChanges[a][d]||{},aa(this.stateChanges[a][d],c),null===this.deletedStates[a])for(const f in this.deletedStates[a]={},this.state[a])f!==d&&(this.deletedStates[a][f]=null);else if(this.deletedStates[a]&&null===this.deletedStates[a][d])for(const g in this.deletedStates[a][d]={},this.state[a][d])c[g]||(this.deletedStates[a][d][g]=null);else for(const h in c)this.deletedStates[a]&&this.deletedStates[a][d]&&null===this.deletedStates[a][d][h]&&delete this.deletedStates[a][d][h]}removeFeatureState(a,b,c){if(null===this.deletedStates[a])return;const d=String(b);if(this.deletedStates[a]=this.deletedStates[a]||{},c&& void 0!==b)null!==this.deletedStates[a][d]&&(this.deletedStates[a][d]=this.deletedStates[a][d]||{},this.deletedStates[a][d][c]=null);else if(void 0!==b){if(this.stateChanges[a]&&this.stateChanges[a][d])for(c in this.deletedStates[a][d]={},this.stateChanges[a][d])this.deletedStates[a][d][c]=null;else this.deletedStates[a][d]=null}else this.deletedStates[a]=null}getState(a,b){const c=String(b),d=aa({},(this.state[a]||{})[c],(this.stateChanges[a]||{})[c]);if(null===this.deletedStates[a])return{};if(this.deletedStates[a]){const f=this.deletedStates[a][b];if(null===f)return{};for(const g in f)delete d[g]}return d}initializeTileState(a,b){a.setFeatureState(this.state,b)}coalesceChanges(a,b){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const g in this.stateChanges[d])this.state[d][g]||(this.state[d][g]={}),aa(this.state[d][g],this.stateChanges[d][g]),f[g]=this.state[d][g];c[d]=f}for(const h in this.deletedStates){this.state[h]=this.state[h]||{};const i={};if(null===this.deletedStates[h])for(const j in this.state[h])i[j]={},this.state[h][j]={};else for(const k in this.deletedStates[h]){if(null===this.deletedStates[h][k])this.state[h][k]={};else for(const l of Object.keys(this.deletedStates[h][k]))delete this.state[h][k][l];i[k]=this.state[h][k]}c[h]=c[h]||{},aa(c[h],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(c).length)for(const m in a)a[m].setFeatureState(c,b)}}}onAdd(a){this.map=a,this._minTileCacheSize=a?a._minTileCacheSize:null,this._maxTileCacheSize=a?a._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const a in this._tiles){const b=this._tiles[a];if("loaded"!==b.state&&"errored"!==b.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(a,b){return a.isSymbolTile=this._onlySymbols,this._source.loadTile(a,b)}_unloadTile(a){if(this._source.unloadTile)return this._source.unloadTile(a,()=>{})}_abortTile(a){if(this._source.abortTile)return this._source.abortTile(a,()=>{})}serialize(){return this._source.serialize()}prepare(a){for(const b in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const c=this._tiles[b];c.upload(a),c.prepare(this.map.style.imageManager)}}getIds(){return _(this._tiles).map(a=>a.tileID).sort(kz).map(a=>a.key)}getRenderableIds(a){const b=[];for(const c in this._tiles)this._isIdRenderable(+c,a)&&b.push(this._tiles[c]);return a?b.sort((a,b)=>{const c=a.tileID,d=b.tileID,f=new g(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),h=new g(d.canonical.x,d.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-d.overscaledZ||h.y-f.y||h.x-f.x}).map(a=>a.tileID.key):b.map(a=>a.tileID).sort(kz).map(a=>a.key)}hasRenderableParent(a){const b=this.findLoadedParent(a,0);return!!b&&this._isIdRenderable(b.tileID.key)}_isIdRenderable(a,b){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(b||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const a in this._cache.reset(),this._tiles)"errored"!==this._tiles[a].state&&this._reloadTile(+a,"reloading")}_reloadTile(a,b){const c=this._tiles[a];c&&("loading"!==c.state&&(c.state=b),this._loadTile(c,this._tileLoaded.bind(this,c,a,b)))}_tileLoaded(a,b,c,d){if(d){if(a.state="errored",404!==d.status)this._source.fire(new bi(d,{tile:a}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else a.timeAdded=ax.now(),"expired"===c&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(b,a),"raster-dem"===this._source.type&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),this._source.fire(new bh("data",{dataType:"source",tile:a,coord:a.tileID,sourceCacheId:this.id}))}_backfillDEM(a){const b=this.getRenderableIds();for(let c=0;c1||(Math.abs(c)>1&&(1===Math.abs(c+f)?c+=f:1===Math.abs(c-f)&&(c-=f)),b.dem&&a.dem&&(a.dem.backfillBorder(b.dem,c,d),a.neighboringTiles&&a.neighboringTiles[g]&&(a.neighboringTiles[g].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(a,b,c,d){for(const f in this._tiles){let g=this._tiles[f];if(d[f]||!g.hasData()||g.tileID.overscaledZ<=b||g.tileID.overscaledZ>c)continue;let h=g.tileID;for(;g&&g.tileID.overscaledZ>b+1;){const i=g.tileID.scaledTo(g.tileID.overscaledZ-1);(g=this._tiles[i.key])&&g.hasData()&&(h=i)}let j=h;for(;j.overscaledZ>b;)if(a[(j=j.scaledTo(j.overscaledZ-1)).key]){d[h.key]=h;break}}}findLoadedParent(a,b){if(a.key in this._loadedParentTiles){const c=this._loadedParentTiles[a.key];return c&&c.tileID.overscaledZ>=b?c:null}for(let d=a.overscaledZ-1;d>=b;d--){const f=a.scaledTo(d),g=this._getLoadedTile(f);if(g)return g}}_getLoadedTile(a){const b=this._tiles[a.key];return b&&b.hasData()?b:this._cache.getByKey(this._source.reparseOverscaled?a.wrapped().key:a.canonical.key)}updateCacheSize(a,b){b=b||this._source.tileSize;const c=Math.ceil(a.width/b)+1,d=Math.ceil(a.height/b)+1,f=Math.floor(c*d*5),g="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,f):f,h="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(h)}handleWrapJump(a){const b=Math.round((a-(void 0===this._prevLng?a:this._prevLng))/360);if(this._prevLng=a,b){const c={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+b),c[f.tileID.key]=f}for(const g in this._tiles=c,this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const h in this._tiles)this._setTileReloadTimer(+h,this._tiles[h])}}update(a,b,c){if(this.transform=a,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;let d;this.updateCacheSize(a,b),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=a.getVisibleUnwrappedCoordinates(this._source.tileID).map(a=>new kh(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(d=a.coveringTiles({tileSize:b||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(d=d.filter(a=>this._source.hasTile(a)))):d=[];const f=this._updateRetainedTiles(d);if(kA(this._source.type)&&0!==d.length){const g={},h={},i=Object.keys(f);for(const j of i){const k=f[j],l=this._tiles[j];if(!l||l.fadeEndTime&&l.fadeEndTime<=ax.now())continue;const m=this.findLoadedParent(k,Math.max(k.overscaledZ-ky.maxOverzooming,this._source.minzoom));m&&(this._addTile(m.tileID),g[m.tileID.key]=m.tileID),h[j]=k}const n=d[d.length-1].overscaledZ;for(const o in this._tiles){const p=this._tiles[o];if(f[o]||!p.hasData())continue;let q=p.tileID;for(;q.overscaledZ>n;){q=q.scaledTo(q.overscaledZ-1);const r=this._tiles[q.key];if(r&&r.hasData()&&h[q.key]){f[o]=p.tileID;break}}}for(const s in g)f[s]||(this._coveredTiles[s]=!0,f[s]=g[s])}for(const u in f)this._tiles[u].clearFadeHold();const v=function(a,b){const c=[];for(const d in a)d in b||c.push(d);return c}(this._tiles,f);for(const w of v){const x=this._tiles[w];x.hasSymbolBuckets&&!x.holdingForFade()?x.setHoldDuration(this.map._fadeDuration):x.hasSymbolBuckets&&!x.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(+a)}_updateRetainedTiles(a){const b={};if(0===a.length)return b;const c={},d=a.reduce((a,b)=>Math.min(a,b.overscaledZ),1/0),f=a[0].overscaledZ,g=Math.max(f-ky.maxOverzooming,this._source.minzoom),h=Math.max(f+ky.maxUnderzooming,this._source.minzoom),i={};for(const j of a){const k=this._addTile(j);b[j.key]=j,k.hasData()||d=this._source.maxzoom){const n=l.children(this._source.maxzoom)[0],o=this.getTile(n);if(o&&o.hasData()){b[n.key]=n;continue}}else{const p=l.children(this._source.maxzoom);if(b[p[0].key]&&b[p[1].key]&&b[p[2].key]&&b[p[3].key])continue}let q=m.wasRequested();for(let r=l.overscaledZ-1;r>=g;--r){const s=l.scaledTo(r);if(c[s.key]||(c[s.key]=!0,(m=this.getTile(s))||!q||(m=this._addTile(s)),m&&(b[s.key]=s,q=m.wasRequested(),m.hasData())))break}}return b}_updateLoadedParentTileCache(){for(const a in this._loadedParentTiles={},this._tiles){const b=[];let c,d=this._tiles[a].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}b.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(f))break;d=f}for(const g of b)this._loadedParentTiles[g]=c}}_addTile(a){let b=this._tiles[a.key];if(b)return b;(b=this._cache.getAndRemove(a))&&(this._setTileReloadTimer(a.key,b),b.tileID=a,this._state.initializeTileState(b,this.map?this.map.painter:null),this._cacheTimers[a.key]&&(clearTimeout(this._cacheTimers[a.key]),delete this._cacheTimers[a.key],this._setTileReloadTimer(a.key,b)));const c=Boolean(b);if(!c){const d=this.map?this.map.painter:null,f="raster"===this._source.type||"raster-dem"===this._source.type;b=new kY(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,d,f),this._loadTile(b,this._tileLoaded.bind(this,b,a.key,b.state))}return b?(b.uses++,this._tiles[a.key]=b,c||this._source.fire(new bh("dataloading",{tile:b,coord:b.tileID,dataType:"source"})),b):null}_setTileReloadTimer(a,b){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const c=b.getExpiryTimeout();c&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},c))}_removeTile(a){const b=this._tiles[a];b&&(b.uses--,delete this._tiles[a],this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]),b.uses>0||(b.hasData()&&"reloading"!==b.state?this._cache.add(b.tileID,b,b.getExpiryTimeout()):(b.aborted=!0,this._abortTile(b),this._unloadTile(b))))}clearTiles(){for(const a in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+a);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(a,b,c){const d=[],f=this.transform;if(!f)return d;for(const g in this._tiles){const h=this._tiles[g];if(c&&h.clearQueryDebugViz(),h.holdingForFade())continue;const i=a.containsTile(h,f,b);i&&d.push(i)}return d}getVisibleCoordinates(a){const b=this.getRenderableIds(a).map(a=>this._tiles[a].tileID);for(const c of b)c.projMatrix=this.transform.calculateProjMatrix(c.toUnwrapped());return b}hasTransition(){if(this._source.hasTransition())return!0;if(kA(this._source.type))for(const a in this._tiles){const b=this._tiles[a];if(void 0!==b.fadeEndTime&&b.fadeEndTime>=ax.now())return!0}return!1}setFeatureState(a,b,c){this._state.updateState(a=a||"_geojsonTileLayer",b,c)}removeFeatureState(a,b,c){this._state.removeFeatureState(a=a||"_geojsonTileLayer",b,c)}getFeatureState(a,b){return this._state.getState(a=a||"_geojsonTileLayer",b)}setDependencies(a,b,c){const d=this._tiles[a];d&&d.setDependencies(b,c)}reloadTilesForDependencies(a,b){for(const c in this._tiles)this._tiles[c].hasDependency(a,b)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(a,b))}_preloadTiles(a,b){const c=new Map,d=Array.isArray(a)?a:[a],f=this.map.painter.terrain,g=this.usedForTerrain&&f?f.getScaledDemTileSize():this._source.tileSize;for(const h of d){const i=h.coveringTiles({tileSize:g,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const j of i)c.set(j.key,j);this.usedForTerrain&&h.updateElevation(!1)}const k=Array.from(c.values()),l="raster"===this._source.type||"raster-dem"===this._source.type;$(k,(a,b)=>{const c=new kY(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,this.map.painter,l);this._loadTile(c,a=>{"raster-dem"===this._source.type&&c.dem&&this._backfillDEM(c),b(a,c)})},b)}}function kz(a,b){const c=Math.abs(2*a.wrap)- +(a.wrap<0),d=Math.abs(2*b.wrap)- +(b.wrap<0);return a.overscaledZ-b.overscaledZ||d-c||b.canonical.y-a.canonical.y||b.canonical.x-a.canonical.x}function kA(a){return"raster"===a||"image"===a||"video"===a}ky.maxOverzooming=10,ky.maxUnderzooming=3;class kB{constructor(a,b,c){this._demTile=a,this._dem=this._demTile.dem,this._scale=b,this._offset=c}static create(a,b,c){const d=c||a.findDEMTileFor(b);if(!d||!d.dem)return;const f=d.dem,g=d.tileID,h=1<=0&&l[3]>=0&&i.insert(h,l[0],l[1],l[2],l[3])}}loadVTLayers(){if(!this.vtLayers)for(const a in this.vtLayers=new h3.VectorTile(new iH(this.rawTileData)).layers,this.sourceLayerCoder=new kn(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[a]=[];return this.vtLayers}query(a,b,c,d){this.loadVTLayers();const f=a.params||{},g=dz(f.filter),h=a.tileResult,i=a.transform,j=h.bufferedTilespaceBounds,k=this.grid.query(j.min.x,j.min.y,j.max.x,j.max.y,(a,b,c,d)=>gU(h.bufferedTilespaceGeometry,a,b,c,d));k.sort(kE);let l=null;i.elevation&&k.length>0&&(l=kB.create(i.elevation,this.tileID));const m={};let n;for(let o=0;o(r||(r=gG(b,this.tileID.canonical,a.tileTransform)),c.queryIntersectsFeature(h,b,d,r,this.z,a.transform,a.pixelPosMatrix,l,f)))}return m}loadMatchingFeature(a,b,c,d,f,g,h,i,j){const{featureIndex:k,bucketIndex:l,sourceLayerIndex:m,layoutVertexArrayOffset:n}=b,o=this.bucketLayerIDs[l];if(d&&!function(a,b){for(let c=0;c=0)return!0;return!1}(d,o))return;const p=this.sourceLayerCoder.decode(m),q=this.vtLayers[p].feature(k);if(c.needGeometry){const r=gH(q,!0);if(!c.filter(new e2(this.tileID.overscaledZ),r,this.tileID.canonical))return}else if(!c.filter(new e2(this.tileID.overscaledZ),q))return;const s=this.getId(q,p);for(let u=0;ud.indexOf(v))continue;const w=g[v];if(!w)continue;let x={};void 0!==s&&i&&(x=i.getState(w.sourceLayer||"_geojsonTileLayer",s));const y=aa({},h[v]);y.paint=kD(y.paint,w.paint,q,x,f),y.layout=kD(y.layout,w.layout,q,x,f);const z=!j||j(q,w,x,n);if(!z)continue;const A=new ko(q,this.z,this.x,this.y,s);A.layer=y;let B=a[v];void 0===B&&(B=a[v]=[]),B.push({featureIndex:k,feature:A,intersectionZ:z})}}lookupSymbolFeatures(a,b,c,d,f,g,h,i){const j={};this.loadVTLayers();const k=dz(f);for(const l of a)this.loadMatchingFeature(j,{bucketIndex:c,sourceLayerIndex:d,featureIndex:l,layoutVertexArrayOffset:0},k,g,h,i,b);return j}loadFeature(a){const{featureIndex:b,sourceLayerIndex:c}=a;this.loadVTLayers();const d=this.sourceLayerCoder.decode(c),f=this.vtFeatures[d];if(f[b])return f[b];const g=this.vtLayers[d].feature(b);return f[b]=g,g}hasLayer(a){for(const b of this.bucketLayerIDs)for(const c of b)if(a===c)return!0;return!1}getId(a,b){let c=a.id;return this.promoteId&&"boolean"==typeof(c=a.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[b]])&&(c=Number(c)),c}}function kD(a,b,c,d,f){return ai(a,(a,g)=>{const h=b instanceof e9?b.get(g):null;return h&&h.evaluate?h.evaluate(c,d,f):h})}function kE(a,b){return b-a}ec("FeatureIndex",kC,{omit:["rawTileData","sourceLayerCoder"]});var kF=fk([{name:"a_pos",type:"Int16",components:2},]);const kG=new Uint16Array(8184);for(let kH=0;kH<2046;kH++){let kI=kH+2,kJ=0,kK=0,kL=0,kM=0,kN=0,kO=0;for(1&kI?kL=kM=kN=32:kJ=kK=kO=32;(kI>>=1)>1;){const kP=kJ+kL>>1,kQ=kK+kM>>1;1&kI?(kL=kJ,kM=kK,kJ=kN,kK=kO):(kJ=kL,kK=kM,kL=kN,kM=kO),kN=kP,kO=kQ}const kR=4*kH;kG[kR+0]=kJ,kG[kR+1]=kK,kG[kR+2]=kL,kG[kR+3]=kM}const kS=new Uint16Array(2178),kT=new Uint8Array(1089),kU=new Uint16Array(1089);function kV(a){return 0===a?-.03125:32===a?.03125:0}var kW=fk([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const kX={type:2,extent:8192,loadGeometry:()=>[[new g(0,0),new g(8193,0),new g(8193,8193),new g(0,8193),new g(0,0),],]};class kY{constructor(a,b,c,d,f){this.tileID=a,this.uid=ac(),this.uses=0,this.tileSize=b,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(a){const b=a+this.timeAdded;bb.getLayer(a)).filter(Boolean);if(0!==f.length)for(const g of(d.layers=f,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(a=>f.filter(b=>b.id===a)[0])),f))c[g.id]=d}return c}(a.buckets,b.style),this.hasSymbolBuckets=!1,this.buckets){const f=this.buckets[d];if(f instanceof jW){if(this.hasSymbolBuckets=!0,!c)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const h=this.buckets[g];if(h instanceof jW&&h.hasRTLText){this.hasRTLText=!0,e1.isLoading()||e1.isLoaded()||"deferred"!==e_()||e0();break}}for(const i in this.queryPadding=0,this.buckets){const j=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,b.style.getLayer(i).queryRadius(j))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage),a.lineAtlas&&(this.lineAtlas=a.lineAtlas)}else this.collisionBoxArray=new fK}unloadVectorData(){if(this.hasData()){for(const a in this.buckets)this.buckets[a].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._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(a){return this.buckets[a.id]}upload(a){for(const b in this.buckets){const c=this.buckets[b];c.uploadPending()&&c.upload(a)}const d=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ka(a,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ka(a,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new ka(a,this.lineAtlas.image,d.ALPHA),this.lineAtlas.uploaded=!0)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,b,c,d,f,g,h,i){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:h,transform:g,params:f,tileTransform:this.tileTransform},a,b,c):{}}querySourceFeatures(a,b){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),f=b?b.sourceLayer:"",g=d._geojsonTileLayer||d[f];if(!g)return;const h=dz(b&&b.filter),{z:i,x:j,y:k}=this.tileID.canonical,l={z:i,x:j,y:k};for(let m=0;md)f=!1;else if(b){if(this.expirationTime=0;l--){const m=4*l,n=kG[m+0],o=kG[m+1],p=kG[m+2],q=kG[m+3],r=n+p>>1,s=o+q>>1,u=r+s-o,v=s+n-r,w=33*o+n,x=33*q+p,y=33*s+r,z=Math.hypot((kS[2*w+0]+kS[2*x+0])/2-kS[2*y+0],(kS[2*w+1]+kS[2*x+1])/2-kS[2*y+1])>=16;if(kT[y]=kT[y]||(z?1:0),l<1022){const A=(o+v>>1)*33+(n+u>>1),B=(q+v>>1)*33+(p+u>>1);kT[y]=kT[y]||kT[A]||kT[B]}}const C=new fn,D=new fy;let E=0;function F(a,b){const c=33*b+a;return 0===kU[c]&&(C.emplaceBack(kS[2*c+0],kS[2*c+1],8192*a/32,8192*b/32),kU[c]=++E),kU[c]-1}function G(a,b,c,d,f,g){const h=a+c>>1,i=b+d>>1;if(Math.abs(a-f)+Math.abs(b-g)>1&&kT[33*i+h])G(f,g,a,b,h,i),G(c,d,f,g,h,i);else{const j=F(a,b),k=F(c,d),l=F(f,g);D.emplaceBack(j,k,l)}}return G(0,0,32,32,32,0),G(32,32,0,0,0,32),{vertices:C,indices:D}}(this.tileID.canonical,b);d=g.vertices,f=g.indices}else{for(const{x:h,y:i}of(d=new fn,f=new fy,c))d.emplaceBack(h,i,0,0);const j=hi(d.int16,void 0,4);for(let k=0;k{const d=65*c+b;a.emplaceBack(d+1,d,d+65),a.emplaceBack(d+65,d+65+1,d+1)};for(let c=0;c<64;c++)for(let d=0;d<64;d++)b(d,c);return a}getWirefameBuffer(a){if(!this.wireframeSegments){const b=this._createWireframeGrid();this.wireframeIndexBuffer=a.createIndexBuffer(b),this.wireframeSegments=gq.simpleSegment(0,0,4096,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const a=new fF,b=(b,c)=>{const d=65*c+b;a.emplaceBack(d,d+1),a.emplaceBack(d,d+65),a.emplaceBack(d,d+65+1)};for(let c=0;c<64;c++)for(let d=0;d<64;d++)b(d,c);return a}}function ld(a,b){if(!b.isReprojectedInTileSpace)return{scale:1<v&&(w(a,k,d,f,i,j),w(k,c,i,j,g,h))}w(m,n,d,g,f,g),w(n,o,f,g,f,h),w(o,p,f,h,d,h),w(p,m,d,h,d,g),q-=v,r-=v,s+=v,u+=v;const x=1/Math.max(s-q,u-r);return{scale:x,x:q*x,y:r*x,x2:s*x,y2:u*x,projection:b}}class le{constructor(a){const b={},c=[];for(const d in a){const f=a[d],g=b[d]={};for(const h in f.glyphs){const i=f.glyphs[+h];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const j=i.metrics.localGlyph?2:1,k={x:0,y:0,w:i.bitmap.width+2*j,h:i.bitmap.height+2*j};c.push(k),g[h]=k}}const{w:l,h:m}=i_(c),n=new hb({width:l||1,height:m||1});for(const o in a){const p=a[o];for(const q in p.glyphs){const r=p.glyphs[+q];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const s=b[o][q],u=r.metrics.localGlyph?2:1;hb.copy(r.bitmap,n,{x:0,y:0},{x:s.x+u,y:s.y+u},r.bitmap)}}this.image=n,this.positions=b}}ec("GlyphAtlas",le);class lf{constructor(a){this.tileID=new kh(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),this.tileZoom=a.tileZoom,this.uid=a.uid,this.zoom=a.zoom,this.canonical=a.tileID.canonical,this.pixelRatio=a.pixelRatio,this.tileSize=a.tileSize,this.source=a.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=a.showCollisionBoxes,this.collectResourceTiming=!!a.collectResourceTiming,this.returnDependencies=!!a.returnDependencies,this.promoteId=a.promoteId,this.enableTerrain=!!a.enableTerrain,this.isSymbolTile=a.isSymbolTile,this.tileTransform=ld(a.tileID.canonical,a.projection),this.projection=a.projection}parse(a,b,c,d,f){this.status="parsing",this.data=a,this.collisionBoxArray=new fK;const g=new kn(Object.keys(a.layers).sort()),h=new kC(this.tileID,this.promoteId);h.bucketLayerIDs=[];const i={},j=new kb(256,256),k={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:j,availableImages:c},l=b.familiesBySource[this.source];for(const m in l){const n=a.layers[m];if(!n)continue;let o=!1,p=!1;for(const q of l[m])"symbol"===q[0].type?o=!0:p=!0;if(!0===this.isSymbolTile&&!o|| !1===this.isSymbolTile&&!p)continue;1===n.version&&am(`Vector tile source "${this.source}" layer "${m}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const r=g.encode(m),s=[];for(let u=0;u=y.maxzoom||"none"!==y.visibility&&(lg(x,this.zoom,c),(i[y.id]=y.createBucket({index:h.bucketLayerIDs.length,layers:x,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:r,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:c})).populate(s,k,this.tileID.canonical,this.tileTransform),h.bucketLayerIDs.push(x.map(a=>a.id)))}}let z,A,B,C;j.trim();const D={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},E=ai(k.glyphDependencies,a=>Object.keys(a).map(Number));Object.keys(E).length?d.send("getGlyphs",{uid:this.uid,stacks:E},(a,b)=>{z||(z=a,A=b,H.call(this))},void 0,!1,D):A={};const F=Object.keys(k.iconDependencies);F.length?d.send("getImages",{icons:F,source:this.source,tileID:this.tileID,type:"icons"},(a,b)=>{z||(z=a,B=b,H.call(this))},void 0,!1,D):B={};const G=Object.keys(k.patternDependencies);function H(){if(z)return f(z);if(A&&B&&C){const a=new le(A),b=new i1(B,C);for(const d in i){const g=i[d];g instanceof jW?(lg(g.layers,this.zoom,c),jG(g,A,a.positions,B,b.iconPositions,this.showCollisionBoxes,c,this.tileID.canonical,this.tileZoom,this.projection),g.projection=this.projection.name):g.hasPattern&&(g instanceof il||g instanceof hR||g instanceof h7)&&(lg(g.layers,this.zoom,c),g.addFeatures(k,this.tileID.canonical,b.patternPositions,c))}this.status="done",f(null,{buckets:_(i).filter(a=>!a.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:a.image,lineAtlas:j,imageAtlas:b,glyphMap:this.returnDependencies?A:null,iconMap:this.returnDependencies?B:null,glyphPositions:this.returnDependencies?a.positions:null})}}G.length?d.send("getImages",{icons:G,source:this.source,tileID:this.tileID,type:"patterns"},(a,b)=>{z||(z=a,C=b,H.call(this))},void 0,!1,D):C={},H.call(this)}}function lg(a,b,c){const d=new e2(b);for(const f of a)f.recalculate(d,c)}class lh{constructor(a){this.entries={},this.scheduler=a}request(a,b,c,d){const f=this.entries[a]=this.entries[a]||{callbacks:[]};if(f.result){const[g,h]=f.result;return this.scheduler?this.scheduler.add(()=>{d(g,h)},b):d(g,h),()=>{}}return f.callbacks.push(d),f.cancel||(f.cancel=c((c,d)=>{for(const g of(f.result=[c,d],f.callbacks))this.scheduler?this.scheduler.add(()=>{g(c,d)},b):g(c,d);setTimeout(()=>delete this.entries[a],3e3)})),()=>{f.result||(f.callbacks=f.callbacks.filter(a=>a!==d),f.callbacks.length||(f.cancel(),delete this.entries[a]))}}}function li(a,b,c){const d=JSON.stringify(a.request);return a.data&&(this.deduped.entries[d]={result:[null,a.data]}),this.deduped.request(d,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},b=>{const d=a7(a.request,(a,d,f,g)=>{a?b(a):d&&b(null,{vectorTile:c?void 0:new h3.VectorTile(new iH(d)),rawData:d,cacheControl:f,expires:g})});return()=>{d.cancel(),b()}},b)}const lj=l(new Float64Array(16));class lk{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lj}createTileMatrix(a){let b,c,d;const f=a.canonical,g=l(new Float64Array(16)),h=this._tr.projection;if(h.isReprojectedInTileSpace){const i=ld(f,h);b=1,c=i.x+a.wrap*i.scale,d=i.y,o(g,g,[b/i.scale,b/i.scale,this._tr.pixelsPerMeter/this._worldSize,])}else b=this._worldSize/this._tr.zoomScale(f.z),c=(f.x+Math.pow(2,f.z)*a.wrap)*b,d=f.y*b;return n(g,g,[c,d,0]),o(g,g,[b/8192,b/8192,1]),g}pointCoordinate(a,b,c){const d=this._tr.horizonLineFromTop(!1),f=new g(a,Math.max(d,b));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(f,c))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var ll={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&O(this.parallels,this.constants.parallels))return;const a=Math.sin(this.parallels[0]*P),b=(a+Math.sin(this.parallels[1]*P))/2,c=1+a*(2*b-a),d=Math.sqrt(c)/b;this.constants={n:b,c:c,r0:d,parallels:this.parallels}},project(a,b){this.initializeConstants();const c=(a-this.center[0])*P,{n:d,c:f,r0:g}=this.constants,h=Math.sqrt(f-2*d*Math.sin(b*P))/d;return{x:h*Math.sin(c*d),y:h*Math.cos(c*d)-g,z:0}},unproject(a,b){this.initializeConstants();const{n:c,c:d,r0:f}=this.constants,g=f+b;let h=Math.atan2(a,Math.abs(g))*Math.sign(g);g*c<0&&(h-=Math.PI*Math.sign(a)*Math.sign(g));const i=this.center[0]*P*c;h=Z(h,-Math.PI-i,Math.PI-i);const j=h/c*Q+this.center[0],k=Math.asin(X((d-(a*a+g*g)*c*c)/(2*c),-1,1)),l=X(k*Q,-85.051129,85.051129);return new gs(j,l)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)};const lm=Math.sqrt(3)/2;var ln={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b=b/180*Math.PI,a=a/180*Math.PI;const c=Math.asin(lm*Math.sin(b)),d=c*c,f=d*d*d;return{x:.5*(a*Math.cos(c)/(lm*(1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d)))/Math.PI+.5),y:1-.5*(c*(1.340264+ -.081106*d+f*(893e-6+.003796*d))/Math.PI+1),z:0}},unproject(a,b){a=(2*a-.5)*Math.PI;let c=b=(2*(1-b)-1)*Math.PI,d=c*c,f=d*d*d;for(let g,h,i,j=0;j<12&&(h=c*(1.340264+ -.081106*d+f*(893e-6+.003796*d))-b,i=1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d),g=h/i,c=X(c-g,-Math.PI/3,Math.PI/3),d=c*c,f=d*d*d,!(1e-12>Math.abs(g)));++j);const k=lm*a*(1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d))/Math.cos(c),l=Math.asin(Math.sin(c)/lm),m=X(180*k/Math.PI,-180,180),n=X(180*l/Math.PI,-85.051129,85.051129);return new gs(m,n)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)},lo={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(a,b)=>({x:.5+a/360,y:.5-b/360,z:0}),unproject(a,b){const c=X(360*(.5-b),-85.051129,85.051129);return new gs(360*(a-.5),c)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)};const lp=Math.PI/2;function lq(a){return Math.tan((lp+a)/2)}var lr,ls={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&O(this.parallels,this.constants.parallels))return;const a=this.parallels[0]*P,b=this.parallels[1]*P,c=Math.cos(a),d=a===b?Math.sin(a):Math.log(c/Math.cos(b))/Math.log(lq(b)/lq(a)),f=c*Math.pow(lq(a),d)/d;this.constants={n:d,f:f,parallels:this.parallels}},project(a,b){this.initializeConstants(),b*=P,a=(a-this.center[0])*P;const{n:c,f:d}=this.constants;d>0?b< -lp+1e-6&&(b=-lp+1e-6):b>lp-1e-6&&(b=lp-1e-6);const f=d/Math.pow(lq(b),c),g=f*Math.sin(c*a),h=d-f*Math.cos(c*a);return{x:.5*(g/Math.PI+.5),y:1-.5*(h/Math.PI+.5),z:0}},unproject(a,b){this.initializeConstants(),a=(2*a-.5)*Math.PI,b=(2*(1-b)-.5)*Math.PI;const{n:c,f:d}=this.constants,f=d-b,g=Math.sign(f),h=Math.sign(c)*Math.sqrt(a*a+f*f);let i=Math.atan2(a,Math.abs(f))*g;f*c<0&&(i-=Math.PI*Math.sign(a)*g);const j=X(i/c*Q+this.center[0],-180,180),k=X((2*Math.atan(Math.pow(d/h,1/c))-lp)*Q,-85.051129,85.051129);return new gs(j,k)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)},lt={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(a,b)=>({x:gv(a),y:gw(b),z:0}),unproject(a,b){const c=gy(a),d=gz(b);return new gs(c,d)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)};const lu=85.051129*P;var lv={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(a,b){const c=(b*=P)*b,d=c*c;return{x:.5*((a*=P)*(.8707-.131979*c+d*(d*(.003971*c-.001529*d)-.013791))/Math.PI+.5),y:1-.5*(b*(1.007226+c*(.015085+d*(.028874*c-.044475-.005916*d)))/Math.PI+1),z:0}},unproject(a,b){a=(2*a-.5)*Math.PI;let c=b=(2*(1-b)-1)*Math.PI,d=25,f=0,g=c*c;do{g=c*c;const h=g*g;f=(c*(1.007226+g*(.015085+h*(.028874*g-.044475-.005916*h)))-b)/(1.007226+g*(.045255+h*(.259866*g-.311325-.005916*11*h))),c=X(c-f,-lu,lu)}while(Math.abs(f)>1e-6&& --d>0)g=c*c;const i=X(a/(.8707+g*(g*(g*g*g*(.003971-.001529*g)-.013791)-.131979))*Q,-180,180),j=c*Q;return new gs(i,j)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)};const lw=85.051129*P,lx={albers:ll,equalEarth:ln,equirectangular:lo,lambertConformalConic:ls,mercator:lt,naturalEarth:lv,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b*=P,a*=P;const c=Math.cos(b),d=2/Math.PI,f=Math.acos(c*Math.cos(a/2)),g=Math.sin(f)/f,h=.5*(a*d+2*c*Math.sin(a/2)/g)||0,i=.5*(b+Math.sin(b)/g)||0;return{x:.5*(h/Math.PI+.5),y:1-.5*(i/Math.PI+1),z:0}},unproject(a,b){let c=a=(2*a-.5)*Math.PI,d=b=(2*(1-b)-1)*Math.PI,f=25,g=0,h=0;do{const i=Math.cos(d),j=Math.sin(d),k=2*j*i,l=j*j,m=i*i,n=Math.cos(c/2),o=Math.sin(c/2),p=2*n*o,q=o*o,r=1-m*n*n,s=r?1/r:0,u=r?Math.acos(i*n)*Math.sqrt(1/r):0,v=.5*(2*u*i*o+2*c/Math.PI)-a,w=.5*(u*j+d)-b,x=.5*s*(m*q+u*i*n*l)+1/Math.PI,y=s*(p*k/4-u*j*o),z=.125*s*(k*o-u*j*m*p),A=.5*s*(l*n+u*q*i)+.5,B=y*z-A*x;g=(w*y-v*A)/B,h=(v*z-w*x)/B,c=X(c-g,-Math.PI,Math.PI),d=X(d-h,-lw,lw)}while((Math.abs(g)>1e-6||Math.abs(h)>1e-6)&& --f>0)return new gs(c*Q,d*Q)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return k0(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lk(a,b)}};a.ARRAY_TYPE=j,a.AUTH_ERR_MSG=aI,a.Aabb=g1,a.Actor=class{constructor(a,b,c){this.target=a,this.parent=b,this.mapId=c,this.callbacks={},this.cancelCallbacks={},ag(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ap()?a:i,this.scheduler=new class{constructor(){this.tasks={},this.taskQueue=[],ag(["process"],this),this.invoker=new class{constructor(a){this._callback=a,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(){delete this._channel,this._callback=()=>{}}}(this.process),this.nextId=0}add(a,b){const c=this.nextId++,d=function({type:a,isSymbolTile:b,zoom:c}){return c=c||0,"message"===a?0:"maybePrepare"!==a||b?"parseTile"!==a||b?"parseTile"===a&&b?300-c:"maybePrepare"===a&&b?400-c:500:200-c:100-c}(b);return 0===d?(ap(),a(),{cancel:()=>{}}):(this.tasks[c]={fn:a,metadata:b,priority:d,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}})}process(){ap();{if(this.taskQueue=this.taskQueue.filter(a=>!!this.tasks[a]),!this.taskQueue.length)return;const a=this.pick();if(null===a)return;const b=this.tasks[a];if(delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),!b)return;b.fn()}}pick(){let a=null,b=1/0;for(let c=0;c{c&&delete this.callbacks[h],this.target.postMessage({id:h,type:"",targetMapId:d,sourceMapId:this.mapId})}}}receive(a){const b=a.data,c=b.id;if(c&&(!b.targetMapId||this.mapId===b.targetMapId)){if(""===b.type){const d=this.cancelCallbacks[c];delete this.cancelCallbacks[c],d&&d.cancel()}else if(b.mustQueue||ap()){const f=this.callbacks[c];this.cancelCallbacks[c]=this.scheduler.add(()=>this.processTask(c,b),f&&f.metadata||{type:"message"})}else this.processTask(c,b)}}processTask(a,b){if(""===b.type){const c=this.callbacks[a];delete this.callbacks[a],c&&(b.error?c(eh(b.error)):c(null,eh(b.data)))}else{const d=av(this.globalScope)?void 0:[],f=b.hasCallback?(b,c)=>{delete this.cancelCallbacks[a],this.target.postMessage({id:a,type:"",sourceMapId:this.mapId,error:b?eg(b):null,data:eg(c,d)},d)}:a=>{},g=eh(b.data);if(this.parent[b.type])this.parent[b.type](b.sourceMapId,g,f);else if(this.parent.getWorkerSource){const h=b.type.split(".");this.parent.getWorkerSource(b.sourceMapId,h[0],g.source)[h[1]](g,f)}else f(Error(`Could not find function ${b.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.CanonicalTileID=kf,a.Color=bK,a.ColorMode=kl,a.CullFaceMode=km,a.DEMData=kx,a.DataConstantProperty=fa,a.DedupedRequest=lh,a.DepthMode=kj,a.EXTENT=8192,a.Elevation=class{getAtPointOrZero(a,b=0){return this.getAtPoint(a,b)||0}getAtPoint(a,b,c=!0){null==b&&(b=null);const d=this._source();if(!d||a.y<0||a.y>1)return b;const f=d.getSource().maxzoom,g=1<{const d=this.getAtTileOffset(a,c.x,c.y),f=b.upVector(a.canonical,c.x,c.y);return B(f,f,d*b.upVectorScale(a.canonical)),f}}getForTilePoints(a,b,c,d){const f=kB.create(this,a,d);return!!f&&(b.forEach(a=>{a[2]=this.exaggeration()*f.getElevationAt(a[0],a[1],c)}),!0)}getMinMaxForTile(a){const b=this.findDEMTileFor(a);if(!b||!b.dem)return null;const c=b.dem.tree,d=b.tileID,f=1<Math.abs(d))return!1;const f=((a[0]-this.pos[0])*b[0]+(a[1]-this.pos[1])*b[1]+(a[2]-this.pos[2])*b[2])/d;return c[0]=this.pos[0]+this.dir[0]*f,c[1]=this.pos[1]+this.dir[1]*f,c[2]=this.pos[2]+this.dir[2]*f,!0}closestPointOnSphere(a,b,c){var d,f,g,h,i,j,k,l;if(d=this.pos,f=a,g=d[0],h=d[1],i=d[2],j=f[0],k=f[1],l=f[2],Math.abs(g-j)<=1e-6*Math.max(1,Math.abs(g),Math.abs(j))&&Math.abs(h-k)<=1e-6*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(i-l)<=1e-6*Math.max(1,Math.abs(i),Math.abs(l))||0===b)return c[0]=c[1]=c[2]=0,!1;const[m,n,o]=this.dir,p=this.pos[0]-a[0],q=this.pos[1]-a[1],r=this.pos[2]-a[2],s=m*m+n*n+o*o,u=2*(p*m+q*n+r*o),v=u*u-4*s*(p*p+q*q+r*r-b*b);if(v<0){const w=Math.max(-u/2,0),x=p+m*w,y=q+n*w,z=r+o*w,A=Math.hypot(x,y,z);return c[0]=x*b/A,c[1]=y*b/A,c[2]=z*b/A,!1}{const B=(-u-Math.sqrt(v))/(2*s);if(B<0){const C=Math.hypot(p,q,r);return c[0]=p*b/C,c[1]=q*b/C,c[2]=r*b/C,!1}return c[0]=p+m*B,c[1]=q+n*B,c[2]=r+o*B,!0}}},a.RequestManager=class{constructor(a,b,c){this._transformRequestFn=a,this._customAccessToken=b,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const a=function(){let a="";for(let b=0;b<10;b++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",a].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(a,b){return this._transformRequestFn&&this._transformRequestFn(a,b)||{url:a}}normalizeStyleURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||b)}normalizeGlyphsURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||b)}normalizeSourceURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/v4/${c.authority}.json`,c.params.push("secure"),this._makeAPIURL(c,this._customAccessToken||b)}normalizeSpriteURL(a,b,c,d){const f=aM(a);return aJ(a)?(f.path=`/styles/v1${f.path}/sprite${b}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${b}${c}`,aN(f))}normalizeTileURL(a,b,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),a&&!aJ(a))return a;const d=aM(a);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${b||c&&"raster"!==d.authority&&512===c?"@2x":""}${aC.supported?".webp":"$1"}`),"raster"===d.authority?d.path=`/${az.RASTER_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${az.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||function(a){for(const b of a){const c=b.match(/^access_token=(.*)$/);if(c)return c[1]}return null}(d.params)||az.ACCESS_TOKEN;return az.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(a,b){const c=aM(a);if(!c.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!c.path.match(/\.[\w]+$/))return a;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${az.RASTER_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${az.TILE_URL_VERSION}/`,"")}`;let f=c.params;return b&&(f=f.filter(a=>!a.match(/^access_token=/))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(a,b){const c=!!b&&aJ(b),d=[];for(const f of a.tiles||[])aK(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(a,b){const c="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",d=aM(az.API_URL);if(a.protocol=d.protocol,a.authority=d.authority,"http"===a.protocol){const f=a.params.indexOf("secure");f>=0&&a.params.splice(f,1)}if("/"!==d.path&&(a.path=`${d.path}${a.path}`),!az.REQUIRE_ACCESS_TOKEN)return aN(a);if(b=b||az.ACCESS_TOKEN,!this._silenceAuthErrors){if(!b)throw Error(`An API access token is required to use Mapbox GL. ${c}`);if("s"===b[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return a.params=a.params.filter(a=>-1===a.indexOf("access_token")),a.params.push(`access_token=${b||""}`),aN(a)}},a.ResourceType=a3,a.SegmentVector=gq,a.SourceCache=ky,a.StencilMode=kk,a.StructArrayLayout1ui2=fG,a.StructArrayLayout2f1f2i16=fw,a.StructArrayLayout2i4=fm,a.StructArrayLayout2ui4=fF,a.StructArrayLayout3f12=fp,a.StructArrayLayout3ui6=fy,a.StructArrayLayout4i8=fn,a.Texture=ka,a.Tile=kY,a.Transitionable=e5,a.Uniform1f=f3,a.Uniform1i=class extends f2{constructor(a,b){super(a,b),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},a.Uniform2f=class extends f2{constructor(a,b){super(a,b),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},a.Uniform3f=class extends f2{constructor(a,b){super(a,b),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},a.Uniform4f=f4,a.UniformColor=f5,a.UniformMatrix2f=class extends f2{constructor(a,b){super(a,b),this.current=f8}set(a){for(let b=0;b<4;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix2fv(this.location,!1,a);break}}},a.UniformMatrix3f=class extends f2{constructor(a,b){super(a,b),this.current=f7}set(a){for(let b=0;b<9;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix3fv(this.location,!1,a);break}}},a.UniformMatrix4f=class extends f2{constructor(a,b){super(a,b),this.current=f6}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let b=1;b<16;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},a.UnwrappedTileID=kg,a.ValidationError=bl,a.VectorTileWorkerSource=class extends bj{constructor(a,b,c,d,f){super(),this.actor=a,this.layerIndex=b,this.availableImages=c,this.loadVectorData=f||li,this.loading={},this.loaded={},this.deduped=new lh(a.scheduler),this.isSpriteLoaded=d,this.scheduler=a.scheduler}loadTile(a,b){const c=a.uid,d=a&&a.request,f=d&&d.collectResourceTiming,g=this.loading[c]=new lf(a);g.abort=this.loadVectorData(a,(h,i)=>{const j=!this.loading[c];if(delete this.loading[c],j||h||!i)return g.status="done",j||(this.loaded[c]=g),b(h);const k=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl),g.vectorTile=i.vectorTile||new h3.VectorTile(new iH(k));const m=()=>{g.parse(g.vectorTile,this.layerIndex,this.availableImages,this.actor,(a,c)=>{if(a||!c)return b(a);const g={};if(f){const h=kd(d);h.length>0&&(g.resourceTiming=JSON.parse(JSON.stringify(h)))}b(null,aa({rawTileData:k.slice(0)},c,l,g))})};this.isSpriteLoaded?m():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(m,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom}):m()}),this.loaded=this.loaded||{},this.loaded[c]=g})}reloadTile(a,b){const c=this.loaded,d=a.uid,f=this;if(c&&c[d]){const g=c[d];g.showCollisionBoxes=a.showCollisionBoxes,g.enableTerrain=!!a.enableTerrain,g.projection=a.projection;const h=(a,c)=>{const d=g.reloadCallback;d&&(delete g.reloadCallback,g.parse(g.vectorTile,f.layerIndex,this.availableImages,f.actor,d)),b(a,c)};"parsing"===g.status?g.reloadCallback=h:"done"===g.status&&(g.vectorTile?g.parse(g.vectorTile,this.layerIndex,this.availableImages,this.actor,h):h())}}abortTile(a,b){const c=a.uid,d=this.loading[c];d&&(d.abort&&d.abort(),delete this.loading[c]),b()}removeTile(a,b){const c=this.loaded,d=a.uid;c&&c[d]&&delete c[d],b()}},a.WritingMode=i2,a.ZoomHistory=ei,a.add=x,a.addDynamicAttributes=jS,a.adjoint=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8];return a[0]=h*l-i*k,a[1]=f*k-d*l,a[2]=d*i-f*h,a[3]=i*j-g*l,a[4]=c*l-f*j,a[5]=f*g-c*i,a[6]=g*k-h*j,a[7]=d*j-c*k,a[8]=c*h-d*g,a},a.asyncAll=$,a.bezier=V,a.bindAll=ag,a.boundsAttributes=kW,a.bufferConvexPolygon=function(a,b){const c=[];for(let d=0;da_&&(a.getActor().send("enforceCacheSizeLimit",a$),a2=0)},a.calculateGlobeMatrix=lb,a.calculateGlobeMercatorMatrix=function(a){const b=a.worldSize,c=X(a.center.lat,-85.051129,85.051129),d=new g(gv(a.center.lng)*b,gw(c)*b),f=1/gu(a.center.lat)*b,h=a.pixelsPerMeter,i=b/(f/a.pixelsPerMeter),j=l(new Float64Array(16));return n(j,j,[d.x,d.y,0]),o(j,j,[i,i,h]),j},a.clamp=X,a.clearTileCache=function(a){const b=i.caches.delete(aX);a&&b.catch(a).then(()=>a())},a.clipLine=jq,a.clone=function(a){var b=new j(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],b},a.clone$1=ak,a.collisionCircleLayout=iw,a.config=az,a.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a},a.create=function(){var a=new j(16);return j!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},a.create$1=k,a.createExpression=dk,a.createLayout=fk,a.createStyleLayer=function(a){return"custom"===a.type?new j1(a):new j4[a.type](a)},a.cross=F,a.degToRad=R,a.div=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a},a.dot=E,a.ease=W,a.easeCubicInOut=U,a.emitValidationErrors=d6,a.endsWith=ah,a.enforceCacheSizeLimit=function(a){a0(),aY&&aY.then(b=>{b.keys().then(c=>{for(let d=0;dg&&(d+=(a[f]-g)*(a[f]-g)),b[f]Math.abs(b.parallels[0]+b.parallels[1])){let c=function(a){const b=Math.max(.01,Math.cos(a*P)),c=1/(2*Math.max(Math.PI*b,1/b));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(a,d){const f=a*P*b,g=Math.sin(d*P)/b;return{x:f*c+.5,y:-g*c+.5,z:0}},unproject(a,d){const f=-(d-.5)/c,g=X((a-.5)/c*Q/b,-180,180),h=Math.asin(X(f*b,-1,1)),i=X(h*Q,-85.051129,85.051129);return new gs(g,i)}}}(b.parallels[0]);if("lambertConformalConic"===b.name){const{project:d,unproject:f}=lx.mercator;c={wrap:!0,supportsWorldCopies:!0,project:d,unproject:f}}return aa({},a,b,c)}return aa({},a,b)}(b,a):b},a.getRTLTextPluginStatus=e_,a.getReferrer=a5,a.getTilePoint=function(a,{x:b,y:c},d=0){return new g(((b-d)*a.scale-a.x)*8192,(c*a.scale-a.y)*8192)},a.getTileVec3=function(a,b,c=0){return w(((b.x-c)*a.scale-a.x)*8192,(b.y*a.scale-a.y)*8192,gA(b.z,b.y))},a.getVideo=function(a,b){const c=i.document.createElement("video");c.muted=!0,c.onloadstart=function(){b(null,c)};for(let d=0;d{}}},a.globeBuffersForTileMesh=function(a,b,c,d){const f=a.context,g=a.transform;let h=b.globeGridBuffer,i=b.globePoleBuffer;if(!h){const j=lc.createGridVertices(c.canonical);h=b.globeGridBuffer=f.createVertexBuffer(j,k_,!1)}if(!i){const k=lc.createPoleTriangleVertices(d,g.tileSize*d,0===c.canonical.y);i=b.globePoleBuffer=f.createVertexBuffer(k,k_,!1)}return[h,i]},a.globeDenormalizeECEF=la,a.globeMatrixForTile=function(a,b){var c,d;const f=la(k5(a)),g=((c=new Float64Array(16))[0]=(d=b)[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=d[6],c[7]=d[7],c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15],c);return r(g,g,f),g},a.globePoleMatrixForTile=function(a,b,c){const d=l(new Float64Array(16)),f=Math.pow(2,a.z),g=(a.x-f/2)/f*Math.PI*2,h=c.point,i=c.worldSize/(c.tileSize*f);return n(d,d,[h.x,h.y,-c.worldSize/Math.PI/2,]),o(d,d,[i,i,i]),p(d,d,-c._center.lat*P),q(d,d,-c._center.lng*P),q(d,d,g),b&&o(d,d,[1,-1,1]),d},a.globeTileBounds=k5,a.globeToMercatorTransition=function(a){return Y(5,6,a)},a.identity=l,a.identity$1=M,a.invert=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],s=b[15],u=c*i-d*h,v=c*j-f*h,w=c*k-g*h,x=d*j-f*i,y=d*k-g*i,z=f*k-g*j,A=l*q-m*p,B=l*r-n*p,C=l*s-o*p,D=m*r-n*q,E=m*s-o*q,F=n*s-o*r,G=u*F-v*E+w*D+x*C-y*B+z*A;return G?(a[0]=(i*F-j*E+k*D)*(G=1/G),a[1]=(f*E-d*F-g*D)*G,a[2]=(q*z-r*y+s*x)*G,a[3]=(n*y-m*z-o*x)*G,a[4]=(j*C-h*F-k*B)*G,a[5]=(c*F-f*C+g*B)*G,a[6]=(r*w-p*z-s*v)*G,a[7]=(l*z-n*w+o*v)*G,a[8]=(h*E-i*C+k*A)*G,a[9]=(d*C-c*E-g*A)*G,a[10]=(p*y-q*w+s*u)*G,a[11]=(m*w-l*y-o*u)*G,a[12]=(i*B-h*D-j*A)*G,a[13]=(c*D-d*B+f*A)*G,a[14]=(q*v-p*x-r*u)*G,a[15]=(l*x-m*v+n*u)*G,a):null},a.isMapAuthenticated=function(a){return aW.has(a)},a.isMapboxURL=aJ,a.latFromMercatorY=gz,a.len=v,a.length=v,a.length$1=function(a){return Math.hypot(a[0],a[1],a[2],a[3])},a.loadVectorTile=li,a.makeRequest=a6,a.mercatorXfromLng=gv,a.mercatorYfromLat=gw,a.mercatorZfromAltitude=gx,a.mul=r,a.mul$1=z,a.multiply=function(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=c[0],o=c[1],p=c[2],q=c[3],r=c[4],s=c[5],u=c[6],v=c[7],w=c[8];return a[0]=n*d+o*h+p*k,a[1]=n*f+o*i+p*l,a[2]=n*g+o*j+p*m,a[3]=q*d+r*h+s*k,a[4]=q*f+r*i+s*l,a[5]=q*g+r*j+s*m,a[6]=u*d+v*h+w*k,a[7]=u*f+v*i+w*l,a[8]=u*g+v*j+w*m,a},a.multiply$1=m,a.multiply$2=z,a.nextPowerOfTwo=ae,a.normalize=D,a.normalize$1=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=c*c+d*d+f*f+g*g;return h>0&&(h=1/Math.sqrt(h)),a[0]=c*h,a[1]=d*h,a[2]=f*h,a[3]=g*h,a},a.number=cr,a.ortho=function(a,b,c,d,f,g,h){var i=1/(b-c),j=1/(d-f),k=1/(g-h);return a[0]=-2*i,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*j,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*k,a[11]=0,a[12]=(b+c)*i,a[13]=(f+d)*j,a[14]=(h+g)*k,a[15]=1,a},a.pbf=iH,a.perspective=function(a,b,c,d,f){var g,h=1/Math.tan(b/2);return a[0]=h/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=f&&f!==1/0?(a[10]=(f+d)*(g=1/(d-f)),a[14]=2*f*d*g):(a[10]=-1,a[14]=-2*d),a},a.pick=function(a,b){const c={};for(let d=0;dthis._layers[a.id]),k=j[0];if("none"===k.visibility)continue;const l=k.source||"";let m=this.familiesBySource[l];m||(m=this.familiesBySource[l]={});const n=k.sourceLayer||"_geojsonTileLayer";let o=m[n];o||(o=m[n]=[]),o.push(j)}}}const{ImageBitmap:f}=a.window;class g{loadTile(b,c){const{uid:d,encoding:g,rawImageData:h,padding:i,buildQuadTree:j}=b,k=f&&h instanceof f?this.getImageData(h,i):h;c(null,new a.DEMData(d,k,g,i<1,j))}getImageData(b,c){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const d=this.offscreenCanvasContext.getImageData(-c,-c,b.width+2*c,b.height+2*c);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:d.width,height:d.height},d.data)}}var h,i=function a(b,c){var d,f=b&&b.type;if("FeatureCollection"===f)for(d=0;d=Math.abs(i)?c-j+i:i-j+c,c=j}c+d>=0!= !!b&&a.reverse()}const l=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class m{constructor(b){this._feature=b,this.extent=a.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(1===this._feature.type){const b=[];for(const c of this._feature.geometry)b.push([new a.pointGeometry(c[0],c[1]),]);return b}{const d=[];for(const f of this._feature.geometry){const g=[];for(const h of f)g.push(new a.pointGeometry(h[0],h[1]));d.push(g)}return d}}toGeoJSON(a,b,c){return l.call(this,a,b,c)}}class n{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(a){return new m(this._features[a])}}var o=a.vectorTile.VectorTileFeature,p=q;function q(a,b){this.options=b||{},this.features=a,this.length=a.length}function r(a,b){this.id="number"==typeof a.id?a.id:void 0,this.type=a.type,this.rawGeometry=1===a.type?[a.geometry]:a.geometry,this.properties=a.tags,this.extent=b||4096}q.prototype.feature=function(a){return new r(this.features[a],this.options.extent)},r.prototype.loadGeometry=function(){var b=this.rawGeometry;this.geometry=[];for(var c=0;c>31}function A(a,b){for(var c=a.loadGeometry(),d=a.type,f=0,g=0,h=c.length,i=0;i>1;D(a,b,h,d,f,g%2),C(a,b,c,d,h-1,g+1),C(a,b,c,h+1,f,g+1)}function D(a,b,c,d,f,g){for(;f>d;){if(f-d>600){const h=f-d+1,i=c-d+1,j=Math.log(h),k=.5*Math.exp(2*j/3),l=.5*Math.sqrt(j*k*(h-k)/h)*(i-h/2<0?-1:1);D(a,b,c,Math.max(d,Math.floor(c-i*k/h+l)),Math.min(f,Math.floor(c+(h-i)*k/h+l)),g)}const m=b[2*c+g];let n=d,o=f;for(E(a,b,d,c),b[2*f+g]>m&&E(a,b,d,f);nm;)o--}b[2*d+g]===m?E(a,b,d,o):E(a,b,++o,f),o<=c&&(d=o+1),c<=o&&(f=o-1)}}function E(a,b,c,d){F(a,c,d),F(b,2*c,2*d),F(b,2*c+1,2*d+1)}function F(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function G(a,b,c,d){const f=a-c,g=b-d;return f*f+g*g}s.fromVectorTileJs=u,s.fromGeojsonVt=function(a,b){b=b||{};var c={};for(var d in a)c[d]=new p(a[d].features,b),c[d].name=d,c[d].version=b.version,c[d].extent=b.extent;return u({layers:c})},s.GeoJSONWrapper=p;const H=a=>a[0],I=a=>a[1];class J{constructor(a,b=H,c=I,d=64,f=Float64Array){this.nodeSize=d,this.points=a;const g=a.length<65536?Uint16Array:Uint32Array,h=this.ids=new g(a.length),i=this.coords=new f(2*a.length);for(let j=0;j=c&&k<=f&&l>=d&&l<=g&&j.push(a[p]);continue}const q=Math.floor((o+n)/2);k=b[2*q],l=b[2*q+1],k>=c&&k<=f&&l>=d&&l<=g&&j.push(a[q]);const r=(m+1)%2;(0===m?c<=k:d<=l)&&(i.push(o),i.push(q-1),i.push(r)),(0===m?f>=k:g>=l)&&(i.push(q+1),i.push(n),i.push(r))}return j}(this.ids,this.coords,a,b,c,d,this.nodeSize)}within(a,b,c){return function(a,b,c,d,f,g){const h=[0,a.length-1,0],i=[],j=f*f;for(;h.length;){const k=h.pop(),l=h.pop(),m=h.pop();if(l-m<=g){for(let n=m;n<=l;n++)G(b[2*n],b[2*n+1],c,d)<=j&&i.push(a[n]);continue}const o=Math.floor((m+l)/2),p=b[2*o],q=b[2*o+1];G(p,q,c,d)<=j&&i.push(a[o]);const r=(k+1)%2;(0===k?c-f<=p:d-f<=q)&&(h.push(m),h.push(o-1),h.push(r)),(0===k?c+f>=p:d+f>=q)&&(h.push(o+1),h.push(l),h.push(r))}return i}(this.ids,this.coords,a,b,c,this.nodeSize)}}const K=Math.fround||(h=new Float32Array(1),a=>(h[0]=+a,h[0]));class L{constructor(a){this.options=T(Object.create({minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a}),a),this.trees=Array(this.options.maxZoom+1)}load(a){const{log:b,minZoom:c,maxZoom:d,nodeSize:f}=this.options;b&&console.time("total time");const g=`prepare ${a.length} points`;b&&console.time(g),this.points=a;let h=[];for(let i=0;i=c;j--){const k=+Date.now();h=this._cluster(h,j),this.trees[j]=new J(h,U,V,f,Float32Array),b&&console.log("z%d: %d clusters in %dms",j,h.length,+Date.now()-k)}return b&&console.timeEnd("total time"),this}getClusters(a,b){let c=((a[0]+180)%360+360)%360-180;const d=Math.max(-90,Math.min(90,a[1]));let f=180===a[2]?180:((a[2]+180)%360+360)%360-180;const g=Math.max(-90,Math.min(90,a[3]));if(a[2]-a[0]>=360)c=-180,f=180;else if(c>f){const h=this.getClusters([c,d,180,g],b),i=this.getClusters([-180,d,f,g],b);return h.concat(i)}const j=this.trees[this._limitZoom(b)],k=j.range(Q(c),R(g),Q(f),R(d)),l=[];for(const m of k){const n=j.points[m];l.push(n.numPoints?O(n):this.points[n.index])}return l}getChildren(a){const b=this._getOriginId(a),c=this._getOriginZoom(a),d="No cluster with the specified id.",f=this.trees[c];if(!f)throw Error(d);const g=f.points[b];if(!g)throw Error(d);const h=this.options.radius/(this.options.extent*Math.pow(2,c-1)),i=f.within(g.x,g.y,h),j=[];for(const k of i){const l=f.points[k];l.parentId===a&&j.push(l.numPoints?O(l):this.points[l.index])}if(0===j.length)throw Error(d);return j}getLeaves(a,b,c){const d=[];return this._appendLeaves(d,a,b=b||10,c=c||0,0),d}getTile(a,b,c){const d=this.trees[this._limitZoom(a)],f=Math.pow(2,a),{extent:g,radius:h}=this.options,i=h/g,j=(c-i)/f,k=(c+1+i)/f,l={features:[]};return this._addTileFeatures(d.range((b-i)/f,j,(b+1+i)/f,k),d.points,b,c,f,l),0===b&&this._addTileFeatures(d.range(1-i/f,j,1,k),d.points,f,c,f,l),b===f-1&&this._addTileFeatures(d.range(0,j,i/f,k),d.points,-1,c,f,l),l.features.length?l:null}getClusterExpansionZoom(a){let b=this._getOriginZoom(a)-1;for(;b<=this.options.maxZoom;){const c=this.getChildren(a);if(b++,1!==c.length)break;a=c[0].properties.cluster_id}return b}_appendLeaves(a,b,c,d,f){const g=this.getChildren(b);for(const h of g){const i=h.properties;if(i&&i.cluster?f+i.point_count<=d?f+=i.point_count:f=this._appendLeaves(a,i.cluster_id,c,d,f):fb&&(o+=q.numPoints||1)}if(o>n&&o>=h){let r=k.x*n,s=k.y*n,u=g&&n>1?this._map(k,!0):null;const v=(j<<5)+(b+1)+this.points.length;for(const w of m){const x=l.points[w];if(x.zoom<=b)continue;x.zoom=b;const y=x.numPoints||1;r+=x.x*y,s+=x.y*y,x.parentId=v,g&&(u||(u=this._map(k,!0)),g(u,this._map(x)))}k.parentId=v,c.push(M(r/o,s/o,v,o,u))}else if(c.push(k),o>1)for(const z of m){const A=l.points[z];A.zoom<=b||(A.zoom=b,c.push(A))}}return c}_getOriginId(a){return a-this.points.length>>5}_getOriginZoom(a){return(a-this.points.length)%32}_map(a,b){if(a.numPoints)return b?T({},a.properties):a.properties;const c=this.points[a.index].properties,d=this.options.map(c);return b&&d===c?T({},d):d}}function M(a,b,c,d,f){return{x:K(a),y:K(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:f}}function N(a,b){const[c,d]=a.geometry.coordinates;return{x:K(Q(c)),y:K(R(d)),zoom:1/0,index:b,parentId:-1}}function O(a){return{type:"Feature",id:a.id,properties:P(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),S(a.y),]}}}function P(a){const b=a.numPoints,c=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return T(T({},a.properties),{cluster:!0,cluster_id:a.id,point_count:b,point_count_abbreviated:c})}function Q(a){return a/360+.5}function R(a){const b=Math.sin(a*Math.PI/180),c=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return c<0?0:c>1?1:c}function S(a){const b=(180-360*a)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function T(a,b){for(const c in b)a[c]=b[c];return a}function U(a){return a.x}function V(a){return a.y}function W(a,b,c,d){for(var f,g=d,h=c-b>>1,i=c-b,j=a[b],k=a[b+1],l=a[c],m=a[c+1],n=b+3;ng)f=n,g=o;else if(o===g){var p=Math.abs(n-h);pd&&(f-b>3&&W(a,b,f,d),a[f+2]=g,c-f>3&&W(a,f,c,d))}function X(a,b,c,d,f,g){var h=f-c,i=g-d;if(0!==h||0!==i){var j=((a-c)*h+(b-d)*i)/(h*h+i*i);j>1?(c=f,d=g):j>0&&(c+=h*j,d+=i*j)}return(h=a-c)*h+(i=b-d)*i}function Y(a,b,c,d){var f={id:void 0===a?null:a,type:b,geometry:c,tags:d,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(a){var b=a.geometry,c=a.type;if("Point"===c||"MultiPoint"===c||"LineString"===c)Z(a,b);else if("Polygon"===c||"MultiLineString"===c)for(var d=0;d0&&(h+=d?(f*k-j*g)/2:Math.sqrt(Math.pow(j-f,2)+Math.pow(k-g,2))),f=j,g=k}var l=b.length-3;b[2]=1,W(b,0,l,c),b[l+2]=1,b.size=Math.abs(h),b.start=0,b.end=b.size}function ab(a,b,c,d){for(var f=0;f1?1:c}function ae(a,b,c,d,f,g,h,i){if(d/=b,g>=(c/=b)&&h=d)return null;for(var j=[],k=0;k=c&&p=d)){var q=[];if("Point"===n||"MultiPoint"===n)af(m,q,c,d,f);else if("LineString"===n)ag(m,q,c,d,f,!1,i.lineMetrics);else if("MultiLineString"===n)ai(m,q,c,d,f,!1);else if("Polygon"===n)ai(m,q,c,d,f,!0);else if("MultiPolygon"===n)for(var r=0;r=c&&h<=d&&(b.push(a[g]),b.push(a[g+1]),b.push(a[g+2]))}}function ag(a,b,c,d,f,g,h){for(var i,j,k=ah(a),l=0===f?ak:al,m=a.start,n=0;nc&&(j=l(k,o,p,r,s,c),h&&(k.start=m+i*j)):u>d?v=c&&(j=l(k,o,p,r,s,c),w=!0),v>d&&u<=d&&(j=l(k,o,p,r,s,d),w=!0),!g&&w&&(h&&(k.end=m+i*j),b.push(k),k=ah(a)),h&&(m+=i)}var x=a.length-3;o=a[x],p=a[x+1],q=a[x+2],(u=0===f?o:p)>=c&&u<=d&&aj(k,o,p,q),x=k.length-3,g&&x>=3&&(k[x]!==k[0]||k[x+1]!==k[1])&&aj(k,k[0],k[1],k[2]),k.length&&b.push(k)}function ah(a){var b=[];return b.size=a.size,b.start=a.start,b.end=a.end,b}function ai(a,b,c,d,f,g){for(var h=0;hh.maxX&&(h.maxX=l),m>h.maxY&&(h.maxY=m)}return h}function ar(a,b,c,d){var f=b.geometry,g=b.type,h=[];if("Point"===g||"MultiPoint"===g)for(var i=0;i0&&b.size<(f?h:d))c.numPoints+=b.length/3;else{for(var i=[],j=0;jh)&&(c.numSimplified++,i.push(b[j]),i.push(b[j+1])),c.numPoints++;f&&function(a,b){for(var c=0,d=0,f=a.length,g=f-2;d0===b)for(d=0,f=a.length;d24)throw Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw Error("promoteId and generateId cannot be used together.");var d,f,g,h,i,j,k=function(a,b){var c=[];if("FeatureCollection"===a.type)for(var d=0;d1&&console.time("creation"),n=this.tiles[m]=aq(a,b,c,d,j),this.tileCoords.push({z:b,x:c,y:d}),k)){k>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,c,d,n.numFeatures,n.numPoints,n.numSimplified),console.timeEnd("creation"));var o="z"+b;this.stats[o]=(this.stats[o]||0)+1,this.total++}if(n.source=a,f){if(b===j.maxZoom||b===f)continue;var p=1<1&&console.time("clipping");var q,r,s,u,v,w,x=.5*j.buffer/j.extent,y=.5-x,z=.5+x,A=1+x;q=r=s=u=null,v=ae(a,l,c-x,c+z,0,n.minX,n.maxX,j),w=ae(a,l,c+y,c+A,0,n.minX,n.maxX,j),a=null,v&&(q=ae(v,l,d-x,d+z,1,n.minY,n.maxY,j),r=ae(v,l,d+y,d+A,1,n.minY,n.maxY,j),v=null),w&&(s=ae(w,l,d-x,d+z,1,n.minY,n.maxY,j),u=ae(w,l,d+y,d+A,1,n.minY,n.maxY,j),w=null),k>1&&console.timeEnd("clipping"),i.push(q||[],b+1,2*c,2*d),i.push(r||[],b+1,2*c,2*d+1),i.push(s||[],b+1,2*c+1,2*d),i.push(u||[],b+1,2*c+1,2*d+1)}}},at.prototype.getTile=function(a,b,c){var d=this.options,f=d.extent,g=d.debug;if(a<0||a>24)return null;var h=1<1&&console.log("drilling down to z%d-%d-%d",a,b,c);for(var j,k=a,l=b,m=c;!j&&k>0;)k--,l=Math.floor(l/2),m=Math.floor(m/2),j=this.tiles[au(k,l,m)];return j&&j.source?(g>1&&console.log("found parent tile z%d-%d-%d",k,l,m),g>1&&console.time("drilling down"),this.splitTile(j.source,k,l,m,a,b,c),g>1&&console.timeEnd("drilling down"),this.tiles[i]?ao(this.tiles[i],f):null):null};class av extends a.VectorTileWorkerSource{constructor(a,b,c,d,f){super(a,b,c,d,function(a,b){const c=a.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const d=this._geoJSONIndex.getTile(c.z,c.x,c.y);if(!d)return b(null,null);const f=new n(d.features);let g=s(f);0===g.byteOffset&&g.byteLength===g.buffer.byteLength||(g=new Uint8Array(g)),b(null,{vectorTile:f,rawData:g.buffer})}),f&&(this.loadGeoJSON=f)}loadData(b,c){const d=b&&b.request,f=d&&d.collectResourceTiming;this.loadGeoJSON(b,(g,h)=>{if(g||!h)return c(g);if("object"!=typeof h)return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{i(h,!0);try{var j,k;if(b.filter){const l=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===l.result)throw Error(l.value.map(a=>`${a.key}: ${a.message}`).join(", "));const m=h.features.filter(a=>l.value.evaluate({zoom:0},a));h={type:"FeatureCollection",features:m}}this._geoJSONIndex=b.cluster?new L(function({superclusterOptions:b,clusterProperties:c}){if(!c||!b)return b;const d={},f={},g={accumulated:null,zoom:0},h={properties:null},i=Object.keys(c);for(const j of i){const[k,l]=c[j],m=a.createExpression(l),n=a.createExpression("string"==typeof k?[k,["accumulated",],["get",j,],]:k);d[j]=m.value,f[j]=n.value}return b.map=a=>{h.properties=a;const b={};for(const c of i)b[c]=d[c].evaluate(g,h);return b},b.reduce=(a,b)=>{for(const c of(h.properties=b,i))g.accumulated=a[c],a[c]=f[c].evaluate(g,h)},b}(b)).load(h.features):(j=h,k=b.geojsonVtOptions,new at(j,k))}catch(n){return c(n)}this.loaded={};const o={};if(f){const p=a.getPerformanceMeasurement(d);p&&(o.resourceTiming={},o.resourceTiming[b.source]=JSON.parse(JSON.stringify(p)))}c(null,o)}})}reloadTile(a,b){const c=this.loaded;return c&&c[a.uid]?super.reloadTile(a,b):this.loadTile(a,b)}loadGeoJSON(b,c){if(b.request)a.getJSON(b.request,c);else{if("string"!=typeof b.data)return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));try{return c(null,JSON.parse(b.data))}catch(d){return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(a,b){try{b(null,this._geoJSONIndex.getClusterExpansionZoom(a.clusterId))}catch(c){b(c)}}getClusterChildren(a,b){try{b(null,this._geoJSONIndex.getChildren(a.clusterId))}catch(c){b(c)}}getClusterLeaves(a,b){try{b(null,this._geoJSONIndex.getLeaves(a.clusterId,a.limit,a.offset))}catch(c){b(c)}}}class aw{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.getProjection({name:"mercator"}),this.workerSourceTypes={vector:a.VectorTileWorkerSource,geojson:av},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(a,b)=>{if(this.workerSourceTypes[a])throw Error(`Worker source with name "${a}" already registered.`);this.workerSourceTypes[a]=b},this.self.registerRTLTextPlugin=b=>{if(a.plugin.isParsed())throw Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=b.applyArabicShaping,a.plugin.processBidirectionalText=b.processBidirectionalText,a.plugin.processStyledBidirectionalText=b.processStyledBidirectionalText}}clearCaches(a,b,c){delete this.layerIndexes[a],delete this.availableImages[a],delete this.workerSources[a],delete this.demWorkerSources[a],c()}checkIfReady(a,b,c){c()}setReferrer(a,b){this.referrer=b}spriteLoaded(b,c){for(const d in this.isSpriteLoaded[b]=c,this.workerSources[b]){const f=this.workerSources[b][d];for(const g in f)f[g]instanceof a.VectorTileWorkerSource&&(f[g].isSpriteLoaded=c,f[g].fire(new a.Event("isSpriteLoaded")))}}setImages(a,b,c){for(const d in this.availableImages[a]=b,this.workerSources[a]){const f=this.workerSources[a][d];for(const g in f)f[g].availableImages=b}c()}enableTerrain(a,b,c){this.terrain=b,c()}setProjection(b,c){this.projections[b]=a.getProjection(c)}setLayers(a,b,c){this.getLayerIndex(a).replace(b),c()}updateLayers(a,b,c){this.getLayerIndex(a).update(b.layers,b.removedIds),c()}loadTile(b,c,d){const f=this.enableTerrain?a.extend({enableTerrain:this.terrain},c):c;f.projection=this.projections[b]||this.defaultProjection,this.getWorkerSource(b,c.type,c.source).loadTile(f,d)}loadDEMTile(b,c,d){const f=this.enableTerrain?a.extend({buildQuadTree:this.terrain},c):c;this.getDEMWorkerSource(b,c.source).loadTile(f,d)}reloadTile(b,c,d){const f=this.enableTerrain?a.extend({enableTerrain:this.terrain},c):c;f.projection=this.projections[b]||this.defaultProjection,this.getWorkerSource(b,c.type,c.source).reloadTile(f,d)}abortTile(a,b,c){this.getWorkerSource(a,b.type,b.source).abortTile(b,c)}removeTile(a,b,c){this.getWorkerSource(a,b.type,b.source).removeTile(b,c)}removeSource(a,b,c){if(!this.workerSources[a]||!this.workerSources[a][b.type]||!this.workerSources[a][b.type][b.source])return;const d=this.workerSources[a][b.type][b.source];delete this.workerSources[a][b.type][b.source],void 0!==d.removeSource?d.removeSource(b,c):c()}loadWorkerSource(a,b,c){try{this.self.importScripts(b.url),c()}catch(d){c(d.toString())}}syncRTLPluginState(b,c,d){try{a.plugin.setState(c);const f=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&null!=f){this.self.importScripts(f);const g=a.plugin.isParsed();d(g?void 0:Error(`RTL Text Plugin failed to import scripts from ${f}`),g)}}catch(h){d(h.toString())}}getAvailableImages(a){let b=this.availableImages[a];return b||(b=[]),b}getLayerIndex(a){let b=this.layerIndexes[a];return b||(b=this.layerIndexes[a]=new d),b}getWorkerSource(a,b,c){return this.workerSources[a]||(this.workerSources[a]={}),this.workerSources[a][b]||(this.workerSources[a][b]={}),this.workerSources[a][b][c]||(this.workerSources[a][b][c]=new this.workerSourceTypes[b]({send:(b,c,d,f,g,h)=>{this.actor.send(b,c,d,a,g,h)},scheduler:this.actor.scheduler},this.getLayerIndex(a),this.getAvailableImages(a),this.isSpriteLoaded[a])),this.workerSources[a][b][c]}getDEMWorkerSource(a,b){return this.demWorkerSources[a]||(this.demWorkerSources[a]={}),this.demWorkerSources[a][b]||(this.demWorkerSources[a][b]=new g),this.demWorkerSources[a][b]}enforceCacheSizeLimit(b,c){a.enforceCacheSizeLimit(c)}getWorkerPerformanceMetrics(a,b,c){c(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new aw(self)),aw}),f(["./shared"],function(a){var b=c;function c(a){var b,f;return b=a,"undefined"!=typeof window&&"undefined"!=typeof document&&!!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 a,b,c=new Blob([""],{type:"text/javascript"}),d=URL.createObjectURL(c);try{b=new Worker(d),a=!0}catch(f){a=!1}return b&&b.terminate(),URL.revokeObjectURL(d),a}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d");if(!b)return!1;var c=b.getImageData(0,0,1,1);return c&&c.width===a.width}()&&(void 0===d[f=b&&b.failIfMajorPerformanceCaveat]&&(d[f]=function(a){var b,d,f,g,h=(b=a,d=document.createElement("canvas"),(f=Object.create(c.webGLContextAttributes)).failIfMajorPerformanceCaveat=b,d.getContext("webgl",f)||d.getContext("experimental-webgl",f));if(!h)return!1;try{g=h.createShader(h.VERTEX_SHADER)}catch(i){return!1}return!(!g||h.isContextLost())&&(h.shaderSource(g,"void main() {}"),h.compileShader(g),!0===h.getShaderParameter(g,h.COMPILE_STATUS))}(f)),!!d[f]&&!document.documentMode)}var d={};function f(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=c*g-f*d;return h?(a[0]=g*(h=1/h),a[1]=-d*h,a[2]=-f*h,a[3]=c*h,a):null}function g(a,b){if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(let c=0;c{a.window.removeEventListener("click",l,!0)},0)},h.mousePos=function(a,b){const c=a.getBoundingClientRect();return m(a,c,b)},h.touchPos=function(a,b){const c=a.getBoundingClientRect(),d=[];for(let f=0;f=0?0:b.button};class o extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:b,callback:c}of this.requestors)this._notify(b,c);this.requestors=[]}}getImage(a){return this.images[a]}addImage(a,b){this._validate(a,b)&&(this.images[a]=b)}_validate(b,c){let d=!0;return this._validateStretch(c.stretchX,c.data&&c.data.width)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "stretchX" value`))),d=!1),this._validateStretch(c.stretchY,c.data&&c.data.height)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "stretchY" value`))),d=!1),this._validateContent(c.content,c)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "content" value`))),d=!1),d}_validateStretch(a,b){if(!a)return!0;let c=0;for(const d of a){if(d[0]{this.ready=!0})}broadcast(b,c,d){a.asyncAll(this.actors,(a,d)=>{a.send(b,c,d)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function C(b,c,d){return c*(a.EXTENT/(b.tileSize*Math.pow(2,d-b.tileID.overscaledZ)))}B.Actor=a.Actor;class D{constructor(a,b,c){this.context=a;const d=a.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(c),this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const b=this.context.gl;this.context.unbindVAO(),this.bind(),b.bufferSubData(b.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const E={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class F{constructor(a,b,c,d){this.length=b.length,this.attributes=c,this.itemSize=b.bytesPerElement,this.dynamicDraw=d,this.context=a;const f=a.gl;this.buffer=f.createBuffer(),a.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){const b=this.context.gl;this.bind(),b.bufferSubData(b.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,b){for(let c=0;cd.pointCoordinate3D(a)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(b,c){let d,f;if(b instanceof a.pointGeometry||"number"==typeof b[0]){const g=a.pointGeometry.convert(b);d=[a.pointGeometry.convert(b)],f=c.isPointAboveHorizon(g)}else{const h=a.pointGeometry.convert(b[0]),i=a.pointGeometry.convert(b[1]);d=[h,i],f=a.polygonizeBounds(h,i).every(a=>c.isPointAboveHorizon(a))}return new L(d,c.getCameraPoint(),f,c)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(b){return a.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],b)}bufferedCameraGeometry(b){const c=this.screenBounds[0],d=1===this.screenBounds.length?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],f=a.polygonizeBounds(c,d,0,!1);return this.cameraPoint.y>d.y&&(this.cameraPoint.x>c.x&&this.cameraPoint.x=d.x?f[2]=this.cameraPoint:this.cameraPoint.x<=c.x&&(f[3]=this.cameraPoint)),a.bufferConvexPolygon(f,b)}containsTile(b,c,d){var f;const g=b.queryPadding+1,h=b.tileID.wrap,i=d?this._bufferedCameraMercator(g,c).map(c=>a.getTilePoint(b.tileTransform,c,h)):this._bufferedScreenMercator(g,c).map(c=>a.getTilePoint(b.tileTransform,c,h)),j=this.screenGeometryMercator.map(c=>a.getTileVec3(b.tileTransform,c,h)),k=j.map(b=>new a.pointGeometry(b[0],b[1])),l=c.getFreeCameraOptions().position||new a.MercatorCoordinate(0,0,0),m=a.getTileVec3(b.tileTransform,l,h),n=j.map(b=>{const c=a.sub(b,b,m);return a.normalize(c,c),new a.Ray(m,c)}),o=C(b,1,c.zoom);if(a.polygonIntersectsBox(i,0,0,a.EXTENT,a.EXTENT))return{queryGeometry:this,tilespaceGeometry:k,tilespaceRays:n,bufferedTilespaceGeometry:i,bufferedTilespaceBounds:((f=a.getBounds(i)).min.x=a.clamp(f.min.x,0,a.EXTENT),f.min.y=a.clamp(f.min.y,0,a.EXTENT),f.max.x=a.clamp(f.max.x,0,a.EXTENT),f.max.y=a.clamp(f.max.y,0,a.EXTENT),f),tile:b,tileID:b.tileID,pixelToTileUnitsFactor:o}}_bufferedScreenMercator(a,b){const c=M(a);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{const d=this.bufferedScreenGeometry(a).map(a=>b.pointCoordinate3D(a));return this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(a,b){const c=M(a);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{const d=this.bufferedCameraGeometry(a).map(a=>b.pointCoordinate3D(a));return this._cameraRaycastCache[c]=d,d}}}function M(a){return 100*a|0}function N(b,c,d){const f=function(f,g){if(f)return d(f);if(g){const h=a.pick(a.extend(g,b),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);g.vector_layers&&(h.vectorLayers=g.vector_layers,h.vectorLayerIds=h.vectorLayers.map(a=>a.id)),h.tiles=c.canonicalizeTileset(h,b.url),d(null,h)}};return b.url?a.getJSON(c.transformRequest(c.normalizeSourceURL(b.url),a.ResourceType.Source),f):a.exported.frame(()=>f(null,b))}class O{constructor(b,c,d){this.bounds=a.LngLatBounds.convert(this.validateBounds(b)),this.minzoom=c||0,this.maxzoom=d||24}validateBounds(a){return Array.isArray(a)&&4===a.length?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3]),]:[-180,-90,180,90]}contains(b){const c=Math.pow(2,b.z),d=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*c),f=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*c),g=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*c),h=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*c);return b.x>=d&&b.x=f&&b.y{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(a.extend(this,c),c.bounds&&(this.tileBounds=new O(c.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(c.tiles),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(b,c){const d=a.exported.devicePixelRatio>=2,f=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),d,this.tileSize);b.request=a.getImage(this.map._requestManager.transformRequest(f,a.ResourceType.Tile),(d,f,g,h)=>{if(delete b.request,b.aborted)b.state="unloaded",c(null);else if(d)b.state="errored",c(d);else if(f){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:g,expires:h});const i=this.map.painter.context,j=i.gl;b.texture=this.map.painter.getTileTexture(f.width),b.texture?b.texture.update(f,{useMipmap:!0}):(b.texture=new a.Texture(i,f,j.RGBA,{useMipmap:!0}),b.texture.bind(j.LINEAR,j.CLAMP_TO_EDGE),i.extTextureFilterAnisotropic&&j.texParameterf(j.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),b.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),c(null)}})}abortTile(a,b){a.request&&(a.request.cancel(),delete a.request),b()}unloadTile(a,b){a.texture&&this.map.painter.saveTileTexture(a.texture),b()}hasTransition(){return!1}}let Q;function R(b,c,d,f,g,h,i,j){const k=[b,d,g,c,f,h,1,1,1],l=[i,j,1],m=a.adjoint([],k),[n,o,p]=a.transformMat3(l,l,a.transpose(m,m));return a.multiply(k,[n,0,0,0,o,0,0,0,p],k)}class S extends a.Evented{constructor(a,b,c,d){super(),this.id=a,this.dispatcher=c,this.coordinates=b.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=b}load(b,c){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(d,f)=>{this._loaded=!0,d?this.fire(new a.ErrorEvent(d)):f&&(this.image=a.exported.getImageData(f),this.width=this.image.width,this.height=this.image.height,b&&(this.coordinates=b),c&&c(),this._finishLoading())})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url&&(this.options.url=a.url,this.load(a.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}setCoordinates(b){this.coordinates=b,delete this._boundsArray;const c=b.map(a.MercatorCoordinate.fromLngLat);return this.tileID=function(b){let c=1/0,d=1/0,f=-1/0,g=-1/0;for(const h of b)c=Math.min(c,h.x),d=Math.min(d,h.y),f=Math.max(f,h.x),g=Math.max(g,h.y);const i=Math.max(f-c,g-d),j=Math.max(0,Math.floor(-Math.log(i)/Math.LN2)),k=Math.pow(2,j);return new a.CanonicalTileID(j,Math.floor((c+f)/2*k),Math.floor((d+g)/2*k))}(c),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const b=a.tileTransform(this.tileID,this.map.transform.projection),[c,d,f,g]=this.coordinates.map(c=>{const d=b.projection.project(c[0],c[1]);return a.getTilePoint(b,d)._round()});return this.perspectiveTransform=function(b,c,d,f,g,h,i,j,k,l){const m=R(0,0,b,0,0,c,b,c),n=R(d,f,g,h,i,j,k,l);return a.multiply(n,a.adjoint(m,m),n),[n[6]/n[8]*b/a.EXTENT,n[7]/n[8]*c/a.EXTENT,]}(this.width,this.height,c.x,c.y,d.x,d.y,g.x,g.y,f.x,f.y),this._boundsArray=new a.StructArrayLayout4i8,this._boundsArray.emplaceBack(c.x,c.y,0,0),this._boundsArray.emplaceBack(d.x,d.y,a.EXTENT,0),this._boundsArray.emplaceBack(g.x,g.y,0,a.EXTENT),this._boundsArray.emplaceBack(f.x,f.y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const b=this.map.painter.context,c=b.gl;for(const d in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new a.Texture(b,this.image,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){const f=this.tiles[d];"loaded"!==f.state&&(f.state="loaded",f.texture=this.texture)}}loadTile(a,b){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},b(null)):(a.state="errored",b(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const T={vector:class extends a.Evented{constructor(b,c,d,f){if(super(),this.id=b,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(c,["url","scheme","tileSize","promoteId",])),this._options=a.extend({type:"vector"},c),this._collectResourceTiming=c.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f),this._tileWorkers={},this._deduped=new a.DedupedRequest}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=N(this._options,this.map._requestManager,(b,c)=>{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(a.extend(this,c),c.bounds&&(this.tileBounds=new O(c.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(c.tiles,this.map._requestManager._customAccessToken),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}onAdd(a){this.map=a,this.load()}setSourceProperty(a){this._tileJSONRequest&&this._tileJSONRequest.cancel(),a();const b=this.map.style._getSourceCaches(this.id);for(const c of b)c.clearTiles();this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(b,c){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme)),f={request:this.map._requestManager.transformRequest(d,a.ResourceType.Tile),data:void 0,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,tileSize:this.tileSize*b.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:b.isSymbolTile};if(f.request.collectResourceTiming=this._collectResourceTiming,b.actor&&"expired"!==b.state)"loading"===b.state?b.reloadCallback=c:b.request=b.actor.send("reloadTile",f,h.bind(this));else if(b.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)b.request=b.actor.send("loadTile",f,h.bind(this),void 0,!0);else{const g=a.loadVectorTile.call({deduped:this._deduped},f,(a,c)=>{a||!c?h.call(this,a):(f.data={cacheControl:c.cacheControl,expires:c.expires,rawData:c.rawData.slice(0)},b.actor&&b.actor.send("loadTile",f,h.bind(this),void 0,!0))},!0);b.request={cancel:g}}function h(d,f){return delete b.request,b.aborted?c(null):d&&404!==d.status?c(d):(f&&f.resourceTiming&&(b.resourceTiming=f.resourceTiming),this.map._refreshExpiredTiles&&f&&b.setExpiryData(f),b.loadVectorData(f,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),c(null),void(b.reloadCallback&&(this.loadTile(b,b.reloadCallback),b.reloadCallback=null)))}}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id})}unloadTile(a){a.unloadVectorData(),a.actor&&a.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:P,"raster-dem":class extends P{constructor(b,c,d,f){super(b,c,d,f),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},c),this.encoding=c.encoding||"mapbox"}loadTile(b,c){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function f(a,d){a&&(b.state="errored",c(a)),d&&(b.dem=d,b.dem.onDeserialize(),b.needsHillshadePrepare=!0,b.needsDEMTextureUpload=!0,b.state="loaded",c(null))}b.request=a.getImage(this.map._requestManager.transformRequest(d,a.ResourceType.Tile),(function(d,g,h,i){if(delete b.request,b.aborted)b.state="unloaded",c(null);else if(d)b.state="errored",c(d);else if(g){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const j=a.window.ImageBitmap&&g instanceof a.window.ImageBitmap&&(null==Q&&(Q=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),Q),k=1-(g.width-a.prevPowerOfTwo(g.width))/2;k<1||b.neighboringTiles||(b.neighboringTiles=this._getNeighboringTiles(b.tileID));const l=j?g:a.exported.getImageData(g,k),m={uid:b.uid,coord:b.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:k};b.actor&&"expired"!==b.state||(b.actor=this.dispatcher.getActor(),b.actor.send("loadDEMTile",m,f.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(b){const c=b.canonical,d=Math.pow(2,c.z),f=(c.x-1+d)%d,g=0===c.x?b.wrap-1:b.wrap,h=(c.x+1+d)%d,i=c.x+1===d?b.wrap+1:b.wrap,j={};return j[new a.OverscaledTileID(b.overscaledZ,g,c.z,f,c.y).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,i,c.z,h,c.y).key]={backfilled:!1},c.y>0&&(j[new a.OverscaledTileID(b.overscaledZ,g,c.z,f,c.y-1).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,b.wrap,c.z,c.x,c.y-1).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,i,c.z,h,c.y-1).key]={backfilled:!1}),c.y+1{if(this._loaded=!0,this._pendingLoad=null,b)this.fire(new a.ErrorEvent(b));else{const d={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&c&&c.resourceTiming&&c.resourceTiming[this.id]&&(d.resourceTiming=c.resourceTiming[this.id]),this.fire(new a.Event("data",d)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(b,c){const d=b.actor?"reloadTile":"loadTile";b.actor=this.actor,b.request=this.actor.send(d,{type:this.type,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(a,f)=>(delete b.request,b.unloadVectorData(),b.aborted?c(null):a?c(a):(b.loadVectorData(f,this.map.painter,"reloadTile"===d),c(null))),void 0,"loadTile"===d)}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.aborted=!0}unloadTile(a){a.unloadVectorData(),this.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends S{constructor(a,b,c,d){super(a,b,c,d),this.roundZoom=!0,this.type="video",this.options=b}load(){this._loaded=!1;const b=this.options;for(const c of(this.urls=[],b.urls))this.urls.push(this.map._requestManager.transformRequest(c,a.ResourceType.Source).url);a.getVideo(this.urls,(b,c)=>{this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(this.video=c,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(b){if(this.video){const c=this.video.seekable;bc.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${c.start(0)} and ${c.end(0)}-second mark.`))):this.video.currentTime=b}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,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 b=this.map.painter.context,c=b.gl;for(const d in this.texture?this.video.paused||(this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,this.video)):(this.texture=new a.Texture(b,this.video,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const f=this.tiles[d];"loaded"!==f.state&&(f.state="loaded",f.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:S,canvas:class extends S{constructor(b,c,d,f){super(b,c,d,f),c.coordinates?Array.isArray(c.coordinates)&&4===c.coordinates.length&&!c.coordinates.some(a=>!Array.isArray(a)||2!==a.length||a.some(a=>"number"!=typeof a))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'missing required property "coordinates"'))),c.animate&&"boolean"!=typeof c.animate&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'optional "animate" property must be a boolean value'))),c.canvas?"string"==typeof c.canvas||c.canvas instanceof a.window.HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'missing required property "canvas"'))),this.options=c,this.animate=void 0===c.animate||c.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof a.window.HTMLCanvasElement?this.options.canvas:a.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(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(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const c=this.map.painter.context,d=c.gl;for(const f in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.Texture(c,this.canvas,d.RGBA,{premultiply:!0}),this.tiles){const g=this.tiles[f];"loaded"!==g.state&&(g.state="loaded",g.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height,])if(isNaN(a)||a<=0)return!0;return!1}}},U=function(b,c,d,f){const g=new T[c.type](b,c,d,f);if(g.id!==b)throw Error(`Expected Source id to be ${b} instead of ${g.id}`);return a.bindAll(["load","abort","unload","serialize","prepare",],g),g};function V(b,c){const d=a.identity([]);return a.scale(d,d,[.5*b.width,-(.5*b.height),1,]),a.translate(d,d,[1,-1,0]),a.multiply$1(d,d,b.calculateProjMatrix(c.toUnwrapped()))}function W(a,b,c,d,f,g,h,i=!1){const j=a.tilesIn(d,h,i);j.sort(Y);const k=[];for(const l of j)k.push({wrappedTileID:l.tile.tileID.wrapped().key,queryResults:l.tile.queryRenderedFeatures(b,c,a._state,l,f,g,V(a.transform,l.tile.tileID),i)});const m=function(a){const b={},c={};for(const d of a){const f=d.queryResults,g=d.wrappedTileID,h=c[g]=c[g]||{};for(const i in f){const j=f[i],k=h[i]=h[i]||{},l=b[i]=b[i]||[];for(const m of j)k[m.featureIndex]||(k[m.featureIndex]=!0,l.push(m))}}return b}(k);for(const n in m)m[n].forEach(b=>{const c=b.feature,d=a.getFeatureState(c.layer["source-layer"],c.id);c.source=c.layer.source,c.layer["source-layer"]&&(c.sourceLayer=c.layer["source-layer"]),c.state=d});return m}function X(a,b){const c=a.getRenderableIds().map(b=>a.getTileByID(b)),d=[],f={};for(let g=0;g{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[$]}numActive(){return Object.keys(this.active).length}}let aa;function ab(){return aa||(aa=new _),aa}function ac(b,c){const d={};for(const f in b)"ref"!==f&&(d[f]=b[f]);return a.refProperties.forEach(a=>{a in c&&(d[a]=c[a])}),d}function ad(a){a=a.slice();const b=Object.create(null);for(let c=0;c0?(f-h)/i:0;return this.points[g].mult(1-j).add(this.points[c].mult(j))}}class an{constructor(a,b,c){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(a/c),this.yCellCount=Math.ceil(b/c);for(let g=0;gthis.width||d<0||b>this.height)return!f&&[];const h=[];if(a<=0&&b<=0&&this.width<=c&&this.height<=d){if(f)return!0;for(let i=0;i0:h}_queryCircle(a,b,c,d,f){const g=a-c,h=a+c,i=b-c,j=b+c;if(h<0||g>this.width||j<0||i>this.height)return!d&&[];const k=[];return this._forEachCell(g,i,h,j,this._queryCellCircle,k,{hitTest:d,circle:{x:a,y:b,radius:c},seenUids:{box:{},circle:{}}},f),d?k.length>0:k}query(a,b,c,d,f){return this._query(a,b,c,d,!1,f)}hitTest(a,b,c,d,f){return this._query(a,b,c,d,!0,f)}hitTestCircle(a,b,c,d){return this._queryCircle(a,b,c,!0,d)}_queryCell(a,b,c,d,f,g,h,i){const j=h.seenUids,k=this.boxCells[f];if(null!==k){const l=this.bboxes;for(const m of k)if(!j.box[m]){j.box[m]=!0;const n=4*m;if(a<=l[n+2]&&b<=l[n+3]&&c>=l[n+0]&&d>=l[n+1]&&(!i||i(this.boxKeys[m]))){if(h.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[m],x1:l[n],y1:l[n+1],x2:l[n+2],y2:l[n+3]})}}}const o=this.circleCells[f];if(null!==o){const p=this.circles;for(const q of o)if(!j.circle[q]){j.circle[q]=!0;const r=3*q;if(this._circleAndRectCollide(p[r],p[r+1],p[r+2],a,b,c,d)&&(!i||i(this.circleKeys[q]))){if(h.hitTest)return g.push(!0),!0;{const s=p[r],u=p[r+1],v=p[r+2];g.push({key:this.circleKeys[q],x1:s-v,y1:u-v,x2:s+v,y2:u+v})}}}}}_queryCellCircle(a,b,c,d,f,g,h,i){const j=h.circle,k=h.seenUids,l=this.boxCells[f];if(null!==l){const m=this.bboxes;for(const n of l)if(!k.box[n]){k.box[n]=!0;const o=4*n;if(this._circleAndRectCollide(j.x,j.y,j.radius,m[o+0],m[o+1],m[o+2],m[o+3])&&(!i||i(this.boxKeys[n])))return g.push(!0),!0}}const p=this.circleCells[f];if(null!==p){const q=this.circles;for(const r of p)if(!k.circle[r]){k.circle[r]=!0;const s=3*r;if(this._circlesCollide(q[s],q[s+1],q[s+2],j.x,j.y,j.radius)&&(!i||i(this.circleKeys[r])))return g.push(!0),!0}}}_forEachCell(a,b,c,d,f,g,h,i){const j=this._convertToXCellCoord(a),k=this._convertToYCellCoord(b),l=this._convertToXCellCoord(c),m=this._convertToYCellCoord(d);for(let n=j;n<=l;n++)for(let o=k;o<=m;o++)if(f.call(this,a,b,c,d,this.xCellCount*o+n,g,h,i))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,b,c,d,f,g){const h=d-a,i=f-b,j=c+g;return j*j>h*h+i*i}_circleAndRectCollide(a,b,c,d,f,g,h){const i=(g-d)/2,j=Math.abs(a-(d+i));if(j>i+c)return!1;const k=(h-f)/2,l=Math.abs(b-(f+k));if(l>k+c)return!1;if(j<=i||l<=k)return!0;const m=j-i,n=l-k;return m*m+n*n<=c*c}}const ao=Math.tan(85*Math.PI/180);function ap(b,c,d,g,h,i){let j=a.create();if(d){if("globe"===h.projection.name)j=a.calculateGlobeMatrix(h,h.worldSize/h._projectionScaler,[0,0]),a.multiply$1(j,j,a.globeDenormalizeECEF(a.globeTileBounds(c)));else{const k=f([],i);j[0]=k[0],j[1]=k[1],j[4]=k[2],j[5]=k[3]}g||a.rotateZ(j,j,h.angle)}else a.multiply$1(j,h.labelPlaneMatrix,b);return j}function aq(b,c,d,f,g,h){if(d){if("globe"===g.projection.name){const i=ap(b,c,d,f,g,h);return a.invert(i,i),a.multiply$1(i,b,i),i}{const j=a.clone(b),k=a.identity([]);return k[0]=h[0],k[1]=h[1],k[4]=h[2],k[5]=h[3],a.multiply$1(j,j,k),f||a.rotateZ(j,j,-g.angle),j}}return g.glCoordMatrix}function ar(b,c,d=0){const f=[b.x,b.y,d,1];d?a.transformMat4$1(f,f,c):aD(f,f,c);const g=f[3];return{point:new a.pointGeometry(f[0]/g,f[1]/g),signedDistanceFromCamera:g}}function as(a,b){return Math.min(.5+a/b*.5,1.5)}function at(a,b){const c=a[0]/a[3],d=a[1]/a[3];return c>= -b[0]&&c<=b[0]&&d>= -b[1]&&d<=b[1]}function au(b,c,d,f,g,h,i,j,k,l){const m=d.transform,n=f?b.textSizeData:b.iconSizeData,o=a.evaluateSizeForZoom(n,d.transform.zoom),p=[256/d.width*2+1,256/d.height*2+1,],q=f?b.text.dynamicLayoutVertexArray:b.icon.dynamicLayoutVertexArray;q.clear();const r=b.lineVertexArray,s=f?b.text.placedSymbolArray:b.icon.placedSymbolArray,u=d.transform.width/d.transform.height;let v=!1;for(let w=0;wMath.abs(d.x-c.x)*f?{useVertical:!0}:b.writingMode===a.WritingMode.vertical?c.yao}(c,d,f)?1===b.flipState?{needsFlipping:!0}:null:c.x>d.x?{needsFlipping:!0}:null}function ax(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=c/24,v=b.lineOffsetX*u,w=b.lineOffsetY*u;let x;if(b.numGlyphs>1){const y=b.glyphStartIndex+b.numGlyphs,z=b.lineStartIndex,A=b.lineStartIndex+b.lineLength,B=av(u,j,v,w,d,m,n,b,k,h,o,q,!1,r,s);if(!B)return{notEnoughRoom:!0};const C=ar(B.first.point,i).point,D=ar(B.last.point,i).point;if(f&&!d){const E=aw(b,C,D,p);if(b.flipState=E&&E.needsFlipping?1:2,E)return E}x=[B.first];for(let F=b.glyphStartIndex+1;F0?J.point:az(n,I,G,1,g,void 0,r,s.canonical),p);if(b.flipState=K&&K.needsFlipping?1:2,K)return K}const L=aA(u*j.getoffsetX(b.glyphStartIndex),v,w,d,m,n,b.segment,b.lineStartIndex,b.lineStartIndex+b.lineLength,k,h,o,q,!1,!1,r,s);if(!L)return{notEnoughRoom:!0};x=[L]}for(const M of x)a.addDynamicAttributes(l,M.point,M.angle);return{}}function ay(b,c,d,f,g){const h=f.projectTilePoint(b.x,b.y,c);if(!g)return ar(h,d,h.z);const i=g(b);return ar(new a.pointGeometry(h.x+i[0],h.y+i[1]),d,h.z+i[2])}function az(a,b,c,d,f,g,h,i){const j=ay(a.add(a.sub(b)._unit()),i,f,h,g).point,k=c.sub(j);return c.add(k._mult(d/k.mag()))}function aA(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=f?b-c:b+c;let v=u>0?1:-1,w=0;f&&(v*=-1,w=Math.PI),v<0&&(w+=Math.PI);let x=v>0?j+i:j+i+1,y=g,z=g,A=0,B=0;const C=Math.abs(u),D=[],E=[];let F=h;const G=()=>{const b=x-v;return 0===A?h:new a.pointGeometry(l.getx(b),l.gety(b))},H=()=>az(G(),F,z,C-A+1,m,o,r,s.canonical);for(;A+B<=C;){if((x+=v)=k)return null;if(z=y,D.push(y),p&&E.push(F||G()),void 0===(y=n[x])){F=new a.pointGeometry(l.getx(x),l.gety(x));const I=ay(F,s.canonical,m,r,o);y=I.signedDistanceFromCamera>0?n[x]=I.point:H()}else F=null;A+=B,B=z.dist(y)}q&&o&&(F=F||new a.pointGeometry(l.getx(x),l.gety(x)),n[x]=y=void 0===n[x]?y:H(),B=z.dist(y));const J=(C-A)/B,K=y.sub(z),L=K.mult(J)._add(z);d&&L._add(K._unit()._perp()._mult(d*v));const M=w+Math.atan2(y.y-z.y,y.x-z.x);return D.push(L),p&&(F=F||new a.pointGeometry(l.getx(x),l.gety(x)),E.push(function(b,c,d){const f=1-d;return new a.pointGeometry(b.x*f+c.x*d,b.y*f+c.y*d)}(E.length>0?E[E.length-1]:F,F,J))),{point:L,angle:M,path:D,tilePath:E}}const aB=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function aC(a,b){for(let c=0;ca.sortKey-b.sortKey));this._currentPartIndex[0,0,0],v=new a.pointGeometry(c.tileAnchorX,c.tileAnchorY),w=this.transform.projection.projectTilePoint(c.tileAnchorX,c.tileAnchorY,p.canonical),x=u(v),y=[w.x+x[0],w.y+x[1],w.z+x[2]],z=this.projectAndGetPerspectiveRatio(h,y[0],y[1],y[2],p),{perspectiveRatio:A}=z,B=(l?g/A:g*A)/a.ONE_EM,C=ar(new a.pointGeometry(y[0],y[1]),i,y[2]).point,D=z.signedDistanceFromCamera>0?av(B,f,c.lineOffsetX*B,c.lineOffsetY*B,!1,C,v,c,d,i,{},r&&!l?u:null,l&&!!r,this.transform.projection,p):null;let E=!1,F=!1,G=!0;if(D&&!z.aboveHorizon){const H=.5*n*A+o,I=new a.pointGeometry(-100,-100),J=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),K=new am,L=D.first,M=D.last;let N=[];for(let O=L.path.length-1;O>=1;O--)N.push(L.path[O]);for(let P=1;P{const c=u(bar(a,j));N=R.some(a=>a.signedDistanceFromCamera<=0)?[]:R.map(a=>a.point)}let S=[];if(N.length>0){const T=N[0].clone(),U=N[0].clone();for(let V=1;V=I.x&&U.x<=J.x&&T.y>=I.y&&U.y<=J.y?[N]:U.xJ.x||U.yJ.y?[]:a.clipLine([N],I.x,I.y,J.x,J.y)}for(const W of S){K.reset(W,.25*H);let X=0;X=K.length<=.5*H?1:Math.ceil(K.paddedLength/Q)+1;for(let Y=0;Y0){a.transformMat4$1(h,h,b);let j=!1;this.fogState&&g&&(j=function(b,c,d,f,g,h){const i=h.calculateFogTileMatrix(g),j=[c,d,f];return a.transformMat4(j,j,i),w(b,j,h.pitch,h._fov)}(this.fogState,c,d,f||0,g.toUnwrapped(),this.transform)>.9),i=h[2]>h[3]||j}else aD(h,h,b);return{point:new a.pointGeometry((h[0]/h[3]+1)/2*this.transform.width+100,(-h[1]/h[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/h[3]*.5,1.5),signedDistanceFromCamera:h[3],aboveHorizon:i}}isOffscreen(a,b,c,d){return c<100||a>=this.screenRightBoundary||d<100||b>this.screenBottomBoundary}isInsideGrid(a,b,c,d){return c>=0&&a=0&&ba.collisionGroupID===b}}return this.collisionGroups[a]}}(d),this.collisionCircleArrays={},this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(b,c,d,f){const g=d.getBucket(c),h=d.latestFeatureIndex;if(!g||!h||c.id!==g.layerIds[0])return;const i=g.layers[0].layout,j=d.collisionBoxArray,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),l=d.tileSize/a.EXTENT,m=d.tileID.toUnwrapped(),n=this.transform.calculateProjMatrix(m),o="map"===i.get("text-pitch-alignment"),p="map"===i.get("text-rotation-alignment");c.compileFilter();const q=c.dynamicFilter(),r=c.dynamicFilterNeedsFeature(),s=this.transform.calculatePixelsToTileUnitsMatrix(d),u=ap(n,d.tileID.canonical,o,p,this.transform,s);let v=null;if(o){const w=aq(n,d.tileID.canonical,o,p,this.transform,s);v=a.multiply$1([],this.transform.labelPlaneMatrix,w)}let x=null;q&&d.latestFeatureIndex&&(x={unwrappedTileID:m,dynamicFilter:q,dynamicFilterNeedsFeature:r,featureIndex:d.latestFeatureIndex}),this.retainedQueryData[g.bucketInstanceId]=new aI(g.bucketInstanceId,h,g.sourceLayerIndex,g.index,d.tileID);const y={bucket:g,layout:i,posMatrix:n,textLabelPlaneMatrix:u,labelToScreenMatrix:v,clippingData:x,scale:k,textPixelRatio:l,holdingForFade:d.holdingForFade(),collisionBoxArray:j,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(g.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.evaluateSizeForZoom(g.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(f)for(const z of g.sortKeyRanges){const{sortKey:A,symbolInstanceStart:B,symbolInstanceEnd:C}=z;b.push({sortKey:A,symbolInstanceStart:B,symbolInstanceEnd:C,parameters:y})}else b.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:y})}attemptAnchorPlacement(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=[m.textOffset0,m.textOffset1],v=aJ(a,c,d,u,f),w=this.collisionIndex.placeCollisionBox(f,b,aK(v.x,v.y,g,h,this.transform.angle),l,i,j,k.predicate);if((!q||0!==this.collisionIndex.placeCollisionBox(o.getSymbolInstanceIconSize(s,this.transform.zoom,n),q,aK(v.x,v.y,g,h,this.transform.angle),l,i,j,k.predicate).box.length)&&w.box.length>0){let x;return this.prevPlacement&&this.prevPlacement.variableOffsets[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID].text&&(x=this.prevPlacement.variableOffsets[m.crossTileID].anchor),this.variableOffsets[m.crossTileID]={textOffset:u,width:c,height:d,anchor:a,textScale:f,prevAnchor:x},this.markUsedJustification(o,a,m,p),o.allowVerticalPlacement&&(this.markUsedOrientation(o,p,m),this.placedOrientations[m.crossTileID]=p),{shift:v,placedGlyphBoxes:w}}}placeLayerBucketPart(b,c,d,f){const{bucket:g,layout:h,posMatrix:i,textLabelPlaneMatrix:j,labelToScreenMatrix:k,clippingData:l,textPixelRatio:m,holdingForFade:n,collisionBoxArray:o,partiallyEvaluatedTextSize:p,partiallyEvaluatedIconSize:q,collisionGroup:r}=b.parameters,s=h.get("text-optional"),u=h.get("icon-optional"),v=h.get("text-allow-overlap"),w=h.get("icon-allow-overlap"),x="map"===h.get("text-rotation-alignment"),y="map"===h.get("text-pitch-alignment"),z="none"!==h.get("icon-text-fit"),A="viewport-y"===h.get("symbol-z-order"),B=v&&(w||!g.hasIconData()||u),C=w&&(v||!g.hasTextData()||s);!g.collisionArrays&&o&&g.deserializeCollisionBoxes(o),d&&f&&g.updateCollisionDebugBuffers(this.transform.zoom,o);const D=(b,f,o)=>{if(l){const A={zoom:this.transform.zoom,pitch:this.transform.pitch};let D=null;if(l.dynamicFilterNeedsFeature){const E=this.retainedQueryData[g.bucketInstanceId];D=l.featureIndex.loadFeature({featureIndex:b.featureIndex,bucketIndex:E.bucketIndex,sourceLayerIndex:E.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,l.dynamicFilter)(A,D,this.retainedQueryData[g.bucketInstanceId].tileID.canonical,new a.pointGeometry(b.tileAnchorX,b.tileAnchorY),this.transform.calculateDistanceTileData(l.unwrappedTileID)))return this.placements[b.crossTileID]=new aG(!1,!1,!1,!0),void(c[b.crossTileID]=!0)}if(c[b.crossTileID])return;if(n)return void(this.placements[b.crossTileID]=new aG(!1,!1,!1));let F=!1,G=!1,H=!0,I=null,J={box:null,offscreen:null},K={box:null,offscreen:null},L=null,M=null,N=null,O=0,P=0,Q=0;o.textFeatureIndex?O=o.textFeatureIndex:b.useRuntimeCollisionCircles&&(O=b.featureIndex),o.verticalTextFeatureIndex&&(P=o.verticalTextFeatureIndex);const R=a=>{a.tileID=this.retainedQueryData[g.bucketInstanceId].tileID,(this.transform.elevation||a.elevation)&&(a.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[g.bucketInstanceId].tileID,a.tileAnchorX,a.tileAnchorY):0)},S=o.textBox;if(S){R(S);const T=c=>{let d=a.WritingMode.horizontal;if(g.allowVerticalPlacement&&!c&&this.prevPlacement){const f=this.prevPlacement.placedOrientations[b.crossTileID];f&&(this.placedOrientations[b.crossTileID]=f,d=f,this.markUsedOrientation(g,d,b))}return d},U=(c,d)=>{if(g.allowVerticalPlacement&&b.numVerticalGlyphVertices>0&&o.verticalTextBox){for(const f of g.writingModes)if(f===a.WritingMode.vertical?K=J=d():J=c(),J&&J.box&&J.box.length)break}else J=c()};if(h.get("text-variable-anchor")){let V=h.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[b.crossTileID]){const W=this.prevPlacement.variableOffsets[b.crossTileID];V.indexOf(W.anchor)>0&&(V=V.filter(a=>a!==W.anchor)).unshift(W.anchor)}const X=(a,c,d)=>{const h=g.getSymbolInstanceTextSize(p,b,this.transform.zoom,f),j=(a.x2-a.x1)*h+2*a.padding,k=(a.y2-a.y1)*h+2*a.padding,l=z&&!w?c:null;l&&R(l);let n={box:[],offscreen:!1};const o=v?2*V.length:V.length;for(let s=0;s=V.length,b,f,g,d,l,p,q);if(u&&(n=u.placedGlyphBoxes)&&n.box&&n.box.length){F=!0,I=u.shift;break}}return n};U(()=>X(S,o.iconBox,a.WritingMode.horizontal),()=>{const c=o.verticalTextBox;return c&&R(c),g.allowVerticalPlacement&&!(J&&J.box&&J.box.length)&&b.numVerticalGlyphVertices>0&&c?X(c,o.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),J&&(F=J.box,H=J.offscreen);const Y=T(J&&J.box);if(!F&&this.prevPlacement){const Z=this.prevPlacement.variableOffsets[b.crossTileID];Z&&(this.variableOffsets[b.crossTileID]=Z,this.markUsedJustification(g,Z.anchor,b,Y))}}else{const $=(c,d)=>{const h=g.getSymbolInstanceTextSize(p,b,this.transform.zoom,f),j=this.collisionIndex.placeCollisionBox(h,c,new a.pointGeometry(0,0),v,m,i,r.predicate);return j&&j.box&&j.box.length&&(this.markUsedOrientation(g,d,b),this.placedOrientations[b.crossTileID]=d),j};U(()=>$(S,a.WritingMode.horizontal),()=>{const c=o.verticalTextBox;return g.allowVerticalPlacement&&b.numVerticalGlyphVertices>0&&c?(R(c),$(c,a.WritingMode.vertical)):{box:null,offscreen:null}}),T(J&&J.box&&J.box.length)}}if(F=(L=J)&&L.box&&L.box.length>0,H=L&&L.offscreen,b.useRuntimeCollisionCircles){const _=g.text.placedSymbolArray.get(b.centerJustifiedTextSymbolIndex>=0?b.centerJustifiedTextSymbolIndex:b.verticalPlacedTextSymbolIndex),aa=a.evaluateSizeForFeature(g.textSizeData,p,_),ab=h.get("text-padding");M=this.collisionIndex.placeCollisionCircles(v,_,g.lineVertexArray,g.glyphOffsetArray,aa,i,j,k,d,y,r.predicate,b.collisionCircleDiameter*aa/a.ONE_EM,ab,this.retainedQueryData[g.bucketInstanceId].tileID),F=v||M.circles.length>0&&!M.collisionDetected,H=H&&M.offscreen}if(o.iconFeatureIndex&&(Q=o.iconFeatureIndex),o.iconBox){const ac=b=>{R(b);const c=z&&I?aK(I.x,I.y,x,y,this.transform.angle):new a.pointGeometry(0,0),d=g.getSymbolInstanceIconSize(q,this.transform.zoom,f);return this.collisionIndex.placeCollisionBox(d,b,c,w,m,i,r.predicate)};G=K&&K.box&&K.box.length&&o.verticalIconBox?(N=ac(o.verticalIconBox)).box.length>0:(N=ac(o.iconBox)).box.length>0,H=H&&N.offscreen}const ad=s||0===b.numHorizontalGlyphVertices&&0===b.numVerticalGlyphVertices,ae=u||0===b.numIconVertices;if(ad||ae?ae?ad||(G=G&&F):F=G&&F:G=F=G&&F,F&&L&&L.box&&this.collisionIndex.insertCollisionBox(L.box,h.get("text-ignore-placement"),g.bucketInstanceId,K&&K.box&&P?P:O,r.ID),G&&N&&this.collisionIndex.insertCollisionBox(N.box,h.get("icon-ignore-placement"),g.bucketInstanceId,Q,r.ID),M&&(F&&this.collisionIndex.insertCollisionCircles(M.circles,h.get("text-ignore-placement"),g.bucketInstanceId,O,r.ID),d)){const af=g.bucketInstanceId;let ag=this.collisionCircleArrays[af];void 0===ag&&(ag=this.collisionCircleArrays[af]=new aH);for(let ah=0;ah=0;--F){const G=E[F];D(g.symbolInstances.get(G),G,g.collisionArrays[G])}}else for(let H=b.symbolInstanceStart;H=0&&(b.text.placedSymbolArray.get(i).crossTileID=g>=0&&i!==g?0:d.crossTileID)}markUsedOrientation(b,c,d){const f=c===a.WritingMode.horizontal||c===a.WritingMode.horizontalOnly?c:0,g=c===a.WritingMode.vertical?c:0,h=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex,];for(const i of h)b.text.placedSymbolArray.get(i).placedOrientation=f;d.verticalPlacedTextSymbolIndex&&(b.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const b=this.prevPlacement;let c=!1;this.prevZoomAdjustment=b?b.zoomAdjustment(this.transform.zoom):0;const d=b?b.symbolFadeChange(a):1,f=b?b.opacities:{},g=b?b.variableOffsets:{},h=b?b.placedOrientations:{};for(const i in this.placements){const j=this.placements[i],k=f[i];k?(this.opacities[i]=new aF(k,d,j.text,j.icon,null,j.clipped),c=c||j.text!==k.text.placed||j.icon!==k.icon.placed):(this.opacities[i]=new aF(null,d,j.text,j.icon,j.skipFade,j.clipped),c=c||j.text||j.icon)}for(const l in f){const m=f[l];if(!this.opacities[l]){const n=new aF(m,d,!1,!1);n.isHidden()||(this.opacities[l]=n,c=c||m.text.placed||m.icon.placed)}}for(const o in g)this.variableOffsets[o]||!this.opacities[o]||this.opacities[o].isHidden()||(this.variableOffsets[o]=g[o]);for(const p in h)this.placedOrientations[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.placedOrientations[p]=h[p]);c?this.lastPlacementChangeTime=a:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=b?b.lastPlacementChangeTime:a)}updateLayerOpacities(a,b){const c={};for(const d of b){const f=d.getBucket(a);f&&d.latestFeatureIndex&&a.id===f.layerIds[0]&&this.updateBucketOpacities(f,c,d.collisionBoxArray)}}updateBucketOpacities(b,c,d){b.hasTextData()&&b.text.opacityVertexArray.clear(),b.hasIconData()&&b.icon.opacityVertexArray.clear(),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexArray.clear(),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexArray.clear();const f=b.layers[0].layout,g=!!b.layers[0].dynamicFilter(),h=new aF(null,0,!1,!1,!0),i=f.get("text-allow-overlap"),j=f.get("icon-allow-overlap"),k=f.get("text-variable-anchor"),l="map"===f.get("text-rotation-alignment"),m="map"===f.get("text-pitch-alignment"),n="none"!==f.get("icon-text-fit"),o=new aF(null,0,i&&(j||!b.hasIconData()||f.get("icon-optional")),j&&(i||!b.hasTextData()||f.get("text-optional")),!0);!b.collisionArrays&&d&&(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData())&&b.deserializeCollisionBoxes(d);const p=(a,b,c)=>{for(let d=0;d0||v>0,z=s.numIconVertices>0,A=this.placedOrientations[s.crossTileID],B=A===a.WritingMode.vertical,C=A===a.WritingMode.horizontal||A===a.WritingMode.horizontalOnly;if(!y&&!z||x.isHidden()||q++,y){const D=aM(x.text);p(b.text,u,B?0:D),p(b.text,v,C?0:D);const E=x.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex,].forEach(a=>{a>=0&&(b.text.placedSymbolArray.get(a).hidden=E||B?1:0)}),s.verticalPlacedTextSymbolIndex>=0&&(b.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=E||C?1:0);const F=this.variableOffsets[s.crossTileID];F&&this.markUsedJustification(b,F.anchor,s,A);const G=this.placedOrientations[s.crossTileID];G&&(this.markUsedJustification(b,"left",s,G),this.markUsedOrientation(b,G,s))}if(z){const H=aM(x.icon);s.placedIconSymbolIndex>=0&&(p(b.icon,s.numIconVertices,B?0:H),b.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=x.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(p(b.icon,s.numVerticalIconVertices,C?0:H),b.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=x.icon.isHidden())}if(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData()){const I=b.collisionArrays[r];if(I){let J=new a.pointGeometry(0,0),K=!0;if(I.textBox||I.verticalTextBox){if(k){const L=this.variableOffsets[w];L?(J=aJ(L.anchor,L.width,L.height,L.textOffset,L.textScale),l&&J._rotate(m?this.transform.angle:-this.transform.angle)):K=!1}g&&(K=!x.clipped),I.textBox&&aL(b.textCollisionBox.collisionVertexArray,x.text.placed,!K||B,J.x,J.y),I.verticalTextBox&&aL(b.textCollisionBox.collisionVertexArray,x.text.placed,!K||C,J.x,J.y)}const M=K&&Boolean(!C&&I.verticalIconBox);I.iconBox&&aL(b.iconCollisionBox.collisionVertexArray,x.icon.placed,M,n?J.x:0,n?J.y:0),I.verticalIconBox&&aL(b.iconCollisionBox.collisionVertexArray,x.icon.placed,!M,n?J.x:0,n?J.y:0)}}}if(b.fullyClipped=0===q,b.sortFeatures(this.transform.angle),this.retainedQueryData[b.bucketInstanceId]&&(this.retainedQueryData[b.bucketInstanceId].featureSortOrder=b.featureSortOrder),b.hasTextData()&&b.text.opacityVertexBuffer&&b.text.opacityVertexBuffer.updateData(b.text.opacityVertexArray),b.hasIconData()&&b.icon.opacityVertexBuffer&&b.icon.opacityVertexBuffer.updateData(b.icon.opacityVertexArray),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexBuffer&&b.iconCollisionBox.collisionVertexBuffer.updateData(b.iconCollisionBox.collisionVertexArray),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexBuffer&&b.textCollisionBox.collisionVertexBuffer.updateData(b.textCollisionBox.collisionVertexArray),b.bucketInstanceId in this.collisionCircleArrays){const N=this.collisionCircleArrays[b.bucketInstanceId];b.placementInvProjMatrix=N.invProjMatrix,b.placementViewportMatrix=N.viewportMatrix,b.collisionCircleArray=N.circles,delete this.collisionCircleArrays[b.bucketInstanceId]}}symbolFadeChange(a){return 0===this.fadeDuration?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimea}setStale(){this.stale=!0}}(b,g,h,i,j),this._currentPlacementIndex=c.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(b,c,d){const f=a.exported.now(),g=()=>{const b=a.exported.now()-f;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const h=c[b[this._currentPlacementIndex]],i=this.placement.collisionIndex.transform.zoom;if("symbol"===h.type&&(!h.minzoom||h.minzoom<=i)&&(!h.maxzoom||h.maxzoom>i)){if(this._inProgressLayer||(this._inProgressLayer=new aN(h)),this._inProgressLayer.continuePlacement(d[h.source],this.placement,this._showCollisionBoxes,h,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const aP=512/a.EXTENT/2;class aQ{constructor(a,b,c){this.tileID=a,this.indexedSymbolInstances={},this.bucketInstanceId=c;for(let d=0;da.overscaledZ)for(const i in h){const j=h[i];j.tileID.isChildOf(a)&&j.findMatches(b.symbolInstances,a,f)}else{const k=h[a.scaledTo(Number(g)).key];k&&k.findMatches(b.symbolInstances,a,f)}}for(let l=0;l{b[a]=!0}),this.layerIndexes)b[c]||delete this.layerIndexes[c]}}const aT=(b,c)=>a.emitValidationErrors(b,c&&c.filter(a=>"source.canvas"!==a.identifier)),aU=a.pick(ae,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),aV=a.pick(ae,["setCenter","setZoom","setBearing","setPitch",]),aW=function(){const b={},c=a.spec.$version;for(const d in a.spec.$root){const f=a.spec.$root[d];if(f.required){let g=null;null!=(g="version"===d?c:"array"===f.type?[]:{})&&(b[d]=g)}}return b}(),aX={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class aY extends a.Evented{constructor(b,c={}){super(),this.map=b,this.dispatcher=new B(ab(),this),this.imageManager=new o,this.imageManager.setEventedParent(this),this.glyphManager=new a.GlyphManager(b._requestManager,c.localFontFamily?a.LocalGlyphMode.all:c.localIdeographFontFamily?a.LocalGlyphMode.ideographs:a.LocalGlyphMode.none,c.localFontFamily||c.localIdeographFontFamily),this.lineAtlas=new a.LineAtlas(256,512),this.crossTileSymbolIndex=new aS,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const d=this;this._rtlTextPluginCallback=aY.registerForPluginStateChange(b=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(b,c)=>{if(a.triggerPluginCompletionEvent(b),c&&c.every(a=>a))for(const f in d._sourceCaches){const g=d._sourceCaches[f],h=g.getSource().type;"vector"!==h&&"geojson"!==h||g.reload()}})}),this.on("data",a=>{if("source"!==a.dataType||"metadata"!==a.sourceDataType)return;const b=this.getSource(a.sourceId);if(b&&b.vectorLayerIds)for(const c in this._layers){const d=this._layers[c];d.source===b.id&&this._validateLayer(d)}})}loadURL(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const d="boolean"==typeof c.validate?c.validate:!a.isMapboxURL(b);b=this.map._requestManager.normalizeStyleURL(b,c.accessToken);const f=this.map._requestManager.transformRequest(b,a.ResourceType.Style);this._request=a.getJSON(f,(b,c)=>{this._request=null,b?this.fire(new a.ErrorEvent(b)):c&&this._load(c,d)})}loadJSON(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(b,!1!==c.validate)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(aW,!1)}_updateLayerCount(a,b){const c=b?1:-1;a.is3D()&&(this._num3DLayers+=c),"circle"===a.type&&(this._numCircleLayers+=c),"symbol"===a.type&&(this._numSymbolLayers+=c)}_load(b,c){if(c&&aT(this,a.validateStyle(b)))return;for(const d in this._loaded=!0,this.stylesheet=b,this.updateProjection(),b.sources)this.addSource(d,b.sources[d],{validate:!1});this._changed=!1,b.sprite?this._loadSprite(b.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(b.glyphs);const f=ad(this.stylesheet.layers);for(let g of(this._order=f.map(a=>a.id),this._layers={},this._serializedLayers={},f))(g=a.createStyleLayer(g)).setEventedParent(this,{layer:{id:g.id}}),this._layers[g.id]=g,this._serializedLayers[g.id]=g.serialize(),this._updateLayerCount(g,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new r(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 a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const a=this.map.transform.projection,b=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),c=this.map.transform.projection;if(this._loaded&&(c.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),b){if(c.isReprojectedInTileSpace||a.isReprojectedInTileSpace)for(const d in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[d].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(b){this._spriteRequest=function(b,c,d){let f,g,h;const i=a.exported.devicePixelRatio>1?"@2x":"";let j=a.getJSON(c.transformRequest(c.normalizeSpriteURL(b,i,".json"),a.ResourceType.SpriteJSON),(a,b)=>{j=null,h||(h=a,f=b,l())}),k=a.getImage(c.transformRequest(c.normalizeSpriteURL(b,i,".png"),a.ResourceType.SpriteImage),(a,b)=>{k=null,h||(h=a,g=b,l())});function l(){if(h)d(h);else if(f&&g){const b=a.exported.getImageData(g),c={};for(const i in f){const{width:j,height:k,x:l,y:m,sdf:n,pixelRatio:o,stretchX:p,stretchY:q,content:r}=f[i],s=new a.RGBAImage({width:j,height:k});a.RGBAImage.copy(b,s,{x:l,y:m},{x:0,y:0},{width:j,height:k}),c[i]={data:s,pixelRatio:o,sdf:n,stretchX:p,stretchY:q,content:r}}d(null,c)}}return{cancel(){j&&(j.cancel(),j=null),k&&(k.cancel(),k=null)}}}(b,this.map._requestManager,(b,c)=>{if(this._spriteRequest=null,b)this.fire(new a.ErrorEvent(b));else if(c)for(const d in c)this.imageManager.addImage(d,c[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(b){const c=this.getSource(b.source);if(!c)return;const d=b.sourceLayer;d&&("geojson"===c.type||c.vectorLayerIds&& -1===c.vectorLayerIds.indexOf(d))&&this.fire(new a.ErrorEvent(Error(`Source layer "${d}" does not exist on source "${c.id}" as specified by style layer "${b.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(a){const b=[];for(const c of a){const d=this._layers[c];"custom"!==d.type&&b.push(d.serialize())}return b}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const b in this._layers)if(this._layers[b].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&aX[a.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(b){if(!this._loaded)return;const c=this._changed;if(this._changed){const d=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);for(const g in(d.length||f.length)&&this._updateWorkerLayers(d,f),this._updatedSources){const h=this._updatedSources[g];"reload"===h?this._reloadSource(g):"clear"===h&&this._clearSource(g)}for(const i in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[i].updateTransitions(b);this.light.updateTransitions(b),this.fog&&this.fog.updateTransitions(b),this._resetUpdates()}const j={};for(const k in this._sourceCaches){const l=this._sourceCaches[k];j[k]=l.used,l.used=!1}for(const m of this._order){const n=this._layers[m];if(n.recalculate(b,this._availableImages),!n.isHidden(b.zoom)){const o=this._getLayerSourceCache(n);o&&(o.used=!0)}const p=this.map.painter;if(p){const q=n.getProgramIds();if(!q)continue;const r=n.getProgramConfiguration(b.zoom);for(const s of q)p.useProgram(s,r)}}for(const u in j){const v=this._sourceCaches[u];j[u]!==v.used&&v.getSource().fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:v.getSource().id}))}this.light.recalculate(b),this.terrain&&this.terrain.recalculate(b),this.fog&&this.fog.recalculate(b),this.z=b.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),c&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const b in this._sourceCaches)this._sourceCaches[b].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,b){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:b})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(b){if(this._checkLoaded(),aT(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=ad(b.layers);const c=(function(a,b){if(!a)return[{command:ae.setStyle,args:[b]},];let c=[];try{if(!g(a.version,b.version))return[{command:ae.setStyle,args:[b]},];g(a.center,b.center)||c.push({command:ae.setCenter,args:[b.center]}),g(a.zoom,b.zoom)||c.push({command:ae.setZoom,args:[b.zoom]}),g(a.bearing,b.bearing)||c.push({command:ae.setBearing,args:[b.bearing]}),g(a.pitch,b.pitch)||c.push({command:ae.setPitch,args:[b.pitch]}),g(a.sprite,b.sprite)||c.push({command:ae.setSprite,args:[b.sprite]}),g(a.glyphs,b.glyphs)||c.push({command:ae.setGlyphs,args:[b.glyphs]}),g(a.transition,b.transition)||c.push({command:ae.setTransition,args:[b.transition]}),g(a.light,b.light)||c.push({command:ae.setLight,args:[b.light]}),g(a.fog,b.fog)||c.push({command:ae.setFog,args:[b.fog]}),g(a.projection,b.projection)||c.push({command:ae.setProjection,args:[b.projection]});const d={},f=[];!function(a,b,c,d){let f;for(f in b=b||{},a=a||{})a.hasOwnProperty(f)&&(b.hasOwnProperty(f)||ag(f,c,d));for(f in b)b.hasOwnProperty(f)&&(a.hasOwnProperty(f)?g(a[f],b[f])||("geojson"===a[f].type&&"geojson"===b[f].type&&ai(a,b,f)?c.push({command:ae.setGeoJSONSourceData,args:[f,b[f].data,]}):ah(f,b,c,d)):af(f,b,c))}(a.sources,b.sources,f,d);const h=[];a.layers&&a.layers.forEach(a=>{d[a.source]?c.push({command:ae.removeLayer,args:[a.id]}):h.push(a)});let i=a.terrain;i&&d[i.source]&&(c.push({command:ae.setTerrain,args:[void 0]}),i=void 0),c=c.concat(f),g(i,b.terrain)||c.push({command:ae.setTerrain,args:[b.terrain]}),function(a,b,c){b=b||[];const d=(a=a||[]).map(ak),f=b.map(ak),h=a.reduce(al,{}),i=b.reduce(al,{}),j=d.slice(),k=Object.create(null);let l,m,n,o,p,q,r;for(l=0,m=0;l!(a.command in aV));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in aU));if(d.length>0)throw Error(`Unimplemented: ${d.map(a=>a.command).join(", ")}.`);return c.forEach(a=>{"setTransition"!==a.command&&this[a.command].apply(this,a.args)}),this.stylesheet=b,this.updateProjection(),!0}addImage(b,c){if(this.getImage(b))return this.fire(new a.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(b,c),this._afterImageUpdated(b)}updateImage(a,b){this.imageManager.updateImage(a,b)}getImage(a){return this.imageManager.getImage(a)}removeImage(b){if(!this.getImage(b))return this.fire(new a.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(b),this._afterImageUpdated(b)}_afterImageUpdated(b){this._availableImages=this.imageManager.listImages(),this._changedImages[b]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(b,c,d={}){if(this._checkLoaded(),void 0!==this.getSource(b))throw Error("There is already a source with this ID");if(!c.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(c).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(c.type)>=0&&this._validate(a.validateStyle.source,`sources.${b}`,c,null,d))return;this.map&&this.map._collectResourceTiming&&(c.collectResourceTiming=!0);const f=U(b,c,this.dispatcher,this);f.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:f.serialize(),sourceId:b}));const g=c=>{const d=(c?"symbol:":"other:")+b,g=this._sourceCaches[d]=new a.SourceCache(d,f,c);(c?this._symbolSourceCaches:this._otherSourceCaches)[b]=g,g.style=this,g.onAdd(this.map)};g(!1),"vector"!==c.type&&"geojson"!==c.type||g(!0),f.onAdd&&f.onAdd(this.map),this._changed=!0}removeSource(b){this._checkLoaded();const c=this.getSource(b);if(void 0===c)throw Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.get().source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while terrain is using it.`)));const f=this._getSourceCaches(b);for(const g of f)delete this._sourceCaches[g.id],delete this._updatedSources[g.id],g.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:g.getSource().id})),g.setEventedParent(null),g.clearTiles();delete this._otherSourceCaches[b],delete this._symbolSourceCaches[b],c.setEventedParent(null),c.onRemove&&c.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,b){this._checkLoaded(),this.getSource(a).setData(b),this._changed=!0}getSource(a){const b=this._getSourceCache(a);return b&&b.getSource()}addLayer(b,c,d={}){this._checkLoaded();const f=b.id;if(this.getLayer(f))return void this.fire(new a.ErrorEvent(Error(`Layer with id "${f}" already exists on this map`)));let g;if("custom"===b.type){if(aT(this,a.validateCustomStyleLayer(b)))return;g=a.createStyleLayer(b)}else{if("object"==typeof b.source&&(this.addSource(f,b.source),b=a.clone$1(b),b=a.extend(b,{source:f})),this._validate(a.validateStyle.layer,`layers.${f}`,b,{arrayIndex:-1},d))return;g=a.createStyleLayer(b),this._validateLayer(g),g.setEventedParent(this,{layer:{id:f}}),this._serializedLayers[g.id]=g.serialize(),this._updateLayerCount(g,!0)}const h=c?this._order.indexOf(c):this._order.length;if(c&& -1===h)return void this.fire(new a.ErrorEvent(Error(`Layer with id "${c}" does not exist on this map.`)));this._order.splice(h,0,f),this._layerOrderChanged=!0,this._layers[f]=g;const i=this._getLayerSourceCache(g);if(this._removedLayers[f]&&g.source&&i&&"custom"!==g.type){const j=this._removedLayers[f];delete this._removedLayers[f],j.type!==g.type?this._updatedSources[g.source]="clear":(this._updatedSources[g.source]="reload",i.pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(b,c){if(this._checkLoaded(),this._changed=!0,!this._layers[b])return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be moved.`)));if(b===c)return;const d=this._order.indexOf(b);this._order.splice(d,1);const f=c?this._order.indexOf(c):this._order.length;c&& -1===f?this.fire(new a.ErrorEvent(Error(`Layer with id "${c}" does not exist on this map.`))):(this._order.splice(f,0,b),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(b){this._checkLoaded();const c=this._layers[b];if(!c)return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be removed.`)));c.setEventedParent(null),this._updateLayerCount(c,!1);const d=this._order.indexOf(b);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[b]=c,delete this._layers[b],delete this._serializedLayers[b],delete this._updatedLayers[b],delete this._updatedPaintProps[b],c.onRemove&&c.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const b in this._layers)if(this._layers[b].type===a)return!0;return!1}setLayerZoomRange(b,c,d){this._checkLoaded();const f=this.getLayer(b);f?f.minzoom===c&&f.maxzoom===d||(null!=c&&(f.minzoom=c),null!=d&&(f.maxzoom=d),this._updateLayer(f)):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(b,c,d={}){this._checkLoaded();const f=this.getLayer(b);if(f){if(!g(f.filter,c))return null==c?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(a.validateStyle.filter,`layers.${f.id}.filter`,c,{layerType:f.type},d)||(f.filter=a.clone$1(c),this._updateLayer(f)))}else this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be filtered.`)))}getFilter(b){return a.clone$1(this.getLayer(b).filter)}setLayoutProperty(b,c,d,f={}){this._checkLoaded();const h=this.getLayer(b);h?g(h.getLayoutProperty(c),d)||(h.setLayoutProperty(c,d,f),this._updateLayer(h)):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(b,c){const d=this.getLayer(b);if(d)return d.getLayoutProperty(c);this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style.`)))}setPaintProperty(b,c,d,f={}){this._checkLoaded();const h=this.getLayer(b);h?g(h.getPaintProperty(c),d)||(h.setPaintProperty(c,d,f)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[b]=!0):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,b){return this.getLayer(a).getPaintProperty(b)}setFeatureState(b,c){this._checkLoaded();const d=b.source,f=b.sourceLayer,g=this.getSource(d);if(void 0===g)return void this.fire(new a.ErrorEvent(Error(`The source '${d}' does not exist in the map's style.`)));const h=g.type;if("geojson"===h&&f)return void this.fire(new a.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===h&&!f)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided.")));const i=this._getSourceCaches(d);for(const j of i)j.setFeatureState(f,b.id,c)}removeFeatureState(b,c){this._checkLoaded();const d=b.source,f=this.getSource(d);if(void 0===f)return void this.fire(new a.ErrorEvent(Error(`The source '${d}' does not exist in the map's style.`)));const g=f.type,h="vector"===g?b.sourceLayer:void 0;if("vector"===g&&!h)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(c&&"string"!=typeof b.id&&"number"!=typeof b.id)return void this.fire(new a.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const i=this._getSourceCaches(d);for(const j of i)j.removeFeatureState(h,b.id,c)}getFeatureState(b){this._checkLoaded();const c=b.source,d=b.sourceLayer,f=this.getSource(c);if(void 0!==f){if("vector"!==f.type||d)return void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(c)[0].getFeatureState(d,b.id);this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new a.ErrorEvent(Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const b={};for(const c in this._sourceCaches){const d=this._sourceCaches[c].getSource();b[d.id]||(b[d.id]=d.serialize())}return a.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:b,layers:this._serializeLayers(this._order)},a=>void 0!==a)}_updateLayer(a){this._updatedLayers[a.id]=!0;const b=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&b&&"raster"!==b.getSource().type&&(this._updatedSources[a.source]="reload",b.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(a){var b,c;const d={},f=[];for(let g=this._order.length-1;g>=0;g--){const h=this._order[g];if(b=h,"fill-extrusion"===this._layers[b].type)for(const i of(d[h]=g,a)){const j=i[h];if(j)for(const k of j)f.push(k)}}f.sort((a,b)=>b.intersectionZ-a.intersectionZ);const l=[];for(let m=this._order.length-1;m>=0;m--){const n=this._order[m];if(c=n,"fill-extrusion"===this._layers[c].type)for(let o=f.length-1;o>=0;o--){const p=f[o].feature;if(d[p.layer.id]{const b=this.getLayer(a);return b&&b.is3D()}):this.has3DLayers(),k=L.createFromScreenPoints(b,d);for(const l in this._sourceCaches){const m=this._sourceCaches[l].getSource().id;c.layers&&!f[m]||i.push(W(this._sourceCaches[l],this._layers,this._serializedLayers,k,c,d,j,!!this.map._showQueryGeometry))}return this.placement&&i.push(function(a,b,c,d,f,g,h){const i={},j=g.queryRenderedSymbols(d),k=[];for(const l of Object.keys(j).map(Number))k.push(h[l]);for(const m of(k.sort(Y),k)){const n=m.featureIndex.lookupSymbolFeatures(j[m.bucketInstanceId],b,m.bucketIndex,m.sourceLayerIndex,f.filter,f.layers,f.availableImages,a);for(const o in n){const p=i[o]=i[o]||[],q=n[o];for(const r of(q.sort((a,b)=>{const c=m.featureSortOrder;if(c){const d=c.indexOf(a.featureIndex);return c.indexOf(b.featureIndex)-d}return b.featureIndex-a.featureIndex}),q))p.push(r)}}for(const s in i)i[s].forEach(b=>{const d=b.feature,f=c(a[s]).getFeatureState(d.layer["source-layer"],d.id);d.source=d.layer.source,d.layer["source-layer"]&&(d.sourceLayer=d.layer["source-layer"]),d.state=f});return i}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),k.screenGeometry,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(i)}querySourceFeatures(b,c){c&&c.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",c.filter,null,c);const d=this._getSourceCaches(b);let f=[];for(const g of d)f=f.concat(X(g,c));return f}addSourceType(a,b,c){return aY.getSourceType(a)?c(Error(`A source type called "${a}" already exists.`)):(aY.setSourceType(a,b),b.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:b.workerSourceURL},c):c(null,null))}getLight(){return this.light.getLight()}setLight(b,c={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const h in b)if(!g(b[h],d[h])){f=!0;break}if(!f)return;const i={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(b,c),this.light.updateTransitions(i)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(b,c=1){if(this._checkLoaded(),!b)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===c){if("object"==typeof b.source){const d="terrain-dem-src";this.addSource(d,b.source),b=a.clone$1(b),b=a.extend(b,{source:d})}if(this._validate(a.validateStyle.terrain,"terrain",b))return}if(!this.terrain||this.terrain&&c!==this.terrain.drapeRenderMode)this._createTerrain(b,c);else{const f=this.terrain,h=f.get();for(const i in b)if(!g(b[i],h[i])){f.set(b),this.stylesheet.terrain=b;const j={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};f.updateTransitions(j);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(b){const c=this.fog=new A(b,this.map.transform);this.stylesheet.fog=b;const d={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(d)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(b){if(this._checkLoaded(),!b)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const c=this.fog,d=c.get();for(const f in b)if(!g(b[f],d[f])){c.set(b),this.stylesheet.fog=b;const h={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(h);break}}else this._createFog(b);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(a=>this.isLayerDraped(this._layers[a])),b=this._order.filter(a=>!this.isLayerDraped(this._layers[a]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...b)}_createTerrain(b,c){const d=this.terrain=new v(b,c);this.stylesheet.terrain=b,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const f={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(f)}_force3DLayerUpdate(){for(const a in this._layers){const b=this._layers[a];"fill-extrusion"===b.type&&this._updateLayer(b)}}_forceSymbolLayerUpdate(){for(const a in this._layers){const b=this._layers[a];"symbol"===b.type&&this._updateLayer(b)}}_validate(b,c,d,f,g={}){return(!g|| !1!==g.validate)&&aT(this,b.call(a.validateStyle,a.extend({key:c,style:this.serialize(),value:d,styleSpec:a.spec},f)))}_remove(){for(const b in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[b].setEventedParent(null);for(const c in this._sourceCaches)this._sourceCaches[c].clearTiles(),this._sourceCaches[c].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const b=this._getSourceCaches(a);for(const c of b)c.clearTiles()}_reloadSource(a){const b=this._getSourceCaches(a);for(const c of b)c.resume(),c.reload()}_updateSources(a){for(const b in this._sourceCaches)this._sourceCaches[b].update(a)}_generateCollisionBoxes(){for(const a in this._sourceCaches){const b=this._sourceCaches[a];b.resume(),b.reload()}}_updatePlacement(b,c,d,f,g=!1){let h=!1,i=!1;const j={};for(const k of this._order){const l=this._layers[k];if("symbol"!==l.type)continue;if(!j[l.source]){const m=this._getLayerSourceCache(l);if(!m)continue;j[l.source]=m.getRenderableIds(!0).map(a=>m.getTileByID(a)).sort((a,b)=>b.tileID.overscaledZ-a.tileID.overscaledZ||(a.tileID.isLessThan(b.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(l,j[l.source],b.center.lng,b.projection);h=h||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),g=g||this._layerOrderChanged||0===d,this._layerOrderChanged&&this.fire(new a.Event("neworder")),(g||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),b.zoom))&&(this.pauseablePlacement=new aO(b,this._order,g,c,d,f,this.placement,this.fog&&b.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,j),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),i=!0),h&&this.pauseablePlacement.placement.setStale()),i||h)for(const o of this._order){const p=this._layers[o];"symbol"===p.type&&this.placement.updateLayerOpacities(p,j[p.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,b,c){this.imageManager.getImages(b.icons,c),this._updateTilesForChangedImages();const d=a=>{a&&a.setDependencies(b.tileID.key,b.type,b.icons)};d(this._otherSourceCaches[b.source]),d(this._symbolSourceCaches[b.source])}getGlyphs(a,b,c){this.glyphManager.getGlyphs(b.stacks,c)}getResource(b,c,d){return a.makeRequest(c,d)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return"symbol"===a.type?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const b=[];return this._otherSourceCaches[a]&&b.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&b.push(this._symbolSourceCaches[a]),b}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)}}aY.getSourceType=function(a){return T[a]},aY.setSourceType=function(a,b){T[a]=b},aY.registerForPluginStateChange=a.registerForPluginStateChange;var aZ="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;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);}\n#endif",a$="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;}";let a_={},a0={};a_=a4("","\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\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.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",!0),a0=a4("#ifdef FOG\nuniform float u_fog_temporal_offset;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=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","#ifdef FOG\nuniform mat4 u_fog_matrix;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",!0);const a1=a4("\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;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\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;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(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) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 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."),a2=aZ;var a3={background:a4("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:a4("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:a4("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;attribute float a_scale;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\nvec2 scaled_extrude=extrude*a_scale;vec3 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=scaled_extrude.x*surface_vectors[0]+scaled_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\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\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:a4("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:a4("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\ngl_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;attribute float a_scale;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\nextrude*=a_scale;vec3 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:a4("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:a4("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:a4("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:a4("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:a4("#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:a4("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:a4("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:a4("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:a4("varying vec4 v_color;void main() {vec4 color=v_color;\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;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#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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,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\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_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*(pos.z+lift));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);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,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)));}v_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:a4("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\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#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==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;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)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:a4("#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:a4("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:a4("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\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;varying highp vec2 v_uv;\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\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\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#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\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;\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;varying highp vec2 v_uv;\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#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\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:a4("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:a4("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:a4("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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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_minFontScale,fontScale)+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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));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_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:a4("#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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float 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:a4("#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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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);\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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float 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:a4("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\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\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}"),terrainDepth:a4("#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:a4("\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}",a$),skyboxGradient:a4("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}",a$),skyboxCapture:a4("\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:a4("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\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_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:a4("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function a4(a,b,c){const d=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,f=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,g=b.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),h=a.match(f),i=b.match(f),j=aZ.match(f);let k=i?i.concat(h):h;c||(a_.staticUniforms&&(k=a_.staticUniforms.concat(k)),a0.staticUniforms&&(k=a0.staticUniforms.concat(k))),k&&(k=k.concat(j));const l={};return{fragmentSource:a=a.replace(d,(a,b,c,d,f)=>(l[f]=!0,"define"===b?` +Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(l[1])} }\`.`),];const m=[];return"symbol"===a.layerType&&("text-field"===h&&d&&!d.glyphs&&m.push(new bl(c,g,'use of "text-field" requires a style "glyphs" property')),"text-font"===h&&da(bp(g))&&"identity"===bo(g.type)&&m.push(new bl(c,g,'"text-font" does not support identity functions'))),m.concat(dY({key:a.key,value:g,valueSpec:k,style:d,styleSpec:f,expressionContext:"property",propertyType:b,propertyKey:h}))}function dO(a){return dN(a,"paint")}function dP(a){return dN(a,"layout")}function dQ(a){let b=[];const c=a.value,d=a.key,f=a.style,g=a.styleSpec;c.type||c.ref||b.push(new bl(d,c,'either "type" or "ref" is required'));let h=bo(c.type);const i=bo(c.ref);if(c.id){const j=bo(c.id);for(let k=0;k{a in c&&b.push(new bl(d,c[a],`"${a}" is prohibited for ref layers`))}),f.layers.forEach(a=>{bo(a.id)===i&&(m=a)}),m?m.ref?b.push(new bl(d,c.ref,"ref cannot reference another ref layer")):h=bo(m.type):b.push(new bl(d,c.ref,`ref layer "${i}" not found`))}else if("background"!==h&&"sky"!==h){if(c.source){const n=f.sources&&f.sources[c.source],o=n&&bo(n.type);n?"vector"===o&&"raster"===h?b.push(new bl(d,c.source,`layer "${c.id}" requires a raster source`)):"raster"===o&&"raster"!==h?b.push(new bl(d,c.source,`layer "${c.id}" requires a vector source`)):"vector"!==o||c["source-layer"]?"raster-dem"===o&&"hillshade"!==h?b.push(new bl(d,c.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===h&&c.paint&&c.paint["line-gradient"]&&("geojson"!==o||!n.lineMetrics)&&b.push(new bl(d,c,`layer "${c.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):b.push(new bl(d,c,`layer "${c.id}" must specify a "source-layer"`)):b.push(new bl(d,c.source,`source "${c.source}" not found`))}else b.push(new bl(d,c,'missing required property "source"'))}return b=b.concat(dr({key:d,value:c,valueSpec:g.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":()=>[],type:()=>dY({key:`${d}.type`,value:c.type,valueSpec:g.layer.type,style:a.style,styleSpec:a.styleSpec,object:c,objectKey:"type"}),filter:a=>dL(bn({layerType:h},a)),layout:a=>dr({layer:c,key:a.key,value:a.value,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":a=>dP(bn({layerType:h},a))}}),paint:a=>dr({layer:c,key:a.key,value:a.value,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":a=>dO(bn({layerType:h},a))}})}}))}function dR(a){const b=a.value,c=a.key,d=c9(b);return"string"!==d?[new bl(c,b,`string expected, ${d} found`)]:[]}const dS={promoteId:function({key:a,value:b}){if("string"===c9(b))return dR({key:a,value:b});{const c=[];for(const d in b)c.push(...dR({key:`${a}.${d}`,value:b[d]}));return c}}};function dT(a){const b=a.value,c=a.key,d=a.styleSpec,f=a.style;if(!b.type)return[new bl(c,b,'"type" is required')];const g=bo(b.type);let h;switch(g){case"vector":case"raster":case"raster-dem":return dr({key:c,value:b,valueSpec:d[`source_${g.replace("-","_")}`],style:a.style,styleSpec:d,objectElementValidators:dS});case"geojson":if(h=dr({key:c,value:b,valueSpec:d.source_geojson,style:f,styleSpec:d,objectElementValidators:dS}),b.cluster)for(const i in b.clusterProperties){const[j,k]=b.clusterProperties[i],l="string"==typeof j?[j,["accumulated"],["get",i],]:j;h.push(...dv({key:`${c}.${i}.map`,value:k,expressionContext:"cluster-map"})),h.push(...dv({key:`${c}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}return h;case"video":return dr({key:c,value:b,valueSpec:d.source_video,style:f,styleSpec:d});case"image":return dr({key:c,value:b,valueSpec:d.source_image,style:f,styleSpec:d});case"canvas":return[new bl(c,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return dx({key:`${c}.type`,value:b.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:f,styleSpec:d})}}function dU(a){const b=a.value,c=a.styleSpec,d=c.light,f=a.style;let g=[];const h=c9(b);if(void 0===b)return g;if("object"!==h)return g.concat([new bl("light",b,`object expected, ${h} found`),]);for(const i in b){const j=i.match(/^(.*)-transition$/);g=g.concat(j&&d[j[1]]&&d[j[1]].transition?dY({key:i,value:b[i],valueSpec:c.transition,style:f,styleSpec:c}):d[i]?dY({key:i,value:b[i],valueSpec:d[i],style:f,styleSpec:c}):[new bl(i,b[i],`unknown property "${i}"`),])}return g}function dV(a){const b=a.value,c=a.key,d=a.style,f=a.styleSpec,g=f.terrain;let h=[];const i=c9(b);if(void 0===b)return h;if("object"!==i)return h.concat([new bl("terrain",b,`object expected, ${i} found`),]);for(const j in b){const k=j.match(/^(.*)-transition$/);h=h.concat(k&&g[k[1]]&&g[k[1]].transition?dY({key:j,value:b[j],valueSpec:f.transition,style:d,styleSpec:f}):g[j]?dY({key:j,value:b[j],valueSpec:g[j],style:d,styleSpec:f}):[new bl(j,b[j],`unknown property "${j}"`),])}if(b.source){const l=d.sources&&d.sources[b.source],m=l&&bo(l.type);l?"raster-dem"!==m&&h.push(new bl(c,b.source,`terrain cannot be used with a source of type ${m}, it only be used with a "raster-dem" source type`)):h.push(new bl(c,b.source,`source "${b.source}" not found`))}else h.push(new bl(c,b,'terrain is missing required property "source"'));return h}function dW(a){const b=a.value,c=a.style,d=a.styleSpec,f=d.fog;let g=[];const h=c9(b);if(void 0===b)return g;if("object"!==h)return g.concat([new bl("fog",b,`object expected, ${h} found`),]);for(const i in b){const j=i.match(/^(.*)-transition$/);g=g.concat(j&&f[j[1]]&&f[j[1]].transition?dY({key:i,value:b[i],valueSpec:d.transition,style:c,styleSpec:d}):f[i]?dY({key:i,value:b[i],valueSpec:f[i],style:c,styleSpec:d}):[new bl(i,b[i],`unknown property "${i}"`),])}return g}const dX={"*":()=>[],array:ds,boolean:function(a){const b=a.value,c=a.key,d=c9(b);return"boolean"!==d?[new bl(c,b,`boolean expected, ${d} found`),]:[]},number:dt,color:function(a){const b=a.key,c=a.value,d=c9(c);return"string"!==d?[new bl(b,c,`color expected, ${d} found`),]:null===bJ.parseCSSColor(c)?[new bl(b,c,`color expected, "${c}" found`),]:[]},constants:bm,enum:dx,filter:dL,function:du,layer:dQ,object:dr,source:dT,light:dU,terrain:dV,fog:dW,string:dR,formatted:function(a){return 0===dR(a).length?[]:dv(a)},resolvedImage:function(a){return 0===dR(a).length?[]:dv(a)},projection:function(a){const b=a.value,c=a.styleSpec,d=c.projection,f=a.style;let g=[];const h=c9(b);if("object"===h)for(const i in b)g=g.concat(dY({key:i,value:b[i],valueSpec:d[i],style:f,styleSpec:c}));else"string"!==h&&(g=g.concat([new bl("projection",b,`object or string expected, ${h} found`),]));return g}};function dY(a){const b=a.value,c=a.valueSpec,d=a.styleSpec;return c.expression&&da(bo(b))?du(a):c.expression&&dj(bp(b))?dv(a):c.type&&dX[c.type]?dX[c.type](a):dr(bn({},a,{valueSpec:c.type?d[c.type]:c}))}function dZ(a){const b=a.value,c=a.key,d=dR(a);return d.length||(-1===b.indexOf("{fontstack}")&&d.push(new bl(c,b,'"glyphs" url must include a "{fontstack}" token')),-1===b.indexOf("{range}")&&d.push(new bl(c,b,'"glyphs" url must include a "{range}" token'))),d}function d$(a,b=bk){let c=[];return c=c.concat(dY({key:"",value:a,valueSpec:b.$root,styleSpec:b,style:a,objectElementValidators:{glyphs:dZ,"*":()=>[]}})),a.constants&&(c=c.concat(bm({key:"constants",value:a.constants,style:a,styleSpec:b}))),d_(c)}function d_(a){return[].concat(a).sort((a,b)=>a.line-b.line)}function d0(a){return function(...b){return d_(a.apply(this,b))}}d$.source=d0(dT),d$.light=d0(dU),d$.terrain=d0(dV),d$.fog=d0(dW),d$.layer=d0(dQ),d$.filter=d0(dL),d$.paintProperty=d0(dO),d$.layoutProperty=d0(dP);const d1=d$,d2=d1.light,d3=d1.fog,d4=d1.paintProperty,d5=d1.layoutProperty;function d6(a,b){let c=!1;if(b&&b.length)for(const d of b)a.fire(new bi(Error(d.message))),c=!0;return c}var d7=d8;function d8(a,b,c){var d=this.cells=[];if(a instanceof ArrayBuffer){this.arrayBuffer=a;var f=new Int32Array(this.arrayBuffer);a=f[0],this.d=(b=f[1])+2*(c=f[2]);for(var g=0;g=l[o+0]&&d>=l[o+1])?(h[n]=!0,g.push(k[n])):h[n]=!1}}},d8.prototype._forEachCell=function(a,b,c,d,f,g,h,i){for(var j=this._convertToCellCoord(a),k=this._convertToCellCoord(b),l=this._convertToCellCoord(c),m=this._convertToCellCoord(d),n=j;n<=l;n++)for(var o=k;o<=m;o++){var p=this.d*o+n;if((!i||i(this._convertFromCellCoord(n),this._convertFromCellCoord(o),this._convertFromCellCoord(n+1),this._convertFromCellCoord(o+1)))&&f.call(this,a,b,c,d,p,g,h,i))return}},d8.prototype._convertFromCellCoord=function(a){return(a-this.padding)/this.scale},d8.prototype._convertToCellCoord=function(a){return Math.max(0,Math.min(this.d-1,Math.floor(a*this.scale)+this.padding))},d8.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var a=this.cells,b=3+this.cells.length+1+1,c=0,d=0;d=0)continue;const k=a[j];i[j]=eb[h].shallow.indexOf(j)>=0?k:eg(k,b)}a instanceof Error&&(i.message=a.message)}if(i.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==h&&(i.$name=h),i}throw Error("can't serialize object of type "+typeof a)}function eh(a){if(null==a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||a instanceof Boolean||a instanceof Number||a instanceof String||a instanceof Date||a instanceof RegExp||ee(a)||ef(a)||ArrayBuffer.isView(a)||a instanceof d9)return a;if(Array.isArray(a))return a.map(eh);if("object"==typeof a){const b=a.$name||"Object",{klass:c}=eb[b];if(!c)throw Error(`can't deserialize unregistered class ${b}`);if(c.deserialize)return c.deserialize(a);const d=Object.create(c.prototype);for(const f of Object.keys(a)){if("$name"===f)continue;const g=a[f];d[f]=eb[b].shallow.indexOf(f)>=0?g:eh(g)}return d}throw Error("can't deserialize object of type "+typeof a)}class ei{constructor(){this.first=!0}update(a,b){const c=Math.floor(a);return this.first?(this.first=!1,this.lastIntegerZoom=c,this.lastIntegerZoomTime=0,this.lastZoom=a,this.lastFloorZoom=c,!0):(this.lastFloorZoom>c?(this.lastIntegerZoom=c+1,this.lastIntegerZoomTime=b):this.lastFloorZooma>=1536&&a<=1791,ek=a=>a>=1872&&a<=1919,el=a=>a>=2208&&a<=2303,em=a=>a>=11904&&a<=12031,en=a=>a>=12032&&a<=12255,eo=a=>a>=12272&&a<=12287,ep=a=>a>=12288&&a<=12351,eq=a=>a>=12352&&a<=12447,er=a=>a>=12448&&a<=12543,es=a=>a>=12544&&a<=12591,et=a=>a>=12704&&a<=12735,eu=a=>a>=12736&&a<=12783,ev=a=>a>=12784&&a<=12799,ew=a=>a>=12800&&a<=13055,ex=a=>a>=13056&&a<=13311,ey=a=>a>=13312&&a<=19903,ez=a=>a>=19968&&a<=40959,eA=a=>a>=40960&&a<=42127,eB=a=>a>=42128&&a<=42191,eC=a=>a>=44032&&a<=55215,eD=a=>a>=63744&&a<=64255,eE=a=>a>=64336&&a<=65023,eF=a=>a>=65040&&a<=65055,eG=a=>a>=65072&&a<=65103,eH=a=>a>=65104&&a<=65135,eI=a=>a>=65136&&a<=65279,eJ=a=>a>=65280&&a<=65519;function eK(a){for(const b of a)if(eN(b.charCodeAt(0)))return!0;return!1}function eL(a){for(const b of a)if(!eM(b.charCodeAt(0)))return!1;return!0}function eM(a){return!(ej(a)||ek(a)||el(a)||eE(a)||eI(a))}function eN(a){var b,c,d,f,g,h,i,j;return!(746!==a&&747!==a&&(a<4352||!(et(a)||es(a)||eG(a)&&!(a>=65097&&a<=65103)||eD(a)||ex(a)||em(a)||eu(a)||!(!ep(a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||ey(a)||ez(a)||ew(a)||(b=a)>=12592&&b<=12687||(c=a)>=43360&&c<=43391||(d=a)>=55216&&d<=55295||(f=a)>=4352&&f<=4607||eC(a)||eq(a)||eo(a)||(g=a)>=12688&&g<=12703||en(a)||ev(a)||er(a)&&12540!==a||!(!eJ(a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||!(!eH(a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(h=a)>=5120&&h<=5759||(i=a)>=6320&&i<=6399||eF(a)||(j=a)>=19904&&j<=19967||eA(a)||eB(a))))}function eO(a){var b,c,d,f,g,h,i,j,k,l,m,n,o;return!(eN(a)||(c=b=a)>=128&&c<=255&&(167===b||169===b||174===b||177===b||188===b||189===b||190===b||215===b||247===b)||(d=b)>=8192&&d<=8303&&(8214===b||8224===b||8225===b||8240===b||8241===b||8251===b||8252===b||8258===b||8263===b||8264===b||8265===b||8273===b)||(f=b)>=8448&&f<=8527||(g=b)>=8528&&g<=8591||(h=b)>=8960&&h<=9215&&(b>=8960&&b<=8967||b>=8972&&b<=8991||b>=8996&&b<=9e3||9003===b||b>=9085&&b<=9114||b>=9150&&b<=9165||9167===b||b>=9169&&b<=9179||b>=9186&&b<=9215)||(i=b)>=9216&&i<=9279&&9251!==b||(j=b)>=9280&&j<=9311||(k=b)>=9312&&k<=9471||(l=b)>=9632&&l<=9727||(m=b)>=9728&&m<=9983&&!(b>=9754&&b<=9759)||(n=b)>=11008&&n<=11263&&(b>=11026&&b<=11055||b>=11088&&b<=11097||b>=11192&&b<=11243)||ep(b)||er(b)||(o=b)>=57344&&o<=63743||eG(b)||eH(b)||eJ(b)||8734===b||8756===b||8757===b||b>=9984&&b<=10087||b>=10102&&b<=10131||65532===b||65533===b)}function eP(a){return a>=1424&&a<=2303||eE(a)||eI(a)}function eQ(a,b){var c;return!(!b&&eP(a)||a>=2304&&a<=3583||a>=3840&&a<=4255||(c=a)>=6016&&c<=6143)}function eR(a){for(const b of a)if(eP(b.charCodeAt(0)))return!0;return!1}const eS="deferred",eT="loading",eU="loaded";let eV=null,eW="unavailable",eX=null;const eY=function(a){a&&"string"==typeof a&&a.indexOf("NetworkError")> -1&&(eW="error"),eV&&eV(a)};function eZ(){e$.fire(new bh("pluginStateChange",{pluginStatus:eW,pluginURL:eX}))}const e$=new bj,e_=function(){return eW},e0=function(){if(eW!==eS||!eX)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");eW=eT,eZ(),eX&&a7({url:eX},a=>{a?eY(a):(eW=eU,eZ())})},e1={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>eW===eU||null!=e1.applyArabicShaping,isLoading:()=>eW===eT,setState(a){eW=a.pluginStatus,eX=a.pluginURL},isParsed:()=>null!=e1.applyArabicShaping&&null!=e1.processBidirectionalText&&null!=e1.processStyledBidirectionalText,getPluginURL:()=>eX};class e2{constructor(a,b){this.zoom=a,b?(this.now=b.now,this.fadeDuration=b.fadeDuration,this.zoomHistory=b.zoomHistory,this.transition=b.transition,this.pitch=b.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ei,this.transition={},this.pitch=0)}isSupportedScript(a){return function(a,b){for(const c of a)if(!eQ(c.charCodeAt(0),b))return!1;return!0}(a,e1.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const a=this.zoom,b=a-Math.floor(a),c=this.crossFadingFactor();return a>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:b+(1-b)*c}:{fromScale:.5,toScale:1,t:1-(1-c)*b}}}class e3{constructor(a,b){this.property=a,this.value=b,this.expression=function(a,b){if(da(a))return new dp(a,b);if(dj(a)){const c=dn(a,b);if("error"===c.result)throw Error(c.value.map(a=>`${a.key}: ${a.message}`).join(", "));return c.value}{let d=a;return"string"==typeof a&&"color"===b.type&&(d=bK.parse(a)),{kind:"constant",evaluate:()=>d}}}(void 0===b?a.specification.default:b,a.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(a,b,c){return this.property.possiblyEvaluate(this,a,b,c)}}class e4{constructor(a){this.property=a,this.value=new e3(a,void 0)}transitioned(a,b){return new e6(this.property,this.value,b,aa({},a.transition,this.transition),a.now)}untransitioned(){return new e6(this.property,this.value,null,{},0)}}class e5{constructor(a){this._properties=a,this._values=Object.create(a.defaultTransitionablePropertyValues)}getValue(a){return ak(this._values[a].value.value)}setValue(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new e4(this._values[a].property)),this._values[a].value=new e3(this._values[a].property,null===b?void 0:ak(b))}getTransition(a){return ak(this._values[a].transition)}setTransition(a,b){this._values.hasOwnProperty(a)||(this._values[a]=new e4(this._values[a].property)),this._values[a].transition=ak(b)||void 0}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c);const d=this.getTransition(b);void 0!==d&&(a[`${b}-transition`]=d)}return a}transitioned(a,b){const c=new e7(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].transitioned(a,b._values[d]);return c}untransitioned(){const a=new e7(this._properties);for(const b of Object.keys(this._values))a._values[b]=this._values[b].untransitioned();return a}}class e6{constructor(a,b,c,d,f){const g=d.delay||0,h=d.duration||0;f=f||0,this.property=a,this.value=b,this.begin=f+g,this.end=this.begin+h,a.specification.transition&&(d.delay||d.duration)&&(this.prior=c)}possiblyEvaluate(a,b,c){const d=a.now||0,f=this.value.possiblyEvaluate(a,b,c),g=this.prior;if(g){if(d>this.end||this.value.isDataDriven())return this.prior=null,f;if(dd.zoomHistory.lastIntegerZoom?{from:a,to:b,other:c}:{from:c,to:b,other:a}}interpolate(a){return a}}class fd{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){if(void 0!==a.value){if("constant"===a.expression.kind){const f=a.expression.evaluate(b,null,{},c,d);return this._calculate(f,f,f,b)}return this._calculate(a.expression.evaluate(new e2(Math.floor(b.zoom-1),b)),a.expression.evaluate(new e2(Math.floor(b.zoom),b)),a.expression.evaluate(new e2(Math.floor(b.zoom+1),b)),b)}}_calculate(a,b,c,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:a,to:b}:{from:c,to:b}}interpolate(a){return a}}class fe{constructor(a){this.specification=a}possiblyEvaluate(a,b,c,d){return!!a.expression.evaluate(b,null,{},c,d)}interpolate(){return!1}}class ff{constructor(a){for(const b in this.properties=a,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],a){const c=a[b];c.specification.overridable&&this.overridableProperties.push(b);const d=this.defaultPropertyValues[b]=new e3(c,void 0),f=this.defaultTransitionablePropertyValues[b]=new e4(c);this.defaultTransitioningPropertyValues[b]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[b]=d.possiblyEvaluate({})}}}function fg(a,b){return 256*(a=X(Math.floor(a),0,255))+X(Math.floor(b),0,255)}ec("DataDrivenProperty",fb),ec("DataConstantProperty",fa),ec("CrossFadedDataDrivenProperty",fc),ec("CrossFadedProperty",fd),ec("ColorRampProperty",fe);const fh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fi{constructor(a,b){this._structArray=a,this._pos1=b*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class fj{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(a,b){return a._trim(),b&&(a.isTransferred=!0,b.push(a.arrayBuffer)),{length:a.length,arrayBuffer:a.arrayBuffer}}static deserialize(a){const b=Object.create(this.prototype);return b.arrayBuffer=a.arrayBuffer,b.length=a.length,b.capacity=a.arrayBuffer.byteLength/b.bytesPerElement,b._refreshViews(),b}_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(a){this.reserve(a),this.length=a}reserve(a){if(a>this.capacity){this.capacity=Math.max(a,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const b=this.uint8;this._refreshViews(),b&&this.uint8.set(b)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function fk(a,b=1){let c=0,d=0;return{members:a.map(a=>{const f=fh[a.type].BYTES_PER_ELEMENT,g=c=fl(c,Math.max(b,f)),h=a.components||1;return d=Math.max(d,f),c+=f*h,{name:a.name,type:a.type,components:h,offset:g}}),size:fl(c,Math.max(d,b)),alignment:b}}function fl(a,b){return Math.ceil(a/b)*b}class fm extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.int16[d+0]=b,this.int16[d+1]=c,a}}fm.prototype.bytesPerElement=4,ec("StructArrayLayout2i4",fm);class fn extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=4*a;return this.int16[g+0]=b,this.int16[g+1]=c,this.int16[g+2]=d,this.int16[g+3]=f,a}}fn.prototype.bytesPerElement=8,ec("StructArrayLayout4i8",fn);class fo extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=6*a,k=12*a,l=3*a;return this.int16[j+0]=b,this.int16[j+1]=c,this.uint8[k+4]=d,this.uint8[k+5]=f,this.uint8[k+6]=g,this.uint8[k+7]=h,this.float32[l+2]=i,a}}fo.prototype.bytesPerElement=12,ec("StructArrayLayout2i4ub1f12",fo);class fp extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.float32[f+0]=b,this.float32[f+1]=c,this.float32[f+2]=d,a}}fp.prototype.bytesPerElement=12,ec("StructArrayLayout3f12",fp);class fq extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i,j,k){const l=this.length;return this.resize(l+1),this.emplace(l,a,b,c,d,f,g,h,i,j,k)}emplace(a,b,c,d,f,g,h,i,j,k,l){const m=10*a;return this.uint16[m+0]=b,this.uint16[m+1]=c,this.uint16[m+2]=d,this.uint16[m+3]=f,this.uint16[m+4]=g,this.uint16[m+5]=h,this.uint16[m+6]=i,this.uint16[m+7]=j,this.uint16[m+8]=k,this.uint16[m+9]=l,a}}fq.prototype.bytesPerElement=20,ec("StructArrayLayout10ui20",fq);class fr extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i){const j=this.length;return this.resize(j+1),this.emplace(j,a,b,c,d,f,g,h,i)}emplace(a,b,c,d,f,g,h,i,j){const k=8*a;return this.uint16[k+0]=b,this.uint16[k+1]=c,this.uint16[k+2]=d,this.uint16[k+3]=f,this.uint16[k+4]=g,this.uint16[k+5]=h,this.uint16[k+6]=i,this.uint16[k+7]=j,a}}fr.prototype.bytesPerElement=16,ec("StructArrayLayout8ui16",fr);class fs extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q){const r=this.length;return this.resize(r+1),this.emplace(r,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r){const s=16*a;return this.int16[s+0]=b,this.int16[s+1]=c,this.int16[s+2]=d,this.int16[s+3]=f,this.uint16[s+4]=g,this.uint16[s+5]=h,this.uint16[s+6]=i,this.uint16[s+7]=j,this.int16[s+8]=k,this.int16[s+9]=l,this.int16[s+10]=m,this.int16[s+11]=n,this.int16[s+12]=o,this.int16[s+13]=p,this.int16[s+14]=q,this.int16[s+15]=r,a}}fs.prototype.bytesPerElement=32,ec("StructArrayLayout4i4ui4i4i32",fs);class ft extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.uint32[1*a+0]=b,a}}ft.prototype.bytesPerElement=4,ec("StructArrayLayout1ul4",ft);class fu extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n){const o=this.length;return this.resize(o+1),this.emplace(o,a,b,c,d,f,g,h,i,j,k,l,m,n)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o){const p=20*a,q=10*a;return this.int16[p+0]=b,this.int16[p+1]=c,this.int16[p+2]=d,this.int16[p+3]=f,this.int16[p+4]=g,this.float32[q+3]=h,this.float32[q+4]=i,this.float32[q+5]=j,this.float32[q+6]=k,this.int16[p+14]=l,this.uint32[q+8]=m,this.uint16[p+18]=n,this.uint16[p+19]=o,a}}fu.prototype.bytesPerElement=40,ec("StructArrayLayout5i4f1i1ul2ui40",fu);class fv extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=8*a;return this.int16[j+0]=b,this.int16[j+1]=c,this.int16[j+2]=d,this.int16[j+4]=f,this.int16[j+5]=g,this.int16[j+6]=h,this.int16[j+7]=i,a}}fv.prototype.bytesPerElement=16,ec("StructArrayLayout3i2i2i16",fv);class fw extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f){const g=this.length;return this.resize(g+1),this.emplace(g,a,b,c,d,f)}emplace(a,b,c,d,f,g){const h=4*a,i=8*a;return this.float32[h+0]=b,this.float32[h+1]=c,this.float32[h+2]=d,this.int16[i+6]=f,this.int16[i+7]=g,a}}fw.prototype.bytesPerElement=16,ec("StructArrayLayout2f1f2i16",fw);class fx extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=12*a,h=3*a;return this.uint8[g+0]=b,this.uint8[g+1]=c,this.float32[h+1]=d,this.float32[h+2]=f,a}}fx.prototype.bytesPerElement=12,ec("StructArrayLayout2ub2f12",fx);class fy extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.uint16[f+0]=b,this.uint16[f+1]=c,this.uint16[f+2]=d,a}}fy.prototype.bytesPerElement=6,ec("StructArrayLayout3ui6",fy);class fz extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w){const x=this.length;return this.resize(x+1),this.emplace(x,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x){const y=30*a,z=15*a,A=60*a;return this.int16[y+0]=b,this.int16[y+1]=c,this.int16[y+2]=d,this.float32[z+2]=f,this.float32[z+3]=g,this.uint16[y+8]=h,this.uint16[y+9]=i,this.uint32[z+5]=j,this.uint32[z+6]=k,this.uint32[z+7]=l,this.uint16[y+16]=m,this.uint16[y+17]=n,this.uint16[y+18]=o,this.float32[z+10]=p,this.float32[z+11]=q,this.uint8[A+48]=r,this.uint8[A+49]=s,this.uint8[A+50]=u,this.uint32[z+13]=v,this.int16[y+28]=w,this.uint8[A+58]=x,a}}fz.prototype.bytesPerElement=60,ec("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",fz);class fA extends fj{_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(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F){const G=this.length;return this.resize(G+1),this.emplace(G,a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F)}emplace(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A,B,C,D,E,F,G){const H=38*a,I=19*a;return this.int16[H+0]=b,this.int16[H+1]=c,this.int16[H+2]=d,this.float32[I+2]=f,this.float32[I+3]=g,this.int16[H+8]=h,this.int16[H+9]=i,this.int16[H+10]=j,this.int16[H+11]=k,this.int16[H+12]=l,this.int16[H+13]=m,this.uint16[H+14]=n,this.uint16[H+15]=o,this.uint16[H+16]=p,this.uint16[H+17]=q,this.uint16[H+18]=r,this.uint16[H+19]=s,this.uint16[H+20]=u,this.uint16[H+21]=v,this.uint16[H+22]=w,this.uint16[H+23]=x,this.uint16[H+24]=y,this.uint16[H+25]=z,this.uint16[H+26]=A,this.uint16[H+27]=B,this.uint16[H+28]=C,this.uint32[I+15]=D,this.float32[I+16]=E,this.float32[I+17]=F,this.float32[I+18]=G,a}}fA.prototype.bytesPerElement=76,ec("StructArrayLayout3i2f6i15ui1ul3f76",fA);class fB extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.float32[1*a+0]=b,a}}fB.prototype.bytesPerElement=4,ec("StructArrayLayout1f4",fB);class fC extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(a,b,c){const d=this.length;return this.resize(d+1),this.emplace(d,a,b,c)}emplace(a,b,c,d){const f=3*a;return this.int16[f+0]=b,this.int16[f+1]=c,this.int16[f+2]=d,a}}fC.prototype.bytesPerElement=6,ec("StructArrayLayout3i6",fC);class fD extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d,f,g,h){const i=this.length;return this.resize(i+1),this.emplace(i,a,b,c,d,f,g,h)}emplace(a,b,c,d,f,g,h,i){const j=7*a;return this.float32[j+0]=b,this.float32[j+1]=c,this.float32[j+2]=d,this.float32[j+3]=f,this.float32[j+4]=g,this.float32[j+5]=h,this.float32[j+6]=i,a}}fD.prototype.bytesPerElement=28,ec("StructArrayLayout7f28",fD);class fE extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=6*a;return this.uint32[3*a+0]=b,this.uint16[g+2]=c,this.uint16[g+3]=d,this.uint16[g+4]=f,a}}fE.prototype.bytesPerElement=12,ec("StructArrayLayout1ul3ui12",fE);class fF extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.uint16[d+0]=b,this.uint16[d+1]=c,a}}fF.prototype.bytesPerElement=4,ec("StructArrayLayout2ui4",fF);class fG extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(a){const b=this.length;return this.resize(b+1),this.emplace(b,a)}emplace(a,b){return this.uint16[1*a+0]=b,a}}fG.prototype.bytesPerElement=2,ec("StructArrayLayout1ui2",fG);class fH extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b){const c=this.length;return this.resize(c+1),this.emplace(c,a,b)}emplace(a,b,c){const d=2*a;return this.float32[d+0]=b,this.float32[d+1]=c,a}}fH.prototype.bytesPerElement=8,ec("StructArrayLayout2f8",fH);class fI extends fj{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(a,b,c,d){const f=this.length;return this.resize(f+1),this.emplace(f,a,b,c,d)}emplace(a,b,c,d,f){const g=4*a;return this.float32[g+0]=b,this.float32[g+1]=c,this.float32[g+2]=d,this.float32[g+3]=f,a}}fI.prototype.bytesPerElement=16,ec("StructArrayLayout4f16",fI);class fJ extends fi{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]}}fJ.prototype.size=40;class fK extends fu{get(a){return new fJ(this,a)}}ec("CollisionBoxArray",fK);class fL extends fi{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(a){this._structArray.uint8[this._pos1+49]=a}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(a){this._structArray.uint8[this._pos1+50]=a}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(a){this._structArray.uint32[this._pos4+13]=a}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(a){this._structArray.uint8[this._pos1+58]=a}}fL.prototype.size=60;class fM extends fz{get(a){return new fL(this,a)}}ec("PlacedSymbolArray",fM);class fN extends fi{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(a){this._structArray.uint32[this._pos4+15]=a}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]}}fN.prototype.size=76;class fO extends fA{get(a){return new fN(this,a)}}ec("SymbolInstanceArray",fO);class fP extends fB{getoffsetX(a){return this.float32[1*a+0]}}ec("GlyphOffsetArray",fP);class fQ extends fC{getx(a){return this.int16[3*a+0]}gety(a){return this.int16[3*a+1]}gettileUnitDistanceFromAnchor(a){return this.int16[3*a+2]}}ec("SymbolLineVertexArray",fQ);class fR extends fi{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]}}fR.prototype.size=12;class fS extends fE{get(a){return new fR(this,a)}}ec("FeatureIndexArray",fS);class fT extends fi{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}fT.prototype.size=4;class fU extends fF{get(a){return new fT(this,a)}}ec("FillExtrusionCentroidArray",fU);const fV=fk([{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"},]),fW=fk([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var fX=bI(function(a){a.exports=function(a,b){var c,d,f,g,h,i,j,k;for(d=a.length-(c=3&a.length),f=b,h=3432918353,i=461845907,k=0;k>>16)*h&65535)<<16)&4294967295)<<15|j>>>17))*i+(((j>>>16)*i&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(j=0,c){case 3:j^=(255&a.charCodeAt(k+2))<<16;case 2:j^=(255&a.charCodeAt(k+1))<<8;case 1:f^=j=(65535&(j=(j=(65535&(j^=255&a.charCodeAt(k)))*h+(((j>>>16)*h&65535)<<16)&4294967295)<<15|j>>>17))*i+(((j>>>16)*i&65535)<<16)&4294967295}return f^=a.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0}}),fY=bI(function(a){a.exports=function(a,b){for(var c,d=a.length,f=b^d,g=0;d>=4;)c=1540483477*(65535&(c=255&a.charCodeAt(g)|(255&a.charCodeAt(++g))<<8|(255&a.charCodeAt(++g))<<16|(255&a.charCodeAt(++g))<<24))+((1540483477*(c>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++g;switch(d){case 3:f^=(255&a.charCodeAt(g+2))<<16;case 2:f^=(255&a.charCodeAt(g+1))<<8;case 1:f=1540483477*(65535&(f^=255&a.charCodeAt(g)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0}}),fZ=fX;fZ.murmur3=fX,fZ.murmur2=fY;class f${constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(a,b,c,d){this.ids.push(f_(a)),this.positions.push(b,c,d)}getPositions(a){const b=f_(a);let c=0,d=this.ids.length-1;for(;c>1;this.ids[f]>=b?d=f:c=f+1}const g=[];for(;this.ids[c]===b;)g.push({index:this.positions[3*c],start:this.positions[3*c+1],end:this.positions[3*c+2]}),c++;return g}static serialize(a,b){const c=new Float64Array(a.ids),d=new Uint32Array(a.positions);return f0(c,d,0,c.length-1),b&&b.push(c.buffer,d.buffer),{ids:c,positions:d}}static deserialize(a){const b=new f$;return b.ids=a.ids,b.positions=a.positions,b.indexed=!0,b}}function f_(a){const b=+a;return!isNaN(b)&&Number.MIN_SAFE_INTEGER<=b&&b<=Number.MAX_SAFE_INTEGER?b:fZ(String(a))}function f0(a,b,c,d){for(;c>1];let g=c-1,h=d+1;for(;;){do g++;while(a[g]f)if(g>=h)break;f1(a,g,h),f1(b,3*g,3*h),f1(b,3*g+1,3*h+1),f1(b,3*g+2,3*h+2)}h-c`u_${a}`),this.type=c}setUniform(a,b,c){a.set(c.constantOr(this.value))}getBinding(a,b,c){return"color"===this.type?new f5(a,b):new f3(a,b)}}class gb{constructor(a,b){this.uniformNames=b.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(a,b){this.pixelRatioFrom=b.pixelRatio,this.pixelRatioTo=a.pixelRatio,this.patternFrom=b.tl.concat(b.br),this.patternTo=a.tl.concat(a.br)}setUniform(a,b,c,d){const f="u_pattern_to"===d||"u_dash_to"===d?this.patternTo:"u_pattern_from"===d||"u_dash_from"===d?this.patternFrom:"u_pixel_ratio_to"===d?this.pixelRatioTo:"u_pixel_ratio_from"===d?this.pixelRatioFrom:null;f&&a.set(f)}getBinding(a,b,c){return"u_pattern_from"===c||"u_pattern_to"===c||"u_dash_from"===c||"u_dash_to"===c?new f4(a,b):new f3(a,b)}}class gc{constructor(a,b,c,d){this.expression=a,this.type=c,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(a,b,c,d,f,g){const h=this.paintVertexArray.length,i=this.expression.evaluate(new e2(0),b,{},f,d,g);this.paintVertexArray.resize(a),this._setPaintValue(h,a,i)}updatePaintArray(a,b,c,d,f){const g=this.expression.evaluate({zoom:0},c,d,void 0,f);this._setPaintValue(a,b,g)}_setPaintValue(a,b,c){if("color"===this.type){const d=f9(c);for(let f=a;f`u_${a}_t`),this.type=c,this.useIntegerZoom=d,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=b.map(a=>({name:`a_${a}`,type:"Float32",components:"color"===c?4:2,offset:0})),this.paintVertexArray=new g}populatePaintArray(a,b,c,d,f,g){const h=this.expression.evaluate(new e2(this.zoom),b,{},f,d,g),i=this.expression.evaluate(new e2(this.zoom+1),b,{},f,d,g),j=this.paintVertexArray.length;this.paintVertexArray.resize(a),this._setPaintValue(j,a,h,i)}updatePaintArray(a,b,c,d,f){const g=this.expression.evaluate({zoom:this.zoom},c,d,void 0,f),h=this.expression.evaluate({zoom:this.zoom+1},c,d,void 0,f);this._setPaintValue(a,b,g,h)}_setPaintValue(a,b,c,d){if("color"===this.type){const f=f9(c),g=f9(d);for(let h=a;h!0){this.binders={},this._buffers=[];const d=[];for(const f in a.paint._values){if(!c(f))continue;const g=a.paint.get(f);if(!(g instanceof e8&&c6(g.property.specification)))continue;const h=gi(f,a.type),i=g.value,j=g.property.specification.type,k=g.property.useIntegerZoom,l=g.property.specification["property-type"],m="cross-faded"===l||"cross-faded-data-driven"===l,n="line-dasharray"===String(f)&&"constant"!==a.layout.get("line-cap").value.kind;if("constant"!==i.kind||n){if("source"===i.kind||n||m){const o=gl(f,j,"source");this.binders[f]=m?new ge(i,h,j,k,b,o,a.id):new gc(i,h,j,o),d.push(`/a_${f}`)}else{const p=gl(f,j,"composite");this.binders[f]=new gd(i,h,j,k,b,p),d.push(`/z_${f}`)}}else this.binders[f]=m?new gb(i.value,h):new ga(i.value,h,j),d.push(`/u_${f}`)}this.cacheKey=d.sort().join("")}getMaxValue(a){const b=this.binders[a];return b instanceof gc||b instanceof gd?b.maxValue:0}populatePaintArrays(a,b,c,d,f,g){for(const h in this.binders){const i=this.binders[h];(i instanceof gc||i instanceof gd||i instanceof ge)&&i.populatePaintArray(a,b,c,d,f,g)}}setConstantPatternPositions(a,b){for(const c in this.binders){const d=this.binders[c];d instanceof gb&&d.setConstantPatternPositions(a,b)}}updatePaintArrays(a,b,c,d,f,g){let h=!1;for(const i in a){const j=b.getPositions(i);for(const k of j){const l=c.feature(k.index);for(const m in this.binders){const n=this.binders[m];if((n instanceof gc||n instanceof gd||n instanceof ge)&& !0===n.expression.isStateDependent){const o=d.paint.get(m);n.expression=o.value,n.updatePaintArray(k.start,k.end,l,a[i],f,g),h=!0}}}}return h}defines(){const a=[];for(const b in this.binders){const c=this.binders[b];(c instanceof ga||c instanceof gb)&&a.push(...c.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return a}getBinderAttributes(){const a=[];for(const b in this.binders){const c=this.binders[b];if(c instanceof gc||c instanceof gd||c instanceof ge)for(let d=0;d!0){for(const d of(this.programConfigurations={},a))this.programConfigurations[d.id]=new gf(d,b,c);this.needsUpload=!1,this._featureMap=new f$,this._bufferOffset=0}populatePaintArrays(a,b,c,d,f,g,h){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(a,b,d,f,g,h);void 0!==b.id&&this._featureMap.add(b.id,c,this._bufferOffset,a),this._bufferOffset=a,this.needsUpload=!0}updatePaintArrays(a,b,c,d,f){for(const g of c)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(a,this._featureMap,b,g,d,f)||this.needsUpload}get(a){return this.programConfigurations[a]}upload(a){if(this.needsUpload){for(const b in this.programConfigurations)this.programConfigurations[b].upload(a);this.needsUpload=!1}}destroy(){for(const a in this.programConfigurations)this.programConfigurations[a].destroy()}}const gh={"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 gi(a,b){return gh[a]||[a.replace(`${b}-`,"").replace(/-/g,"_"),]}const gj={"line-pattern":{source:fq,composite:fq},"fill-pattern":{source:fq,composite:fq},"fill-extrusion-pattern":{source:fq,composite:fq},"line-dasharray":{source:fr,composite:fr}},gk={color:{source:fH,composite:fI},number:{source:fB,composite:fH}};function gl(a,b,c){const d=gj[a];return d&&d[c]||gk[b][c]}ec("ConstantBinder",ga),ec("CrossFadedConstantBinder",gb),ec("SourceExpressionBinder",gc),ec("CrossFadedCompositeBinder",ge),ec("CompositeExpressionBinder",gd),ec("ProgramConfiguration",gf,{omit:["_buffers"]}),ec("ProgramConfigurationSet",gg);const gm="-transition";class gn extends bj{constructor(a,b){if(super(),this.id=a.id,this.type=a.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==a.type&&(this.metadata=a.metadata,this.minzoom=a.minzoom,this.maxzoom=a.maxzoom,"background"!==a.type&&"sky"!==a.type&&(this.source=a.source,this.sourceLayer=a["source-layer"],this.filter=a.filter),b.layout&&(this._unevaluatedLayout=new class{constructor(a){this._properties=a,this._values=Object.create(a.defaultPropertyValues)}getValue(a){return ak(this._values[a].value)}setValue(a,b){this._values[a]=new e3(this._values[a].property,null===b?void 0:ak(b))}serialize(){const a={};for(const b of Object.keys(this._values)){const c=this.getValue(b);void 0!==c&&(a[b]=c)}return a}possiblyEvaluate(a,b,c){const d=new e9(this._properties);for(const f of Object.keys(this._values))d._values[f]=this._values[f].possiblyEvaluate(a,b,c);return d}}(b.layout)),b.paint)){for(const c in this._transitionablePaint=new e5(b.paint),a.paint)this.setPaintProperty(c,a.paint[c],{validate:!1});for(const d in a.layout)this.setLayoutProperty(d,a.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new e9(b.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(a){return"visibility"===a?this.visibility:this._unevaluatedLayout.getValue(a)}setLayoutProperty(a,b,c={}){null!=b&&this._validate(d5,`layers.${this.id}.layout.${a}`,a,b,c)||("visibility"!==a?this._unevaluatedLayout.setValue(a,b):this.visibility=b)}getPaintProperty(a){return ah(a,gm)?this._transitionablePaint.getTransition(a.slice(0,-gm.length)):this._transitionablePaint.getValue(a)}setPaintProperty(a,b,c={}){if(null!=b&&this._validate(d4,`layers.${this.id}.paint.${a}`,a,b,c))return!1;if(ah(a,gm))return this._transitionablePaint.setTransition(a.slice(0,-gm.length),b||void 0),!1;{const d=this._transitionablePaint._values[a],f="cross-faded-data-driven"===d.property.specification["property-type"],g=d.value.isDataDriven(),h=d.value;this._transitionablePaint.setValue(a,b),this._handleSpecialPaintPropertyUpdate(a);const i=this._transitionablePaint._values[a].value;return i.isDataDriven()||g||f||this._handleOverridablePaintPropertyUpdate(a,h,i)}}_handleSpecialPaintPropertyUpdate(a){}getProgramIds(){return null}getProgramConfiguration(a){return null}_handleOverridablePaintPropertyUpdate(a,b,c){return!1}isHidden(a){return!!(this.minzoom&&a=this.maxzoom)||"none"===this.visibility}updateTransitions(a){this._transitioningPaint=this._transitionablePaint.transitioned(a,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(a,b){a.getCrossfadeParameters&&(this._crossfadeParameters=a.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(a,void 0,b)),this.paint=this._transitioningPaint.possiblyEvaluate(a,void 0,b)}serialize(){const a={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&&(a.layout=a.layout||{},a.layout.visibility=this.visibility),aj(a,(a,b)=>!(void 0===a||"layout"===b&&!Object.keys(a).length||"paint"===b&&!Object.keys(a).length))}_validate(a,b,c,d,f={}){return(!f|| !1!==f.validate)&&d6(this,a.call(d1,{key:b,layerType:this.type,objectKey:c,value:d,styleSpec:bk,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const a in this.paint._values){const b=this.paint.get(a);if(b instanceof e8&&c6(b.property.specification)&&("source"===b.value.kind||"composite"===b.value.kind)&&b.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=dz(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const go=fk([{name:"a_pos",components:2,type:"Int16"},],4),{members:gp}=go;class gq{constructor(a=[]){this.segments=a}prepareSegment(a,b,c,d){let f=this.segments[this.segments.length-1];return a>gq.MAX_VERTEX_ARRAY_LENGTH&&am(`Max vertices per segment is ${gq.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${a}`),(!f||f.vertexLength+a>gq.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==d)&&(f={vertexOffset:b.length,primitiveOffset:c.length,vertexLength:0,primitiveLength:0},void 0!==d&&(f.sortKey=d),this.segments.push(f)),f}get(){return this.segments}destroy(){for(const a of this.segments)for(const b in a.vaos)a.vaos[b].destroy()}static simpleSegment(a,b,c,d){return new gq([{vertexOffset:a,primitiveOffset:b,vertexLength:c,primitiveLength:d,vaos:{},sortKey:0},])}}gq.MAX_VERTEX_ARRAY_LENGTH=65535,ec("SegmentVector",gq);class gr{constructor(a,b){a&&(b?this.setSouthWest(a).setNorthEast(b):4===a.length?this.setSouthWest([a[0],a[1],]).setNorthEast([a[2],a[3]]):this.setSouthWest(a[0]).setNorthEast(a[1]))}setNorthEast(a){return this._ne=a instanceof gs?new gs(a.lng,a.lat):gs.convert(a),this}setSouthWest(a){return this._sw=a instanceof gs?new gs(a.lng,a.lat):gs.convert(a),this}extend(a){const b=this._sw,c=this._ne;let d,f;if(a instanceof gs)d=a,f=a;else{if(!(a instanceof gr))return Array.isArray(a)?4===a.length||a.every(Array.isArray)?this.extend(gr.convert(a)):this.extend(gs.convert(a)):this;if(d=a._sw,f=a._ne,!d||!f)return this}return b||c?(b.lng=Math.min(d.lng,b.lng),b.lat=Math.min(d.lat,b.lat),c.lng=Math.max(f.lng,c.lng),c.lat=Math.max(f.lat,c.lat)):(this._sw=new gs(d.lng,d.lat),this._ne=new gs(f.lng,f.lat)),this}getCenter(){return new gs((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 gs(this.getWest(),this.getNorth())}getSouthEast(){return new gs(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(a){const{lng:b,lat:c}=gs.convert(a);let d=this._sw.lng<=b&&b<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=b&&b>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&d}static convert(a){return!a||a instanceof gr?a:new gr(a)}}class gs{constructor(a,b){if(isNaN(a)||isNaN(b))throw Error(`Invalid LngLat object: (${a}, ${b})`);if(this.lng=+a,this.lat=+b,this.lat>90||this.lat< -90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new gs(Z(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(a){const b=Math.PI/180,c=this.lat*b,d=a.lat*b,f=Math.sin(c)*Math.sin(d)+Math.cos(c)*Math.cos(d)*Math.cos((a.lng-this.lng)*b);return 6371008.8*Math.acos(Math.min(f,1))}toBounds(a=0){const b=360*a/40075017,c=b/Math.cos(Math.PI/180*this.lat);return new gr(new gs(this.lng-c,this.lat-b),new gs(this.lng+c,this.lat+b))}static convert(a){if(a instanceof gs)return a;if(Array.isArray(a)&&(2===a.length||3===a.length))return new gs(Number(a[0]),Number(a[1]));if(!Array.isArray(a)&&"object"==typeof a&&null!==a)return new gs(Number("lng"in a?a.lng:a.lon),Number(a.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const gt=2*Math.PI*6371008.8;function gu(a){return gt*Math.cos(a*Math.PI/180)}function gv(a){return(180+a)/360}function gw(a){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+a*Math.PI/360)))/360}function gx(a,b){return a/gu(b)}function gy(a){return 360*a-180}function gz(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}class gA{constructor(a,b,c=0){this.x=+a,this.y=+b,this.z=+c}static fromLngLat(a,b=0){const c=gs.convert(a);return new gA(gv(c.lng),gw(c.lat),b/gu(c.lat))}toLngLat(){return new gs(gy(this.x),gz(this.y))}toAltitude(){return this.z*gu(gz(this.y))}meterInMercatorCoordinateUnits(){return 1/gt*(1/Math.cos(gz(this.y)*Math.PI/180))}}function gB(a,b,c,d,f,h,i,j,k){const l=(b+d)/2,m=(c+f)/2,n=new g(l,m);j(n),function(a,b,c,d,f,g){const h=c-f,i=d-g;return Math.abs((d-b)*h-(c-a)*i)/Math.hypot(h,i)}(n.x,n.y,h.x,h.y,i.x,i.y)>=k?(gB(a,b,c,l,m,h,n,j,k),gB(a,l,m,d,f,n,i,j,k)):a.push(i)}function gC(a,b,c){const d=[];let f,g,h;for(const i of a){const{x:j,y:k}=i;b(i),h?gB(d,f,g,j,k,h,i,b,c):d.push(i),f=j,g=k,h=i}return d}const gD=-16383-1;function gE(a,b){const c=Math.round(a.x*b),d=Math.round(a.y*b);return a.x=X(c,gD,16383),a.y=X(d,gD,16383),(ca.x+1||da.y+1)&&am("Geometry exceeds allowed extent, reduce your vector tile buffer size"),a}function gF(a,b,c){const d=a.loadGeometry(),f=a.extent,g=8192/f;if(b&&c&&c.projection.isReprojectedInTileSpace){const h=1<{const c=gy((b.x+a.x/f)/h),d=gz((b.y+a.y/f)/h),g=l.project(c,d);a.x=(g.x*i-j)*f,a.y=(g.y*i-k)*f};for(let n=0;n=f||p.y<0||p.y>=f||(m(p),o.push(p));d[n]=o}}for(const q of d)for(const r of q)gE(r,g);return d}function gG(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?gF(a):[]}}function gH(a,b,c,d,f){a.emplaceBack(2*b+(d+1)/2,2*c+(f+1)/2)}class gI{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new fm,this.indexArray=new fy,this.segments=new gq,this.programConfigurations=new gg(a.layers,a.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){const f=this.layers[0],g=[];let h=null;for(const{feature:i,id:j,index:k,sourceLayerIndex:l}of("circle"===f.type&&(h=f.layout.get("circle-sort-key")),a)){const m=this.layers[0]._featureFilter.needGeometry,n=gG(i,m);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),n,c))continue;const o=h?h.evaluate(n,{},c):void 0,p={id:j,properties:i.properties,type:i.type,sourceLayerIndex:l,index:k,geometry:m?n.geometry:gF(i,c,d),patterns:{},sortKey:o};g.push(p)}for(const q of(h&&g.sort((a,b)=>a.sortKey-b.sortKey),g)){const{geometry:r,index:s,sourceLayerIndex:u}=q,v=a[s].feature;this.addFeature(q,r,s,b.availableImages,c),b.featureIndex.insert(v,r,s,u,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,gp),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(a,b,c,d,f){for(const g of b)for(const h of g){const i=h.x,j=h.y;if(i<0||i>=8192||j<0||j>=8192)continue;const k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,a.sortKey),l=k.vertexLength;gH(this.layoutVertexArray,i,j,-1,-1),gH(this.layoutVertexArray,i,j,1,-1),gH(this.layoutVertexArray,i,j,1,1),gH(this.layoutVertexArray,i,j,-1,1),this.indexArray.emplaceBack(l,l+1,l+2),this.indexArray.emplaceBack(l,l+3,l+2),k.vertexLength+=4,k.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,{},d,f)}}function gJ(a,b){for(let c=0;c1){if(gM(a,b))return!0;for(let d=0;d1?c:c.sub(b)._mult(f)._add(b))}function gQ(a,b){let c,d,f,g=!1;for(let h=0;hb.y!=f.y>b.y&&b.x<(f.x-d.x)*(b.y-d.y)/(f.y-d.y)+d.x&&(g=!g)}return g}function gR(a,b){let c=!1;for(let d=0,f=a.length-1;db.y!=h.y>b.y&&b.x<(h.x-g.x)*(b.y-g.y)/(h.y-g.y)+g.x&&(c=!c)}return c}function gS(a,b,c,d,f){for(const h of a)if(b<=h.x&&c<=h.y&&d>=h.x&&f>=h.y)return!0;const i=[new g(b,c),new g(b,f),new g(d,f),new g(d,c),];if(a.length>2){for(const j of i)if(gR(a,j))return!0}for(let k=0;kf.x&&b.x>f.x||a.yf.y&&b.y>f.y)return!1;const g=an(a,b,c[0]);return g!==an(a,b,c[1])||g!==an(a,b,c[2])||g!==an(a,b,c[3])}function gU(a,b,c){const d=b.paint.get(a).value;return"constant"===d.kind?d.value:c.programConfigurations.get(b.id).getMaxValue(a)}function gV(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function gW(a,b,c,d,f){if(!b[0]&&!b[1])return a;const h=g.convert(b)._mult(f);"viewport"===c&&h._rotate(-d);const i=[];for(let j=0;j{var g,h,i;const j=K([],c,a),k=1/j[3]/b*f;return g=j,h=j,i=[k,k,d?1/j[3]:k,k],g[0]=h[0]*i[0],g[1]=h[1]*i[1],g[2]=h[2]*i[2],g[3]=h[3]*i[3],g}),h=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(a=>{const b=D([],F([],J([],g[a[0]],g[a[1]]),J([],g[a[2]],g[a[1]]))),c=-E(b,g[a[1]]);return b.concat(c)});return new g$(g,h)}}class g_{constructor(a,b){this.min=a,this.max=b,this.center=B([],x([],this.min,this.max),.5)}quadrant(a){const b=[a%2==0,a<2],c=u(this.min),d=u(this.max);for(let f=0;f=0;if(0===g)return 0;g!==b.length&&(c=!1)}if(c)return 2;for(let i=0;i<3;i++){let j=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(let l=0;lthis.max[i]-this.min[i])return 0}return 1}}function g0(a,b,c,d,f,g,h,i,j){if(g&&a.queryGeometry.isAboveHorizon)return!1;for(const k of(g&&(j*=a.pixelToTileUnitsFactor),b))for(const l of k){var m,n,o;const p=l.add(i),q=f&&c.elevation?c.elevation.exaggeration()*f.getElevationAt(p.x,p.y,!0):0,r=g?p:g1(p,q,d),s=g?a.tilespaceRays.map(a=>g4(a,q)):a.queryGeometry.screenGeometry,u=K([],[l.x,l.y,q,1],d);if(!h&&g?j*=u[3]/c.cameraToCenterDistance:h&&!g&&(j*=c.cameraToCenterDistance/u[3]),m=s,n=r,o=j,gR(m,n)||gO(n,m,o))return!0}return!1}function g1(a,b,c){const d=K([],[a.x,a.y,b,1],c);return new g(d[0]/d[3],d[1]/d[3])}const g2=w(0,0,0),g3=w(0,0,1);function g4(a,b){const c=s();return g2[2]=b,a.intersectsPlane(g2,g3,c),new g(c[0],c[1])}class g5 extends gI{}function g6(a,{width:b,height:c},d,f){if(f){if(f instanceof Uint8ClampedArray)f=new Uint8Array(f.buffer);else if(f.length!==b*c*d)throw RangeError("mismatched image size")}else f=new Uint8Array(b*c*d);return a.width=b,a.height=c,a.data=f,a}function g7(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const f=g6({},{width:b,height:c},d);g8(a,f,{x:0,y:0},{x:0,y:0},{width:Math.min(a.width,b),height:Math.min(a.height,c)},d),a.width=b,a.height=c,a.data=f.data}function g8(a,b,c,d,f,g){if(0===f.width||0===f.height)return b;if(f.width>a.width||f.height>a.height||c.x>a.width-f.width||c.y>a.height-f.height)throw RangeError("out of range source coordinates for image copy");if(f.width>b.width||f.height>b.height||d.x>b.width-f.width||d.y>b.height-f.height)throw RangeError("out of range destination coordinates for image copy");const h=a.data,i=b.data;for(let j=0;j{b[a.evaluationKey]=g;const h=a.expression.evaluate(b);f.data[c+d+0]=Math.floor(255*h.r/h.a),f.data[c+d+1]=Math.floor(255*h.g/h.a),f.data[c+d+2]=Math.floor(255*h.b/h.a),f.data[c+d+3]=Math.floor(255*h.a)};if(a.clips)for(let h=0,i=0;h80*c){d=g=a[0],f=h=a[1];for(var p=c;pg&&(g=i),j>h&&(h=j);k=0!==(k=Math.max(g-d,h-f))?1/k:0}return hk(n,o,c,d,f,k),o}function hi(a,b,c,d,f){var g,h;if(f===hG(a,b,c,d)>0)for(g=b;g=b;g-=d)h=hD(g,a[g],a[g+1],h);return h&&hx(h,h.next)&&(hE(h),h=h.next),h}function hj(a,b){if(!a)return a;b||(b=a);var c,d=a;do if(c=!1,d.steiner|| !hx(d,d.next)&&0!==hw(d.prev,d,d.next))d=d.next;else{if(hE(d),(d=b=d.prev)===d.next)break;c=!0}while(c||d!==b)return b}function hk(a,b,c,d,f,g,h){if(a){!h&&g&&function(a,b,c,d){var f=a;do null===f.z&&(f.z=hs(f.x,f.y,b,c,d)),f.prevZ=f.prev,f.nextZ=f.next,f=f.next;while(f!==a)f.prevZ.nextZ=null,f.prevZ=null,function(a){var b,c,d,f,g,h,i,j,k=1;do{for(c=a,a=null,g=null,h=0;c;){for(h++,d=c,i=0,b=0;b0||j>0&&d;)0!==i&&(0===j||!d||c.z<=d.z)?(f=c,c=c.nextZ,i--):(f=d,d=d.nextZ,j--),g?g.nextZ=f:a=f,f.prevZ=g,g=f;c=d}g.nextZ=null,k*=2}while(h>1)}(f)}(a,d,f,g);for(var i,j,k=a;a.prev!==a.next;)if(i=a.prev,j=a.next,g?hm(a,d,f,g):hl(a))b.push(i.i/c),b.push(a.i/c),b.push(j.i/c),hE(a),a=j.next,k=j.next;else if((a=j)===k){h?1===h?hk(a=hn(hj(a),b,c),b,c,d,f,g,2):2===h&&ho(a,b,c,d,f,g):hk(hj(a),b,c,d,f,g,1);break}}}function hl(a){var b=a.prev,c=a,d=a.next;if(hw(b,c,d)>=0)return!1;for(var f=a.next.next;f!==a.prev;){if(hu(b.x,b.y,c.x,c.y,d.x,d.y,f.x,f.y)&&hw(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function hm(a,b,c,d){var f=a.prev,g=a,h=a.next;if(hw(f,g,h)>=0)return!1;for(var i=f.x>g.x?f.x>h.x?f.x:h.x:g.x>h.x?g.x:h.x,j=f.y>g.y?f.y>h.y?f.y:h.y:g.y>h.y?g.y:h.y,k=hs(f.x=k&&n&&n.z<=l;){if(m!==a.prev&&m!==a.next&&hu(f.x,f.y,g.x,g.y,h.x,h.y,m.x,m.y)&&hw(m.prev,m,m.next)>=0||(m=m.prevZ,n!==a.prev&&n!==a.next&&hu(f.x,f.y,g.x,g.y,h.x,h.y,n.x,n.y)&&hw(n.prev,n,n.next)>=0))return!1;n=n.nextZ}for(;m&&m.z>=k;){if(m!==a.prev&&m!==a.next&&hu(f.x,f.y,g.x,g.y,h.x,h.y,m.x,m.y)&&hw(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;n&&n.z<=l;){if(n!==a.prev&&n!==a.next&&hu(f.x,f.y,g.x,g.y,h.x,h.y,n.x,n.y)&&hw(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}function hn(a,b,c){var d=a;do{var f=d.prev,g=d.next.next;!hx(f,g)&&hy(f,d,d.next,g)&&hB(f,g)&&hB(g,f)&&(b.push(f.i/c),b.push(d.i/c),b.push(g.i/c),hE(d),hE(d.next),d=a=g),d=d.next}while(d!==a)return hj(d)}function ho(a,b,c,d,f,g){var h=a;do{for(var i=h.next.next;i!==h.prev;){if(h.i!==i.i&&hv(h,i)){var j=hC(h,i);return h=hj(h,h.next),j=hj(j,j.next),hk(h,b,c,d,f,g),void hk(j,b,c,d,f,g)}i=i.next}h=h.next}while(h!==a)}function hp(a,b){return a.x-b.x}function hq(a,b){var c=function(a,b){var c,d=b,f=a.x,g=a.y,h=-1/0;do{if(g<=d.y&&g>=d.next.y&&d.next.y!==d.y){var i=d.x+(g-d.y)*(d.next.x-d.x)/(d.next.y-d.y);if(i<=f&&i>h){if(h=i,i===f){if(g===d.y)return d;if(g===d.next.y)return d.next}c=d.x=d.x&&d.x>=l&&f!==d.x&&hu(gc.x||d.x===c.x&&hr(c,d)))&&(c=d,n=j)),d=d.next;while(d!==k)return c}(a,b);if(!c)return b;var d=hC(c,a),f=hj(c,c.next);return hj(d,d.next),b===c?f:b}function hr(a,b){return 0>hw(a.prev,a,b.prev)&&0>hw(b.next,a,a.next)}function hs(a,b,c,d,f){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=32767*(a-c)*f)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-d)*f)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function ht(a){var b=a,c=a;do(b.x=0&&(a-h)*(d-i)-(c-h)*(b-i)>=0&&(c-h)*(g-i)-(f-h)*(d-i)>=0}function hv(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var c=a;do{if(c.i!==a.i&&c.next.i!==a.i&&c.i!==b.i&&c.next.i!==b.i&&hy(c,c.next,a,b))return!0;c=c.next}while(c!==a)return!1}(a,b)&&(hB(a,b)&&hB(b,a)&&function(a,b){var c=a,d=!1,f=(a.x+b.x)/2,g=(a.y+b.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&f<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==a)return d}(a,b)&&(hw(a.prev,a,b.prev)||hw(a,b.prev,b))||hx(a,b)&&hw(a.prev,a,a.next)>0&&hw(b.prev,b,b.next)>0)}function hw(a,b,c){return(b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y)}function hx(a,b){return a.x===b.x&&a.y===b.y}function hy(a,b,c,d){var f=hA(hw(a,b,c)),g=hA(hw(a,b,d)),h=hA(hw(c,d,a)),i=hA(hw(c,d,b));return f!==g&&h!==i||!(0!==f||!hz(a,c,b))||!(0!==g||!hz(a,d,b))||!(0!==h||!hz(c,a,d))||!(0!==i||!hz(c,b,d))}function hz(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function hA(a){return a>0?1:a<0?-1:0}function hB(a,b){return 0>hw(a.prev,a,a.next)?hw(a,b,a.next)>=0&&hw(a,a.prev,b)>=0:0>hw(a,b,a.prev)||0>hw(a,a.next,b)}function hC(a,b){var c=new hF(a.i,a.x,a.y),d=new hF(b.i,b.x,b.y),f=a.next,g=b.prev;return a.next=b,b.prev=a,c.next=f,f.prev=c,d.next=c,c.prev=d,g.next=d,d.prev=g,d}function hD(a,b,c,d){var f=new hF(a,b,c);return d?(f.next=d.next,f.prev=d,d.next.prev=f,d.next=f):(f.prev=f,f.next=f),f}function hE(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function hF(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hG(a,b,c,d){for(var f=0,g=b,h=c-d;gc;){if(d-c>600){var g=d-c+1,h=b-c+1,i=Math.log(g),j=.5*Math.exp(2*i/3),k=.5*Math.sqrt(i*j*(g-j)/g)*(h-g/2<0?-1:1);hI(a,b,Math.max(c,Math.floor(b-h*j/g+k)),Math.min(d,Math.floor(b+(g-h)*j/g+k)),f)}var l=a[b],m=c,n=d;for(hJ(a,c,b),f(a[d],l)>0&&hJ(a,c,d);mf(a[m],l);)m++;for(;f(a[n],l)>0;)n--}0===f(a[c],l)?hJ(a,c,n):hJ(a,++n,d),n<=b&&(c=n+1),b<=n&&(d=n-1)}}function hJ(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function hK(a,b){return ab?1:0}function hL(a,b){const c=a.length;if(c<=1)return[a];const d=[];let f,g;for(let h=0;h1)for(let j=0;j0&&c.holes.push(d+=a[f-1].length)}return c},hg.default=hh;class hP{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new fm,this.indexArray=new fy,this.indexArray2=new fF,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.segments2=new gq,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){this.hasPattern=hN("fill",this.layers,b);const f=this.layers[0].layout.get("fill-sort-key"),g=[];for(const{feature:h,id:i,index:j,sourceLayerIndex:k}of a){const l=this.layers[0]._featureFilter.needGeometry,m=gG(h,l);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),m,c))continue;const n=f?f.evaluate(m,{},c,b.availableImages):void 0,o={id:i,properties:h.properties,type:h.type,sourceLayerIndex:k,index:j,geometry:l?m.geometry:gF(h,c,d),patterns:{},sortKey:n};g.push(o)}for(const p of(f&&g.sort((a,b)=>a.sortKey-b.sortKey),g)){const{geometry:q,index:r,sourceLayerIndex:s}=p;if(this.hasPattern){const u=hO("fill",this.layers,p,this.zoom,b);this.patternFeatures.push(u)}else this.addFeature(p,q,r,c,{},b.availableImages);b.featureIndex.insert(a[r].feature,q,r,s,this.index)}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(a,b,c,d){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,hf),this.indexBuffer=a.createIndexBuffer(this.indexArray),this.indexBuffer2=a.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(a),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(a,b,c,d,f,g=[]){for(const h of hL(b,500)){let i=0;for(const j of h)i+=j.length;const k=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),l=k.vertexLength,m=[],n=[];for(const o of h){if(0===o.length)continue;o!==h[0]&&n.push(m.length/2);const p=this.segments2.prepareSegment(o.length,this.layoutVertexArray,this.indexArray2),q=p.vertexLength;this.layoutVertexArray.emplaceBack(o[0].x,o[0].y),this.indexArray2.emplaceBack(q+o.length-1,q),m.push(o[0].x),m.push(o[0].y);for(let r=1;r>3}if(f--,1===d||2===d)h+=a.readSVarint(),i+=a.readSVarint(),1===d&&(b&&j.push(b),b=[]),b.push(new g(h,i));else{if(7!==d)throw Error("unknown command "+d);b&&b.push(b[0].clone())}}return b&&j.push(b),j},hW.prototype.bbox=function(){var a=this._pbf;a.pos=this._geometry;for(var b=a.readVarint()+a.pos,c=1,d=0,f=0,g=0,h=1/0,i=-1/0,j=1/0,k=-1/0;a.pos>3}if(d--,1===c||2===c)(f+=a.readSVarint())i&&(i=f),(g+=a.readSVarint())k&&(k=g);else if(7!==c)throw Error("unknown command "+c)}return[h,j,i,k]},hW.prototype.toGeoJSON=function(a,b,c){var d,f,g=this.extent*Math.pow(2,c),h=this.extent*a,i=this.extent*b,j=this.loadGeometry(),k=hW.types[this.type];function l(a){for(var b=0;b>3;b=1===d?a.readString():2===d?a.readFloat():3===d?a.readDouble():4===d?a.readVarint64():5===d?a.readVarint():6===d?a.readSVarint():7===d?a.readBoolean():null}return b}(c))}function h0(a,b,c){if(3===a){var d=new hZ(c,c.readVarint()+c.pos);d.length&&(b[d.name]=d)}}h$.prototype.feature=function(a){if(a<0||a>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[a];var b=this._pbf.readVarint()+this._pbf.pos;return new hV(this._pbf,b,this.extent,this._keys,this._values)};var h1={VectorTile:function(a,b){this.layers=a.readFields(h0,{},b)},VectorTileFeature:hV,VectorTileLayer:hZ};const h2=h1.VectorTileFeature.types;function h3(a,b,c,d,f,g,h,i){a.emplaceBack((b<<1)+h,(c<<1)+g,(Math.floor(8192*d)<<1)+f,Math.round(i))}class h4{constructor(){this.acc=new g(0,0),this.polyCount=[]}startRing(a){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new g(a.x,a.y),this.max=new g(a.x,a.y))}append(a,b){this.currentPolyCount.edges++,this.acc._add(a);let c=!!this.borders;const d=this.min,f=this.max;a.xf.x&&(f.x=a.x,c=!0),a.yf.y&&(f.y=a.y,c=!0),((0===a.x||8192===a.x)&&a.x===b.x)!=((0===a.y||8192===a.y)&&a.y===b.y)&&this.processBorderOverlap(a,b),c&&this.checkBorderIntersection(a,b)}checkBorderIntersection(a,b){b.x<0!=a.x<0&&this.addBorderIntersection(0,cr(b.y,a.y,(0-b.x)/(a.x-b.x))),b.x>8192!=a.x>8192&&this.addBorderIntersection(1,cr(b.y,a.y,(8192-b.x)/(a.x-b.x))),b.y<0!=a.y<0&&this.addBorderIntersection(2,cr(b.x,a.x,(0-b.y)/(a.y-b.y))),b.y>8192!=a.y>8192&&this.addBorderIntersection(3,cr(b.x,a.x,(8192-b.y)/(a.y-b.y)))}addBorderIntersection(a,b){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 c=this.borders[a];bc[1]&&(c[1]=b)}processBorderOverlap(a,b){if(a.x===b.x){if(a.y===b.y)return;const c=0===a.x?0:1;this.addBorderIntersection(c,b.y),this.addBorderIntersection(c,a.y)}else{const d=0===a.y?2:3;this.addBorderIntersection(d,b.x),this.addBorderIntersection(d,a.x)}}centroid(){const a=this.polyCount.reduce((a,b)=>a+b.edges,0);return 0!==a?this.acc.div(a)._round():new g(0,0)}span(){return new g(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((a,b)=>a+ +(b[0]!==Number.MAX_VALUE),0)}}class h5{constructor(a){this.zoom=a.zoom,this.overscaling=a.overscaling,this.layers=a.layers,this.layerIds=this.layers.map(a=>a.id),this.index=a.index,this.hasPattern=!1,this.layoutVertexArray=new fn,this.centroidVertexArray=new fU,this.indexArray=new fy,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.enableTerrain=a.enableTerrain}populate(a,b,c,d){for(const{feature:f,id:g,index:h,sourceLayerIndex:i}of(this.features=[],this.hasPattern=hN("fill-extrusion",this.layers,b),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(a){const b=Math.exp(Math.PI*(1-a.y/(1<a.x<=0)||h.every(a=>a.x>=8192)||h.every(a=>a.y<=0)||h.every(a=>a.y>=8192))continue;for(let m=0;m=1){const r=n[p-1];if(!h6(q,r)){i&&i.append(q,r),l.vertexLength+4>gq.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const s=q.sub(r)._perp(),u=s.x/(Math.abs(s.x)+Math.abs(s.y)),v=s.y>0?1:0,w=r.dist(q);o+w>32768&&(o=0),h3(this.layoutVertexArray,q.x,q.y,u,v,0,0,o),h3(this.layoutVertexArray,q.x,q.y,u,v,0,1,o),o+=w,h3(this.layoutVertexArray,r.x,r.y,u,v,0,0,o),h3(this.layoutVertexArray,r.x,r.y,u,v,0,1,o);const x=l.vertexLength;this.indexArray.emplaceBack(x,x+2,x+1),this.indexArray.emplaceBack(x+1,x+2,x+3),l.vertexLength+=4,l.primitiveLength+=2}}}}if(l.vertexLength+k>gq.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),"Polygon"!==h2[a.type])continue;const y=[],z=[],A=l.vertexLength;for(let B=0;B0){if(i.borders){i.vertexArrayOffset=this.centroidVertexArray.length;const H=i.borders,I=this.featuresOnBorder.push(i)-1;for(let J=0;J<4;J++)H[J][0]!==Number.MAX_VALUE&&this.borders[J].push(I)}this.encodeCentroid(i.borders?void 0:i.centroid(),i)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,f,g,d)}sortBorders(){for(let a=0;a<4;a++)this.borders[a].sort((b,c)=>this.featuresOnBorder[b].borders[a][0]-this.featuresOnBorder[c].borders[a][0])}encodeCentroid(a,b,c=!0){let d,f;if(a){if(0!==a.y){const g=b.span()._mult(this.tileToMeter);d=(Math.max(a.x,1)<<3)+Math.min(7,Math.round(g.x/10)),f=(Math.max(a.y,1)<<3)+Math.min(7,Math.round(g.y/10))}else d=Math.ceil(7*(a.x+450)),f=0}else d=0,f=+c;let h=c?this.centroidVertexArray.length:b.vertexArrayOffset;for(const i of b.polyCount){c&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*i.edges+i.top);for(let j=0;j<2*i.edges;j++)this.centroidVertexArray.emplace(h++,0,f),this.centroidVertexArray.emplace(h++,d,f);for(let k=0;k8192)||a.y===b.y&&(a.y<0||a.y>8192)}ec("FillExtrusionBucket",h5,{omit:["layers","features"]}),ec("PartMetadata",h4);var h7={paint:new ff({"fill-extrusion-opacity":new fa(bk["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new fb(bk["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new fa(bk["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new fa(bk["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new fc(bk["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new fb(bk["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new fb(bk["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new fa(bk["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function h8(a,b){return a.x*b.x+a.y*b.y}function h9(a,b){if(1===a.length){let c=0;const d=b[c++];let f;for(;!f||d.equals(f);)if(!(f=b[c++]))return 1/0;for(;ca.id),this.index=a.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new fo,this.layoutVertexArray2=new fp,this.indexArray=new fy,this.programConfigurations=new gg(a.layers,a.zoom),this.segments=new gq,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(a,b,c,d){this.hasPattern=hN("line",this.layers,b);const f=this.layers[0].layout.get("line-sort-key"),g=[];for(const{feature:h,id:i,index:j,sourceLayerIndex:k}of a){const l=this.layers[0]._featureFilter.needGeometry,m=gG(h,l);if(!this.layers[0]._featureFilter.filter(new e2(this.zoom),m,c))continue;const n=f?f.evaluate(m,{},c):void 0,o={id:i,properties:h.properties,type:h.type,sourceLayerIndex:k,index:j,geometry:l?m.geometry:gF(h,c,d),patterns:{},sortKey:n};g.push(o)}f&&g.sort((a,b)=>a.sortKey-b.sortKey);const{lineAtlas:p,featureIndex:q}=b,r=this.addConstantDashes(p);for(const s of g){const{geometry:u,index:v,sourceLayerIndex:w}=s;if(r&&this.addFeatureDashes(s,p),this.hasPattern){const x=hO("line",this.layers,s,this.zoom,b);this.patternFeatures.push(x)}else this.addFeature(s,u,v,c,p.positions,b.availableImages);q.insert(a[v].feature,u,v,w,this.index)}}addConstantDashes(a){let b=!1;for(const c of this.layers){const d=c.paint.get("line-dasharray").value,f=c.layout.get("line-cap").value;if("constant"!==d.kind||"constant"!==f.kind)b=!0;else{const g=f.value,h=d.value;if(!h)continue;a.addDash(h.from,g),a.addDash(h.to,g),h.other&&a.addDash(h.other,g)}}return b}addFeatureDashes(a,b){const c=this.zoom;for(const d of this.layers){const f=d.paint.get("line-dasharray").value,g=d.layout.get("line-cap").value;if("constant"===f.kind&&"constant"===g.kind)continue;let h,i,j,k,l,m;if("constant"===f.kind){const n=f.value;if(!n)continue;h=n.other||n.to,i=n.to,j=n.from}else h=f.evaluate({zoom:c-1},a),i=f.evaluate({zoom:c},a),j=f.evaluate({zoom:c+1},a);"constant"===g.kind?k=l=m=g.value:(k=g.evaluate({zoom:c-1},a),l=g.evaluate({zoom:c},a),m=g.evaluate({zoom:c+1},a)),b.addDash(h,k),b.addDash(i,l),b.addDash(j,m);const o=b.getKey(h,k),p=b.getKey(i,l),q=b.getKey(j,m);a.patterns[d.id]={min:o,mid:p,max:q}}}update(a,b,c,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(a,b,this.stateDependentLayers,c,d)}addFeatures(a,b,c,d){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,b,c,d)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(a){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=a.createVertexBuffer(this.layoutVertexArray2,ig)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,id),this.indexBuffer=a.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(a),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(a){if(a.properties&&a.properties.hasOwnProperty("mapbox_clip_start")&&a.properties.hasOwnProperty("mapbox_clip_end"))return{start:+a.properties.mapbox_clip_start,end:+a.properties.mapbox_clip_end}}addFeature(a,b,c,d,f,g){const h=this.layers[0].layout,i=h.get("line-join").evaluate(a,{}),j=h.get("line-cap").evaluate(a,{}),k=h.get("line-miter-limit"),l=h.get("line-round-limit");for(const m of(this.lineClips=this.lineFeatureClips(a),b))this.addLine(m,a,i,j,k,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,a,c,f,g,d)}addLine(a,b,c,d,f,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let h=0;h=2&&a[j-1].equals(a[j-2]);)j--;let k=0;for(;k0;if(z&&s>k){const B=n.dist(o);if(B>2*l){const C=n.sub(n.sub(o)._mult(l/B)._round());this.updateDistance(o,C),this.addCurrentVertex(C,q,0,0,m),o=C}}const D=o&&p;let E=D?c:i?"butt":d;if(D&&"round"===E&&(xf&&(E="bevel"),"bevel"===E&&(x>2&&(E="flipbevel"),x100)u=r.mult(-1);else{const F=x*q.add(r).mag()/q.sub(r).mag();u._perp()._mult(F*(A?-1:1))}this.addCurrentVertex(n,u,0,0,m),this.addCurrentVertex(n,u.mult(-1),0,0,m)}else if("bevel"===E||"fakeround"===E){const G=-Math.sqrt(x*x-1),H=A?G:0,I=A?0:G;if(o&&this.addCurrentVertex(n,q,H,I,m),"fakeround"===E){const J=Math.round(180*y/Math.PI/20);for(let K=1;K2*l){const Q=n.add(p.sub(n)._mult(l/P)._round());this.updateDistance(n,Q),this.addCurrentVertex(Q,r,0,0,m),n=Q}}}}addCurrentVertex(a,b,c,d,f,g=!1){const h=b.y*d-b.x,i=-b.y-b.x*d;this.addHalfVertex(a,b.x+b.y*c,b.y-b.x*c,g,!1,c,f),this.addHalfVertex(a,h,i,g,!0,-d,f)}addHalfVertex({x:a,y:b},c,d,f,g,h,i){this.layoutVertexArray.emplaceBack((a<<1)+(f?1:0),(b<<1)+(g?1:0),Math.round(63*c)+128,Math.round(63*d)+128,1+(0===h?0:h<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const j=i.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,j),i.primitiveLength++),g?this.e2=j:this.e1=j}updateScaledDistance(){if(this.lineClips){const a=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=a*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(a,b){this.distance+=a.dist(b),this.updateScaledDistance()}}ec("LineBucket",ij,{omit:["layers","patternFeatures"]});const ik=new ff({"line-cap":new fb(bk.layout_line["line-cap"]),"line-join":new fb(bk.layout_line["line-join"]),"line-miter-limit":new fa(bk.layout_line["line-miter-limit"]),"line-round-limit":new fa(bk.layout_line["line-round-limit"]),"line-sort-key":new fb(bk.layout_line["line-sort-key"])});var il={paint:new ff({"line-opacity":new fb(bk.paint_line["line-opacity"]),"line-color":new fb(bk.paint_line["line-color"]),"line-translate":new fa(bk.paint_line["line-translate"]),"line-translate-anchor":new fa(bk.paint_line["line-translate-anchor"]),"line-width":new fb(bk.paint_line["line-width"]),"line-gap-width":new fb(bk.paint_line["line-gap-width"]),"line-offset":new fb(bk.paint_line["line-offset"]),"line-blur":new fb(bk.paint_line["line-blur"]),"line-dasharray":new fc(bk.paint_line["line-dasharray"]),"line-pattern":new fc(bk.paint_line["line-pattern"]),"line-gradient":new fe(bk.paint_line["line-gradient"])}),layout:ik};const im=new class extends fb{possiblyEvaluate(a,b){return b=new e2(Math.floor(b.zoom),{now:b.now,fadeDuration:b.fadeDuration,zoomHistory:b.zoomHistory,transition:b.transition}),super.possiblyEvaluate(a,b)}evaluate(a,b,c,d){return b=aa({},b,{zoom:Math.floor(b.zoom)}),super.evaluate(a,b,c,d)}}(il.paint.properties["line-width"].specification);im.useIntegerZoom=!0;const io=fk([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_z_tile_anchor",components:4,type:"Int16"},],4),ip=fk([{name:"a_projected_pos",components:3,type:"Float32"},],4);fk([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const iq=fk([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),ir=fk([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);fk([{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 is=fk([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),it=fk([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function iu(a,b){const{expression:c}=b;if("constant"===c.kind)return{kind:"constant",layoutSize:c.evaluate(new e2(a+1))};if("source"===c.kind)return{kind:"source"};{const{zoomStops:d,interpolationType:f}=c;let g=0;for(;g{a.text=function(a,b,c){const d=b.layout.get("text-transform").evaluate(c,{});return"uppercase"===d?a=a.toLocaleUpperCase():"lowercase"===d&&(a=a.toLocaleLowerCase()),e1.applyArabicShaping&&(a=e1.applyArabicShaping(a)),a}(a.text,b,c)}),a}const iz={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function iA(a){return"︶"===a||"﹈"===a||"︸"===a||"﹄"===a||"﹂"===a||"︾"===a||"︼"===a||"︺"===a||"︘"===a||"﹀"===a||"︐"===a||"︓"===a||"︔"===a||"`"===a||" ̄"===a||"︑"===a||"︒"===a}function iB(a){return"︵"===a||"﹇"===a||"︷"===a||"﹃"===a||"﹁"===a||"︽"===a||"︻"===a||"︹"===a||"︗"===a||"︿"===a}var iC=function(a,b,c,d,f){var g,h,i=8*f-d-1,j=(1<>1,l=-7,m=c?f-1:0,n=c?-1:1,o=a[b+m];for(m+=n,g=o&(1<< -l)-1,o>>=-l,l+=i;l>0;g=256*g+a[b+m],m+=n,l-=8);for(h=g&(1<< -l)-1,g>>=-l,l+=d;l>0;h=256*h+a[b+m],m+=n,l-=8);if(0===g)g=1-k;else{if(g===j)return h?NaN:1/0*(o?-1:1);h+=Math.pow(2,d),g-=k}return(o?-1:1)*h*Math.pow(2,g-d)},iD=function(a,b,c,d,f,g){var h,i,j,k=8*g-f-1,l=(1<>1,n=23===f?5960464477539062e-23:0,o=d?0:g-1,p=d?1:-1,q=b<0||0===b&&1/b<0?1:0;for(isNaN(b=Math.abs(b))||b===1/0?(i=isNaN(b)?1:0,h=l):(h=Math.floor(Math.log(b)/Math.LN2),b*(j=Math.pow(2,-h))<1&&(h--,j*=2),(b+=h+m>=1?n/j:n*Math.pow(2,1-m))*j>=2&&(h++,j/=2),h+m>=l?(i=0,h=l):h+m>=1?(i=(b*j-1)*Math.pow(2,f),h+=m):(i=b*Math.pow(2,m-1)*Math.pow(2,f),h=0));f>=8;a[c+o]=255&i,o+=p,i/=256,f-=8);for(h=h<0;a[c+o]=255&h,o+=p,h/=256,k-=8);a[c+o-p]|=128*q},iE=iF;function iF(a){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(a)?a:new Uint8Array(a||0),this.pos=0,this.type=0,this.length=this.buf.length}iF.Varint=0,iF.Fixed64=1,iF.Bytes=2,iF.Fixed32=5;var iG="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function iH(a){return a.type===iF.Bytes?a.readVarint()+a.pos:a.pos+1}function iI(a,b,c){var d=b<=16383?1:b<=2097151?2:b<=268435455?3:Math.floor(Math.log(b)/(7*Math.LN2));c.realloc(d);for(var f=c.pos-1;f>=a;f--)c.buf[f+d]=c.buf[f]}function iJ(a,b){for(var c=0;c>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function iU(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function iV(a,b,c){b.glyphs=[],1===a&&c.readMessage(iW,b)}function iW(a,b,c){if(3===a){const{id:d,bitmap:f,width:g,height:h,left:i,top:j,advance:k}=c.readMessage(iX,{});b.glyphs.push({id:d,bitmap:new g9({width:g+6,height:h+6},f),metrics:{width:g,height:h,left:i,top:j,advance:k}})}else 4===a?b.ascender=c.readSVarint():5===a&&(b.descender=c.readSVarint())}function iX(a,b,c){1===a?b.id=c.readVarint():2===a?b.bitmap=c.readBytes():3===a?b.width=c.readVarint():4===a?b.height=c.readVarint():5===a?b.left=c.readSVarint():6===a?b.top=c.readSVarint():7===a&&(b.advance=c.readVarint())}function iY(a){let b=0,c=0;for(const d of a)b+=d.w*d.h,c=Math.max(c,d.w);a.sort((a,b)=>b.h-a.h);const f=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(b/.95)),c),h:1/0},];let g=0,h=0;for(const i of a)for(let j=f.length-1;j>=0;j--){const k=f[j];if(!(i.w>k.w||i.h>k.h)){if(i.x=k.x,i.y=k.y,h=Math.max(h,i.y+i.h),g=Math.max(g,i.x+i.w),i.w===k.w&&i.h===k.h){const l=f.pop();j>3,g=this.pos;this.type=7&d,a(f,b,this),this.pos===g&&this.skip(d)}return b},readMessage:function(a,b){return this.readFields(a,b,this.readVarint()+this.pos)},readFixed32:function(){var a=iS(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=iU(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=iS(this.buf,this.pos)+4294967296*iS(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=iS(this.buf,this.pos)+4294967296*iU(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=iC(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=iC(this.buf,this.pos,!0,52,8);return this.pos+=8,a},readVarint:function(a){var b,c,d=this.buf;return b=127&(c=d[this.pos++]),c<128?b:(b|=(127&(c=d[this.pos++]))<<7,c<128?b:(b|=(127&(c=d[this.pos++]))<<14,c<128?b:(b|=(127&(c=d[this.pos++]))<<21,c<128?b:function(a,b,c){var d,f,g,h,i=c.buf;if(g=(112&(h=i[c.pos++]))>>4,h<128||(g|=(127&(h=i[c.pos++]))<<3,h<128)||(g|=(127&(h=i[c.pos++]))<<10,h<128)||(g|=(127&(h=i[c.pos++]))<<17,h<128)||(g|=(127&(h=i[c.pos++]))<<24,h<128)||(g|=(1&(h=i[c.pos++]))<<31,h<128))return d=a,f=g,b?4294967296*f+(d>>>0):4294967296*(f>>>0)+(d>>>0);throw Error("Expected varint not more than 10 bytes")}(b|=(15&(c=d[this.pos]))<<28,a,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var a=this.readVarint();return a%2==1?-((a+1)/2):a/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var a,b,c,d=this.readVarint()+this.pos,f=this.pos;return this.pos=d,d-f>=12&&iG?(a=this.buf,b=f,c=d,iG.decode(a.subarray(b,c))):function(a,b,c){for(var d="",f=b;f239?4:j>223?3:j>191?2:1;if(f+l>c)break;1===l?j<128&&(k=j):2===l?128==(192&(g=a[f+1]))&&(k=(31&j)<<6|63&g)<=127&&(k=null):3===l?(h=a[f+2],128==(192&(g=a[f+1]))&&128==(192&h)&&((k=(15&j)<<12|(63&g)<<6|63&h)<=2047||k>=55296&&k<=57343)&&(k=null)):4===l&&(h=a[f+2],i=a[f+3],128==(192&(g=a[f+1]))&&128==(192&h)&&128==(192&i)&&((k=(15&j)<<18|(63&g)<<12|(63&h)<<6|63&i)<=65535||k>=1114112)&&(k=null)),null===k?(k=65533,l=1):k>65535&&(k-=65536,d+=String.fromCharCode(k>>>10&1023|55296),k=56320|1023&k),d+=String.fromCharCode(k),f+=l}return d}(this.buf,f,d)},readBytes:function(){var a=this.readVarint()+this.pos,b=this.buf.subarray(this.pos,a);return this.pos=a,b},readPackedVarint:function(a,b){if(this.type!==iF.Bytes)return a.push(this.readVarint(b));var c=iH(this);for(a=a||[];this.pos127;);else if(b===iF.Bytes)this.pos=this.readVarint()+this.pos;else if(b===iF.Fixed32)this.pos+=4;else{if(b!==iF.Fixed64)throw Error("Unimplemented type: "+b);this.pos+=8}},writeTag:function(a,b){this.writeVarint(a<<3|b)},realloc:function(a){for(var b=this.length||16;b268435455||a<0?function(a,b){var c,d,f,g,h,i,j;if(a>=0?(c=a%4294967296|0,d=a/4294967296|0):(d=~(-a/4294967296),4294967295^(c=~(-a%4294967296))?c=c+1|0:(c=0,d=d+1|0)),a>=18446744073709552e3||a< -18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");b.realloc(10),f=c,(g=b).buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,f>>>=7,g.buf[g.pos++]=127&f|128,g.buf[g.pos]=127&(f>>>=7),h=d,i=b,j=(7&h)<<4,i.buf[i.pos++]|=j|((h>>>=3)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h|((h>>>=7)?128:0),h&&(i.buf[i.pos++]=127&h)))))}(a,this):(this.realloc(4),this.buf[this.pos++]=127&a|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=127&(a>>>=7)|(a>127?128:0),a<=127||(this.buf[this.pos++]=a>>>7&127))))},writeSVarint:function(a){this.writeVarint(a<0?-(2*a)-1:2*a)},writeBoolean:function(a){this.writeVarint(Boolean(a))},writeString:function(a){a=String(a),this.realloc(4*a.length),this.pos++;var b=this.pos;this.pos=function(a,b,c){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===b.length?(a[c++]=239,a[c++]=191,a[c++]=189):f=d;continue}if(d<56320){a[c++]=239,a[c++]=191,a[c++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(a[c++]=239,a[c++]=191,a[c++]=189,f=null);d<128?a[c++]=d:(d<2048?a[c++]=d>>6|192:(d<65536?a[c++]=d>>12|224:(a[c++]=d>>18|240,a[c++]=d>>12&63|128),a[c++]=d>>6&63|128),a[c++]=63&d|128)}return c}(this.buf,a,this.pos);var c=this.pos-b;c>=128&&iI(b,c,this),this.pos=b-1,this.writeVarint(c),this.pos+=c},writeFloat:function(a){this.realloc(4),iD(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),iD(this.buf,a,this.pos,!0,52,8),this.pos+=8},writeBytes:function(a){var b=a.length;this.writeVarint(b),this.realloc(b);for(var c=0;c=128&&iI(c,d,this),this.pos=c-1,this.writeVarint(d),this.pos+=d},writeMessage:function(a,b,c){this.writeTag(a,iF.Bytes),this.writeRawMessage(b,c)},writePackedVarint:function(a,b){b.length&&this.writeMessage(a,iJ,b)},writePackedSVarint:function(a,b){b.length&&this.writeMessage(a,iK,b)},writePackedBoolean:function(a,b){b.length&&this.writeMessage(a,iN,b)},writePackedFloat:function(a,b){b.length&&this.writeMessage(a,iL,b)},writePackedDouble:function(a,b){b.length&&this.writeMessage(a,iM,b)},writePackedFixed32:function(a,b){b.length&&this.writeMessage(a,iO,b)},writePackedSFixed32:function(a,b){b.length&&this.writeMessage(a,iP,b)},writePackedFixed64:function(a,b){b.length&&this.writeMessage(a,iQ,b)},writePackedSFixed64:function(a,b){b.length&&this.writeMessage(a,iR,b)},writeBytesField:function(a,b){this.writeTag(a,iF.Bytes),this.writeBytes(b)},writeFixed32Field:function(a,b){this.writeTag(a,iF.Fixed32),this.writeFixed32(b)},writeSFixed32Field:function(a,b){this.writeTag(a,iF.Fixed32),this.writeSFixed32(b)},writeFixed64Field:function(a,b){this.writeTag(a,iF.Fixed64),this.writeFixed64(b)},writeSFixed64Field:function(a,b){this.writeTag(a,iF.Fixed64),this.writeSFixed64(b)},writeVarintField:function(a,b){this.writeTag(a,iF.Varint),this.writeVarint(b)},writeSVarintField:function(a,b){this.writeTag(a,iF.Varint),this.writeSVarint(b)},writeStringField:function(a,b){this.writeTag(a,iF.Bytes),this.writeString(b)},writeFloatField:function(a,b){this.writeTag(a,iF.Fixed32),this.writeFloat(b)},writeDoubleField:function(a,b){this.writeTag(a,iF.Fixed64),this.writeDouble(b)},writeBooleanField:function(a,b){this.writeVarintField(a,Boolean(b))}};class iZ{constructor(a,{pixelRatio:b,version:c,stretchX:d,stretchY:f,content:g}){this.paddedRect=a,this.pixelRatio=b,this.stretchX=d,this.stretchY=f,this.content=g,this.version=c}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 i${constructor(a,b){const c={},d={};this.haveRenderCallbacks=[];const f=[];this.addImages(a,c,f),this.addImages(b,d,f);const{w:g,h:h}=iY(f),i=new ha({width:g||1,height:h||1});for(const j in a){const k=a[j],l=c[j].paddedRect;ha.copy(k.data,i,{x:0,y:0},{x:l.x+1,y:l.y+1},k.data)}for(const m in b){const n=b[m],o=d[m].paddedRect,p=o.x+1,q=o.y+1,r=n.data.width,s=n.data.height;ha.copy(n.data,i,{x:0,y:0},{x:p,y:q},n.data),ha.copy(n.data,i,{x:0,y:s-1},{x:p,y:q-1},{width:r,height:1}),ha.copy(n.data,i,{x:0,y:0},{x:p,y:q+s},{width:r,height:1}),ha.copy(n.data,i,{x:r-1,y:0},{x:p-1,y:q},{width:1,height:s}),ha.copy(n.data,i,{x:0,y:0},{x:p+r,y:q},{width:1,height:s})}this.image=i,this.iconPositions=c,this.patternPositions=d}addImages(a,b,c){for(const d in a){const f=a[d],g={x:0,y:0,w:f.data.width+2,h:f.data.height+2};c.push(g),b[d]=new iZ(g,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(d)}}patchUpdatedImages(a,b){for(const c in a.dispatchRenderCallbacks(this.haveRenderCallbacks),a.updatedImages)this.patchUpdatedImage(this.iconPositions[c],a.getImage(c),b),this.patchUpdatedImage(this.patternPositions[c],a.getImage(c),b)}patchUpdatedImage(a,b,c){if(!a||!b||a.version===b.version)return;a.version=b.version;const[d,f]=a.tl;c.update(b.data,void 0,{x:d,y:f})}}ec("ImagePosition",iZ),ec("ImageAtlas",i$);const i_={horizontal:1,vertical:2,horizontalOnly:3};class i0{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(a,b){const c=new i0;return c.scale=a||1,c.fontStack=b,c}static forImage(a){const b=new i0;return b.imageName=a,b}}class i1{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(a,b){const c=new i1;for(let d=0;d=0&&d>=a&&i3[this.text.charCodeAt(d)];d--)c--;this.text=this.text.substring(a,c),this.sectionIndex=this.sectionIndex.slice(a,c)}substring(a,b){const c=new i1;return c.text=this.text.substring(a,b),c.sectionIndex=this.sectionIndex.slice(a,b),c.sections=this.sections,c}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((a,b)=>Math.max(a,this.sections[b].scale),0)}addTextSection(a,b){this.text+=a.text,this.sections.push(i0.forText(a.scale,a.fontStack||b));const c=this.sections.length-1;for(let d=0;d=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function i2(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q){const r=i1.fromFeature(a,f);let s;m===i_.vertical&&r.verticalizePunctuation(n);const{processBidirectionalText:u,processStyledBidirectionalText:v}=e1;if(u&&1===r.sections.length){s=[];const w=u(r.toString(),ja(r,k,g,b,d,o,p));for(const x of w){const y=new i1;y.text=x,y.sections=r.sections;for(let z=0;z0&&U>E&&(E=U)}else{const V=c[I.fontStack];if(!V)continue;V[K]&&(N=V[K]);const W=b[I.fontStack];if(!W)continue;const X=W.glyphs[K];if(!X)continue;if(M=X.metrics,P=8203!==K?24:0,s){const Y=void 0!==W.ascender?Math.abs(W.ascender):0,Z=void 0!==W.descender?Math.abs(W.descender):0,$=(Y+Z)*L;F<$&&(F=$,G=(Y-Z)/2*L),Q=-Y*L}else Q=(A-L)*24-17}R?(a.verticalizable=!0,D.push({glyph:K,imageName:O,x:o,y:p+Q,vertical:R,scale:L,localGlyph:M.localGlyph,fontStack:I.fontStack,sectionIndex:J,metrics:M,rect:N}),o+=P*L+k):(D.push({glyph:K,imageName:O,x:o,y:p+Q,vertical:R,scale:L,localGlyph:M.localGlyph,fontStack:I.fontStack,sectionIndex:J,metrics:M,rect:N}),o+=M.advance*L+k)}0!==D.length&&(q=Math.max(o-k,q),s?jc(D,r,E,G,g*A/2):jc(D,r,E,0,g/2)),o=0;const _=g*A+E;C.lineOffset=Math.max(E,B),p+=_,++y}const aa=p,{horizontalAlign:ab,verticalAlign:ac}=jb(h);(function(a,b,c,d,f,g){const h=(b-c)*f,i=-g*d;for(const j of a)for(const k of j.positionedGlyphs)k.x+=h,k.y+=i})(a.positionedLines,r,ab,ac,q,aa),a.top+=-ac*aa,a.bottom=a.top+aa,a.left+=-ab*q,a.right=a.left+q,a.hasBaseline=s}(E,b,c,d,s,h,i,j,m,k,n,q),!function(a){for(const b of a)if(0!==b.positionedGlyphs.length)return!1;return!0}(D)&&E}const i3={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},i4={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 i5(a,b,c,d,f,g){if(b.imageName){const h=d[b.imageName];return h?h.displaySize[0]*b.scale*24/g+f:0}{const i=c[b.fontStack],j=i&&i.glyphs[a];return j?j.metrics.advance*b.scale+f:0}}function i6(a,b,c,d){const f=Math.pow(a-b,2);return d?a=0;let m=0;for(let n=0;n -c/2;){if(--h<0)return!1;i-=a[h].dist(g),g=a[h]}i+=a[h].dist(a[h+1]),h++;const j=[];let k=0;for(;id;)k-=j.shift().angleDelta;if(k>f)return!1;h++,i+=l.dist(m)}return!0}function jh(a){let b=0;for(let c=0;cn){const s=(n-m)/r,u=cr(p.x,q.x,s),v=cr(p.y,q.y,s),w=new jf(u,v,0,q.angleTo(p),o);return!k||jg(a,w,l,k,b)?w:void 0}m+=r}}function jk(a,b,c,d,f,g,h,i,j){var k,l,m;const n=(k=d,l=g,m=h,k?.6*l*m:0),o=ji(d,f),p=o*h,q=0===a[0].x||a[0].x===j||0===a[0].y||a[0].y===j;return b-p=0&&w=0&&x=0&&n+k<=l){const y=new jf(w,x,0,u,p);y._round(),d&&!jg(a,y,g,d,f)||o.push(y)}}m+=s}return i||o.length||h||(o=jl(a,m/2,c,d,f,g,h,!0,j)),o}function jm(a,b,c,d,f){const h=[];for(let i=0;i=d&&n.x>=d||(m.x>=d?m=new g(d,m.y+(d-m.x)/(n.x-m.x)*(n.y-m.y))._round():n.x>=d&&(n=new g(d,m.y+(d-m.x)/(n.x-m.x)*(n.y-m.y))._round()),m.y>=f&&n.y>=f||(m.y>=f?m=new g(m.x+(f-m.y)/(n.y-m.y)*(n.x-m.x),f)._round():n.y>=f&&(n=new g(m.x+(f-m.y)/(n.y-m.y)*(n.x-m.x),f)._round()),k&&m.equals(k[k.length-1])||(k=[m],h.push(k)),k.push(n)))))}}return h}function jn(a,b,c,d,f,g,h,i,j){for(let k=b;k -1)g[++j]=i,h[j]=k,h[j+1]=1e20}for(let n=0,o=0;n{let d=this.entries[a];d||(d=this.entries[a]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let f=d.glyphs[b];if(void 0!==f)return void c(null,{stack:a,id:b,glyph:f});if(f=this._tinySDF(d,a,b))return d.glyphs[b]=f,void c(null,{stack:a,id:b,glyph:f});const g=Math.floor(b/256);if(256*g>65535)return void c(Error("glyphs > 65535 not supported"));if(d.ranges[g])return void c(null,{stack:a,id:b,glyph:f});let h=d.requests[g];h||(h=d.requests[g]=[],jq.loadGlyphRange(a,g,this.url,this.requestManager,(a,b)=>{if(b){for(const c in d.ascender=b.ascender,d.descender=b.descender,b.glyphs)this._doesCharSupportLocalGlyph(+c)||(d.glyphs[+c]=b.glyphs[+c]);d.ranges[g]=!0}for(const f of h)f(a,b);delete d.requests[g]})),h.push((d,f)=>{d?c(d):f&&c(null,{stack:a,id:b,glyph:f.glyphs[b]||null})})},(a,c)=>{if(a)b(a);else if(c){const d={};for(const{stack:f,id:g,glyph:h}of c)void 0===d[f]&&(d[f]={}),void 0===d[f].glyphs&&(d[f].glyphs={}),d[f].glyphs[g]=h&&{id:h.id,bitmap:h.bitmap.clone(),metrics:h.metrics},d[f].ascender=this.entries[f].ascender,d[f].descender=this.entries[f].descender;b(null,d)}})}_doesCharSupportLocalGlyph(a){return this.localGlyphMode!==jp.none&&(this.localGlyphMode===jp.all?!!this.localFontFamily:!!this.localFontFamily&&(ez(a)||eC(a)||eq(a)||er(a))||ep(a))}_tinySDF(a,b,c){const d=this.localFontFamily;if(!d||!this._doesCharSupportLocalGlyph(c))return;let f=a.tinySDF;if(!f){let g="400";/bold/i.test(b)?g="900":/medium/i.test(b)?g="500":/light/i.test(b)&&(g="200"),(f=a.tinySDF=new jq.TinySDF({fontFamily:d,fontWeight:g,fontSize:48,buffer:6,radius:16})).fontWeight=g}if(this.localGlyphs[f.fontWeight][c])return this.localGlyphs[f.fontWeight][c];const h=String.fromCharCode(c),{data:i,width:j,height:k,glyphWidth:l,glyphHeight:m,glyphLeft:n,glyphTop:o,glyphAdvance:p}=f.draw(h);return this.localGlyphs[f.fontWeight][c]={id:c,bitmap:new g9({width:j,height:k},i),metrics:{width:l/2,height:m/2,left:n/2,top:o/2-27,advance:p/2,localGlyph:!0}}}}function jr(a,b,c,d){const f=[],h=a.image,i=h.pixelRatio,j=h.paddedRect.w-2,k=h.paddedRect.h-2,l=a.right-a.left,m=a.bottom-a.top,n=h.stretchX||[[0,j]],o=h.stretchY||[[0,k]],p=(a,b)=>a+b[1]-b[0],q=n.reduce(p,0),r=o.reduce(p,0),s=j-q,u=k-r;let v=0,w=q,x=0,y=r,z=0,A=s,B=0,C=u;if(h.content&&d){const D=h.content;v=js(n,0,D[0]),x=js(o,0,D[1]),w=js(n,D[0],D[2]),y=js(o,D[1],D[3]),z=D[0]-v,B=D[1]-x,A=D[2]-D[0]-w,C=D[3]-D[1]-y}const E=(d,f,j,k)=>{const n=(d.stretch-v)/w*l+a.left,o=d.fixed-z-A*d.stretch/q,p=(f.stretch-x)/y*m+a.top,s=f.fixed-B-C*f.stretch/r,u=(j.stretch-v)/w*l+a.left,D=j.fixed-z-A*j.stretch/q,E=(k.stretch-x)/y*m+a.top,F=k.fixed-B-C*k.stretch/r,G=new g(n,p),H=new g(u,p),I=new g(u,E),J=new g(n,E),K=new g(o/i,s/i),L=new g(D/i,F/i),M=b*Math.PI/180;if(M){const N=Math.sin(M),O=Math.cos(M),P=[O,-N,N,O];G._matMult(P),H._matMult(P),J._matMult(P),I._matMult(P)}const Q=d.stretch+d.fixed,R=f.stretch+f.fixed;return{tl:G,tr:H,bl:J,br:I,tex:{x:h.paddedRect.x+1+Q,y:h.paddedRect.y+1+R,w:j.stretch+j.fixed-Q,h:k.stretch+k.fixed-R},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:L,minFontScaleX:A/i/l,minFontScaleY:C/i/m,isSDF:c}};if(d&&(h.stretchX||h.stretchY)){const F=jt(n,s,q),G=jt(o,u,r);for(let H=0;H{if(a)f(a);else if(b){var c;const d={},g=(c=b,new iE(c).readFields(iV,{}));for(const h of g.glyphs)d[h.id]=h;f(null,{glyphs:d,ascender:g.ascender,descender:g.descender})}})},jq.TinySDF=class{constructor({fontSize:a=24,buffer:b=3,radius:c=8,cutoff:d=.25,fontFamily:f="sans-serif",fontWeight:g="normal",fontStyle:h="normal"}){this.buffer=b,this.cutoff=d,this.radius=c;const i=this.size=a+4*b,j=this._createCanvas(i),k=this.ctx=j.getContext("2d",{willReadFrequently:!0});k.font=`${h} ${g} ${a}px ${f}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(i*i),this.gridInner=new Float64Array(i*i),this.f=new Float64Array(i),this.z=new Float64Array(i+1),this.v=new Uint16Array(i)}_createCanvas(a){const b=document.createElement("canvas");return b.width=b.height=a,b}draw(a){const{width:b,actualBoundingBoxAscent:c,actualBoundingBoxDescent:d,actualBoundingBoxLeft:f,actualBoundingBoxRight:g}=this.ctx.measureText(a),h=Math.floor(c),i=Math.min(this.size-this.buffer,Math.ceil(g-f)),j=Math.min(this.size-this.buffer,Math.ceil(c)+Math.ceil(d)),k=i+2*this.buffer,l=j+2*this.buffer,m=k*l,n=new Uint8ClampedArray(m),o={data:n,width:k,height:l,glyphWidth:i,glyphHeight:j,glyphTop:h,glyphLeft:0,glyphAdvance:b};if(0===i||0===j)return o;const{ctx:p,buffer:q,gridInner:r,gridOuter:s}=this;p.clearRect(q,q,i,j),p.fillText(a,q,q+h+1);const u=p.getImageData(q,q,i,j);s.fill(1e20,0,m),r.fill(0,0,m);for(let v=0;v0?z*z:0,r[y]=z<0?z*z:0}}jn(s,0,0,k,l,k,this.f,this.v,this.z),jn(r,q,q,i,j,k,this.f,this.v,this.z);for(let A=0;Ab?1:0}){if(this.data=a,this.length=this.data.length,this.compare=b,this.length>0)for(let c=(this.length>>1)-1;c>=0;c--)this._down(c)}push(a){this.data.push(a),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const a=this.data[0],b=this.data.pop();return this.length--,this.length>0&&(this.data[0]=b,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:b,compare:c}=this,d=b[a];for(;a>0;){const f=a-1>>1,g=b[f];if(c(d,g)>=0)break;b[a]=g,a=f}b[a]=d}_down(a){const{data:b,compare:c}=this,d=this.length>>1,f=b[a];for(;ac(b[i],h)&&(g=i,h=b[i]),c(h,f)>=0)break;b[a]=h,a=g}b[a]=f}}function jw(a,b=1,c=!1){let d=1/0,f=1/0,h=-1/0,i=-1/0;const j=a[0];for(let k=0;kh)&&(h=l.x),(!k||l.y>i)&&(i=l.y)}const m=Math.min(h-d,i-f);let n=m/2;const o=new jv([],jx);if(0===m)return new g(d,f);for(let p=d;pr.d||!r.d)&&(r=u,c&&console.log("found best %d after %d probes",Math.round(1e4*u.d)/1e4,s)),u.max-r.d<=b||(n=u.h/2,o.push(new jy(u.p.x-n,u.p.y-n,n,a)),o.push(new jy(u.p.x+n,u.p.y-n,n,a)),o.push(new jy(u.p.x-n,u.p.y+n,n,a)),o.push(new jy(u.p.x+n,u.p.y+n,n,a)),s+=4)}return c&&(console.log(`num probes: ${s}`),console.log(`best distance: ${r.d}`)),r.p}function jx(a,b){return b.max-a.max}function jy(a,b,c,d){this.p=new g(a,b),this.h=c,this.d=function(a,b){let c=!1,d=1/0;for(let f=0;fa.y!=l.y>a.y&&a.x<(l.x-k.x)*(a.y-k.y)/(l.y-k.y)+k.x&&(c=!c),d=Math.min(d,gP(a,k,l))}}return(c?1:-1)*Math.sqrt(d)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const jz=Number.POSITIVE_INFINITY,jA=Math.sqrt(2);function jB(a,b){return b[1]!==jz?function(a,b,c){let d=0,f=0;switch(b=Math.abs(b),c=Math.abs(c),a){case"top-right":case"top-left":case"top":f=c-7;break;case"bottom-right":case"bottom-left":case"bottom":f=7-c}switch(a){case"top-right":case"bottom-right":case"right":d=-b;break;case"top-left":case"bottom-left":case"left":d=b}return[d,f]}(a,b[0],b[1]):function(a,b){let c=0,d=0;b<0&&(b=0);const f=b/jA;switch(a){case"top-right":case"top-left":d=f-7;break;case"bottom-right":case"bottom-left":d=7-f;break;case"bottom":d=7-b;break;case"top":d=b-7}switch(a){case"top-right":case"bottom-right":c=-f;break;case"top-left":case"bottom-left":c=f;break;case"left":c=b;break;case"right":c=-b}return[c,d]}(a,b[0])}function jC(a,b,c,d,f,g,h,i,j,k){a.createArrays(),a.tilePixelRatio=8192/(512*a.overscaling),a.compareText={},a.iconsNeedLinear=!1;const l=a.layers[0].layout,m=a.layers[0]._unevaluatedLayout._values,n={};if("composite"===a.textSizeData.kind){const{minZoom:o,maxZoom:p}=a.textSizeData;n.compositeTextSizes=[m["text-size"].possiblyEvaluate(new e2(o),i),m["text-size"].possiblyEvaluate(new e2(p),i),]}if("composite"===a.iconSizeData.kind){const{minZoom:q,maxZoom:r}=a.iconSizeData;n.compositeIconSizes=[m["icon-size"].possiblyEvaluate(new e2(q),i),m["icon-size"].possiblyEvaluate(new e2(r),i),]}n.layoutTextSize=m["text-size"].possiblyEvaluate(new e2(j+1),i),n.layoutIconSize=m["icon-size"].possiblyEvaluate(new e2(j+1),i),n.textMaxSize=m["text-size"].possiblyEvaluate(new e2(18),i);const s="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),u=l.get("text-size");for(const v of a.features){const w=l.get("text-font").evaluate(v,{},i).join(","),x=u.evaluate(v,{},i),y=n.layoutTextSize.evaluate(v,{},i),z=(n.layoutIconSize.evaluate(v,{},i),{horizontal:{},vertical:void 0}),A=v.text;let B,C=[0,0];if(A){const D=A.toString(),E=24*l.get("text-letter-spacing").evaluate(v,{},i),F=24*l.get("text-line-height").evaluate(v,{},i),G=eL(D)?E:0,H=l.get("text-anchor").evaluate(v,{},i),I=l.get("text-variable-anchor");if(!I){const J=l.get("text-radial-offset").evaluate(v,{},i);C=J?jB(H,[24*J,jz]):l.get("text-offset").evaluate(v,{},i).map(a=>24*a)}let K=s?"center":l.get("text-justify").evaluate(v,{},i);const L=l.get("symbol-placement"),M="point"===L,N="point"===L?24*l.get("text-max-width").evaluate(v,{},i):0,O=d=>{a.allowVerticalPlacement&&eK(D)&&(z.vertical=i2(A,b,c,f,w,N,F,H,d,G,C,i_.vertical,!0,L,y,x))};if(!s&&I){const P="auto"===K?I.map(a=>jD(a)):[K];let Q=!1;for(let R=0;R=0||!eK(D)){const U=i2(A,b,c,f,w,N,F,H,K,G,C,i_.horizontal,!1,L,y,x);U&&(z.horizontal[K]=U)}O("point"===L?"left":K)}}let V=!1;if(v.icon&&v.icon.name){const W=d[v.icon.name];W&&(B=jd(f[v.icon.name],l.get("icon-offset").evaluate(v,{},i),l.get("icon-anchor").evaluate(v,{},i)),V=W.sdf,void 0===a.sdfIcons?a.sdfIcons=W.sdf:a.sdfIcons!==W.sdf&&am("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(W.pixelRatio!==a.pixelRatio||0!==l.get("icon-rotate").constantOr(1))&&(a.iconsNeedLinear=!0))}const X=jH(z.horizontal)||z.vertical;a.iconsInText||(a.iconsInText=!!X&&X.iconsInText),(X||B)&&jE(a,v,z,B,d,n,y,0,C,V,h,i,k)}g&&a.generateCollisionDebugBuffers(j,a.collisionBoxArray)}function jD(a){switch(a){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function jE(a,b,c,d,f,g,h,i,j,k,l,m,n){let o=g.textMaxSize.evaluate(b,{},m);void 0===o&&(o=h);const p=a.layers[0].layout,q=p.get("icon-offset").evaluate(b,{},m),r=jH(c.horizontal)||c.vertical,s=h/24,u=a.tilePixelRatio*o/24,v=a.tilePixelRatio*p.get("symbol-spacing"),w=p.get("text-padding")*a.tilePixelRatio,x=p.get("icon-padding")*a.tilePixelRatio,y=p.get("text-max-angle")*P,z="map"===p.get("text-rotation-alignment")&&"point"!==p.get("symbol-placement"),A="map"===p.get("icon-rotation-alignment")&&"point"!==p.get("symbol-placement"),B=p.get("symbol-placement"),C=v/2,D=p.get("icon-text-fit");let E;d&&"none"!==D&&(a.allowVerticalPlacement&&c.vertical&&(E=je(d,c.vertical,D,p.get("icon-text-fit-padding"),q,s)),r&&(d=je(d,r,D,p.get("icon-text-fit-padding"),q,s)));const F=(h,i,o)=>{if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)return;const{x:p,y:r,z:s}=n.projectTilePoint(i.x,i.y,o),u=new jf(p,r,s,0,void 0);!function(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z,A){const B=a.addToLineVertexArray(b,d);let C,D,E,F,G,H,I,J=0,K=0,L=0,M=0,N=-1,O=-1;const P={};let Q=fZ(""),R=0,S=0;if(void 0===j._unevaluatedLayout.getValue("text-radial-offset")?[R,S]=j.layout.get("text-offset").evaluate(w,{},A).map(a=>24*a):(R=24*j.layout.get("text-radial-offset").evaluate(w,{},A),S=jz),a.allowVerticalPlacement&&f.vertical){const T=f.vertical;if(p)H=jJ(T),i&&(I=jJ(i));else{const U=j.layout.get("text-rotate").evaluate(w,{},A)+90;E=jI(k,c,b,l,m,n,T,o,U,q),i&&(F=jI(k,c,b,l,m,n,i,s,U))}}if(g){const V=j.layout.get("icon-rotate").evaluate(w,{},A),W="none"!==j.layout.get("icon-text-fit"),X=jr(g,V,y,W),Y=i?jr(i,V,y,W):void 0;D=jI(k,c,b,l,m,n,g,s,V),J=4*X.length;const Z=a.iconSizeData;let $=null;"source"===Z.kind?($=[128*j.layout.get("icon-size").evaluate(w,{},A),])[0]>jF&&am(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Z.kind&&(($=[128*x.compositeIconSizes[0].evaluate(w,{},A),128*x.compositeIconSizes[1].evaluate(w,{},A),])[0]>jF||$[1]>jF)&&am(`${a.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),a.addSymbols(a.icon,X,$,v,u,w,!1,c,b,B.lineStartIndex,B.lineLength,-1,z,A),N=a.icon.placedSymbolArray.length-1,Y&&(K=4*Y.length,a.addSymbols(a.icon,Y,$,v,u,w,i_.vertical,c,b,B.lineStartIndex,B.lineLength,-1,z,A),O=a.icon.placedSymbolArray.length-1)}for(const _ in f.horizontal){const aa=f.horizontal[_];C||(Q=fZ(aa.text),p?G=jJ(aa):C=jI(k,c,b,l,m,n,aa,o,j.layout.get("text-rotate").evaluate(w,{},A),q));const ab=1===aa.positionedLines.length;if(L+=jG(a,c,b,aa,h,j,p,w,q,B,f.vertical?i_.horizontal:i_.horizontalOnly,ab?Object.keys(f.horizontal):[_],P,N,x,z,A),ab)break}f.vertical&&(M+=jG(a,c,b,f.vertical,h,j,p,w,q,B,i_.vertical,["vertical"],P,O,x,z,A));let ac=-1;const ad=(a,b)=>a?Math.max(a,b):b;ac=ad(G,ac),ac=ad(H,ac),ac=ad(I,ac);const ae=ac> -1?1:0;a.glyphOffsetArray.length>=jS.MAX_GLYPHS&&am("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&a.addToSortKeyRanges(a.symbolInstances.length,w.sortKey),a.symbolInstances.emplaceBack(c.x,c.y,c.z,b.x,b.y,P.right>=0?P.right:-1,P.center>=0?P.center:-1,P.left>=0?P.left:-1,P.vertical>=0?P.vertical:-1,N,O,Q,void 0!==C?C:a.collisionBoxArray.length,void 0!==C?C+1:a.collisionBoxArray.length,void 0!==E?E:a.collisionBoxArray.length,void 0!==E?E+1:a.collisionBoxArray.length,void 0!==D?D:a.collisionBoxArray.length,void 0!==D?D+1:a.collisionBoxArray.length,F||a.collisionBoxArray.length,F?F+1:a.collisionBoxArray.length,l,L,M,J,K,ae,0,R,S,ac)}(a,i,u,h,c,d,f,E,a.layers[0],a.collisionBoxArray,b.index,b.sourceLayerIndex,a.index,w,z,j,0,x,A,q,b,g,k,l,m)};if("line"===B)for(const G of jm(b.geometry,0,0,8192,8192)){const H=jk(G,v,y,c.vertical||r,d,24,u,a.overscaling,8192);for(const I of H){const J=r;J&&jK(a,J.text,C,I)||F(G,I,m)}}else if("line-center"===B){for(const K of b.geometry)if(K.length>1){const L=jj(K,y,c.vertical||r,d,24,u);L&&F(K,L,m)}}else if("Polygon"===b.type)for(const M of hL(b.geometry,0)){const N=jw(M,16);F(M[0],new jf(N.x,N.y,0,0,void 0),m)}else if("LineString"===b.type)for(const O of b.geometry)F(O,new jf(O[0].x,O[0].y,0,0,void 0),m);else if("Point"===b.type)for(const Q of b.geometry)for(const R of Q)F([R],new jf(R.x,R.y,0,0,void 0),m)}const jF=32640;function jG(a,b,c,d,f,h,i,j,k,l,m,n,o,p,q,r,s){const u=function(a,b,c,d,f,h,i,j){const k=[];if(0===b.positionedLines.length)return k;const l=d.layout.get("text-rotate").evaluate(h,{})*Math.PI/180,m=function(a){const b=a[0],c=a[1],d=b*c;return d>0?[b,-c]:d<0?[-b,c]:0===b?[c,b]:[c,-b]}(c);let n=Math.abs(b.top-b.bottom);for(const o of b.positionedLines)n-=o.lineOffset;const p=b.positionedLines.length,q=n/p;let r=b.top-c[1];for(let s=0;sjF&&am(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===v.kind&&((w=[128*q.compositeTextSizes[0].evaluate(j,{},s),128*q.compositeTextSizes[1].evaluate(j,{},s),])[0]>jF||w[1]>jF)&&am(`${a.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),a.addSymbols(a.text,u,w,k,i,j,m,b,c,l.lineStartIndex,l.lineLength,p,r,s),n))o[x]=a.text.placedSymbolArray.length-1;return 4*u.length}function jH(a){for(const b in a)return a[b];return null}function jI(a,b,c,d,f,h,i,j,k,l){let m=i.top,n=i.bottom,o=i.left,p=i.right;const q=i.collisionPadding;if(q&&(o-=q[0],m-=q[1],p+=q[2],n+=q[3]),k){const r=new g(o,m),s=new g(p,m),u=new g(o,n),v=new g(p,n),w=k*P;let x=new g(0,0);l&&(x=new g(l[0],l[1])),r._rotateAround(w,x),s._rotateAround(w,x),u._rotateAround(w,x),v._rotateAround(w,x),o=Math.min(r.x,s.x,u.x,v.x),p=Math.max(r.x,s.x,u.x,v.x),m=Math.min(r.y,s.y,u.y,v.y),n=Math.max(r.y,s.y,u.y,v.y)}return a.emplaceBack(b.x,b.y,b.z,c.x,c.y,o,m,p,n,j,d,f,h),a.length-1}function jJ(a){a.collisionPadding&&(a.top-=a.collisionPadding[1],a.bottom+=a.collisionPadding[3]);const b=a.bottom-a.top;return b>0?Math.max(10,b):null}function jK(a,b,c,d){const f=a.compareText;if(b in f){const g=f[b];for(let h=g.length-1;h>=0;h--)if(d.dist(g[h])a.id),this.index=a.index,this.pixelRatio=a.pixelRatio,this.sourceLayerIndex=a.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=l([]),this.placementViewportMatrix=l([]);const b=this.layers[0]._unevaluatedLayout._values;this.textSizeData=iu(this.zoom,b["text-size"]),this.iconSizeData=iu(this.zoom,b["icon-size"]);const c=this.layers[0].layout,d=c.get("symbol-sort-key"),f=c.get("symbol-z-order");this.canOverlap=c.get("text-allow-overlap")||c.get("icon-allow-overlap")||c.get("text-ignore-placement")||c.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==f&& void 0!==d.constantOr(1),this.sortFeaturesByY=("viewport-y"===f||"auto"===f&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=c.get("text-writing-mode").map(a=>i_[a]),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id),this.sourceID=a.sourceID}createArrays(){this.text=new jQ(new gg(this.layers,this.zoom,a=>/^text/.test(a))),this.icon=new jQ(new gg(this.layers,this.zoom,a=>/^icon/.test(a))),this.glyphOffsetArray=new fP,this.lineVertexArray=new fQ,this.symbolInstances=new fO}calculateGlyphDependencies(a,b,c,d,f){for(let g=0;g0)&&("constant"!==h.value.kind||h.value.value.length>0),l="constant"!==j.value.kind||!!j.value.value||Object.keys(j.parameters).length>0,m=g.get("symbol-sort-key");if(this.features=[],!k&&!l)return;const n=b.iconDependencies,o=b.glyphDependencies,p=b.availableImages,q=new e2(this.zoom);for(const{feature:r,id:s,index:u,sourceLayerIndex:v}of a){const w=f._featureFilter.needGeometry,x=gG(r,w);if(!f._featureFilter.filter(q,x,c))continue;let y,z;if(w||(x.geometry=gF(r,c,d)),k){const A=f.getValueAndResolveTokens("text-field",x,c,p),B=bN.factory(A);jP(B)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===e_()||this.hasRTLText&&e1.isParsed())&&(y=iy(B,f,x))}if(l){const C=f.getValueAndResolveTokens("icon-image",x,c,p);z=C instanceof bO?C:bO.fromString(C)}if(!y&&!z)continue;const D=this.sortFeaturesByKey?m.evaluate(x,{},c):void 0;if(this.features.push({id:s,text:y,icon:z,index:u,sourceLayerIndex:v,geometry:x.geometry,properties:r.properties,type:jL[r.type],sortKey:D}),z&&(n[z.name]=!0),y){const E=h.evaluate(x,{},c).join(","),F="map"===g.get("text-rotation-alignment")&&"point"!==g.get("symbol-placement");for(const G of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(i_.vertical)>=0,y.sections))if(G.image)n[G.image.name]=!0;else{const H=eK(y.toString()),I=G.fontStack||E,J=o[I]=o[I]||{};this.calculateGlyphDependencies(G.text,J,F,this.allowVerticalPlacement,H)}}}"line"===g.get("symbol-placement")&&(this.features=function(a){const b={},c={},d=[];let f=0;function g(b){d.push(a[b]),f++}function h(a,b,f){const g=c[a];return delete c[a],c[b]=g,d[g].geometry[0].pop(),d[g].geometry[0]=d[g].geometry[0].concat(f[0]),g}function i(a,c,f){const g=b[c];return delete b[c],b[a]=g,d[g].geometry[0].shift(),d[g].geometry[0]=f[0].concat(d[g].geometry[0]),g}function j(a,b,c){const d=c?b[0][b[0].length-1]:b[0][0];return`${a}:${d.x}:${d.y}`}for(let k=0;ka.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((a,b)=>a.sortKey-b.sortKey)}update(a,b,c,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(a,b,this.layers,c,d),this.icon.programConfigurations.updatePaintArrays(a,b,this.layers,c,d))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(a){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(a),this.iconCollisionBox.upload(a)),this.text.upload(a,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(a,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(a,b){const c=this.lineVertexArray.length;if(void 0!==a.segment){let d=a.dist(b[a.segment+1]),f=a.dist(b[a.segment]);const g={};for(let h=a.segment+1;h=0;i--)g[i]={x:b[i].x,y:b[i].y,tileUnitDistanceFromAnchor:f},i>0&&(f+=b[i-1].dist(b[i]));for(let j=0;j=0?b.rightJustifiedTextSymbolIndex:b.centerJustifiedTextSymbolIndex>=0?b.centerJustifiedTextSymbolIndex:b.leftJustifiedTextSymbolIndex>=0?b.leftJustifiedTextSymbolIndex:b.verticalPlacedTextSymbolIndex>=0?b.verticalPlacedTextSymbolIndex:d),g=iv(this.textSizeData,a,f)/24;return this.tilePixelRatio*g}getSymbolInstanceIconSize(a,b,c){const d=this.icon.placedSymbolArray.get(c),f=iv(this.iconSizeData,a,d);return this.tilePixelRatio*f}_commitDebugCollisionVertexUpdate(a,b,c){a.emplaceBack(b,-c,-c),a.emplaceBack(b,c,-c),a.emplaceBack(b,c,c),a.emplaceBack(b,-c,c)}_updateTextDebugCollisionBoxes(a,b,c,d,f,g){for(let h=d;h0}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(a,b){const c=a.placedSymbolArray.get(b),d=c.vertexStartIndex+4*c.numGlyphs;for(let f=c.vertexStartIndex;fd[a]-d[b]||f[b]-f[a]),g}addToSortKeyRanges(a,b){const c=this.sortKeyRanges[this.sortKeyRanges.length-1];c&&c.sortKey===b?c.symbolInstanceEnd=a+1:this.sortKeyRanges.push({sortKey:b,symbolInstanceStart:a,symbolInstanceEnd:a+1})}sortFeatures(a){if(this.sortFeaturesByY&&this.sortedAngle!==a&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const b of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(a),this.sortedAngle=a,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const c=this.symbolInstances.get(b);this.featureSortOrder.push(c.featureIndex),[c.rightJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.leftJustifiedTextSymbolIndex,].forEach((a,b,c)=>{a>=0&&c.indexOf(a)===b&&this.addIndicesForPlacedSymbol(this.text,a)}),c.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,c.verticalPlacedTextSymbolIndex),c.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,c.placedIconSymbolIndex),c.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,c.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}ec("SymbolBucket",jS,{omit:["layers","collisionBoxArray","features","compareText",]}),jS.MAX_GLYPHS=65535,jS.addDynamicAttributes=jO;const jT=new ff({"symbol-placement":new fa(bk.layout_symbol["symbol-placement"]),"symbol-spacing":new fa(bk.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new fa(bk.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new fb(bk.layout_symbol["symbol-sort-key"]),"symbol-z-order":new fa(bk.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new fa(bk.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new fa(bk.layout_symbol["icon-ignore-placement"]),"icon-optional":new fa(bk.layout_symbol["icon-optional"]),"icon-rotation-alignment":new fa(bk.layout_symbol["icon-rotation-alignment"]),"icon-size":new fb(bk.layout_symbol["icon-size"]),"icon-text-fit":new fa(bk.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new fa(bk.layout_symbol["icon-text-fit-padding"]),"icon-image":new fb(bk.layout_symbol["icon-image"]),"icon-rotate":new fb(bk.layout_symbol["icon-rotate"]),"icon-padding":new fa(bk.layout_symbol["icon-padding"]),"icon-keep-upright":new fa(bk.layout_symbol["icon-keep-upright"]),"icon-offset":new fb(bk.layout_symbol["icon-offset"]),"icon-anchor":new fb(bk.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new fa(bk.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new fa(bk.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new fa(bk.layout_symbol["text-rotation-alignment"]),"text-field":new fb(bk.layout_symbol["text-field"]),"text-font":new fb(bk.layout_symbol["text-font"]),"text-size":new fb(bk.layout_symbol["text-size"]),"text-max-width":new fb(bk.layout_symbol["text-max-width"]),"text-line-height":new fb(bk.layout_symbol["text-line-height"]),"text-letter-spacing":new fb(bk.layout_symbol["text-letter-spacing"]),"text-justify":new fb(bk.layout_symbol["text-justify"]),"text-radial-offset":new fb(bk.layout_symbol["text-radial-offset"]),"text-variable-anchor":new fa(bk.layout_symbol["text-variable-anchor"]),"text-anchor":new fb(bk.layout_symbol["text-anchor"]),"text-max-angle":new fa(bk.layout_symbol["text-max-angle"]),"text-writing-mode":new fa(bk.layout_symbol["text-writing-mode"]),"text-rotate":new fb(bk.layout_symbol["text-rotate"]),"text-padding":new fa(bk.layout_symbol["text-padding"]),"text-keep-upright":new fa(bk.layout_symbol["text-keep-upright"]),"text-transform":new fb(bk.layout_symbol["text-transform"]),"text-offset":new fb(bk.layout_symbol["text-offset"]),"text-allow-overlap":new fa(bk.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new fa(bk.layout_symbol["text-ignore-placement"]),"text-optional":new fa(bk.layout_symbol["text-optional"])});var jU={paint:new ff({"icon-opacity":new fb(bk.paint_symbol["icon-opacity"]),"icon-color":new fb(bk.paint_symbol["icon-color"]),"icon-halo-color":new fb(bk.paint_symbol["icon-halo-color"]),"icon-halo-width":new fb(bk.paint_symbol["icon-halo-width"]),"icon-halo-blur":new fb(bk.paint_symbol["icon-halo-blur"]),"icon-translate":new fa(bk.paint_symbol["icon-translate"]),"icon-translate-anchor":new fa(bk.paint_symbol["icon-translate-anchor"]),"text-opacity":new fb(bk.paint_symbol["text-opacity"]),"text-color":new fb(bk.paint_symbol["text-color"],{runtimeType:bw,getOverride:a=>a.textColor,hasOverride:a=>!!a.textColor}),"text-halo-color":new fb(bk.paint_symbol["text-halo-color"]),"text-halo-width":new fb(bk.paint_symbol["text-halo-width"]),"text-halo-blur":new fb(bk.paint_symbol["text-halo-blur"]),"text-translate":new fa(bk.paint_symbol["text-translate"]),"text-translate-anchor":new fa(bk.paint_symbol["text-translate-anchor"])}),layout:jT};class jV{constructor(a){this.type=a.property.overrides?a.property.overrides.runtimeType:bs,this.defaultValue=a}evaluate(a){if(a.formattedSection){const b=this.defaultValue.property.overrides;if(b&&b.hasOverride(a.formattedSection))return b.getOverride(a.formattedSection)}return a.feature&&a.featureState?this.defaultValue.evaluate(a.feature,a.featureState):this.defaultValue.property.specification.default}eachChild(a){this.defaultValue.isConstant()||a(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ec("FormatSectionOverride",jV,{omit:["defaultValue"]});class jW extends gn{constructor(a){super(a,jU)}recalculate(a,b){super.recalculate(a,b),"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 c=this.layout.get("text-writing-mode");if(c){const d=[];for(const f of c)0>d.indexOf(f)&&d.push(f);this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(a,b,c,d){var f;const g=this.layout.get(a).evaluate(b,{},c,d),h=this._unevaluatedLayout._values[a];return h.isDataDriven()||dj(h.value)||!g?g:(f=b.properties,g.replace(/{([^{}]+)}/g,(a,b)=>b in f?String(f[b]):""))}createBucket(a){return new jS(a)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const a of jU.paint.overridableProperties){if(!jW.hasPaintOverride(this.layout,a))continue;const b=this.paint.get(a),c=new jV(b),d=new di(c,b.property.specification);let f=null;f="constant"===b.value.kind||"source"===b.value.kind?new dl("source",d):new dm("composite",d,b.value.zoomStops,b.value._interpolationType),this.paint._values[a]=new e8(b.property,f,b.parameters)}}_handleOverridablePaintPropertyUpdate(a,b,c){return!(!this.layout||b.isDataDriven()||c.isDataDriven())&&jW.hasPaintOverride(this.layout,a)}static hasPaintOverride(a,b){const c=a.get("text-field"),d=jU.paint.properties[b];let f=!1;const g=a=>{for(const b of a)if(d.overrides&&d.overrides.hasOverride(b))return void(f=!0)};if("constant"===c.value.kind&&c.value.value instanceof bN)g(c.value.value.sections);else if("source"===c.value.kind){const h=a=>{f||(a instanceof bT&&bR(a.value)===bA?g(a.value.sections):a instanceof bX?g(a.sections):a.eachChild(h))},i=c.value;i._styleExpression&&h(i._styleExpression.expression)}return f}getProgramConfiguration(a){return new gf(this,a)}}var jX={paint:new ff({"background-color":new fa(bk.paint_background["background-color"]),"background-pattern":new fd(bk.paint_background["background-pattern"]),"background-opacity":new fa(bk.paint_background["background-opacity"])})},jY={paint:new ff({"raster-opacity":new fa(bk.paint_raster["raster-opacity"]),"raster-hue-rotate":new fa(bk.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new fa(bk.paint_raster["raster-brightness-min"]),"raster-brightness-max":new fa(bk.paint_raster["raster-brightness-max"]),"raster-saturation":new fa(bk.paint_raster["raster-saturation"]),"raster-contrast":new fa(bk.paint_raster["raster-contrast"]),"raster-resampling":new fa(bk.paint_raster["raster-resampling"]),"raster-fade-duration":new fa(bk.paint_raster["raster-fade-duration"])})};class jZ extends gn{constructor(a){super(a,{}),this.implementation=a}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(a){this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)}onRemove(a){this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)}}var j$={paint:new ff({"sky-type":new fa(bk.paint_sky["sky-type"]),"sky-atmosphere-sun":new fa(bk.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new fa(bk.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new fa(bk.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new fa(bk.paint_sky["sky-gradient-radius"]),"sky-gradient":new fe(bk.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new fa(bk.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new fa(bk.paint_sky["sky-atmosphere-color"]),"sky-opacity":new fa(bk.paint_sky["sky-opacity"])})};function j_(a,b,c){var d,f,g,h,i,j,k,l,m;const n=w(0,0,1),o=M(L());return d=o,f=o,g=c?-(a*P)+Math.PI:a*P,g*=.5,h=f[0],i=f[1],j=f[2],k=f[3],l=Math.sin(g),m=Math.cos(g),d[0]=h*m-j*l,d[1]=i*m+k*l,d[2]=j*m+h*l,d[3]=k*m-i*l,N(o,o,-(b*P)),H(n,n,o),D(n,n)}const j0={circle:class extends gn{constructor(a){super(a,gZ)}createBucket(a){return new gI(a)}queryRadius(a){const b=a;return gU("circle-radius",this,b)+gU("circle-stroke-width",this,b)+gV(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,d,f,g,h,i){const j=gX(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),g.angle,a.pixelToTileUnitsFactor),k=this.paint.get("circle-radius").evaluate(b,c)+this.paint.get("circle-stroke-width").evaluate(b,c);return g0(a,d,g,h,i,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),j,k)}getProgramIds(){return["circle"]}getProgramConfiguration(a){return new gf(this,a)}},heatmap:class extends gn{createBucket(a){return new g5(a)}constructor(a){super(a,hb),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(a){"heatmap-color"===a&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hc({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(a){return gU("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,f,h,i,j){const k=this.paint.get("heatmap-radius").evaluate(b,c);return g0(a,d,h,i,j,!0,!0,new g(0,0),k)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(a){return new gf(this,a)}},hillshade:class extends gn{constructor(a){super(a,hd)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(a){return new gf(this,a)}},fill:class extends gn{constructor(a){super(a,hR)}getProgramIds(){const a=this.paint.get("fill-pattern"),b=a&&a.constantOr(1),c=[b?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&c.push(b&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),c}getProgramConfiguration(a){return new gf(this,a)}recalculate(a,b){super.recalculate(a,b);const c=this.paint._values["fill-outline-color"];"constant"===c.value.kind&& void 0===c.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(a){return new hP(a)}queryRadius(){return gV(this.paint.get("fill-translate"))}queryIntersectsFeature(a,b,c,d,f,g){return!a.queryGeometry.isAboveHorizon&&gK(gW(a.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),g.angle,a.pixelToTileUnitsFactor),d)}isTileClipped(){return!0}},"fill-extrusion":class extends gn{constructor(a){super(a,h7)}createBucket(a){return new h5(a)}queryRadius(){return gV(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(a){return new gf(this,a)}queryIntersectsFeature(a,b,c,d,f,h,i,j,k){var l,m,n,o,p,q,r,s,u;const v=gX(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,a.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(b,c),x=this.paint.get("fill-extrusion-base").evaluate(b,c),y=[0,0],z=j&&h.elevation,A=h.elevation?h.elevation.exaggeration():1;if(z){const B=a.tile.getBucket(this).centroidVertexArray,C=k+1;if(C0?c+2*b:b),g=gU("line-offset",this,d);return f/2+Math.abs(g)+gV(this.paint.get("line-translate"))}queryIntersectsFeature(a,b,c,d,f,h){var i,j;if(a.queryGeometry.isAboveHorizon)return!1;const k=gW(a.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,a.pixelToTileUnitsFactor),l=a.pixelToTileUnitsFactor/2*(i=this.paint.get("line-width").evaluate(b,c),(j=this.paint.get("line-gap-width").evaluate(b,c))>0?j+2*i:i),m=this.paint.get("line-offset").evaluate(b,c);return m&&(d=function(a,b){const c=[],d=new g(0,0);for(let f=0;f=3){for(let g=0;g1&&(i=a[++h]);const k=Math.abs(j-i.left),l=Math.abs(j-i.right),m=Math.min(k,l);let n;const o=f/c*(d+1);if(i.isDash){const p=d-Math.abs(o);n=Math.sqrt(m*m+p*p)}else n=d-Math.sqrt(m*m+o*o);this.image.data[g+j]=Math.max(0,Math.min(255,n+128))}}}addRegularDash(a,b){for(let c=a.length-1;c>=0;--c){const d=a[c],f=a[c+1];d.zeroLength?a.splice(c,1):f&&f.isDash===d.isDash&&(f.left=d.left,a.splice(c,1))}const g=a[0],h=a[a.length-1];g.isDash===h.isDash&&(g.left=h.left-this.width,h.right=g.right+this.width);const i=this.width*this.nextRow;let j=0,k=a[j];for(let l=0;l1&&(k=a[++j]);const m=Math.abs(l-k.left),n=Math.abs(l-k.right),o=Math.min(m,n);this.image.data[i+l]=Math.max(0,Math.min(255,(k.isDash?o:-o)+b+128))}}addDash(a,b){const c=this.getKey(a,b);if(this.positions[c])return this.positions[c];const d="round"===b,f=d?7:0,g=2*f+1;if(this.nextRow+g>this.height)return am("LineAtlas out of space"),null;0===a.length&&a.push(1);let h=0;for(let i=0;i0;g--)f+=(b&(d=1<this.canonical.z?new kd(a,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new kd(a,this.wrap,a,this.canonical.x>>b,this.canonical.y>>b)}calculateScaledKey(a,b=!0){if(this.overscaledZ===a&&b)return this.key;if(a>this.canonical.z)return ke(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return ke(this.wrap*+b,a,a,this.canonical.x>>c,this.canonical.y>>c)}}isChildOf(a){if(a.wrap!==this.wrap)return!1;const b=this.canonical.z-a.canonical.z;return 0===a.overscaledZ||a.overscaledZ>b&&a.canonical.y===this.canonical.y>>b}children(a){if(this.overscaledZ>=a)return[new kd(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const b=this.canonical.z+1,c=2*this.canonical.x,d=2*this.canonical.y;return[new kd(b,this.wrap,b,c,d),new kd(b,this.wrap,b,c+1,d),new kd(b,this.wrap,b,c,d+1),new kd(b,this.wrap,b,c+1,d+1),]}isLessThan(a){return this.wrapa.wrap)&&(this.overscaledZa.overscaledZ)&&(this.canonical.xa.canonical.x)&&this.canonical.yMath.abs(d[h])){if(c[h]b[h])return null}else{const i=1/d[h];let j=(a[h]-c[h])*i,k=(b[h]-c[h])*i;if(j>k){const l=j;j=k,k=l}if(j>f&&(f=j),kg)return null}return f}function kn(a,b,c,d,f,g,h,i,j,k,l){const m=d-a,n=f-b,o=g-c,p=h-a,q=i-b,r=j-c,s=l[1]*r-l[2]*q,u=l[2]*p-l[0]*r,v=l[0]*q-l[1]*p,w=m*s+n*u+o*v;if(1e-15>Math.abs(w))return null;const x=1/w,y=k[0]-a,z=k[1]-b,A=k[2]-c,B=(y*s+z*u+A*v)*x;if(B<0||B>1)return null;const C=z*o-A*n,D=A*m-y*o,E=y*n-z*m,F=(l[0]*C+l[1]*D+l[2]*E)*x;return F<0||B+F>1?null:(p*C+q*D+r*E)*x}function ko(a,b,c,d,f,g,h,i,j){const k=1<{const g=d?1:0,h=(a+1)*c-g,i=b*c,j=(b+1)*c-g;f[0]=a*c,f[1]=i,f[2]=h,f[3]=j};let h=new kl(d);const i=[];for(let j=0;j=1;d/=2){const o=c[c.length-1];h=new kl(d);for(let p=0;p0;){const{idx:o,t:p,nodex:q,nodey:r,depth:s}=n.pop();if(this.leaves[o]){ko(q,r,s,a,b,c,d,l,m);const u=1<=J[2])return p}continue}let K=0;for(let L=0;L=j[k[P]]&&(k.splice(P,0,L),O=!0);O||(k[K]=L),K++}}for(let Q=0;Q=this.dim+1||b< -1||b>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(b+1)*this.stride+(a+1)}_unpackMapbox(a,b,c){return(256*a*256+256*b+c)/10-1e4}_unpackTerrarium(a,b,c){return 256*a+b+c/256-32768}static pack(a,b){const c=[0,0,0,0],d=kt.getUnpackVector(b);let f=Math.floor((a+d[3])/d[2]);return c[2]=f%256,f=Math.floor(f/256),c[1]=f%256,f=Math.floor(f/256),c[0]=f,c}getPixels(){return new ha({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(a,b,c){if(this.dim!==a.dim)throw Error("dem dimension mismatch");let d=b*this.dim,f=b*this.dim+this.dim,g=c*this.dim,h=c*this.dim+this.dim;switch(b){case -1:d=f-1;break;case 1:f=d+1}switch(c){case -1:g=h-1;break;case 1:h=g+1}const i=-b*this.dim,j=-c*this.dim;for(let k=g;k{"source"===a.dataType&&"metadata"===a.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===a.dataType&&"content"===a.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),b.on("error",()=>{this._sourceErrored=!0}),this._source=b,this._tiles={},this._cache=new class{constructor(a,b){this.max=a,this.onRemove=b,this.reset()}reset(){for(const a in this.data)for(const b of this.data[a])b.timeout&&clearTimeout(b.timeout),this.onRemove(b.value);return this.data={},this.order=[],this}add(a,b,c){const d=a.wrapped().key;void 0===this.data[d]&&(this.data[d]=[]);const f={value:b,timeout:void 0};if(void 0!==c&&(f.timeout=setTimeout(()=>{this.remove(a,f)},c)),this.data[d].push(f),this.order.push(d),this.order.length>this.max){const g=this._getAndRemoveByKey(this.order[0]);g&&this.onRemove(g)}return this}has(a){return a.wrapped().key in this.data}getAndRemove(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null}_getAndRemoveByKey(a){const b=this.data[a].shift();return b.timeout&&clearTimeout(b.timeout),0===this.data[a].length&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),b.value}getByKey(a){const b=this.data[a];return b?b[0].value:null}get(a){return this.has(a)?this.data[a.wrapped().key][0].value:null}remove(a,b){if(!this.has(a))return this;const c=a.wrapped().key,d=void 0===b?0:this.data[c].indexOf(b),f=this.data[c][d];return this.data[c].splice(d,1),f.timeout&&clearTimeout(f.timeout),0===this.data[c].length&&delete this.data[c],this.onRemove(f.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(a){for(this.max=a;this.order.length>this.max;){const b=this._getAndRemoveByKey(this.order[0]);b&&this.onRemove(b)}return this}filter(a){const b=[];for(const c in this.data)for(const d of this.data[c])a(d.value)||b.push(d);for(const f of b)this.remove(f.value.tileID,f)}}(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(a,b,c){const d=String(b);if(this.stateChanges[a]=this.stateChanges[a]||{},this.stateChanges[a][d]=this.stateChanges[a][d]||{},aa(this.stateChanges[a][d],c),null===this.deletedStates[a])for(const f in this.deletedStates[a]={},this.state[a])f!==d&&(this.deletedStates[a][f]=null);else if(this.deletedStates[a]&&null===this.deletedStates[a][d])for(const g in this.deletedStates[a][d]={},this.state[a][d])c[g]||(this.deletedStates[a][d][g]=null);else for(const h in c)this.deletedStates[a]&&this.deletedStates[a][d]&&null===this.deletedStates[a][d][h]&&delete this.deletedStates[a][d][h]}removeFeatureState(a,b,c){if(null===this.deletedStates[a])return;const d=String(b);if(this.deletedStates[a]=this.deletedStates[a]||{},c&& void 0!==b)null!==this.deletedStates[a][d]&&(this.deletedStates[a][d]=this.deletedStates[a][d]||{},this.deletedStates[a][d][c]=null);else if(void 0!==b){if(this.stateChanges[a]&&this.stateChanges[a][d])for(c in this.deletedStates[a][d]={},this.stateChanges[a][d])this.deletedStates[a][d][c]=null;else this.deletedStates[a][d]=null}else this.deletedStates[a]=null}getState(a,b){const c=String(b),d=aa({},(this.state[a]||{})[c],(this.stateChanges[a]||{})[c]);if(null===this.deletedStates[a])return{};if(this.deletedStates[a]){const f=this.deletedStates[a][b];if(null===f)return{};for(const g in f)delete d[g]}return d}initializeTileState(a,b){a.setFeatureState(this.state,b)}coalesceChanges(a,b){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const f={};for(const g in this.stateChanges[d])this.state[d][g]||(this.state[d][g]={}),aa(this.state[d][g],this.stateChanges[d][g]),f[g]=this.state[d][g];c[d]=f}for(const h in this.deletedStates){this.state[h]=this.state[h]||{};const i={};if(null===this.deletedStates[h])for(const j in this.state[h])i[j]={},this.state[h][j]={};else for(const k in this.deletedStates[h]){if(null===this.deletedStates[h][k])this.state[h][k]={};else for(const l of Object.keys(this.deletedStates[h][k]))delete this.state[h][k][l];i[k]=this.state[h][k]}c[h]=c[h]||{},aa(c[h],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(c).length)for(const m in a)a[m].setFeatureState(c,b)}}}onAdd(a){this.map=a,this._minTileCacheSize=a?a._minTileCacheSize:null,this._maxTileCacheSize=a?a._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const a in this._tiles){const b=this._tiles[a];if("loaded"!==b.state&&"errored"!==b.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const a=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,a&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(a,b){return a.isSymbolTile=this._onlySymbols,this._source.loadTile(a,b)}_unloadTile(a){if(this._source.unloadTile)return this._source.unloadTile(a,()=>{})}_abortTile(a){if(this._source.abortTile)return this._source.abortTile(a,()=>{})}serialize(){return this._source.serialize()}prepare(a){for(const b in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const c=this._tiles[b];c.upload(a),c.prepare(this.map.style.imageManager)}}getIds(){return _(this._tiles).map(a=>a.tileID).sort(kv).map(a=>a.key)}getRenderableIds(a){const b=[];for(const c in this._tiles)this._isIdRenderable(+c,a)&&b.push(this._tiles[c]);return a?b.sort((a,b)=>{const c=a.tileID,d=b.tileID,f=new g(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),h=new g(d.canonical.x,d.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-d.overscaledZ||h.y-f.y||h.x-f.x}).map(a=>a.tileID.key):b.map(a=>a.tileID).sort(kv).map(a=>a.key)}hasRenderableParent(a){const b=this.findLoadedParent(a,0);return!!b&&this._isIdRenderable(b.tileID.key)}_isIdRenderable(a,b){return this._tiles[a]&&this._tiles[a].hasData()&&!this._coveredTiles[a]&&(b||!this._tiles[a].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const a in this._cache.reset(),this._tiles)"errored"!==this._tiles[a].state&&this._reloadTile(+a,"reloading")}_reloadTile(a,b){const c=this._tiles[a];c&&("loading"!==c.state&&(c.state=b),this._loadTile(c,this._tileLoaded.bind(this,c,a,b)))}_tileLoaded(a,b,c,d){if(d){if(a.state="errored",404!==d.status)this._source.fire(new bi(d,{tile:a}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const f=this.map.painter.terrain;this.update(this.transform,f.getScaledDemTileSize(),!0),f.resetTileLookupCache(this.id)}else this.update(this.transform)}else a.timeAdded=ax.now(),"expired"===c&&(a.refreshedUponExpiration=!0),this._setTileReloadTimer(b,a),"raster-dem"===this._source.type&&a.dem&&this._backfillDEM(a),this._state.initializeTileState(a,this.map?this.map.painter:null),this._source.fire(new bh("data",{dataType:"source",tile:a,coord:a.tileID,sourceCacheId:this.id}))}_backfillDEM(a){const b=this.getRenderableIds();for(let c=0;c1||(Math.abs(c)>1&&(1===Math.abs(c+f)?c+=f:1===Math.abs(c-f)&&(c-=f)),b.dem&&a.dem&&(a.dem.backfillBorder(b.dem,c,d),a.neighboringTiles&&a.neighboringTiles[g]&&(a.neighboringTiles[g].backfilled=!0)))}}getTile(a){return this.getTileByID(a.key)}getTileByID(a){return this._tiles[a]}_retainLoadedChildren(a,b,c,d){for(const f in this._tiles){let g=this._tiles[f];if(d[f]||!g.hasData()||g.tileID.overscaledZ<=b||g.tileID.overscaledZ>c)continue;let h=g.tileID;for(;g&&g.tileID.overscaledZ>b+1;){const i=g.tileID.scaledTo(g.tileID.overscaledZ-1);(g=this._tiles[i.key])&&g.hasData()&&(h=i)}let j=h;for(;j.overscaledZ>b;)if(a[(j=j.scaledTo(j.overscaledZ-1)).key]){d[h.key]=h;break}}}findLoadedParent(a,b){if(a.key in this._loadedParentTiles){const c=this._loadedParentTiles[a.key];return c&&c.tileID.overscaledZ>=b?c:null}for(let d=a.overscaledZ-1;d>=b;d--){const f=a.scaledTo(d),g=this._getLoadedTile(f);if(g)return g}}_getLoadedTile(a){const b=this._tiles[a.key];return b&&b.hasData()?b:this._cache.getByKey(this._source.reparseOverscaled?a.wrapped().key:a.canonical.key)}updateCacheSize(a,b){b=b||this._source.tileSize;const c=Math.ceil(a.width/b)+1,d=Math.ceil(a.height/b)+1,f=Math.floor(c*d*5),g="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,f):f,h="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(h)}handleWrapJump(a){const b=Math.round((a-(void 0===this._prevLng?a:this._prevLng))/360);if(this._prevLng=a,b){const c={};for(const d in this._tiles){const f=this._tiles[d];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+b),c[f.tileID.key]=f}for(const g in this._tiles=c,this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const h in this._tiles)this._setTileReloadTimer(+h,this._tiles[h])}}update(a,b,c){if(this.transform=a,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;let d;this.updateCacheSize(a,b),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=a.getVisibleUnwrappedCoordinates(this._source.tileID).map(a=>new kd(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(d=a.coveringTiles({tileSize:b||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(d=d.filter(a=>this._source.hasTile(a)))):d=[];const f=this._updateRetainedTiles(d);if(kw(this._source.type)&&0!==d.length){const g={},h={},i=Object.keys(f);for(const j of i){const k=f[j],l=this._tiles[j];if(!l||l.fadeEndTime&&l.fadeEndTime<=ax.now())continue;const m=this.findLoadedParent(k,Math.max(k.overscaledZ-ku.maxOverzooming,this._source.minzoom));m&&(this._addTile(m.tileID),g[m.tileID.key]=m.tileID),h[j]=k}const n=d[d.length-1].overscaledZ;for(const o in this._tiles){const p=this._tiles[o];if(f[o]||!p.hasData())continue;let q=p.tileID;for(;q.overscaledZ>n;){q=q.scaledTo(q.overscaledZ-1);const r=this._tiles[q.key];if(r&&r.hasData()&&h[q.key]){f[o]=p.tileID;break}}}for(const s in g)f[s]||(this._coveredTiles[s]=!0,f[s]=g[s])}for(const u in f)this._tiles[u].clearFadeHold();const v=function(a,b){const c=[];for(const d in a)d in b||c.push(d);return c}(this._tiles,f);for(const w of v){const x=this._tiles[w];x.hasSymbolBuckets&&!x.holdingForFade()?x.setHoldDuration(this.map._fadeDuration):x.hasSymbolBuckets&&!x.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const a in this._tiles)this._tiles[a].holdingForFade()&&this._removeTile(+a)}_updateRetainedTiles(a){const b={};if(0===a.length)return b;const c={},d=a.reduce((a,b)=>Math.min(a,b.overscaledZ),1/0),f=a[0].overscaledZ,g=Math.max(f-ku.maxOverzooming,this._source.minzoom),h=Math.max(f+ku.maxUnderzooming,this._source.minzoom),i={};for(const j of a){const k=this._addTile(j);b[j.key]=j,k.hasData()||d=this._source.maxzoom){const n=l.children(this._source.maxzoom)[0],o=this.getTile(n);if(o&&o.hasData()){b[n.key]=n;continue}}else{const p=l.children(this._source.maxzoom);if(b[p[0].key]&&b[p[1].key]&&b[p[2].key]&&b[p[3].key])continue}let q=m.wasRequested();for(let r=l.overscaledZ-1;r>=g;--r){const s=l.scaledTo(r);if(c[s.key]||(c[s.key]=!0,(m=this.getTile(s))||!q||(m=this._addTile(s)),m&&(b[s.key]=s,q=m.wasRequested(),m.hasData())))break}}return b}_updateLoadedParentTileCache(){for(const a in this._loadedParentTiles={},this._tiles){const b=[];let c,d=this._tiles[a].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}b.push(d.key);const f=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(f))break;d=f}for(const g of b)this._loadedParentTiles[g]=c}}_addTile(a){let b=this._tiles[a.key];if(b)return b;(b=this._cache.getAndRemove(a))&&(this._setTileReloadTimer(a.key,b),b.tileID=a,this._state.initializeTileState(b,this.map?this.map.painter:null),this._cacheTimers[a.key]&&(clearTimeout(this._cacheTimers[a.key]),delete this._cacheTimers[a.key],this._setTileReloadTimer(a.key,b)));const c=Boolean(b);if(!c){const d=this.map?this.map.painter:null,f="raster"===this._source.type||"raster-dem"===this._source.type;b=new kU(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,d,f),this._loadTile(b,this._tileLoaded.bind(this,b,a.key,b.state))}return b?(b.uses++,this._tiles[a.key]=b,c||this._source.fire(new bh("dataloading",{tile:b,coord:b.tileID,dataType:"source"})),b):null}_setTileReloadTimer(a,b){a in this._timers&&(clearTimeout(this._timers[a]),delete this._timers[a]);const c=b.getExpiryTimeout();c&&(this._timers[a]=setTimeout(()=>{this._reloadTile(a,"expired"),delete this._timers[a]},c))}_removeTile(a){const b=this._tiles[a];b&&(b.uses--,delete this._tiles[a],this._timers[a]&&(clearTimeout(this._timers[a]),delete this._timers[a]),b.uses>0||(b.hasData()&&"reloading"!==b.state?this._cache.add(b.tileID,b,b.getExpiryTimeout()):(b.aborted=!0,this._abortTile(b),this._unloadTile(b))))}clearTiles(){for(const a in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+a);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(a,b,c){const d=[],f=this.transform;if(!f)return d;for(const g in this._tiles){const h=this._tiles[g];if(c&&h.clearQueryDebugViz(),h.holdingForFade())continue;const i=a.containsTile(h,f,b);i&&d.push(i)}return d}getVisibleCoordinates(a){const b=this.getRenderableIds(a).map(a=>this._tiles[a].tileID);for(const c of b)c.projMatrix=this.transform.calculateProjMatrix(c.toUnwrapped());return b}hasTransition(){if(this._source.hasTransition())return!0;if(kw(this._source.type))for(const a in this._tiles){const b=this._tiles[a];if(void 0!==b.fadeEndTime&&b.fadeEndTime>=ax.now())return!0}return!1}setFeatureState(a,b,c){this._state.updateState(a=a||"_geojsonTileLayer",b,c)}removeFeatureState(a,b,c){this._state.removeFeatureState(a=a||"_geojsonTileLayer",b,c)}getFeatureState(a,b){return this._state.getState(a=a||"_geojsonTileLayer",b)}setDependencies(a,b,c){const d=this._tiles[a];d&&d.setDependencies(b,c)}reloadTilesForDependencies(a,b){for(const c in this._tiles)this._tiles[c].hasDependency(a,b)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(a,b))}_preloadTiles(a,b){const c=new Map,d=Array.isArray(a)?a:[a],f=this.map.painter.terrain,g=this.usedForTerrain&&f?f.getScaledDemTileSize():this._source.tileSize;for(const h of d){const i=h.coveringTiles({tileSize:g,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const j of i)c.set(j.key,j);this.usedForTerrain&&h.updateElevation(!1)}const k=Array.from(c.values()),l="raster"===this._source.type||"raster-dem"===this._source.type;$(k,(a,b)=>{const c=new kU(a,this._source.tileSize*a.overscaleFactor(),this.transform.tileZoom,this.map.painter,l);this._loadTile(c,a=>{"raster-dem"===this._source.type&&c.dem&&this._backfillDEM(c),b(a,c)})},b)}}function kv(a,b){const c=Math.abs(2*a.wrap)- +(a.wrap<0),d=Math.abs(2*b.wrap)- +(b.wrap<0);return a.overscaledZ-b.overscaledZ||d-c||b.canonical.y-a.canonical.y||b.canonical.x-a.canonical.x}function kw(a){return"raster"===a||"image"===a||"video"===a}ku.maxOverzooming=10,ku.maxUnderzooming=3;class kx{constructor(a,b,c){this._demTile=a,this._dem=this._demTile.dem,this._scale=b,this._offset=c}static create(a,b,c){const d=c||a.findDEMTileFor(b);if(!d||!d.dem)return;const f=d.dem,g=d.tileID,h=1<=0&&l[3]>=0&&i.insert(h,l[0],l[1],l[2],l[3])}}loadVTLayers(){if(!this.vtLayers)for(const a in this.vtLayers=new h1.VectorTile(new iE(this.rawTileData)).layers,this.sourceLayerCoder=new kj(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[a]=[];return this.vtLayers}query(a,b,c,d){this.loadVTLayers();const f=a.params||{},g=dz(f.filter),h=a.tileResult,i=a.transform,j=h.bufferedTilespaceBounds,k=this.grid.query(j.min.x,j.min.y,j.max.x,j.max.y,(a,b,c,d)=>gS(h.bufferedTilespaceGeometry,a,b,c,d));k.sort(kA);let l=null;i.elevation&&k.length>0&&(l=kx.create(i.elevation,this.tileID));const m={};let n;for(let o=0;o(r||(r=gF(b,this.tileID.canonical,a.tileTransform)),c.queryIntersectsFeature(h,b,d,r,this.z,a.transform,a.pixelPosMatrix,l,f)))}return m}loadMatchingFeature(a,b,c,d,f,g,h,i,j){const{featureIndex:k,bucketIndex:l,sourceLayerIndex:m,layoutVertexArrayOffset:n}=b,o=this.bucketLayerIDs[l];if(d&&!function(a,b){for(let c=0;c=0)return!0;return!1}(d,o))return;const p=this.sourceLayerCoder.decode(m),q=this.vtLayers[p].feature(k);if(c.needGeometry){const r=gG(q,!0);if(!c.filter(new e2(this.tileID.overscaledZ),r,this.tileID.canonical))return}else if(!c.filter(new e2(this.tileID.overscaledZ),q))return;const s=this.getId(q,p);for(let u=0;ud.indexOf(v))continue;const w=g[v];if(!w)continue;let x={};void 0!==s&&i&&(x=i.getState(w.sourceLayer||"_geojsonTileLayer",s));const y=aa({},h[v]);y.paint=kz(y.paint,w.paint,q,x,f),y.layout=kz(y.layout,w.layout,q,x,f);const z=!j||j(q,w,x,n);if(!z)continue;const A=new kk(q,this.z,this.x,this.y,s);A.layer=y;let B=a[v];void 0===B&&(B=a[v]=[]),B.push({featureIndex:k,feature:A,intersectionZ:z})}}lookupSymbolFeatures(a,b,c,d,f,g,h,i){const j={};this.loadVTLayers();const k=dz(f);for(const l of a)this.loadMatchingFeature(j,{bucketIndex:c,sourceLayerIndex:d,featureIndex:l,layoutVertexArrayOffset:0},k,g,h,i,b);return j}loadFeature(a){const{featureIndex:b,sourceLayerIndex:c}=a;this.loadVTLayers();const d=this.sourceLayerCoder.decode(c),f=this.vtFeatures[d];if(f[b])return f[b];const g=this.vtLayers[d].feature(b);return f[b]=g,g}hasLayer(a){for(const b of this.bucketLayerIDs)for(const c of b)if(a===c)return!0;return!1}getId(a,b){let c=a.id;return this.promoteId&&"boolean"==typeof(c=a.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[b]])&&(c=Number(c)),c}}function kz(a,b,c,d,f){return ai(a,(a,g)=>{const h=b instanceof e9?b.get(g):null;return h&&h.evaluate?h.evaluate(c,d,f):h})}function kA(a,b){return b-a}ec("FeatureIndex",ky,{omit:["rawTileData","sourceLayerCoder"]});var kB=fk([{name:"a_pos",type:"Int16",components:2},]);const kC=new Uint16Array(8184);for(let kD=0;kD<2046;kD++){let kE=kD+2,kF=0,kG=0,kH=0,kI=0,kJ=0,kK=0;for(1&kE?kH=kI=kJ=32:kF=kG=kK=32;(kE>>=1)>1;){const kL=kF+kH>>1,kM=kG+kI>>1;1&kE?(kH=kF,kI=kG,kF=kJ,kG=kK):(kF=kH,kG=kI,kH=kJ,kI=kK),kJ=kL,kK=kM}const kN=4*kD;kC[kN+0]=kF,kC[kN+1]=kG,kC[kN+2]=kH,kC[kN+3]=kI}const kO=new Uint16Array(2178),kP=new Uint8Array(1089),kQ=new Uint16Array(1089);function kR(a){return 0===a?-.03125:32===a?.03125:0}var kS=fk([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const kT={type:2,extent:8192,loadGeometry:()=>[[new g(0,0),new g(8193,0),new g(8193,8193),new g(0,8193),new g(0,0),],]};class kU{constructor(a,b,c,d,f){this.tileID=a,this.uid=ac(),this.uses=0,this.tileSize=b,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=f,this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection)}registerFadeDuration(a){const b=a+this.timeAdded;bb.getLayer(a)).filter(Boolean);if(0!==f.length)for(const g of(d.layers=f,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(a=>f.filter(b=>b.id===a)[0])),f))c[g.id]=d}return c}(a.buckets,b.style),this.hasSymbolBuckets=!1,this.buckets){const f=this.buckets[d];if(f instanceof jS){if(this.hasSymbolBuckets=!0,!c)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const h=this.buckets[g];if(h instanceof jS&&h.hasRTLText){this.hasRTLText=!0,e1.isLoading()||e1.isLoaded()||"deferred"!==e_()||e0();break}}for(const i in this.queryPadding=0,this.buckets){const j=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,b.style.getLayer(i).queryRadius(j))}a.imageAtlas&&(this.imageAtlas=a.imageAtlas),a.glyphAtlasImage&&(this.glyphAtlasImage=a.glyphAtlasImage),a.lineAtlas&&(this.lineAtlas=a.lineAtlas)}else this.collisionBoxArray=new fK}unloadVectorData(){if(this.hasData()){for(const a in this.buckets)this.buckets[a].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._tileDebugIndexBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this.globeGridBuffer&&(this.globeGridBuffer.destroy(),this.globeGridBuffer=null),this.globePoleBuffer&&(this.globePoleBuffer.destroy(),this.globePoleBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(a){return this.buckets[a.id]}upload(a){for(const b in this.buckets){const c=this.buckets[b];c.uploadPending()&&c.upload(a)}const d=a.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new j6(a,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new j6(a,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new j6(a,this.lineAtlas.image,d.ALPHA),this.lineAtlas.uploaded=!0)}prepare(a){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(a,this.imageAtlasTexture)}queryRenderedFeatures(a,b,c,d,f,g,h,i){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:d,pixelPosMatrix:h,transform:g,params:f,tileTransform:this.tileTransform},a,b,c):{}}querySourceFeatures(a,b){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),f=b?b.sourceLayer:"",g=d._geojsonTileLayer||d[f];if(!g)return;const h=dz(b&&b.filter),{z:i,x:j,y:k}=this.tileID.canonical,l={z:i,x:j,y:k};for(let m=0;md)f=!1;else if(b){if(this.expirationTime=0;l--){const m=4*l,n=kC[m+0],o=kC[m+1],p=kC[m+2],q=kC[m+3],r=n+p>>1,s=o+q>>1,u=r+s-o,v=s+n-r,w=33*o+n,x=33*q+p,y=33*s+r,z=Math.hypot((kO[2*w+0]+kO[2*x+0])/2-kO[2*y+0],(kO[2*w+1]+kO[2*x+1])/2-kO[2*y+1])>=16;if(kP[y]=kP[y]||(z?1:0),l<1022){const A=(o+v>>1)*33+(n+u>>1),B=(q+v>>1)*33+(p+u>>1);kP[y]=kP[y]||kP[A]||kP[B]}}const C=new fn,D=new fy;let E=0;function F(a,b){const c=33*b+a;return 0===kQ[c]&&(C.emplaceBack(kO[2*c+0],kO[2*c+1],8192*a/32,8192*b/32),kQ[c]=++E),kQ[c]-1}function G(a,b,c,d,f,g){const h=a+c>>1,i=b+d>>1;if(Math.abs(a-f)+Math.abs(b-g)>1&&kP[33*i+h])G(f,g,a,b,h,i),G(c,d,f,g,h,i);else{const j=F(a,b),k=F(c,d),l=F(f,g);D.emplaceBack(j,k,l)}}return G(0,0,32,32,32,0),G(32,32,0,0,0,32),{vertices:C,indices:D}}(this.tileID.canonical,b);d=g.vertices,f=g.indices}else{for(const{x:h,y:i}of(d=new fn,f=new fy,c))d.emplaceBack(h,i,0,0);const j=hg(d.int16,void 0,4);for(let k=0;k{const d=65*c+b;a.emplaceBack(d+1,d,d+65),a.emplaceBack(d+65,d+65+1,d+1)};for(let c=0;c<64;c++)for(let d=0;d<64;d++)b(d,c);return a}getWirefameBuffer(a){if(!this.wireframeSegments){const b=this._createWireframeGrid();this.wireframeIndexBuffer=a.createIndexBuffer(b),this.wireframeSegments=gq.simpleSegment(0,0,4096,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const a=new fF,b=(b,c)=>{const d=65*c+b;a.emplaceBack(d,d+1),a.emplaceBack(d,d+65),a.emplaceBack(d,d+65+1)};for(let c=0;c<64;c++)for(let d=0;d<64;d++)b(d,c);return a}}function k9(a,b){if(!b.isReprojectedInTileSpace)return{scale:1<v&&(w(a,k,d,f,i,j),w(k,c,i,j,g,h))}w(m,n,d,g,f,g),w(n,o,f,g,f,h),w(o,p,f,h,d,h),w(p,m,d,h,d,g),q-=v,r-=v,s+=v,u+=v;const x=1/Math.max(s-q,u-r);return{scale:x,x:q*x,y:r*x,x2:s*x,y2:u*x,projection:b}}class la{constructor(a){const b={},c=[];for(const d in a){const f=a[d],g=b[d]={};for(const h in f.glyphs){const i=f.glyphs[+h];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const j=i.metrics.localGlyph?2:1,k={x:0,y:0,w:i.bitmap.width+2*j,h:i.bitmap.height+2*j};c.push(k),g[h]=k}}const{w:l,h:m}=iY(c),n=new g9({width:l||1,height:m||1});for(const o in a){const p=a[o];for(const q in p.glyphs){const r=p.glyphs[+q];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const s=b[o][q],u=r.metrics.localGlyph?2:1;g9.copy(r.bitmap,n,{x:0,y:0},{x:s.x+u,y:s.y+u},r.bitmap)}}this.image=n,this.positions=b}}ec("GlyphAtlas",la);class lb{constructor(a){this.tileID=new kd(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),this.tileZoom=a.tileZoom,this.uid=a.uid,this.zoom=a.zoom,this.canonical=a.tileID.canonical,this.pixelRatio=a.pixelRatio,this.tileSize=a.tileSize,this.source=a.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=a.showCollisionBoxes,this.collectResourceTiming=!!a.collectResourceTiming,this.returnDependencies=!!a.returnDependencies,this.promoteId=a.promoteId,this.enableTerrain=!!a.enableTerrain,this.isSymbolTile=a.isSymbolTile,this.tileTransform=k9(a.tileID.canonical,a.projection),this.projection=a.projection}parse(a,b,c,d,f){this.status="parsing",this.data=a,this.collisionBoxArray=new fK;const g=new kj(Object.keys(a.layers).sort()),h=new ky(this.tileID,this.promoteId);h.bucketLayerIDs=[];const i={},j=new j7(256,256),k={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:j,availableImages:c},l=b.familiesBySource[this.source];for(const m in l){const n=a.layers[m];if(!n)continue;let o=!1,p=!1;for(const q of l[m])"symbol"===q[0].type?o=!0:p=!0;if(!0===this.isSymbolTile&&!o|| !1===this.isSymbolTile&&!p)continue;1===n.version&&am(`Vector tile source "${this.source}" layer "${m}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const r=g.encode(m),s=[];for(let u=0;u=y.maxzoom||"none"!==y.visibility&&(lc(x,this.zoom,c),(i[y.id]=y.createBucket({index:h.bucketLayerIDs.length,layers:x,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:r,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:c})).populate(s,k,this.tileID.canonical,this.tileTransform),h.bucketLayerIDs.push(x.map(a=>a.id)))}}let z,A,B,C;j.trim();const D={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},E=ai(k.glyphDependencies,a=>Object.keys(a).map(Number));Object.keys(E).length?d.send("getGlyphs",{uid:this.uid,stacks:E},(a,b)=>{z||(z=a,A=b,H.call(this))},void 0,!1,D):A={};const F=Object.keys(k.iconDependencies);F.length?d.send("getImages",{icons:F,source:this.source,tileID:this.tileID,type:"icons"},(a,b)=>{z||(z=a,B=b,H.call(this))},void 0,!1,D):B={};const G=Object.keys(k.patternDependencies);function H(){if(z)return f(z);if(A&&B&&C){const a=new la(A),b=new i$(B,C);for(const d in i){const g=i[d];g instanceof jS?(lc(g.layers,this.zoom,c),jC(g,A,a.positions,B,b.iconPositions,this.showCollisionBoxes,c,this.tileID.canonical,this.tileZoom,this.projection),g.projection=this.projection.name):g.hasPattern&&(g instanceof ij||g instanceof hP||g instanceof h5)&&(lc(g.layers,this.zoom,c),g.addFeatures(k,this.tileID.canonical,b.patternPositions,c))}this.status="done",f(null,{buckets:_(i).filter(a=>!a.isEmpty()),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:a.image,lineAtlas:j,imageAtlas:b,glyphMap:this.returnDependencies?A:null,iconMap:this.returnDependencies?B:null,glyphPositions:this.returnDependencies?a.positions:null})}}G.length?d.send("getImages",{icons:G,source:this.source,tileID:this.tileID,type:"patterns"},(a,b)=>{z||(z=a,C=b,H.call(this))},void 0,!1,D):C={},H.call(this)}}function lc(a,b,c){const d=new e2(b);for(const f of a)f.recalculate(d,c)}class ld{constructor(a){this.entries={},this.scheduler=a}request(a,b,c,d){const f=this.entries[a]=this.entries[a]||{callbacks:[]};if(f.result){const[g,h]=f.result;return this.scheduler?this.scheduler.add(()=>{d(g,h)},b):d(g,h),()=>{}}return f.callbacks.push(d),f.cancel||(f.cancel=c((c,d)=>{for(const g of(f.result=[c,d],f.callbacks))this.scheduler?this.scheduler.add(()=>{g(c,d)},b):g(c,d);setTimeout(()=>delete this.entries[a],3e3)})),()=>{f.result||(f.callbacks=f.callbacks.filter(a=>a!==d),f.callbacks.length||(f.cancel(),delete this.entries[a]))}}}function le(a,b,c){const d=JSON.stringify(a.request);return a.data&&(this.deduped.entries[d]={result:[null,a.data]}),this.deduped.request(d,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom},b=>{const d=a7(a.request,(a,d,f,g)=>{a?b(a):d&&b(null,{vectorTile:c?void 0:new h1.VectorTile(new iE(d)),rawData:d,cacheControl:f,expires:g})});return()=>{d.cancel(),b()}},b)}const lf=l(new Float64Array(16));class lg{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lf}createTileMatrix(a){let b,c,d;const f=a.canonical,g=l(new Float64Array(16)),h=this._tr.projection;if(h.isReprojectedInTileSpace){const i=k9(f,h);b=1,c=i.x+a.wrap*i.scale,d=i.y,o(g,g,[b/i.scale,b/i.scale,this._tr.pixelsPerMeter/this._worldSize,])}else b=this._worldSize/this._tr.zoomScale(f.z),c=(f.x+Math.pow(2,f.z)*a.wrap)*b,d=f.y*b;return n(g,g,[c,d,0]),o(g,g,[b/8192,b/8192,1]),g}pointCoordinate(a,b,c){const d=this._tr.horizonLineFromTop(!1),f=new g(a,Math.max(d,b));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(f,c))}upVector(){return[0,0,1]}upVectorScale(){return 1}}var lh={name:"albers",range:[4,7],center:[-96,37.5],parallels:[29.5,45.5],zAxisUnit:"meters",conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&O(this.parallels,this.constants.parallels))return;const a=Math.sin(this.parallels[0]*P),b=(a+Math.sin(this.parallels[1]*P))/2,c=1+a*(2*b-a),d=Math.sqrt(c)/b;this.constants={n:b,c:c,r0:d,parallels:this.parallels}},project(a,b){this.initializeConstants();const c=(a-this.center[0])*P,{n:d,c:f,r0:g}=this.constants,h=Math.sqrt(f-2*d*Math.sin(b*P))/d;return{x:h*Math.sin(c*d),y:h*Math.cos(c*d)-g,z:0}},unproject(a,b){this.initializeConstants();const{n:c,c:d,r0:f}=this.constants,g=f+b;let h=Math.atan2(a,Math.abs(g))*Math.sign(g);g*c<0&&(h-=Math.PI*Math.sign(a)*Math.sign(g));const i=this.center[0]*P*c;h=Z(h,-Math.PI-i,Math.PI-i);const j=h/c*Q+this.center[0],k=Math.asin(X((d-(a*a+g*g)*c*c)/(2*c),-1,1)),l=X(k*Q,-85.051129,85.051129);return new gs(j,l)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)};const li=Math.sqrt(3)/2;var lj={name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b=b/180*Math.PI,a=a/180*Math.PI;const c=Math.asin(li*Math.sin(b)),d=c*c,f=d*d*d;return{x:.5*(a*Math.cos(c)/(li*(1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d)))/Math.PI+.5),y:1-.5*(c*(1.340264+ -.081106*d+f*(893e-6+.003796*d))/Math.PI+1),z:0}},unproject(a,b){a=(2*a-.5)*Math.PI;let c=b=(2*(1-b)-1)*Math.PI,d=c*c,f=d*d*d;for(let g,h,i,j=0;j<12&&(h=c*(1.340264+ -.081106*d+f*(893e-6+.003796*d))-b,i=1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d),g=h/i,c=X(c-g,-Math.PI/3,Math.PI/3),d=c*c,f=d*d*d,!(1e-12>Math.abs(g)));++j);const k=li*a*(1.340264+ -.24331799999999998*d+f*(.0062510000000000005+.034164*d))/Math.cos(c),l=Math.asin(Math.sin(c)/li),m=X(180*k/Math.PI,-180,180),n=X(180*l/Math.PI,-85.051129,85.051129);return new gs(m,n)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)},lk={name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(a,b)=>({x:.5+a/360,y:.5-b/360,z:0}),unproject(a,b){const c=X(360*(.5-b),-85.051129,85.051129);return new gs(360*(a-.5),c)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)};const ll=Math.PI/2;function lm(a){return Math.tan((ll+a)/2)}var ln,lo={name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&O(this.parallels,this.constants.parallels))return;const a=this.parallels[0]*P,b=this.parallels[1]*P,c=Math.cos(a),d=a===b?Math.sin(a):Math.log(c/Math.cos(b))/Math.log(lm(b)/lm(a)),f=c*Math.pow(lm(a),d)/d;this.constants={n:d,f:f,parallels:this.parallels}},project(a,b){this.initializeConstants(),b*=P,a=(a-this.center[0])*P;const{n:c,f:d}=this.constants;d>0?b< -ll+1e-6&&(b=-ll+1e-6):b>ll-1e-6&&(b=ll-1e-6);const f=d/Math.pow(lm(b),c),g=f*Math.sin(c*a),h=d-f*Math.cos(c*a);return{x:.5*(g/Math.PI+.5),y:1-.5*(h/Math.PI+.5),z:0}},unproject(a,b){this.initializeConstants(),a=(2*a-.5)*Math.PI,b=(2*(1-b)-.5)*Math.PI;const{n:c,f:d}=this.constants,f=d-b,g=Math.sign(f),h=Math.sign(c)*Math.sqrt(a*a+f*f);let i=Math.atan2(a,Math.abs(f))*g;f*c<0&&(i-=Math.PI*Math.sign(a)*g);const j=X(i/c*Q+this.center[0],-180,180),k=X((2*Math.atan(Math.pow(d/h,1/c))-ll)*Q,-85.051129,85.051129);return new gs(j,k)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)},lp={name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(a,b)=>({x:gv(a),y:gw(b),z:0}),unproject(a,b){const c=gy(a),d=gz(b);return new gs(c,d)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)};const lq=85.051129*P;var lr={name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(a,b){const c=(b*=P)*b,d=c*c;return{x:.5*((a*=P)*(.8707-.131979*c+d*(d*(.003971*c-.001529*d)-.013791))/Math.PI+.5),y:1-.5*(b*(1.007226+c*(.015085+d*(.028874*c-.044475-.005916*d)))/Math.PI+1),z:0}},unproject(a,b){a=(2*a-.5)*Math.PI;let c=b=(2*(1-b)-1)*Math.PI,d=25,f=0,g=c*c;do{g=c*c;const h=g*g;f=(c*(1.007226+g*(.015085+h*(.028874*g-.044475-.005916*h)))-b)/(1.007226+g*(.045255+h*(.259866*g-.311325-.005916*11*h))),c=X(c-f,-lq,lq)}while(Math.abs(f)>1e-6&& --d>0)g=c*c;const i=X(a/(.8707+g*(g*(g*g*g*(.003971-.001529*g)-.013791)-.131979))*Q,-180,180),j=c*Q;return new gs(i,j)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)};const ls=85.051129*P,lt={albers:lh,equalEarth:lj,equirectangular:lk,lambertConformalConic:lo,mercator:lp,naturalEarth:lr,winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(a,b){b*=P,a*=P;const c=Math.cos(b),d=2/Math.PI,f=Math.acos(c*Math.cos(a/2)),g=Math.sin(f)/f,h=.5*(a*d+2*c*Math.sin(a/2)/g)||0,i=.5*(b+Math.sin(b)/g)||0;return{x:.5*(h/Math.PI+.5),y:1-.5*(i/Math.PI+1),z:0}},unproject(a,b){let c=a=(2*a-.5)*Math.PI,d=b=(2*(1-b)-1)*Math.PI,f=25,g=0,h=0;do{const i=Math.cos(d),j=Math.sin(d),k=2*j*i,l=j*j,m=i*i,n=Math.cos(c/2),o=Math.sin(c/2),p=2*n*o,q=o*o,r=1-m*n*n,s=r?1/r:0,u=r?Math.acos(i*n)*Math.sqrt(1/r):0,v=.5*(2*u*i*o+2*c/Math.PI)-a,w=.5*(u*j+d)-b,x=.5*s*(m*q+u*i*n*l)+1/Math.PI,y=s*(p*k/4-u*j*o),z=.125*s*(k*o-u*j*m*p),A=.5*s*(l*n+u*q*i)+.5,B=y*z-A*x;g=(w*y-v*A)/B,h=(v*z-w*x)/B,c=X(c-g,-Math.PI,Math.PI),d=X(d-h,-ls,ls)}while((Math.abs(g)>1e-6||Math.abs(h)>1e-6)&& --f>0)return new gs(c*Q,d*Q)},projectTilePoint:(a,b)=>({x:a,y:b,z:0}),locationPoint:(a,b)=>a._coordinatePoint(a.locationCoordinate(b),!1),pixelsPerMeter:(a,b)=>1/gu(a)*b,farthestPixelDistance(a){return kY(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lg(a,b)}};a.ARRAY_TYPE=j,a.AUTH_ERR_MSG=aI,a.Aabb=g_,a.Actor=class{constructor(a,b,c){this.target=a,this.parent=b,this.mapId=c,this.callbacks={},this.cancelCallbacks={},ag(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ap()?a:i,this.scheduler=new class{constructor(){this.tasks={},this.taskQueue=[],ag(["process"],this),this.invoker=new class{constructor(a){this._callback=a,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(){delete this._channel,this._callback=()=>{}}}(this.process),this.nextId=0}add(a,b){const c=this.nextId++,d=function({type:a,isSymbolTile:b,zoom:c}){return c=c||0,"message"===a?0:"maybePrepare"!==a||b?"parseTile"!==a||b?"parseTile"===a&&b?300-c:"maybePrepare"===a&&b?400-c:500:200-c:100-c}(b);return 0===d?(ap(),a(),{cancel:()=>{}}):(this.tasks[c]={fn:a,metadata:b,priority:d,id:c},this.taskQueue.push(c),this.invoker.trigger(),{cancel:()=>{delete this.tasks[c]}})}process(){ap();{if(this.taskQueue=this.taskQueue.filter(a=>!!this.tasks[a]),!this.taskQueue.length)return;const a=this.pick();if(null===a)return;const b=this.tasks[a];if(delete this.tasks[a],this.taskQueue.length&&this.invoker.trigger(),!b)return;b.fn()}}pick(){let a=null,b=1/0;for(let c=0;c{c&&delete this.callbacks[h],this.target.postMessage({id:h,type:"",targetMapId:d,sourceMapId:this.mapId})}}}receive(a){const b=a.data,c=b.id;if(c&&(!b.targetMapId||this.mapId===b.targetMapId)){if(""===b.type){const d=this.cancelCallbacks[c];delete this.cancelCallbacks[c],d&&d.cancel()}else if(b.mustQueue||ap()){const f=this.callbacks[c];this.cancelCallbacks[c]=this.scheduler.add(()=>this.processTask(c,b),f&&f.metadata||{type:"message"})}else this.processTask(c,b)}}processTask(a,b){if(""===b.type){const c=this.callbacks[a];delete this.callbacks[a],c&&(b.error?c(eh(b.error)):c(null,eh(b.data)))}else{const d=av(this.globalScope)?void 0:[],f=b.hasCallback?(b,c)=>{delete this.cancelCallbacks[a],this.target.postMessage({id:a,type:"",sourceMapId:this.mapId,error:b?eg(b):null,data:eg(c,d)},d)}:a=>{},g=eh(b.data);if(this.parent[b.type])this.parent[b.type](b.sourceMapId,g,f);else if(this.parent.getWorkerSource){const h=b.type.split(".");this.parent.getWorkerSource(b.sourceMapId,h[0],g.source)[h[1]](g,f)}else f(Error(`Could not find function ${b.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.CanonicalTileID=kb,a.Color=bK,a.ColorMode=kh,a.CullFaceMode=ki,a.DEMData=kt,a.DataConstantProperty=fa,a.DedupedRequest=ld,a.DepthMode=kf,a.EXTENT=8192,a.Elevation=class{getAtPointOrZero(a,b=0){return this.getAtPoint(a,b)||0}getAtPoint(a,b,c=!0){null==b&&(b=null);const d=this._source();if(!d||a.y<0||a.y>1)return b;const f=d.getSource().maxzoom,g=1<{const d=this.getAtTileOffset(a,c.x,c.y),f=b.upVector(a.canonical,c.x,c.y);return B(f,f,d*b.upVectorScale(a.canonical)),f}}getForTilePoints(a,b,c,d){const f=kx.create(this,a,d);return!!f&&(b.forEach(a=>{a[2]=this.exaggeration()*f.getElevationAt(a[0],a[1],c)}),!0)}getMinMaxForTile(a){const b=this.findDEMTileFor(a);if(!b||!b.dem)return null;const c=b.dem.tree,d=b.tileID,f=1<Math.abs(d))return!1;const f=((a[0]-this.pos[0])*b[0]+(a[1]-this.pos[1])*b[1]+(a[2]-this.pos[2])*b[2])/d;return c[0]=this.pos[0]+this.dir[0]*f,c[1]=this.pos[1]+this.dir[1]*f,c[2]=this.pos[2]+this.dir[2]*f,!0}closestPointOnSphere(a,b,c){var d,f,g,h,i,j,k,l;if(d=this.pos,f=a,g=d[0],h=d[1],i=d[2],j=f[0],k=f[1],l=f[2],Math.abs(g-j)<=1e-6*Math.max(1,Math.abs(g),Math.abs(j))&&Math.abs(h-k)<=1e-6*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(i-l)<=1e-6*Math.max(1,Math.abs(i),Math.abs(l))||0===b)return c[0]=c[1]=c[2]=0,!1;const[m,n,o]=this.dir,p=this.pos[0]-a[0],q=this.pos[1]-a[1],r=this.pos[2]-a[2],s=m*m+n*n+o*o,u=2*(p*m+q*n+r*o),v=u*u-4*s*(p*p+q*q+r*r-b*b);if(v<0){const w=Math.max(-u/2,0),x=p+m*w,y=q+n*w,z=r+o*w,A=Math.hypot(x,y,z);return c[0]=x*b/A,c[1]=y*b/A,c[2]=z*b/A,!1}{const B=(-u-Math.sqrt(v))/(2*s);if(B<0){const C=Math.hypot(p,q,r);return c[0]=p*b/C,c[1]=q*b/C,c[2]=r*b/C,!1}return c[0]=p+m*B,c[1]=q+n*B,c[2]=r+o*B,!0}}},a.RequestManager=class{constructor(a,b,c){this._transformRequestFn=a,this._customAccessToken=b,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const a=function(){let a="";for(let b=0;b<10;b++)a+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",a].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=a.token,this._skuTokenExpiresAt=a.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(a,b){return this._transformRequestFn&&this._transformRequestFn(a,b)||{url:a}}normalizeStyleURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||b)}normalizeGlyphsURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||b)}normalizeSourceURL(a,b){if(!aJ(a))return a;const c=aM(a);return c.path=`/v4/${c.authority}.json`,c.params.push("secure"),this._makeAPIURL(c,this._customAccessToken||b)}normalizeSpriteURL(a,b,c,d){const f=aM(a);return aJ(a)?(f.path=`/styles/v1${f.path}/sprite${b}${c}`,this._makeAPIURL(f,this._customAccessToken||d)):(f.path+=`${b}${c}`,aN(f))}normalizeTileURL(a,b,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),a&&!aJ(a))return a;const d=aM(a);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${b||c&&"raster"!==d.authority&&512===c?"@2x":""}${aC.supported?".webp":"$1"}`),"raster"===d.authority?d.path=`/${az.RASTER_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${az.TILE_URL_VERSION}${d.path}`);const f=this._customAccessToken||function(a){for(const b of a){const c=b.match(/^access_token=(.*)$/);if(c)return c[1]}return null}(d.params)||az.ACCESS_TOKEN;return az.REQUIRE_ACCESS_TOKEN&&f&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,f)}canonicalizeTileURL(a,b){const c=aM(a);if(!c.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!c.path.match(/\.[\w]+$/))return a;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${az.RASTER_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${az.TILE_URL_VERSION}/`,"")}`;let f=c.params;return b&&(f=f.filter(a=>!a.match(/^access_token=/))),f.length&&(d+=`?${f.join("&")}`),d}canonicalizeTileset(a,b){const c=!!b&&aJ(b),d=[];for(const f of a.tiles||[])aK(f)?d.push(this.canonicalizeTileURL(f,c)):d.push(f);return d}_makeAPIURL(a,b){const c="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",d=aM(az.API_URL);if(a.protocol=d.protocol,a.authority=d.authority,"http"===a.protocol){const f=a.params.indexOf("secure");f>=0&&a.params.splice(f,1)}if("/"!==d.path&&(a.path=`${d.path}${a.path}`),!az.REQUIRE_ACCESS_TOKEN)return aN(a);if(b=b||az.ACCESS_TOKEN,!this._silenceAuthErrors){if(!b)throw Error(`An API access token is required to use Mapbox GL. ${c}`);if("s"===b[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return a.params=a.params.filter(a=>-1===a.indexOf("access_token")),a.params.push(`access_token=${b||""}`),aN(a)}},a.ResourceType=a3,a.SegmentVector=gq,a.SourceCache=ku,a.StencilMode=kg,a.StructArrayLayout1ui2=fG,a.StructArrayLayout2f1f2i16=fw,a.StructArrayLayout2i4=fm,a.StructArrayLayout2ui4=fF,a.StructArrayLayout3f12=fp,a.StructArrayLayout3ui6=fy,a.StructArrayLayout4i8=fn,a.Texture=j6,a.Tile=kU,a.Transitionable=e5,a.Uniform1f=f3,a.Uniform1i=class extends f2{constructor(a,b){super(a,b),this.current=0}set(a){this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}},a.Uniform2f=class extends f2{constructor(a,b){super(a,b),this.current=[0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1]))}},a.Uniform3f=class extends f2{constructor(a,b){super(a,b),this.current=[0,0,0]}set(a){a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2]))}},a.Uniform4f=f4,a.UniformColor=f5,a.UniformMatrix2f=class extends f2{constructor(a,b){super(a,b),this.current=f8}set(a){for(let b=0;b<4;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix2fv(this.location,!1,a);break}}},a.UniformMatrix3f=class extends f2{constructor(a,b){super(a,b),this.current=f7}set(a){for(let b=0;b<9;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix3fv(this.location,!1,a);break}}},a.UniformMatrix4f=class extends f2{constructor(a,b){super(a,b),this.current=f6}set(a){if(a[12]!==this.current[12]||a[0]!==this.current[0])return this.current=a,void this.gl.uniformMatrix4fv(this.location,!1,a);for(let b=1;b<16;b++)if(a[b]!==this.current[b]){this.current=a,this.gl.uniformMatrix4fv(this.location,!1,a);break}}},a.UnwrappedTileID=kc,a.ValidationError=bl,a.VectorTileWorkerSource=class extends bj{constructor(a,b,c,d,f){super(),this.actor=a,this.layerIndex=b,this.availableImages=c,this.loadVectorData=f||le,this.loading={},this.loaded={},this.deduped=new ld(a.scheduler),this.isSpriteLoaded=d,this.scheduler=a.scheduler}loadTile(a,b){const c=a.uid,d=a&&a.request,f=d&&d.collectResourceTiming,g=this.loading[c]=new lb(a);g.abort=this.loadVectorData(a,(h,i)=>{const j=!this.loading[c];if(delete this.loading[c],j||h||!i)return g.status="done",j||(this.loaded[c]=g),b(h);const k=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl),g.vectorTile=i.vectorTile||new h1.VectorTile(new iE(k));const m=()=>{g.parse(g.vectorTile,this.layerIndex,this.availableImages,this.actor,(a,c)=>{if(a||!c)return b(a);const g={};if(f){const h=j9(d);h.length>0&&(g.resourceTiming=JSON.parse(JSON.stringify(h)))}b(null,aa({rawTileData:k.slice(0)},c,l,g))})};this.isSpriteLoaded?m():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(m,{type:"parseTile",isSymbolTile:a.isSymbolTile,zoom:a.tileZoom}):m()}),this.loaded=this.loaded||{},this.loaded[c]=g})}reloadTile(a,b){const c=this.loaded,d=a.uid,f=this;if(c&&c[d]){const g=c[d];g.showCollisionBoxes=a.showCollisionBoxes,g.enableTerrain=!!a.enableTerrain,g.projection=a.projection;const h=(a,c)=>{const d=g.reloadCallback;d&&(delete g.reloadCallback,g.parse(g.vectorTile,f.layerIndex,this.availableImages,f.actor,d)),b(a,c)};"parsing"===g.status?g.reloadCallback=h:"done"===g.status&&(g.vectorTile?g.parse(g.vectorTile,this.layerIndex,this.availableImages,this.actor,h):h())}}abortTile(a,b){const c=a.uid,d=this.loading[c];d&&(d.abort&&d.abort(),delete this.loading[c]),b()}removeTile(a,b){const c=this.loaded,d=a.uid;c&&c[d]&&delete c[d],b()}},a.WritingMode=i_,a.ZoomHistory=ei,a.add=x,a.addDynamicAttributes=jO,a.adjoint=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8];return a[0]=h*l-i*k,a[1]=f*k-d*l,a[2]=d*i-f*h,a[3]=i*j-g*l,a[4]=c*l-f*j,a[5]=f*g-c*i,a[6]=g*k-h*j,a[7]=d*j-c*k,a[8]=c*h-d*g,a},a.asyncAll=$,a.bezier=V,a.bindAll=ag,a.boundsAttributes=kS,a.bufferConvexPolygon=function(a,b){const c=[];for(let d=0;da_&&(a.getActor().send("enforceCacheSizeLimit",a$),a2=0)},a.calculateGlobeMatrix=k7,a.calculateGlobeMercatorMatrix=function(a){const b=a.worldSize,c=X(a.center.lat,-85.051129,85.051129),d=new g(gv(a.center.lng)*b,gw(c)*b),f=1/gu(a.center.lat)*b,h=a.pixelsPerMeter,i=b/(f/a.pixelsPerMeter),j=l(new Float64Array(16));return n(j,j,[d.x,d.y,0]),o(j,j,[i,i,h]),j},a.clamp=X,a.clearTileCache=function(a){const b=i.caches.delete(aX);a&&b.catch(a).then(()=>a())},a.clipLine=jm,a.clone=function(a){var b=new j(16);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15],b},a.clone$1=ak,a.collisionCircleLayout=it,a.config=az,a.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a},a.create=function(){var a=new j(16);return j!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0),a[0]=1,a[5]=1,a[10]=1,a[15]=1,a},a.create$1=k,a.createExpression=dk,a.createLayout=fk,a.createStyleLayer=function(a){return"custom"===a.type?new jZ(a):new j0[a.type](a)},a.cross=F,a.degToRad=R,a.div=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a},a.dot=E,a.ease=W,a.easeCubicInOut=U,a.emitValidationErrors=d6,a.endsWith=ah,a.enforceCacheSizeLimit=function(a){a0(),aY&&aY.then(b=>{b.keys().then(c=>{for(let d=0;dg&&(d+=(a[f]-g)*(a[f]-g)),b[f]Math.abs(b.parallels[0]+b.parallels[1])){let c=function(a){const b=Math.max(.01,Math.cos(a*P)),c=1/(2*Math.max(Math.PI*b,1/b));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(a,d){const f=a*P*b,g=Math.sin(d*P)/b;return{x:f*c+.5,y:-g*c+.5,z:0}},unproject(a,d){const f=-(d-.5)/c,g=X((a-.5)/c*Q/b,-180,180),h=Math.asin(X(f*b,-1,1)),i=X(h*Q,-85.051129,85.051129);return new gs(g,i)}}}(b.parallels[0]);if("lambertConformalConic"===b.name){const{project:d,unproject:f}=lt.mercator;c={wrap:!0,supportsWorldCopies:!0,project:d,unproject:f}}return aa({},a,b,c)}return aa({},a,b)}(b,a):b},a.getRTLTextPluginStatus=e_,a.getReferrer=a5,a.getTilePoint=function(a,{x:b,y:c},d=0){return new g(((b-d)*a.scale-a.x)*8192,(c*a.scale-a.y)*8192)},a.getTileVec3=function(a,b,c=0){var d,f;return w(((b.x-c)*a.scale-a.x)*8192,(b.y*a.scale-a.y)*8192,(d=b.z,f=b.y,d*gu(gz(f))))},a.getVideo=function(a,b){const c=i.document.createElement("video");c.muted=!0,c.onloadstart=function(){b(null,c)};for(let d=0;d{}}},a.globeBuffersForTileMesh=function(a,b,c,d){const f=a.context,g=a.transform;let h=b.globeGridBuffer,i=b.globePoleBuffer;if(!h){const j=k8.createGridVertices(c.canonical);h=b.globeGridBuffer=f.createVertexBuffer(j,kX,!1)}if(!i){const k=k8.createPoleTriangleVertices(d,g.tileSize*d,0===c.canonical.y);i=b.globePoleBuffer=f.createVertexBuffer(k,kX,!1)}return[h,i]},a.globeDenormalizeECEF=k6,a.globeMatrixForTile=function(a,b){var c,d;const f=k6(k1(a)),g=((c=new Float64Array(16))[0]=(d=b)[0],c[1]=d[1],c[2]=d[2],c[3]=d[3],c[4]=d[4],c[5]=d[5],c[6]=d[6],c[7]=d[7],c[8]=d[8],c[9]=d[9],c[10]=d[10],c[11]=d[11],c[12]=d[12],c[13]=d[13],c[14]=d[14],c[15]=d[15],c);return r(g,g,f),g},a.globePoleMatrixForTile=function(a,b,c){const d=l(new Float64Array(16)),f=Math.pow(2,a.z),g=(a.x-f/2)/f*Math.PI*2,h=c.point,i=c.worldSize/(c.tileSize*f);return n(d,d,[h.x,h.y,-c.worldSize/Math.PI/2,]),o(d,d,[i,i,i]),p(d,d,-c._center.lat*P),q(d,d,-c._center.lng*P),q(d,d,g),b&&o(d,d,[1,-1,1]),d},a.globeTileBounds=k1,a.globeToMercatorTransition=function(a){return Y(5,6,a)},a.identity=l,a.identity$1=M,a.invert=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],s=b[15],u=c*i-d*h,v=c*j-f*h,w=c*k-g*h,x=d*j-f*i,y=d*k-g*i,z=f*k-g*j,A=l*q-m*p,B=l*r-n*p,C=l*s-o*p,D=m*r-n*q,E=m*s-o*q,F=n*s-o*r,G=u*F-v*E+w*D+x*C-y*B+z*A;return G?(a[0]=(i*F-j*E+k*D)*(G=1/G),a[1]=(f*E-d*F-g*D)*G,a[2]=(q*z-r*y+s*x)*G,a[3]=(n*y-m*z-o*x)*G,a[4]=(j*C-h*F-k*B)*G,a[5]=(c*F-f*C+g*B)*G,a[6]=(r*w-p*z-s*v)*G,a[7]=(l*z-n*w+o*v)*G,a[8]=(h*E-i*C+k*A)*G,a[9]=(d*C-c*E-g*A)*G,a[10]=(p*y-q*w+s*u)*G,a[11]=(m*w-l*y-o*u)*G,a[12]=(i*B-h*D-j*A)*G,a[13]=(c*D-d*B+f*A)*G,a[14]=(q*v-p*x-r*u)*G,a[15]=(l*x-m*v+n*u)*G,a):null},a.isMapAuthenticated=function(a){return aW.has(a)},a.isMapboxURL=aJ,a.latFromMercatorY=gz,a.len=v,a.length=v,a.length$1=function(a){return Math.hypot(a[0],a[1],a[2],a[3])},a.loadVectorTile=le,a.makeRequest=a6,a.mercatorXfromLng=gv,a.mercatorYfromLat=gw,a.mercatorZfromAltitude=gx,a.mul=r,a.mul$1=z,a.multiply=function(a,b,c){var d=b[0],f=b[1],g=b[2],h=b[3],i=b[4],j=b[5],k=b[6],l=b[7],m=b[8],n=c[0],o=c[1],p=c[2],q=c[3],r=c[4],s=c[5],u=c[6],v=c[7],w=c[8];return a[0]=n*d+o*h+p*k,a[1]=n*f+o*i+p*l,a[2]=n*g+o*j+p*m,a[3]=q*d+r*h+s*k,a[4]=q*f+r*i+s*l,a[5]=q*g+r*j+s*m,a[6]=u*d+v*h+w*k,a[7]=u*f+v*i+w*l,a[8]=u*g+v*j+w*m,a},a.multiply$1=m,a.multiply$2=z,a.nextPowerOfTwo=ae,a.normalize=D,a.normalize$1=function(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=c*c+d*d+f*f+g*g;return h>0&&(h=1/Math.sqrt(h)),a[0]=c*h,a[1]=d*h,a[2]=f*h,a[3]=g*h,a},a.number=cr,a.ortho=function(a,b,c,d,f,g,h){var i=1/(b-c),j=1/(d-f),k=1/(g-h);return a[0]=-2*i,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*j,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*k,a[11]=0,a[12]=(b+c)*i,a[13]=(f+d)*j,a[14]=(h+g)*k,a[15]=1,a},a.pbf=iE,a.perspective=function(a,b,c,d,f){var g,h=1/Math.tan(b/2);return a[0]=h/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=h,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=f&&f!==1/0?(a[10]=(f+d)*(g=1/(d-f)),a[14]=2*f*d*g):(a[10]=-1,a[14]=-2*d),a},a.pick=function(a,b){const c={};for(let d=0;dthis._layers[a.id]),k=j[0];if("none"===k.visibility)continue;const l=k.source||"";let m=this.familiesBySource[l];m||(m=this.familiesBySource[l]={});const n=k.sourceLayer||"_geojsonTileLayer";let o=m[n];o||(o=m[n]=[]),o.push(j)}}}const{ImageBitmap:f}=a.window;class g{loadTile(b,c){const{uid:d,encoding:g,rawImageData:h,padding:i,buildQuadTree:j}=b,k=f&&h instanceof f?this.getImageData(h,i):h;c(null,new a.DEMData(d,k,g,i<1,j))}getImageData(b,c){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const d=this.offscreenCanvasContext.getImageData(-c,-c,b.width+2*c,b.height+2*c);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:d.width,height:d.height},d.data)}}var h,i=function a(b,c){var d,f=b&&b.type;if("FeatureCollection"===f)for(d=0;d=Math.abs(i)?c-j+i:i-j+c,c=j}c+d>=0!= !!b&&a.reverse()}const l=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class m{constructor(b){this._feature=b,this.extent=a.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(1===this._feature.type){const b=[];for(const c of this._feature.geometry)b.push([new a.pointGeometry(c[0],c[1]),]);return b}{const d=[];for(const f of this._feature.geometry){const g=[];for(const h of f)g.push(new a.pointGeometry(h[0],h[1]));d.push(g)}return d}}toGeoJSON(a,b,c){return l.call(this,a,b,c)}}class n{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=b.length,this._features=b}feature(a){return new m(this._features[a])}}var o=a.vectorTile.VectorTileFeature,p=q;function q(a,b){this.options=b||{},this.features=a,this.length=a.length}function r(a,b){this.id="number"==typeof a.id?a.id:void 0,this.type=a.type,this.rawGeometry=1===a.type?[a.geometry]:a.geometry,this.properties=a.tags,this.extent=b||4096}q.prototype.feature=function(a){return new r(this.features[a],this.options.extent)},r.prototype.loadGeometry=function(){var b=this.rawGeometry;this.geometry=[];for(var c=0;c>31),b.writeVarint((o=q)<<1^o>>31),f+=p,g+=q}3===d&&b.writeVarint(15)}}function z(a,b){var c=typeof a;"string"===c?b.writeStringField(1,a):"boolean"===c?b.writeBooleanField(7,a):"number"===c&&(a%1!=0?b.writeDoubleField(3,a):a<0?b.writeSVarintField(6,a):b.writeVarintField(5,a))}function A(a,b,c,d,f,g){if(f-d<=c)return;const h=d+f>>1;B(a,b,h,d,f,g%2),A(a,b,c,d,h-1,g+1),A(a,b,c,h+1,f,g+1)}function B(a,b,c,d,f,g){for(;f>d;){if(f-d>600){const h=f-d+1,i=c-d+1,j=Math.log(h),k=.5*Math.exp(2*j/3),l=.5*Math.sqrt(j*k*(h-k)/h)*(i-h/2<0?-1:1);B(a,b,c,Math.max(d,Math.floor(c-i*k/h+l)),Math.min(f,Math.floor(c+(h-i)*k/h+l)),g)}const m=b[2*c+g];let n=d,o=f;for(C(a,b,d,c),b[2*f+g]>m&&C(a,b,d,f);nm;)o--}b[2*d+g]===m?C(a,b,d,o):C(a,b,++o,f),o<=c&&(d=o+1),c<=o&&(f=o-1)}}function C(a,b,c,d){D(a,c,d),D(b,2*c,2*d),D(b,2*c+1,2*d+1)}function D(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function E(a,b,c,d){const f=a-c,g=b-d;return f*f+g*g}s.fromVectorTileJs=u,s.fromGeojsonVt=function(a,b){b=b||{};var c={};for(var d in a)c[d]=new p(a[d].features,b),c[d].name=d,c[d].version=b.version,c[d].extent=b.extent;return u({layers:c})},s.GeoJSONWrapper=p;const F=a=>a[0],G=a=>a[1];class H{constructor(a,b=F,c=G,d=64,f=Float64Array){this.nodeSize=d,this.points=a;const g=a.length<65536?Uint16Array:Uint32Array,h=this.ids=new g(a.length),i=this.coords=new f(2*a.length);for(let j=0;j=c&&k<=f&&l>=d&&l<=g&&j.push(a[p]);continue}const q=Math.floor((o+n)/2);k=b[2*q],l=b[2*q+1],k>=c&&k<=f&&l>=d&&l<=g&&j.push(a[q]);const r=(m+1)%2;(0===m?c<=k:d<=l)&&(i.push(o),i.push(q-1),i.push(r)),(0===m?f>=k:g>=l)&&(i.push(q+1),i.push(n),i.push(r))}return j}(this.ids,this.coords,a,b,c,d,this.nodeSize)}within(a,b,c){return function(a,b,c,d,f,g){const h=[0,a.length-1,0],i=[],j=f*f;for(;h.length;){const k=h.pop(),l=h.pop(),m=h.pop();if(l-m<=g){for(let n=m;n<=l;n++)E(b[2*n],b[2*n+1],c,d)<=j&&i.push(a[n]);continue}const o=Math.floor((m+l)/2),p=b[2*o],q=b[2*o+1];E(p,q,c,d)<=j&&i.push(a[o]);const r=(k+1)%2;(0===k?c-f<=p:d-f<=q)&&(h.push(m),h.push(o-1),h.push(r)),(0===k?c+f>=p:d+f>=q)&&(h.push(o+1),h.push(l),h.push(r))}return i}(this.ids,this.coords,a,b,c,this.nodeSize)}}const I=Math.fround||(h=new Float32Array(1),a=>(h[0]=+a,h[0]));class J{constructor(a){this.options=R(Object.create({minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:a=>a}),a),this.trees=Array(this.options.maxZoom+1)}load(a){const{log:b,minZoom:c,maxZoom:d,nodeSize:f}=this.options;b&&console.time("total time");const g=`prepare ${a.length} points`;b&&console.time(g),this.points=a;let h=[];for(let i=0;i=c;j--){const k=+Date.now();h=this._cluster(h,j),this.trees[j]=new H(h,S,T,f,Float32Array),b&&console.log("z%d: %d clusters in %dms",j,h.length,+Date.now()-k)}return b&&console.timeEnd("total time"),this}getClusters(a,b){let c=((a[0]+180)%360+360)%360-180;const d=Math.max(-90,Math.min(90,a[1]));let f=180===a[2]?180:((a[2]+180)%360+360)%360-180;const g=Math.max(-90,Math.min(90,a[3]));if(a[2]-a[0]>=360)c=-180,f=180;else if(c>f){const h=this.getClusters([c,d,180,g],b),i=this.getClusters([-180,d,f,g],b);return h.concat(i)}const j=this.trees[this._limitZoom(b)],k=j.range(O(c),P(g),O(f),P(d)),l=[];for(const m of k){const n=j.points[m];l.push(n.numPoints?M(n):this.points[n.index])}return l}getChildren(a){const b=this._getOriginId(a),c=this._getOriginZoom(a),d="No cluster with the specified id.",f=this.trees[c];if(!f)throw Error(d);const g=f.points[b];if(!g)throw Error(d);const h=this.options.radius/(this.options.extent*Math.pow(2,c-1)),i=f.within(g.x,g.y,h),j=[];for(const k of i){const l=f.points[k];l.parentId===a&&j.push(l.numPoints?M(l):this.points[l.index])}if(0===j.length)throw Error(d);return j}getLeaves(a,b,c){const d=[];return this._appendLeaves(d,a,b=b||10,c=c||0,0),d}getTile(a,b,c){const d=this.trees[this._limitZoom(a)],f=Math.pow(2,a),{extent:g,radius:h}=this.options,i=h/g,j=(c-i)/f,k=(c+1+i)/f,l={features:[]};return this._addTileFeatures(d.range((b-i)/f,j,(b+1+i)/f,k),d.points,b,c,f,l),0===b&&this._addTileFeatures(d.range(1-i/f,j,1,k),d.points,f,c,f,l),b===f-1&&this._addTileFeatures(d.range(0,j,i/f,k),d.points,-1,c,f,l),l.features.length?l:null}getClusterExpansionZoom(a){let b=this._getOriginZoom(a)-1;for(;b<=this.options.maxZoom;){const c=this.getChildren(a);if(b++,1!==c.length)break;a=c[0].properties.cluster_id}return b}_appendLeaves(a,b,c,d,f){const g=this.getChildren(b);for(const h of g){const i=h.properties;if(i&&i.cluster?f+i.point_count<=d?f+=i.point_count:f=this._appendLeaves(a,i.cluster_id,c,d,f):fb&&(o+=q.numPoints||1)}if(o>n&&o>=h){let r=k.x*n,s=k.y*n,u=g&&n>1?this._map(k,!0):null;const v=(j<<5)+(b+1)+this.points.length;for(const w of m){const x=l.points[w];if(x.zoom<=b)continue;x.zoom=b;const y=x.numPoints||1;r+=x.x*y,s+=x.y*y,x.parentId=v,g&&(u||(u=this._map(k,!0)),g(u,this._map(x)))}k.parentId=v,c.push(K(r/o,s/o,v,o,u))}else if(c.push(k),o>1)for(const z of m){const A=l.points[z];A.zoom<=b||(A.zoom=b,c.push(A))}}return c}_getOriginId(a){return a-this.points.length>>5}_getOriginZoom(a){return(a-this.points.length)%32}_map(a,b){if(a.numPoints)return b?R({},a.properties):a.properties;const c=this.points[a.index].properties,d=this.options.map(c);return b&&d===c?R({},d):d}}function K(a,b,c,d,f){return{x:I(a),y:I(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:f}}function L(a,b){const[c,d]=a.geometry.coordinates;return{x:I(O(c)),y:I(P(d)),zoom:1/0,index:b,parentId:-1}}function M(a){return{type:"Feature",id:a.id,properties:N(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),Q(a.y),]}}}function N(a){const b=a.numPoints,c=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return R(R({},a.properties),{cluster:!0,cluster_id:a.id,point_count:b,point_count_abbreviated:c})}function O(a){return a/360+.5}function P(a){const b=Math.sin(a*Math.PI/180),c=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return c<0?0:c>1?1:c}function Q(a){const b=(180-360*a)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function R(a,b){for(const c in b)a[c]=b[c];return a}function S(a){return a.x}function T(a){return a.y}function U(a,b,c,d){for(var f,g=d,h=c-b>>1,i=c-b,j=a[b],k=a[b+1],l=a[c],m=a[c+1],n=b+3;ng)f=n,g=o;else if(o===g){var p=Math.abs(n-h);pd&&(f-b>3&&U(a,b,f,d),a[f+2]=g,c-f>3&&U(a,f,c,d))}function V(a,b,c,d,f,g){var h=f-c,i=g-d;if(0!==h||0!==i){var j=((a-c)*h+(b-d)*i)/(h*h+i*i);j>1?(c=f,d=g):j>0&&(c+=h*j,d+=i*j)}return(h=a-c)*h+(i=b-d)*i}function W(a,b,c,d){var f={id:void 0===a?null:a,type:b,geometry:c,tags:d,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(a){var b=a.geometry,c=a.type;if("Point"===c||"MultiPoint"===c||"LineString"===c)X(a,b);else if("Polygon"===c||"MultiLineString"===c)for(var d=0;d0&&(h+=d?(f*k-j*g)/2:Math.sqrt(Math.pow(j-f,2)+Math.pow(k-g,2))),f=j,g=k}var l=b.length-3;b[2]=1,U(b,0,l,c),b[l+2]=1,b.size=Math.abs(h),b.start=0,b.end=b.size}function _(a,b,c,d){for(var f=0;f1?1:c}function ab(a,b,c,d,f,g,h,i){if(d/=b,g>=(c/=b)&&h=d)return null;for(var j=[],k=0;k=c&&p=d)){var q=[];if("Point"===n||"MultiPoint"===n)ac(m,q,c,d,f);else if("LineString"===n)ad(m,q,c,d,f,!1,i.lineMetrics);else if("MultiLineString"===n)af(m,q,c,d,f,!1);else if("Polygon"===n)af(m,q,c,d,f,!0);else if("MultiPolygon"===n)for(var r=0;r=c&&h<=d&&(b.push(a[g]),b.push(a[g+1]),b.push(a[g+2]))}}function ad(a,b,c,d,f,g,h){for(var i,j,k=ae(a),l=0===f?ah:ai,m=a.start,n=0;nc&&(j=l(k,o,p,r,s,c),h&&(k.start=m+i*j)):u>d?v=c&&(j=l(k,o,p,r,s,c),w=!0),v>d&&u<=d&&(j=l(k,o,p,r,s,d),w=!0),!g&&w&&(h&&(k.end=m+i*j),b.push(k),k=ae(a)),h&&(m+=i)}var x=a.length-3;o=a[x],p=a[x+1],q=a[x+2],(u=0===f?o:p)>=c&&u<=d&&ag(k,o,p,q),x=k.length-3,g&&x>=3&&(k[x]!==k[0]||k[x+1]!==k[1])&&ag(k,k[0],k[1],k[2]),k.length&&b.push(k)}function ae(a){var b=[];return b.size=a.size,b.start=a.start,b.end=a.end,b}function af(a,b,c,d,f,g){for(var h=0;hh.maxX&&(h.maxX=l),m>h.maxY&&(h.maxY=m)}return h}function ao(a,b,c,d){var f=b.geometry,g=b.type,h=[];if("Point"===g||"MultiPoint"===g)for(var i=0;i0&&b.size<(f?h:d))c.numPoints+=b.length/3;else{for(var i=[],j=0;jh)&&(c.numSimplified++,i.push(b[j]),i.push(b[j+1])),c.numPoints++;f&&function(a,b){for(var c=0,d=0,f=a.length,g=f-2;d0===b)for(d=0,f=a.length;d24)throw Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw Error("promoteId and generateId cannot be used together.");var d,f,g,h,i,j,k=function(a,b){var c=[];if("FeatureCollection"===a.type)for(var d=0;d1&&console.time("creation"),n=this.tiles[m]=an(a,b,c,d,j),this.tileCoords.push({z:b,x:c,y:d}),k)){k>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,c,d,n.numFeatures,n.numPoints,n.numSimplified),console.timeEnd("creation"));var o="z"+b;this.stats[o]=(this.stats[o]||0)+1,this.total++}if(n.source=a,f){if(b===j.maxZoom||b===f)continue;var p=1<1&&console.time("clipping");var q,r,s,u,v,w,x=.5*j.buffer/j.extent,y=.5-x,z=.5+x,A=1+x;q=r=s=u=null,v=ab(a,l,c-x,c+z,0,n.minX,n.maxX,j),w=ab(a,l,c+y,c+A,0,n.minX,n.maxX,j),a=null,v&&(q=ab(v,l,d-x,d+z,1,n.minY,n.maxY,j),r=ab(v,l,d+y,d+A,1,n.minY,n.maxY,j),v=null),w&&(s=ab(w,l,d-x,d+z,1,n.minY,n.maxY,j),u=ab(w,l,d+y,d+A,1,n.minY,n.maxY,j),w=null),k>1&&console.timeEnd("clipping"),i.push(q||[],b+1,2*c,2*d),i.push(r||[],b+1,2*c,2*d+1),i.push(s||[],b+1,2*c+1,2*d),i.push(u||[],b+1,2*c+1,2*d+1)}}},aq.prototype.getTile=function(a,b,c){var d=this.options,f=d.extent,g=d.debug;if(a<0||a>24)return null;var h=1<1&&console.log("drilling down to z%d-%d-%d",a,b,c);for(var j,k=a,l=b,m=c;!j&&k>0;)k--,l=Math.floor(l/2),m=Math.floor(m/2),j=this.tiles[ar(k,l,m)];return j&&j.source?(g>1&&console.log("found parent tile z%d-%d-%d",k,l,m),g>1&&console.time("drilling down"),this.splitTile(j.source,k,l,m,a,b,c),g>1&&console.timeEnd("drilling down"),this.tiles[i]?al(this.tiles[i],f):null):null};class as extends a.VectorTileWorkerSource{constructor(a,b,c,d,f){super(a,b,c,d,function(a,b){const c=a.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const d=this._geoJSONIndex.getTile(c.z,c.x,c.y);if(!d)return b(null,null);const f=new n(d.features);let g=s(f);0===g.byteOffset&&g.byteLength===g.buffer.byteLength||(g=new Uint8Array(g)),b(null,{vectorTile:f,rawData:g.buffer})}),f&&(this.loadGeoJSON=f)}loadData(b,c){const d=b&&b.request,f=d&&d.collectResourceTiming;this.loadGeoJSON(b,(g,h)=>{if(g||!h)return c(g);if("object"!=typeof h)return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{i(h,!0);try{var j,k;if(b.filter){const l=a.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===l.result)throw Error(l.value.map(a=>`${a.key}: ${a.message}`).join(", "));const m=h.features.filter(a=>l.value.evaluate({zoom:0},a));h={type:"FeatureCollection",features:m}}this._geoJSONIndex=b.cluster?new J(function({superclusterOptions:b,clusterProperties:c}){if(!c||!b)return b;const d={},f={},g={accumulated:null,zoom:0},h={properties:null},i=Object.keys(c);for(const j of i){const[k,l]=c[j],m=a.createExpression(l),n=a.createExpression("string"==typeof k?[k,["accumulated",],["get",j,],]:k);d[j]=m.value,f[j]=n.value}return b.map=a=>{h.properties=a;const b={};for(const c of i)b[c]=d[c].evaluate(g,h);return b},b.reduce=(a,b)=>{for(const c of(h.properties=b,i))g.accumulated=a[c],a[c]=f[c].evaluate(g,h)},b}(b)).load(h.features):(j=h,k=b.geojsonVtOptions,new aq(j,k))}catch(n){return c(n)}this.loaded={};const o={};if(f){const p=a.getPerformanceMeasurement(d);p&&(o.resourceTiming={},o.resourceTiming[b.source]=JSON.parse(JSON.stringify(p)))}c(null,o)}})}reloadTile(a,b){const c=this.loaded;return c&&c[a.uid]?super.reloadTile(a,b):this.loadTile(a,b)}loadGeoJSON(b,c){if(b.request)a.getJSON(b.request,c);else{if("string"!=typeof b.data)return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));try{return c(null,JSON.parse(b.data))}catch(d){return c(Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(a,b){try{b(null,this._geoJSONIndex.getClusterExpansionZoom(a.clusterId))}catch(c){b(c)}}getClusterChildren(a,b){try{b(null,this._geoJSONIndex.getChildren(a.clusterId))}catch(c){b(c)}}getClusterLeaves(a,b){try{b(null,this._geoJSONIndex.getLeaves(a.clusterId,a.limit,a.offset))}catch(c){b(c)}}}class at{constructor(b){this.self=b,this.actor=new a.Actor(b,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=a.getProjection({name:"mercator"}),this.workerSourceTypes={vector:a.VectorTileWorkerSource,geojson:as},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(a,b)=>{if(this.workerSourceTypes[a])throw Error(`Worker source with name "${a}" already registered.`);this.workerSourceTypes[a]=b},this.self.registerRTLTextPlugin=b=>{if(a.plugin.isParsed())throw Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=b.applyArabicShaping,a.plugin.processBidirectionalText=b.processBidirectionalText,a.plugin.processStyledBidirectionalText=b.processStyledBidirectionalText}}clearCaches(a,b,c){delete this.layerIndexes[a],delete this.availableImages[a],delete this.workerSources[a],delete this.demWorkerSources[a],c()}checkIfReady(a,b,c){c()}setReferrer(a,b){this.referrer=b}spriteLoaded(b,c){for(const d in this.isSpriteLoaded[b]=c,this.workerSources[b]){const f=this.workerSources[b][d];for(const g in f)f[g]instanceof a.VectorTileWorkerSource&&(f[g].isSpriteLoaded=c,f[g].fire(new a.Event("isSpriteLoaded")))}}setImages(a,b,c){for(const d in this.availableImages[a]=b,this.workerSources[a]){const f=this.workerSources[a][d];for(const g in f)f[g].availableImages=b}c()}enableTerrain(a,b,c){this.terrain=b,c()}setProjection(b,c){this.projections[b]=a.getProjection(c)}setLayers(a,b,c){this.getLayerIndex(a).replace(b),c()}updateLayers(a,b,c){this.getLayerIndex(a).update(b.layers,b.removedIds),c()}loadTile(b,c,d){const f=this.enableTerrain?a.extend({enableTerrain:this.terrain},c):c;f.projection=this.projections[b]||this.defaultProjection,this.getWorkerSource(b,c.type,c.source).loadTile(f,d)}loadDEMTile(b,c,d){const f=this.enableTerrain?a.extend({buildQuadTree:this.terrain},c):c;this.getDEMWorkerSource(b,c.source).loadTile(f,d)}reloadTile(b,c,d){const f=this.enableTerrain?a.extend({enableTerrain:this.terrain},c):c;f.projection=this.projections[b]||this.defaultProjection,this.getWorkerSource(b,c.type,c.source).reloadTile(f,d)}abortTile(a,b,c){this.getWorkerSource(a,b.type,b.source).abortTile(b,c)}removeTile(a,b,c){this.getWorkerSource(a,b.type,b.source).removeTile(b,c)}removeSource(a,b,c){if(!this.workerSources[a]||!this.workerSources[a][b.type]||!this.workerSources[a][b.type][b.source])return;const d=this.workerSources[a][b.type][b.source];delete this.workerSources[a][b.type][b.source],void 0!==d.removeSource?d.removeSource(b,c):c()}loadWorkerSource(a,b,c){try{this.self.importScripts(b.url),c()}catch(d){c(d.toString())}}syncRTLPluginState(b,c,d){try{a.plugin.setState(c);const f=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&null!=f){this.self.importScripts(f);const g=a.plugin.isParsed();d(g?void 0:Error(`RTL Text Plugin failed to import scripts from ${f}`),g)}}catch(h){d(h.toString())}}getAvailableImages(a){let b=this.availableImages[a];return b||(b=[]),b}getLayerIndex(a){let b=this.layerIndexes[a];return b||(b=this.layerIndexes[a]=new d),b}getWorkerSource(a,b,c){return this.workerSources[a]||(this.workerSources[a]={}),this.workerSources[a][b]||(this.workerSources[a][b]={}),this.workerSources[a][b][c]||(this.workerSources[a][b][c]=new this.workerSourceTypes[b]({send:(b,c,d,f,g,h)=>{this.actor.send(b,c,d,a,g,h)},scheduler:this.actor.scheduler},this.getLayerIndex(a),this.getAvailableImages(a),this.isSpriteLoaded[a])),this.workerSources[a][b][c]}getDEMWorkerSource(a,b){return this.demWorkerSources[a]||(this.demWorkerSources[a]={}),this.demWorkerSources[a][b]||(this.demWorkerSources[a][b]=new g),this.demWorkerSources[a][b]}enforceCacheSizeLimit(b,c){a.enforceCacheSizeLimit(c)}getWorkerPerformanceMetrics(a,b,c){c(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new at(self)),at}),f(["./shared"],function(a){var b=c;function c(a){var b,f;return b=a,"undefined"!=typeof window&&"undefined"!=typeof document&&!!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 a,b,c=new Blob([""],{type:"text/javascript"}),d=URL.createObjectURL(c);try{b=new Worker(d),a=!0}catch(f){a=!1}return b&&b.terminate(),URL.revokeObjectURL(d),a}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var a=document.createElement("canvas");a.width=a.height=1;var b=a.getContext("2d");if(!b)return!1;var c=b.getImageData(0,0,1,1);return c&&c.width===a.width}()&&(void 0===d[f=b&&b.failIfMajorPerformanceCaveat]&&(d[f]=function(a){var b,d,f,g,h=(b=a,d=document.createElement("canvas"),(f=Object.create(c.webGLContextAttributes)).failIfMajorPerformanceCaveat=b,d.getContext("webgl",f)||d.getContext("experimental-webgl",f));if(!h)return!1;try{g=h.createShader(h.VERTEX_SHADER)}catch(i){return!1}return!(!g||h.isContextLost())&&(h.shaderSource(g,"void main() {}"),h.compileShader(g),!0===h.getShaderParameter(g,h.COMPILE_STATUS))}(f)),!!d[f]&&!document.documentMode)}var d={};function f(a,b){var c=b[0],d=b[1],f=b[2],g=b[3],h=c*g-f*d;return h?(a[0]=g*(h=1/h),a[1]=-d*h,a[2]=-f*h,a[3]=c*h,a):null}function g(a,b){if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(let c=0;c{a.window.removeEventListener("click",l,!0)},0)},h.mousePos=function(a,b){const c=a.getBoundingClientRect();return m(a,c,b)},h.touchPos=function(a,b){const c=a.getBoundingClientRect(),d=[];for(let f=0;f=0?0:b.button};class o extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(a){if(this.loaded!==a&&(this.loaded=a,a)){for(const{ids:b,callback:c}of this.requestors)this._notify(b,c);this.requestors=[]}}getImage(a){return this.images[a]}addImage(a,b){this._validate(a,b)&&(this.images[a]=b)}_validate(b,c){let d=!0;return this._validateStretch(c.stretchX,c.data&&c.data.width)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "stretchX" value`))),d=!1),this._validateStretch(c.stretchY,c.data&&c.data.height)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "stretchY" value`))),d=!1),this._validateContent(c.content,c)||(this.fire(new a.ErrorEvent(Error(`Image "${b}" has invalid "content" value`))),d=!1),d}_validateStretch(a,b){if(!a)return!0;let c=0;for(const d of a){if(d[0]{this.ready=!0})}broadcast(b,c,d){a.asyncAll(this.actors,(a,d)=>{a.send(b,c,d)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(a=>{a.remove()}),this.actors=[],this.workerPool.release(this.id)}}function C(b,c,d){return c*(a.EXTENT/(b.tileSize*Math.pow(2,d-b.tileID.overscaledZ)))}B.Actor=a.Actor;class D{constructor(a,b,c){this.context=a;const d=a.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(c),this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(a){const b=this.context.gl;this.context.unbindVAO(),this.bind(),b.bufferSubData(b.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const E={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class F{constructor(a,b,c,d){this.length=b.length,this.attributes=c,this.itemSize=b.bytesPerElement,this.dynamicDraw=d,this.context=a;const f=a.gl;this.buffer=f.createBuffer(),a.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,b.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete b.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(a){const b=this.context.gl;this.bind(),b.bufferSubData(b.ARRAY_BUFFER,0,a.arrayBuffer)}enableAttributes(a,b){for(let c=0;cd.pointCoordinate3D(a)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(b,c){let d,f;if(b instanceof a.pointGeometry||"number"==typeof b[0]){const g=a.pointGeometry.convert(b);d=[a.pointGeometry.convert(b)],f=c.isPointAboveHorizon(g)}else{const h=a.pointGeometry.convert(b[0]),i=a.pointGeometry.convert(b[1]);d=[h,i],f=a.polygonizeBounds(h,i).every(a=>c.isPointAboveHorizon(a))}return new L(d,c.getCameraPoint(),f,c)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(b){return a.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],b)}bufferedCameraGeometry(b){const c=this.screenBounds[0],d=1===this.screenBounds.length?this.screenBounds[0].add(new a.pointGeometry(1,1)):this.screenBounds[1],f=a.polygonizeBounds(c,d,0,!1);return this.cameraPoint.y>d.y&&(this.cameraPoint.x>c.x&&this.cameraPoint.x=d.x?f[2]=this.cameraPoint:this.cameraPoint.x<=c.x&&(f[3]=this.cameraPoint)),a.bufferConvexPolygon(f,b)}containsTile(b,c,d){var f;const g=b.queryPadding+1,h=b.tileID.wrap,i=d?this._bufferedCameraMercator(g,c).map(c=>a.getTilePoint(b.tileTransform,c,h)):this._bufferedScreenMercator(g,c).map(c=>a.getTilePoint(b.tileTransform,c,h)),j=this.screenGeometryMercator.map(c=>a.getTileVec3(b.tileTransform,c,h)),k=j.map(b=>new a.pointGeometry(b[0],b[1])),l=c.getFreeCameraOptions().position||new a.MercatorCoordinate(0,0,0),m=a.getTileVec3(b.tileTransform,l,h),n=j.map(b=>{const c=a.sub(b,b,m);return a.normalize(c,c),new a.Ray(m,c)}),o=C(b,1,c.zoom);if(a.polygonIntersectsBox(i,0,0,a.EXTENT,a.EXTENT))return{queryGeometry:this,tilespaceGeometry:k,tilespaceRays:n,bufferedTilespaceGeometry:i,bufferedTilespaceBounds:((f=a.getBounds(i)).min.x=a.clamp(f.min.x,0,a.EXTENT),f.min.y=a.clamp(f.min.y,0,a.EXTENT),f.max.x=a.clamp(f.max.x,0,a.EXTENT),f.max.y=a.clamp(f.max.y,0,a.EXTENT),f),tile:b,tileID:b.tileID,pixelToTileUnitsFactor:o}}_bufferedScreenMercator(a,b){const c=100*a|0;if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{const d=this.bufferedScreenGeometry(a).map(a=>b.pointCoordinate3D(a));return this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(a,b){const c=100*a|0;if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{const d=this.bufferedCameraGeometry(a).map(a=>b.pointCoordinate3D(a));return this._cameraRaycastCache[c]=d,d}}}function M(b,c,d){const f=function(f,g){if(f)return d(f);if(g){const h=a.pick(a.extend(g,b),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);g.vector_layers&&(h.vectorLayers=g.vector_layers,h.vectorLayerIds=h.vectorLayers.map(a=>a.id)),h.tiles=c.canonicalizeTileset(h,b.url),d(null,h)}};return b.url?a.getJSON(c.transformRequest(c.normalizeSourceURL(b.url),a.ResourceType.Source),f):a.exported.frame(()=>f(null,b))}class N{constructor(b,c,d){this.bounds=a.LngLatBounds.convert(this.validateBounds(b)),this.minzoom=c||0,this.maxzoom=d||24}validateBounds(a){return Array.isArray(a)&&4===a.length?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3]),]:[-180,-90,180,90]}contains(b){const c=Math.pow(2,b.z),d=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*c),f=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*c),g=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*c),h=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*c);return b.x>=d&&b.x=f&&b.y{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(a.extend(this,c),c.bounds&&(this.tileBounds=new N(c.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(c.tiles),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(a){this.map=a,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(b,c){const d=a.exported.devicePixelRatio>=2,f=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),d,this.tileSize);b.request=a.getImage(this.map._requestManager.transformRequest(f,a.ResourceType.Tile),(d,f,g,h)=>{if(delete b.request,b.aborted)b.state="unloaded",c(null);else if(d)b.state="errored",c(d);else if(f){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:g,expires:h});const i=this.map.painter.context,j=i.gl;b.texture=this.map.painter.getTileTexture(f.width),b.texture?b.texture.update(f,{useMipmap:!0}):(b.texture=new a.Texture(i,f,j.RGBA,{useMipmap:!0}),b.texture.bind(j.LINEAR,j.CLAMP_TO_EDGE),i.extTextureFilterAnisotropic&&j.texParameterf(j.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),b.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),c(null)}})}abortTile(a,b){a.request&&(a.request.cancel(),delete a.request),b()}unloadTile(a,b){a.texture&&this.map.painter.saveTileTexture(a.texture),b()}hasTransition(){return!1}}let P;function Q(b,c,d,f,g,h,i,j){const k=[b,d,g,c,f,h,1,1,1],l=[i,j,1],m=a.adjoint([],k),[n,o,p]=a.transformMat3(l,l,a.transpose(m,m));return a.multiply(k,[n,0,0,0,o,0,0,0,p],k)}class R extends a.Evented{constructor(a,b,c,d){super(),this.id=a,this.dispatcher=c,this.coordinates=b.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=b}load(b,c){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(d,f)=>{this._loaded=!0,d?this.fire(new a.ErrorEvent(d)):f&&(this.image=a.exported.getImageData(f),this.width=this.image.width,this.height=this.image.height,b&&(this.coordinates=b),c&&c(),this._finishLoading())})}loaded(){return this._loaded}updateImage(a){return this.image&&a.url&&(this.options.url=a.url,this.load(a.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(a){this.map=a,this.load()}setCoordinates(b){this.coordinates=b,delete this._boundsArray;const c=b.map(a.MercatorCoordinate.fromLngLat);return this.tileID=function(b){let c=1/0,d=1/0,f=-1/0,g=-1/0;for(const h of b)c=Math.min(c,h.x),d=Math.min(d,h.y),f=Math.max(f,h.x),g=Math.max(g,h.y);const i=Math.max(f-c,g-d),j=Math.max(0,Math.floor(-Math.log(i)/Math.LN2)),k=Math.pow(2,j);return new a.CanonicalTileID(j,Math.floor((c+f)/2*k),Math.floor((d+g)/2*k))}(c),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const b=a.tileTransform(this.tileID,this.map.transform.projection),[c,d,f,g]=this.coordinates.map(c=>{const d=b.projection.project(c[0],c[1]);return a.getTilePoint(b,d)._round()});return this.perspectiveTransform=function(b,c,d,f,g,h,i,j,k,l){const m=Q(0,0,b,0,0,c,b,c),n=Q(d,f,g,h,i,j,k,l);return a.multiply(n,a.adjoint(m,m),n),[n[6]/n[8]*b/a.EXTENT,n[7]/n[8]*c/a.EXTENT,]}(this.width,this.height,c.x,c.y,d.x,d.y,g.x,g.y,f.x,f.y),this._boundsArray=new a.StructArrayLayout4i8,this._boundsArray.emplaceBack(c.x,c.y,0,0),this._boundsArray.emplaceBack(d.x,d.y,a.EXTENT,0),this._boundsArray.emplaceBack(g.x,g.y,0,a.EXTENT),this._boundsArray.emplaceBack(f.x,f.y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const b=this.map.painter.context,c=b.gl;for(const d in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new a.Texture(b,this.image,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){const f=this.tiles[d];"loaded"!==f.state&&(f.state="loaded",f.texture=this.texture)}}loadTile(a,b){this.tileID&&this.tileID.equals(a.tileID.canonical)?(this.tiles[String(a.tileID.wrap)]=a,a.buckets={},b(null)):(a.state="errored",b(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const S={vector:class extends a.Evented{constructor(b,c,d,f){if(super(),this.id=b,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(c,["url","scheme","tileSize","promoteId",])),this._options=a.extend({type:"vector"},c),this._collectResourceTiming=c.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f),this._tileWorkers={},this._deduped=new a.DedupedRequest}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=M(this._options,this.map._requestManager,(b,c)=>{this._tileJSONRequest=null,this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(a.extend(this,c),c.bounds&&(this.tileBounds=new N(c.bounds,this.minzoom,this.maxzoom)),a.postTurnstileEvent(c.tiles,this.map._requestManager._customAccessToken),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}onAdd(a){this.map=a,this.load()}setSourceProperty(a){this._tileJSONRequest&&this._tileJSONRequest.cancel(),a();const b=this.map.style._getSourceCaches(this.id);for(const c of b)c.clearTiles();this.load()}setTiles(a){return this.setSourceProperty(()=>{this._options.tiles=a}),this}setUrl(a){return this.setSourceProperty(()=>{this.url=a,this._options.url=a}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(b,c){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme)),f={request:this.map._requestManager.transformRequest(d,a.ResourceType.Tile),data:void 0,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,tileSize:this.tileSize*b.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:b.isSymbolTile};if(f.request.collectResourceTiming=this._collectResourceTiming,b.actor&&"expired"!==b.state)"loading"===b.state?b.reloadCallback=c:b.request=b.actor.send("reloadTile",f,h.bind(this));else if(b.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)b.request=b.actor.send("loadTile",f,h.bind(this),void 0,!0);else{const g=a.loadVectorTile.call({deduped:this._deduped},f,(a,c)=>{a||!c?h.call(this,a):(f.data={cacheControl:c.cacheControl,expires:c.expires,rawData:c.rawData.slice(0)},b.actor&&b.actor.send("loadTile",f,h.bind(this),void 0,!0))},!0);b.request={cancel:g}}function h(d,f){return delete b.request,b.aborted?c(null):d&&404!==d.status?c(d):(f&&f.resourceTiming&&(b.resourceTiming=f.resourceTiming),this.map._refreshExpiredTiles&&f&&b.setExpiryData(f),b.loadVectorData(f,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),c(null),void(b.reloadCallback&&(this.loadTile(b,b.reloadCallback),b.reloadCallback=null)))}}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id})}unloadTile(a){a.unloadVectorData(),a.actor&&a.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:O,"raster-dem":class extends O{constructor(b,c,d,f){super(b,c,d,f),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},c),this.encoding=c.encoding||"mapbox"}loadTile(b,c){const d=this.map._requestManager.normalizeTileURL(b.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function f(a,d){a&&(b.state="errored",c(a)),d&&(b.dem=d,b.dem.onDeserialize(),b.needsHillshadePrepare=!0,b.needsDEMTextureUpload=!0,b.state="loaded",c(null))}b.request=a.getImage(this.map._requestManager.transformRequest(d,a.ResourceType.Tile),(function(d,g,h,i){if(delete b.request,b.aborted)b.state="unloaded",c(null);else if(d)b.state="errored",c(d);else if(g){this.map._refreshExpiredTiles&&b.setExpiryData({cacheControl:h,expires:i});const j=a.window.ImageBitmap&&g instanceof a.window.ImageBitmap&&(null==P&&(P=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),P),k=1-(g.width-a.prevPowerOfTwo(g.width))/2;k<1||b.neighboringTiles||(b.neighboringTiles=this._getNeighboringTiles(b.tileID));const l=j?g:a.exported.getImageData(g,k),m={uid:b.uid,coord:b.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:k};b.actor&&"expired"!==b.state||(b.actor=this.dispatcher.getActor(),b.actor.send("loadDEMTile",m,f.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(b){const c=b.canonical,d=Math.pow(2,c.z),f=(c.x-1+d)%d,g=0===c.x?b.wrap-1:b.wrap,h=(c.x+1+d)%d,i=c.x+1===d?b.wrap+1:b.wrap,j={};return j[new a.OverscaledTileID(b.overscaledZ,g,c.z,f,c.y).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,i,c.z,h,c.y).key]={backfilled:!1},c.y>0&&(j[new a.OverscaledTileID(b.overscaledZ,g,c.z,f,c.y-1).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,b.wrap,c.z,c.x,c.y-1).key]={backfilled:!1},j[new a.OverscaledTileID(b.overscaledZ,i,c.z,h,c.y-1).key]={backfilled:!1}),c.y+1{if(this._loaded=!0,this._pendingLoad=null,b)this.fire(new a.ErrorEvent(b));else{const d={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&c&&c.resourceTiming&&c.resourceTiming[this.id]&&(d.resourceTiming=c.resourceTiming[this.id]),this.fire(new a.Event("data",d)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(b,c){const d=b.actor?"reloadTile":"loadTile";b.actor=this.actor,b.request=this.actor.send(d,{type:this.type,uid:b.uid,tileID:b.tileID,tileZoom:b.tileZoom,zoom:b.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:a.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(a,f)=>(delete b.request,b.unloadVectorData(),b.aborted?c(null):a?c(a):(b.loadVectorData(f,this.map.painter,"reloadTile"===d),c(null))),void 0,"loadTile"===d)}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.aborted=!0}unloadTile(a){a.unloadVectorData(),this.actor.send("removeTile",{uid:a.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends R{constructor(a,b,c,d){super(a,b,c,d),this.roundZoom=!0,this.type="video",this.options=b}load(){this._loaded=!1;const b=this.options;for(const c of(this.urls=[],b.urls))this.urls.push(this.map._requestManager.transformRequest(c,a.ResourceType.Source).url);a.getVideo(this.urls,(b,c)=>{this._loaded=!0,b?this.fire(new a.ErrorEvent(b)):c&&(this.video=c,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(b){if(this.video){const c=this.video.seekable;bc.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${c.start(0)} and ${c.end(0)}-second mark.`))):this.video.currentTime=b}}getVideo(){return this.video}onAdd(a){this.map||(this.map=a,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 b=this.map.painter.context,c=b.gl;for(const d in this.texture?this.video.paused||(this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,this.video)):(this.texture=new a.Texture(b,this.video,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=b.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const f=this.tiles[d];"loaded"!==f.state&&(f.state="loaded",f.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:R,canvas:class extends R{constructor(b,c,d,f){super(b,c,d,f),c.coordinates?Array.isArray(c.coordinates)&&4===c.coordinates.length&&!c.coordinates.some(a=>!Array.isArray(a)||2!==a.length||a.some(a=>"number"!=typeof a))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'missing required property "coordinates"'))),c.animate&&"boolean"!=typeof c.animate&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'optional "animate" property must be a boolean value'))),c.canvas?"string"==typeof c.canvas||c.canvas instanceof a.window.HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${b}`,null,'missing required property "canvas"'))),this.options=c,this.animate=void 0===c.animate||c.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof a.window.HTMLCanvasElement?this.options.canvas:a.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(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(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let b=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,b=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,b=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const c=this.map.painter.context,d=c.gl;for(const f in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,a.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(b||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.Texture(c,this.canvas,d.RGBA,{premultiply:!0}),this.tiles){const g=this.tiles[f];"loaded"!==g.state&&(g.state="loaded",g.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height,])if(isNaN(a)||a<=0)return!0;return!1}}},T=function(b,c,d,f){const g=new S[c.type](b,c,d,f);if(g.id!==b)throw Error(`Expected Source id to be ${b} instead of ${g.id}`);return a.bindAll(["load","abort","unload","serialize","prepare",],g),g};function U(b,c){const d=a.identity([]);return a.scale(d,d,[.5*b.width,-(.5*b.height),1,]),a.translate(d,d,[1,-1,0]),a.multiply$1(d,d,b.calculateProjMatrix(c.toUnwrapped()))}function V(a,b,c,d,f,g,h,i=!1){const j=a.tilesIn(d,h,i);j.sort(X);const k=[];for(const l of j)k.push({wrappedTileID:l.tile.tileID.wrapped().key,queryResults:l.tile.queryRenderedFeatures(b,c,a._state,l,f,g,U(a.transform,l.tile.tileID),i)});const m=function(a){const b={},c={};for(const d of a){const f=d.queryResults,g=d.wrappedTileID,h=c[g]=c[g]||{};for(const i in f){const j=f[i],k=h[i]=h[i]||{},l=b[i]=b[i]||[];for(const m of j)k[m.featureIndex]||(k[m.featureIndex]=!0,l.push(m))}}return b}(k);for(const n in m)m[n].forEach(b=>{const c=b.feature,d=a.getFeatureState(c.layer["source-layer"],c.id);c.source=c.layer.source,c.layer["source-layer"]&&(c.sourceLayer=c.layer["source-layer"]),c.state=d});return m}function W(a,b){const c=a.getRenderableIds().map(b=>a.getTileByID(b)),d=[],f={};for(let g=0;g{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Z]}numActive(){return Object.keys(this.active).length}}let _;function aa(){return _||(_=new $),_}function ab(b,c){const d={};for(const f in b)"ref"!==f&&(d[f]=b[f]);return a.refProperties.forEach(a=>{a in c&&(d[a]=c[a])}),d}function ac(a){a=a.slice();const b=Object.create(null);for(let c=0;c0?(f-h)/i:0;return this.points[g].mult(1-j).add(this.points[c].mult(j))}}class al{constructor(a,b,c){const d=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(a/c),this.yCellCount=Math.ceil(b/c);for(let g=0;gthis.width||d<0||b>this.height)return!f&&[];const h=[];if(a<=0&&b<=0&&this.width<=c&&this.height<=d){if(f)return!0;for(let i=0;i0:h}_queryCircle(a,b,c,d,f){const g=a-c,h=a+c,i=b-c,j=b+c;if(h<0||g>this.width||j<0||i>this.height)return!d&&[];const k=[];return this._forEachCell(g,i,h,j,this._queryCellCircle,k,{hitTest:d,circle:{x:a,y:b,radius:c},seenUids:{box:{},circle:{}}},f),d?k.length>0:k}query(a,b,c,d,f){return this._query(a,b,c,d,!1,f)}hitTest(a,b,c,d,f){return this._query(a,b,c,d,!0,f)}hitTestCircle(a,b,c,d){return this._queryCircle(a,b,c,!0,d)}_queryCell(a,b,c,d,f,g,h,i){const j=h.seenUids,k=this.boxCells[f];if(null!==k){const l=this.bboxes;for(const m of k)if(!j.box[m]){j.box[m]=!0;const n=4*m;if(a<=l[n+2]&&b<=l[n+3]&&c>=l[n+0]&&d>=l[n+1]&&(!i||i(this.boxKeys[m]))){if(h.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[m],x1:l[n],y1:l[n+1],x2:l[n+2],y2:l[n+3]})}}}const o=this.circleCells[f];if(null!==o){const p=this.circles;for(const q of o)if(!j.circle[q]){j.circle[q]=!0;const r=3*q;if(this._circleAndRectCollide(p[r],p[r+1],p[r+2],a,b,c,d)&&(!i||i(this.circleKeys[q]))){if(h.hitTest)return g.push(!0),!0;{const s=p[r],u=p[r+1],v=p[r+2];g.push({key:this.circleKeys[q],x1:s-v,y1:u-v,x2:s+v,y2:u+v})}}}}}_queryCellCircle(a,b,c,d,f,g,h,i){const j=h.circle,k=h.seenUids,l=this.boxCells[f];if(null!==l){const m=this.bboxes;for(const n of l)if(!k.box[n]){k.box[n]=!0;const o=4*n;if(this._circleAndRectCollide(j.x,j.y,j.radius,m[o+0],m[o+1],m[o+2],m[o+3])&&(!i||i(this.boxKeys[n])))return g.push(!0),!0}}const p=this.circleCells[f];if(null!==p){const q=this.circles;for(const r of p)if(!k.circle[r]){k.circle[r]=!0;const s=3*r;if(this._circlesCollide(q[s],q[s+1],q[s+2],j.x,j.y,j.radius)&&(!i||i(this.circleKeys[r])))return g.push(!0),!0}}}_forEachCell(a,b,c,d,f,g,h,i){const j=this._convertToXCellCoord(a),k=this._convertToYCellCoord(b),l=this._convertToXCellCoord(c),m=this._convertToYCellCoord(d);for(let n=j;n<=l;n++)for(let o=k;o<=m;o++)if(f.call(this,a,b,c,d,this.xCellCount*o+n,g,h,i))return}_convertToXCellCoord(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))}_convertToYCellCoord(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))}_circlesCollide(a,b,c,d,f,g){const h=d-a,i=f-b,j=c+g;return j*j>h*h+i*i}_circleAndRectCollide(a,b,c,d,f,g,h){const i=(g-d)/2,j=Math.abs(a-(d+i));if(j>i+c)return!1;const k=(h-f)/2,l=Math.abs(b-(f+k));if(l>k+c)return!1;if(j<=i||l<=k)return!0;const m=j-i,n=l-k;return m*m+n*n<=c*c}}const am=Math.tan(85*Math.PI/180);function an(b,c,d,g,h,i){let j=a.create();if(d){if("globe"===h.projection.name)j=a.calculateGlobeMatrix(h,h.worldSize/h._projectionScaler,[0,0]),a.multiply$1(j,j,a.globeDenormalizeECEF(a.globeTileBounds(c)));else{const k=f([],i);j[0]=k[0],j[1]=k[1],j[4]=k[2],j[5]=k[3]}g||a.rotateZ(j,j,h.angle)}else a.multiply$1(j,h.labelPlaneMatrix,b);return j}function ao(b,c,d,f,g,h){if(d){if("globe"===g.projection.name){const i=an(b,c,d,f,g,h);return a.invert(i,i),a.multiply$1(i,b,i),i}{const j=a.clone(b),k=a.identity([]);return k[0]=h[0],k[1]=h[1],k[4]=h[2],k[5]=h[3],a.multiply$1(j,j,k),f||a.rotateZ(j,j,-g.angle),j}}return g.glCoordMatrix}function ap(b,c,d=0){const f=[b.x,b.y,d,1];d?a.transformMat4$1(f,f,c):aB(f,f,c);const g=f[3];return{point:new a.pointGeometry(f[0]/g,f[1]/g),signedDistanceFromCamera:g}}function aq(a,b){return Math.min(.5+a/b*.5,1.5)}function ar(a,b){const c=a[0]/a[3],d=a[1]/a[3];return c>= -b[0]&&c<=b[0]&&d>= -b[1]&&d<=b[1]}function as(b,c,d,f,g,h,i,j,k,l){const m=d.transform,n=f?b.textSizeData:b.iconSizeData,o=a.evaluateSizeForZoom(n,d.transform.zoom),p=[256/d.width*2+1,256/d.height*2+1,],q=f?b.text.dynamicLayoutVertexArray:b.icon.dynamicLayoutVertexArray;q.clear();const r=b.lineVertexArray,s=f?b.text.placedSymbolArray:b.icon.placedSymbolArray,u=d.transform.width/d.transform.height;let v=!1;for(let w=0;wMath.abs(d.x-c.x)*f?{useVertical:!0}:b.writingMode===a.WritingMode.vertical?c.yam}(c,d,f)?1===b.flipState?{needsFlipping:!0}:null:c.x>d.x?{needsFlipping:!0}:null}function av(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=c/24,v=b.lineOffsetX*u,w=b.lineOffsetY*u;let x;if(b.numGlyphs>1){const y=b.glyphStartIndex+b.numGlyphs,z=b.lineStartIndex,A=b.lineStartIndex+b.lineLength,B=at(u,j,v,w,d,m,n,b,k,h,o,q,!1,r,s);if(!B)return{notEnoughRoom:!0};const C=ap(B.first.point,i).point,D=ap(B.last.point,i).point;if(f&&!d){const E=au(b,C,D,p);if(b.flipState=E&&E.needsFlipping?1:2,E)return E}x=[B.first];for(let F=b.glyphStartIndex+1;F0?J.point:ax(n,I,G,1,g,void 0,r,s.canonical),p);if(b.flipState=K&&K.needsFlipping?1:2,K)return K}const L=ay(u*j.getoffsetX(b.glyphStartIndex),v,w,d,m,n,b.segment,b.lineStartIndex,b.lineStartIndex+b.lineLength,k,h,o,q,!1,!1,r,s);if(!L)return{notEnoughRoom:!0};x=[L]}for(const M of x)a.addDynamicAttributes(l,M.point,M.angle);return{}}function aw(b,c,d,f,g){const h=f.projectTilePoint(b.x,b.y,c);if(!g)return ap(h,d,h.z);const i=g(b);return ap(new a.pointGeometry(h.x+i[0],h.y+i[1]),d,h.z+i[2])}function ax(a,b,c,d,f,g,h,i){const j=aw(a.add(a.sub(b)._unit()),i,f,h,g).point,k=c.sub(j);return c.add(k._mult(d/k.mag()))}function ay(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=f?b-c:b+c;let v=u>0?1:-1,w=0;f&&(v*=-1,w=Math.PI),v<0&&(w+=Math.PI);let x=v>0?j+i:j+i+1,y=g,z=g,A=0,B=0;const C=Math.abs(u),D=[],E=[];let F=h;const G=()=>{const b=x-v;return 0===A?h:new a.pointGeometry(l.getx(b),l.gety(b))},H=()=>ax(G(),F,z,C-A+1,m,o,r,s.canonical);for(;A+B<=C;){if((x+=v)=k)return null;if(z=y,D.push(y),p&&E.push(F||G()),void 0===(y=n[x])){F=new a.pointGeometry(l.getx(x),l.gety(x));const I=aw(F,s.canonical,m,r,o);y=I.signedDistanceFromCamera>0?n[x]=I.point:H()}else F=null;A+=B,B=z.dist(y)}q&&o&&(F=F||new a.pointGeometry(l.getx(x),l.gety(x)),n[x]=y=void 0===n[x]?y:H(),B=z.dist(y));const J=(C-A)/B,K=y.sub(z),L=K.mult(J)._add(z);d&&L._add(K._unit()._perp()._mult(d*v));const M=w+Math.atan2(y.y-z.y,y.x-z.x);return D.push(L),p&&(F=F||new a.pointGeometry(l.getx(x),l.gety(x)),E.push(function(b,c,d){const f=1-d;return new a.pointGeometry(b.x*f+c.x*d,b.y*f+c.y*d)}(E.length>0?E[E.length-1]:F,F,J))),{point:L,angle:M,path:D,tilePath:E}}const az=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function aA(a,b){for(let c=0;ca.sortKey-b.sortKey));this._currentPartIndex[0,0,0],v=new a.pointGeometry(c.tileAnchorX,c.tileAnchorY),w=this.transform.projection.projectTilePoint(c.tileAnchorX,c.tileAnchorY,p.canonical),x=u(v),y=[w.x+x[0],w.y+x[1],w.z+x[2]],z=this.projectAndGetPerspectiveRatio(h,y[0],y[1],y[2],p),{perspectiveRatio:A}=z,B=(l?g/A:g*A)/a.ONE_EM,C=ap(new a.pointGeometry(y[0],y[1]),i,y[2]).point,D=z.signedDistanceFromCamera>0?at(B,f,c.lineOffsetX*B,c.lineOffsetY*B,!1,C,v,c,d,i,{},r&&!l?u:null,l&&!!r,this.transform.projection,p):null;let E=!1,F=!1,G=!0;if(D&&!z.aboveHorizon){const H=.5*n*A+o,I=new a.pointGeometry(-100,-100),J=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),K=new ak,L=D.first,M=D.last;let N=[];for(let O=L.path.length-1;O>=1;O--)N.push(L.path[O]);for(let P=1;P{const c=u(bap(a,j));N=R.some(a=>a.signedDistanceFromCamera<=0)?[]:R.map(a=>a.point)}let S=[];if(N.length>0){const T=N[0].clone(),U=N[0].clone();for(let V=1;V=I.x&&U.x<=J.x&&T.y>=I.y&&U.y<=J.y?[N]:U.xJ.x||U.yJ.y?[]:a.clipLine([N],I.x,I.y,J.x,J.y)}for(const W of S){K.reset(W,.25*H);let X=0;X=K.length<=.5*H?1:Math.ceil(K.paddedLength/Q)+1;for(let Y=0;Y0){a.transformMat4$1(h,h,b);let j=!1;this.fogState&&g&&(j=function(b,c,d,f,g,h){const i=h.calculateFogTileMatrix(g),j=[c,d,f];return a.transformMat4(j,j,i),w(b,j,h.pitch,h._fov)}(this.fogState,c,d,f||0,g.toUnwrapped(),this.transform)>.9),i=h[2]>h[3]||j}else aB(h,h,b);return{point:new a.pointGeometry((h[0]/h[3]+1)/2*this.transform.width+100,(-h[1]/h[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/h[3]*.5,1.5),signedDistanceFromCamera:h[3],aboveHorizon:i}}isOffscreen(a,b,c,d){return c<100||a>=this.screenRightBoundary||d<100||b>this.screenBottomBoundary}isInsideGrid(a,b,c,d){return c>=0&&a=0&&ba.collisionGroupID===b}}return this.collisionGroups[a]}}(d),this.collisionCircleArrays={},this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(b,c,d,f){const g=d.getBucket(c),h=d.latestFeatureIndex;if(!g||!h||c.id!==g.layerIds[0])return;const i=g.layers[0].layout,j=d.collisionBoxArray,k=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),l=d.tileSize/a.EXTENT,m=d.tileID.toUnwrapped(),n=this.transform.calculateProjMatrix(m),o="map"===i.get("text-pitch-alignment"),p="map"===i.get("text-rotation-alignment");c.compileFilter();const q=c.dynamicFilter(),r=c.dynamicFilterNeedsFeature(),s=this.transform.calculatePixelsToTileUnitsMatrix(d),u=an(n,d.tileID.canonical,o,p,this.transform,s);let v=null;if(o){const w=ao(n,d.tileID.canonical,o,p,this.transform,s);v=a.multiply$1([],this.transform.labelPlaneMatrix,w)}let x=null;q&&d.latestFeatureIndex&&(x={unwrappedTileID:m,dynamicFilter:q,dynamicFilterNeedsFeature:r,featureIndex:d.latestFeatureIndex}),this.retainedQueryData[g.bucketInstanceId]=new aG(g.bucketInstanceId,h,g.sourceLayerIndex,g.index,d.tileID);const y={bucket:g,layout:i,posMatrix:n,textLabelPlaneMatrix:u,labelToScreenMatrix:v,clippingData:x,scale:k,textPixelRatio:l,holdingForFade:d.holdingForFade(),collisionBoxArray:j,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(g.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:a.evaluateSizeForZoom(g.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(f)for(const z of g.sortKeyRanges){const{sortKey:A,symbolInstanceStart:B,symbolInstanceEnd:C}=z;b.push({sortKey:A,symbolInstanceStart:B,symbolInstanceEnd:C,parameters:y})}else b.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:y})}attemptAnchorPlacement(a,b,c,d,f,g,h,i,j,k,l,m,n,o,p,q,r,s){const u=[m.textOffset0,m.textOffset1],v=aH(a,c,d,u,f),w=this.collisionIndex.placeCollisionBox(f,b,aI(v.x,v.y,g,h,this.transform.angle),l,i,j,k.predicate);if((!q||0!==this.collisionIndex.placeCollisionBox(o.getSymbolInstanceIconSize(s,this.transform.zoom,n),q,aI(v.x,v.y,g,h,this.transform.angle),l,i,j,k.predicate).box.length)&&w.box.length>0){let x;return this.prevPlacement&&this.prevPlacement.variableOffsets[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID]&&this.prevPlacement.placements[m.crossTileID].text&&(x=this.prevPlacement.variableOffsets[m.crossTileID].anchor),this.variableOffsets[m.crossTileID]={textOffset:u,width:c,height:d,anchor:a,textScale:f,prevAnchor:x},this.markUsedJustification(o,a,m,p),o.allowVerticalPlacement&&(this.markUsedOrientation(o,p,m),this.placedOrientations[m.crossTileID]=p),{shift:v,placedGlyphBoxes:w}}}placeLayerBucketPart(b,c,d,f){const{bucket:g,layout:h,posMatrix:i,textLabelPlaneMatrix:j,labelToScreenMatrix:k,clippingData:l,textPixelRatio:m,holdingForFade:n,collisionBoxArray:o,partiallyEvaluatedTextSize:p,partiallyEvaluatedIconSize:q,collisionGroup:r}=b.parameters,s=h.get("text-optional"),u=h.get("icon-optional"),v=h.get("text-allow-overlap"),w=h.get("icon-allow-overlap"),x="map"===h.get("text-rotation-alignment"),y="map"===h.get("text-pitch-alignment"),z="none"!==h.get("icon-text-fit"),A="viewport-y"===h.get("symbol-z-order"),B=v&&(w||!g.hasIconData()||u),C=w&&(v||!g.hasTextData()||s);!g.collisionArrays&&o&&g.deserializeCollisionBoxes(o),d&&f&&g.updateCollisionDebugBuffers(this.transform.zoom,o);const D=(b,f,o)=>{if(l){const A={zoom:this.transform.zoom,pitch:this.transform.pitch};let D=null;if(l.dynamicFilterNeedsFeature){const E=this.retainedQueryData[g.bucketInstanceId];D=l.featureIndex.loadFeature({featureIndex:b.featureIndex,bucketIndex:E.bucketIndex,sourceLayerIndex:E.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,l.dynamicFilter)(A,D,this.retainedQueryData[g.bucketInstanceId].tileID.canonical,new a.pointGeometry(b.tileAnchorX,b.tileAnchorY),this.transform.calculateDistanceTileData(l.unwrappedTileID)))return this.placements[b.crossTileID]=new aE(!1,!1,!1,!0),void(c[b.crossTileID]=!0)}if(c[b.crossTileID])return;if(n)return void(this.placements[b.crossTileID]=new aE(!1,!1,!1));let F=!1,G=!1,H=!0,I=null,J={box:null,offscreen:null},K={box:null,offscreen:null},L=null,M=null,N=null,O=0,P=0,Q=0;o.textFeatureIndex?O=o.textFeatureIndex:b.useRuntimeCollisionCircles&&(O=b.featureIndex),o.verticalTextFeatureIndex&&(P=o.verticalTextFeatureIndex);const R=a=>{a.tileID=this.retainedQueryData[g.bucketInstanceId].tileID,(this.transform.elevation||a.elevation)&&(a.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[g.bucketInstanceId].tileID,a.tileAnchorX,a.tileAnchorY):0)},S=o.textBox;if(S){R(S);const T=c=>{let d=a.WritingMode.horizontal;if(g.allowVerticalPlacement&&!c&&this.prevPlacement){const f=this.prevPlacement.placedOrientations[b.crossTileID];f&&(this.placedOrientations[b.crossTileID]=f,d=f,this.markUsedOrientation(g,d,b))}return d},U=(c,d)=>{if(g.allowVerticalPlacement&&b.numVerticalGlyphVertices>0&&o.verticalTextBox){for(const f of g.writingModes)if(f===a.WritingMode.vertical?K=J=d():J=c(),J&&J.box&&J.box.length)break}else J=c()};if(h.get("text-variable-anchor")){let V=h.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[b.crossTileID]){const W=this.prevPlacement.variableOffsets[b.crossTileID];V.indexOf(W.anchor)>0&&(V=V.filter(a=>a!==W.anchor)).unshift(W.anchor)}const X=(a,c,d)=>{const h=g.getSymbolInstanceTextSize(p,b,this.transform.zoom,f),j=(a.x2-a.x1)*h+2*a.padding,k=(a.y2-a.y1)*h+2*a.padding,l=z&&!w?c:null;l&&R(l);let n={box:[],offscreen:!1};const o=v?2*V.length:V.length;for(let s=0;s=V.length,b,f,g,d,l,p,q);if(u&&(n=u.placedGlyphBoxes)&&n.box&&n.box.length){F=!0,I=u.shift;break}}return n};U(()=>X(S,o.iconBox,a.WritingMode.horizontal),()=>{const c=o.verticalTextBox;return c&&R(c),g.allowVerticalPlacement&&!(J&&J.box&&J.box.length)&&b.numVerticalGlyphVertices>0&&c?X(c,o.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),J&&(F=J.box,H=J.offscreen);const Y=T(J&&J.box);if(!F&&this.prevPlacement){const Z=this.prevPlacement.variableOffsets[b.crossTileID];Z&&(this.variableOffsets[b.crossTileID]=Z,this.markUsedJustification(g,Z.anchor,b,Y))}}else{const $=(c,d)=>{const h=g.getSymbolInstanceTextSize(p,b,this.transform.zoom,f),j=this.collisionIndex.placeCollisionBox(h,c,new a.pointGeometry(0,0),v,m,i,r.predicate);return j&&j.box&&j.box.length&&(this.markUsedOrientation(g,d,b),this.placedOrientations[b.crossTileID]=d),j};U(()=>$(S,a.WritingMode.horizontal),()=>{const c=o.verticalTextBox;return g.allowVerticalPlacement&&b.numVerticalGlyphVertices>0&&c?(R(c),$(c,a.WritingMode.vertical)):{box:null,offscreen:null}}),T(J&&J.box&&J.box.length)}}if(F=(L=J)&&L.box&&L.box.length>0,H=L&&L.offscreen,b.useRuntimeCollisionCircles){const _=g.text.placedSymbolArray.get(b.centerJustifiedTextSymbolIndex>=0?b.centerJustifiedTextSymbolIndex:b.verticalPlacedTextSymbolIndex),aa=a.evaluateSizeForFeature(g.textSizeData,p,_),ab=h.get("text-padding");M=this.collisionIndex.placeCollisionCircles(v,_,g.lineVertexArray,g.glyphOffsetArray,aa,i,j,k,d,y,r.predicate,b.collisionCircleDiameter*aa/a.ONE_EM,ab,this.retainedQueryData[g.bucketInstanceId].tileID),F=v||M.circles.length>0&&!M.collisionDetected,H=H&&M.offscreen}if(o.iconFeatureIndex&&(Q=o.iconFeatureIndex),o.iconBox){const ac=b=>{R(b);const c=z&&I?aI(I.x,I.y,x,y,this.transform.angle):new a.pointGeometry(0,0),d=g.getSymbolInstanceIconSize(q,this.transform.zoom,f);return this.collisionIndex.placeCollisionBox(d,b,c,w,m,i,r.predicate)};G=K&&K.box&&K.box.length&&o.verticalIconBox?(N=ac(o.verticalIconBox)).box.length>0:(N=ac(o.iconBox)).box.length>0,H=H&&N.offscreen}const ad=s||0===b.numHorizontalGlyphVertices&&0===b.numVerticalGlyphVertices,ae=u||0===b.numIconVertices;if(ad||ae?ae?ad||(G=G&&F):F=G&&F:G=F=G&&F,F&&L&&L.box&&this.collisionIndex.insertCollisionBox(L.box,h.get("text-ignore-placement"),g.bucketInstanceId,K&&K.box&&P?P:O,r.ID),G&&N&&this.collisionIndex.insertCollisionBox(N.box,h.get("icon-ignore-placement"),g.bucketInstanceId,Q,r.ID),M&&(F&&this.collisionIndex.insertCollisionCircles(M.circles,h.get("text-ignore-placement"),g.bucketInstanceId,O,r.ID),d)){const af=g.bucketInstanceId;let ag=this.collisionCircleArrays[af];void 0===ag&&(ag=this.collisionCircleArrays[af]=new aF);for(let ah=0;ah=0;--F){const G=E[F];D(g.symbolInstances.get(G),G,g.collisionArrays[G])}}else for(let H=b.symbolInstanceStart;H=0&&(b.text.placedSymbolArray.get(i).crossTileID=g>=0&&i!==g?0:d.crossTileID)}markUsedOrientation(b,c,d){const f=c===a.WritingMode.horizontal||c===a.WritingMode.horizontalOnly?c:0,g=c===a.WritingMode.vertical?c:0,h=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex,];for(const i of h)b.text.placedSymbolArray.get(i).placedOrientation=f;d.verticalPlacedTextSymbolIndex&&(b.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;const b=this.prevPlacement;let c=!1;this.prevZoomAdjustment=b?b.zoomAdjustment(this.transform.zoom):0;const d=b?b.symbolFadeChange(a):1,f=b?b.opacities:{},g=b?b.variableOffsets:{},h=b?b.placedOrientations:{};for(const i in this.placements){const j=this.placements[i],k=f[i];k?(this.opacities[i]=new aD(k,d,j.text,j.icon,null,j.clipped),c=c||j.text!==k.text.placed||j.icon!==k.icon.placed):(this.opacities[i]=new aD(null,d,j.text,j.icon,j.skipFade,j.clipped),c=c||j.text||j.icon)}for(const l in f){const m=f[l];if(!this.opacities[l]){const n=new aD(m,d,!1,!1);n.isHidden()||(this.opacities[l]=n,c=c||m.text.placed||m.icon.placed)}}for(const o in g)this.variableOffsets[o]||!this.opacities[o]||this.opacities[o].isHidden()||(this.variableOffsets[o]=g[o]);for(const p in h)this.placedOrientations[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.placedOrientations[p]=h[p]);c?this.lastPlacementChangeTime=a:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=b?b.lastPlacementChangeTime:a)}updateLayerOpacities(a,b){const c={};for(const d of b){const f=d.getBucket(a);f&&d.latestFeatureIndex&&a.id===f.layerIds[0]&&this.updateBucketOpacities(f,c,d.collisionBoxArray)}}updateBucketOpacities(b,c,d){b.hasTextData()&&b.text.opacityVertexArray.clear(),b.hasIconData()&&b.icon.opacityVertexArray.clear(),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexArray.clear(),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexArray.clear();const f=b.layers[0].layout,g=!!b.layers[0].dynamicFilter(),h=new aD(null,0,!1,!1,!0),i=f.get("text-allow-overlap"),j=f.get("icon-allow-overlap"),k=f.get("text-variable-anchor"),l="map"===f.get("text-rotation-alignment"),m="map"===f.get("text-pitch-alignment"),n="none"!==f.get("icon-text-fit"),o=new aD(null,0,i&&(j||!b.hasIconData()||f.get("icon-optional")),j&&(i||!b.hasTextData()||f.get("text-optional")),!0);!b.collisionArrays&&d&&(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData())&&b.deserializeCollisionBoxes(d);const p=(a,b,c)=>{for(let d=0;d0||v>0,z=s.numIconVertices>0,A=this.placedOrientations[s.crossTileID],B=A===a.WritingMode.vertical,C=A===a.WritingMode.horizontal||A===a.WritingMode.horizontalOnly;if(!y&&!z||x.isHidden()||q++,y){const D=aK(x.text);p(b.text,u,B?0:D),p(b.text,v,C?0:D);const E=x.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex,].forEach(a=>{a>=0&&(b.text.placedSymbolArray.get(a).hidden=E||B?1:0)}),s.verticalPlacedTextSymbolIndex>=0&&(b.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=E||C?1:0);const F=this.variableOffsets[s.crossTileID];F&&this.markUsedJustification(b,F.anchor,s,A);const G=this.placedOrientations[s.crossTileID];G&&(this.markUsedJustification(b,"left",s,G),this.markUsedOrientation(b,G,s))}if(z){const H=aK(x.icon);s.placedIconSymbolIndex>=0&&(p(b.icon,s.numIconVertices,B?0:H),b.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=x.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(p(b.icon,s.numVerticalIconVertices,C?0:H),b.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=x.icon.isHidden())}if(b.hasIconCollisionBoxData()||b.hasTextCollisionBoxData()){const I=b.collisionArrays[r];if(I){let J=new a.pointGeometry(0,0),K=!0;if(I.textBox||I.verticalTextBox){if(k){const L=this.variableOffsets[w];L?(J=aH(L.anchor,L.width,L.height,L.textOffset,L.textScale),l&&J._rotate(m?this.transform.angle:-this.transform.angle)):K=!1}g&&(K=!x.clipped),I.textBox&&aJ(b.textCollisionBox.collisionVertexArray,x.text.placed,!K||B,J.x,J.y),I.verticalTextBox&&aJ(b.textCollisionBox.collisionVertexArray,x.text.placed,!K||C,J.x,J.y)}const M=K&&Boolean(!C&&I.verticalIconBox);I.iconBox&&aJ(b.iconCollisionBox.collisionVertexArray,x.icon.placed,M,n?J.x:0,n?J.y:0),I.verticalIconBox&&aJ(b.iconCollisionBox.collisionVertexArray,x.icon.placed,!M,n?J.x:0,n?J.y:0)}}}if(b.fullyClipped=0===q,b.sortFeatures(this.transform.angle),this.retainedQueryData[b.bucketInstanceId]&&(this.retainedQueryData[b.bucketInstanceId].featureSortOrder=b.featureSortOrder),b.hasTextData()&&b.text.opacityVertexBuffer&&b.text.opacityVertexBuffer.updateData(b.text.opacityVertexArray),b.hasIconData()&&b.icon.opacityVertexBuffer&&b.icon.opacityVertexBuffer.updateData(b.icon.opacityVertexArray),b.hasIconCollisionBoxData()&&b.iconCollisionBox.collisionVertexBuffer&&b.iconCollisionBox.collisionVertexBuffer.updateData(b.iconCollisionBox.collisionVertexArray),b.hasTextCollisionBoxData()&&b.textCollisionBox.collisionVertexBuffer&&b.textCollisionBox.collisionVertexBuffer.updateData(b.textCollisionBox.collisionVertexArray),b.bucketInstanceId in this.collisionCircleArrays){const N=this.collisionCircleArrays[b.bucketInstanceId];b.placementInvProjMatrix=N.invProjMatrix,b.placementViewportMatrix=N.viewportMatrix,b.collisionCircleArray=N.circles,delete this.collisionCircleArrays[b.bucketInstanceId]}}symbolFadeChange(a){return 0===this.fadeDuration?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(a){return Math.max(0,(this.transform.zoom-a)/1.5)}hasTransitions(a){return this.stale||a-this.lastPlacementChangeTimea}setStale(){this.stale=!0}}(b,g,h,i,j),this._currentPlacementIndex=c.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(b,c,d){const f=a.exported.now(),g=()=>{const b=a.exported.now()-f;return!this._forceFullPlacement&&b>2};for(;this._currentPlacementIndex>=0;){const h=c[b[this._currentPlacementIndex]],i=this.placement.collisionIndex.transform.zoom;if("symbol"===h.type&&(!h.minzoom||h.minzoom<=i)&&(!h.maxzoom||h.maxzoom>i)){if(this._inProgressLayer||(this._inProgressLayer=new aL(h)),this._inProgressLayer.continuePlacement(d[h.source],this.placement,this._showCollisionBoxes,h,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(a){return this.placement.commit(a),this.placement}}const aN=512/a.EXTENT/2;class aO{constructor(a,b,c){this.tileID=a,this.indexedSymbolInstances={},this.bucketInstanceId=c;for(let d=0;da.overscaledZ)for(const i in h){const j=h[i];j.tileID.isChildOf(a)&&j.findMatches(b.symbolInstances,a,f)}else{const k=h[a.scaledTo(Number(g)).key];k&&k.findMatches(b.symbolInstances,a,f)}}for(let l=0;l{b[a]=!0}),this.layerIndexes)b[c]||delete this.layerIndexes[c]}}const aR=(b,c)=>a.emitValidationErrors(b,c&&c.filter(a=>"source.canvas"!==a.identifier)),aS=a.pick(ad,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),aT=a.pick(ad,["setCenter","setZoom","setBearing","setPitch",]),aU=function(){const b={},c=a.spec.$version;for(const d in a.spec.$root){const f=a.spec.$root[d];if(f.required){let g=null;null!=(g="version"===d?c:"array"===f.type?[]:{})&&(b[d]=g)}}return b}(),aV={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class aW extends a.Evented{constructor(b,c={}){super(),this.map=b,this.dispatcher=new B(aa(),this),this.imageManager=new o,this.imageManager.setEventedParent(this),this.glyphManager=new a.GlyphManager(b._requestManager,c.localFontFamily?a.LocalGlyphMode.all:c.localIdeographFontFamily?a.LocalGlyphMode.ideographs:a.LocalGlyphMode.none,c.localFontFamily||c.localIdeographFontFamily),this.lineAtlas=new a.LineAtlas(256,512),this.crossTileSymbolIndex=new aQ,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const d=this;this._rtlTextPluginCallback=aW.registerForPluginStateChange(b=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:b.pluginStatus,pluginURL:b.pluginURL},(b,c)=>{if(a.triggerPluginCompletionEvent(b),c&&c.every(a=>a))for(const f in d._sourceCaches){const g=d._sourceCaches[f],h=g.getSource().type;"vector"!==h&&"geojson"!==h||g.reload()}})}),this.on("data",a=>{if("source"!==a.dataType||"metadata"!==a.sourceDataType)return;const b=this.getSource(a.sourceId);if(b&&b.vectorLayerIds)for(const c in this._layers){const d=this._layers[c];d.source===b.id&&this._validateLayer(d)}})}loadURL(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const d="boolean"==typeof c.validate?c.validate:!a.isMapboxURL(b);b=this.map._requestManager.normalizeStyleURL(b,c.accessToken);const f=this.map._requestManager.transformRequest(b,a.ResourceType.Style);this._request=a.getJSON(f,(b,c)=>{this._request=null,b?this.fire(new a.ErrorEvent(b)):c&&this._load(c,d)})}loadJSON(b,c={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(b,!1!==c.validate)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(aU,!1)}_updateLayerCount(a,b){const c=b?1:-1;a.is3D()&&(this._num3DLayers+=c),"circle"===a.type&&(this._numCircleLayers+=c),"symbol"===a.type&&(this._numSymbolLayers+=c)}_load(b,c){if(c&&aR(this,a.validateStyle(b)))return;for(const d in this._loaded=!0,this.stylesheet=b,this.updateProjection(),b.sources)this.addSource(d,b.sources[d],{validate:!1});this._changed=!1,b.sprite?this._loadSprite(b.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(b.glyphs);const f=ac(this.stylesheet.layers);for(let g of(this._order=f.map(a=>a.id),this._layers={},this._serializedLayers={},f))(g=a.createStyleLayer(g)).setEventedParent(this,{layer:{id:g.id}}),this._layers[g.id]=g,this._serializedLayers[g.id]=g.serialize(),this._updateLayerCount(g,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new r(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 a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(a){a?this.stylesheet.projection=a:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const a=this.map.transform.projection,b=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),c=this.map.transform.projection;if(this._loaded&&(c.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),b){if(c.isReprojectedInTileSpace||a.isReprojectedInTileSpace)for(const d in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[d].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(b){this._spriteRequest=function(b,c,d){let f,g,h;const i=a.exported.devicePixelRatio>1?"@2x":"";let j=a.getJSON(c.transformRequest(c.normalizeSpriteURL(b,i,".json"),a.ResourceType.SpriteJSON),(a,b)=>{j=null,h||(h=a,f=b,l())}),k=a.getImage(c.transformRequest(c.normalizeSpriteURL(b,i,".png"),a.ResourceType.SpriteImage),(a,b)=>{k=null,h||(h=a,g=b,l())});function l(){if(h)d(h);else if(f&&g){const b=a.exported.getImageData(g),c={};for(const i in f){const{width:j,height:k,x:l,y:m,sdf:n,pixelRatio:o,stretchX:p,stretchY:q,content:r}=f[i],s=new a.RGBAImage({width:j,height:k});a.RGBAImage.copy(b,s,{x:l,y:m},{x:0,y:0},{width:j,height:k}),c[i]={data:s,pixelRatio:o,sdf:n,stretchX:p,stretchY:q,content:r}}d(null,c)}}return{cancel(){j&&(j.cancel(),j=null),k&&(k.cancel(),k=null)}}}(b,this.map._requestManager,(b,c)=>{if(this._spriteRequest=null,b)this.fire(new a.ErrorEvent(b));else if(c)for(const d in c)this.imageManager.addImage(d,c[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(b){const c=this.getSource(b.source);if(!c)return;const d=b.sourceLayer;d&&("geojson"===c.type||c.vectorLayerIds&& -1===c.vectorLayerIds.indexOf(d))&&this.fire(new a.ErrorEvent(Error(`Source layer "${d}" does not exist on source "${c.id}" as specified by style layer "${b.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const a in this._sourceCaches)if(!this._sourceCaches[a].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(a){const b=[];for(const c of a){const d=this._layers[c];"custom"!==d.type&&b.push(d.serialize())}return b}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const a in this._sourceCaches)if(this._sourceCaches[a].hasTransition())return!0;for(const b in this._layers)if(this._layers[b].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(a){return!!this.terrain&&aV[a.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(b){if(!this._loaded)return;const c=this._changed;if(this._changed){const d=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);for(const g in(d.length||f.length)&&this._updateWorkerLayers(d,f),this._updatedSources){const h=this._updatedSources[g];"reload"===h?this._reloadSource(g):"clear"===h&&this._clearSource(g)}for(const i in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[i].updateTransitions(b);this.light.updateTransitions(b),this.fog&&this.fog.updateTransitions(b),this._resetUpdates()}const j={};for(const k in this._sourceCaches){const l=this._sourceCaches[k];j[k]=l.used,l.used=!1}for(const m of this._order){const n=this._layers[m];if(n.recalculate(b,this._availableImages),!n.isHidden(b.zoom)){const o=this._getLayerSourceCache(n);o&&(o.used=!0)}const p=this.map.painter;if(p){const q=n.getProgramIds();if(!q)continue;const r=n.getProgramConfiguration(b.zoom);for(const s of q)p.useProgram(s,r)}}for(const u in j){const v=this._sourceCaches[u];j[u]!==v.used&&v.getSource().fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:v.getSource().id}))}this.light.recalculate(b),this.terrain&&this.terrain.recalculate(b),this.fog&&this.fog.recalculate(b),this.z=b.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),c&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const a=Object.keys(this._changedImages);if(a.length){for(const b in this._sourceCaches)this._sourceCaches[b].reloadTilesForDependencies(["icons","patterns"],a);this._changedImages={}}}_updateWorkerLayers(a,b){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(a),removedIds:b})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(b){if(this._checkLoaded(),aR(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=ac(b.layers);const c=(function(a,b){if(!a)return[{command:ad.setStyle,args:[b]},];let c=[];try{if(!g(a.version,b.version))return[{command:ad.setStyle,args:[b]},];g(a.center,b.center)||c.push({command:ad.setCenter,args:[b.center]}),g(a.zoom,b.zoom)||c.push({command:ad.setZoom,args:[b.zoom]}),g(a.bearing,b.bearing)||c.push({command:ad.setBearing,args:[b.bearing]}),g(a.pitch,b.pitch)||c.push({command:ad.setPitch,args:[b.pitch]}),g(a.sprite,b.sprite)||c.push({command:ad.setSprite,args:[b.sprite]}),g(a.glyphs,b.glyphs)||c.push({command:ad.setGlyphs,args:[b.glyphs]}),g(a.transition,b.transition)||c.push({command:ad.setTransition,args:[b.transition]}),g(a.light,b.light)||c.push({command:ad.setLight,args:[b.light]}),g(a.fog,b.fog)||c.push({command:ad.setFog,args:[b.fog]}),g(a.projection,b.projection)||c.push({command:ad.setProjection,args:[b.projection]});const d={},f=[];!function(a,b,c,d){let f;for(f in b=b||{},a=a||{})a.hasOwnProperty(f)&&(b.hasOwnProperty(f)||af(f,c,d));for(f in b){var h,i,j,k;b.hasOwnProperty(f)&&(a.hasOwnProperty(f)?g(a[f],b[f])||("geojson"===a[f].type&&"geojson"===b[f].type&&ag(a,b,f)?c.push({command:ad.setGeoJSONSourceData,args:[f,b[f].data,]}):(h=f,i=b,j=c,k=d,af(h,j,k),ae(h,i,j))):ae(f,b,c))}}(a.sources,b.sources,f,d);const h=[];a.layers&&a.layers.forEach(a=>{d[a.source]?c.push({command:ad.removeLayer,args:[a.id]}):h.push(a)});let i=a.terrain;i&&d[i.source]&&(c.push({command:ad.setTerrain,args:[void 0]}),i=void 0),c=c.concat(f),g(i,b.terrain)||c.push({command:ad.setTerrain,args:[b.terrain]}),function(a,b,c){b=b||[];const d=(a=a||[]).map(ai),f=b.map(ai),h=a.reduce(aj,{}),i=b.reduce(aj,{}),j=d.slice(),k=Object.create(null);let l,m,n,o,p,q,r;for(l=0,m=0;l!(a.command in aT));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in aS));if(d.length>0)throw Error(`Unimplemented: ${d.map(a=>a.command).join(", ")}.`);return c.forEach(a=>{"setTransition"!==a.command&&this[a.command].apply(this,a.args)}),this.stylesheet=b,this.updateProjection(),!0}addImage(b,c){if(this.getImage(b))return this.fire(new a.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(b,c),this._afterImageUpdated(b)}updateImage(a,b){this.imageManager.updateImage(a,b)}getImage(a){return this.imageManager.getImage(a)}removeImage(b){if(!this.getImage(b))return this.fire(new a.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(b),this._afterImageUpdated(b)}_afterImageUpdated(b){this._availableImages=this.imageManager.listImages(),this._changedImages[b]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(b,c,d={}){if(this._checkLoaded(),void 0!==this.getSource(b))throw Error("There is already a source with this ID");if(!c.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(c).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(c.type)>=0&&this._validate(a.validateStyle.source,`sources.${b}`,c,null,d))return;this.map&&this.map._collectResourceTiming&&(c.collectResourceTiming=!0);const f=T(b,c,this.dispatcher,this);f.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:f.serialize(),sourceId:b}));const g=c=>{const d=(c?"symbol:":"other:")+b,g=this._sourceCaches[d]=new a.SourceCache(d,f,c);(c?this._symbolSourceCaches:this._otherSourceCaches)[b]=g,g.style=this,g.onAdd(this.map)};g(!1),"vector"!==c.type&&"geojson"!==c.type||g(!0),f.onAdd&&f.onAdd(this.map),this._changed=!0}removeSource(b){this._checkLoaded();const c=this.getSource(b);if(void 0===c)throw Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.get().source===b)return this.fire(new a.ErrorEvent(Error(`Source "${b}" cannot be removed while terrain is using it.`)));const f=this._getSourceCaches(b);for(const g of f)delete this._sourceCaches[g.id],delete this._updatedSources[g.id],g.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:g.getSource().id})),g.setEventedParent(null),g.clearTiles();delete this._otherSourceCaches[b],delete this._symbolSourceCaches[b],c.setEventedParent(null),c.onRemove&&c.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(a,b){this._checkLoaded(),this.getSource(a).setData(b),this._changed=!0}getSource(a){const b=this._getSourceCache(a);return b&&b.getSource()}addLayer(b,c,d={}){this._checkLoaded();const f=b.id;if(this.getLayer(f))return void this.fire(new a.ErrorEvent(Error(`Layer with id "${f}" already exists on this map`)));let g;if("custom"===b.type){if(aR(this,a.validateCustomStyleLayer(b)))return;g=a.createStyleLayer(b)}else{if("object"==typeof b.source&&(this.addSource(f,b.source),b=a.clone$1(b),b=a.extend(b,{source:f})),this._validate(a.validateStyle.layer,`layers.${f}`,b,{arrayIndex:-1},d))return;g=a.createStyleLayer(b),this._validateLayer(g),g.setEventedParent(this,{layer:{id:f}}),this._serializedLayers[g.id]=g.serialize(),this._updateLayerCount(g,!0)}const h=c?this._order.indexOf(c):this._order.length;if(c&& -1===h)return void this.fire(new a.ErrorEvent(Error(`Layer with id "${c}" does not exist on this map.`)));this._order.splice(h,0,f),this._layerOrderChanged=!0,this._layers[f]=g;const i=this._getLayerSourceCache(g);if(this._removedLayers[f]&&g.source&&i&&"custom"!==g.type){const j=this._removedLayers[f];delete this._removedLayers[f],j.type!==g.type?this._updatedSources[g.source]="clear":(this._updatedSources[g.source]="reload",i.pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(b,c){if(this._checkLoaded(),this._changed=!0,!this._layers[b])return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be moved.`)));if(b===c)return;const d=this._order.indexOf(b);this._order.splice(d,1);const f=c?this._order.indexOf(c):this._order.length;c&& -1===f?this.fire(new a.ErrorEvent(Error(`Layer with id "${c}" does not exist on this map.`))):(this._order.splice(f,0,b),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(b){this._checkLoaded();const c=this._layers[b];if(!c)return void this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be removed.`)));c.setEventedParent(null),this._updateLayerCount(c,!1);const d=this._order.indexOf(b);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[b]=c,delete this._layers[b],delete this._serializedLayers[b],delete this._updatedLayers[b],delete this._updatedPaintProps[b],c.onRemove&&c.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(a){return this._layers[a]}hasLayer(a){return a in this._layers}hasLayerType(a){for(const b in this._layers)if(this._layers[b].type===a)return!0;return!1}setLayerZoomRange(b,c,d){this._checkLoaded();const f=this.getLayer(b);f?f.minzoom===c&&f.maxzoom===d||(null!=c&&(f.minzoom=c),null!=d&&(f.maxzoom=d),this._updateLayer(f)):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(b,c,d={}){this._checkLoaded();const f=this.getLayer(b);if(f){if(!g(f.filter,c))return null==c?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(a.validateStyle.filter,`layers.${f.id}.filter`,c,{layerType:f.type},d)||(f.filter=a.clone$1(c),this._updateLayer(f)))}else this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be filtered.`)))}getFilter(b){return a.clone$1(this.getLayer(b).filter)}setLayoutProperty(b,c,d,f={}){this._checkLoaded();const h=this.getLayer(b);h?g(h.getLayoutProperty(c),d)||(h.setLayoutProperty(c,d,f),this._updateLayer(h)):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(b,c){const d=this.getLayer(b);if(d)return d.getLayoutProperty(c);this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style.`)))}setPaintProperty(b,c,d,f={}){this._checkLoaded();const h=this.getLayer(b);h?g(h.getPaintProperty(c),d)||(h.setPaintProperty(c,d,f)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[b]=!0):this.fire(new a.ErrorEvent(Error(`The layer '${b}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(a,b){return this.getLayer(a).getPaintProperty(b)}setFeatureState(b,c){this._checkLoaded();const d=b.source,f=b.sourceLayer,g=this.getSource(d);if(void 0===g)return void this.fire(new a.ErrorEvent(Error(`The source '${d}' does not exist in the map's style.`)));const h=g.type;if("geojson"===h&&f)return void this.fire(new a.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===h&&!f)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided.")));const i=this._getSourceCaches(d);for(const j of i)j.setFeatureState(f,b.id,c)}removeFeatureState(b,c){this._checkLoaded();const d=b.source,f=this.getSource(d);if(void 0===f)return void this.fire(new a.ErrorEvent(Error(`The source '${d}' does not exist in the map's style.`)));const g=f.type,h="vector"===g?b.sourceLayer:void 0;if("vector"===g&&!h)return void this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(c&&"string"!=typeof b.id&&"number"!=typeof b.id)return void this.fire(new a.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const i=this._getSourceCaches(d);for(const j of i)j.removeFeatureState(h,b.id,c)}getFeatureState(b){this._checkLoaded();const c=b.source,d=b.sourceLayer,f=this.getSource(c);if(void 0!==f){if("vector"!==f.type||d)return void 0===b.id&&this.fire(new a.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(c)[0].getFeatureState(d,b.id);this.fire(new a.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new a.ErrorEvent(Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const b={};for(const c in this._sourceCaches){const d=this._sourceCaches[c].getSource();b[d.id]||(b[d.id]=d.serialize())}return a.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:b,layers:this._serializeLayers(this._order)},a=>void 0!==a)}_updateLayer(a){this._updatedLayers[a.id]=!0;const b=this._getLayerSourceCache(a);a.source&&!this._updatedSources[a.source]&&b&&"raster"!==b.getSource().type&&(this._updatedSources[a.source]="reload",b.pause()),this._changed=!0,a.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(a){var b,c;const d={},f=[];for(let g=this._order.length-1;g>=0;g--){const h=this._order[g];if(b=h,"fill-extrusion"===this._layers[b].type)for(const i of(d[h]=g,a)){const j=i[h];if(j)for(const k of j)f.push(k)}}f.sort((a,b)=>b.intersectionZ-a.intersectionZ);const l=[];for(let m=this._order.length-1;m>=0;m--){const n=this._order[m];if(c=n,"fill-extrusion"===this._layers[c].type)for(let o=f.length-1;o>=0;o--){const p=f[o].feature;if(d[p.layer.id]{const b=this.getLayer(a);return b&&b.is3D()}):this.has3DLayers(),k=L.createFromScreenPoints(b,d);for(const l in this._sourceCaches){const m=this._sourceCaches[l].getSource().id;c.layers&&!f[m]||i.push(V(this._sourceCaches[l],this._layers,this._serializedLayers,k,c,d,j,!!this.map._showQueryGeometry))}return this.placement&&i.push(function(a,b,c,d,f,g,h){const i={},j=g.queryRenderedSymbols(d),k=[];for(const l of Object.keys(j).map(Number))k.push(h[l]);for(const m of(k.sort(X),k)){const n=m.featureIndex.lookupSymbolFeatures(j[m.bucketInstanceId],b,m.bucketIndex,m.sourceLayerIndex,f.filter,f.layers,f.availableImages,a);for(const o in n){const p=i[o]=i[o]||[],q=n[o];for(const r of(q.sort((a,b)=>{const c=m.featureSortOrder;if(c){const d=c.indexOf(a.featureIndex);return c.indexOf(b.featureIndex)-d}return b.featureIndex-a.featureIndex}),q))p.push(r)}}for(const s in i)i[s].forEach(b=>{const d=b.feature,f=c(a[s]).getFeatureState(d.layer["source-layer"],d.id);d.source=d.layer.source,d.layer["source-layer"]&&(d.sourceLayer=d.layer["source-layer"]),d.state=f});return i}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),k.screenGeometry,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(i)}querySourceFeatures(b,c){c&&c.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",c.filter,null,c);const d=this._getSourceCaches(b);let f=[];for(const g of d)f=f.concat(W(g,c));return f}addSourceType(a,b,c){return aW.getSourceType(a)?c(Error(`A source type called "${a}" already exists.`)):(aW.setSourceType(a,b),b.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:a,url:b.workerSourceURL},c):c(null,null))}getLight(){return this.light.getLight()}setLight(b,c={}){this._checkLoaded();const d=this.light.getLight();let f=!1;for(const h in b)if(!g(b[h],d[h])){f=!0;break}if(!f)return;const i={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(b,c),this.light.updateTransitions(i)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(b,c=1){if(this._checkLoaded(),!b)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===c){if("object"==typeof b.source){const d="terrain-dem-src";this.addSource(d,b.source),b=a.clone$1(b),b=a.extend(b,{source:d})}if(this._validate(a.validateStyle.terrain,"terrain",b))return}if(!this.terrain||this.terrain&&c!==this.terrain.drapeRenderMode)this._createTerrain(b,c);else{const f=this.terrain,h=f.get();for(const i in b)if(!g(b[i],h[i])){f.set(b),this.stylesheet.terrain=b;const j={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};f.updateTransitions(j);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(b){const c=this.fog=new A(b,this.map.transform);this.stylesheet.fog=b;const d={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(d)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const a of this.map._markers)a._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(b){if(this._checkLoaded(),!b)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const c=this.fog,d=c.get();for(const f in b)if(!g(b[f],d[f])){c.set(b),this.stylesheet.fog=b;const h={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};c.updateTransitions(h);break}}else this._createFog(b);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const a=this._order.filter(a=>this.isLayerDraped(this._layers[a])),b=this._order.filter(a=>!this.isLayerDraped(this._layers[a]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...a),this._drapedFirstOrder.push(...b)}_createTerrain(b,c){const d=this.terrain=new v(b,c);this.stylesheet.terrain=b,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const f={now:a.exported.now(),transition:a.extend({duration:0},this.stylesheet.transition)};d.updateTransitions(f)}_force3DLayerUpdate(){for(const a in this._layers){const b=this._layers[a];"fill-extrusion"===b.type&&this._updateLayer(b)}}_forceSymbolLayerUpdate(){for(const a in this._layers){const b=this._layers[a];"symbol"===b.type&&this._updateLayer(b)}}_validate(b,c,d,f,g={}){return(!g|| !1!==g.validate)&&aR(this,b.call(a.validateStyle,a.extend({key:c,style:this.serialize(),value:d,styleSpec:a.spec},f)))}_remove(){for(const b in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[b].setEventedParent(null);for(const c in this._sourceCaches)this._sourceCaches[c].clearTiles(),this._sourceCaches[c].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(a){const b=this._getSourceCaches(a);for(const c of b)c.clearTiles()}_reloadSource(a){const b=this._getSourceCaches(a);for(const c of b)c.resume(),c.reload()}_updateSources(a){for(const b in this._sourceCaches)this._sourceCaches[b].update(a)}_generateCollisionBoxes(){for(const a in this._sourceCaches){const b=this._sourceCaches[a];b.resume(),b.reload()}}_updatePlacement(b,c,d,f,g=!1){let h=!1,i=!1;const j={};for(const k of this._order){const l=this._layers[k];if("symbol"!==l.type)continue;if(!j[l.source]){const m=this._getLayerSourceCache(l);if(!m)continue;j[l.source]=m.getRenderableIds(!0).map(a=>m.getTileByID(a)).sort((a,b)=>b.tileID.overscaledZ-a.tileID.overscaledZ||(a.tileID.isLessThan(b.tileID)?-1:1))}const n=this.crossTileSymbolIndex.addLayer(l,j[l.source],b.center.lng,b.projection);h=h||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),g=g||this._layerOrderChanged||0===d,this._layerOrderChanged&&this.fire(new a.Event("neworder")),(g||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),b.zoom))&&(this.pauseablePlacement=new aM(b,this._order,g,c,d,f,this.placement,this.fog&&b.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,j),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),i=!0),h&&this.pauseablePlacement.placement.setStale()),i||h)for(const o of this._order){const p=this._layers[o];"symbol"===p.type&&this.placement.updateLayerOpacities(p,j[p.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const a in this._sourceCaches)this._sourceCaches[a].releaseSymbolFadeTiles()}getImages(a,b,c){this.imageManager.getImages(b.icons,c),this._updateTilesForChangedImages();const d=a=>{a&&a.setDependencies(b.tileID.key,b.type,b.icons)};d(this._otherSourceCaches[b.source]),d(this._symbolSourceCaches[b.source])}getGlyphs(a,b,c){this.glyphManager.getGlyphs(b.stacks,c)}getResource(b,c,d){return a.makeRequest(c,d)}_getSourceCache(a){return this._otherSourceCaches[a]}_getLayerSourceCache(a){return"symbol"===a.type?this._symbolSourceCaches[a.source]:this._otherSourceCaches[a.source]}_getSourceCaches(a){const b=[];return this._otherSourceCaches[a]&&b.push(this._otherSourceCaches[a]),this._symbolSourceCaches[a]&&b.push(this._symbolSourceCaches[a]),b}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)}}aW.getSourceType=function(a){return S[a]},aW.setSourceType=function(a,b){S[a]=b},aW.registerForPluginStateChange=a.registerForPluginStateChange;var aX="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;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);}\n#endif",aY="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;}";let aZ={},a$={};aZ=a2("","\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\nfloat unpack_depth(vec4 rgba_depth)\n{const vec4 bit_shift=vec4(1.0/(256.0*256.0*256.0),1.0/(256.0*256.0),1.0/256.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",!0),a$=a2("#ifdef FOG\nuniform float u_fog_temporal_offset;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=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","#ifdef FOG\nuniform mat4 u_fog_matrix;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",!0);const a_=a2("\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;}\n#ifdef TERRAIN\nhighp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(256.0*256.0*256.0,256.0*256.0,256.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/256.0,1.0/256.0,1.0/256.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#endif","\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;}vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(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) {\n#if defined(PROJECTION_GLOBE_VIEW) && !defined(PROJECTED_POS_ON_VIEWPORT)\nreturn mix(globe,mercator,t);\n#else\nreturn globe;\n#endif\n}\n#ifdef PROJECTION_GLOBE_VIEW\nmat3 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."),a0=aX;var a1={background:a2("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:a2("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:a2("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;attribute float a_scale;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\nvec2 scaled_extrude=extrude*a_scale;vec3 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=scaled_extrude.x*surface_vectors[0]+scaled_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\n#if defined(SCALE_WITH_MAP) && defined(PROJECTION_GLOBE_VIEW)\nview_scale*=a_scale;\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:a2("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:a2("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\ngl_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;attribute float a_scale;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\nextrude*=a_scale;vec3 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:a2("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:a2("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:a2("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:a2("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:a2("#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:a2("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:a2("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:a2("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:a2("varying vec4 v_color;void main() {vec4 color=v_color;\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;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#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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,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\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);vec3 pos=vec3(pos_nx.xy,h);\n#else\nvec3 pos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_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*(pos.z+lift));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);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal,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)));}v_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:a2("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 out_color=mix(color1,color2,u_fade);out_color=out_color*v_lighting;\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#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==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;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)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:a2("#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:a2("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:a2("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\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;varying highp vec2 v_uv;\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\nvec4 out_color=texture2D(u_gradient_image,v_uv);\n#else\nvec4 out_color=color;\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#ifdef RENDER_LINE_GRADIENT\nattribute vec3 a_packed;\n#else\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;\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;varying highp vec2 v_uv;\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#ifdef RENDER_LINE_GRADIENT\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];float a_linesofar=a_packed[2];highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);\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:a2("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:a2("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:a2("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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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_minFontScale,fontScale)+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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));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_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:a2("#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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float 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:a2("#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_z_tile_anchor;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_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[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}float anchorZ=a_z_tile_anchor.x;vec2 tileAnchor=a_z_tile_anchor.yz;vec3 h=elevationVector(tileAnchor)*elevation(tileAnchor);vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,tileAnchor,u_tile_id,u_merc_center);vec3 world_pos=mix_globe_mercator(vec3(a_pos,anchorZ)+h,mercator_pos,u_zoom_transition);vec4 projectedPoint=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),anchorZ,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec3 proj_pos=mix_globe_mercator(vec3(a_projected_pos.xy,anchorZ),mercator_pos,u_zoom_transition);\n#ifdef PROJECTED_POS_ON_VIEWPORT\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xy,0.0,1.0);\n#else\nvec4 projected_pos=u_label_plane_matrix*vec4(proj_pos.xyz+h,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);\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(projectedPoint);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projectedPoint.w <=0.0 || occlusion_fade==0.0));float 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:a2("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\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\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}"),terrainDepth:a2("#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:a2("\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}",aY),skyboxGradient:a2("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}",aY),skyboxCapture:a2("\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:a2("uniform sampler2D u_image0;varying vec2 v_pos0;void main() {gl_FragColor=texture2D(u_image0,v_pos0);\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_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;attribute vec3 a_globe_pos;attribute vec2 a_merc_pos;attribute vec2 a_uv;varying vec2 v_pos0;const float wireframeOffset=1e3;void main() {v_pos0=a_uv;vec2 uv=a_uv*EXTENT;vec4 up_vector=vec4(elevationVector(uv),1.0);float height=elevation(uv);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nvec4 globe=u_globe_matrix*vec4(a_globe_pos+up_vector.xyz*height,1.0);vec4 mercator=vec4(0.0);if (u_zoom_transition > 0.0) {mercator=vec4(a_merc_pos,height,1.0);mercator.xy-=u_merc_center;mercator.x=wrap(mercator.x,-0.5,0.5);mercator=u_merc_matrix*mercator;}vec3 position=mix(globe.xyz,mercator.xyz,u_zoom_transition);gl_Position=u_proj_matrix*vec4(position,1.0);}"),globeAtmosphere:a2("uniform vec2 u_center;uniform float u_radius;uniform vec2 u_screen_size;uniform float u_opacity;uniform highp float u_fadeout_range;uniform vec3 u_start_color;uniform vec3 u_end_color;uniform float u_pixel_ratio;void main() {highp vec2 fragCoord=gl_FragCoord.xy/u_pixel_ratio;fragCoord.y=u_screen_size.y-fragCoord.y;float distFromCenter=length(fragCoord-u_center);float normDistFromCenter=length(fragCoord-u_center)/u_radius;if (normDistFromCenter < 1.0)\ndiscard;float t=clamp(1.0-sqrt(normDistFromCenter-1.0)/u_fadeout_range,0.0,1.0);vec3 color=mix(u_start_color,u_end_color,1.0-t);gl_FragColor=vec4(color*t*u_opacity,u_opacity);}","attribute vec3 a_pos;void main() {gl_Position=vec4(a_pos,1.0);}")};function a2(a,b,c){const d=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,f=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,g=b.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),h=a.match(f),i=b.match(f),j=aX.match(f);let k=i?i.concat(h):h;c||(aZ.staticUniforms&&(k=aZ.staticUniforms.concat(k)),a$.staticUniforms&&(k=a$.staticUniforms.concat(k))),k&&(k=k.concat(j));const l={};return{fragmentSource:a=a.replace(d,(a,b,c,d,f)=>(l[f]=!0,"define"===b?` #ifndef HAS_UNIFORM_u_${f} varying ${c} ${d} ${f}; #else @@ -54,7 +54,7 @@ uniform ${c} ${d} u_${f}; #else ${c} ${d} ${f} = u_${f}; #endif -`}),staticAttributes:g,staticUniforms:k}}class a5{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(a,b,c,d,f,g,h,i){this.context=a;let j=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!j&&k{const g=d.paint.get("hillshade-shadow-color"),h=d.paint.get("hillshade-highlight-color"),i=d.paint.get("hillshade-accent-color");let j=d.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===d.paint.get("hillshade-illumination-anchor")&&(j-=b.transform.angle);const k=!b.options.moving;return{u_matrix:f||b.transform.calculateProjMatrix(c.tileID.toUnwrapped(),k),u_image:0,u_latrange:function(b,c){const d=Math.pow(2,c.canonical.z),f=c.canonical.y;return[new a.MercatorCoordinate(0,f/d).toLngLat().lat,new a.MercatorCoordinate(0,(f+1)/d).toLngLat().lat,]}(0,c.tileID),u_light:[d.paint.get("hillshade-exaggeration"),j,],u_shadow:g,u_highlight:h,u_accent:i}})(b,d,f,b.terrain?c.projMatrix:null);b.prepareDrawProgram(j,m,c.toUnwrapped());const{tileBoundsBuffer:o,tileBoundsIndexBuffer:p,tileBoundsSegments:q}=b.getTileBoundsBuffers(d);m.draw(j,k.TRIANGLES,g,h,i,a.CullFaceMode.disabled,n,f.id,o,p,q)}function a7(b,c,d){if(!c.needsDEMTextureUpload)return;const f=b.context,g=f.gl;f.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture=c.demTexture||b.getTileTexture(d.stride);const h=d.getPixels();c.demTexture?c.demTexture.update(h,{premultiply:!1}):c.demTexture=new a.Texture(f,h,g.RGBA,{premultiply:!1}),c.needsDEMTextureUpload=!1}function a8(b,c,d,f,g,h){const i=b.context,j=i.gl;if(!c.dem)return;const k=c.dem;if(i.activeTexture.set(j.TEXTURE1),a7(b,c,k),!c.demTexture)return;c.demTexture.bind(j.NEAREST,j.CLAMP_TO_EDGE);const l=k.dim;i.activeTexture.set(j.TEXTURE0);let m=c.fbo;if(!m){const n=new a.Texture(i,{width:l,height:l,data:null},j.RGBA);n.bind(j.LINEAR,j.CLAMP_TO_EDGE),(m=c.fbo=i.createFramebuffer(l,l,!0)).colorAttachment.set(n.texture)}i.bindFramebuffer.set(m.framebuffer),i.viewport.set([0,0,l,l]);const{tileBoundsBuffer:o,tileBoundsIndexBuffer:p,tileBoundsSegments:q}=b.getMercatorTileBoundsBuffers();b.useProgram("hillshadePrepare").draw(i,j.TRIANGLES,f,g,h,a.CullFaceMode.disabled,((b,c)=>{const d=c.stride,f=a.create();return a.ortho(f,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(f,f,[0,-a.EXTENT,0]),{u_matrix:f,u_image:1,u_dimension:[d,d],u_zoom:b.overscaledZ,u_unpack:c.unpackVector}})(c.tileID,k),d.id,o,p,q),c.needsHillshadePrepare=!1}const a9=(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image0:new a.Uniform1i(b,c.u_image0),u_skirt_height:new a.Uniform1f(b,c.u_skirt_height)}),ba=(a,b)=>({u_matrix:a,u_image0:0,u_skirt_height:b}),bb=(a,b,c,d,f)=>({u_proj_matrix:Float32Array.from(a),u_globe_matrix:b,u_merc_matrix:c,u_zoom_transition:d,u_merc_center:f,u_image0:0});function bc(a,b){return null!=a&&null!=b&&!(!a.hasData()||!b.hasData())&&null!=a.demTexture&&null!=b.demTexture&&a.tileID.key!==b.tileID.key}const bd=new class{constructor(){this.operations={}}newMorphing(a,b,c,d,f){if(a in this.operations){const g=this.operations[a];g.to.tileID.key!==c.tileID.key&&(g.queued=c)}else this.operations[a]={startTime:d,phase:0,duration:f,from:b,to:c,queued:null}}getMorphValuesForProxy(a){if(!(a in this.operations))return null;const b=this.operations[a];return{from:b.from,to:b.to,phase:b.phase}}update(a){for(const b in this.operations){const c=this.operations[b];for(c.phase=(a-c.startTime)/c.duration;c.phase>=1||!this._validOp(c);)if(!this._nextOp(c,a)){delete this.operations[b];break}}}_nextOp(a,b){return!!a.queued&&(a.from=a.to,a.to=a.queued,a.queued=null,a.phase=0,a.startTime=b,!0)}_validOp(a){return a.from.hasData()&&a.to.hasData()}},be={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function bf(a,b){const c=1<({u_matrix:a});function bh(b,c,d,f,g){if(g>0){const h=a.exported.now(),i=(h-b.timeAdded)/g,j=c?(h-c.timeAdded)/g:-1,k=d.getSource(),l=f.coveringZoomLevel({tileSize:k.tileSize,roundZoom:k.roundZoom}),m=!c||Math.abs(c.tileID.overscaledZ-l)>Math.abs(b.tileID.overscaledZ-l),n=m&&b.refreshedUponExpiration?1:a.clamp(m?i:1-j,0,1);return b.refreshedUponExpiration&&i>=1&&(b.refreshedUponExpiration=!1),c?{opacity:1,mix:1-n}:{opacity:n,mix:0}}return{opacity:1,mix:0}}class bi extends a.SourceCache{constructor(a){const b={type:"raster-dem",maxzoom:a.transform.maxZoom},c=new B(ab(),null),d=U("mock-dem",b,c,a.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,b){a.state="loaded",b(null)}}class bj extends a.SourceCache{constructor(a){const b=U("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new B(ab(),null),a.style);super("proxy",b,!1),b.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(b,c,d){if(b.freezeTileCoverage)return;this.transform=b;const f=b.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((c,d)=>{if(c[d.key]="",!this._tiles[d.key]){const f=new a.Tile(d,this._source.tileSize*d.overscaleFactor(),b.tileZoom);f.state="loaded",this._tiles[d.key]=f}return c},{});for(const g in this._tiles)g in f||(this.freeFBO(g),this._tiles[g].unloadVectorData(),delete this._tiles[g])}freeFBO(a){const b=this.proxyCachedFBO[a];if(void 0!==b){const c=Object.values(b);this.renderCachePool.push(...c),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class bk extends a.OverscaledTileID{constructor(a,b,c){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=b,this.projMatrix=c}}class bl extends a.Elevation{constructor(b,c){super(),this.painter=b,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[d,f,g]=function(b){const c=new a.StructArrayLayout4i8,d=new a.StructArrayLayout3ui6;c.reserve(17161),d.reserve(33800);const f=a.EXTENT/128,g=a.EXTENT+f/2,h=g+f;for(let i=-f;ig||i<0||i>g?24575:0,l=a.clamp(Math.round(j),0,a.EXTENT),m=a.clamp(Math.round(i),0,a.EXTENT);c.emplaceBack(l+k,m,l,m)}const n=(a,b)=>{const c=131*b+a;d.emplaceBack(c+1,c,c+131),d.emplaceBack(c+131,c+131+1,c+1)};for(let o=1;o<129;o++)for(let p=1;p<129;p++)n(p,o);return[0,129].forEach(a=>{for(let b=0;b<130;b++)n(b,a),n(a,b)}),[c,d,32768]}(),h=b.context;this.gridBuffer=h.createVertexBuffer(d,a.boundsAttributes.members),this.gridIndexBuffer=h.createIndexBuffer(f),this.gridSegments=a.SegmentVector.simpleSegment(0,0,d.length,f.length),this.gridNoSkirtSegments=a.SegmentVector.simpleSegment(0,0,d.length,g),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new bj(c.map),this.orthoMatrix=a.create(),a.ortho(this.orthoMatrix,0,a.EXTENT,0,a.EXTENT,0,1);const i=h.gl;this._overlapStencilMode=new a.StencilMode({func:i.GEQUAL,mask:255},0,255,i.KEEP,i.KEEP,i.REPLACE),this._previousZoom=b.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=c,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new bi(c.map)}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),a.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=a,this._checkRenderCacheEfficiency()}update(b,c,d){if(b&&b.terrain){this._style!==b&&(this.style=b),this.enabled=!0;const f=b.terrain.properties;this.sourceCache=0===b.terrain.drapeRenderMode?this._mockSourceCache:b._getSourceCache(f.get("source")),this._exaggeration=f.get("exaggeration");const g=()=>{this.sourceCache.used&&a.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. +`}),staticAttributes:g,staticUniforms:k}}class a3{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(a,b,c,d,f,g,h,i){this.context=a;let j=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!j&&k{const g=d.paint.get("hillshade-shadow-color"),h=d.paint.get("hillshade-highlight-color"),i=d.paint.get("hillshade-accent-color");let j=d.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===d.paint.get("hillshade-illumination-anchor")&&(j-=b.transform.angle);const k=!b.options.moving;return{u_matrix:f||b.transform.calculateProjMatrix(c.tileID.toUnwrapped(),k),u_image:0,u_latrange:function(b,c){const d=Math.pow(2,c.canonical.z),f=c.canonical.y;return[new a.MercatorCoordinate(0,f/d).toLngLat().lat,new a.MercatorCoordinate(0,(f+1)/d).toLngLat().lat,]}(0,c.tileID),u_light:[d.paint.get("hillshade-exaggeration"),j,],u_shadow:g,u_highlight:h,u_accent:i}})(b,d,f,b.terrain?c.projMatrix:null);b.prepareDrawProgram(j,m,c.toUnwrapped());const{tileBoundsBuffer:o,tileBoundsIndexBuffer:p,tileBoundsSegments:q}=b.getTileBoundsBuffers(d);m.draw(j,k.TRIANGLES,g,h,i,a.CullFaceMode.disabled,n,f.id,o,p,q)}function a5(b,c,d){if(!c.needsDEMTextureUpload)return;const f=b.context,g=f.gl;f.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture=c.demTexture||b.getTileTexture(d.stride);const h=d.getPixels();c.demTexture?c.demTexture.update(h,{premultiply:!1}):c.demTexture=new a.Texture(f,h,g.RGBA,{premultiply:!1}),c.needsDEMTextureUpload=!1}function a6(b,c,d,f,g,h){const i=b.context,j=i.gl;if(!c.dem)return;const k=c.dem;if(i.activeTexture.set(j.TEXTURE1),a5(b,c,k),!c.demTexture)return;c.demTexture.bind(j.NEAREST,j.CLAMP_TO_EDGE);const l=k.dim;i.activeTexture.set(j.TEXTURE0);let m=c.fbo;if(!m){const n=new a.Texture(i,{width:l,height:l,data:null},j.RGBA);n.bind(j.LINEAR,j.CLAMP_TO_EDGE),(m=c.fbo=i.createFramebuffer(l,l,!0)).colorAttachment.set(n.texture)}i.bindFramebuffer.set(m.framebuffer),i.viewport.set([0,0,l,l]);const{tileBoundsBuffer:o,tileBoundsIndexBuffer:p,tileBoundsSegments:q}=b.getMercatorTileBoundsBuffers();b.useProgram("hillshadePrepare").draw(i,j.TRIANGLES,f,g,h,a.CullFaceMode.disabled,((b,c)=>{const d=c.stride,f=a.create();return a.ortho(f,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(f,f,[0,-a.EXTENT,0]),{u_matrix:f,u_image:1,u_dimension:[d,d],u_zoom:b.overscaledZ,u_unpack:c.unpackVector}})(c.tileID,k),d.id,o,p,q),c.needsHillshadePrepare=!1}const a7=(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image0:new a.Uniform1i(b,c.u_image0),u_skirt_height:new a.Uniform1f(b,c.u_skirt_height)}),a8=(a,b)=>({u_matrix:a,u_image0:0,u_skirt_height:b}),a9=(a,b,c,d,f)=>({u_proj_matrix:Float32Array.from(a),u_globe_matrix:b,u_merc_matrix:c,u_zoom_transition:d,u_merc_center:f,u_image0:0});function ba(a,b){return null!=a&&null!=b&&!(!a.hasData()||!b.hasData())&&null!=a.demTexture&&null!=b.demTexture&&a.tileID.key!==b.tileID.key}const bb=new class{constructor(){this.operations={}}newMorphing(a,b,c,d,f){if(a in this.operations){const g=this.operations[a];g.to.tileID.key!==c.tileID.key&&(g.queued=c)}else this.operations[a]={startTime:d,phase:0,duration:f,from:b,to:c,queued:null}}getMorphValuesForProxy(a){if(!(a in this.operations))return null;const b=this.operations[a];return{from:b.from,to:b.to,phase:b.phase}}update(a){for(const b in this.operations){const c=this.operations[b];for(c.phase=(a-c.startTime)/c.duration;c.phase>=1||!this._validOp(c);)if(!this._nextOp(c,a)){delete this.operations[b];break}}}_nextOp(a,b){return!!a.queued&&(a.from=a.to,a.to=a.queued,a.queued=null,a.phase=0,a.startTime=b,!0)}_validOp(a){return a.from.hasData()&&a.to.hasData()}},bc={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function bd(a,b){const c=1<({u_matrix:a});function bf(b,c,d,f,g){if(g>0){const h=a.exported.now(),i=(h-b.timeAdded)/g,j=c?(h-c.timeAdded)/g:-1,k=d.getSource(),l=f.coveringZoomLevel({tileSize:k.tileSize,roundZoom:k.roundZoom}),m=!c||Math.abs(c.tileID.overscaledZ-l)>Math.abs(b.tileID.overscaledZ-l),n=m&&b.refreshedUponExpiration?1:a.clamp(m?i:1-j,0,1);return b.refreshedUponExpiration&&i>=1&&(b.refreshedUponExpiration=!1),c?{opacity:1,mix:1-n}:{opacity:n,mix:0}}return{opacity:1,mix:0}}class bg extends a.SourceCache{constructor(a){const b={type:"raster-dem",maxzoom:a.transform.maxZoom},c=new B(aa(),null),d=T("mock-dem",b,c,a.style);super("mock-dem",d,!1),d.setEventedParent(this),this._sourceLoaded=!0}_loadTile(a,b){a.state="loaded",b(null)}}class bh extends a.SourceCache{constructor(a){const b=T("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new B(aa(),null),a.style);super("proxy",b,!1),b.setEventedParent(this),this.map=this.getSource().map=a,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(b,c,d){if(b.freezeTileCoverage)return;this.transform=b;const f=b.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((c,d)=>{if(c[d.key]="",!this._tiles[d.key]){const f=new a.Tile(d,this._source.tileSize*d.overscaleFactor(),b.tileZoom);f.state="loaded",this._tiles[d.key]=f}return c},{});for(const g in this._tiles)g in f||(this.freeFBO(g),this._tiles[g].unloadVectorData(),delete this._tiles[g])}freeFBO(a){const b=this.proxyCachedFBO[a];if(void 0!==b){const c=Object.values(b);this.renderCachePool.push(...c),delete this.proxyCachedFBO[a]}}deallocRenderCache(){this.renderCache.forEach(a=>a.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class bi extends a.OverscaledTileID{constructor(a,b,c){super(a.overscaledZ,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y),this.proxyTileKey=b,this.projMatrix=c}}class bj extends a.Elevation{constructor(b,c){super(),this.painter=b,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[d,f,g]=function(b){const c=new a.StructArrayLayout4i8,d=new a.StructArrayLayout3ui6;c.reserve(17161),d.reserve(33800);const f=a.EXTENT/128,g=a.EXTENT+f/2,h=g+f;for(let i=-f;ig||i<0||i>g?24575:0,l=a.clamp(Math.round(j),0,a.EXTENT),m=a.clamp(Math.round(i),0,a.EXTENT);c.emplaceBack(l+k,m,l,m)}const n=(a,b)=>{const c=131*b+a;d.emplaceBack(c+1,c,c+131),d.emplaceBack(c+131,c+131+1,c+1)};for(let o=1;o<129;o++)for(let p=1;p<129;p++)n(p,o);return[0,129].forEach(a=>{for(let b=0;b<130;b++)n(b,a),n(a,b)}),[c,d,32768]}(),h=b.context;this.gridBuffer=h.createVertexBuffer(d,a.boundsAttributes.members),this.gridIndexBuffer=h.createIndexBuffer(f),this.gridSegments=a.SegmentVector.simpleSegment(0,0,d.length,f.length),this.gridNoSkirtSegments=a.SegmentVector.simpleSegment(0,0,d.length,g),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new bh(c.map),this.orthoMatrix=a.create(),a.ortho(this.orthoMatrix,0,a.EXTENT,0,a.EXTENT,0,1);const i=h.gl;this._overlapStencilMode=new a.StencilMode({func:i.GEQUAL,mask:255},0,255,i.KEEP,i.KEEP,i.REPLACE),this._previousZoom=b.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=c,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new bg(c.map)}set style(a){a.on("data",this._onStyleDataEvent.bind(this)),a.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=a,this._checkRenderCacheEfficiency()}update(b,c,d){if(b&&b.terrain){this._style!==b&&(this.style=b),this.enabled=!0;const f=b.terrain.properties;this.sourceCache=0===b.terrain.drapeRenderMode?this._mockSourceCache:b._getSourceCache(f.get("source")),this._exaggeration=f.get("exaggeration");const g=()=>{this.sourceCache.used&&a.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const b=this.getScaledDemTileSize();this.sourceCache.update(c,b,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,g(),this._initializing=!0),g(),c.updateElevation(!d),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(c),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(a){this._findCoveringTileCache[a]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const b=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==b.efficiency&&a.warnOnce(`Terrain render cache efficiency is not optimal (${b.efficiency}%) and performance may be affected negatively, consider placing all background, fill and line layers before layer - with id '${b.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&"source"===a.dataType?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):"style"===a.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(b){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const c=this.proxySourceCache,d=this.painter.transform;this._initializing&&(this._initializing=0===d._centerAltitude&& -1===this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(d.center),-1),this._emptyDEMTextureDirty=!this._initializing);const f=this.proxyCoords=c.getIds().map(a=>{const b=c.getTileByID(a).tileID;return b.projMatrix=d.calculateProjMatrix(b.toUnwrapped()),b});(function(b,c){const d=c.transform.pointCoordinate(c.transform.getCameraPoint()),f=new a.pointGeometry(d.x,d.y);b.sort((b,c)=>{if(c.overscaledZ-b.overscaledZ)return c.overscaledZ-b.overscaledZ;const d=new a.pointGeometry(b.canonical.x+(1<{this.proxyToSource[a.key]={}}),this.terrainTileForTile={};const h=this._style._sourceCaches;for(const i in h){const j=h[i];if(!j.used||(j!==this.sourceCache&&this.resetTileLookupCache(j.id),this._setupProxiedCoordsForOrtho(j,b[i],g),j.usedForTerrain))continue;const k=b[i];j.getSource().reparseOverscaled&&this._assignTerrainTiles(k)}this.proxiedCoords[c.id]=f.map(a=>new bk(a,a.key,this.orthoMatrix)),this._assignTerrainTiles(f),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(g),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const l={};for(const m of(this._visibleDemTiles=[],this.proxyCoords)){const n=this.terrainTileForTile[m.key];if(!n)continue;const o=n.tileID.key;o in l||(this._visibleDemTiles.push(n),l[o]=o)}}_assignTerrainTiles(a){this._initializing||a.forEach(a=>{if(this.terrainTileForTile[a.key])return;const b=this._findTileCoveringTileID(a,this.sourceCache);b&&(this.terrainTileForTile[a.key]=b)})}_prepareDEMTextures(){const a=this.painter.context,b=a.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],f=d.dem;f&&(!d.demTexture||d.needsDEMTextureUpload)&&(a.activeTexture.set(b.TEXTURE1),a7(this.painter,d,f))}}_prepareDemTileUniforms(a,b,c,d){if(!b||null==b.demTexture)return!1;const f=a.tileID.canonical,g=Math.pow(2,b.tileID.canonical.z-f.z),h=d||"";return c[`u_dem_tl${h}`]=[f.x*g%1,f.y*g%1,],c[`u_dem_scale${h}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const b=this.painter.context,c=b.gl;if(!this._emptyDepthBufferTexture){const d={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new a.Texture(b,d,c.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const b=this._visibleDemTiles.reduce((b,c)=>{if(!c.dem)return b;const d=c.dem.tree.minimums[0];return d>0&&a++,b+d},0);return a?b/a:0}_updateEmptyDEMTexture(){const b=this.painter.context,c=b.gl;b.activeTexture.set(c.TEXTURE2);const d=this._getLoadedAreaMinimum(),f={width:1,height:1,data:new Uint8Array(a.DEMData.pack(d,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(f,{premultiply:!1}):g=this._emptyDEMTexture=new a.Texture(b,f,c.RGBA,{premultiply:!1}),g}setupElevationDraw(b,c,d){var f;const g=this.painter.context,h=g.gl,i=(f=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:a.DEMData.getUnpackVector(f),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});i.u_dem_size=this.sourceCache.getSource().tileSize,i.u_exaggeration=this.exaggeration();const j=this.painter.transform,k=j.projection.createTileTransform(j,j.worldSize),l=b.tileID.canonical;i.u_tile_tl_up=k.upVector(l,0,0),i.u_tile_tr_up=k.upVector(l,a.EXTENT,0),i.u_tile_br_up=k.upVector(l,a.EXTENT,a.EXTENT),i.u_tile_bl_up=k.upVector(l,0,a.EXTENT),i.u_tile_up_scale=k.upVectorScale(l);let m=null,n=null,o=1;if(d&&d.morphing&&this._useVertexMorphing){const p=d.morphing.srcDemTile,q=d.morphing.dstDemTile;o=d.morphing.phase,p&&q&&(this._prepareDemTileUniforms(b,p,i,"_prev")&&(n=p),this._prepareDemTileUniforms(b,q,i)&&(m=q))}if(n&&m?(g.activeTexture.set(h.TEXTURE2),m.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE,h.NEAREST),g.activeTexture.set(h.TEXTURE4),n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE,h.NEAREST),i.u_dem_lerp=o):(m=this.terrainTileForTile[b.tileID.key],g.activeTexture.set(h.TEXTURE2),(this._prepareDemTileUniforms(b,m,i)?m.demTexture:this.emptyDEMTexture).bind(h.NEAREST,h.CLAMP_TO_EDGE)),g.activeTexture.set(h.TEXTURE3),d&&d.useDepthForOcclusion?(this._depthTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.u_depth_size_inv=[1,1]),d&&d.useMeterToDem&&m){const r=(1<{if(k===a)return;const d=[];c&&d.push(be[l]),d.push(be[a]),d.push("PROJECTION_GLOBE_VIEW"),j=b.useProgram("globeRaster",null,d),k=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(i.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bd.update(g);const p=b.transform,q=a.calculateGlobeMatrix(p,p.worldSize),r=a.calculateGlobeMercatorMatrix(p),s=[a.mercatorXfromLng(p.center.lng),a.mercatorYfromLat(p.center.lat),],u=b.globeSharedBuffers;(l?[!1,!0]:[!1]).forEach(l=>{k=-1;const v=l?i.LINES:i.TRIANGLES;for(const w of f){const x=d.getTile(w),y=Math.pow(2,w.canonical.z),[z,A]=a.globeBuffersForTileMesh(b,x,w,y),B=a.StencilMode.disabled,C=c.prevTerrainTileForTile[w.key],D=c.terrainTileForTile[w.key];bc(C,D)&&bd.newMorphing(w.key,C,D,g,250),h.activeTexture.set(i.TEXTURE0),x.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const E=bd.getMorphValuesForProxy(w.key),F=E?1:0,G={};E&&a.extend$1(G,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:a.easeCubicInOut(E.phase)}});const H=a.globeMatrixForTile(w.canonical,q),I=bb(p.projMatrix,H,r,a.globeToMercatorTransition(p.zoom),s);if(m(F,l),c.setupElevationDraw(x,j,G),b.prepareDrawProgram(h,j,w.toUnwrapped()),u){const[J,K]=l?u.getWirefameBuffer(b.context):[u.gridIndexBuffer,u.gridSegments,];j.draw(h,v,o,B,n,a.CullFaceMode.backCCW,I,"globe_raster",z,J,K)}if(!l){const L=[0===w.canonical.y?a.globePoleMatrixForTile(w.canonical,!1,p):null,w.canonical.y===y-1?a.globePoleMatrixForTile(w.canonical,!0,p):null,];for(const M of L){if(!M)continue;const N=bb(p.projMatrix,M,M,0,s);u&&j.draw(h,v,o,B,n,a.CullFaceMode.disabled,N,"globe_pole_raster",A,u.poleIndexBuffer,u.poleSegments)}}}})}(b,c,d,f,g);else{const h=b.context,i=h.gl;let j,k;const l=b.options.showTerrainWireframe?2:0,m=(a,c)=>{if(k===a)return;const d=[be[a]];c&&d.push(be[l]),j=b.useProgram("terrainRaster",null,d),k=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(i.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bd.update(g);const p=b.transform,q=6*Math.pow(1.5,22-p.zoom)*c.exaggeration();(l?[!1,!0]:[!1]).forEach(l=>{k=-1;const r=l?i.LINES:i.TRIANGLES,[s,u]=l?c.getWirefameBuffer():[c.gridIndexBuffer,c.gridSegments,];for(const v of f){const w=d.getTile(v),x=a.StencilMode.disabled,y=c.prevTerrainTileForTile[v.key],z=c.terrainTileForTile[v.key];bc(y,z)&&bd.newMorphing(v.key,y,z,g,250),h.activeTexture.set(i.TEXTURE0),w.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST);const A=bd.getMorphValuesForProxy(v.key),B=A?1:0;let C;A&&(C={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:a.easeCubicInOut(A.phase)}});const D=ba(v.projMatrix,bf(v.canonical,p.renderWorldCopies)?q/10:q);m(B,l),c.setupElevationDraw(w,j,C),b.prepareDrawProgram(h,j,v.toUnwrapped()),j.draw(h,r,o,x,n,a.CullFaceMode.backCCW,D,"terrain_raster",c.gridBuffer,s,u)}})}}(c,this,this.proxySourceCache,b,this._updateTimestamp),this.renderingToTexture=!0,b.splice(0,b.length))}renderBatch(b){if(0===this._drapedRenderBatches.length)return b+1;this.renderingToTexture=!0;const c=this.painter,d=this.painter.context,f=this.proxySourceCache,g=this.proxiedCoords[f.id],h=this._drapedRenderBatches.shift(),i=[],j=c.style.order;let k=0;for(const l of g){const m=f.getTileByID(l.proxyTileKey),n=f.proxyCachedFBO[l.key]?f.proxyCachedFBO[l.key][b]:void 0,o=void 0!==n?f.renderCache[n]:this.pool[k++],p=void 0!==n;if(m.texture=o.tex,p&&!o.dirty){i.push(m.tileID);continue}let q;d.bindFramebuffer.set(o.fb.framebuffer),this.renderedToTile=!1,o.dirty&&(d.clear({color:a.Color.transparent,stencil:0}),o.dirty=!1);for(let r=h.start;r<=h.end;++r){const s=c.style._layers[j[r]];if(s.isHidden(c.transform.zoom))continue;const u=c.style._getLayerSourceCache(s),v=u?this.proxyToSource[l.key][u.id]:[l];if(!v)continue;const w=v;d.viewport.set([0,0,o.fb.width,o.fb.height,]),q!==(u?u.id:null)&&(this._setupStencil(o,v,s,u),q=u?u.id:null),c.renderLayer(c,u,s,w)}this.renderedToTile?(o.dirty=!0,i.push(m.tileID)):p|| --k,5===k&&(k=0,this.renderToBackBuffer(i))}return this.renderToBackBuffer(i),this.renderingToTexture=!1,d.bindFramebuffer.set(null),d.viewport.set([0,0,c.width,c.height]),h.end+1}postRender(){}renderCacheEfficiency(a){const b=a.order.length;if(0===b)return{efficiency:100};let c,d=0,f=0,g=!1;for(let h=0;ha.dem).forEach(b=>{a=Math.min(a,b.dem.tree.minimums[0])}),0===a?a:(a-30)*this._exaggeration}raycast(a,b,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(a=>a.dem).map(d=>{const f=d.tileID,g=Math.pow(2,f.overscaledZ),{x:h,y:i}=f.canonical,j=h/g,k=(h+1)/g,l=i/g,m=(i+1)/g;return{minx:j,miny:l,maxx:k,maxy:m,t:d.dem.tree.raycastRoot(j,l,k,m,a,b,c),tile:d}});for(const f of(d.sort((a,b)=>(null!==a.t?a.t:Number.MAX_VALUE)-(null!==b.t?b.t:Number.MAX_VALUE)),d)){if(null==f.t)break;const g=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,a,b,c);if(null!=g)return g}return null}_createFBO(){const b=this.painter.context,c=b.gl,d=this.drapeBufferSize;b.activeTexture.set(c.TEXTURE0);const f=new a.Texture(b,{width:d[0],height:d[1],data:null},c.RGBA);f.bind(c.LINEAR,c.CLAMP_TO_EDGE);const g=b.createFramebuffer(d[0],d[1],!1);return g.colorAttachment.set(f.texture),g.depthAttachment=new J(b,g.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=b.createRenderbuffer(b.gl.DEPTH_STENCIL,d[0],d[1]),this._stencilRef=0,g.depthAttachment.set(this._sharedDepthStencil),b.clear({stencil:0})):g.depthAttachment.set(this._sharedDepthStencil),b.extTextureFilterAnisotropic&&!b.extTextureFilterAnisotropicForceOff&&c.texParameterf(c.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax),{fb:g,tex:f,dirty:!1}}_initFBOPool(){for(;this.pool.length{const b=this._style._layers[a],c=b.isHidden(this.painter.transform.zoom),d=b.getCrossfadeParameters(),f=!!d&&1!==d.t,g=b.hasTransition();return"custom"!==b.type&&!c&&(f||g)})}_clearRasterFadeFromRenderCache(){let a=!1;for(const b in this._style._sourceCaches)if(this._style._sourceCaches[b]._source instanceof P){a=!0;break}if(a)for(let c=0;cb.renderCachePool.length){const c=Object.values(b.proxyCachedFBO);b.proxyCachedFBO={};for(let d=0;d=0;i--){const j=g[i];if(b.getTileByID(j.key),void 0!==b.proxyCachedFBO[j.key]){const k=a[j.key],l=this.proxyToSource[j.key];let m=0;for(const n in l){const o=l[n],p=k[n];if(!p||p.length!==o.length||o.some((a,b)=>a!==p[b]||h[n]&&h[n].hasOwnProperty(a.key))){m=-1;break}++m}for(const q in b.proxyCachedFBO[j.key])b.renderCache[b.proxyCachedFBO[j.key][q]].dirty=m<0||m!==Object.values(k).length}}const r=[...this._drapedRenderBatches];for(const s of(r.sort((a,b)=>b.end-b.start-(a.end-a.start)),r))for(const u of g){if(b.proxyCachedFBO[u.key])continue;let v=b.renderCachePool.pop();void 0===v&&b.renderCache.length<50&&(v=b.renderCache.length,b.renderCache.push(this._createFBO())),void 0!==v&&(b.proxyCachedFBO[u.key]={},b.proxyCachedFBO[u.key][s.start]=v,b.renderCache[v].dirty=!0)}this._tilesDirty={}}_setupStencil(a,b,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,g=f.gl;if(b.length<=1)return void(this._overlapStencilType=!1);let h;if(c.isTileClipped())h=b.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(b[0].overscaledZ>b[b.length-1].overscaledZ))return void(this._overlapStencilType=!1);h=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+h>255&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=h,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(b,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(b){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[b.key]),this._overlapStencilMode):a.StencilMode.disabled}_renderTileClippingMasks(b,c){const d=this.painter,f=this.painter.context,g=f.gl;d._tileClippingMaskIDs={},f.setColorMode(a.ColorMode.disabled),f.setDepthMode(a.DepthMode.disabled);const h=d.useProgram("clippingMask");for(const i of b){const j=d._tileClippingMaskIDs[i.key]=--c;h.draw(f,g.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:g.ALWAYS,mask:0},j,255,g.KEEP,g.KEEP,g.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bg(i.projMatrix),"$clipping",d.tileExtentBuffer,d.quadTriangleIndexBuffer,d.tileExtentSegments)}}pointCoordinate(b){const c=this.painter.transform;if(b.x<0||b.x>c.width||b.y<0||b.y>c.height)return null;const d=[b.x,b.y,1,1];a.transformMat4$1(d,d,c.pixelMatrixInverse),a.scale$1(d,d,1/d[3]),d[0]/=c.worldSize,d[1]/=c.worldSize;const f=c._camera.position,g=a.mercatorZfromAltitude(1,c.center.lat),h=[f[0],f[1],f[2]/g,0],i=a.subtract([],d.slice(0,3),h);a.normalize(i,i);const j=this.raycast(h,i,this._exaggeration);return null!==j&&j?(a.scaleAndAdd(h,h,i,j),h[3]=h[2],h[2]*=g,h):null}drawDepth(){const b=this.painter,c=b.context,d=this.proxySourceCache,f=Math.ceil(b.width),g=Math.ceil(b.height);if(this._depthFBO&&(this._depthFBO.width!==f||this._depthFBO.height!==g)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const h=c.gl,i=c.createFramebuffer(f,g,!0);c.activeTexture.set(h.TEXTURE0);const j=new a.Texture(c,{width:f,height:g,data:null},h.RGBA);j.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.colorAttachment.set(j.texture);const k=c.createRenderbuffer(c.gl.DEPTH_COMPONENT16,f,g);i.depthAttachment.set(k),this._depthFBO=i,this._depthTexture=j}c.bindFramebuffer.set(this._depthFBO.framebuffer),c.viewport.set([0,0,f,g]),function(b,c,d,f){if("globe"===b.transform.projection.name)return;const g=b.context,h=g.gl;g.clear({depth:1});const i=b.useProgram("terrainDepth"),j=new a.DepthMode(h.LESS,a.DepthMode.ReadWrite,b.depthRangeFor3D);for(const k of f){const l=d.getTile(k),m=ba(k.projMatrix,0);c.setupElevationDraw(l,i),i.draw(g,h.TRIANGLES,j,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.backCCW,m,"terrain_depth",c.gridBuffer,c.gridIndexBuffer,c.gridNoSkirtSegments)}}(b,this,d,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,b,c){if(a.getSource() instanceof S)return this._setupProxiedCoordsForImageSource(a,b,c);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const d=this.proxiedCoords[a.id]=[],f=this.proxyCoords;for(let g=0;g(a.min.x=Math.min(a.min.x,b.x-i.x),a.min.y=Math.min(a.min.y,b.y-i.y),a.max.x=Math.max(a.max.x,b.x-i.x),a.max.y=Math.max(a.max.y,b.y-i.y),a),{min:new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),k=(b,c)=>{const d=b.wrap+b.canonical.x/(1<h+j.max.x||f+gi+j.max.y};for(let l=0;la.key===c.tileID.key);if(g)return g}if(c.tileID.key!==b.key){const h=b.canonical.z-c.tileID.canonical.z;let i,j,k;f=a.create();const l=c.tileID.wrap-b.wrap<0?(j=(i=a.EXTENT>>h)*((c.tileID.canonical.x<=l){const m=b.canonical.z-l;c.getSource().reparseOverscaled?(i=Math.max(b.canonical.z+2,c.transform.tileZoom),h=new a.OverscaledTileID(i,b.wrap,l,b.canonical.x>>m,b.canonical.y>>m)):0!==m&&(i=l,h=new a.OverscaledTileID(i,b.wrap,l,b.canonical.x>>m,b.canonical.y>>m))}h.key!==b.key&&(k.push(h.key),d=c.getTile(h))}const n=a=>{k.forEach(b=>{f[b]=a}),k.length=0};for(i-=1;i>=j&&(!d||!d.hasData());i--){d&&n(d.tileID.key);const o=h.calculateScaledKey(i);if((d=c.getTileByID(o))&&d.hasData())break;const p=f[o];if(null===p)break;void 0===p?k.push(o):d=c.getTileByID(p)}return n(d?d.tileID.key:null),d&&d.hasData()?d:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(a){this.renderedToTile=!0}_clearRenderCacheForTile(a,b){let c=this._tilesDirty[a];c||(c=this._tilesDirty[a]={}),c[b.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const b=function(b){let c,d,f;const g=new a.StructArrayLayout2ui4,h=131;for(d=1;d<129;d++){for(c=1;c<129;c++)f=d*h+c,g.emplaceBack(f,f+1),g.emplaceBack(f,f+h),g.emplaceBack(f+1,f+h),128===d&&g.emplaceBack(f+h,f+h+1);g.emplaceBack(f+1,f+1+h)}return g}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(b),this.wireframeSegments=a.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function bm(a){const b=[];for(let c=0;cu.indexOf(v)&&u.push(v);let w=f?f.defines():[];w=w.concat(h.map(a=>`#define ${a}`));const x=w.concat("\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",a2,a1.fragmentSource,a0.fragmentSource,d.fragmentSource).join("\n"),y=w.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",a2,a1.vertexSource,a0.vertexSource,a_.vertexSource,d.vertexSource).join("\n"),z=m.createShader(m.FRAGMENT_SHADER);if(m.isContextLost())return void(this.failedToCreate=!0);m.shaderSource(z,x),m.compileShader(z),m.attachShader(this.program,z);const A=m.createShader(m.VERTEX_SHADER);if(m.isContextLost())return void(this.failedToCreate=!0);m.shaderSource(A,y),m.compileShader(A),m.attachShader(this.program,A),this.attributes={};const B={};this.numAttributes=p.length;for(let C=0;C>16,i>>16],u_pixel_coord_lower:[65535&h,65535&i]}}const bp=(b,c,d,f)=>{const g=c.style.light,h=g.properties.get("position"),i=[h.x,h.y,h.z],j=a.create$1();"viewport"===g.properties.get("anchor")&&(a.fromRotation(j,-c.transform.angle),a.transformMat3(i,i,j));const k=g.properties.get("color");return{u_matrix:b,u_lightpos:i,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[k.r,k.g,k.b],u_vertical_gradient:+d,u_opacity:f}},bq=(b,c,d,f,g,h,i)=>a.extend(bp(b,c,d,f),bo(h,c,i),{u_height_factor:-Math.pow(2,g.overscaledZ)/i.tileSize/8}),br=a=>({u_matrix:a}),bs=(b,c,d,f)=>a.extend(br(b),bo(d,c,f)),bt=(a,b)=>({u_matrix:a,u_world:b}),bu=(b,c,d,f,g)=>a.extend(bs(b,c,d,f),{u_world:g}),bv=(b,c,d,f)=>{const g=b.transform;let h;return h="map"===f.paint.get("circle-pitch-alignment")?g.calculatePixelsToTileUnitsMatrix(d):new Float32Array([g.pixelsToGLUnits[0],0,0,g.pixelsToGLUnits[1],]),{u_camera_to_center_distance:g.cameraToCenterDistance,u_matrix:b.translatePosMatrix(c.projMatrix,d,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_device_pixel_ratio:a.exported.devicePixelRatio,u_extrude_scale:h}},bw=a=>{const b=[];return"map"===a.paint.get("circle-pitch-alignment")&&b.push("PITCH_WITH_MAP"),"map"===a.paint.get("circle-pitch-scale")&&b.push("SCALE_WITH_MAP"),b},bx=(b,c,d)=>{const f=a.EXTENT/d.tileSize;return{u_matrix:b,u_camera_to_center_distance:c.cameraToCenterDistance,u_extrude_scale:[c.pixelsToGLUnits[0]/f,c.pixelsToGLUnits[1]/f,]}},by=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bz=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:C(b,1,c),u_intensity:d}),bA=(b,c,d,f,g,h)=>{const i=b.transform,j=i.calculatePixelsToTileUnitsMatrix(c),k={u_matrix:bD(b,c,d,g),u_pixels_to_tile_units:j,u_device_pixel_ratio:a.exported.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:h,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(bE(d)){const l=bC(c,b.transform);k.u_texsize=c.lineAtlasTexture.size,k.u_scale=[l,f.fromScale,f.toScale,],k.u_mix=f.t}return k},bB=(b,c,d,f,g)=>{const h=b.transform,i=bC(c,h);return{u_matrix:bD(b,c,d,g),u_texsize:c.imageAtlasTexture.size,u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:a.exported.devicePixelRatio,u_image:0,u_scale:[i,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function bC(a,b){return 1/C(a,1,b.tileZoom)}function bD(a,b,c,d){return a.translatePosMatrix(d||b.tileID.projMatrix,b,c.paint.get("line-translate"),c.paint.get("line-translate-anchor"))}function bE(a){const b=a.paint.get("line-dasharray").value;return b.value||"constant"!==b.kind}const bF=(a,b,c,d,f,g)=>{var h,i;return{u_matrix:a,u_tl_parent:b,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(i=f.paint.get("raster-saturation"))>0?1-1/(1.001-i):-i,u_contrast_factor:(h=f.paint.get("raster-contrast"))>0?1/(1-h):1+h,u_spin_weights:bG(f.paint.get("raster-hue-rotate")),u_perspective_transform:g}};function bG(a){a*=Math.PI/180;const b=Math.sin(a),c=Math.cos(a);return[(2*c+1)/3,(-Math.sqrt(3)*b-c+1)/3,(Math.sqrt(3)*b-c+1)/3,]}const bH=(a,b,c,d,f,g,h,i,j,k,l,m,n,o)=>{const p=f.transform;return{u_is_size_zoom_constant:+("constant"===a||"source"===a),u_is_size_feature_constant:+("constant"===a||"camera"===a),u_size_t:b?b.uSizeT:0,u_size:b?b.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+c,u_aspect_ratio:p.width/p.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:h,u_coord_matrix:i,u_is_text:+j,u_pitch_with_map:+d,u_texsize:k,u_tile_id:l,u_zoom_transition:m,u_inv_rot_matrix:n,u_merc_center:o,u_texture:0}},bI=(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q)=>{const{cameraToCenterDistance:r,_pitch:s}=g.transform;return a.extend(bH(b,c,d,f,g,h,i,j,k,l,n,o,p,q),{u_gamma_scale:f?r*Math.cos(g.terrain?0:s):1,u_device_pixel_ratio:a.exported.devicePixelRatio,u_is_halo:+m})},bJ=(b,c,d,f,g,h,i,j,k,l,m,n,o,p)=>a.extend(bI(b,c,d,f,g,h,i,j,!0,k,!0,m,n,o,p),{u_texsize_icon:l,u_texture_icon:1}),bK=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bL=(b,c,d,f,g,h)=>a.extend(function(a,b,c,d){const f=c.imageManager.getPattern(a.from.toString()),g=c.imageManager.getPattern(a.to.toString()),{width:h,height:i}=c.imageManager.getPixelSize(),j=Math.pow(2,d.tileID.overscaledZ),k=d.tileSize*Math.pow(2,c.transform.tileZoom)/j,l=k*(d.tileID.canonical.x+d.tileID.wrap*j),m=k*d.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:f.tl,u_pattern_br_a:f.br,u_pattern_tl_b:g.tl,u_pattern_br_b:g.br,u_texsize:[h,i],u_mix:b.t,u_pattern_size_a:f.displaySize,u_pattern_size_b:g.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/C(d,1,c.transform.tileZoom),u_pixel_coord_upper:[l>>16,m>>16,],u_pixel_coord_lower:[65535&l,65535&m,]}}(f,h,d,g),{u_matrix:b,u_opacity:c}),bM={fillExtrusion:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fillExtrusionPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_height_factor:new a.Uniform1f(b,c.u_height_factor),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fill:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),fillPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),fillOutline:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world)}),fillOutlinePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),circle:(b,c)=>({u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.UniformMatrix2f(b,c.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),collisionBox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.Uniform2f(b,c.u_extrude_scale)}),collisionCircle:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_inv_matrix:new a.UniformMatrix4f(b,c.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(b,c.u_viewport_size)}),debug:(b,c)=>({u_color:new a.UniformColor(b,c.u_color),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_overlay:new a.Uniform1i(b,c.u_overlay),u_overlay_scale:new a.Uniform1f(b,c.u_overlay_scale)}),clippingMask:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmap:(b,c)=>({u_extrude_scale:new a.Uniform1f(b,c.u_extrude_scale),u_intensity:new a.Uniform1f(b,c.u_intensity),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmapTexture:(b,c)=>({u_image:new a.Uniform1i(b,c.u_image),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_opacity:new a.Uniform1f(b,c.u_opacity)}),hillshade:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_latrange:new a.Uniform2f(b,c.u_latrange),u_light:new a.Uniform2f(b,c.u_light),u_shadow:new a.UniformColor(b,c.u_shadow),u_highlight:new a.UniformColor(b,c.u_highlight),u_accent:new a.UniformColor(b,c.u_accent)}),hillshadePrepare:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_dimension:new a.Uniform2f(b,c.u_dimension),u_zoom:new a.Uniform1f(b,c.u_zoom),u_unpack:new a.Uniform4f(b,c.u_unpack)}),line:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_dash_image:new a.Uniform1i(b,c.u_dash_image),u_gradient_image:new a.Uniform1i(b,c.u_gradient_image),u_image_height:new a.Uniform1f(b,c.u_image_height),u_texsize:new a.Uniform2f(b,c.u_texsize),u_scale:new a.Uniform3f(b,c.u_scale),u_mix:new a.Uniform1f(b,c.u_mix),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),linePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_image:new a.Uniform1i(b,c.u_image),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),raster:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_tl_parent:new a.Uniform2f(b,c.u_tl_parent),u_scale_parent:new a.Uniform1f(b,c.u_scale_parent),u_fade_t:new a.Uniform1f(b,c.u_fade_t),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image0:new a.Uniform1i(b,c.u_image0),u_image1:new a.Uniform1i(b,c.u_image1),u_brightness_low:new a.Uniform1f(b,c.u_brightness_low),u_brightness_high:new a.Uniform1f(b,c.u_brightness_high),u_saturation_factor:new a.Uniform1f(b,c.u_saturation_factor),u_contrast_factor:new a.Uniform1f(b,c.u_contrast_factor),u_spin_weights:new a.Uniform3f(b,c.u_spin_weights),u_perspective_transform:new a.Uniform2f(b,c.u_perspective_transform)}),symbolIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_texture:new a.Uniform1i(b,c.u_texture)}),symbolSDF:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texture:new a.Uniform1i(b,c.u_texture),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),symbolTextAndIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texsize_icon:new a.Uniform2f(b,c.u_texsize_icon),u_texture:new a.Uniform1i(b,c.u_texture),u_texture_icon:new a.Uniform1i(b,c.u_texture_icon),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),background:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_color:new a.UniformColor(b,c.u_color)}),backgroundPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image:new a.Uniform1i(b,c.u_image),u_pattern_tl_a:new a.Uniform2f(b,c.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(b,c.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(b,c.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(b,c.u_pattern_br_b),u_texsize:new a.Uniform2f(b,c.u_texsize),u_mix:new a.Uniform1f(b,c.u_mix),u_pattern_size_a:new a.Uniform2f(b,c.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(b,c.u_pattern_size_b),u_scale_a:new a.Uniform1f(b,c.u_scale_a),u_scale_b:new a.Uniform1f(b,c.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(b,c.u_tile_units_to_pixels)}),terrainRaster:a9,terrainDepth:a9,skybox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_cubemap:new a.Uniform1i(b,c.u_cubemap),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxGradient:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_center_direction:new a.Uniform3f(b,c.u_center_direction),u_radius:new a.Uniform1f(b,c.u_radius),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxCapture:(b,c)=>({u_matrix_3f:new a.UniformMatrix3f(b,c.u_matrix_3f),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_sun_intensity:new a.Uniform1f(b,c.u_sun_intensity),u_color_tint_r:new a.Uniform4f(b,c.u_color_tint_r),u_color_tint_m:new a.Uniform4f(b,c.u_color_tint_m),u_luminance:new a.Uniform1f(b,c.u_luminance)}),globeRaster:(b,c)=>({u_proj_matrix:new a.UniformMatrix4f(b,c.u_proj_matrix),u_globe_matrix:new a.UniformMatrix4f(b,c.u_globe_matrix),u_merc_matrix:new a.UniformMatrix4f(b,c.u_merc_matrix),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_image0:new a.Uniform1i(b,c.u_image0)}),globeAtmosphere:(b,c)=>({u_center:new a.Uniform2f(b,c.u_center),u_radius:new a.Uniform1f(b,c.u_radius),u_screen_size:new a.Uniform2f(b,c.u_screen_size),u_pixel_ratio:new a.Uniform1f(b,c.u_pixel_ratio),u_opacity:new a.Uniform1f(b,c.u_opacity),u_fadeout_range:new a.Uniform1f(b,c.u_fadeout_range),u_start_color:new a.Uniform3f(b,c.u_start_color),u_end_color:new a.Uniform3f(b,c.u_end_color)})};let bN;function bO(b,c,d,f,g,h,i){var j;const k=b.context,l=k.gl,m=b.useProgram("collisionBox"),n=[];let o=0,p=0;for(let q=0;q0){const y=a.create(),z=v;a.mul(y,u.placementInvProjMatrix,b.transform.glCoordMatrix),a.mul(y,y,u.placementViewportMatrix),n.push({circleArray:x,circleOffset:p,transform:z,invTransform:y}),o+=x.length/4,p=o}w&&(b.terrain&&b.terrain.setupElevationDraw(s,m),m.draw(k,l.LINES,a.DepthMode.disabled,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.disabled,bx(v,b.transform,s),d.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,b.transform.zoom,null,w.collisionVertexBuffer,w.collisionVertexBufferExt))}if(!i||!n.length)return;const A=b.useProgram("collisionCircle"),B=new a.StructArrayLayout2f1f2i16;B.resize(4*o),B._trim();let C=0;for(const D of n)for(let E=0;E[0,0,0];p.clear();for(let w=0;w=0&&(r[x.associatedIconIndex]={shiftedAnchor:L,angle:M})}else aC(x.numGlyphs,p)}if(m){q.clear();const O=b.icon.placedSymbolArray;for(let P=0;P[0,0,0];au(I,G.projMatrix,b,g,$,aa,u,l,ae,G)}const af=b.translatePosMatrix(G.projMatrix,H,h,i),ag=v||g&&B||ac?bP:$,ah=b.translatePosMatrix(aa,H,h,i,!0),ai=L&&0!==d.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1);let aj;const ak=r.createInversionMatrix(G.toUnwrapped());aj=L?I.iconsInText?bJ(M.kind,P,w,u,b,af,ag,ah,R,V,Q,D,ak,A):bI(M.kind,P,w,u,b,af,ag,ah,g,R,!0,Q,D,ak,A):bH(M.kind,P,w,u,b,af,ag,ah,g,R,Q,D,ak,A);const al={program:O,buffers:J,uniformValues:aj,atlasTexture:S,atlasTextureIcon:W,atlasInterpolation:T,atlasInterpolationIcon:U,isSDF:L,hasHalo:ai,tile:H,labelPlaneMatrixInv:_};if(x&&I.canOverlap){y=!0;const am=J.segments.get();for(const an of am)E.push({segments:new a.SegmentVector([an]),sortKey:an.sortKey,state:al})}else E.push({segments:J.segments,sortKey:0,state:al})}for(const ao of(y&&E.sort((a,b)=>a.sortKey-b.sortKey),E)){const ar=ao.state;if(b.terrain&&b.terrain.setupElevationDraw(ar.tile,ar.program,{useDepthForOcclusion:!C,labelPlaneMatrixInv:ar.labelPlaneMatrixInv}),o.activeTexture.set(p.TEXTURE0),ar.atlasTexture.bind(ar.atlasInterpolation,p.CLAMP_TO_EDGE),ar.atlasTextureIcon&&(o.activeTexture.set(p.TEXTURE1),ar.atlasTextureIcon&&ar.atlasTextureIcon.bind(ar.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),ar.isSDF){const as=ar.uniformValues;ar.hasHalo&&(as.u_is_halo=1,bU(ar.buffers,ao.segments,d,b,ar.program,z,m,n,as)),as.u_is_halo=0}bU(ar.buffers,ao.segments,d,b,ar.program,z,m,n,ar.uniformValues)}}function bU(b,c,d,f,g,h,i,j,k){const l=f.context;g.draw(l,l.gl.TRIANGLES,h,i,j,a.CullFaceMode.disabled,k,d.id,b.layoutVertexBuffer,b.indexBuffer,c,d.paint,f.transform.zoom,b.programConfigurations.get(d.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function bV(b,c,d,f,g,h,i){const j=b.context.gl,k=d.paint.get("fill-pattern"),l=k&&k.constantOr(1),m=d.getCrossfadeParameters();let n,o,p,q,r;for(const s of(i?(o=l&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",n=j.LINES):(o=l?"fillPattern":"fill",n=j.TRIANGLES),f)){const u=c.getTile(s);if(l&&!u.patternsLoaded())continue;const v=u.getBucket(d);if(!v)continue;b.prepareDrawTile(s);const w=v.programConfigurations.get(d.id),x=b.useProgram(o,w);l&&(b.context.activeTexture.set(j.TEXTURE0),u.imageAtlasTexture.bind(j.LINEAR,j.CLAMP_TO_EDGE),w.updatePaintBuffers(m));const y=k.constantOr(null);if(y&&u.imageAtlas){const z=u.imageAtlas,A=z.patternPositions[y.to.toString()],B=z.patternPositions[y.from.toString()];A&&B&&w.setConstantPatternPositions(A,B)}const C=b.translatePosMatrix(s.projMatrix,u,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(i){q=v.indexBuffer2,r=v.segments2;const D=b.terrain&&b.terrain.renderingToTexture?b.terrain.drapeBufferSize:[j.drawingBufferWidth,j.drawingBufferHeight,];p="fillOutlinePattern"===o&&l?bu(C,b,m,u,D):bt(C,D)}else q=v.indexBuffer,r=v.segments,p=l?bs(C,b,m,u):br(C);b.prepareDrawProgram(b.context,x,s.toUnwrapped()),x.draw(b.context,n,g,b.stencilModeForClipping(s),h,a.CullFaceMode.disabled,p,d.id,v.layoutVertexBuffer,q,r,d.paint,b.transform.zoom,w)}}function bW(b,c,d,f,g,h,i){const j=b.context,k=j.gl,l=d.paint.get("fill-extrusion-pattern"),m=l.constantOr(1),n=d.getCrossfadeParameters(),o=d.paint.get("fill-extrusion-opacity");for(const p of f){const q=c.getTile(p),r=q.getBucket(d);if(!r)continue;const s=r.programConfigurations.get(d.id),u=b.useProgram(m?"fillExtrusionPattern":"fillExtrusion",s);if(b.terrain){const v=b.terrain;if(!r.enableTerrain)continue;if(v.setupElevationDraw(q,u,{useMeterToDem:!0}),bX(j,c,p,r,d,v),!r.centroidVertexBuffer){const w=u.attributes.a_centroid_pos;void 0!==w&&k.vertexAttrib2f(w,0,0)}}m&&(b.context.activeTexture.set(k.TEXTURE0),q.imageAtlasTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),s.updatePaintBuffers(n));const x=l.constantOr(null);if(x&&q.imageAtlas){const y=q.imageAtlas,z=y.patternPositions[x.to.toString()],A=y.patternPositions[x.from.toString()];z&&A&&s.setConstantPatternPositions(z,A)}const B=b.translatePosMatrix(p.projMatrix,q,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),C=d.paint.get("fill-extrusion-vertical-gradient"),D=m?bq(B,b,C,o,p,n,q):bp(B,b,C,o);b.prepareDrawProgram(j,u,p.toUnwrapped()),u.draw(j,j.gl.TRIANGLES,g,h,i,a.CullFaceMode.backCCW,D,d.id,r.layoutVertexBuffer,r.indexBuffer,r.segments,d.paint,b.transform.zoom,s,b.terrain?r.centroidVertexBuffer:null)}}function bX(b,c,d,f,g,h){const i=[b=>{let c=b.canonical.x-1,d=b.wrap;return c<0&&(c=(1<{let c=b.canonical.x+1,d=b.wrap;return c===1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,(0===b.canonical.y?1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y===(1<{const b=c.getSource().maxzoom,d=a=>{const b=c.getTileByID(a);if(b&&b.hasData())return b.getBucket(g)};let f,h,i;return(a.overscaledZ===a.canonical.z||a.overscaledZ>=b)&&(f=d(a.key)),a.overscaledZ>=b&&(h=d(a.calculateScaledKey(a.overscaledZ+1))),a.overscaledZ>b&&(i=d(a.calculateScaledKey(a.overscaledZ-1))),f||h||i},k=[0,0,0],l=(b,c)=>(k[0]=Math.min(b.min.y,c.min.y),k[1]=Math.max(b.max.y,c.max.y),k[2]=a.EXTENT-c.min.x>b.max.x?c.min.x-a.EXTENT:b.max.x,k),m=(b,c)=>(k[0]=Math.min(b.min.x,c.min.x),k[1]=Math.max(b.max.x,c.max.x),k[2]=a.EXTENT-c.min.y>b.max.y?c.min.y-a.EXTENT:b.max.y,k),n=[(a,b)=>l(a,b),(a,b)=>l(b,a),(a,b)=>m(a,b),(a,b)=>m(b,a),],o=new a.pointGeometry(0,0);let p,q,r;const s=(b,c,f,g,i)=>{const j=[[g?f:b,g?b:f,0],[g?f:c,g?c:f,0],],k=i<0?a.EXTENT+i:i,l=[g?k:(b+c)/2,g?(b+c)/2:k,0,];return 0===f&&i<0||0!==f&&i>0?h.getForTilePoints(r,[l],!0,q):j.push(l),h.getForTilePoints(d,j,!0,p),Math.max(j[0][2],j[1][2],l[2])/h.exaggeration()};for(let u=0;u<4;u++){const v=f.borders[u];if(0===v.length&&(f.borderDone[u]=!0),f.borderDone[u])continue;const w=r=i[u](d),x=j(w);if(!x||!x.enableTerrain||!(q=h.findDEMTileFor(w))||!q.dem)continue;if(!p){const y=h.findDEMTileFor(d);if(!y||!y.dem)return;p=y}const z=(u<2?1:5)-u,A=x.borders[z];let B=0;for(let C=0;CE[0]+3);)x.borderDone[z]||x.encodeCentroid(void 0,F,!1),B++;if(F&&BE[1]-3)&&(H++,++B!==A.length);)F=x.featuresOnBorder[A[B]];if(F=x.featuresOnBorder[A[G]],D.intersectsCount()>1||F.intersectsCount()>1||1!==H){1!==H&&(B=G),f.encodeCentroid(void 0,D,!1),x.borderDone[z]||x.encodeCentroid(void 0,F,!1);continue}const I=n[u](D,F),J=u%2?a.EXTENT-1:0;o.x=s(I[0],Math.min(a.EXTENT-1,I[1]),J,u<2,I[2]),o.y=0,f.encodeCentroid(o,D,!1),x.borderDone[z]||x.encodeCentroid(o,F,!1)}else f.encodeCentroid(void 0,D,!1)}f.borderDone[u]=f.needsCentroidUpdate=!0,x.borderDone[z]||(x.borderDone[z]=x.needsCentroidUpdate=!0)}(f.needsCentroidUpdate|| !f.centroidVertexBuffer&&0!==f.centroidVertexArray.length)&&f.uploadCentroid(b)}const bY=new a.Color(1,0,0,1),bZ=new a.Color(0,1,0,1),b$=new a.Color(0,0,1,1),b_=new a.Color(1,0,1,1),b0=new a.Color(0,1,1,1);function b1(a,b,c,d){b3(a,0,b+c/2,a.transform.width,c,d)}function b2(a,b,c,d){b3(a,b-c/2,0,c,a.transform.height,d)}function b3(b,c,d,f,g,h){const i=b.context,j=i.gl;j.enable(j.SCISSOR_TEST),j.scissor(c*a.exported.devicePixelRatio,d*a.exported.devicePixelRatio,f*a.exported.devicePixelRatio,g*a.exported.devicePixelRatio),i.clear({color:h}),j.disable(j.SCISSOR_TEST)}function b4(b,c,d){const f=b.context,g=f.gl,h=d.projMatrix,i=b.useProgram("debug"),j=c.getTileByID(d.key);b.terrain&&b.terrain.setupElevationDraw(j,i);const k=a.DepthMode.disabled,l=a.StencilMode.disabled,m=b.colorModeForRenderPass(),n="$debug";f.activeTexture.set(g.TEXTURE0),b.emptyTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),j._makeDebugTileBoundsBuffers(b.context,b.transform.projection);const o=j._tileDebugBuffer||b.debugBuffer,p=j._tileDebugIndexBuffer||b.debugIndexBuffer,q=j._tileDebugSegments||b.debugSegments;i.draw(f,g.LINE_STRIP,k,l,m,a.CullFaceMode.disabled,by(h,a.Color.red),n,o,p,q);const r=j.latestRawTileData,s=Math.floor((r&&r.byteLength||0)/1024),u=c.getTile(d).tileSize,v=512/Math.min(u,512)*(d.overscaledZ/b.transform.zoom)*.5;let w=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(w+=` => ${d.overscaledZ}`),function(a,b){a.initDebugOverlayCanvas();const c=a.debugOverlayCanvas,d=a.context.gl,f=a.debugOverlayCanvas.getContext("2d");f.clearRect(0,0,c.width,c.height),f.shadowColor="white",f.shadowBlur=2,f.lineWidth=1.5,f.strokeStyle="white",f.textBaseline="top",f.font="bold 36px Open Sans, sans-serif",f.fillText(b,5,5),f.strokeText(b,5,5),a.debugOverlayTexture.update(c),a.debugOverlayTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}(b,`${w} ${s}kb`),i.draw(f,g.TRIANGLES,k,l,a.ColorMode.alphaBlended,a.CullFaceMode.disabled,by(h,a.Color.transparent,v),n,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments)}const b5=a.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:b6}=b5;function b7(a,b,c,d){a.emplaceBack(b,c,d)}class b8{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,b7(this.vertexArray,-1,-1,1),b7(this.vertexArray,1,-1,1),b7(this.vertexArray,-1,1,1),b7(this.vertexArray,1,1,1),b7(this.vertexArray,-1,-1,-1),b7(this.vertexArray,1,-1,-1),b7(this.vertexArray,-1,1,-1),b7(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=b.createVertexBuffer(this.vertexArray,b6),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function b9(b,c,d,f,g,h){var i,j,k,l,m;const n=b.gl,o=c.paint.get("sky-atmosphere-color"),p=c.paint.get("sky-atmosphere-halo-color"),q=c.paint.get("sky-atmosphere-sun-intensity"),r=(i=a.fromMat4([],f),j=g,k=q,l=o,m=p,{u_matrix_3f:i,u_sun_direction:j,u_sun_intensity:k,u_color_tint_r:[l.r,l.g,l.b,l.a],u_color_tint_m:[m.r,m.g,m.b,m.a],u_luminance:5e-5});n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+h,c.skyboxTexture,0),d.draw(b,n.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.frontCW,r,"skyboxCapture",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}const ca={symbol:function(b,c,d,f,g){if("translucent"!==b.renderPass)return;const h=a.StencilMode.disabled,i=b.colorModeForRenderPass();d.layout.get("text-variable-anchor")&&function(b,c,d,f,g,h,i){const j=c.transform,k="map"===g,l="map"===h,m=j.projection.createTileTransform(j,j.worldSize);for(const n of b){const o=f.getTile(n),p=o.getBucket(d);if(!p||p.projection!==j.projection.name||!p.text||!p.text.segments.get().length)continue;const q=a.evaluateSizeForZoom(p.textSizeData,j.zoom),r=c.transform.calculatePixelsToTileUnitsMatrix(o),s=ap(n.projMatrix,o.tileID.canonical,l,k,c.transform,r),u="none"!==d.layout.get("icon-text-fit")&&p.hasIconData();if(q){const v=Math.pow(2,j.zoom-o.tileID.overscaledZ);bR(p,k,l,i,a.symbolSize,j,s,n,v,q,u,m)}}}(f,b,d,c,d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),g),0!==d.paint.get("icon-opacity").constantOr(1)&&bT(b,c,d,f,!1,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),d.layout.get("icon-rotation-alignment"),d.layout.get("icon-pitch-alignment"),d.layout.get("icon-keep-upright"),h,i),0!==d.paint.get("text-opacity").constantOr(1)&&bT(b,c,d,f,!0,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),d.layout.get("text-keep-upright"),h,i),c.map.showCollisionBoxes&&(bO(b,c,d,f,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),!0),bO(b,c,d,f,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),!1))},circle:function(b,c,d,f){if("translucent"!==b.renderPass)return;const g=d.paint.get("circle-opacity"),h=d.paint.get("circle-stroke-width"),i=d.paint.get("circle-stroke-opacity"),j=void 0!==d.layout.get("circle-sort-key").constantOr(1);if(0===g.constantOr(1)&&(0===h.constantOr(1)||0===i.constantOr(1)))return;const k=b.context,l=k.gl,m=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),n=a.StencilMode.disabled,o=b.colorModeForRenderPass(),p=[];for(let q=0;qa.sortKey-b.sortKey);const A={useDepthForOcclusion:"globe"!==b.transform.projection.name};for(const B of p){const{programConfiguration:C,program:D,layoutVertexBuffer:E,indexBuffer:F,uniformValues:G,tile:H}=B.state,I=B.segments;b.terrain&&b.terrain.setupElevationDraw(H,D,A),b.prepareDrawProgram(k,D,H.tileID.toUnwrapped()),D.draw(k,l.TRIANGLES,m,n,o,a.CullFaceMode.disabled,G,d.id,E,F,I,d.paint,b.transform.zoom,C)}},heatmap:function(b,c,d,f){if(0!==d.paint.get("heatmap-opacity")){if("offscreen"===b.renderPass){const g=b.context,h=g.gl,i=a.StencilMode.disabled,j=new a.ColorMode([h.ONE,h.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(a,b,c){const d=a.gl;a.activeTexture.set(d.TEXTURE1),a.viewport.set([0,0,b.width/4,b.height/4,]);let f=c.heatmapFbo;if(f)d.bindTexture(d.TEXTURE_2D,f.colorAttachment.get()),a.bindFramebuffer.set(f.framebuffer);else{const g=d.createTexture();d.bindTexture(d.TEXTURE_2D,g),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),f=c.heatmapFbo=a.createFramebuffer(b.width/4,b.height/4,!1),function(a,b,c,d){const f=a.gl;f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b.width/4,b.height/4,0,f.RGBA,a.extRenderToTextureHalfFloat?a.extTextureHalfFloat.HALF_FLOAT_OES:f.UNSIGNED_BYTE,null),d.colorAttachment.set(c)}(a,b,g,f)}})(g,b,d),g.clear({color:a.Color.transparent});for(let k=0;k{const b=[];bE(a)&&b.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&b.push("RENDER_LINE_GRADIENT");const c=a.paint.get("line-pattern").constantOr(1),d=1!==a.paint.get("line-opacity").constantOr(1);return!c&&d&&b.push("RENDER_LINE_ALPHA_DISCARD"),b})(d);let w=v.includes("RENDER_LINE_ALPHA_DISCARD");for(const x of(b.terrain&&b.terrain.clipOrMaskOverlapStencilType()&&(w=!1),f)){const y=c.getTile(x);if(o&&!y.patternsLoaded())continue;const z=y.getBucket(d);if(!z)continue;b.prepareDrawTile(x);const A=z.programConfigurations.get(d.id),B=b.useProgram(r,A,v),C=n.constantOr(null);if(C&&y.imageAtlas){const D=y.imageAtlas,E=D.patternPositions[C.to.toString()],F=D.patternPositions[C.from.toString()];E&&F&&A.setConstantPatternPositions(E,F)}const G=k.constantOr(null),H=m.constantOr(null);if(!o&&G&&H&&y.lineAtlas){const I=y.lineAtlas,J=I.getDash(G.to,H),K=I.getDash(G.from,H);J&&K&&A.setConstantPatternPositions(J,K)}const L=b.terrain?x.projMatrix:null,M=o?bB(b,y,d,q,L):bA(b,y,d,q,L,z.lineClipsArray.length);if(p){const N=z.gradients[d.id];let O=N.texture;if(d.gradientVersion!==N.version){let P=256;if(d.stepInterpolant){const Q=c.getSource().maxzoom,R=x.canonical.z===Q?Math.ceil(1<{B.draw(s,u.TRIANGLES,i,c,j,a.CullFaceMode.disabled,M,d.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,d.paint,b.transform.zoom,A,z.layoutVertexBuffer2)};if(w){const T=b.stencilModeForClipping(x).ref;0===T&&b.terrain&&s.clear({stencil:0});const U={func:u.EQUAL,mask:255};M.u_alpha_discard_threshold=.8,S(new a.StencilMode(U,T,255,u.KEEP,u.KEEP,u.INVERT)),M.u_alpha_discard_threshold=0,S(new a.StencilMode(U,T,255,u.KEEP,u.KEEP,u.KEEP))}else S(b.stencilModeForClipping(x))}w&&(b.resetStencilClippingMasks(),b.terrain&&s.clear({stencil:0}))},fill:function(b,c,d,f){const g=d.paint.get("fill-color"),h=d.paint.get("fill-opacity");if(0===h.constantOr(1))return;const i=b.colorModeForRenderPass(),j=d.paint.get("fill-pattern"),k=b.opaquePassEnabledForLayer()&&!j.constantOr(1)&&1===g.constantOr(a.Color.transparent).a&&1===h.constantOr(0)?"opaque":"translucent";if(b.renderPass===k){const l=b.depthModeForSublayer(1,"opaque"===b.renderPass?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly);bV(b,c,d,f,l,i,!1)}if("translucent"===b.renderPass&&d.paint.get("fill-antialias")){const m=b.depthModeForSublayer(d.getPaintProperty("fill-outline-color")?2:0,a.DepthMode.ReadOnly);bV(b,c,d,f,m,i,!0)}},"fill-extrusion":function(b,c,d,f){const g=d.paint.get("fill-extrusion-opacity");if(0!==g&&"translucent"===b.renderPass){const h=new a.DepthMode(b.context.gl.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);if(1!==g||d.paint.get("fill-extrusion-pattern").constantOr(1))bW(b,c,d,f,h,a.StencilMode.disabled,a.ColorMode.disabled),bW(b,c,d,f,h,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const i=b.colorModeForRenderPass();bW(b,c,d,f,h,a.StencilMode.disabled,i)}}},hillshade:function(b,c,d,f){if("offscreen"!==b.renderPass&&"translucent"!==b.renderPass)return;const g=b.context,h=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),i=b.colorModeForRenderPass(),j=b.terrain&&b.terrain.renderingToTexture,[k,l]="translucent"!==b.renderPass||j?[{},f]:b.stencilConfigForOverlap(f);for(const m of l){const n=c.getTile(m);if(n.needsHillshadePrepare&&"offscreen"===b.renderPass)a8(b,n,d,h,a.StencilMode.disabled,i);else if("translucent"===b.renderPass){const o=j&&b.terrain?b.terrain.stencilModeForRTTOverlap(m):k[m.overscaledZ];a6(b,m,n,d,h,o,i)}}g.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,c,d,f,g,h){if("translucent"!==b.renderPass||0===d.paint.get("raster-opacity")||!f.length)return;const i=b.context,j=i.gl,k=c.getSource(),l=b.useProgram("raster"),m=b.colorModeForRenderPass(),n=b.terrain&&b.terrain.renderingToTexture,[o,p]=k instanceof S||n?[{},f]:b.stencilConfigForOverlap(f),q=p[p.length-1].overscaledZ,r=!b.options.moving;for(const s of p){const u=n?a.DepthMode.disabled:b.depthModeForSublayer(s.overscaledZ-q,1===d.paint.get("raster-opacity")?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly,j.LESS),v=s.toUnwrapped(),w=c.getTile(s);if(n&&(!w||!w.hasData()))continue;const x=n?s.projMatrix:b.transform.calculateProjMatrix(v,r),y=b.terrain&&n?b.terrain.stencilModeForRTTOverlap(s):o[s.overscaledZ],z=h?0:d.paint.get("raster-fade-duration");w.registerFadeDuration(z);const A=c.findLoadedParent(s,0),B=bh(w,A,c,b.transform,z);let C,D;b.terrain&&b.terrain.prepareDrawTile(s);const E="nearest"===d.paint.get("raster-resampling")?j.NEAREST:j.LINEAR;i.activeTexture.set(j.TEXTURE0),w.texture.bind(E,j.CLAMP_TO_EDGE),i.activeTexture.set(j.TEXTURE1),A?(A.texture.bind(E,j.CLAMP_TO_EDGE),C=Math.pow(2,A.tileID.overscaledZ-w.tileID.overscaledZ),D=[w.tileID.canonical.x*C%1,w.tileID.canonical.y*C%1,]):w.texture.bind(E,j.CLAMP_TO_EDGE);const F=bF(x,D||[0,0],C||1,B,d,k instanceof S?k.perspectiveTransform:[0,0]);if(b.prepareDrawProgram(i,l,v),k instanceof S)l.draw(i,j.TRIANGLES,u,a.StencilMode.disabled,m,a.CullFaceMode.disabled,F,d.id,k.boundsBuffer,b.quadTriangleIndexBuffer,k.boundsSegments);else{const{tileBoundsBuffer:G,tileBoundsIndexBuffer:H,tileBoundsSegments:I}=b.getTileBoundsBuffers(w);l.draw(i,j.TRIANGLES,u,y,m,a.CullFaceMode.disabled,F,d.id,G,H,I)}}b.resetStencilClippingMasks()},background:function(b,c,d,f){const g=d.paint.get("background-color"),h=d.paint.get("background-opacity");if(0===h)return;const i=b.context,j=i.gl,k=b.transform,l=k.tileSize,m=d.paint.get("background-pattern");if(b.isPatternMissing(m))return;const n=!m&&1===g.a&&1===h&&b.opaquePassEnabledForLayer()?"opaque":"translucent";if(b.renderPass!==n)return;const o=a.StencilMode.disabled,p=b.depthModeForSublayer(0,"opaque"===n?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly),q=b.colorModeForRenderPass(),r=b.useProgram(m?"backgroundPattern":"background");let s,u=f;u||(u=Object.values(s=b.getBackgroundTiles()).map(a=>a.tileID)),m&&(i.activeTexture.set(j.TEXTURE0),b.imageManager.bind(b.context));const v=d.getCrossfadeParameters();for(const w of u){const x=w.toUnwrapped(),y=f?w.projMatrix:b.transform.calculateProjMatrix(x);b.prepareDrawTile(w);const z=c?c.getTile(w):s?s[w.key]:new a.Tile(w,l,k.zoom,b),A=m?bL(y,h,b,m,{tileID:w,tileSize:l},v):bK(y,h,g);b.prepareDrawProgram(i,r,x);const{tileBoundsBuffer:B,tileBoundsIndexBuffer:C,tileBoundsSegments:D}=b.getTileBoundsBuffers(z);r.draw(i,j.TRIANGLES,p,o,q,a.CullFaceMode.disabled,A,d.id,B,C,D)}},sky:function(b,c,d){const f=b.transform,g="mercator"===f.projection.name||"globe"===f.projection.name?1:a.smoothstep(7,8,f.zoom),h=d.paint.get("sky-opacity")*g;if(0===h)return;const i=b.context,j=d.paint.get("sky-type"),k=new a.DepthMode(i.gl.LEQUAL,a.DepthMode.ReadOnly,[0,1]),l=b.frameCounter/1e3%1;"atmosphere"===j?"offscreen"===b.renderPass?d.needsSkyboxCapture(b)&&(function(b,c,d,f){const g=b.context,h=g.gl;let i=c.skyboxFbo;if(!i){i=c.skyboxFbo=g.createFramebuffer(32,32,!1),c.skyboxGeometry=new b8(g),c.skyboxTexture=g.gl.createTexture(),h.bindTexture(h.TEXTURE_CUBE_MAP,c.skyboxTexture),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,h.LINEAR);for(let j=0;j<6;++j)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,h.RGBA,32,32,0,h.RGBA,h.UNSIGNED_BYTE,null)}g.bindFramebuffer.set(i.framebuffer),g.viewport.set([0,0,32,32,]);const k=c.getCenter(b,!0),l=b.useProgram("skyboxCapture"),m=new Float64Array(16);a.identity(m),a.rotateY(m,m,-(.5*Math.PI)),b9(g,c,l,m,k,0),a.identity(m),a.rotateY(m,m,.5*Math.PI),b9(g,c,l,m,k,1),a.identity(m),a.rotateX(m,m,-(.5*Math.PI)),b9(g,c,l,m,k,2),a.identity(m),a.rotateX(m,m,.5*Math.PI),b9(g,c,l,m,k,3),a.identity(m),b9(g,c,l,m,k,4),a.identity(m),a.rotateY(m,m,Math.PI),b9(g,c,l,m,k,5),g.viewport.set([0,0,b.width,b.height,])}(b,d),d.markSkyboxValid(b)):"sky"===b.renderPass&&function(b,c,d,f,g){var h,i;const j=b.context,k=j.gl,l=b.transform,m=b.useProgram("skybox");j.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_CUBE_MAP,c.skyboxTexture);const n=(h=l.skyboxMatrix,i=c.getCenter(b,!1),{u_matrix:h,u_sun_direction:i,u_cubemap:0,u_opacity:f,u_temporal_offset:g});b.prepareDrawProgram(j,m),m.draw(j,k.TRIANGLES,d,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,n,"skybox",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,d,k,h,l):"gradient"===j&&"sky"===b.renderPass&&function(b,c,d,f,g){var h,i,j,k,l;const m=b.context,n=m.gl,o=b.transform,p=b.useProgram("skyboxGradient");c.skyboxGeometry||(c.skyboxGeometry=new b8(m)),m.activeTexture.set(n.TEXTURE0);let q=c.colorRampTexture;q||(q=c.colorRampTexture=new a.Texture(m,c.colorRamp,n.RGBA)),q.bind(n.LINEAR,n.CLAMP_TO_EDGE);const r=(h=o.skyboxMatrix,i=c.getCenter(b,!1),j=c.paint.get("sky-gradient-radius"),k=f,l=g,{u_matrix:h,u_color_ramp:0,u_center_direction:i,u_radius:a.degToRad(j),u_opacity:k,u_temporal_offset:l});b.prepareDrawProgram(m,p),p.draw(m,n.TRIANGLES,d,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,r,"skyboxGradient",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,d,k,h,l)},debug:function(a,b,c){for(let d=0;db.getOpacity(this.transform.pitch)||.03>b.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[c,d]=b.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const f=c+.78*(d-c);this.transform.fogCullDistSq=f*f}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(b,c){if(this.width=b*a.exported.devicePixelRatio,this.height=c*a.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const d of this.style.order)this.style._layers[d].resize()}setup(){const b=this.context,c=new a.StructArrayLayout2i4;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=b.createVertexBuffer(c,a.posAttributes.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.StructArrayLayout2i4;d.emplaceBack(0,0),d.emplaceBack(a.EXTENT,0),d.emplaceBack(0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=b.createVertexBuffer(d,a.posAttributes.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const f=new a.StructArrayLayout2i4;f.emplaceBack(-1,-1),f.emplaceBack(1,-1),f.emplaceBack(-1,1),f.emplaceBack(1,1),this.viewportBuffer=b.createVertexBuffer(f,a.posAttributes.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const g=new a.StructArrayLayout4i8;g.emplaceBack(0,0,0,0),g.emplaceBack(a.EXTENT,0,a.EXTENT,0),g.emplaceBack(0,a.EXTENT,0,a.EXTENT),g.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.mercatorBoundsBuffer=b.createVertexBuffer(g,a.boundsAttributes.members),this.mercatorBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const h=new a.StructArrayLayout3ui6;h.emplaceBack(0,1,2),h.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=b.createIndexBuffer(h);const i=new a.StructArrayLayout1ui2;for(const j of[0,1,3,2,0])i.emplaceBack(j);this.debugIndexBuffer=b.createIndexBuffer(i),this.emptyTexture=new a.Texture(b,{width:1,height:1,data:new Uint8Array([0,0,0,0])},b.gl.RGBA),this.identityMat=a.create();const k=this.context.gl;this.stencilClearMode=new a.StencilMode({func:k.ALWAYS,mask:0},0,255,k.ZERO,k.ZERO,k.ZERO),this.loadTimeStamps.push(a.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const b=this.context,c=b.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(b,c.TRIANGLES,a.DepthMode.disabled,this.stencilClearMode,a.ColorMode.disabled,a.CullFaceMode.disabled,bg(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(b,c,d){if(!c||this.currentStencilSource===c.id||!b.isTileClipped()||!d||0===d.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let f=!1;for(const g of d)if(void 0===this._tileClippingMaskIDs[g.key]){f=!0;break}if(!f)return}this.currentStencilSource=c.id;const h=this.context,i=h.gl;this.nextStencilID+d.length>256&&this.clearStencil(),h.setColorMode(a.ColorMode.disabled),h.setDepthMode(a.DepthMode.disabled);const j=this.useProgram("clippingMask");for(const k of(this._tileClippingMaskIDs={},d)){const l=c.getTile(k),m=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=this.getTileBoundsBuffers(l);j.draw(h,i.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:i.ALWAYS,mask:0},m,255,i.KEEP,i.KEEP,i.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,bg(k.projMatrix),"$clipping",n,o,p)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const b=this.nextStencilID++,c=this.context.gl;return new a.StencilMode({func:c.NOTEQUAL,mask:255},b,255,c.KEEP,c.KEEP,c.REPLACE)}stencilModeForClipping(b){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(b);const c=this.context.gl;return new a.StencilMode({func:c.EQUAL,mask:255},this._tileClippingMaskIDs[b.key],0,c.KEEP,c.KEEP,c.REPLACE)}stencilConfigForOverlap(b){const c=this.context.gl,d=b.sort((a,b)=>b.overscaledZ-a.overscaledZ),f=d[d.length-1].overscaledZ,g=d[0].overscaledZ-f+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const h={};for(let i=0;i=0;this.currentLayer--){const u=this.style._layers[d[this.currentLayer]],v=b._getLayerSourceCache(u);if(u.isSky())continue;const w=v?j[v.id]:void 0;this._renderTileClippingMasks(u,v,w),this.renderLayer(this,v,u,w)}if(this.renderPass="sky",(a.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const c=b._getLayerSourceCache(a);c&&!a.isHidden(this.transform.zoom)&&(!C||C.getSource().maxzoom0?b.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const b=this.imageManager.getPattern(a.from.toString()),c=this.imageManager.getPattern(a.to.toString());return!b||!c}currentGlobalDefines(){const a=this.terrain&&this.terrain.renderingToTexture,b=this.style&&this.style.fog,c=[];return this.terrain&&!this.terrain.renderingToTexture&&c.push("TERRAIN"),b&&!a&&0!==b.getOpacity(this.transform.pitch)&&c.push("FOG"),a&&c.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&c.push("OVERDRAW_INSPECTOR"),c}useProgram(a,b,c){this.cache=this.cache||{};const d=this.currentGlobalDefines().concat(c||[]),f=bn.cacheKey(a,d,b);return this.cache[f]||(this.cache[f]=new bn(this.context,a,a3[a],b,bM[a],d)),this.cache[f]}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 a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=a.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.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()}prepareDrawTile(a){this.terrain&&this.terrain.prepareDrawTile(a)}prepareDrawProgram(a,b,c){if(this.terrain&&this.terrain.renderingToTexture)return;const d=this.style.fog;if(d){const f=d.getOpacity(this.transform.pitch);0!==f&&b.setFogUniformValues(a,((a,b,c,d)=>{const f=b.properties.get("color"),g=a.frameCounter/1e3%1,h=[f.r/f.a,f.g/f.a,f.b/f.a,d,];return{u_fog_matrix:c?a.transform.calculateFogTileMatrix(c):a.identityMat,u_fog_range:b.getFovAdjustedRange(a.transform._fov),u_fog_color:h,u_fog_horizon_blend:b.properties.get("horizon-blend"),u_fog_temporal_offset:g}})(this,d,c,f))}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,b=a.createTexture();return a.bindTexture(a.TEXTURE_2D,b),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),b}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&0!==a.getOpacity(this.transform.pitch)}getBackgroundTiles(){const b=this._backgroundTiles,c=this._backgroundTiles={},d=this.transform.coveringTiles({tileSize:512});for(const f of d)c[f.key]=b[f.key]||new a.Tile(f,512,this.transform.tileZoom,this);return c}clearBackgroundTiles(){this._backgroundTiles={}}}class cc{constructor(a=0,b=0,c=0,d=0){if(isNaN(a)||a<0||isNaN(b)||b<0||isNaN(c)||c<0||isNaN(d)||d<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=b,this.left=c,this.right=d}interpolate(b,c,d){return null!=c.top&&null!=b.top&&(this.top=a.number(b.top,c.top,d)),null!=c.bottom&&null!=b.bottom&&(this.bottom=a.number(b.bottom,c.bottom,d)),null!=c.left&&null!=b.left&&(this.left=a.number(b.left,c.left,d)),null!=c.right&&null!=b.right&&(this.right=a.number(b.right,c.right,d)),this}getCenter(b,c){const d=a.clamp((this.left+b-this.right)/2,0,b),f=a.clamp((this.top+c-this.bottom)/2,0,c);return new a.pointGeometry(d,f)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new cc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function cd(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function ce(b,c){a.setColumn(b,3,[c[0],c[1],c[2],1])}function cf(b,c){const d=a.identity$1([]);return a.rotateZ$1(d,d,-c),a.rotateX$1(d,d,-b),d}function cg(b,c){const d=[b[0],b[1],0],f=[c[0],c[1],0];if(a.length(d)>=1e-15){const g=a.normalize([],d);a.scale$2(f,g,a.dot(f,g)),c[0]=f[0],c[1]=f[1]}const h=a.cross([],c,b);if(1e-15>a.len(h))return null;const i=Math.atan2(-h[1],h[0]);return cf(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),i)}class ch{constructor(a,b){this.position=a,this.orientation=b}get position(){return this._position}set position(b){this._position=this._renderWorldCopies?function(b){if(!b)return;const c=Array.isArray(b)?new a.MercatorCoordinate(b[0],b[1],b[2]):b;return c.x=a.wrap(c.x,0,1),c}(b):b}lookAtPoint(b,c){if(this.orientation=null,!this.position)return;const d=this._elevation?this._elevation.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(b)):0,f=this.position,g=a.MercatorCoordinate.fromLngLat(b,d),h=[g.x-f.x,g.y-f.y,g.z-f.z];c||(c=[0,0,1]),c[2]=Math.abs(c[2]),this.orientation=cg(h,c)}setPitchBearing(b,c){this.orientation=cf(a.degToRad(b),a.degToRad(-c))}}class ci{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,cd(this._transform,this._orientation)),b&&ce(this._transform,b)}get mercatorPosition(){const b=this.position;return new a.MercatorCoordinate(b[0],b[1],b[2])}get position(){const b=a.getColumn(this._transform,3);return[b[0],b[1],b[2]]}set position(a){ce(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,cd(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),b=this.right();return{bearing:Math.atan2(-b[1],b[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,b){this._orientation=cf(a,b),cd(this._transform,this._orientation)}forward(){const b=a.getColumn(this._transform,2);return[-b[0],-b[1],-b[2]]}up(){const b=a.getColumn(this._transform,1);return[-b[0],-b[1],-b[2]]}right(){const b=a.getColumn(this._transform,0);return[b[0],b[1],b[2]]}getCameraToWorld(b,c){const d=new Float64Array(16);return a.invert(d,this.getWorldToCamera(b,c)),d}getWorldToCameraPosition(b,c,d){const f=this.position;a.scale$2(f,f,-b);const g=new Float64Array(16);return a.fromScaling(g,[d,d,d]),a.translate(g,g,f),g[10]*=c,g}getWorldToCamera(b,c){const d=new Float64Array(16),f=new Float64Array(4),g=this.position;return a.conjugate(f,this._orientation),a.scale$2(g,g,-b),a.fromQuat(d,f),a.translate(d,d,g),d[1]*=-1,d[5]*=-1,d[9]*=-1,d[13]*=-1,d[8]*=c,d[9]*=c,d[10]*=c,d[11]*=c,d}getCameraToClipPerspective(b,c,d,f){const g=new Float64Array(16);return a.perspective(g,b,c,d,f),g}getDistanceToElevation(b){const c=0===b?0:a.mercatorZfromAltitude(b,this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new ci([...this.position],[...this.orientation])}}function cj(b,c){const d=cl(b),f=function(b,c,d,f,g){const h=new a.LngLat(d.lng-180*cm,d.lat),i=new a.LngLat(d.lng+180*cm,d.lat),j=b.project(h.lng,h.lat),k=b.project(i.lng,i.lat),l=-Math.atan2(k.y-j.y,k.x-j.x),m=a.MercatorCoordinate.fromLngLat(d);m.y=a.clamp(m.y,-.999975,.999975);const n=m.toLngLat(),o=b.project(n.lng,n.lat),p=a.MercatorCoordinate.fromLngLat(n);p.x+=cm;const q=p.toLngLat(),r=b.project(q.lng,q.lat),s=co(r.x-o.x,r.y-o.y,l),u=a.MercatorCoordinate.fromLngLat(n);u.y+=cm;const v=u.toLngLat(),w=b.project(v.lng,v.lat),x=co(w.x-o.x,w.y-o.y,l),y=Math.abs(s.x)/Math.abs(x.y),z=a.identity([]);a.rotateZ(z,z,-l*(1-(g?0:f)));const A=a.identity([]);return a.scale(A,A,[1,1-(1-y)*f,1]),A[4]=-x.x/x.y*f,a.rotateZ(A,A,l),a.multiply$1(A,z,A),A}(b.projection,0,b.center,d,c),g=ck(b);return a.scale(f,f,[g,g,1]),f}function ck(b){const c=b.projection,d=cl(b),f=cn(c,b.center),g=cn(c,a.LngLat.convert(c.center));return Math.pow(2,f*d+(1-d)*g)}function cl(b){const c=b.projection.range;if(!c)return 0;const d=Math.max(b.width,b.height),f=Math.log(d/1024)/Math.LN2;return a.smoothstep(c[0]+f,c[1]+f,b.zoom)}const cm=1/4e4;function cn(b,c){const d=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),f=new a.LngLat(c.lng-180*cm,d),g=new a.LngLat(c.lng+180*cm,d),h=b.project(f.lng,d),i=b.project(g.lng,d),j=a.MercatorCoordinate.fromLngLat(f),k=a.MercatorCoordinate.fromLngLat(g),l=i.x-h.x,m=i.y-h.y,n=k.x-j.x,o=k.y-j.y,p=Math.sqrt((n*n+o*o)/(l*l+m*m));return Math.log(p)/Math.LN2}function co(a,b,c){const d=Math.cos(c),f=Math.sin(c);return{x:a*d-b*f,y:a*f+b*d}}class cp{constructor(b,c,d,f,g){this.tileSize=512,this._renderWorldCopies=void 0===g||g,this._minZoom=b||0,this._maxZoom=c||22,this._minPitch=null==d?0:d,this._maxPitch=null==f?60:f,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.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 cc,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new ci,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new cp(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.setProjection(this.getProjection()),a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a.tileSize=this.tileSize,a.setMaxBounds(this.getMaxBounds()),a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._cameraZoom=this._cameraZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,a?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(a){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),a&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return a.pick(this.projection,["name","center","parallels",])}setProjection(b){null==b&&(b={name:"mercator"}),this.projectionOptions=b;const c=this.projection?this.getProjection():void 0;return this.projection=a.getProjection(b),!g(c,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&& !0===this.projection.supportsWorldCopies}set renderWorldCopies(a){void 0===a?a=!0:null===a&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return a.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(b){var c,d,f,g,h,i,j,k,l,m;const n=-b*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(c=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(c[1]=0,c[2]=0),c[0]=1,c[3]=1,c),d=this.rotationMatrix,f=this.rotationMatrix,g=this.angle,h=f[0],i=f[1],j=f[2],k=f[3],l=Math.sin(g),m=Math.cos(g),d[0]=h*m+j*l,d[1]=i*m+k*l,d[2]=-(h*l)+j*m,d[3]=-(i*l)+k*m)}get pitch(){return this._pitch/Math.PI*180}set pitch(b){const c=a.clamp(b,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==c&&(this._unmodified=!1,this._pitch=c,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(a){const b=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==b&&(this._unmodified=!1,this._setZoom(b),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===a?(this._cameraZoom=null,!1):(this._centerAltitude=a,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const b=this._elevation,c=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],d=this.horizonLineFromTop();let f=0,g=0;for(let h=0;hb.maxzoom&&(c=b.maxzoom);const h=this.locationCoordinate(this.center),i=1<{const c=1/4e4,d=new a.MercatorCoordinate(b.x+c,b.y,b.z),f=new a.MercatorCoordinate(b.x,b.y+c,b.z),g=b.toLngLat(),h=d.toLngLat(),i=f.toLngLat(),j=this.locationCoordinate(g),k=this.locationCoordinate(h),l=this.locationCoordinate(i),m=Math.hypot(k.x-j.x,k.y-j.y),n=Math.hypot(l.x-j.x,l.y-j.y);return Math.sqrt(m*n)*u/c},w=b=>{const c=r,d=s;return{aabb:a.tileAABB(this,i,0,0,0,b,d,c,this.projection),zoom:0,x:0,y:0,minZ:d,maxZ:c,wrap:b,fullyVisible:!1}},x=[];let y=[];const z=c,A=b.reparseOverscaled?d:c,B=a=>a*a,C=B((n-this._centerAltitude)*m),D=a=>{if(!this._elevation||!a.tileID||!g)return;const b=this._elevation.getMinMaxForTile(a.tileID),c=a.aabb;b?(c.min[2]=b.min,c.max[2]=b.max,c.center[2]=(c.min[2]+c.max[2])/2):(a.shouldSplit=E(a),a.shouldSplit||(c.min[2]=c.max[2]=c.center[2]=this._centerAltitude))},E=b=>{if(b.zoom.85?1:k}const l=c*c+g*g+h;return l{if(b*B(.707)0;){const G=x.pop(),H=G.x,I=G.y;let J=G.fullyVisible;if(!J){const K=G.aabb.intersects(k);if(0===K)continue;J=2===K}if(G.zoom!==z&&E(G))for(let L=0;L<4;L++){const M=(H<<1)+L%2,N=(I<<1)+(L>>1),O={aabb:g?G.aabb.quadrant(L):a.tileAABB(this,i,G.zoom+1,M,N,G.wrap,G.minZ,G.maxZ,this.projection),zoom:G.zoom+1,x:M,y:N,wrap:G.wrap,fullyVisible:J,tileID:void 0,shouldSplit:void 0,minZ:G.minZ,maxZ:G.maxZ};f&&(O.tileID=new a.OverscaledTileID(G.zoom+1===z?A:G.zoom+1,G.wrap,G.zoom+1,M,N),D(O)),x.push(O)}else{const P=G.zoom===z?A:G.zoom;if(b.minzoom&&b.minzoom>P)continue;const Q=j[0]-(.5+H+(G.wrap<{const d=[0,0,0,1],f=[a.EXTENT,a.EXTENT,0,1],g=this.calculateFogTileMatrix(c.tileID.toUnwrapped());a.transformMat4$1(d,d,g),a.transformMat4$1(f,f,g);const h=a.getAABBPointSquareDist(d,f);if(0===h)return!0;let i=!1;const j=this._elevation;if(j&&h>T&&0!==U){const k=this.calculateProjMatrix(c.tileID.toUnwrapped());let l;b.isTerrainDEM||(l=j.getMinMaxForTile(c.tileID)),l||(l={min:s,max:r});const m=a.furthestTileCorner(this.rotation),n=[m[0]*a.EXTENT,m[1]*a.EXTENT,l.max,];a.transformMat4(n,n,k),i=(1-n[1])*this.height*.5a.distanceSq-b.distanceSq).map(a=>a.tileID)}resize(a,b){this.width=a,this.height=b,this.pixelsToGLUnits=[2/a,-2/b],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(b){const c=a.clamp(b.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),d=this.projection.project(b.lng,c);return new a.pointGeometry(d.x*this.worldSize,d.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(b,c){const d=this.pointCoordinate(c),f=this.pointCoordinate(this.centerPoint),g=this.locationCoordinate(b);this.setLocation(new a.MercatorCoordinate(g.x-(d.x-f.x),g.y-(d.y-f.y)))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this._coordinatePoint(this.locationCoordinate(a),!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(b,c){const d=c?a.mercatorZfromAltitude(c,b.lat):void 0,f=this.projection.project(b.lng,b.lat);return new a.MercatorCoordinate(f.x,f.y,d)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(b,c){const d=null!=c?c:this._centerAltitude,f=[b.x,b.y,0,1],g=[b.x,b.y,1,1];a.transformMat4$1(f,f,this.pixelMatrixInverse),a.transformMat4$1(g,g,this.pixelMatrixInverse);const h=g[3];a.scale$1(f,f,1/f[3]),a.scale$1(g,g,1/h);const i=f[2],j=g[2];return{p0:f,p1:g,t:i===j?0:(d-i)/(j-i)}}screenPointToMercatorRay(b){const c=[b.x,b.y,0,1],d=[b.x,b.y,1,1];return a.transformMat4$1(c,c,this.pixelMatrixInverse),a.transformMat4$1(d,d,this.pixelMatrixInverse),a.scale$1(c,c,1/c[3]),a.scale$1(d,d,1/d[3]),c[2]=a.mercatorZfromAltitude(c[2],this._center.lat)*this.worldSize,d[2]=a.mercatorZfromAltitude(d[2],this._center.lat)*this.worldSize,a.scale$1(c,c,1/this.worldSize),a.scale$1(d,d,1/this.worldSize),new a.Ray([c[0],c[1],c[2]],a.normalize([],a.sub([],d,c)))}rayIntersectionCoordinate(b){const{p0:c,p1:d,t:f}=b,g=a.mercatorZfromAltitude(c[2],this._center.lat),h=a.mercatorZfromAltitude(d[2],this._center.lat);return new a.MercatorCoordinate(a.number(c[0],d[0],f)/this.worldSize,a.number(c[1],d[1],f)/this.worldSize,a.number(g,h,f))}pointCoordinate(a,b=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(a.x,a.y,b)}pointCoordinate3D(b){if(!this.elevation)return this.pointCoordinate(b);const c=this.elevation;let d=this.elevation.pointCoordinate(b);if(d)return new a.MercatorCoordinate(d[0],d[1],d[2]);let f=0,g=this.horizonLineFromTop();if(b.y>g)return this.pointCoordinate(b);const h=.02*g,i=b.clone();for(let j=0;j<10&&g-f>h;j++){i.y=a.number(f,g,.66);const k=c.pointCoordinate(i);k?(g=i.y,d=k):f=i.y}return d?new a.MercatorCoordinate(d[0],d[1],d[2]):this.pointCoordinate(b)}isPointAboveHorizon(a){if(this.elevation)return!this.elevation.pointCoordinate(a);{const b=this.horizonLineFromTop();return a.y0?new a.pointGeometry(f[0]/f[3],f[1]/f[3]):new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(b,c){var d,f,g,h,i,j,k,l;const m=new a.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),n=new a.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),o=new a.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),p=new a.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let q=this.pointCoordinate(m,b),r=this.pointCoordinate(n,b);const s=this.pointCoordinate(o,c),u=this.pointCoordinate(p,c);return q.y>1&&r.y>=0?q=new a.MercatorCoordinate((1-u.y)/(d=u,((f=q).y-d.y)/(f.x-d.x))+u.x,1):q.y<0&&r.y<=1&&(q=new a.MercatorCoordinate(-u.y/(g=u,((h=q).y-g.y)/(h.x-g.x))+u.x,0)),r.y>1&&q.y>=0?r=new a.MercatorCoordinate((1-s.y)/(i=s,((j=r).y-i.y)/(j.x-i.x))+s.x,1):r.y<0&&q.y<=1&&(r=new a.MercatorCoordinate(-s.y/(k=s,((l=r).y-k.y)/(l.x-k.x))+s.x,0)),new a.LngLatBounds().extend(this.coordinateLocation(q)).extend(this.coordinateLocation(r)).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(s))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length)return this._getBounds(0,0);const b=a.visibleDemTiles.reduce((a,b)=>{if(b.dem){const c=b.dem.tree;a.min=Math.min(a.min,c.minimums[0]),a.max=Math.max(a.max,c.maximums[0])}return a},{min:Number.MAX_VALUE,max:0});return this._getBounds(b.min*a.exaggeration(),b.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(a=!0){const b=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,c=this.height/2-b*(1-this._horizonShift);return a?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(b){this.maxBounds=b,this.minLat=-a.MAX_MERCATOR_LATITUDE,this.maxLat=a.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,b&&(this.minLat=b.getSouth(),this.maxLat=b.getNorth(),this.minLng=b.getWest(),this.maxLng=b.getEast(),this.maxLngm&&(i=m-k),m-lo&&(h=o-j),o-n.5?w-1:w,x>.5?x-1:x,0,]),this.alignedProjMatrix=y,i=a.create(),a.scale(i,i,[this.width/2,-this.height/2,1,]),a.translate(i,i,[1,-1,0]),this.labelPlaneMatrix=i,i=a.create(),a.scale(i,i,[1,-1,1]),a.translate(i,i,[-1,-1,0]),a.scale(i,i,[2/this.width,2/this.height,1,]),this.glCoordMatrix=i,this.pixelMatrix=a.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},i=a.invert(new Float64Array(16),this.pixelMatrix),!i)throw Error("failed to invert matrix");this.pixelMatrixInverse=i,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const b=this.cameraWorldSize,c=this.cameraPixelsPerMeter,d=this._camera.position,f=1/this.height,g=[b,b,c];a.scale$2(g,g,f),a.scale$2(d,d,-1),a.multiply$2(d,d,g);const h=a.create();a.translate(h,h,d),a.scale(h,h,g),this.mercatorFogMatrix=h,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(b,c,f)}_computeCameraPosition(a){const b=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*b-a/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*f,d.y/this.worldSize-c[1]*f,a/this.worldSize*this._centerAltitude-c[2]*f,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(b){const c=this._maxCameraBoundsDistance()*Math.cos(this._pitch),d=b[2];let f=1;d>0&&(f=Math.min((c-this._camera.position[2])/d,1)),this._camera.position=a.scaleAndAdd([],this._camera.position,b,f),this._updateStateFromCamera()}_updateStateFromCamera(){const b=this._camera.position,c=this._camera.forward(),{pitch:d,bearing:f}=this._camera.getPitchBearing(),g=a.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,h=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.degToRad(this._maxPitch)),i=Math.max((b[2]-g)/Math.cos(d),h),j=this._zoomFromMercatorZ(i);a.scaleAndAdd(b,b,c,i),this._pitch=a.clamp(d,a.degToRad(this.minPitch),a.degToRad(this.maxPitch)),this.angle=a.wrap(f,-Math.PI,Math.PI),this._setZoom(a.clamp(j,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new a.MercatorCoordinate(b[0],b[1],b[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}_terrainEnabled(){return!(!this._elevation|| !this.projection.supportsTerrain&&(a.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(b,c){const d=Math.min(b.x,c.x),f=Math.max(b.x,c.x),g=Math.min(b.y,c.y),h=Math.max(b.y,c.y);if(gk||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.pointGeometry(0,0),new a.pointGeometry(this.width,this.height))}zoomDeltaToMovement(b,c){const d=a.length(a.sub([],this._camera.position,b)),f=this._zoomFromMercatorZ(d)+c;return d-this._mercatorZfromZoom(f)}getCameraPoint(){const b=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,b))}}function cq(a,b){let c=!1,d=null;const f=()=>{d=null,c&&(a(),d=setTimeout(f,b),c=!1)};return()=>(c=!0,d||f(),d)}const cr={linearity:.3,easing:a.bezier(0,0,.3,1)},cs=a.extend({deceleration:2500,maxSpeed:1400},cr),ct=a.extend({deceleration:20,maxSpeed:1400},cr),cu=a.extend({deceleration:1e3,maxSpeed:360},cr),cv=a.extend({deceleration:1e3,maxSpeed:90},cr);function cw(a,b){(!a.duration||a.durationc.unproject(a)),j=g.reduce((a,b,c,d)=>a.add(b.div(d.length)),new a.pointGeometry(0,0));super(b,{points:g,point:j,lngLats:i,lngLat:c.unproject(j),originalEvent:d}),this._defaultPrevented=!1}}class cA extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,b,c){super(a,{originalEvent:c}),this._defaultPrevented=!1}}class cB{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cA(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cy(a.type,this._map,a))}mouseup(a){this._map.fire(new cy(a.type,this._map,a))}preclick(b){const c=a.extend({},b);c.type="preclick",this._map.fire(new cy(c.type,this._map,c))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cy(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cy(a.type,this._map,a))}mouseover(a){this._map.fire(new cy(a.type,this._map,a))}mouseout(a){this._map.fire(new cy(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cz(a.type,this._map,a))}touchmove(a){this._map.fire(new cz(a.type,this._map,a))}touchend(a){this._map.fire(new cz(a.type,this._map,a))}touchcancel(a){this._map.fire(new cz(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cC{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cy(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cy("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cy(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cD{constructor(a,b){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=b.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,b){this.isEnabled()&&a.shiftKey&&0===a.button&&(h.disableDrag(),this._startPos=this._lastPos=b,this._active=!0)}mousemoveWindow(a,b){if(!this._active)return;const c=b;if(this._lastPos.equals(c)|| !this._box&&c.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${f}px,${i}px)`,this._box.style.width=g-f+"px",this._box.style.height=j-i+"px")})}mouseupWindow(b,c){if(!this._active||0!==b.button)return;const d=this._startPos,f=c;if(this.reset(),h.suppressClick(),d.x!==f.x||d.y!==f.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:b})),{cameraAnimation:a=>a.fitScreenCoordinates(d,f,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",b)}keydown(a){this._active&&27===a.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),h.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(b,c){return this._map.fire(new a.Event(b,{originalEvent:c}))}}function cE(a,b){const c={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=b.timeStamp),d.length===this.numTouches&&(this.centroid=function(b){const c=new a.pointGeometry(0,0);for(const d of b)c._add(d);return c.div(b.length)}(c),this.touches=cE(d,c)))}touchmove(a,b,c){if(this.aborted||!this.centroid)return;const d=cE(c,b);for(const f in this.touches){const g=this.touches[f],h=d[f];(!h||h.dist(g)>30)&&(this.aborted=!0)}}touchend(a,b,c){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),0===c.length){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}(b),this.numTaps=b.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,b,c){this.singleTap.touchstart(a,b,c)}touchmove(a,b,c){this.singleTap.touchmove(a,b,c)}touchend(a,b,c){const d=this.singleTap.touchend(a,b,c);if(d){const f=a.timeStamp-this.lastTime<500,g=!this.lastTap||30>this.lastTap.dist(d);if(f&&g||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class cG{constructor(){this._zoomIn=new cF({numTouches:1,numTaps:2}),this._zoomOut=new cF({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,b,c){this._zoomIn.touchstart(a,b,c),this._zoomOut.touchstart(a,b,c)}touchmove(a,b,c){this._zoomIn.touchmove(a,b,c),this._zoomOut.touchmove(a,b,c)}touchend(a,b,c){const d=this._zoomIn.touchend(a,b,c),f=this._zoomOut.touchend(a,b,c);return d?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(d)},{originalEvent:a})}):f?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(f)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cH={0:1,2:2};class cI{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(a,b){return!1}_move(a,b){return{}}mousedown(a,b){if(this._lastPoint)return;const c=h.mouseButton(a);this._correctButton(a,c)&&(this._lastPoint=b,this._eventButton=c)}mousemoveWindow(a,b){const c=this._lastPoint;if(c){if(a.preventDefault(),function(a,b){const c=cH[b];return void 0===a.buttons||(a.buttons&c)!==c}(a,this._eventButton))this.reset();else if(this._moved||!(b.dist(c)0&&(this._active=!0);const f=cE(d,c),g=new a.pointGeometry(0,0),h=new a.pointGeometry(0,0);let i=0;for(const j in f){const k=f[j],l=this._touches[j];l&&(g._add(k),h._add(k.sub(l)),i++,f[j]=k)}if(this._touches=f,i{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class cN{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(a){}_move(a,b,c){return{}}touchstart(a,b,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier,],this._start([b[0],b[1]]))}touchmove(a,b,c){if(!this._firstTwoTouches)return;a.preventDefault();const[d,f]=this._firstTwoTouches,g=cO(c,b,d),h=cO(c,b,f);if(!g||!h)return;const i=this._aroundCenter?null:g.add(h).div(2);return this._move([g,h],i,a)}touchend(a,b,c){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,g=cO(c,b,d),i=cO(c,b,f);g&&i||(this._active&&h.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function cO(a,b,c){for(let d=0;dMath.abs(cP(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cP(this._distance,c),pinchAround:b}}}function cR(a,b){return 180*a.angleWith(b)/Math.PI}class cS extends cN{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,b){const c=this._vector;if(this._vector=a[0].sub(a[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:cR(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cR(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cU extends cN{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(a){this._lastPoints=a,cT(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,b,c){const d=a[0].sub(this._lastPoints[0]),f=a[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&c.touches.length<3)&&(this._valid=this.gestureBeginsVertically(d,f,c.timeStamp),this._valid))return this._lastPoints=a,this._active=!0,{pitchDelta:-((d.y+f.y)/2*.5)}}gestureBeginsVertically(a,b,c){if(void 0!==this._valid)return this._valid;const d=a.mag()>=2,f=b.mag()>=2;if(!d&&!f)return;if(!d||!f)return void 0===this._firstMove&&(this._firstMove=c),c-this._firstMove<100&&void 0;const g=a.y>0==b.y>0;return cT(a)&&cT(b)&&g}}class cV{constructor(){const a={panStep:100,bearingStep:15,pitchStep:10};this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let b=0,c=0,d=0,f=0,g=0;switch(a.keyCode){case 61:case 107:case 171:case 187:b=1;break;case 189:case 109:case 173:b=-1;break;case 37:a.shiftKey?c=-1:(a.preventDefault(),f=-1);break;case 39:a.shiftKey?c=1:(a.preventDefault(),f=1);break;case 38:a.shiftKey?d=1:(a.preventDefault(),g=-1);break;case 40:a.shiftKey?d=-1:(a.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:h=>{const i=h.getZoom();h.easeTo({duration:300,easeId:"keyboardHandler",easing:cW,zoom:b?Math.round(i)+b*(a.shiftKey?2:1):i,bearing:h.getBearing()+c*this._bearingStep,pitch:h.getPitch()+d*this._pitchStep,offset:[-f*this._panStep,-g*this._panStep,],center:h.getCenter()},{originalEvent:a})}}}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 cW(a){return a*(2-a)}const cX=4.000244140625;class cY{constructor(b,c){this._map=b,this._el=b.getCanvasContainer(),this._handler=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active|| void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(b){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(b.ctrlKey||b.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let c=b.deltaMode===a.window.WheelEvent.DOM_DELTA_LINE?40*b.deltaY:b.deltaY;const d=a.exported.now(),f=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,0!==c&&c%cX==0?this._type="wheel":0!==c&&4>Math.abs(c)?this._type="trackpad":f>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,b)):this._type||(this._type=200>Math.abs(f*c)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),b.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=b,this._delta-=c,this._active||this._start(b)),b.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){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 b=h.mousePos(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:b,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const b=this._map.transform,c=()=>b._terrainEnabled()&&this._aroundCoord?b.computeZoomRelativeTo(this._aroundCoord):b.zoom;if(0!==this._delta){const d="wheel"===this._type&&Math.abs(this._delta)>cX?this._wheelZoomRate:this._defaultZoomRate;let f=2/(1+Math.exp(-Math.abs(this._delta*d)));this._delta<0&&0!==f&&(f=1/f);const g=c(),h=Math.pow(2,g),i="number"==typeof this._targetZoom?b.zoomScale(this._targetZoom):h;this._targetZoom=Math.min(b.maxZoom,Math.max(b.minZoom,b.scaleZoom(i*f))),"wheel"===this._type&&(this._startZoom=c(),this._easing=this._smoothOutEasing(200)),this._delta=0}const j="number"==typeof this._targetZoom?this._targetZoom:c(),k=this._startZoom,l=this._easing;let m,n=!1;if("wheel"===this._type&&k&&l){const o=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),p=l(o);m=a.number(k,j,p),o<1?this._frameId||(this._frameId=!0):n=!0}else m=j,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!n,zoomDelta:m-c(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(b){let c=a.ease;if(this._prevEase){const d=this._prevEase,f=(a.exported.now()-d.start)/d.duration,g=d.easing(f+.01)-d.easing(f),h=.27/Math.sqrt(g*g+1e-4)*.01,i=Math.sqrt(.0729-h*h);c=a.bezier(h,i,.25,1)}return this._prevEase={start:a.exported.now(),duration:b,easing:c},c}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=h.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(a.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`)}_isFullscreen(){return!!a.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class cZ{constructor(a,b){this._clickZoom=a,this._tapZoom=b}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 c${constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,b){return a.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(a.shiftKey?-1:1),around:c.unproject(b)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c_{constructor(){this._tap=new cF({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(a,b,c){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=b[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(a,b,c))}touchmove(a,b,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=b[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,a.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(a,b,c)}touchend(a,b,c){this._tapTime?this._swipePoint&&0===c.length&&this.reset():this._tap.touchend(a,b,c)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c0{constructor(a,b,c){this._el=a,this._mousePan=b,this._touchPan=c}enable(a){this._inertiaOptions=a||{},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 c1{constructor(a,b,c){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=b,this._mousePitch=c}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 c2{constructor(a,b,c,d){this._el=a,this._touchZoom=b,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),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 c3=a=>a.zoom||a.drag||a.pitch||a.rotate;class c4 extends a.Event{}function c5(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c6="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c7 extends a.Evented{constructor(b,c){super(),this._moving=!1,this._zooming=!1,this.transform=b,this._bearingSnap=c.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,b){return this.jumpTo({center:a},b)}panBy(b,c,d){return b=a.pointGeometry.convert(b).mult(-1),this.panTo(this.transform.center,a.extend({offset:b},c),d)}panTo(b,c,d){return this.easeTo(a.extend({center:b},c),d)}getZoom(){return this.transform.zoom}setZoom(a,b){return this.jumpTo({zoom:a},b),this}zoomTo(b,c,d){return this.easeTo(a.extend({zoom:b},c),d)}zoomIn(a,b){return this.zoomTo(this.getZoom()+1,a,b),this}zoomOut(a,b){return this.zoomTo(this.getZoom()-1,a,b),this}getBearing(){return this.transform.bearing}setBearing(a,b){return this.jumpTo({bearing:a},b),this}getPadding(){return this.transform.padding}setPadding(a,b){return this.jumpTo({padding:a},b),this}rotateTo(b,c,d){return this.easeTo(a.extend({bearing:b},c),d)}resetNorth(b,c){return this.rotateTo(0,a.extend({duration:1e3},b),c),this}resetNorthPitch(b,c){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},b),c),this}snapToNorth(a,b){return Math.abs(this.getBearing())p=>{if(x&&(d.zoom=a.number(f,j,p)),y&&(d.bearing=a.number(g,k,p)),z&&(d.pitch=a.number(h,l,p)),A&&(d.interpolatePadding(i,m,p),o=d.centerPoint.add(n)),v)d.setLocationAtPoint(v,w);else{const q=d.zoomScale(d.zoom-f),B=j>f?Math.min(2,u):Math.max(.5,u),C=Math.pow(B,1-p),D=d.unproject(r.add(s.mult(p*C)).mult(q));d.setLocationAtPoint(d.renderWorldCopies?D.wrap():D,o)}return b.preloadOnly||this._fireMoveEvents(c),d};if(b.preloadOnly){const C=this._emulate(B,b.duration,d);return this._preloadTiles(C),this}const D={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=y,this._pitching=z,this._padding=A,this._easeId=b.easeId,this._prepareEase(c,b.noMoveStart,D),this._ease(B(d),a=>{d.recenterOnTerrain(),this._afterEase(c,a)},b),this}_prepareEase(b,c,d={}){this._moving=!0,this.transform.cameraElevationReference="sea",c||d.moving||this.fire(new a.Event("movestart",b)),this._zooming&&!d.zooming&&this.fire(new a.Event("zoomstart",b)),this._rotating&&!d.rotating&&this.fire(new a.Event("rotatestart",b)),this._pitching&&!d.pitching&&this.fire(new a.Event("pitchstart",b))}_fireMoveEvents(b){this.fire(new a.Event("move",b)),this._zooming&&this.fire(new a.Event("zoom",b)),this._rotating&&this.fire(new a.Event("rotate",b)),this._pitching&&this.fire(new a.Event("pitch",b))}_afterEase(b,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId,this.transform.cameraElevationReference="ground";const d=this._zooming,f=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.Event("zoomend",b)),f&&this.fire(new a.Event("rotateend",b)),g&&this.fire(new a.Event("pitchend",b)),this.fire(new a.Event("moveend",b))}flyTo(b,c){if(!b.essential&&a.exported.prefersReducedMotion){const d=a.pick(b,["center","zoom","bearing","pitch","around",]);return this.jumpTo(d,c)}this.stop(),b=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},b);const f=this.transform,g=this.getZoom(),h=this.getBearing(),i=this.getPitch(),j=this.getPadding(),k="zoom"in b?a.clamp(+b.zoom,f.minZoom,f.maxZoom):g,l="bearing"in b?this._normalizeBearing(b.bearing,h):h,m="pitch"in b?+b.pitch:i,n="padding"in b?b.padding:f.padding,o=f.zoomScale(k-g),p=a.pointGeometry.convert(b.offset);let q=f.centerPoint.add(p);const r=f.pointLocation(q),s=a.LngLat.convert(b.center||r);this._normalizeCenter(s);const u=f.project(r),v=f.project(s).sub(u);let w=b.curve;const x=Math.max(f.width,f.height),y=x/o,z=v.mag();if("minZoom"in b){const A=a.clamp(Math.min(b.minZoom,g,k),f.minZoom,f.maxZoom),B=x/f.zoomScale(A-g);w=Math.sqrt(B/z*2)}const C=w*w;function D(a){const b=(y*y-x*x+(a?-1:1)*C*C*z*z)/(2*(a?y:x)*C*z);return Math.log(Math.sqrt(b*b+1)-b)}function E(a){return(Math.exp(a)-Math.exp(-a))/2}function F(a){return(Math.exp(a)+Math.exp(-a))/2}const G=D(0);let H=function(a){return F(G)/F(G+w*a)},I=function(a){var b;return x*((F(G)*(E(b=G+w*a)/F(b))-E(G))/C)/z},J=(D(1)-G)/w;if(1e-6>Math.abs(z)||!isFinite(J)){if(1e-6>Math.abs(x-y))return this.easeTo(b,c);const K=yb.maxDuration&&(b.duration=0);const L=h!==l,M=m!==i,N=!f.isPaddingEqual(n),O=d=>f=>{const o=f*J,r=1/H(o);d.zoom=1===f?k:g+d.scaleZoom(r),L&&(d.bearing=a.number(h,l,f)),M&&(d.pitch=a.number(i,m,f)),N&&(d.interpolatePadding(j,n,f),q=d.centerPoint.add(p));const w=1===f?s:d.unproject(u.add(v.mult(I(o))).mult(r));return d.setLocationAtPoint(d.renderWorldCopies?w.wrap():w,q),d._updateCenterElevation(),b.preloadOnly||this._fireMoveEvents(c),d};if(b.preloadOnly){const P=this._emulate(O,b.duration,f);return this._preloadTiles(P),this}return this._zooming=!0,this._rotating=L,this._pitching=M,this._padding=N,this._prepareEase(c,!1),this._ease(O(f),()=>this._afterEase(c),b),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,b){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,b)}if(!a){const d=this.handlers;d&&d.stop(!1)}return this}_ease(b,c,d){!1===d.animate||0===d.duration?(b(1),c()):(this._easeStart=a.exported.now(),this._easeOptions=d,this._onEaseFrame=b,this._onEaseEnd=c,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const b=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(b)),b<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(b,c){b=a.wrap(b,-180,180);const d=Math.abs(b-c);return Math.abs(b-360-c)180?-360:c< -180?360:0}_emulate(a,b,c){const d=Math.ceil(15*b/1e3),f=[],g=a(c.clone());for(let h=0;h<=d;h++){const i=g(h/d);f.push(i.clone())}return f}}class c8{constructor(b={}){this.options=b,a.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(a){const b=this.options&&this.options.compact;return this._map=a,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=h.create("button","mapboxgl-ctrl-attrib-button",this._container),h.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=h.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),b&&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===b&&(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(a,b){const c=this._map._getUIString(`AttributionControl.${b}`);a.setAttribute("aria-label",c),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",c)}_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 b=this._editLink;b||(b=this._editLink=this._container.querySelector(".mapbox-improve-map"));const c=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.config.ACCESS_TOKEN},];if(b){const d=c.reduce((a,b,d)=>(b.value&&(a+=`${b.key}=${b.value}${da.indexOf(g.attribution)&&a.push(g.attribution)}}a.sort((a,b)=>a.length-b.length),a=a.filter((b,c)=>{for(let d=c+1;d=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a,]:a.unshift(this.options.customAttribution));const h=a.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,a.length?(this._innerContainer.innerHTML=h,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 c9{constructor(){a.bindAll(["_updateLogo"],this),a.bindAll(["_updateCompact"],this)}onAdd(a){this._map=a,this._container=h.create("div","mapboxgl-ctrl");const b=h.create("a","mapboxgl-ctrl-logo");return b.target="_blank",b.rel="noopener nofollow",b.href="https://www.mapbox.com/",b.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),b.setAttribute("rel","noopener nofollow"),this._container.appendChild(b),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(a){a&&"metadata"!==a.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(0===Object.entries(a).length)return!0;for(const b in a){const c=a[b].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const b=a[0];this._map.getCanvasContainer().offsetWidth<250?b.classList.add("mapboxgl-compact"):b.classList.remove("mapboxgl-compact")}}}class da{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const b=++this._id;return this._queue.push({callback:a,id:b,cancelled:!1}),b}remove(a){const b=this._currentlyRunning,c=b?this._queue.concat(b):this._queue;for(const d of c)if(d.id===a)return void(d.cancelled=!0)}run(a=0){const b=this._currentlyRunning=this._queue;for(const c of(this._queue=[],b))if(!c.cancelled&&(c.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function db(b,c,d){if(b=new a.LngLat(b.lng,b.lat),c){const f=new a.LngLat(b.lng-360,b.lat),g=new a.LngLat(b.lng+360,b.lat),h=360*Math.ceil(Math.abs(b.lng-d.center.lng)/360),i=d.locationPoint(b).distSqr(c),j=c.x<0||c.y<0||c.x>d.width||c.y>d.height;d.locationPoint(f).distSqr(c)180;){const k=d.locationPoint(b);if(k.x>=0&&k.y>=0&&k.x<=d.width&&k.y<=d.height)break;b.lng>d.center.lng?b.lng-=360:b.lng+=360}return b}const dc={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 dd extends a.Evented{constructor(b,c){if(super(),(b instanceof a.window.HTMLElement||c)&&(b=a.extend({element:b},c)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=b&&b.anchor||"center",this._color=b&&b.color||"#3FB1CE",this._scale=b&&b.scale||1,this._draggable=b&&b.draggable||!1,this._clickTolerance=b&&b.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=b&&b.rotation||0,this._rotationAlignment=b&&b.rotationAlignment||"auto",this._pitchAlignment=b&&b.pitchAlignment&&"auto"!==b.pitchAlignment?b.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),b&&b.element)this._element=b.element,this._offset=a.pointGeometry.convert(b&&b.offset||[0,0]);else{this._defaultMarker=!0,this._element=h.create("div");const d=41,f=27,g=h.createSVG("svg",{display:"block",height:d*this._scale+"px",width:f*this._scale+"px",viewBox:`0 0 ${f} ${d}`},this._element),i=h.createSVG("radialGradient",{id:"shadowGradient"},h.createSVG("defs",{},g));h.createSVG("stop",{offset:"10%","stop-opacity":.4},i),h.createSVG("stop",{offset:"100%","stop-opacity":.05},i),h.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},g),h.createSVG("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"},g),h.createSVG("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"},g),h.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},g),this._offset=a.pointGeometry.convert(b&&b.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",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()});const j=this._element.classList;for(const k in dc)j.remove(`mapboxgl-marker-anchor-${k}`);j.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(a){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")),a){if(!("offset"in a.options)){const b=38.1,c=13.5,d=Math.sqrt(Math.pow(c,2)/2);a.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-b],"bottom-left":[d,-1*(b-c+d),],"bottom-right":[-d,-1*(b-c+d),],left:[c,-1*(b-c)],right:[-c,-1*(b-c)]}:this._offset}this._popup=a,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(a){const b=a.code,c=a.charCode||a.keyCode;"Space"!==b&&"Enter"!==b&&32!==c&&13!==c||this.togglePopup()}_onMapClick(a){const b=a.originalEvent.target,c=this._element;this._popup&&(b===c||c.contains(b))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a&&(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):(a.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const a=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(a))return void this._clearFadeTimer();const b=this._map.unproject(a);let c=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const d=this._map.getFreeCameraOptions();if(d.position){const f=d.position.toLngLat();c=f.distanceTo(b)<.9*f.distanceTo(this._lngLat)}}const g=(1-this._map._queryFogOpacity(b))*(c?.2:1);this._element.style.opacity=`${g}`,this._popup&&this._popup._setOpacity(`${g}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(a){const b=this._map.transform;return!!a&&a.x>=0&&a.x=0&&a.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const a=this._map.transform,b=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&b._rotate(a.angle),"map"===this._pitchAlignment&&(b.y*=Math.cos(a._pitch)),b}getOffset(){return this._offset}setOffset(b){return this._offset=a.pointGeometry.convert(b),this._update(),this}_onMove(b){if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=b.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=b.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(a){this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(a){return this._draggable=!!a,this._map&&(a?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&"auto"!==a?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const{HTMLImageElement:de,HTMLElement:df,ImageBitmap:dg}=a.window;function dh(a){a.parentNode&&a.parentNode.removeChild(a)}class di{constructor(b,c,d=!1){this._clickTolerance=10,this.element=c,this.mouseRotate=new cK({clickTolerance:b.dragRotate._mouseRotate._clickTolerance}),this.map=b,d&&(this.mousePitch=new cL({clickTolerance:b.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),c.addEventListener("mousedown",this.mousedown),c.addEventListener("touchstart",this.touchstart,{passive:!1}),c.addEventListener("touchmove",this.touchmove),c.addEventListener("touchend",this.touchend),c.addEventListener("touchcancel",this.reset)}down(a,b){this.mouseRotate.mousedown(a,b),this.mousePitch&&this.mousePitch.mousedown(a,b),h.disableDrag()}move(a,b){const c=this.map,d=this.mouseRotate.mousemoveWindow(a,b);if(d&&d.bearingDelta&&c.setBearing(c.getBearing()+d.bearingDelta),this.mousePitch){const f=this.mousePitch.mousemoveWindow(a,b);f&&f.pitchDelta&&c.setPitch(c.getPitch()+f.pitchDelta)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){h.enableDrag(),a.window.removeEventListener("mousemove",this.mousemove),a.window.removeEventListener("mouseup",this.mouseup)}mousedown(b){this.down(a.extend({},b,{ctrlKey:!0,preventDefault:()=>b.preventDefault()}),h.mousePos(this.element,b)),a.window.addEventListener("mousemove",this.mousemove),a.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,h.mousePos(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){1!==a.targetTouches.length?this.reset():(this._startPos=this._lastPos=h.touchPos(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){1!==a.targetTouches.length?this.reset():(this._lastPos=h.touchPos(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){0===a.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?dn(b,d,j/5280,a._getUIString("ScaleControl.Miles"),a):dn(b,d,j,a._getUIString("ScaleControl.Feet"),a)}else c&&"nautical"===c.unit?dn(b,d,i/1852,a._getUIString("ScaleControl.NauticalMiles"),a):i>=1e3?dn(b,d,i/1e3,a._getUIString("ScaleControl.Kilometers"),a):dn(b,d,i,a._getUIString("ScaleControl.Meters"),a)}function dn(a,b,c,d,f){const g=function(a){const b=Math.pow(10,`${Math.floor(a)}`.length-1);let c=a/b;return c=c>=10?10:c>=5?5:c>=3?3:c>=2?2:c>=1?1:function(a){const b=Math.pow(10,Math.ceil(-Math.log(a)/Math.LN10));return Math.round(a*b)/b}(c),b*c}(c),h=g/c;f._requestDomTask(()=>{a.style.width=b*h+"px",a.innerHTML=`${g} ${d}`})}const dp={version:a.version,supported:b,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends c7{constructor(b){if(null!=(b=a.extend({},{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,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},b)).minZoom&&null!=b.maxZoom&&b.minZoom>b.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=b.minPitch&&null!=b.maxPitch&&b.minPitch>b.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=b.minPitch&&b.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=b.maxPitch&&b.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new cp(b.minZoom,b.maxZoom,b.minPitch,b.maxPitch,b.renderWorldCopies),b),this._interactive=b.interactive,this._minTileCacheSize=b.minTileCacheSize,this._maxTileCacheSize=b.maxTileCacheSize,this._failIfMajorPerformanceCaveat=b.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=b.preserveDrawingBuffer,this._antialias=b.antialias,this._trackResize=b.trackResize,this._bearingSnap=b.bearingSnap,this._refreshExpiredTiles=b.refreshExpiredTiles,this._fadeDuration=b.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=b.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=b.collectResourceTiming,this._optimizeForTerrain=b.optimizeForTerrain,this._renderTaskQueue=new da,this._domRenderTaskQueue=new da,this._controls=[],this._markers=[],this._mapId=a.uniqueId(),this._locale=a.extend({},{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"},b.locale),this._clickTolerance=b.clickTolerance,this._cooperativeGestures=b.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new class{constructor(a){this.jumpTo(a)}getValue(b){if(b<=this._startTime)return this._start;if(b>=this._endTime)return this._end;const c=a.easeCubicInOut((b-this._startTime)/(this._endTime-this._startTime));return this._start*(1-c)+this._end*c}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(a,b,c){this._start=this.getValue(b),this._end=a,this._startTime=b,this._endTime=b+c}}(0),this._requestManager=new a.RequestManager(b.transformRequest,b.accessToken,b.testMode),this._silenceAuthErrors=!!b.testMode,"string"==typeof b.container){if(this._container=a.window.document.getElementById(b.container),!this._container)throw Error(`Container '${b.container}' not found.`)}else{if(!(b.container instanceof df))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=b.container}if(this._container.childNodes.length>0&&a.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."),b.maxBounds&&this.setMaxBounds(b.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw 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!==a.window&&(a.window.addEventListener("online",this._onWindowOnline,!1),a.window.addEventListener("resize",this._onWindowResize,!1),a.window.addEventListener("orientationchange",this._onWindowResize,!1),a.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new class{constructor(b,c){this._map=b,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new class{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(b){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:b})}_drainInertiaBuffer(){const b=this._inertiaBuffer,c=a.exported.now();for(;b.length>0&&c-b[0].time>160;)b.shift()}_onMoveEnd(b){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const c={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)c.zoom+=d.zoomDelta||0,c.bearing+=d.bearingDelta||0,c.pitch+=d.pitchDelta||0,d.panDelta&&c.pan._add(d.panDelta),d.around&&(c.around=d.around),d.pinchAround&&(c.pinchAround=d.pinchAround);const f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(c.pan.mag()){const h=cx(c.pan.mag(),f,a.extend({},cs,b||{}));g.offset=c.pan.mult(h.amount/c.pan.mag()),g.center=this._map.transform.center,cw(g,h)}if(c.zoom){const i=cx(c.zoom,f,ct);g.zoom=this._map.transform.zoom+i.amount,cw(g,i)}if(c.bearing){const j=cx(c.bearing,f,cu);g.bearing=this._map.transform.bearing+a.clamp(j.amount,-179,179),cw(g,j)}if(c.pitch){const k=cx(c.pitch,f,cv);g.pitch=this._map.transform.pitch+k.amount,cw(g,k)}if(g.zoom||g.bearing){const l=void 0===c.pinchAround?c.around:c.pinchAround;g.around=l?this._map.unproject(l):this._map.getCenter()}return this.clear(),a.extend(g,{noMoveStart:!0})}}(b),this._bearingSnap=c.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new class{constructor(){this.constants=[1,1,.01],this.radius=0}setup(b,c){const d=a.sub([],c,b);this.radius=a.length(d[2]<0?a.div([],d,this.constants):[d[0],d[1],0])}projectRay(b){a.div(b,b,this.constants),a.normalize(b,b),a.mul$1(b,b,this.constants);const c=a.scale$2([],b,this.radius);if(c[2]>0){const d=a.scale$2([],[0,0,1],a.dot(c,[0,0,1])),f=a.scale$2([],a.normalize([],[c[0],c[1],0]),this.radius),g=a.add([],c,a.scale$2([],a.sub([],a.add([],f,d),c),2));c[0]=g[0],c[1]=g[1]}return c}},this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(c),a.bindAll(["handleEvent","handleWindowEvent"],this);const d=this._el;for(const[f,g,h]of(this._listeners=[[d,"touchstart",{passive:!0},],[d,"touchmove",{passive:!1},],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[a.window.document,"mousemove",{capture:!0},],[a.window.document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1},],[d,"keyup",void 0],[d,"wheel",{passive:!1},],[d,"contextmenu",void 0],[a.window,"blur",void 0],],this._listeners))f.addEventListener(g,f===a.window.document?this.handleWindowEvent:this.handleEvent,h)}destroy(){for(const[b,c,d]of this._listeners)b.removeEventListener(c,b===a.window.document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(a){const b=this._map,c=b.getCanvasContainer();this._add("mapEvent",new cB(b,a));const d=b.boxZoom=new cD(b,a);this._add("boxZoom",d);const f=new cG,g=new c$;b.doubleClickZoom=new cZ(g,f),this._add("tapZoom",f),this._add("clickZoom",g);const h=new c_;this._add("tapDragZoom",h);const i=b.touchPitch=new cU(b);this._add("touchPitch",i);const j=new cK(a),k=new cL(a);b.dragRotate=new c1(a,j,k),this._add("mouseRotate",j,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);const l=new cJ(a),m=new cM(b,a);b.dragPan=new c0(c,l,m),this._add("mousePan",l),this._add("touchPan",m,["touchZoom","touchRotate",]);const n=new cS,o=new cQ;b.touchZoomRotate=new c2(c,o,n,h),this._add("touchRotate",n,["touchPan","touchZoom",]),this._add("touchZoom",o,["touchPan","touchRotate",]),this._add("blockableMapEvent",new cC(b));const p=b.scrollZoom=new cY(b,this);this._add("scrollZoom",p,["mousePan"]);const q=b.keyboard=new cV;for(const r of(this._add("keyboard",q),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))a.interactive&&a[r]&&b[r].enable(a[r])}_add(a,b,c){this._handlers.push({handlerName:a,handler:b,allowed:c}),this._handlersById[a]=b}stop(a){if(!this._updatingCamera){for(const{handler:b}of this._handlers)b.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(c3(this._eventsInProgress))||this.isZooming()}_blockedByActive(a,b,c){for(const d in a)if(d!==c&&(!b||0>b.indexOf(d)))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(a){const b=[];for(const c of a)this._el.contains(c.target)&&b.push(c);return b}handleEvent(a,b){this._updatingCamera=!0;const c="renderFrame"===a.type,d=c?void 0:a,f={needsRenderFrame:!1},g={},i={},j=a.touches?this._getMapTouches(a.touches):void 0,k=j?h.touchPos(this._el,j):c?void 0:h.mousePos(this._el,a);for(const{handlerName:l,handler:m,allowed:n}of this._handlers){if(!m.isEnabled())continue;let o;this._blockedByActive(i,n,l)?m.reset():m[b||a.type]&&(o=m[b||a.type](a,k,j),this.mergeHandlerResult(f,g,o,l,d),o&&o.needsRenderFrame&&this._triggerRenderFrame()),(o||m.isActive())&&(i[l]=m)}const p={};for(const q in this._previousActiveHandlers)i[q]||(p[q]=d);this._previousActiveHandlers=i,(Object.keys(p).length||c5(f))&&(this._changes.push([f,g,p]),this._triggerRenderFrame()),(Object.keys(i).length||c5(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:r}=f;r&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],r(this._map))}mergeHandlerResult(b,c,d,f,g){if(!d)return;a.extend(b,d);const h={handlerName:f,originalEvent:d.originalEvent||g};void 0!==d.zoomDelta&&(c.zoom=h),void 0!==d.panDelta&&(c.drag=h),void 0!==d.pitchDelta&&(c.pitch=h),void 0!==d.bearingDelta&&(c.rotate=h)}_applyChanges(){const b={},c={},d={};for(const[f,g,h]of this._changes)f.panDelta&&(b.panDelta=(b.panDelta||new a.pointGeometry(0,0))._add(f.panDelta)),f.zoomDelta&&(b.zoomDelta=(b.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(b.bearingDelta=(b.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(b.pitchDelta=(b.pitchDelta||0)+f.pitchDelta),void 0!==f.around&&(b.around=f.around),void 0!==f.aroundCoord&&(b.aroundCoord=f.aroundCoord),void 0!==f.pinchAround&&(b.pinchAround=f.pinchAround),f.noInertia&&(b.noInertia=f.noInertia),a.extend(c,g),a.extend(d,h);this._updateMapTransform(b,c,d),this._changes=[]}_updateMapTransform(b,c,d){const f=this._map,g=f.transform,h=a=>[a.x,a.y,a.z];if((a=>{const b=this._eventsInProgress.drag;return b&&!this._handlersById[b.handlerName].isActive()})()&&!c5(b)){const i=g.zoom;g.cameraElevationReference="sea",g.recenterOnTerrain(),g.cameraElevationReference="ground",i!==g.zoom&&this._map._update(!0)}if(!c5(b))return this._fireEvents(c,d,!0);let{panDelta:j,zoomDelta:k,bearingDelta:l,pitchDelta:m,around:n,aroundCoord:o,pinchAround:p}=b;void 0!==p&&(n=p),c.drag&&!this._eventsInProgress.drag&&n&&(this._dragOrigin=h(g.pointCoordinate3D(n)),this._trackingEllipsoid.setup(g._camera.position,this._dragOrigin)),g.cameraElevationReference="sea",f._stop(!0),n=n||f.transform.centerPoint,l&&(g.bearing+=l),m&&(g.pitch+=m),g._updateCameraState();const q=[0,0,0];if(j){const r=g.pointCoordinate(n),s=g.pointCoordinate(n.sub(j));r&&s&&(q[0]=s.x-r.x,q[1]=s.y-r.y)}const u=g.zoom,v=[0,0,0];if(k){const w=h(o||g.pointCoordinate3D(n)),x={dir:a.normalize([],a.sub([],w,g._camera.position))};if(x.dir[2]<0){const y=g.zoomDeltaToMovement(w,k);a.scale$2(v,x.dir,y)}}const z=a.add(q,q,v);g._translateCameraConstrained(z),k&&Math.abs(g.zoom-u)>1e-4&&g.recenterOnTerrain(),g.cameraElevationReference="ground",this._map._update(),b.noInertia||this._inertia.record(b),this._fireEvents(c,d,!0)}_fireEvents(b,c,d){const f=c3(this._eventsInProgress),g=c3(b),h={};for(const i in b){const{originalEvent:j}=b[i];this._eventsInProgress[i]||(h[`${i}start`]=j),this._eventsInProgress[i]=b[i]}for(const k in!f&&g&&this._fireEvent("movestart",g.originalEvent),h)this._fireEvent(k,h[k]);for(const l in g&&this._fireEvent("move",g.originalEvent),b){const{originalEvent:m}=b[l];this._fireEvent(l,m)}const n={};let o;for(const p in this._eventsInProgress){const{handlerName:q,originalEvent:r}=this._eventsInProgress[p];this._handlersById[q].isActive()||(delete this._eventsInProgress[p],o=c[q]||r,n[`${p}end`]=o)}for(const s in n)this._fireEvent(s,n[s]);const u=c3(this._eventsInProgress);if(d&&(f||g)&&!u){this._updatingCamera=!0;const v=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=a=>0!==a&& -this._bearingSnap{delete this._frameId,this.handleEvent(new c4("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}(this,b),this._localFontFamily=b.localFontFamily,this._localIdeographFontFamily=b.localIdeographFontFamily,b.style&&this.setStyle(b.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),b.projection&&this.setProjection(b.projection),this._hash=b.hash&&new class{constructor(b){this._hashName=b&&encodeURIComponent(b),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=cq(this._updateHashUnthrottled.bind(this),300)}addTo(b){return this._map=b,a.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return a.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(b){const c=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,f=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,f),h=Math.round(c.lng*g)/g,i=Math.round(c.lat*g)/g,j=this._map.getBearing(),k=this._map.getPitch();let l="";if(l+=b?`/${h}/${i}/${d}`:`${d}/${i}/${h}`,(j||k)&&(l+="/"+Math.round(10*j)/10),k&&(l+=`/${Math.round(k)}`),this._hashName){const m=this._hashName;let n=!1;const o=a.window.location.hash.slice(1).split("&").map(a=>{const b=a.split("=")[0];return b===m?(n=!0,`${b}=${l}`):a}).filter(a=>a);return n||o.push(`${m}=${l}`),`#${o.join("&")}`}return`#${l}`}_getCurrentHash(){const b=a.window.location.hash.replace("#","");if(this._hashName){let c;return b.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(c=a)}),(c&&c[1]||"").split("/")}return b.split("/")}_onHashChange(){const a=this._getCurrentHash();if(a.length>=3&&!a.some(a=>isNaN(a))){const b=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:b,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){const b=a.window.location.href.replace(/(#.+)?$/,this.getHashString());a.window.history.replaceState(a.window.history.state,null,b)}}("string"==typeof b.hash&&b.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch}),b.bounds&&(this.resize(),this.fitBounds(b.bounds,a.extend({},b.fitBoundsOptions,{duration:0})))),this.resize(),b.attributionControl&&this.addControl(new c8({customAttribution:b.customAttribution})),this._logoControl=new c9,this.addControl(this._logoControl,b.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",b=>{this._update("style"===b.dataType),this.fire(new a.Event(`${b.dataType}data`,b))}),this.on("dataloading",b=>{this.fire(new a.Event(`${b.dataType}dataloading`,b))})}_getMapId(){return this._mapId}addControl(b,c){if(void 0===c&&(c=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=b.onAdd(this);this._controls.push(b);const f=this._controlPositions[c];return -1!==c.indexOf("bottom")?f.insertBefore(d,f.firstChild):f.appendChild(d),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const c=this._controls.indexOf(b);return c> -1&&this._controls.splice(c,1),b.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)> -1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(b){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 c=!this._moving;return c&&this.fire(new a.Event("movestart",b)).fire(new a.Event("move",b)),this.fire(new a.Event("resize",b)),c&&this.fire(new a.Event("moveend",b)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(b){return this.transform.setMaxBounds(a.LngLatBounds.convert(b)),this._update()}setMinZoom(b){if((b=null==b?-2:b)>= -2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b?this.setZoom(b):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=null==b?0:b)<0)throw Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b?this.setPitch(b):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}getProjection(){return this.transform.getProjection()}setProjection(a){return this._lazyInitEmptyStyle(),"string"==typeof a&&(a={name:a}),this._runtimeProjection=a,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(b){return this.transform.locationPoint3D(a.LngLat.convert(b))}unproject(b){return this.transform.pointLocation3D(a.pointGeometry.convert(b))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(a,b,c){if("mouseenter"===a||"mouseover"===a){let d=!1;const f=f=>{const g=b.filter(a=>this.getLayer(a)),h=g.length?this.queryRenderedFeatures(f.point,{layers:g}):[];h.length?d||(d=!0,c.call(this,new cy(a,this,f.originalEvent,{features:h}))):d=!1},g=()=>{d=!1};return{layers:new Set(b),listener:c,delegates:{mousemove:f,mouseout:g}}}if("mouseleave"===a||"mouseout"===a){let h=!1;const i=d=>{const f=b.filter(a=>this.getLayer(a));(f.length?this.queryRenderedFeatures(d.point,{layers:f}):[]).length?h=!0:h&&(h=!1,c.call(this,new cy(a,this,d.originalEvent)))},j=b=>{h&&(h=!1,c.call(this,new cy(a,this,b.originalEvent)))};return{layers:new Set(b),listener:c,delegates:{mousemove:i,mouseout:j}}}{const k=a=>{const d=b.filter(a=>this.getLayer(a)),f=d.length?this.queryRenderedFeatures(a.point,{layers:d}):[];f.length&&(a.features=f,c.call(this,a),delete a.features)};return{layers:new Set(b),listener:c,delegates:{[a]:k}}}}on(a,b,c){if(void 0===c)return super.on(a,b);Array.isArray(b)||(b=[b]);const d=this._createDelegatedListener(a,b,c);for(const f in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(d),d.delegates)this.on(f,d.delegates[f]);return this}once(a,b,c){if(void 0===c)return super.once(a,b);Array.isArray(b)||(b=[b]);const d=this._createDelegatedListener(a,b,c);for(const f in d.delegates)this.once(f,d.delegates[f]);return this}off(a,b,c){if(void 0===c)return super.off(a,b);b=new Set(Array.isArray(b)?b:[b]);const d=(a,b)=>{if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0},f=this._delegatedListeners?this._delegatedListeners[a]:void 0;return f&&(a=>{for(let f=0;f{b?this.fire(new a.ErrorEvent(b)):d&&this._updateDiff(d,c)})}else"object"==typeof b&&this._updateDiff(b,c)}_updateDiff(b,c){try{this.style.setState(b)&&this._update(!0)}catch(d){a.warnOnce(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(b,c)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(a,b){return this._lazyInitEmptyStyle(),this.style.addSource(a,b),this._update(!0)}isSourceLoaded(b){const c=this.style&&this.style._getSourceCaches(b);if(0!==c.length)return c.every(a=>a.loaded());this.fire(new a.ErrorEvent(Error(`There is no source with ID '${b}'`)))}areTilesLoaded(){const a=this.style&&this.style._sourceCaches;for(const b in a){const c=a[b]._tiles;for(const d in c){const f=c[d];if("loaded"!==f.state&&"errored"!==f.state)return!1}}return!0}addSourceType(a,b,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,b,c)}removeSource(a){return this.style.removeSource(a),this._updateTerrain(),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(b,c,{pixelRatio:d=1,sdf:f=!1,stretchX:g,stretchY:h,content:i}={}){if(this._lazyInitEmptyStyle(),c instanceof de||dg&&c instanceof dg){const{width:j,height:k,data:l}=a.exported.getImageData(c);this.style.addImage(b,{data:new a.RGBAImage({width:j,height:k},l),pixelRatio:d,stretchX:g,stretchY:h,content:i,sdf:f,version:0})}else{if(void 0===c.width|| void 0===c.height)return this.fire(new a.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:m,height:n,data:o}=c,p=c;this.style.addImage(b,{data:new a.RGBAImage({width:m,height:n},new Uint8Array(o)),pixelRatio:d,stretchX:g,stretchY:h,content:i,sdf:f,version:0,userImage:p}),p.onAdd&&p.onAdd(this,b)}}}updateImage(b,c){const d=this.style.getImage(b);if(!d)return this.fire(new a.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const f=c instanceof de||dg&&c instanceof dg?a.exported.getImageData(c):c,{width:g,height:h,data:i}=f;return void 0===g|| void 0===h?this.fire(new a.ErrorEvent(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`"))):g!==d.data.width||h!==d.data.height?this.fire(new a.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(d.data.replace(i,!(c instanceof de||dg&&c instanceof dg)),void this.style.updateImage(b,d))}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new a.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(b,c){a.getImage(this._requestManager.transformRequest(b,a.ResourceType.Image),(b,d)=>{c(b,d instanceof de?a.exported.getImageData(d):d)})}listImages(){return this.style.listImages()}addLayer(a,b){return this._lazyInitEmptyStyle(),this.style.addLayer(a,b),this._update(!0)}moveLayer(a,b){return this.style.moveLayer(a,b),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,b,c){return this.style.setLayerZoomRange(a,b,c),this._update(!0)}setFilter(a,b,c={}){return this.style.setFilter(a,b,c),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,b,c,d={}){return this.style.setPaintProperty(a,b,c,d),this._update(!0)}getPaintProperty(a,b){return this.style.getPaintProperty(a,b)}setLayoutProperty(a,b,c,d={}){return this.style.setLayoutProperty(a,b,c,d),this._update(!0)}getLayoutProperty(a,b){return this.style.getLayoutProperty(a,b)}setLight(a,b={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,b),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(b){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.LngLat.convert(b),this.transform):0}setFeatureState(a,b){return this.style.setFeatureState(a,b),this._update()}removeFeatureState(a,b){return this.style.removeFeatureState(a,b),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}_updateContainerDimensions(){if(!this._container)return;const b=this._container.getBoundingClientRect().width||400,c=this._container.getBoundingClientRect().height||300;let d,f=this._container;for(;f&&!d;){const g=a.window.getComputedStyle(f).transform;g&&"none"!==g&&(d=g.match(/matrix.*\((.+)\)/)[1].split(", ")),f=f.parentElement}d?(this._containerWidth=d[0]&&"0"!==d[0]?Math.abs(b/d[0]):b,this._containerHeight=d[3]&&"0"!==d[3]?Math.abs(c/d[3]):c):(this._containerWidth=b,this._containerHeight=c)}_detectMissingCSS(){"rgb(250, 128, 114)"!==a.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&a.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 a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=h.create("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const b=this._canvasContainer=h.create("div","mapboxgl-canvas-container",a);this._interactive&&b.classList.add("mapboxgl-interactive"),this._canvas=h.create("canvas","mapboxgl-canvas",b),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const c=this._controlContainer=h.create("div","mapboxgl-control-container",a),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(a=>{d[a]=h.create("div",`mapboxgl-ctrl-${a}`,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,c){const d=a.exported.devicePixelRatio||1;this._canvas.width=d*Math.ceil(b),this._canvas.height=d*Math.ceil(c),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${c}px`}_addMarker(a){this._markers.push(a)}_removeMarker(a){const b=this._markers.indexOf(a);-1!==b&&this._markers.splice(b,1)}_setupPainter(){const c=a.extend({},b.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl",c)||this._canvas.getContext("experimental-webgl",c);d?(a.storeAuthState(d,!0),this.painter=new cb(d,this.transform),this.on("data",a=>{"source"===a.dataType&&this.painter.setTileLoadedFlag(!0)}),a.exported$1.testSupport(d)):this.fire(new a.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:b}))}_contextRestored(b){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:b}))}_onMapScroll(a){if(a.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(a){return this.style&&(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(b){let c;const d=this.painter.context.extTimerQuery,f=a.exported.now();this.listens("gpu-timing-frame")&&(c=d.createQueryEXT(),d.beginQueryEXT(d.TIME_ELAPSED_EXT,c));let g=this._updateAverageElevation(f);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(b),this._domRenderTaskQueue.run(b),this._removed)return;this._updateProjection();let h=!1;const i=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,k=this.transform.pitch,l=a.exported.now();this.style.zoomHistory.update(j,l);const m=new a.EvaluationParameters(j,{now:l,fadeDuration:i,pitch:k,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=m.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(m)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,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:i,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const o=a.exported.now()-f;d.endQueryEXT(d.TIME_ELAPSED_EXT,c),setTimeout(()=>{const b=d.getQueryObjectEXT(c,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(c),this.fire(new a.Event("gpu-timing-frame",{cpuTime:o,gpuTime:b}))},50)}if(this.listens("gpu-timing-layer")){const p=this.painter.collectGpuTimers();setTimeout(()=>{const b=this.painter.queryGpuTimers(p);this.fire(new a.Event("gpu-timing-layer",{layerTimes:b}))},50)}const q=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(q||this._repaint)this.triggerRepaint();else{const r=!this.isMoving()&&this.loaded();if(r&&(g=this._updateAverageElevation(f,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),r&&(this.fire(new a.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const s=this._calculateSpeedIndex();this.fire(new a.Event("speedindexcompleted",{speedIndex:s})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||q||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const a of this._markers)a._update()}_updateAverageElevation(a,b=!1){const c=a=>(this.transform.averageElevation=a,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&c(0);if((b||a-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(a)){const d=this.transform.averageElevation;let f=this.transform.sampleAverageElevation();isNaN(f)?f=0:this._averageElevationLastSampledAt=a;const g=Math.abs(d-f);if(g>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(f),c(f);this._averageElevation.easeTo(f,a,300)}else if(g>1e-4)return this._averageElevation.jumpTo(f),c(f)}return!!this._averageElevation.isEasing(a)&&c(this._averageElevation.getValue(a))}_authenticate(){a.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,b=>{if(b&&(b.message===a.AUTH_ERR_MSG||401===b.status)){const c=this.painter.context.gl;a.storeAuthState(c,!1),this._logoControl instanceof c9&&this._logoControl._updateLogo(),c&&c.clear(c.DEPTH_BUFFER_BIT|c.COLOR_BUFFER_BIT|c.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.ErrorEvent(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/")))}}),a.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const a=this.painter.canvasCopy(),b=this.painter.getCanvasCopiesAndTimestamps();b.timeStamps.push(performance.now());const c=this.painter.context.gl,d=c.createFramebuffer();function f(a){c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a,0);const b=new Uint8Array(c.drawingBufferWidth*c.drawingBufferHeight*4);return c.readPixels(0,0,c.drawingBufferWidth,c.drawingBufferHeight,c.RGBA,c.UNSIGNED_BYTE,b),b}return c.bindFramebuffer(c.FRAMEBUFFER,d),this._canvasPixelComparison(f(a),b.canvasCopies.map(f),b.timeStamps)}_canvasPixelComparison(a,b,c){let d=c[1]-c[0];const f=a.length/4;for(let g=0;g{const b=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,b&&this._render(a)}))}_preloadTiles(b){const c=this.style&&Object.values(this.style._sourceCaches)||[];return a.asyncAll(c,(a,c)=>a._preloadTiles(b,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(b,c){a.setCacheLimits(b,c)}get version(){return a.version}},NavigationControl:class{constructor(b){this.options=a.extend({},{showCompass:!0,showZoom:!0,visualizePitch:!1},b),this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),h.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),h.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=h.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const a=this._map.getZoom(),b=a===this._map.getMaxZoom(),c=a===this._map.getMinZoom();this._zoomInButton.disabled=b,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",b.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new di(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(a,b){const c=h.create("button",a,this._container);return c.type="button",c.addEventListener("click",b),c}_setButtonTitle(a,b){const c=this._map._getUIString(`NavigationControl.${b}`);a.setAttribute("aria-label",c),a.firstElementChild&&a.firstElementChild.setAttribute("title",c)}},GeolocateControl:class extends a.Evented{constructor(b){super(),this.options=a.extend({},{positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},b),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=cq(this._updateMarkerRotation,20)}onAdd(b){var c;return this._map=b,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),c=this._setupUI,void 0!==dj?c(dj):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(dj="denied"!==a.state)}):c(dj=!!a.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,dk=0,dl=!1}_isOutOfMapMaxBounds(a){const b=this._map.getMaxBounds(),c=a.coords;return b&&(c.longitudeb.getEast()||c.latitudeb.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(b){if(this._map){if(this._isOutOfMapMaxBounds(b))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",b)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=b,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(b),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(b),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",b)),this._finish()}}_updateCamera(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude),d=b.coords.accuracy,f=this._map.getBearing(),g=a.extend({bearing:f},this.options.fitBoundsOptions);this._map.fitBounds(c.toBounds(d),g,{geolocateSource:!0})}_updateMarker(b){if(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=b.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._containerHeight/2,b=this._map.unproject([0,a]),c=this._map.unproject([100,a]),d=b.distanceTo(c)/100,f=Math.ceil(2*this._accuracy/d);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}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(b){if(this._map){if(this.options.trackUserLocation){if(1===b.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 c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===b.code&&dl)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",b)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(b){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=h.create("button","mapboxgl-ctrl-geolocate",this._container),h.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===b){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=h.create("div","mapboxgl-user-location"),this._dotElement.appendChild(h.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(h.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new dd({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=h.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new dd({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",b=>{b.geolocateSource||"ACTIVE_LOCK"!==this._watchState||b.originalEvent&&"resize"===b.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:!0===a.absolute&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":dk--,dl=!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 a.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 a.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 b;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++dk>1?(b={maximumAge:6e5,timeout:0},dl=!0):(b=this.options.positionOptions,dl=!1),this._geolocationWatchID=a.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else a.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const b=()=>{a.window.addEventListener("ondeviceorientationabsolute"in a.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==a.window.DeviceMotionEvent&&"function"==typeof a.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(a=>{"granted"===a&&b()}).catch(console.error):b()}_clearWatch(){a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),a.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),a.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),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:c8,ScaleControl:class{constructor(b){this.options=a.extend({},{maxWidth:100,unit:"metric"},b),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dm(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,dm(this._map,this._container,this.options)}},FullscreenControl:class{constructor(b){this._fullscreen=!1,b&&b.container&&(b.container instanceof a.window.HTMLElement?this._container=b.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in a.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in a.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(b){return this._map=b,this._container||(this._container=this._map.getContainer()),this._controlContainer=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,a.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!a.window.document.fullscreenEnabled&&!a.window.document.webkitFullscreenEnabled)}_setupUI(){const b=this._fullscreenButton=h.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);h.create("span","mapboxgl-ctrl-icon",b).setAttribute("aria-hidden",!0),b.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(a.window.document.fullscreenElement||a.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()?a.window.document.exitFullscreen?a.window.document.exitFullscreen():a.window.document.webkitCancelFullScreen&&a.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(b){super(),this.options=a.extend(Object.create({closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}),b),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(b&&b.className?b.className.trim().split(/\s+/):[])}addTo(b){return this._map&&this.remove(),this._map=b,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(b){return this.setDOMContent(a.window.document.createTextNode(b))}setHTML(b){const c=a.window.document.createDocumentFragment(),d=a.window.document.createElement("body");let f;for(d.innerHTML=b;f=d.firstChild;)c.appendChild(f);return this.setDOMContent(c)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=h.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._container&&this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._container&&this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){let b;return this._classList.delete(a)?b=!1:(this._classList.add(a),b=!0),this._container&&this._updateClassList(),b}_createCloseButton(){this.options.closeButton&&(this._closeButton=h.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_getAnchor(a){if(this.options.anchor)return this.options.anchor;const b=this._pos,c=this._container.offsetWidth,d=this._container.offsetHeight;let f;return f=b.y+a.bottom.ythis._map.transform.height-d?["bottom"]:[],b.xthis._map.transform.width-c/2&&f.push("right"),0===f.length?"bottom":f.join("-")}_updateClassList(){const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),this._container.className=a.join(" ")}_update(b){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=h.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=h.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=db(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||b){const c=this._pos=this._trackPointer&&b?b:this._map.project(this._lngLat),d=function(b){if(b||(b=new a.pointGeometry(0,0)),"number"==typeof b){const c=Math.round(Math.sqrt(.5*Math.pow(b,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,b),"top-left":new a.pointGeometry(c,c),"top-right":new a.pointGeometry(-c,c),bottom:new a.pointGeometry(0,-b),"bottom-left":new a.pointGeometry(c,-c),"bottom-right":new a.pointGeometry(-c,-c),left:new a.pointGeometry(b,0),right:new a.pointGeometry(-b,0)}}if(b instanceof a.pointGeometry||Array.isArray(b)){const d=a.pointGeometry.convert(b);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:a.pointGeometry.convert(b.center||[0,0,]),top:a.pointGeometry.convert(b.top||[0,0]),"top-left":a.pointGeometry.convert(b["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(b["top-right"]||[0,0]),bottom:a.pointGeometry.convert(b.bottom||[0,0,]),"bottom-left":a.pointGeometry.convert(b["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(b["bottom-right"]||[0,0]),left:a.pointGeometry.convert(b.left||[0,0]),right:a.pointGeometry.convert(b.right||[0,0,])}}(this.options.offset),f=this._anchor=this._getAnchor(d),g=c.add(d[f]).round();this._map._requestDomTask(()=>{this._container&&f&&(this._container.style.transform=`${dc[f]} translate(${g.x}px,${g.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._content&&(this._content.style.opacity=a),this._tip&&(this._tip.style.opacity=a)}},Marker:dd,Style:aY,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,FreeCameraOptions:ch,Evented:a.Evented,config:a.config,prewarm:function(){ab().acquire($)},clearPrewarmedResources:function(){const a=aa;a&&(a.isPreloaded()&&1===a.numActive()?(a.release($),aa=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 a.config.ACCESS_TOKEN},set accessToken(t){a.config.ACCESS_TOKEN=t},get baseApiUrl(){return a.config.API_URL},set baseApiUrl(t){a.config.API_URL=t},get workerCount(){return _.workerCount},set workerCount(e){_.workerCount=e},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){a.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(b){a.clearTileCache(b)},workerUrl:"",workerClass:null,setNow:a.exported.setNow,restoreNow:a.exported.restoreNow};return dp}),c})}},]) + with id '${b.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(a){a.coord&&"source"===a.dataType?this._clearRenderCacheForTile(a.sourceCacheId,a.coord):"style"===a.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const a in this._style._sourceCaches)this._style._sourceCaches[a].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(a=>a.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture)}_source(){return this.enabled?this.sourceCache:null}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const a=2*this.proxySourceCache.getSource().tileSize;return[a,a]}set useVertexMorphing(a){this._useVertexMorphing=a}updateTileBinding(b){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const c=this.proxySourceCache,d=this.painter.transform;this._initializing&&(this._initializing=0===d._centerAltitude&& -1===this.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(d.center),-1),this._emptyDEMTextureDirty=!this._initializing);const f=this.proxyCoords=c.getIds().map(a=>{const b=c.getTileByID(a).tileID;return b.projMatrix=d.calculateProjMatrix(b.toUnwrapped()),b});(function(b,c){const d=c.transform.pointCoordinate(c.transform.getCameraPoint()),f=new a.pointGeometry(d.x,d.y);b.sort((b,c)=>{if(c.overscaledZ-b.overscaledZ)return c.overscaledZ-b.overscaledZ;const d=new a.pointGeometry(b.canonical.x+(1<{this.proxyToSource[a.key]={}}),this.terrainTileForTile={};const h=this._style._sourceCaches;for(const i in h){const j=h[i];if(!j.used||(j!==this.sourceCache&&this.resetTileLookupCache(j.id),this._setupProxiedCoordsForOrtho(j,b[i],g),j.usedForTerrain))continue;const k=b[i];j.getSource().reparseOverscaled&&this._assignTerrainTiles(k)}this.proxiedCoords[c.id]=f.map(a=>new bi(a,a.key,this.orthoMatrix)),this._assignTerrainTiles(f),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(g),this.renderingToTexture=!1,this._updateTimestamp=a.exported.now();const l={};for(const m of(this._visibleDemTiles=[],this.proxyCoords)){const n=this.terrainTileForTile[m.key];if(!n)continue;const o=n.tileID.key;o in l||(this._visibleDemTiles.push(n),l[o]=o)}}_assignTerrainTiles(a){this._initializing||a.forEach(a=>{if(this.terrainTileForTile[a.key])return;const b=this._findTileCoveringTileID(a,this.sourceCache);b&&(this.terrainTileForTile[a.key]=b)})}_prepareDEMTextures(){const a=this.painter.context,b=a.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],f=d.dem;f&&(!d.demTexture||d.needsDEMTextureUpload)&&(a.activeTexture.set(b.TEXTURE1),a5(this.painter,d,f))}}_prepareDemTileUniforms(a,b,c,d){if(!b||null==b.demTexture)return!1;const f=a.tileID.canonical,g=Math.pow(2,b.tileID.canonical.z-f.z),h=d||"";return c[`u_dem_tl${h}`]=[f.x*g%1,f.y*g%1,],c[`u_dem_scale${h}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const b=this.painter.context,c=b.gl;if(!this._emptyDepthBufferTexture){const d={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new a.Texture(b,d,c.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let a=0;const b=this._visibleDemTiles.reduce((b,c)=>{if(!c.dem)return b;const d=c.dem.tree.minimums[0];return d>0&&a++,b+d},0);return a?b/a:0}_updateEmptyDEMTexture(){const b=this.painter.context,c=b.gl;b.activeTexture.set(c.TEXTURE2);const d=this._getLoadedAreaMinimum(),f={width:1,height:1,data:new Uint8Array(a.DEMData.pack(d,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(f,{premultiply:!1}):g=this._emptyDEMTexture=new a.Texture(b,f,c.RGBA,{premultiply:!1}),g}setupElevationDraw(b,c,d){var f;const g=this.painter.context,h=g.gl,i=(f=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:a.DEMData.getUnpackVector(f),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});i.u_dem_size=this.sourceCache.getSource().tileSize,i.u_exaggeration=this.exaggeration();const j=this.painter.transform,k=j.projection.createTileTransform(j,j.worldSize),l=b.tileID.canonical;i.u_tile_tl_up=k.upVector(l,0,0),i.u_tile_tr_up=k.upVector(l,a.EXTENT,0),i.u_tile_br_up=k.upVector(l,a.EXTENT,a.EXTENT),i.u_tile_bl_up=k.upVector(l,0,a.EXTENT),i.u_tile_up_scale=k.upVectorScale(l);let m=null,n=null,o=1;if(d&&d.morphing&&this._useVertexMorphing){const p=d.morphing.srcDemTile,q=d.morphing.dstDemTile;o=d.morphing.phase,p&&q&&(this._prepareDemTileUniforms(b,p,i,"_prev")&&(n=p),this._prepareDemTileUniforms(b,q,i)&&(m=q))}if(n&&m?(g.activeTexture.set(h.TEXTURE2),m.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE,h.NEAREST),g.activeTexture.set(h.TEXTURE4),n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE,h.NEAREST),i.u_dem_lerp=o):(m=this.terrainTileForTile[b.tileID.key],g.activeTexture.set(h.TEXTURE2),(this._prepareDemTileUniforms(b,m,i)?m.demTexture:this.emptyDEMTexture).bind(h.NEAREST,h.CLAMP_TO_EDGE)),g.activeTexture.set(h.TEXTURE3),d&&d.useDepthForOcclusion?(this._depthTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.u_depth_size_inv=[1,1]),d&&d.useMeterToDem&&m){const r=(1<{if(k===a)return;const d=[];c&&d.push(bc[l]),d.push(bc[a]),d.push("PROJECTION_GLOBE_VIEW"),j=b.useProgram("globeRaster",null,d),k=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(i.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bb.update(g);const p=b.transform,q=a.calculateGlobeMatrix(p,p.worldSize),r=a.calculateGlobeMercatorMatrix(p),s=[a.mercatorXfromLng(p.center.lng),a.mercatorYfromLat(p.center.lat),],u=b.globeSharedBuffers;(l?[!1,!0]:[!1]).forEach(l=>{k=-1;const v=l?i.LINES:i.TRIANGLES;for(const w of f){const x=d.getTile(w),y=Math.pow(2,w.canonical.z),[z,A]=a.globeBuffersForTileMesh(b,x,w,y),B=a.StencilMode.disabled,C=c.prevTerrainTileForTile[w.key],D=c.terrainTileForTile[w.key];ba(C,D)&&bb.newMorphing(w.key,C,D,g,250),h.activeTexture.set(i.TEXTURE0),x.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const E=bb.getMorphValuesForProxy(w.key),F=E?1:0,G={};E&&a.extend$1(G,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:a.easeCubicInOut(E.phase)}});const H=a.globeMatrixForTile(w.canonical,q),I=a9(p.projMatrix,H,r,a.globeToMercatorTransition(p.zoom),s);if(m(F,l),c.setupElevationDraw(x,j,G),b.prepareDrawProgram(h,j,w.toUnwrapped()),u){const[J,K]=l?u.getWirefameBuffer(b.context):[u.gridIndexBuffer,u.gridSegments,];j.draw(h,v,o,B,n,a.CullFaceMode.backCCW,I,"globe_raster",z,J,K)}if(!l){const L=[0===w.canonical.y?a.globePoleMatrixForTile(w.canonical,!1,p):null,w.canonical.y===y-1?a.globePoleMatrixForTile(w.canonical,!0,p):null,];for(const M of L){if(!M)continue;const N=a9(p.projMatrix,M,M,0,s);u&&j.draw(h,v,o,B,n,a.CullFaceMode.disabled,N,"globe_pole_raster",A,u.poleIndexBuffer,u.poleSegments)}}}})}(b,c,d,f,g);else{const h=b.context,i=h.gl;let j,k;const l=b.options.showTerrainWireframe?2:0,m=(a,c)=>{if(k===a)return;const d=[bc[a]];c&&d.push(bc[l]),j=b.useProgram("terrainRaster",null,d),k=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(i.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bb.update(g);const p=b.transform,q=6*Math.pow(1.5,22-p.zoom)*c.exaggeration();(l?[!1,!0]:[!1]).forEach(l=>{k=-1;const r=l?i.LINES:i.TRIANGLES,[s,u]=l?c.getWirefameBuffer():[c.gridIndexBuffer,c.gridSegments,];for(const v of f){const w=d.getTile(v),x=a.StencilMode.disabled,y=c.prevTerrainTileForTile[v.key],z=c.terrainTileForTile[v.key];ba(y,z)&&bb.newMorphing(v.key,y,z,g,250),h.activeTexture.set(i.TEXTURE0),w.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST);const A=bb.getMorphValuesForProxy(v.key),B=A?1:0;let C;A&&(C={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:a.easeCubicInOut(A.phase)}});const D=a8(v.projMatrix,bd(v.canonical,p.renderWorldCopies)?q/10:q);m(B,l),c.setupElevationDraw(w,j,C),b.prepareDrawProgram(h,j,v.toUnwrapped()),j.draw(h,r,o,x,n,a.CullFaceMode.backCCW,D,"terrain_raster",c.gridBuffer,s,u)}})}}(c,this,this.proxySourceCache,b,this._updateTimestamp),this.renderingToTexture=!0,b.splice(0,b.length))}renderBatch(b){if(0===this._drapedRenderBatches.length)return b+1;this.renderingToTexture=!0;const c=this.painter,d=this.painter.context,f=this.proxySourceCache,g=this.proxiedCoords[f.id],h=this._drapedRenderBatches.shift(),i=[],j=c.style.order;let k=0;for(const l of g){const m=f.getTileByID(l.proxyTileKey),n=f.proxyCachedFBO[l.key]?f.proxyCachedFBO[l.key][b]:void 0,o=void 0!==n?f.renderCache[n]:this.pool[k++],p=void 0!==n;if(m.texture=o.tex,p&&!o.dirty){i.push(m.tileID);continue}let q;d.bindFramebuffer.set(o.fb.framebuffer),this.renderedToTile=!1,o.dirty&&(d.clear({color:a.Color.transparent,stencil:0}),o.dirty=!1);for(let r=h.start;r<=h.end;++r){const s=c.style._layers[j[r]];if(s.isHidden(c.transform.zoom))continue;const u=c.style._getLayerSourceCache(s),v=u?this.proxyToSource[l.key][u.id]:[l];if(!v)continue;const w=v;d.viewport.set([0,0,o.fb.width,o.fb.height,]),q!==(u?u.id:null)&&(this._setupStencil(o,v,s,u),q=u?u.id:null),c.renderLayer(c,u,s,w)}this.renderedToTile?(o.dirty=!0,i.push(m.tileID)):p|| --k,5===k&&(k=0,this.renderToBackBuffer(i))}return this.renderToBackBuffer(i),this.renderingToTexture=!1,d.bindFramebuffer.set(null),d.viewport.set([0,0,c.width,c.height]),h.end+1}postRender(){}renderCacheEfficiency(a){const b=a.order.length;if(0===b)return{efficiency:100};let c,d=0,f=0,g=!1;for(let h=0;ha.dem).forEach(b=>{a=Math.min(a,b.dem.tree.minimums[0])}),0===a?a:(a-30)*this._exaggeration}raycast(a,b,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(a=>a.dem).map(d=>{const f=d.tileID,g=Math.pow(2,f.overscaledZ),{x:h,y:i}=f.canonical,j=h/g,k=(h+1)/g,l=i/g,m=(i+1)/g;return{minx:j,miny:l,maxx:k,maxy:m,t:d.dem.tree.raycastRoot(j,l,k,m,a,b,c),tile:d}});for(const f of(d.sort((a,b)=>(null!==a.t?a.t:Number.MAX_VALUE)-(null!==b.t?b.t:Number.MAX_VALUE)),d)){if(null==f.t)break;const g=f.tile.dem.tree.raycast(f.minx,f.miny,f.maxx,f.maxy,a,b,c);if(null!=g)return g}return null}_createFBO(){const b=this.painter.context,c=b.gl,d=this.drapeBufferSize;b.activeTexture.set(c.TEXTURE0);const f=new a.Texture(b,{width:d[0],height:d[1],data:null},c.RGBA);f.bind(c.LINEAR,c.CLAMP_TO_EDGE);const g=b.createFramebuffer(d[0],d[1],!1);return g.colorAttachment.set(f.texture),g.depthAttachment=new J(b,g.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=b.createRenderbuffer(b.gl.DEPTH_STENCIL,d[0],d[1]),this._stencilRef=0,g.depthAttachment.set(this._sharedDepthStencil),b.clear({stencil:0})):g.depthAttachment.set(this._sharedDepthStencil),b.extTextureFilterAnisotropic&&!b.extTextureFilterAnisotropicForceOff&&c.texParameterf(c.TEXTURE_2D,b.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,b.extTextureFilterAnisotropicMax),{fb:g,tex:f,dirty:!1}}_initFBOPool(){for(;this.pool.length{const b=this._style._layers[a],c=b.isHidden(this.painter.transform.zoom),d=b.getCrossfadeParameters(),f=!!d&&1!==d.t,g=b.hasTransition();return"custom"!==b.type&&!c&&(f||g)})}_clearRasterFadeFromRenderCache(){let a=!1;for(const b in this._style._sourceCaches)if(this._style._sourceCaches[b]._source instanceof O){a=!0;break}if(a)for(let c=0;cb.renderCachePool.length){const c=Object.values(b.proxyCachedFBO);b.proxyCachedFBO={};for(let d=0;d=0;i--){const j=g[i];if(b.getTileByID(j.key),void 0!==b.proxyCachedFBO[j.key]){const k=a[j.key],l=this.proxyToSource[j.key];let m=0;for(const n in l){const o=l[n],p=k[n];if(!p||p.length!==o.length||o.some((a,b)=>a!==p[b]||h[n]&&h[n].hasOwnProperty(a.key))){m=-1;break}++m}for(const q in b.proxyCachedFBO[j.key])b.renderCache[b.proxyCachedFBO[j.key][q]].dirty=m<0||m!==Object.values(k).length}}const r=[...this._drapedRenderBatches];for(const s of(r.sort((a,b)=>b.end-b.start-(a.end-a.start)),r))for(const u of g){if(b.proxyCachedFBO[u.key])continue;let v=b.renderCachePool.pop();void 0===v&&b.renderCache.length<50&&(v=b.renderCache.length,b.renderCache.push(this._createFBO())),void 0!==v&&(b.proxyCachedFBO[u.key]={},b.proxyCachedFBO[u.key][s.start]=v,b.renderCache[v].dirty=!0)}this._tilesDirty={}}_setupStencil(a,b,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const f=this.painter.context,g=f.gl;if(b.length<=1)return void(this._overlapStencilType=!1);let h;if(c.isTileClipped())h=b.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(b[0].overscaledZ>b[b.length-1].overscaledZ))return void(this._overlapStencilType=!1);h=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+h>255&&(f.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=h,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(b,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(b){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[b.key]),this._overlapStencilMode):a.StencilMode.disabled}_renderTileClippingMasks(b,c){const d=this.painter,f=this.painter.context,g=f.gl;d._tileClippingMaskIDs={},f.setColorMode(a.ColorMode.disabled),f.setDepthMode(a.DepthMode.disabled);const h=d.useProgram("clippingMask");for(const i of b){const j=d._tileClippingMaskIDs[i.key]=--c;h.draw(f,g.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:g.ALWAYS,mask:0},j,255,g.KEEP,g.KEEP,g.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,be(i.projMatrix),"$clipping",d.tileExtentBuffer,d.quadTriangleIndexBuffer,d.tileExtentSegments)}}pointCoordinate(b){const c=this.painter.transform;if(b.x<0||b.x>c.width||b.y<0||b.y>c.height)return null;const d=[b.x,b.y,1,1];a.transformMat4$1(d,d,c.pixelMatrixInverse),a.scale$1(d,d,1/d[3]),d[0]/=c.worldSize,d[1]/=c.worldSize;const f=c._camera.position,g=a.mercatorZfromAltitude(1,c.center.lat),h=[f[0],f[1],f[2]/g,0],i=a.subtract([],d.slice(0,3),h);a.normalize(i,i);const j=this.raycast(h,i,this._exaggeration);return null!==j&&j?(a.scaleAndAdd(h,h,i,j),h[3]=h[2],h[2]*=g,h):null}drawDepth(){const b=this.painter,c=b.context,d=this.proxySourceCache,f=Math.ceil(b.width),g=Math.ceil(b.height);if(this._depthFBO&&(this._depthFBO.width!==f||this._depthFBO.height!==g)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const h=c.gl,i=c.createFramebuffer(f,g,!0);c.activeTexture.set(h.TEXTURE0);const j=new a.Texture(c,{width:f,height:g,data:null},h.RGBA);j.bind(h.NEAREST,h.CLAMP_TO_EDGE),i.colorAttachment.set(j.texture);const k=c.createRenderbuffer(c.gl.DEPTH_COMPONENT16,f,g);i.depthAttachment.set(k),this._depthFBO=i,this._depthTexture=j}c.bindFramebuffer.set(this._depthFBO.framebuffer),c.viewport.set([0,0,f,g]),function(b,c,d,f){if("globe"===b.transform.projection.name)return;const g=b.context,h=g.gl;g.clear({depth:1});const i=b.useProgram("terrainDepth"),j=new a.DepthMode(h.LESS,a.DepthMode.ReadWrite,b.depthRangeFor3D);for(const k of f){const l=d.getTile(k),m=a8(k.projMatrix,0);c.setupElevationDraw(l,i),i.draw(g,h.TRIANGLES,j,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.backCCW,m,"terrain_depth",c.gridBuffer,c.gridIndexBuffer,c.gridNoSkirtSegments)}}(b,this,d,this.proxyCoords)}_setupProxiedCoordsForOrtho(a,b,c){if(a.getSource() instanceof R)return this._setupProxiedCoordsForImageSource(a,b,c);this._findCoveringTileCache[a.id]=this._findCoveringTileCache[a.id]||{};const d=this.proxiedCoords[a.id]=[],f=this.proxyCoords;for(let g=0;g(a.min.x=Math.min(a.min.x,b.x-i.x),a.min.y=Math.min(a.min.y,b.y-i.y),a.max.x=Math.max(a.max.x,b.x-i.x),a.max.y=Math.max(a.max.y,b.y-i.y),a),{min:new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),k=(b,c)=>{const d=b.wrap+b.canonical.x/(1<h+j.max.x||f+gi+j.max.y};for(let l=0;la.key===c.tileID.key);if(g)return g}if(c.tileID.key!==b.key){const h=b.canonical.z-c.tileID.canonical.z;let i,j,k;f=a.create();const l=c.tileID.wrap-b.wrap<0?(j=(i=a.EXTENT>>h)*((c.tileID.canonical.x<=l){const m=b.canonical.z-l;c.getSource().reparseOverscaled?(i=Math.max(b.canonical.z+2,c.transform.tileZoom),h=new a.OverscaledTileID(i,b.wrap,l,b.canonical.x>>m,b.canonical.y>>m)):0!==m&&(i=l,h=new a.OverscaledTileID(i,b.wrap,l,b.canonical.x>>m,b.canonical.y>>m))}h.key!==b.key&&(k.push(h.key),d=c.getTile(h))}const n=a=>{k.forEach(b=>{f[b]=a}),k.length=0};for(i-=1;i>=j&&(!d||!d.hasData());i--){d&&n(d.tileID.key);const o=h.calculateScaledKey(i);if((d=c.getTileByID(o))&&d.hasData())break;const p=f[o];if(null===p)break;void 0===p?k.push(o):d=c.getTileByID(p)}return n(d?d.tileID.key:null),d&&d.hasData()?d:null}findDEMTileFor(a){return this.enabled?this._findTileCoveringTileID(a,this.sourceCache):null}prepareDrawTile(a){this.renderedToTile=!0}_clearRenderCacheForTile(a,b){let c=this._tilesDirty[a];c||(c=this._tilesDirty[a]={}),c[b.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const b=function(b){let c,d,f;const g=new a.StructArrayLayout2ui4,h=131;for(d=1;d<129;d++){for(c=1;c<129;c++)f=d*h+c,g.emplaceBack(f,f+1),g.emplaceBack(f,f+h),g.emplaceBack(f+1,f+h),128===d&&g.emplaceBack(f+h,f+h+1);g.emplaceBack(f+1,f+1+h)}return g}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(b),this.wireframeSegments=a.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,b.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function bk(a){const b=[];for(let c=0;cu.indexOf(v)&&u.push(v);let w=f?f.defines():[];w=w.concat(h.map(a=>`#define ${a}`));const x=w.concat("\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",a0,a_.fragmentSource,a$.fragmentSource,d.fragmentSource).join("\n"),y=w.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",a0,a_.vertexSource,a$.vertexSource,aZ.vertexSource,d.vertexSource).join("\n"),z=m.createShader(m.FRAGMENT_SHADER);if(m.isContextLost())return void(this.failedToCreate=!0);m.shaderSource(z,x),m.compileShader(z),m.attachShader(this.program,z);const A=m.createShader(m.VERTEX_SHADER);if(m.isContextLost())return void(this.failedToCreate=!0);m.shaderSource(A,y),m.compileShader(A),m.attachShader(this.program,A),this.attributes={};const B={};this.numAttributes=p.length;for(let C=0;C>16,i>>16],u_pixel_coord_lower:[65535&h,65535&i]}}const bn=(b,c,d,f)=>{const g=c.style.light,h=g.properties.get("position"),i=[h.x,h.y,h.z],j=a.create$1();"viewport"===g.properties.get("anchor")&&(a.fromRotation(j,-c.transform.angle),a.transformMat3(i,i,j));const k=g.properties.get("color");return{u_matrix:b,u_lightpos:i,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[k.r,k.g,k.b],u_vertical_gradient:+d,u_opacity:f}},bo=(b,c,d,f,g,h,i)=>a.extend(bn(b,c,d,f),bm(h,c,i),{u_height_factor:-Math.pow(2,g.overscaledZ)/i.tileSize/8}),bp=a=>({u_matrix:a}),bq=(b,c,d,f)=>a.extend(bp(b),bm(d,c,f)),br=(a,b)=>({u_matrix:a,u_world:b}),bs=(b,c,d,f,g)=>a.extend(bq(b,c,d,f),{u_world:g}),bt=(b,c,d,f)=>{const g=b.transform;let h;return h="map"===f.paint.get("circle-pitch-alignment")?g.calculatePixelsToTileUnitsMatrix(d):new Float32Array([g.pixelsToGLUnits[0],0,0,g.pixelsToGLUnits[1],]),{u_camera_to_center_distance:g.cameraToCenterDistance,u_matrix:b.translatePosMatrix(c.projMatrix,d,f.paint.get("circle-translate"),f.paint.get("circle-translate-anchor")),u_device_pixel_ratio:a.exported.devicePixelRatio,u_extrude_scale:h}},bu=a=>{const b=[];return"map"===a.paint.get("circle-pitch-alignment")&&b.push("PITCH_WITH_MAP"),"map"===a.paint.get("circle-pitch-scale")&&b.push("SCALE_WITH_MAP"),b},bv=(b,c,d)=>{const f=a.EXTENT/d.tileSize;return{u_matrix:b,u_camera_to_center_distance:c.cameraToCenterDistance,u_extrude_scale:[c.pixelsToGLUnits[0]/f,c.pixelsToGLUnits[1]/f,]}},bw=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bx=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:C(b,1,c),u_intensity:d}),by=(b,c,d,f,g,h)=>{const i=b.transform,j=i.calculatePixelsToTileUnitsMatrix(c),k={u_matrix:bB(b,c,d,g),u_pixels_to_tile_units:j,u_device_pixel_ratio:a.exported.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:h,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(bC(d)){const l=bA(c,b.transform);k.u_texsize=c.lineAtlasTexture.size,k.u_scale=[l,f.fromScale,f.toScale,],k.u_mix=f.t}return k},bz=(b,c,d,f,g)=>{const h=b.transform,i=bA(c,h);return{u_matrix:bB(b,c,d,g),u_texsize:c.imageAtlasTexture.size,u_pixels_to_tile_units:h.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:a.exported.devicePixelRatio,u_image:0,u_scale:[i,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function bA(a,b){return 1/C(a,1,b.tileZoom)}function bB(a,b,c,d){return a.translatePosMatrix(d||b.tileID.projMatrix,b,c.paint.get("line-translate"),c.paint.get("line-translate-anchor"))}function bC(a){const b=a.paint.get("line-dasharray").value;return b.value||"constant"!==b.kind}const bD=(a,b,c,d,f,g)=>{var h,i;return{u_matrix:a,u_tl_parent:b,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(i=f.paint.get("raster-saturation"))>0?1-1/(1.001-i):-i,u_contrast_factor:(h=f.paint.get("raster-contrast"))>0?1/(1-h):1+h,u_spin_weights:bE(f.paint.get("raster-hue-rotate")),u_perspective_transform:g}};function bE(a){a*=Math.PI/180;const b=Math.sin(a),c=Math.cos(a);return[(2*c+1)/3,(-Math.sqrt(3)*b-c+1)/3,(Math.sqrt(3)*b-c+1)/3,]}const bF=(a,b,c,d,f,g,h,i,j,k,l,m,n,o)=>{const p=f.transform;return{u_is_size_zoom_constant:+("constant"===a||"source"===a),u_is_size_feature_constant:+("constant"===a||"camera"===a),u_size_t:b?b.uSizeT:0,u_size:b?b.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+c,u_aspect_ratio:p.width/p.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:h,u_coord_matrix:i,u_is_text:+j,u_pitch_with_map:+d,u_texsize:k,u_tile_id:l,u_zoom_transition:m,u_inv_rot_matrix:n,u_merc_center:o,u_texture:0}},bG=(b,c,d,f,g,h,i,j,k,l,m,n,o,p,q)=>{const{cameraToCenterDistance:r,_pitch:s}=g.transform;return a.extend(bF(b,c,d,f,g,h,i,j,k,l,n,o,p,q),{u_gamma_scale:f?r*Math.cos(g.terrain?0:s):1,u_device_pixel_ratio:a.exported.devicePixelRatio,u_is_halo:+m})},bH=(b,c,d,f,g,h,i,j,k,l,m,n,o,p)=>a.extend(bG(b,c,d,f,g,h,i,j,!0,k,!0,m,n,o,p),{u_texsize_icon:l,u_texture_icon:1}),bI=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bJ=(b,c,d,f,g,h)=>a.extend(function(a,b,c,d){const f=c.imageManager.getPattern(a.from.toString()),g=c.imageManager.getPattern(a.to.toString()),{width:h,height:i}=c.imageManager.getPixelSize(),j=Math.pow(2,d.tileID.overscaledZ),k=d.tileSize*Math.pow(2,c.transform.tileZoom)/j,l=k*(d.tileID.canonical.x+d.tileID.wrap*j),m=k*d.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:f.tl,u_pattern_br_a:f.br,u_pattern_tl_b:g.tl,u_pattern_br_b:g.br,u_texsize:[h,i],u_mix:b.t,u_pattern_size_a:f.displaySize,u_pattern_size_b:g.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/C(d,1,c.transform.tileZoom),u_pixel_coord_upper:[l>>16,m>>16,],u_pixel_coord_lower:[65535&l,65535&m,]}}(f,h,d,g),{u_matrix:b,u_opacity:c}),bK={fillExtrusion:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fillExtrusionPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_lightpos:new a.Uniform3f(b,c.u_lightpos),u_lightintensity:new a.Uniform1f(b,c.u_lightintensity),u_lightcolor:new a.Uniform3f(b,c.u_lightcolor),u_vertical_gradient:new a.Uniform1f(b,c.u_vertical_gradient),u_height_factor:new a.Uniform1f(b,c.u_height_factor),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_opacity:new a.Uniform1f(b,c.u_opacity)}),fill:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),fillPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),fillOutline:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world)}),fillOutlinePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_world:new a.Uniform2f(b,c.u_world),u_image:new a.Uniform1i(b,c.u_image),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade)}),circle:(b,c)=>({u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.UniformMatrix2f(b,c.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),collisionBox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_extrude_scale:new a.Uniform2f(b,c.u_extrude_scale)}),collisionCircle:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_inv_matrix:new a.UniformMatrix4f(b,c.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(b,c.u_viewport_size)}),debug:(b,c)=>({u_color:new a.UniformColor(b,c.u_color),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_overlay:new a.Uniform1i(b,c.u_overlay),u_overlay_scale:new a.Uniform1f(b,c.u_overlay_scale)}),clippingMask:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmap:(b,c)=>({u_extrude_scale:new a.Uniform1f(b,c.u_extrude_scale),u_intensity:new a.Uniform1f(b,c.u_intensity),u_matrix:new a.UniformMatrix4f(b,c.u_matrix)}),heatmapTexture:(b,c)=>({u_image:new a.Uniform1i(b,c.u_image),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_opacity:new a.Uniform1f(b,c.u_opacity)}),hillshade:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_latrange:new a.Uniform2f(b,c.u_latrange),u_light:new a.Uniform2f(b,c.u_light),u_shadow:new a.UniformColor(b,c.u_shadow),u_highlight:new a.UniformColor(b,c.u_highlight),u_accent:new a.UniformColor(b,c.u_accent)}),hillshadePrepare:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_image:new a.Uniform1i(b,c.u_image),u_dimension:new a.Uniform2f(b,c.u_dimension),u_zoom:new a.Uniform1f(b,c.u_zoom),u_unpack:new a.Uniform4f(b,c.u_unpack)}),line:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_dash_image:new a.Uniform1i(b,c.u_dash_image),u_gradient_image:new a.Uniform1i(b,c.u_gradient_image),u_image_height:new a.Uniform1f(b,c.u_image_height),u_texsize:new a.Uniform2f(b,c.u_texsize),u_scale:new a.Uniform3f(b,c.u_scale),u_mix:new a.Uniform1f(b,c.u_mix),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),linePattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_texsize:new a.Uniform2f(b,c.u_texsize),u_pixels_to_tile_units:new a.UniformMatrix2f(b,c.u_pixels_to_tile_units),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_image:new a.Uniform1i(b,c.u_image),u_units_to_pixels:new a.Uniform2f(b,c.u_units_to_pixels),u_scale:new a.Uniform3f(b,c.u_scale),u_fade:new a.Uniform1f(b,c.u_fade),u_alpha_discard_threshold:new a.Uniform1f(b,c.u_alpha_discard_threshold)}),raster:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_tl_parent:new a.Uniform2f(b,c.u_tl_parent),u_scale_parent:new a.Uniform1f(b,c.u_scale_parent),u_fade_t:new a.Uniform1f(b,c.u_fade_t),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image0:new a.Uniform1i(b,c.u_image0),u_image1:new a.Uniform1i(b,c.u_image1),u_brightness_low:new a.Uniform1f(b,c.u_brightness_low),u_brightness_high:new a.Uniform1f(b,c.u_brightness_high),u_saturation_factor:new a.Uniform1f(b,c.u_saturation_factor),u_contrast_factor:new a.Uniform1f(b,c.u_contrast_factor),u_spin_weights:new a.Uniform3f(b,c.u_spin_weights),u_perspective_transform:new a.Uniform2f(b,c.u_perspective_transform)}),symbolIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_texture:new a.Uniform1i(b,c.u_texture)}),symbolSDF:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texture:new a.Uniform1i(b,c.u_texture),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_tile_id:new a.Uniform3f(b,c.u_tile_id),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_inv_rot_matrix:new a.UniformMatrix4f(b,c.u_inv_rot_matrix),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),symbolTextAndIcon:(b,c)=>({u_is_size_zoom_constant:new a.Uniform1i(b,c.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(b,c.u_is_size_feature_constant),u_size_t:new a.Uniform1f(b,c.u_size_t),u_size:new a.Uniform1f(b,c.u_size),u_camera_to_center_distance:new a.Uniform1f(b,c.u_camera_to_center_distance),u_pitch:new a.Uniform1f(b,c.u_pitch),u_rotate_symbol:new a.Uniform1i(b,c.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(b,c.u_aspect_ratio),u_fade_change:new a.Uniform1f(b,c.u_fade_change),u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(b,c.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(b,c.u_coord_matrix),u_is_text:new a.Uniform1i(b,c.u_is_text),u_pitch_with_map:new a.Uniform1i(b,c.u_pitch_with_map),u_texsize:new a.Uniform2f(b,c.u_texsize),u_texsize_icon:new a.Uniform2f(b,c.u_texsize_icon),u_texture:new a.Uniform1i(b,c.u_texture),u_texture_icon:new a.Uniform1i(b,c.u_texture_icon),u_gamma_scale:new a.Uniform1f(b,c.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(b,c.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(b,c.u_is_halo)}),background:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_color:new a.UniformColor(b,c.u_color)}),backgroundPattern:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_opacity:new a.Uniform1f(b,c.u_opacity),u_image:new a.Uniform1i(b,c.u_image),u_pattern_tl_a:new a.Uniform2f(b,c.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(b,c.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(b,c.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(b,c.u_pattern_br_b),u_texsize:new a.Uniform2f(b,c.u_texsize),u_mix:new a.Uniform1f(b,c.u_mix),u_pattern_size_a:new a.Uniform2f(b,c.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(b,c.u_pattern_size_b),u_scale_a:new a.Uniform1f(b,c.u_scale_a),u_scale_b:new a.Uniform1f(b,c.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(b,c.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(b,c.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(b,c.u_tile_units_to_pixels)}),terrainRaster:a7,terrainDepth:a7,skybox:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_cubemap:new a.Uniform1i(b,c.u_cubemap),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxGradient:(b,c)=>({u_matrix:new a.UniformMatrix4f(b,c.u_matrix),u_color_ramp:new a.Uniform1i(b,c.u_color_ramp),u_center_direction:new a.Uniform3f(b,c.u_center_direction),u_radius:new a.Uniform1f(b,c.u_radius),u_opacity:new a.Uniform1f(b,c.u_opacity),u_temporal_offset:new a.Uniform1f(b,c.u_temporal_offset)}),skyboxCapture:(b,c)=>({u_matrix_3f:new a.UniformMatrix3f(b,c.u_matrix_3f),u_sun_direction:new a.Uniform3f(b,c.u_sun_direction),u_sun_intensity:new a.Uniform1f(b,c.u_sun_intensity),u_color_tint_r:new a.Uniform4f(b,c.u_color_tint_r),u_color_tint_m:new a.Uniform4f(b,c.u_color_tint_m),u_luminance:new a.Uniform1f(b,c.u_luminance)}),globeRaster:(b,c)=>({u_proj_matrix:new a.UniformMatrix4f(b,c.u_proj_matrix),u_globe_matrix:new a.UniformMatrix4f(b,c.u_globe_matrix),u_merc_matrix:new a.UniformMatrix4f(b,c.u_merc_matrix),u_zoom_transition:new a.Uniform1f(b,c.u_zoom_transition),u_merc_center:new a.Uniform2f(b,c.u_merc_center),u_image0:new a.Uniform1i(b,c.u_image0)}),globeAtmosphere:(b,c)=>({u_center:new a.Uniform2f(b,c.u_center),u_radius:new a.Uniform1f(b,c.u_radius),u_screen_size:new a.Uniform2f(b,c.u_screen_size),u_pixel_ratio:new a.Uniform1f(b,c.u_pixel_ratio),u_opacity:new a.Uniform1f(b,c.u_opacity),u_fadeout_range:new a.Uniform1f(b,c.u_fadeout_range),u_start_color:new a.Uniform3f(b,c.u_start_color),u_end_color:new a.Uniform3f(b,c.u_end_color)})};let bL;function bM(b,c,d,f,g,h,i){var j;const k=b.context,l=k.gl,m=b.useProgram("collisionBox"),n=[];let o=0,p=0;for(let q=0;q0){const y=a.create(),z=v;a.mul(y,u.placementInvProjMatrix,b.transform.glCoordMatrix),a.mul(y,y,u.placementViewportMatrix),n.push({circleArray:x,circleOffset:p,transform:z,invTransform:y}),o+=x.length/4,p=o}w&&(b.terrain&&b.terrain.setupElevationDraw(s,m),m.draw(k,l.LINES,a.DepthMode.disabled,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.disabled,bv(v,b.transform,s),d.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,b.transform.zoom,null,w.collisionVertexBuffer,w.collisionVertexBufferExt))}if(!i||!n.length)return;const A=b.useProgram("collisionCircle"),B=new a.StructArrayLayout2f1f2i16;B.resize(4*o),B._trim();let C=0;for(const D of n)for(let E=0;E[0,0,0];p.clear();for(let w=0;w=0&&(r[x.associatedIconIndex]={shiftedAnchor:L,angle:M})}else aA(x.numGlyphs,p)}if(m){q.clear();const O=b.icon.placedSymbolArray;for(let P=0;P[0,0,0];as(I,G.projMatrix,b,g,$,aa,u,l,ae,G)}const af=b.translatePosMatrix(G.projMatrix,H,h,i),ag=v||g&&B||ac?bN:$,ah=b.translatePosMatrix(aa,H,h,i,!0),ai=L&&0!==d.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1);let aj;const ak=r.createInversionMatrix(G.toUnwrapped());aj=L?I.iconsInText?bH(M.kind,P,w,u,b,af,ag,ah,R,V,Q,D,ak,A):bG(M.kind,P,w,u,b,af,ag,ah,g,R,!0,Q,D,ak,A):bF(M.kind,P,w,u,b,af,ag,ah,g,R,Q,D,ak,A);const al={program:O,buffers:J,uniformValues:aj,atlasTexture:S,atlasTextureIcon:W,atlasInterpolation:T,atlasInterpolationIcon:U,isSDF:L,hasHalo:ai,tile:H,labelPlaneMatrixInv:_};if(x&&I.canOverlap){y=!0;const am=J.segments.get();for(const ap of am)E.push({segments:new a.SegmentVector([ap]),sortKey:ap.sortKey,state:al})}else E.push({segments:J.segments,sortKey:0,state:al})}for(const aq of(y&&E.sort((a,b)=>a.sortKey-b.sortKey),E)){const ar=aq.state;if(b.terrain&&b.terrain.setupElevationDraw(ar.tile,ar.program,{useDepthForOcclusion:!C,labelPlaneMatrixInv:ar.labelPlaneMatrixInv}),o.activeTexture.set(p.TEXTURE0),ar.atlasTexture.bind(ar.atlasInterpolation,p.CLAMP_TO_EDGE),ar.atlasTextureIcon&&(o.activeTexture.set(p.TEXTURE1),ar.atlasTextureIcon&&ar.atlasTextureIcon.bind(ar.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),ar.isSDF){const at=ar.uniformValues;ar.hasHalo&&(at.u_is_halo=1,bS(ar.buffers,aq.segments,d,b,ar.program,z,m,n,at)),at.u_is_halo=0}bS(ar.buffers,aq.segments,d,b,ar.program,z,m,n,ar.uniformValues)}}function bS(b,c,d,f,g,h,i,j,k){const l=f.context;g.draw(l,l.gl.TRIANGLES,h,i,j,a.CullFaceMode.disabled,k,d.id,b.layoutVertexBuffer,b.indexBuffer,c,d.paint,f.transform.zoom,b.programConfigurations.get(d.id),b.dynamicLayoutVertexBuffer,b.opacityVertexBuffer)}function bT(b,c,d,f,g,h,i){const j=b.context.gl,k=d.paint.get("fill-pattern"),l=k&&k.constantOr(1),m=d.getCrossfadeParameters();let n,o,p,q,r;for(const s of(i?(o=l&&!d.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",n=j.LINES):(o=l?"fillPattern":"fill",n=j.TRIANGLES),f)){const u=c.getTile(s);if(l&&!u.patternsLoaded())continue;const v=u.getBucket(d);if(!v)continue;b.prepareDrawTile(s);const w=v.programConfigurations.get(d.id),x=b.useProgram(o,w);l&&(b.context.activeTexture.set(j.TEXTURE0),u.imageAtlasTexture.bind(j.LINEAR,j.CLAMP_TO_EDGE),w.updatePaintBuffers(m));const y=k.constantOr(null);if(y&&u.imageAtlas){const z=u.imageAtlas,A=z.patternPositions[y.to.toString()],B=z.patternPositions[y.from.toString()];A&&B&&w.setConstantPatternPositions(A,B)}const C=b.translatePosMatrix(s.projMatrix,u,d.paint.get("fill-translate"),d.paint.get("fill-translate-anchor"));if(i){q=v.indexBuffer2,r=v.segments2;const D=b.terrain&&b.terrain.renderingToTexture?b.terrain.drapeBufferSize:[j.drawingBufferWidth,j.drawingBufferHeight,];p="fillOutlinePattern"===o&&l?bs(C,b,m,u,D):br(C,D)}else q=v.indexBuffer,r=v.segments,p=l?bq(C,b,m,u):bp(C);b.prepareDrawProgram(b.context,x,s.toUnwrapped()),x.draw(b.context,n,g,b.stencilModeForClipping(s),h,a.CullFaceMode.disabled,p,d.id,v.layoutVertexBuffer,q,r,d.paint,b.transform.zoom,w)}}function bU(b,c,d,f,g,h,i){const j=b.context,k=j.gl,l=d.paint.get("fill-extrusion-pattern"),m=l.constantOr(1),n=d.getCrossfadeParameters(),o=d.paint.get("fill-extrusion-opacity");for(const p of f){const q=c.getTile(p),r=q.getBucket(d);if(!r)continue;const s=r.programConfigurations.get(d.id),u=b.useProgram(m?"fillExtrusionPattern":"fillExtrusion",s);if(b.terrain){const v=b.terrain;if(!r.enableTerrain)continue;if(v.setupElevationDraw(q,u,{useMeterToDem:!0}),bV(j,c,p,r,d,v),!r.centroidVertexBuffer){const w=u.attributes.a_centroid_pos;void 0!==w&&k.vertexAttrib2f(w,0,0)}}m&&(b.context.activeTexture.set(k.TEXTURE0),q.imageAtlasTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),s.updatePaintBuffers(n));const x=l.constantOr(null);if(x&&q.imageAtlas){const y=q.imageAtlas,z=y.patternPositions[x.to.toString()],A=y.patternPositions[x.from.toString()];z&&A&&s.setConstantPatternPositions(z,A)}const B=b.translatePosMatrix(p.projMatrix,q,d.paint.get("fill-extrusion-translate"),d.paint.get("fill-extrusion-translate-anchor")),C=d.paint.get("fill-extrusion-vertical-gradient"),D=m?bo(B,b,C,o,p,n,q):bn(B,b,C,o);b.prepareDrawProgram(j,u,p.toUnwrapped()),u.draw(j,j.gl.TRIANGLES,g,h,i,a.CullFaceMode.backCCW,D,d.id,r.layoutVertexBuffer,r.indexBuffer,r.segments,d.paint,b.transform.zoom,s,b.terrain?r.centroidVertexBuffer:null)}}function bV(b,c,d,f,g,h){const i=[b=>{let c=b.canonical.x-1,d=b.wrap;return c<0&&(c=(1<{let c=b.canonical.x+1,d=b.wrap;return c===1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,(0===b.canonical.y?1<new a.OverscaledTileID(b.overscaledZ,b.wrap,b.canonical.z,b.canonical.x,b.canonical.y===(1<{const b=c.getSource().maxzoom,d=a=>{const b=c.getTileByID(a);if(b&&b.hasData())return b.getBucket(g)};let f,h,i;return(a.overscaledZ===a.canonical.z||a.overscaledZ>=b)&&(f=d(a.key)),a.overscaledZ>=b&&(h=d(a.calculateScaledKey(a.overscaledZ+1))),a.overscaledZ>b&&(i=d(a.calculateScaledKey(a.overscaledZ-1))),f||h||i},k=[0,0,0],l=(b,c)=>(k[0]=Math.min(b.min.y,c.min.y),k[1]=Math.max(b.max.y,c.max.y),k[2]=a.EXTENT-c.min.x>b.max.x?c.min.x-a.EXTENT:b.max.x,k),m=(b,c)=>(k[0]=Math.min(b.min.x,c.min.x),k[1]=Math.max(b.max.x,c.max.x),k[2]=a.EXTENT-c.min.y>b.max.y?c.min.y-a.EXTENT:b.max.y,k),n=[(a,b)=>l(a,b),(a,b)=>l(b,a),(a,b)=>m(a,b),(a,b)=>m(b,a),],o=new a.pointGeometry(0,0);let p,q,r;const s=(b,c,f,g,i)=>{const j=[[g?f:b,g?b:f,0],[g?f:c,g?c:f,0],],k=i<0?a.EXTENT+i:i,l=[g?k:(b+c)/2,g?(b+c)/2:k,0,];return 0===f&&i<0||0!==f&&i>0?h.getForTilePoints(r,[l],!0,q):j.push(l),h.getForTilePoints(d,j,!0,p),Math.max(j[0][2],j[1][2],l[2])/h.exaggeration()};for(let u=0;u<4;u++){const v=f.borders[u];if(0===v.length&&(f.borderDone[u]=!0),f.borderDone[u])continue;const w=r=i[u](d),x=j(w);if(!x||!x.enableTerrain||!(q=h.findDEMTileFor(w))||!q.dem)continue;if(!p){const y=h.findDEMTileFor(d);if(!y||!y.dem)return;p=y}const z=(u<2?1:5)-u,A=x.borders[z];let B=0;for(let C=0;CE[0]+3);)x.borderDone[z]||x.encodeCentroid(void 0,F,!1),B++;if(F&&BE[1]-3)&&(H++,++B!==A.length);)F=x.featuresOnBorder[A[B]];if(F=x.featuresOnBorder[A[G]],D.intersectsCount()>1||F.intersectsCount()>1||1!==H){1!==H&&(B=G),f.encodeCentroid(void 0,D,!1),x.borderDone[z]||x.encodeCentroid(void 0,F,!1);continue}const I=n[u](D,F),J=u%2?a.EXTENT-1:0;o.x=s(I[0],Math.min(a.EXTENT-1,I[1]),J,u<2,I[2]),o.y=0,f.encodeCentroid(o,D,!1),x.borderDone[z]||x.encodeCentroid(o,F,!1)}else f.encodeCentroid(void 0,D,!1)}f.borderDone[u]=f.needsCentroidUpdate=!0,x.borderDone[z]||(x.borderDone[z]=x.needsCentroidUpdate=!0)}(f.needsCentroidUpdate|| !f.centroidVertexBuffer&&0!==f.centroidVertexArray.length)&&f.uploadCentroid(b)}const bW=new a.Color(1,0,0,1),bX=new a.Color(0,1,0,1),bY=new a.Color(0,0,1,1),bZ=new a.Color(1,0,1,1),b$=new a.Color(0,1,1,1);function b_(a,b,c,d){b1(a,0,b+c/2,a.transform.width,c,d)}function b0(a,b,c,d){b1(a,b-c/2,0,c,a.transform.height,d)}function b1(b,c,d,f,g,h){const i=b.context,j=i.gl;j.enable(j.SCISSOR_TEST),j.scissor(c*a.exported.devicePixelRatio,d*a.exported.devicePixelRatio,f*a.exported.devicePixelRatio,g*a.exported.devicePixelRatio),i.clear({color:h}),j.disable(j.SCISSOR_TEST)}function b2(b,c,d){const f=b.context,g=f.gl,h=d.projMatrix,i=b.useProgram("debug"),j=c.getTileByID(d.key);b.terrain&&b.terrain.setupElevationDraw(j,i);const k=a.DepthMode.disabled,l=a.StencilMode.disabled,m=b.colorModeForRenderPass(),n="$debug";f.activeTexture.set(g.TEXTURE0),b.emptyTexture.bind(g.LINEAR,g.CLAMP_TO_EDGE),j._makeDebugTileBoundsBuffers(b.context,b.transform.projection);const o=j._tileDebugBuffer||b.debugBuffer,p=j._tileDebugIndexBuffer||b.debugIndexBuffer,q=j._tileDebugSegments||b.debugSegments;i.draw(f,g.LINE_STRIP,k,l,m,a.CullFaceMode.disabled,bw(h,a.Color.red),n,o,p,q);const r=j.latestRawTileData,s=Math.floor((r&&r.byteLength||0)/1024),u=c.getTile(d).tileSize,v=512/Math.min(u,512)*(d.overscaledZ/b.transform.zoom)*.5;let w=d.canonical.toString();d.overscaledZ!==d.canonical.z&&(w+=` => ${d.overscaledZ}`),function(a,b){a.initDebugOverlayCanvas();const c=a.debugOverlayCanvas,d=a.context.gl,f=a.debugOverlayCanvas.getContext("2d");f.clearRect(0,0,c.width,c.height),f.shadowColor="white",f.shadowBlur=2,f.lineWidth=1.5,f.strokeStyle="white",f.textBaseline="top",f.font="bold 36px Open Sans, sans-serif",f.fillText(b,5,5),f.strokeText(b,5,5),a.debugOverlayTexture.update(c),a.debugOverlayTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}(b,`${w} ${s}kb`),i.draw(f,g.TRIANGLES,k,l,a.ColorMode.alphaBlended,a.CullFaceMode.disabled,bw(h,a.Color.transparent,v),n,b.debugBuffer,b.quadTriangleIndexBuffer,b.debugSegments)}const b3=a.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:b4}=b3;function b5(a,b,c,d){a.emplaceBack(b,c,d)}class b6{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,b5(this.vertexArray,-1,-1,1),b5(this.vertexArray,1,-1,1),b5(this.vertexArray,-1,1,1),b5(this.vertexArray,1,1,1),b5(this.vertexArray,-1,-1,-1),b5(this.vertexArray,1,-1,-1),b5(this.vertexArray,-1,1,-1),b5(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=b.createVertexBuffer(this.vertexArray,b4),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function b7(b,c,d,f,g,h){var i,j,k,l,m;const n=b.gl,o=c.paint.get("sky-atmosphere-color"),p=c.paint.get("sky-atmosphere-halo-color"),q=c.paint.get("sky-atmosphere-sun-intensity"),r=(i=a.fromMat4([],f),j=g,k=q,l=o,m=p,{u_matrix_3f:i,u_sun_direction:j,u_sun_intensity:k,u_color_tint_r:[l.r,l.g,l.b,l.a],u_color_tint_m:[m.r,m.g,m.b,m.a],u_luminance:5e-5});n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+h,c.skyboxTexture,0),d.draw(b,n.TRIANGLES,a.DepthMode.disabled,a.StencilMode.disabled,a.ColorMode.unblended,a.CullFaceMode.frontCW,r,"skyboxCapture",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}const b8={symbol:function(b,c,d,f,g){if("translucent"!==b.renderPass)return;const h=a.StencilMode.disabled,i=b.colorModeForRenderPass();d.layout.get("text-variable-anchor")&&function(b,c,d,f,g,h,i){const j=c.transform,k="map"===g,l="map"===h,m=j.projection.createTileTransform(j,j.worldSize);for(const n of b){const o=f.getTile(n),p=o.getBucket(d);if(!p||p.projection!==j.projection.name||!p.text||!p.text.segments.get().length)continue;const q=a.evaluateSizeForZoom(p.textSizeData,j.zoom),r=c.transform.calculatePixelsToTileUnitsMatrix(o),s=an(n.projMatrix,o.tileID.canonical,l,k,c.transform,r),u="none"!==d.layout.get("icon-text-fit")&&p.hasIconData();if(q){const v=Math.pow(2,j.zoom-o.tileID.overscaledZ);bP(p,k,l,i,a.symbolSize,j,s,n,v,q,u,m)}}}(f,b,d,c,d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),g),0!==d.paint.get("icon-opacity").constantOr(1)&&bR(b,c,d,f,!1,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),d.layout.get("icon-rotation-alignment"),d.layout.get("icon-pitch-alignment"),d.layout.get("icon-keep-upright"),h,i),0!==d.paint.get("text-opacity").constantOr(1)&&bR(b,c,d,f,!0,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),d.layout.get("text-rotation-alignment"),d.layout.get("text-pitch-alignment"),d.layout.get("text-keep-upright"),h,i),c.map.showCollisionBoxes&&(bM(b,c,d,f,d.paint.get("text-translate"),d.paint.get("text-translate-anchor"),!0),bM(b,c,d,f,d.paint.get("icon-translate"),d.paint.get("icon-translate-anchor"),!1))},circle:function(b,c,d,f){if("translucent"!==b.renderPass)return;const g=d.paint.get("circle-opacity"),h=d.paint.get("circle-stroke-width"),i=d.paint.get("circle-stroke-opacity"),j=void 0!==d.layout.get("circle-sort-key").constantOr(1);if(0===g.constantOr(1)&&(0===h.constantOr(1)||0===i.constantOr(1)))return;const k=b.context,l=k.gl,m=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),n=a.StencilMode.disabled,o=b.colorModeForRenderPass(),p=[];for(let q=0;qa.sortKey-b.sortKey);const A={useDepthForOcclusion:"globe"!==b.transform.projection.name};for(const B of p){const{programConfiguration:C,program:D,layoutVertexBuffer:E,indexBuffer:F,uniformValues:G,tile:H}=B.state,I=B.segments;b.terrain&&b.terrain.setupElevationDraw(H,D,A),b.prepareDrawProgram(k,D,H.tileID.toUnwrapped()),D.draw(k,l.TRIANGLES,m,n,o,a.CullFaceMode.disabled,G,d.id,E,F,I,d.paint,b.transform.zoom,C)}},heatmap:function(b,c,d,f){if(0!==d.paint.get("heatmap-opacity")){if("offscreen"===b.renderPass){const g=b.context,h=g.gl,i=a.StencilMode.disabled,j=new a.ColorMode([h.ONE,h.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(a,b,c){const d=a.gl;a.activeTexture.set(d.TEXTURE1),a.viewport.set([0,0,b.width/4,b.height/4,]);let f=c.heatmapFbo;if(f)d.bindTexture(d.TEXTURE_2D,f.colorAttachment.get()),a.bindFramebuffer.set(f.framebuffer);else{const g=d.createTexture();d.bindTexture(d.TEXTURE_2D,g),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),f=c.heatmapFbo=a.createFramebuffer(b.width/4,b.height/4,!1),function(a,b,c,d){const f=a.gl;f.texImage2D(f.TEXTURE_2D,0,f.RGBA,b.width/4,b.height/4,0,f.RGBA,a.extRenderToTextureHalfFloat?a.extTextureHalfFloat.HALF_FLOAT_OES:f.UNSIGNED_BYTE,null),d.colorAttachment.set(c)}(a,b,g,f)}})(g,b,d),g.clear({color:a.Color.transparent});for(let k=0;k{const b=[];bC(a)&&b.push("RENDER_LINE_DASH"),a.paint.get("line-gradient")&&b.push("RENDER_LINE_GRADIENT");const c=a.paint.get("line-pattern").constantOr(1),d=1!==a.paint.get("line-opacity").constantOr(1);return!c&&d&&b.push("RENDER_LINE_ALPHA_DISCARD"),b})(d);let w=v.includes("RENDER_LINE_ALPHA_DISCARD");for(const x of(b.terrain&&b.terrain.clipOrMaskOverlapStencilType()&&(w=!1),f)){const y=c.getTile(x);if(o&&!y.patternsLoaded())continue;const z=y.getBucket(d);if(!z)continue;b.prepareDrawTile(x);const A=z.programConfigurations.get(d.id),B=b.useProgram(r,A,v),C=n.constantOr(null);if(C&&y.imageAtlas){const D=y.imageAtlas,E=D.patternPositions[C.to.toString()],F=D.patternPositions[C.from.toString()];E&&F&&A.setConstantPatternPositions(E,F)}const G=k.constantOr(null),H=m.constantOr(null);if(!o&&G&&H&&y.lineAtlas){const I=y.lineAtlas,J=I.getDash(G.to,H),K=I.getDash(G.from,H);J&&K&&A.setConstantPatternPositions(J,K)}const L=b.terrain?x.projMatrix:null,M=o?bz(b,y,d,q,L):by(b,y,d,q,L,z.lineClipsArray.length);if(p){const N=z.gradients[d.id];let O=N.texture;if(d.gradientVersion!==N.version){let P=256;if(d.stepInterpolant){const Q=c.getSource().maxzoom,R=x.canonical.z===Q?Math.ceil(1<{B.draw(s,u.TRIANGLES,i,c,j,a.CullFaceMode.disabled,M,d.id,z.layoutVertexBuffer,z.indexBuffer,z.segments,d.paint,b.transform.zoom,A,z.layoutVertexBuffer2)};if(w){const T=b.stencilModeForClipping(x).ref;0===T&&b.terrain&&s.clear({stencil:0});const U={func:u.EQUAL,mask:255};M.u_alpha_discard_threshold=.8,S(new a.StencilMode(U,T,255,u.KEEP,u.KEEP,u.INVERT)),M.u_alpha_discard_threshold=0,S(new a.StencilMode(U,T,255,u.KEEP,u.KEEP,u.KEEP))}else S(b.stencilModeForClipping(x))}w&&(b.resetStencilClippingMasks(),b.terrain&&s.clear({stencil:0}))},fill:function(b,c,d,f){const g=d.paint.get("fill-color"),h=d.paint.get("fill-opacity");if(0===h.constantOr(1))return;const i=b.colorModeForRenderPass(),j=d.paint.get("fill-pattern"),k=b.opaquePassEnabledForLayer()&&!j.constantOr(1)&&1===g.constantOr(a.Color.transparent).a&&1===h.constantOr(0)?"opaque":"translucent";if(b.renderPass===k){const l=b.depthModeForSublayer(1,"opaque"===b.renderPass?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly);bT(b,c,d,f,l,i,!1)}if("translucent"===b.renderPass&&d.paint.get("fill-antialias")){const m=b.depthModeForSublayer(d.getPaintProperty("fill-outline-color")?2:0,a.DepthMode.ReadOnly);bT(b,c,d,f,m,i,!0)}},"fill-extrusion":function(b,c,d,f){const g=d.paint.get("fill-extrusion-opacity");if(0!==g&&"translucent"===b.renderPass){const h=new a.DepthMode(b.context.gl.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);if(1!==g||d.paint.get("fill-extrusion-pattern").constantOr(1))bU(b,c,d,f,h,a.StencilMode.disabled,a.ColorMode.disabled),bU(b,c,d,f,h,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const i=b.colorModeForRenderPass();bU(b,c,d,f,h,a.StencilMode.disabled,i)}}},hillshade:function(b,c,d,f){if("offscreen"!==b.renderPass&&"translucent"!==b.renderPass)return;const g=b.context,h=b.depthModeForSublayer(0,a.DepthMode.ReadOnly),i=b.colorModeForRenderPass(),j=b.terrain&&b.terrain.renderingToTexture,[k,l]="translucent"!==b.renderPass||j?[{},f]:b.stencilConfigForOverlap(f);for(const m of l){const n=c.getTile(m);if(n.needsHillshadePrepare&&"offscreen"===b.renderPass)a6(b,n,d,h,a.StencilMode.disabled,i);else if("translucent"===b.renderPass){const o=j&&b.terrain?b.terrain.stencilModeForRTTOverlap(m):k[m.overscaledZ];a4(b,m,n,d,h,o,i)}}g.viewport.set([0,0,b.width,b.height]),b.resetStencilClippingMasks()},raster:function(b,c,d,f,g,h){if("translucent"!==b.renderPass||0===d.paint.get("raster-opacity")||!f.length)return;const i=b.context,j=i.gl,k=c.getSource(),l=b.useProgram("raster"),m=b.colorModeForRenderPass(),n=b.terrain&&b.terrain.renderingToTexture,[o,p]=k instanceof R||n?[{},f]:b.stencilConfigForOverlap(f),q=p[p.length-1].overscaledZ,r=!b.options.moving;for(const s of p){const u=n?a.DepthMode.disabled:b.depthModeForSublayer(s.overscaledZ-q,1===d.paint.get("raster-opacity")?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly,j.LESS),v=s.toUnwrapped(),w=c.getTile(s);if(n&&(!w||!w.hasData()))continue;const x=n?s.projMatrix:b.transform.calculateProjMatrix(v,r),y=b.terrain&&n?b.terrain.stencilModeForRTTOverlap(s):o[s.overscaledZ],z=h?0:d.paint.get("raster-fade-duration");w.registerFadeDuration(z);const A=c.findLoadedParent(s,0),B=bf(w,A,c,b.transform,z);let C,D;b.terrain&&b.terrain.prepareDrawTile(s);const E="nearest"===d.paint.get("raster-resampling")?j.NEAREST:j.LINEAR;i.activeTexture.set(j.TEXTURE0),w.texture.bind(E,j.CLAMP_TO_EDGE),i.activeTexture.set(j.TEXTURE1),A?(A.texture.bind(E,j.CLAMP_TO_EDGE),C=Math.pow(2,A.tileID.overscaledZ-w.tileID.overscaledZ),D=[w.tileID.canonical.x*C%1,w.tileID.canonical.y*C%1,]):w.texture.bind(E,j.CLAMP_TO_EDGE);const F=bD(x,D||[0,0],C||1,B,d,k instanceof R?k.perspectiveTransform:[0,0]);if(b.prepareDrawProgram(i,l,v),k instanceof R)l.draw(i,j.TRIANGLES,u,a.StencilMode.disabled,m,a.CullFaceMode.disabled,F,d.id,k.boundsBuffer,b.quadTriangleIndexBuffer,k.boundsSegments);else{const{tileBoundsBuffer:G,tileBoundsIndexBuffer:H,tileBoundsSegments:I}=b.getTileBoundsBuffers(w);l.draw(i,j.TRIANGLES,u,y,m,a.CullFaceMode.disabled,F,d.id,G,H,I)}}b.resetStencilClippingMasks()},background:function(b,c,d,f){const g=d.paint.get("background-color"),h=d.paint.get("background-opacity");if(0===h)return;const i=b.context,j=i.gl,k=b.transform,l=k.tileSize,m=d.paint.get("background-pattern");if(b.isPatternMissing(m))return;const n=!m&&1===g.a&&1===h&&b.opaquePassEnabledForLayer()?"opaque":"translucent";if(b.renderPass!==n)return;const o=a.StencilMode.disabled,p=b.depthModeForSublayer(0,"opaque"===n?a.DepthMode.ReadWrite:a.DepthMode.ReadOnly),q=b.colorModeForRenderPass(),r=b.useProgram(m?"backgroundPattern":"background");let s,u=f;u||(u=Object.values(s=b.getBackgroundTiles()).map(a=>a.tileID)),m&&(i.activeTexture.set(j.TEXTURE0),b.imageManager.bind(b.context));const v=d.getCrossfadeParameters();for(const w of u){const x=w.toUnwrapped(),y=f?w.projMatrix:b.transform.calculateProjMatrix(x);b.prepareDrawTile(w);const z=c?c.getTile(w):s?s[w.key]:new a.Tile(w,l,k.zoom,b),A=m?bJ(y,h,b,m,{tileID:w,tileSize:l},v):bI(y,h,g);b.prepareDrawProgram(i,r,x);const{tileBoundsBuffer:B,tileBoundsIndexBuffer:C,tileBoundsSegments:D}=b.getTileBoundsBuffers(z);r.draw(i,j.TRIANGLES,p,o,q,a.CullFaceMode.disabled,A,d.id,B,C,D)}},sky:function(b,c,d){const f=b.transform,g="mercator"===f.projection.name||"globe"===f.projection.name?1:a.smoothstep(7,8,f.zoom),h=d.paint.get("sky-opacity")*g;if(0===h)return;const i=b.context,j=d.paint.get("sky-type"),k=new a.DepthMode(i.gl.LEQUAL,a.DepthMode.ReadOnly,[0,1]),l=b.frameCounter/1e3%1;"atmosphere"===j?"offscreen"===b.renderPass?d.needsSkyboxCapture(b)&&(function(b,c,d,f){const g=b.context,h=g.gl;let i=c.skyboxFbo;if(!i){i=c.skyboxFbo=g.createFramebuffer(32,32,!1),c.skyboxGeometry=new b6(g),c.skyboxTexture=g.gl.createTexture(),h.bindTexture(h.TEXTURE_CUBE_MAP,c.skyboxTexture),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,h.LINEAR);for(let j=0;j<6;++j)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,h.RGBA,32,32,0,h.RGBA,h.UNSIGNED_BYTE,null)}g.bindFramebuffer.set(i.framebuffer),g.viewport.set([0,0,32,32,]);const k=c.getCenter(b,!0),l=b.useProgram("skyboxCapture"),m=new Float64Array(16);a.identity(m),a.rotateY(m,m,-(.5*Math.PI)),b7(g,c,l,m,k,0),a.identity(m),a.rotateY(m,m,.5*Math.PI),b7(g,c,l,m,k,1),a.identity(m),a.rotateX(m,m,-(.5*Math.PI)),b7(g,c,l,m,k,2),a.identity(m),a.rotateX(m,m,.5*Math.PI),b7(g,c,l,m,k,3),a.identity(m),b7(g,c,l,m,k,4),a.identity(m),a.rotateY(m,m,Math.PI),b7(g,c,l,m,k,5),g.viewport.set([0,0,b.width,b.height,])}(b,d),d.markSkyboxValid(b)):"sky"===b.renderPass&&function(b,c,d,f,g){var h,i;const j=b.context,k=j.gl,l=b.transform,m=b.useProgram("skybox");j.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_CUBE_MAP,c.skyboxTexture);const n=(h=l.skyboxMatrix,i=c.getCenter(b,!1),{u_matrix:h,u_sun_direction:i,u_cubemap:0,u_opacity:f,u_temporal_offset:g});b.prepareDrawProgram(j,m),m.draw(j,k.TRIANGLES,d,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,n,"skybox",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,d,k,h,l):"gradient"===j&&"sky"===b.renderPass&&function(b,c,d,f,g){var h,i,j,k,l;const m=b.context,n=m.gl,o=b.transform,p=b.useProgram("skyboxGradient");c.skyboxGeometry||(c.skyboxGeometry=new b6(m)),m.activeTexture.set(n.TEXTURE0);let q=c.colorRampTexture;q||(q=c.colorRampTexture=new a.Texture(m,c.colorRamp,n.RGBA)),q.bind(n.LINEAR,n.CLAMP_TO_EDGE);const r=(h=o.skyboxMatrix,i=c.getCenter(b,!1),j=c.paint.get("sky-gradient-radius"),k=f,l=g,{u_matrix:h,u_color_ramp:0,u_center_direction:i,u_radius:a.degToRad(j),u_opacity:k,u_temporal_offset:l});b.prepareDrawProgram(m,p),p.draw(m,n.TRIANGLES,d,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,r,"skyboxGradient",c.skyboxGeometry.vertexBuffer,c.skyboxGeometry.indexBuffer,c.skyboxGeometry.segment)}(b,d,k,h,l)},debug:function(a,b,c){for(let d=0;db.getOpacity(this.transform.pitch)||.03>b.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[c,d]=b.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const f=c+.78*(d-c);this.transform.fogCullDistSq=f*f}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(b,c){if(this.width=b*a.exported.devicePixelRatio,this.height=c*a.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const d of this.style.order)this.style._layers[d].resize()}setup(){const b=this.context,c=new a.StructArrayLayout2i4;c.emplaceBack(0,0),c.emplaceBack(a.EXTENT,0),c.emplaceBack(0,a.EXTENT),c.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=b.createVertexBuffer(c,a.posAttributes.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.StructArrayLayout2i4;d.emplaceBack(0,0),d.emplaceBack(a.EXTENT,0),d.emplaceBack(0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=b.createVertexBuffer(d,a.posAttributes.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const f=new a.StructArrayLayout2i4;f.emplaceBack(-1,-1),f.emplaceBack(1,-1),f.emplaceBack(-1,1),f.emplaceBack(1,1),this.viewportBuffer=b.createVertexBuffer(f,a.posAttributes.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const g=new a.StructArrayLayout4i8;g.emplaceBack(0,0,0,0),g.emplaceBack(a.EXTENT,0,a.EXTENT,0),g.emplaceBack(0,a.EXTENT,0,a.EXTENT),g.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.mercatorBoundsBuffer=b.createVertexBuffer(g,a.boundsAttributes.members),this.mercatorBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const h=new a.StructArrayLayout3ui6;h.emplaceBack(0,1,2),h.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=b.createIndexBuffer(h);const i=new a.StructArrayLayout1ui2;for(const j of[0,1,3,2,0])i.emplaceBack(j);this.debugIndexBuffer=b.createIndexBuffer(i),this.emptyTexture=new a.Texture(b,{width:1,height:1,data:new Uint8Array([0,0,0,0])},b.gl.RGBA),this.identityMat=a.create();const k=this.context.gl;this.stencilClearMode=new a.StencilMode({func:k.ALWAYS,mask:0},0,255,k.ZERO,k.ZERO,k.ZERO),this.loadTimeStamps.push(a.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(a){return a._makeTileBoundsBuffers(this.context,this.transform.projection),a._tileBoundsBuffer?{tileBoundsBuffer:a._tileBoundsBuffer,tileBoundsIndexBuffer:a._tileBoundsIndexBuffer,tileBoundsSegments:a._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const b=this.context,c=b.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(b,c.TRIANGLES,a.DepthMode.disabled,this.stencilClearMode,a.ColorMode.disabled,a.CullFaceMode.disabled,be(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(b,c,d){if(!c||this.currentStencilSource===c.id||!b.isTileClipped()||!d||0===d.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let f=!1;for(const g of d)if(void 0===this._tileClippingMaskIDs[g.key]){f=!0;break}if(!f)return}this.currentStencilSource=c.id;const h=this.context,i=h.gl;this.nextStencilID+d.length>256&&this.clearStencil(),h.setColorMode(a.ColorMode.disabled),h.setDepthMode(a.DepthMode.disabled);const j=this.useProgram("clippingMask");for(const k of(this._tileClippingMaskIDs={},d)){const l=c.getTile(k),m=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,{tileBoundsBuffer:n,tileBoundsIndexBuffer:o,tileBoundsSegments:p}=this.getTileBoundsBuffers(l);j.draw(h,i.TRIANGLES,a.DepthMode.disabled,new a.StencilMode({func:i.ALWAYS,mask:0},m,255,i.KEEP,i.KEEP,i.REPLACE),a.ColorMode.disabled,a.CullFaceMode.disabled,be(k.projMatrix),"$clipping",n,o,p)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const b=this.nextStencilID++,c=this.context.gl;return new a.StencilMode({func:c.NOTEQUAL,mask:255},b,255,c.KEEP,c.KEEP,c.REPLACE)}stencilModeForClipping(b){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(b);const c=this.context.gl;return new a.StencilMode({func:c.EQUAL,mask:255},this._tileClippingMaskIDs[b.key],0,c.KEEP,c.KEEP,c.REPLACE)}stencilConfigForOverlap(b){const c=this.context.gl,d=b.sort((a,b)=>b.overscaledZ-a.overscaledZ),f=d[d.length-1].overscaledZ,g=d[0].overscaledZ-f+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const h={};for(let i=0;i=0;this.currentLayer--){const u=this.style._layers[d[this.currentLayer]],v=b._getLayerSourceCache(u);if(u.isSky())continue;const w=v?j[v.id]:void 0;this._renderTileClippingMasks(u,v,w),this.renderLayer(this,v,u,w)}if(this.renderPass="sky",(a.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const c=b._getLayerSourceCache(a);c&&!a.isHidden(this.transform.zoom)&&(!C||C.getSource().maxzoom0?b.pop():null}isPatternMissing(a){if(!a)return!1;if(!a.from||!a.to)return!0;const b=this.imageManager.getPattern(a.from.toString()),c=this.imageManager.getPattern(a.to.toString());return!b||!c}currentGlobalDefines(){const a=this.terrain&&this.terrain.renderingToTexture,b=this.style&&this.style.fog,c=[];return this.terrain&&!this.terrain.renderingToTexture&&c.push("TERRAIN"),b&&!a&&0!==b.getOpacity(this.transform.pitch)&&c.push("FOG"),a&&c.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&c.push("OVERDRAW_INSPECTOR"),c}useProgram(a,b,c){this.cache=this.cache||{};const d=this.currentGlobalDefines().concat(c||[]),f=bl.cacheKey(a,d,b);return this.cache[f]||(this.cache[f]=new bl(this.context,a,a1[a],b,bK[a],d)),this.cache[f]}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 a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(a.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=a.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.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()}prepareDrawTile(a){this.terrain&&this.terrain.prepareDrawTile(a)}prepareDrawProgram(a,b,c){if(this.terrain&&this.terrain.renderingToTexture)return;const d=this.style.fog;if(d){const f=d.getOpacity(this.transform.pitch);0!==f&&b.setFogUniformValues(a,((a,b,c,d)=>{const f=b.properties.get("color"),g=a.frameCounter/1e3%1,h=[f.r/f.a,f.g/f.a,f.b/f.a,d,];return{u_fog_matrix:c?a.transform.calculateFogTileMatrix(c):a.identityMat,u_fog_range:b.getFovAdjustedRange(a.transform._fov),u_fog_color:h,u_fog_horizon_blend:b.properties.get("horizon-blend"),u_fog_temporal_offset:g}})(this,d,c,f))}}setTileLoadedFlag(a){this.tileLoaded=a}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const a=this.context.gl,b=a.createTexture();return a.bindTexture(a.TEXTURE_2D,b),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,a.drawingBufferWidth,a.drawingBufferHeight,0),b}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const a=this.style&&this.style.fog;return!!a&&0!==a.getOpacity(this.transform.pitch)}getBackgroundTiles(){const b=this._backgroundTiles,c=this._backgroundTiles={},d=this.transform.coveringTiles({tileSize:512});for(const f of d)c[f.key]=b[f.key]||new a.Tile(f,512,this.transform.tileZoom,this);return c}clearBackgroundTiles(){this._backgroundTiles={}}}class ca{constructor(a=0,b=0,c=0,d=0){if(isNaN(a)||a<0||isNaN(b)||b<0||isNaN(c)||c<0||isNaN(d)||d<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=b,this.left=c,this.right=d}interpolate(b,c,d){return null!=c.top&&null!=b.top&&(this.top=a.number(b.top,c.top,d)),null!=c.bottom&&null!=b.bottom&&(this.bottom=a.number(b.bottom,c.bottom,d)),null!=c.left&&null!=b.left&&(this.left=a.number(b.left,c.left,d)),null!=c.right&&null!=b.right&&(this.right=a.number(b.right,c.right,d)),this}getCenter(b,c){const d=a.clamp((this.left+b-this.right)/2,0,b),f=a.clamp((this.top+c-this.bottom)/2,0,c);return new a.pointGeometry(d,f)}equals(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right}clone(){return new ca(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function cb(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function cc(b,c){a.setColumn(b,3,[c[0],c[1],c[2],1])}function cd(b,c){const d=a.identity$1([]);return a.rotateZ$1(d,d,-c),a.rotateX$1(d,d,-b),d}function ce(b,c){const d=[b[0],b[1],0],f=[c[0],c[1],0];if(a.length(d)>=1e-15){const g=a.normalize([],d);a.scale$2(f,g,a.dot(f,g)),c[0]=f[0],c[1]=f[1]}const h=a.cross([],c,b);if(1e-15>a.len(h))return null;const i=Math.atan2(-h[1],h[0]);return cd(Math.atan2(Math.sqrt(b[0]*b[0]+b[1]*b[1]),-b[2]),i)}class cf{constructor(a,b){this.position=a,this.orientation=b}get position(){return this._position}set position(b){this._position=this._renderWorldCopies?function(b){if(!b)return;const c=Array.isArray(b)?new a.MercatorCoordinate(b[0],b[1],b[2]):b;return c.x=a.wrap(c.x,0,1),c}(b):b}lookAtPoint(b,c){if(this.orientation=null,!this.position)return;const d=this._elevation?this._elevation.getAtPointOrZero(a.MercatorCoordinate.fromLngLat(b)):0,f=this.position,g=a.MercatorCoordinate.fromLngLat(b,d),h=[g.x-f.x,g.y-f.y,g.z-f.z];c||(c=[0,0,1]),c[2]=Math.abs(c[2]),this.orientation=ce(h,c)}setPitchBearing(b,c){this.orientation=cd(a.degToRad(b),a.degToRad(-c))}}class cg{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,cb(this._transform,this._orientation)),b&&cc(this._transform,b)}get mercatorPosition(){const b=this.position;return new a.MercatorCoordinate(b[0],b[1],b[2])}get position(){const b=a.getColumn(this._transform,3);return[b[0],b[1],b[2]]}set position(a){cc(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,cb(this._transform,this._orientation)}getPitchBearing(){const a=this.forward(),b=this.right();return{bearing:Math.atan2(-b[1],b[0]),pitch:Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2])}}setPitchBearing(a,b){this._orientation=cd(a,b),cb(this._transform,this._orientation)}forward(){const b=a.getColumn(this._transform,2);return[-b[0],-b[1],-b[2]]}up(){const b=a.getColumn(this._transform,1);return[-b[0],-b[1],-b[2]]}right(){const b=a.getColumn(this._transform,0);return[b[0],b[1],b[2]]}getCameraToWorld(b,c){const d=new Float64Array(16);return a.invert(d,this.getWorldToCamera(b,c)),d}getWorldToCameraPosition(b,c,d){const f=this.position;a.scale$2(f,f,-b);const g=new Float64Array(16);return a.fromScaling(g,[d,d,d]),a.translate(g,g,f),g[10]*=c,g}getWorldToCamera(b,c){const d=new Float64Array(16),f=new Float64Array(4),g=this.position;return a.conjugate(f,this._orientation),a.scale$2(g,g,-b),a.fromQuat(d,f),a.translate(d,d,g),d[1]*=-1,d[5]*=-1,d[9]*=-1,d[13]*=-1,d[8]*=c,d[9]*=c,d[10]*=c,d[11]*=c,d}getCameraToClipPerspective(b,c,d,f){const g=new Float64Array(16);return a.perspective(g,b,c,d,f),g}getDistanceToElevation(b){const c=0===b?0:a.mercatorZfromAltitude(b,this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new cg([...this.position],[...this.orientation])}}function ch(b,c){const d=cj(b),f=function(b,c,d,f,g){const h=new a.LngLat(d.lng-180*ck,d.lat),i=new a.LngLat(d.lng+180*ck,d.lat),j=b.project(h.lng,h.lat),k=b.project(i.lng,i.lat),l=-Math.atan2(k.y-j.y,k.x-j.x),m=a.MercatorCoordinate.fromLngLat(d);m.y=a.clamp(m.y,-.999975,.999975);const n=m.toLngLat(),o=b.project(n.lng,n.lat),p=a.MercatorCoordinate.fromLngLat(n);p.x+=ck;const q=p.toLngLat(),r=b.project(q.lng,q.lat),s=cm(r.x-o.x,r.y-o.y,l),u=a.MercatorCoordinate.fromLngLat(n);u.y+=ck;const v=u.toLngLat(),w=b.project(v.lng,v.lat),x=cm(w.x-o.x,w.y-o.y,l),y=Math.abs(s.x)/Math.abs(x.y),z=a.identity([]);a.rotateZ(z,z,-l*(1-(g?0:f)));const A=a.identity([]);return a.scale(A,A,[1,1-(1-y)*f,1]),A[4]=-x.x/x.y*f,a.rotateZ(A,A,l),a.multiply$1(A,z,A),A}(b.projection,0,b.center,d,c),g=ci(b);return a.scale(f,f,[g,g,1]),f}function ci(b){const c=b.projection,d=cj(b),f=cl(c,b.center),g=cl(c,a.LngLat.convert(c.center));return Math.pow(2,f*d+(1-d)*g)}function cj(b){const c=b.projection.range;if(!c)return 0;const d=Math.max(b.width,b.height),f=Math.log(d/1024)/Math.LN2;return a.smoothstep(c[0]+f,c[1]+f,b.zoom)}const ck=1/4e4;function cl(b,c){const d=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),f=new a.LngLat(c.lng-180*ck,d),g=new a.LngLat(c.lng+180*ck,d),h=b.project(f.lng,d),i=b.project(g.lng,d),j=a.MercatorCoordinate.fromLngLat(f),k=a.MercatorCoordinate.fromLngLat(g),l=i.x-h.x,m=i.y-h.y,n=k.x-j.x,o=k.y-j.y,p=Math.sqrt((n*n+o*o)/(l*l+m*m));return Math.log(p)/Math.LN2}function cm(a,b,c){const d=Math.cos(c),f=Math.sin(c);return{x:a*d-b*f,y:a*f+b*d}}class cn{constructor(b,c,d,f,g){this.tileSize=512,this._renderWorldCopies=void 0===g||g,this._minZoom=b||0,this._maxZoom=c||22,this._minPitch=null==d?0:d,this._maxPitch=null==f?60:f,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.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 ca,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new cg,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new cn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.setProjection(this.getProjection()),a._elevation=this._elevation,a._centerAltitude=this._centerAltitude,a.tileSize=this.tileSize,a.setMaxBounds(this.getMaxBounds()),a.width=this.width,a.height=this.height,a.cameraElevationReference=this.cameraElevationReference,a._center=this._center,a._setZoom(this.zoom),a._cameraZoom=this._cameraZoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._nearZ=this._nearZ,a._farZ=this._farZ,a._averageElevation=this._averageElevation,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._camera=this._camera.clone(),a._calcMatrices(),a.freezeTileCoverage=this.freezeTileCoverage,a}get elevation(){return this._elevation}set elevation(a){this._elevation!==a&&(this._elevation=a,a?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(a){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),a&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return a.pick(this.projection,["name","center","parallels",])}setProjection(b){null==b&&(b={name:"mercator"}),this.projectionOptions=b;const c=this.projection?this.getProjection():void 0;return this.projection=a.getProjection(b),!g(c,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))}get maxZoom(){return this._maxZoom}set maxZoom(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))}get minPitch(){return this._minPitch}set minPitch(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))}get maxPitch(){return this._maxPitch}set maxPitch(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))}get renderWorldCopies(){return this._renderWorldCopies&& !0===this.projection.supportsWorldCopies}set renderWorldCopies(a){void 0===a?a=!0:null===a&&(a=!1),this._renderWorldCopies=a}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const a=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(a))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.cameraWorldSize)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return a.wrap(this.rotation,-180,180)}set bearing(a){this.rotation=a}get rotation(){return-this.angle/Math.PI*180}set rotation(b){var c,d,f,g,h,i,j,k,l,m;const n=-b*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(c=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(c[1]=0,c[2]=0),c[0]=1,c[3]=1,c),d=this.rotationMatrix,f=this.rotationMatrix,g=this.angle,h=f[0],i=f[1],j=f[2],k=f[3],l=Math.sin(g),m=Math.cos(g),d[0]=h*m+j*l,d[1]=i*m+k*l,d[2]=-(h*l)+j*m,d[3]=-(i*l)+k*m)}get pitch(){return this._pitch/Math.PI*180}set pitch(b){const c=a.clamp(b,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==c&&(this._unmodified=!1,this._pitch=c,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(a){this._averageElevation=a,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(a){const b=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==b&&(this._unmodified=!1,this._setZoom(b),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(a){this._zoom=a,this.scale=this.zoomScale(a),this.tileZoom=Math.floor(a),this.zoomFraction=a-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===a?(this._cameraZoom=null,!1):(this._centerAltitude=a,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const b=this._elevation,c=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],d=this.horizonLineFromTop();let f=0,g=0;for(let h=0;hb.maxzoom&&(c=b.maxzoom);const h=this.locationCoordinate(this.center),i=1<{const c=1/4e4,d=new a.MercatorCoordinate(b.x+c,b.y,b.z),f=new a.MercatorCoordinate(b.x,b.y+c,b.z),g=b.toLngLat(),h=d.toLngLat(),i=f.toLngLat(),j=this.locationCoordinate(g),k=this.locationCoordinate(h),l=this.locationCoordinate(i),m=Math.hypot(k.x-j.x,k.y-j.y),n=Math.hypot(l.x-j.x,l.y-j.y);return Math.sqrt(m*n)*u/c},w=b=>{const c=r,d=s;return{aabb:a.tileAABB(this,i,0,0,0,b,d,c,this.projection),zoom:0,x:0,y:0,minZ:d,maxZ:c,wrap:b,fullyVisible:!1}},x=[];let y=[];const z=c,A=b.reparseOverscaled?d:c,B=a=>a*a,C=B((n-this._centerAltitude)*m),D=a=>{if(!this._elevation||!a.tileID||!g)return;const b=this._elevation.getMinMaxForTile(a.tileID),c=a.aabb;b?(c.min[2]=b.min,c.max[2]=b.max,c.center[2]=(c.min[2]+c.max[2])/2):(a.shouldSplit=E(a),a.shouldSplit||(c.min[2]=c.max[2]=c.center[2]=this._centerAltitude))},E=b=>{if(b.zoom.85?1:k}const l=c*c+g*g+h;return l{if(b*B(.707)0;){const G=x.pop(),H=G.x,I=G.y;let J=G.fullyVisible;if(!J){const K=G.aabb.intersects(k);if(0===K)continue;J=2===K}if(G.zoom!==z&&E(G))for(let L=0;L<4;L++){const M=(H<<1)+L%2,N=(I<<1)+(L>>1),O={aabb:g?G.aabb.quadrant(L):a.tileAABB(this,i,G.zoom+1,M,N,G.wrap,G.minZ,G.maxZ,this.projection),zoom:G.zoom+1,x:M,y:N,wrap:G.wrap,fullyVisible:J,tileID:void 0,shouldSplit:void 0,minZ:G.minZ,maxZ:G.maxZ};f&&(O.tileID=new a.OverscaledTileID(G.zoom+1===z?A:G.zoom+1,G.wrap,G.zoom+1,M,N),D(O)),x.push(O)}else{const P=G.zoom===z?A:G.zoom;if(b.minzoom&&b.minzoom>P)continue;const Q=j[0]-(.5+H+(G.wrap<{const d=[0,0,0,1],f=[a.EXTENT,a.EXTENT,0,1],g=this.calculateFogTileMatrix(c.tileID.toUnwrapped());a.transformMat4$1(d,d,g),a.transformMat4$1(f,f,g);const h=a.getAABBPointSquareDist(d,f);if(0===h)return!0;let i=!1;const j=this._elevation;if(j&&h>T&&0!==U){const k=this.calculateProjMatrix(c.tileID.toUnwrapped());let l;b.isTerrainDEM||(l=j.getMinMaxForTile(c.tileID)),l||(l={min:s,max:r});const m=a.furthestTileCorner(this.rotation),n=[m[0]*a.EXTENT,m[1]*a.EXTENT,l.max,];a.transformMat4(n,n,k),i=(1-n[1])*this.height*.5a.distanceSq-b.distanceSq).map(a=>a.tileID)}resize(a,b){this.width=a,this.height=b,this.pixelsToGLUnits=[2/a,-2/b],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(a){return Math.pow(2,a)}scaleZoom(a){return Math.log(a)/Math.LN2}project(b){const c=a.clamp(b.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),d=this.projection.project(b.lng,c);return new a.pointGeometry(d.x*this.worldSize,d.y*this.worldSize)}unproject(a){return this.projection.unproject(a.x/this.worldSize,a.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(b,c){const d=this.pointCoordinate(c),f=this.pointCoordinate(this.centerPoint),g=this.locationCoordinate(b);this.setLocation(new a.MercatorCoordinate(g.x-(d.x-f.x),g.y-(d.y-f.y)))}setLocation(a){this.center=this.coordinateLocation(a),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(a){return this.projection.locationPoint(this,a)}locationPoint3D(a){return this._coordinatePoint(this.locationCoordinate(a),!0)}pointLocation(a){return this.coordinateLocation(this.pointCoordinate(a))}pointLocation3D(a){return this.coordinateLocation(this.pointCoordinate3D(a))}locationCoordinate(b,c){const d=c?a.mercatorZfromAltitude(c,b.lat):void 0,f=this.projection.project(b.lng,b.lat);return new a.MercatorCoordinate(f.x,f.y,d)}coordinateLocation(a){return this.projection.unproject(a.x,a.y)}pointRayIntersection(b,c){const d=null!=c?c:this._centerAltitude,f=[b.x,b.y,0,1],g=[b.x,b.y,1,1];a.transformMat4$1(f,f,this.pixelMatrixInverse),a.transformMat4$1(g,g,this.pixelMatrixInverse);const h=g[3];a.scale$1(f,f,1/f[3]),a.scale$1(g,g,1/h);const i=f[2],j=g[2];return{p0:f,p1:g,t:i===j?0:(d-i)/(j-i)}}screenPointToMercatorRay(b){const c=[b.x,b.y,0,1],d=[b.x,b.y,1,1];return a.transformMat4$1(c,c,this.pixelMatrixInverse),a.transformMat4$1(d,d,this.pixelMatrixInverse),a.scale$1(c,c,1/c[3]),a.scale$1(d,d,1/d[3]),c[2]=a.mercatorZfromAltitude(c[2],this._center.lat)*this.worldSize,d[2]=a.mercatorZfromAltitude(d[2],this._center.lat)*this.worldSize,a.scale$1(c,c,1/this.worldSize),a.scale$1(d,d,1/this.worldSize),new a.Ray([c[0],c[1],c[2]],a.normalize([],a.sub([],d,c)))}rayIntersectionCoordinate(b){const{p0:c,p1:d,t:f}=b,g=a.mercatorZfromAltitude(c[2],this._center.lat),h=a.mercatorZfromAltitude(d[2],this._center.lat);return new a.MercatorCoordinate(a.number(c[0],d[0],f)/this.worldSize,a.number(c[1],d[1],f)/this.worldSize,a.number(g,h,f))}pointCoordinate(a,b=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(a.x,a.y,b)}pointCoordinate3D(b){if(!this.elevation)return this.pointCoordinate(b);const c=this.elevation;let d=this.elevation.pointCoordinate(b);if(d)return new a.MercatorCoordinate(d[0],d[1],d[2]);let f=0,g=this.horizonLineFromTop();if(b.y>g)return this.pointCoordinate(b);const h=.02*g,i=b.clone();for(let j=0;j<10&&g-f>h;j++){i.y=a.number(f,g,.66);const k=c.pointCoordinate(i);k?(g=i.y,d=k):f=i.y}return d?new a.MercatorCoordinate(d[0],d[1],d[2]):this.pointCoordinate(b)}isPointAboveHorizon(a){if(this.elevation)return!this.elevation.pointCoordinate(a);{const b=this.horizonLineFromTop();return a.y0?new a.pointGeometry(f[0]/f[3],f[1]/f[3]):new a.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(b,c){var d,f,g,h,i,j,k,l;const m=new a.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),n=new a.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),o=new a.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),p=new a.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let q=this.pointCoordinate(m,b),r=this.pointCoordinate(n,b);const s=this.pointCoordinate(o,c),u=this.pointCoordinate(p,c);return q.y>1&&r.y>=0?q=new a.MercatorCoordinate((1-u.y)/(d=u,((f=q).y-d.y)/(f.x-d.x))+u.x,1):q.y<0&&r.y<=1&&(q=new a.MercatorCoordinate(-u.y/(g=u,((h=q).y-g.y)/(h.x-g.x))+u.x,0)),r.y>1&&q.y>=0?r=new a.MercatorCoordinate((1-s.y)/(i=s,((j=r).y-i.y)/(j.x-i.x))+s.x,1):r.y<0&&q.y<=1&&(r=new a.MercatorCoordinate(-s.y/(k=s,((l=r).y-k.y)/(l.x-k.x))+s.x,0)),new a.LngLatBounds().extend(this.coordinateLocation(q)).extend(this.coordinateLocation(r)).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(s))}_getBounds3D(){const a=this.elevation;if(!a.visibleDemTiles.length)return this._getBounds(0,0);const b=a.visibleDemTiles.reduce((a,b)=>{if(b.dem){const c=b.dem.tree;a.min=Math.min(a.min,c.minimums[0]),a.max=Math.max(a.max,c.maximums[0])}return a},{min:Number.MAX_VALUE,max:0});return this._getBounds(b.min*a.exaggeration(),b.max*a.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(a=!0){const b=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,c=this.height/2-b*(1-this._horizonShift);return a?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(b){this.maxBounds=b,this.minLat=-a.MAX_MERCATOR_LATITUDE,this.maxLat=a.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,b&&(this.minLat=b.getSouth(),this.maxLat=b.getNorth(),this.minLng=b.getWest(),this.maxLng=b.getEast(),this.maxLngm&&(i=m-k),m-lo&&(h=o-j),o-n.5?w-1:w,x>.5?x-1:x,0,]),this.alignedProjMatrix=y,i=a.create(),a.scale(i,i,[this.width/2,-this.height/2,1,]),a.translate(i,i,[1,-1,0]),this.labelPlaneMatrix=i,i=a.create(),a.scale(i,i,[1,-1,1]),a.translate(i,i,[-1,-1,0]),a.scale(i,i,[2/this.width,2/this.height,1,]),this.glCoordMatrix=i,this.pixelMatrix=a.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},i=a.invert(new Float64Array(16),this.pixelMatrix),!i)throw Error("failed to invert matrix");this.pixelMatrixInverse=i,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const b=this.cameraWorldSize,c=this.cameraPixelsPerMeter,d=this._camera.position,f=1/this.height,g=[b,b,c];a.scale$2(g,g,f),a.scale$2(d,d,-1),a.multiply$2(d,d,g);const h=a.create();a.translate(h,h,d),a.scale(h,h,g),this.mercatorFogMatrix=h,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(b,c,f)}_computeCameraPosition(a){const b=(a=a||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,f=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*b-a/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*f,d.y/this.worldSize-c[1]*f,a/this.worldSize*this._centerAltitude-c[2]*f,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(b){const c=this._maxCameraBoundsDistance()*Math.cos(this._pitch),d=b[2];let f=1;d>0&&(f=Math.min((c-this._camera.position[2])/d,1)),this._camera.position=a.scaleAndAdd([],this._camera.position,b,f),this._updateStateFromCamera()}_updateStateFromCamera(){const b=this._camera.position,c=this._camera.forward(),{pitch:d,bearing:f}=this._camera.getPitchBearing(),g=a.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,h=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.degToRad(this._maxPitch)),i=Math.max((b[2]-g)/Math.cos(d),h),j=this._zoomFromMercatorZ(i);a.scaleAndAdd(b,b,c,i),this._pitch=a.clamp(d,a.degToRad(this.minPitch),a.degToRad(this.maxPitch)),this.angle=a.wrap(f,-Math.PI,Math.PI),this._setZoom(a.clamp(j,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new a.MercatorCoordinate(b[0],b[1],b[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(a){return Math.pow(2,a)*this.tileSize}_mercatorZfromZoom(a){return this.cameraToCenterDistance/this._worldSizeFromZoom(a)}_minimumHeightOverTerrain(){const a=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(a)}_zoomFromMercatorZ(a){return this.scaleZoom(this.cameraToCenterDistance/(a*this.tileSize))}_terrainEnabled(){return!(!this._elevation|| !this.projection.supportsTerrain&&(a.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(b,c){const d=Math.min(b.x,c.x),f=Math.max(b.x,c.x),g=Math.min(b.y,c.y),h=Math.max(b.y,c.y);if(gk||n.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.pointGeometry(0,0),new a.pointGeometry(this.width,this.height))}zoomDeltaToMovement(b,c){const d=a.length(a.sub([],this._camera.position,b)),f=this._zoomFromMercatorZ(d)+c;return d-this._mercatorZfromZoom(f)}getCameraPoint(){const b=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,b))}}function co(a,b){let c=!1,d=null;const f=()=>{d=null,c&&(a(),d=setTimeout(f,b),c=!1)};return()=>(c=!0,d||f(),d)}const cp={linearity:.3,easing:a.bezier(0,0,.3,1)},cq=a.extend({deceleration:2500,maxSpeed:1400},cp),cr=a.extend({deceleration:20,maxSpeed:1400},cp),cs=a.extend({deceleration:1e3,maxSpeed:360},cp),ct=a.extend({deceleration:1e3,maxSpeed:90},cp);function cu(a,b){(!a.duration||a.durationc.unproject(a)),j=g.reduce((a,b,c,d)=>a.add(b.div(d.length)),new a.pointGeometry(0,0));super(b,{points:g,point:j,lngLats:i,lngLat:c.unproject(j),originalEvent:d}),this._defaultPrevented=!1}}class cy extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,b,c){super(a,{originalEvent:c}),this._defaultPrevented=!1}}class cz{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cy(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cw(a.type,this._map,a))}mouseup(a){this._map.fire(new cw(a.type,this._map,a))}preclick(b){const c=a.extend({},b);c.type="preclick",this._map.fire(new cw(c.type,this._map,c))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cw(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cw(a.type,this._map,a))}mouseover(a){this._map.fire(new cw(a.type,this._map,a))}mouseout(a){this._map.fire(new cw(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cx(a.type,this._map,a))}touchmove(a){this._map.fire(new cx(a.type,this._map,a))}touchend(a){this._map.fire(new cx(a.type,this._map,a))}touchcancel(a){this._map.fire(new cx(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cA{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cw(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cw("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cw(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cB{constructor(a,b){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=b.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(a,b){this.isEnabled()&&a.shiftKey&&0===a.button&&(h.disableDrag(),this._startPos=this._lastPos=b,this._active=!0)}mousemoveWindow(a,b){if(!this._active)return;const c=b;if(this._lastPos.equals(c)|| !this._box&&c.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${f}px,${i}px)`,this._box.style.width=g-f+"px",this._box.style.height=j-i+"px")})}mouseupWindow(b,c){if(!this._active||0!==b.button)return;const d=this._startPos,f=c;if(this.reset(),h.suppressClick(),d.x!==f.x||d.y!==f.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:b})),{cameraAnimation:a=>a.fitScreenCoordinates(d,f,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",b)}keydown(a){this._active&&27===a.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",a))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),h.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(b,c){return this._map.fire(new a.Event(b,{originalEvent:c}))}}function cC(a,b){const c={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=b.timeStamp),d.length===this.numTouches&&(this.centroid=function(b){const c=new a.pointGeometry(0,0);for(const d of b)c._add(d);return c.div(b.length)}(c),this.touches=cC(d,c)))}touchmove(a,b,c){if(this.aborted||!this.centroid)return;const d=cC(c,b);for(const f in this.touches){const g=this.touches[f],h=d[f];(!h||h.dist(g)>30)&&(this.aborted=!0)}}touchend(a,b,c){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),0===c.length){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}(b),this.numTaps=b.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(a,b,c){this.singleTap.touchstart(a,b,c)}touchmove(a,b,c){this.singleTap.touchmove(a,b,c)}touchend(a,b,c){const d=this.singleTap.touchend(a,b,c);if(d){const f=a.timeStamp-this.lastTime<500,g=!this.lastTap||30>this.lastTap.dist(d);if(f&&g||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class cE{constructor(){this._zoomIn=new cD({numTouches:1,numTaps:2}),this._zoomOut=new cD({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(a,b,c){this._zoomIn.touchstart(a,b,c),this._zoomOut.touchstart(a,b,c)}touchmove(a,b,c){this._zoomIn.touchmove(a,b,c),this._zoomOut.touchmove(a,b,c)}touchend(a,b,c){const d=this._zoomIn.touchend(a,b,c),f=this._zoomOut.touchend(a,b,c);return d?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()+1,around:b.unproject(d)},{originalEvent:a})}):f?(this._active=!0,a.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:b.getZoom()-1,around:b.unproject(f)},{originalEvent:a})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cF={0:1,2:2};class cG{constructor(a){this.reset(),this._clickTolerance=a.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(a,b){return!1}_move(a,b){return{}}mousedown(a,b){if(this._lastPoint)return;const c=h.mouseButton(a);this._correctButton(a,c)&&(this._lastPoint=b,this._eventButton=c)}mousemoveWindow(a,b){const c=this._lastPoint;if(c){if(a.preventDefault(),function(a,b){const c=cF[b];return void 0===a.buttons||(a.buttons&c)!==c}(a,this._eventButton))this.reset();else if(this._moved||!(b.dist(c)0&&(this._active=!0);const f=cC(d,c),g=new a.pointGeometry(0,0),h=new a.pointGeometry(0,0);let i=0;for(const j in f){const k=f[j],l=this._touches[j];l&&(g._add(k),h._add(k.sub(l)),i++,f[j]=k)}if(this._touches=f,i{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class cL{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(a){}_move(a,b,c){return{}}touchstart(a,b,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier,],this._start([b[0],b[1]]))}touchmove(a,b,c){if(!this._firstTwoTouches)return;a.preventDefault();const[d,f]=this._firstTwoTouches,g=cM(c,b,d),h=cM(c,b,f);if(!g||!h)return;const i=this._aroundCenter?null:g.add(h).div(2);return this._move([g,h],i,a)}touchend(a,b,c){if(!this._firstTwoTouches)return;const[d,f]=this._firstTwoTouches,g=cM(c,b,d),i=cM(c,b,f);g&&i||(this._active&&h.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(a){this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function cM(a,b,c){for(let d=0;dMath.abs(cN(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cN(this._distance,c),pinchAround:b}}}function cP(a,b){return 180*a.angleWith(b)/Math.PI}class cQ extends cL{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(a){this._startVector=this._vector=a[0].sub(a[1]),this._minDiameter=a[0].dist(a[1])}_move(a,b){const c=this._vector;if(this._vector=a[0].sub(a[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:cP(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cP(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cS extends cL{constructor(a){super(),this._map=a}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(a){this._lastPoints=a,cR(a[0].sub(a[1]))&&(this._valid=!1)}_move(a,b,c){const d=a[0].sub(this._lastPoints[0]),f=a[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&c.touches.length<3)&&(this._valid=this.gestureBeginsVertically(d,f,c.timeStamp),this._valid))return this._lastPoints=a,this._active=!0,{pitchDelta:-((d.y+f.y)/2*.5)}}gestureBeginsVertically(a,b,c){if(void 0!==this._valid)return this._valid;const d=a.mag()>=2,f=b.mag()>=2;if(!d&&!f)return;if(!d||!f)return void 0===this._firstMove&&(this._firstMove=c),c-this._firstMove<100&&void 0;const g=a.y>0==b.y>0;return cR(a)&&cR(b)&&g}}class cT{constructor(){const a={panStep:100,bearingStep:15,pitchStep:10};this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(a){if(a.altKey||a.ctrlKey||a.metaKey)return;let b=0,c=0,d=0,f=0,g=0;switch(a.keyCode){case 61:case 107:case 171:case 187:b=1;break;case 189:case 109:case 173:b=-1;break;case 37:a.shiftKey?c=-1:(a.preventDefault(),f=-1);break;case 39:a.shiftKey?c=1:(a.preventDefault(),f=1);break;case 38:a.shiftKey?d=1:(a.preventDefault(),g=-1);break;case 40:a.shiftKey?d=-1:(a.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:h=>{const i=h.getZoom();h.easeTo({duration:300,easeId:"keyboardHandler",easing:cU,zoom:b?Math.round(i)+b*(a.shiftKey?2:1):i,bearing:h.getBearing()+c*this._bearingStep,pitch:h.getPitch()+d*this._pitchStep,offset:[-f*this._panStep,-g*this._panStep,],center:h.getCenter()},{originalEvent:a})}}}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 cU(a){return a*(2-a)}const cV=4.000244140625;class cW{constructor(b,c){this._map=b,this._el=b.getCanvasContainer(),this._handler=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(a){this._defaultZoomRate=a}setWheelZoomRate(a){this._wheelZoomRate=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active|| void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!a&&"center"===a.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(b){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(b.ctrlKey||b.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let c=b.deltaMode===a.window.WheelEvent.DOM_DELTA_LINE?40*b.deltaY:b.deltaY;const d=a.exported.now(),f=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,0!==c&&c%cV==0?this._type="wheel":0!==c&&4>Math.abs(c)?this._type="trackpad":f>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,b)):this._type||(this._type=200>Math.abs(f*c)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),b.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=b,this._delta-=c,this._active||this._start(b)),b.preventDefault()}_onTimeout(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)}_start(a){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 b=h.mousePos(this._el,a);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:b,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const b=this._map.transform,c=()=>b._terrainEnabled()&&this._aroundCoord?b.computeZoomRelativeTo(this._aroundCoord):b.zoom;if(0!==this._delta){const d="wheel"===this._type&&Math.abs(this._delta)>cV?this._wheelZoomRate:this._defaultZoomRate;let f=2/(1+Math.exp(-Math.abs(this._delta*d)));this._delta<0&&0!==f&&(f=1/f);const g=c(),h=Math.pow(2,g),i="number"==typeof this._targetZoom?b.zoomScale(this._targetZoom):h;this._targetZoom=Math.min(b.maxZoom,Math.max(b.minZoom,b.scaleZoom(i*f))),"wheel"===this._type&&(this._startZoom=c(),this._easing=this._smoothOutEasing(200)),this._delta=0}const j="number"==typeof this._targetZoom?this._targetZoom:c(),k=this._startZoom,l=this._easing;let m,n=!1;if("wheel"===this._type&&k&&l){const o=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),p=l(o);m=a.number(k,j,p),o<1?this._frameId||(this._frameId=!0):n=!0}else m=j,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!n,zoomDelta:m-c(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(b){let c=a.ease;if(this._prevEase){const d=this._prevEase,f=(a.exported.now()-d.start)/d.duration,g=d.easing(f+.01)-d.easing(f),h=.27/Math.sqrt(g*g+1e-4)*.01,i=Math.sqrt(.0729-h*h);c=a.bezier(h,i,.25,1)}return this._prevEase={start:a.exported.now(),duration:b,easing:c},c}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=h.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(a.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`)}_isFullscreen(){return!!a.window.document.fullscreenElement}_showBlockerAlert(){"hidden"===this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="visible"),this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show")},200)}}class cX{constructor(a,b){this._clickZoom=a,this._tapZoom=b}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 cY{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(a,b){return a.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(a.shiftKey?-1:1),around:c.unproject(b)},{originalEvent:a})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class cZ{constructor(){this._tap=new cD({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(a,b,c){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=b[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(a,b,c))}touchmove(a,b,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=b[0],f=d.y-this._swipePoint.y;return this._swipePoint=d,a.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(a,b,c)}touchend(a,b,c){this._tapTime?this._swipePoint&&0===c.length&&this.reset():this._tap.touchend(a,b,c)&&(this._tapTime=a.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class c${constructor(a,b,c){this._el=a,this._mousePan=b,this._touchPan=c}enable(a){this._inertiaOptions=a||{},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 c_{constructor(a,b,c){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=b,this._mousePitch=c}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 c0{constructor(a,b,c,d){this._el=a,this._touchZoom=b,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),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 c1=a=>a.zoom||a.drag||a.pitch||a.rotate;class c2 extends a.Event{}function c3(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c4="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c5 extends a.Evented{constructor(b,c){super(),this._moving=!1,this._zooming=!1,this.transform=b,this._bearingSnap=c.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(a,b){return this.jumpTo({center:a},b)}panBy(b,c,d){return b=a.pointGeometry.convert(b).mult(-1),this.panTo(this.transform.center,a.extend({offset:b},c),d)}panTo(b,c,d){return this.easeTo(a.extend({center:b},c),d)}getZoom(){return this.transform.zoom}setZoom(a,b){return this.jumpTo({zoom:a},b),this}zoomTo(b,c,d){return this.easeTo(a.extend({zoom:b},c),d)}zoomIn(a,b){return this.zoomTo(this.getZoom()+1,a,b),this}zoomOut(a,b){return this.zoomTo(this.getZoom()-1,a,b),this}getBearing(){return this.transform.bearing}setBearing(a,b){return this.jumpTo({bearing:a},b),this}getPadding(){return this.transform.padding}setPadding(a,b){return this.jumpTo({padding:a},b),this}rotateTo(b,c,d){return this.easeTo(a.extend({bearing:b},c),d)}resetNorth(b,c){return this.rotateTo(0,a.extend({duration:1e3},b),c),this}resetNorthPitch(b,c){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},b),c),this}snapToNorth(a,b){return Math.abs(this.getBearing())p=>{if(x&&(d.zoom=a.number(f,j,p)),y&&(d.bearing=a.number(g,k,p)),z&&(d.pitch=a.number(h,l,p)),A&&(d.interpolatePadding(i,m,p),o=d.centerPoint.add(n)),v)d.setLocationAtPoint(v,w);else{const q=d.zoomScale(d.zoom-f),B=j>f?Math.min(2,u):Math.max(.5,u),C=Math.pow(B,1-p),D=d.unproject(r.add(s.mult(p*C)).mult(q));d.setLocationAtPoint(d.renderWorldCopies?D.wrap():D,o)}return b.preloadOnly||this._fireMoveEvents(c),d};if(b.preloadOnly){const C=this._emulate(B,b.duration,d);return this._preloadTiles(C),this}const D={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=y,this._pitching=z,this._padding=A,this._easeId=b.easeId,this._prepareEase(c,b.noMoveStart,D),this._ease(B(d),a=>{d.recenterOnTerrain(),this._afterEase(c,a)},b),this}_prepareEase(b,c,d={}){this._moving=!0,this.transform.cameraElevationReference="sea",c||d.moving||this.fire(new a.Event("movestart",b)),this._zooming&&!d.zooming&&this.fire(new a.Event("zoomstart",b)),this._rotating&&!d.rotating&&this.fire(new a.Event("rotatestart",b)),this._pitching&&!d.pitching&&this.fire(new a.Event("pitchstart",b))}_fireMoveEvents(b){this.fire(new a.Event("move",b)),this._zooming&&this.fire(new a.Event("zoom",b)),this._rotating&&this.fire(new a.Event("rotate",b)),this._pitching&&this.fire(new a.Event("pitch",b))}_afterEase(b,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId,this.transform.cameraElevationReference="ground";const d=this._zooming,f=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new a.Event("zoomend",b)),f&&this.fire(new a.Event("rotateend",b)),g&&this.fire(new a.Event("pitchend",b)),this.fire(new a.Event("moveend",b))}flyTo(b,c){if(!b.essential&&a.exported.prefersReducedMotion){const d=a.pick(b,["center","zoom","bearing","pitch","around",]);return this.jumpTo(d,c)}this.stop(),b=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},b);const f=this.transform,g=this.getZoom(),h=this.getBearing(),i=this.getPitch(),j=this.getPadding(),k="zoom"in b?a.clamp(+b.zoom,f.minZoom,f.maxZoom):g,l="bearing"in b?this._normalizeBearing(b.bearing,h):h,m="pitch"in b?+b.pitch:i,n="padding"in b?b.padding:f.padding,o=f.zoomScale(k-g),p=a.pointGeometry.convert(b.offset);let q=f.centerPoint.add(p);const r=f.pointLocation(q),s=a.LngLat.convert(b.center||r);this._normalizeCenter(s);const u=f.project(r),v=f.project(s).sub(u);let w=b.curve;const x=Math.max(f.width,f.height),y=x/o,z=v.mag();if("minZoom"in b){const A=a.clamp(Math.min(b.minZoom,g,k),f.minZoom,f.maxZoom),B=x/f.zoomScale(A-g);w=Math.sqrt(B/z*2)}const C=w*w;function D(a){const b=(y*y-x*x+(a?-1:1)*C*C*z*z)/(2*(a?y:x)*C*z);return Math.log(Math.sqrt(b*b+1)-b)}function E(a){return(Math.exp(a)-Math.exp(-a))/2}function F(a){return(Math.exp(a)+Math.exp(-a))/2}const G=D(0);let H=function(a){return F(G)/F(G+w*a)},I=function(a){var b;return x*((F(G)*(E(b=G+w*a)/F(b))-E(G))/C)/z},J=(D(1)-G)/w;if(1e-6>Math.abs(z)||!isFinite(J)){if(1e-6>Math.abs(x-y))return this.easeTo(b,c);const K=yb.maxDuration&&(b.duration=0);const L=h!==l,M=m!==i,N=!f.isPaddingEqual(n),O=d=>f=>{const o=f*J,r=1/H(o);d.zoom=1===f?k:g+d.scaleZoom(r),L&&(d.bearing=a.number(h,l,f)),M&&(d.pitch=a.number(i,m,f)),N&&(d.interpolatePadding(j,n,f),q=d.centerPoint.add(p));const w=1===f?s:d.unproject(u.add(v.mult(I(o))).mult(r));return d.setLocationAtPoint(d.renderWorldCopies?w.wrap():w,q),d._updateCenterElevation(),b.preloadOnly||this._fireMoveEvents(c),d};if(b.preloadOnly){const P=this._emulate(O,b.duration,f);return this._preloadTiles(P),this}return this._zooming=!0,this._rotating=L,this._pitching=M,this._padding=N,this._prepareEase(c,!1),this._ease(O(f),()=>this._afterEase(c),b),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(a,b){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const c=this._onEaseEnd;delete this._onEaseEnd,c.call(this,b)}if(!a){const d=this.handlers;d&&d.stop(!1)}return this}_ease(b,c,d){!1===d.animate||0===d.duration?(b(1),c()):(this._easeStart=a.exported.now(),this._easeOptions=d,this._onEaseFrame=b,this._onEaseEnd=c,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const b=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(b)),b<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(b,c){b=a.wrap(b,-180,180);const d=Math.abs(b-c);return Math.abs(b-360-c)180?-360:c< -180?360:0}_emulate(a,b,c){const d=Math.ceil(15*b/1e3),f=[],g=a(c.clone());for(let h=0;h<=d;h++){const i=g(h/d);f.push(i.clone())}return f}}class c6{constructor(b={}){this.options=b,a.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(a){const b=this.options&&this.options.compact;return this._map=a,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=h.create("button","mapboxgl-ctrl-attrib-button",this._container),h.create("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden",!0),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=h.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),b&&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===b&&(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(a,b){const c=this._map._getUIString(`AttributionControl.${b}`);a.setAttribute("aria-label",c),a.removeAttribute("title"),a.firstElementChild&&a.firstElementChild.setAttribute("title",c)}_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 b=this._editLink;b||(b=this._editLink=this._container.querySelector(".mapbox-improve-map"));const c=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.config.ACCESS_TOKEN},];if(b){const d=c.reduce((a,b,d)=>(b.value&&(a+=`${b.key}=${b.value}${da.indexOf(g.attribution)&&a.push(g.attribution)}}a.sort((a,b)=>a.length-b.length),a=a.filter((b,c)=>{for(let d=c+1;d=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=[...this.options.customAttribution,...a,]:a.unshift(this.options.customAttribution));const h=a.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,a.length?(this._innerContainer.innerHTML=h,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 c7{constructor(){a.bindAll(["_updateLogo"],this),a.bindAll(["_updateCompact"],this)}onAdd(a){this._map=a,this._container=h.create("div","mapboxgl-ctrl");const b=h.create("a","mapboxgl-ctrl-logo");return b.target="_blank",b.rel="noopener nofollow",b.href="https://www.mapbox.com/",b.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),b.setAttribute("rel","noopener nofollow"),this._container.appendChild(b),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(a){a&&"metadata"!==a.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const a=this._map.style._sourceCaches;if(0===Object.entries(a).length)return!0;for(const b in a){const c=a[b].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const a=this._container.children;if(a.length){const b=a[0];this._map.getCanvasContainer().offsetWidth<250?b.classList.add("mapboxgl-compact"):b.classList.remove("mapboxgl-compact")}}}class c8{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(a){const b=++this._id;return this._queue.push({callback:a,id:b,cancelled:!1}),b}remove(a){const b=this._currentlyRunning,c=b?this._queue.concat(b):this._queue;for(const d of c)if(d.id===a)return void(d.cancelled=!0)}run(a=0){const b=this._currentlyRunning=this._queue;for(const c of(this._queue=[],b))if(!c.cancelled&&(c.callback(a),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function c9(b,c,d){if(b=new a.LngLat(b.lng,b.lat),c){const f=new a.LngLat(b.lng-360,b.lat),g=new a.LngLat(b.lng+360,b.lat),h=360*Math.ceil(Math.abs(b.lng-d.center.lng)/360),i=d.locationPoint(b).distSqr(c),j=c.x<0||c.y<0||c.x>d.width||c.y>d.height;d.locationPoint(f).distSqr(c)180;){const k=d.locationPoint(b);if(k.x>=0&&k.y>=0&&k.x<=d.width&&k.y<=d.height)break;b.lng>d.center.lng?b.lng-=360:b.lng+=360}return b}const da={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 db extends a.Evented{constructor(b,c){if(super(),(b instanceof a.window.HTMLElement||c)&&(b=a.extend({element:b},c)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=b&&b.anchor||"center",this._color=b&&b.color||"#3FB1CE",this._scale=b&&b.scale||1,this._draggable=b&&b.draggable||!1,this._clickTolerance=b&&b.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=b&&b.rotation||0,this._rotationAlignment=b&&b.rotationAlignment||"auto",this._pitchAlignment=b&&b.pitchAlignment&&"auto"!==b.pitchAlignment?b.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),b&&b.element)this._element=b.element,this._offset=a.pointGeometry.convert(b&&b.offset||[0,0]);else{this._defaultMarker=!0,this._element=h.create("div");const d=41,f=27,g=h.createSVG("svg",{display:"block",height:d*this._scale+"px",width:f*this._scale+"px",viewBox:`0 0 ${f} ${d}`},this._element),i=h.createSVG("radialGradient",{id:"shadowGradient"},h.createSVG("defs",{},g));h.createSVG("stop",{offset:"10%","stop-opacity":.4},i),h.createSVG("stop",{offset:"100%","stop-opacity":.05},i),h.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},g),h.createSVG("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"},g),h.createSVG("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"},g),h.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},g),this._offset=a.pointGeometry.convert(b&&b.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",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()});const j=this._element.classList;for(const k in da)j.remove(`mapboxgl-marker-anchor-${k}`);j.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(a){return a===this._map||(this.remove(),this._map=a,a.getCanvasContainer().appendChild(this._element),a.on("move",this._updateMoving),a.on("moveend",this._update),a.on("remove",this._clearFadeTimer),a._addMarker(this),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick)),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._updateMoving),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._map.off("remove",this._clearFadeTimer),this._map._removeMarker(this),delete this._map),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(a){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")),a){if(!("offset"in a.options)){const b=38.1,c=13.5,d=Math.sqrt(Math.pow(c,2)/2);a.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-b],"bottom-left":[d,-1*(b-c+d),],"bottom-right":[-d,-1*(b-c+d),],left:[c,-1*(b-c)],right:[-c,-1*(b-c)]}:this._offset}this._popup=a,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(a){const b=a.code,c=a.charCode||a.keyCode;"Space"!==b&&"Enter"!==b&&32!==c&&13!==c||this.togglePopup()}_onMapClick(a){const b=a.originalEvent.target,c=this._element;this._popup&&(b===c||c.contains(b))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const a=this._popup;return a&&(a.isOpen()?(a.remove(),this._element.setAttribute("aria-expanded","false")):(a.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const a=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(a))return void this._clearFadeTimer();const b=this._map.unproject(a);let c=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const d=this._map.getFreeCameraOptions();if(d.position){const f=d.position.toLngLat();c=f.distanceTo(b)<.9*f.distanceTo(this._lngLat)}}const g=(1-this._map._queryFogOpacity(b))*(c?.2:1);this._element.style.opacity=`${g}`,this._popup&&this._popup._setOpacity(`${g}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(a){const b=this._map.transform;return!!a&&a.x>=0&&a.x=0&&a.y{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),this._map._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(this._map.getTerrain()||this._map.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}_transformedOffset(){if(!this._defaultMarker)return this._offset;const a=this._map.transform,b=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&b._rotate(a.angle),"map"===this._pitchAlignment&&(b.y*=Math.cos(a._pitch)),b}getOffset(){return this._offset}setOffset(b){return this._offset=a.pointGeometry.convert(b),this._update(),this}_onMove(b){if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=b.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=b.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new a.Event("dragend")),this._state="inactive"}_addDragHandler(a){this._element.contains(a.originalEvent.target)&&(a.preventDefault(),this._positionDelta=a.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=a.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(a){return this._draggable=!!a,this._map&&(a?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(a){return this._rotation=a||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(a){return this._rotationAlignment=a||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(a){return this._pitchAlignment=a&&"auto"!==a?a:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const{HTMLImageElement:dc,HTMLElement:dd,ImageBitmap:de}=a.window;function df(a){a.parentNode&&a.parentNode.removeChild(a)}class dg{constructor(b,c,d=!1){this._clickTolerance=10,this.element=c,this.mouseRotate=new cI({clickTolerance:b.dragRotate._mouseRotate._clickTolerance}),this.map=b,d&&(this.mousePitch=new cJ({clickTolerance:b.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),c.addEventListener("mousedown",this.mousedown),c.addEventListener("touchstart",this.touchstart,{passive:!1}),c.addEventListener("touchmove",this.touchmove),c.addEventListener("touchend",this.touchend),c.addEventListener("touchcancel",this.reset)}down(a,b){this.mouseRotate.mousedown(a,b),this.mousePitch&&this.mousePitch.mousedown(a,b),h.disableDrag()}move(a,b){const c=this.map,d=this.mouseRotate.mousemoveWindow(a,b);if(d&&d.bearingDelta&&c.setBearing(c.getBearing()+d.bearingDelta),this.mousePitch){const f=this.mousePitch.mousemoveWindow(a,b);f&&f.pitchDelta&&c.setPitch(c.getPitch()+f.pitchDelta)}}off(){const a=this.element;a.removeEventListener("mousedown",this.mousedown),a.removeEventListener("touchstart",this.touchstart,{passive:!1}),a.removeEventListener("touchmove",this.touchmove),a.removeEventListener("touchend",this.touchend),a.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){h.enableDrag(),a.window.removeEventListener("mousemove",this.mousemove),a.window.removeEventListener("mouseup",this.mouseup)}mousedown(b){this.down(a.extend({},b,{ctrlKey:!0,preventDefault:()=>b.preventDefault()}),h.mousePos(this.element,b)),a.window.addEventListener("mousemove",this.mousemove),a.window.addEventListener("mouseup",this.mouseup)}mousemove(a){this.move(a,h.mousePos(this.element,a))}mouseup(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()}touchstart(a){1!==a.targetTouches.length?this.reset():(this._startPos=this._lastPos=h.touchPos(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>a.preventDefault()},this._startPos))}touchmove(a){1!==a.targetTouches.length?this.reset():(this._lastPos=h.touchPos(this.element,a.targetTouches)[0],this.move({preventDefault:()=>a.preventDefault()},this._lastPos))}touchend(a){0===a.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?dl(b,d,j/5280,a._getUIString("ScaleControl.Miles"),a):dl(b,d,j,a._getUIString("ScaleControl.Feet"),a)}else c&&"nautical"===c.unit?dl(b,d,i/1852,a._getUIString("ScaleControl.NauticalMiles"),a):i>=1e3?dl(b,d,i/1e3,a._getUIString("ScaleControl.Kilometers"),a):dl(b,d,i,a._getUIString("ScaleControl.Meters"),a)}function dl(a,b,c,d,f){const g=function(a){const b=Math.pow(10,`${Math.floor(a)}`.length-1);let c=a/b;return c=c>=10?10:c>=5?5:c>=3?3:c>=2?2:c>=1?1:function(a){const b=Math.pow(10,Math.ceil(-Math.log(a)/Math.LN10));return Math.round(a*b)/b}(c),b*c}(c),h=g/c;f._requestDomTask(()=>{a.style.width=b*h+"px",a.innerHTML=`${g} ${d}`})}const dm={version:a.version,supported:b,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends c5{constructor(b){if(null!=(b=a.extend({},{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,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},b)).minZoom&&null!=b.maxZoom&&b.minZoom>b.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=b.minPitch&&null!=b.maxPitch&&b.minPitch>b.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=b.minPitch&&b.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=b.maxPitch&&b.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new cn(b.minZoom,b.maxZoom,b.minPitch,b.maxPitch,b.renderWorldCopies),b),this._interactive=b.interactive,this._minTileCacheSize=b.minTileCacheSize,this._maxTileCacheSize=b.maxTileCacheSize,this._failIfMajorPerformanceCaveat=b.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=b.preserveDrawingBuffer,this._antialias=b.antialias,this._trackResize=b.trackResize,this._bearingSnap=b.bearingSnap,this._refreshExpiredTiles=b.refreshExpiredTiles,this._fadeDuration=b.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=b.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=b.collectResourceTiming,this._optimizeForTerrain=b.optimizeForTerrain,this._renderTaskQueue=new c8,this._domRenderTaskQueue=new c8,this._controls=[],this._markers=[],this._mapId=a.uniqueId(),this._locale=a.extend({},{"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","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"},b.locale),this._clickTolerance=b.clickTolerance,this._cooperativeGestures=b.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new class{constructor(a){this.jumpTo(a)}getValue(b){if(b<=this._startTime)return this._start;if(b>=this._endTime)return this._end;const c=a.easeCubicInOut((b-this._startTime)/(this._endTime-this._startTime));return this._start*(1-c)+this._end*c}isEasing(a){return a>=this._startTime&&a<=this._endTime}jumpTo(a){this._startTime=-1/0,this._endTime=-1/0,this._start=a,this._end=a}easeTo(a,b,c){this._start=this.getValue(b),this._end=a,this._startTime=b,this._endTime=b+c}}(0),this._requestManager=new a.RequestManager(b.transformRequest,b.accessToken,b.testMode),this._silenceAuthErrors=!!b.testMode,"string"==typeof b.container){if(this._container=a.window.document.getElementById(b.container),!this._container)throw Error(`Container '${b.container}' not found.`)}else{if(!(b.container instanceof dd))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=b.container}if(this._container.childNodes.length>0&&a.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."),b.maxBounds&&this.setMaxBounds(b.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw 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!==a.window&&(a.window.addEventListener("online",this._onWindowOnline,!1),a.window.addEventListener("resize",this._onWindowResize,!1),a.window.addEventListener("orientationchange",this._onWindowResize,!1),a.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new class{constructor(b,c){this._map=b,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new class{constructor(a){this._map=a,this.clear()}clear(){this._inertiaBuffer=[]}record(b){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:b})}_drainInertiaBuffer(){const b=this._inertiaBuffer,c=a.exported.now();for(;b.length>0&&c-b[0].time>160;)b.shift()}_onMoveEnd(b){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const c={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)c.zoom+=d.zoomDelta||0,c.bearing+=d.bearingDelta||0,c.pitch+=d.pitchDelta||0,d.panDelta&&c.pan._add(d.panDelta),d.around&&(c.around=d.around),d.pinchAround&&(c.pinchAround=d.pinchAround);const f=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(c.pan.mag()){const h=cv(c.pan.mag(),f,a.extend({},cq,b||{}));g.offset=c.pan.mult(h.amount/c.pan.mag()),g.center=this._map.transform.center,cu(g,h)}if(c.zoom){const i=cv(c.zoom,f,cr);g.zoom=this._map.transform.zoom+i.amount,cu(g,i)}if(c.bearing){const j=cv(c.bearing,f,cs);g.bearing=this._map.transform.bearing+a.clamp(j.amount,-179,179),cu(g,j)}if(c.pitch){const k=cv(c.pitch,f,ct);g.pitch=this._map.transform.pitch+k.amount,cu(g,k)}if(g.zoom||g.bearing){const l=void 0===c.pinchAround?c.around:c.pinchAround;g.around=l?this._map.unproject(l):this._map.getCenter()}return this.clear(),a.extend(g,{noMoveStart:!0})}}(b),this._bearingSnap=c.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new class{constructor(){this.constants=[1,1,.01],this.radius=0}setup(b,c){const d=a.sub([],c,b);this.radius=a.length(d[2]<0?a.div([],d,this.constants):[d[0],d[1],0])}projectRay(b){a.div(b,b,this.constants),a.normalize(b,b),a.mul$1(b,b,this.constants);const c=a.scale$2([],b,this.radius);if(c[2]>0){const d=a.scale$2([],[0,0,1],a.dot(c,[0,0,1])),f=a.scale$2([],a.normalize([],[c[0],c[1],0]),this.radius),g=a.add([],c,a.scale$2([],a.sub([],a.add([],f,d),c),2));c[0]=g[0],c[1]=g[1]}return c}},this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(c),a.bindAll(["handleEvent","handleWindowEvent"],this);const d=this._el;for(const[f,g,h]of(this._listeners=[[d,"touchstart",{passive:!0},],[d,"touchmove",{passive:!1},],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[a.window.document,"mousemove",{capture:!0},],[a.window.document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1},],[d,"keyup",void 0],[d,"wheel",{passive:!1},],[d,"contextmenu",void 0],[a.window,"blur",void 0],],this._listeners))f.addEventListener(g,f===a.window.document?this.handleWindowEvent:this.handleEvent,h)}destroy(){for(const[b,c,d]of this._listeners)b.removeEventListener(c,b===a.window.document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(a){const b=this._map,c=b.getCanvasContainer();this._add("mapEvent",new cz(b,a));const d=b.boxZoom=new cB(b,a);this._add("boxZoom",d);const f=new cE,g=new cY;b.doubleClickZoom=new cX(g,f),this._add("tapZoom",f),this._add("clickZoom",g);const h=new cZ;this._add("tapDragZoom",h);const i=b.touchPitch=new cS(b);this._add("touchPitch",i);const j=new cI(a),k=new cJ(a);b.dragRotate=new c_(a,j,k),this._add("mouseRotate",j,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);const l=new cH(a),m=new cK(b,a);b.dragPan=new c$(c,l,m),this._add("mousePan",l),this._add("touchPan",m,["touchZoom","touchRotate",]);const n=new cQ,o=new cO;b.touchZoomRotate=new c0(c,o,n,h),this._add("touchRotate",n,["touchPan","touchZoom",]),this._add("touchZoom",o,["touchPan","touchRotate",]),this._add("blockableMapEvent",new cA(b));const p=b.scrollZoom=new cW(b,this);this._add("scrollZoom",p,["mousePan"]);const q=b.keyboard=new cT;for(const r of(this._add("keyboard",q),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))a.interactive&&a[r]&&b[r].enable(a[r])}_add(a,b,c){this._handlers.push({handlerName:a,handler:b,allowed:c}),this._handlersById[a]=b}stop(a){if(!this._updatingCamera){for(const{handler:b}of this._handlers)b.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}}isActive(){for(const{handler:a}of this._handlers)if(a.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(c1(this._eventsInProgress))||this.isZooming()}_blockedByActive(a,b,c){for(const d in a)if(d!==c&&(!b||0>b.indexOf(d)))return!0;return!1}handleWindowEvent(a){this.handleEvent(a,`${a.type}Window`)}_getMapTouches(a){const b=[];for(const c of a)this._el.contains(c.target)&&b.push(c);return b}handleEvent(a,b){this._updatingCamera=!0;const c="renderFrame"===a.type,d=c?void 0:a,f={needsRenderFrame:!1},g={},i={},j=a.touches?this._getMapTouches(a.touches):void 0,k=j?h.touchPos(this._el,j):c?void 0:h.mousePos(this._el,a);for(const{handlerName:l,handler:m,allowed:n}of this._handlers){if(!m.isEnabled())continue;let o;this._blockedByActive(i,n,l)?m.reset():m[b||a.type]&&(o=m[b||a.type](a,k,j),this.mergeHandlerResult(f,g,o,l,d),o&&o.needsRenderFrame&&this._triggerRenderFrame()),(o||m.isActive())&&(i[l]=m)}const p={};for(const q in this._previousActiveHandlers)i[q]||(p[q]=d);this._previousActiveHandlers=i,(Object.keys(p).length||c3(f))&&(this._changes.push([f,g,p]),this._triggerRenderFrame()),(Object.keys(i).length||c3(f))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:r}=f;r&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],r(this._map))}mergeHandlerResult(b,c,d,f,g){if(!d)return;a.extend(b,d);const h={handlerName:f,originalEvent:d.originalEvent||g};void 0!==d.zoomDelta&&(c.zoom=h),void 0!==d.panDelta&&(c.drag=h),void 0!==d.pitchDelta&&(c.pitch=h),void 0!==d.bearingDelta&&(c.rotate=h)}_applyChanges(){const b={},c={},d={};for(const[f,g,h]of this._changes)f.panDelta&&(b.panDelta=(b.panDelta||new a.pointGeometry(0,0))._add(f.panDelta)),f.zoomDelta&&(b.zoomDelta=(b.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(b.bearingDelta=(b.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(b.pitchDelta=(b.pitchDelta||0)+f.pitchDelta),void 0!==f.around&&(b.around=f.around),void 0!==f.aroundCoord&&(b.aroundCoord=f.aroundCoord),void 0!==f.pinchAround&&(b.pinchAround=f.pinchAround),f.noInertia&&(b.noInertia=f.noInertia),a.extend(c,g),a.extend(d,h);this._updateMapTransform(b,c,d),this._changes=[]}_updateMapTransform(b,c,d){const f=this._map,g=f.transform,h=a=>[a.x,a.y,a.z];if((a=>{const b=this._eventsInProgress.drag;return b&&!this._handlersById[b.handlerName].isActive()})()&&!c3(b)){const i=g.zoom;g.cameraElevationReference="sea",g.recenterOnTerrain(),g.cameraElevationReference="ground",i!==g.zoom&&this._map._update(!0)}if(!c3(b))return this._fireEvents(c,d,!0);let{panDelta:j,zoomDelta:k,bearingDelta:l,pitchDelta:m,around:n,aroundCoord:o,pinchAround:p}=b;void 0!==p&&(n=p),c.drag&&!this._eventsInProgress.drag&&n&&(this._dragOrigin=h(g.pointCoordinate3D(n)),this._trackingEllipsoid.setup(g._camera.position,this._dragOrigin)),g.cameraElevationReference="sea",f._stop(!0),n=n||f.transform.centerPoint,l&&(g.bearing+=l),m&&(g.pitch+=m),g._updateCameraState();const q=[0,0,0];if(j){const r=g.pointCoordinate(n),s=g.pointCoordinate(n.sub(j));r&&s&&(q[0]=s.x-r.x,q[1]=s.y-r.y)}const u=g.zoom,v=[0,0,0];if(k){const w=h(o||g.pointCoordinate3D(n)),x={dir:a.normalize([],a.sub([],w,g._camera.position))};if(x.dir[2]<0){const y=g.zoomDeltaToMovement(w,k);a.scale$2(v,x.dir,y)}}const z=a.add(q,q,v);g._translateCameraConstrained(z),k&&Math.abs(g.zoom-u)>1e-4&&g.recenterOnTerrain(),g.cameraElevationReference="ground",this._map._update(),b.noInertia||this._inertia.record(b),this._fireEvents(c,d,!0)}_fireEvents(b,c,d){const f=c1(this._eventsInProgress),g=c1(b),h={};for(const i in b){const{originalEvent:j}=b[i];this._eventsInProgress[i]||(h[`${i}start`]=j),this._eventsInProgress[i]=b[i]}for(const k in!f&&g&&this._fireEvent("movestart",g.originalEvent),h)this._fireEvent(k,h[k]);for(const l in g&&this._fireEvent("move",g.originalEvent),b){const{originalEvent:m}=b[l];this._fireEvent(l,m)}const n={};let o;for(const p in this._eventsInProgress){const{handlerName:q,originalEvent:r}=this._eventsInProgress[p];this._handlersById[q].isActive()||(delete this._eventsInProgress[p],o=c[q]||r,n[`${p}end`]=o)}for(const s in n)this._fireEvent(s,n[s]);const u=c1(this._eventsInProgress);if(d&&(f||g)&&!u){this._updatingCamera=!0;const v=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=a=>0!==a&& -this._bearingSnap{delete this._frameId,this.handleEvent(new c2("renderFrame",{timeStamp:a})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}(this,b),this._localFontFamily=b.localFontFamily,this._localIdeographFontFamily=b.localIdeographFontFamily,b.style&&this.setStyle(b.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),b.projection&&this.setProjection(b.projection),this._hash=b.hash&&new class{constructor(b){this._hashName=b&&encodeURIComponent(b),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=co(this._updateHashUnthrottled.bind(this),300)}addTo(b){return this._map=b,a.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return a.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(b){const c=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,f=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,f),h=Math.round(c.lng*g)/g,i=Math.round(c.lat*g)/g,j=this._map.getBearing(),k=this._map.getPitch();let l="";if(l+=b?`/${h}/${i}/${d}`:`${d}/${i}/${h}`,(j||k)&&(l+="/"+Math.round(10*j)/10),k&&(l+=`/${Math.round(k)}`),this._hashName){const m=this._hashName;let n=!1;const o=a.window.location.hash.slice(1).split("&").map(a=>{const b=a.split("=")[0];return b===m?(n=!0,`${b}=${l}`):a}).filter(a=>a);return n||o.push(`${m}=${l}`),`#${o.join("&")}`}return`#${l}`}_getCurrentHash(){const b=a.window.location.hash.replace("#","");if(this._hashName){let c;return b.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(c=a)}),(c&&c[1]||"").split("/")}return b.split("/")}_onHashChange(){const a=this._getCurrentHash();if(a.length>=3&&!a.some(a=>isNaN(a))){const b=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:b,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){const b=a.window.location.href.replace(/(#.+)?$/,this.getHashString());a.window.history.replaceState(a.window.history.state,null,b)}}("string"==typeof b.hash&&b.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:b.center,zoom:b.zoom,bearing:b.bearing,pitch:b.pitch}),b.bounds&&(this.resize(),this.fitBounds(b.bounds,a.extend({},b.fitBoundsOptions,{duration:0})))),this.resize(),b.attributionControl&&this.addControl(new c6({customAttribution:b.customAttribution})),this._logoControl=new c7,this.addControl(this._logoControl,b.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",b=>{this._update("style"===b.dataType),this.fire(new a.Event(`${b.dataType}data`,b))}),this.on("dataloading",b=>{this.fire(new a.Event(`${b.dataType}dataloading`,b))})}_getMapId(){return this._mapId}addControl(b,c){if(void 0===c&&(c=b.getDefaultPosition?b.getDefaultPosition():"top-right"),!b||!b.onAdd)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const d=b.onAdd(this);this._controls.push(b);const f=this._controlPositions[c];return -1!==c.indexOf("bottom")?f.insertBefore(d,f.firstChild):f.appendChild(d),this}removeControl(b){if(!b||!b.onRemove)return this.fire(new a.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const c=this._controls.indexOf(b);return c> -1&&this._controls.splice(c,1),b.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)> -1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(b){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 c=!this._moving;return c&&this.fire(new a.Event("movestart",b)).fire(new a.Event("move",b)),this.fire(new a.Event("resize",b)),c&&this.fire(new a.Event("moveend",b)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(b){return this.transform.setMaxBounds(a.LngLatBounds.convert(b)),this._update()}setMinZoom(b){if((b=null==b?-2:b)>= -2&&b<=this.transform.maxZoom)return this.transform.minZoom=b,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=b,this._update(),this.getZoom()>b?this.setZoom(b):this.fire(new a.Event("zoomstart")).fire(new a.Event("zoom")).fire(new a.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(b){if((b=null==b?0:b)<0)throw Error("minPitch must be greater than or equal to 0");if(b>=0&&b<=this.transform.maxPitch)return this.transform.minPitch=b,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(b>=this.transform.minPitch)return this.transform.maxPitch=b,this._update(),this.getPitch()>b?this.setPitch(b):this.fire(new a.Event("pitchstart")).fire(new a.Event("pitch")).fire(new a.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}getProjection(){return this.transform.getProjection()}setProjection(a){return this._lazyInitEmptyStyle(),"string"==typeof a&&(a={name:a}),this._runtimeProjection=a,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(b){return this.transform.locationPoint3D(a.LngLat.convert(b))}unproject(b){return this.transform.pointLocation3D(a.pointGeometry.convert(b))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()}_createDelegatedListener(a,b,c){if("mouseenter"===a||"mouseover"===a){let d=!1;const f=f=>{const g=b.filter(a=>this.getLayer(a)),h=g.length?this.queryRenderedFeatures(f.point,{layers:g}):[];h.length?d||(d=!0,c.call(this,new cw(a,this,f.originalEvent,{features:h}))):d=!1},g=()=>{d=!1};return{layers:new Set(b),listener:c,delegates:{mousemove:f,mouseout:g}}}if("mouseleave"===a||"mouseout"===a){let h=!1;const i=d=>{const f=b.filter(a=>this.getLayer(a));(f.length?this.queryRenderedFeatures(d.point,{layers:f}):[]).length?h=!0:h&&(h=!1,c.call(this,new cw(a,this,d.originalEvent)))},j=b=>{h&&(h=!1,c.call(this,new cw(a,this,b.originalEvent)))};return{layers:new Set(b),listener:c,delegates:{mousemove:i,mouseout:j}}}{const k=a=>{const d=b.filter(a=>this.getLayer(a)),f=d.length?this.queryRenderedFeatures(a.point,{layers:d}):[];f.length&&(a.features=f,c.call(this,a),delete a.features)};return{layers:new Set(b),listener:c,delegates:{[a]:k}}}}on(a,b,c){if(void 0===c)return super.on(a,b);Array.isArray(b)||(b=[b]);const d=this._createDelegatedListener(a,b,c);for(const f in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(d),d.delegates)this.on(f,d.delegates[f]);return this}once(a,b,c){if(void 0===c)return super.once(a,b);Array.isArray(b)||(b=[b]);const d=this._createDelegatedListener(a,b,c);for(const f in d.delegates)this.once(f,d.delegates[f]);return this}off(a,b,c){if(void 0===c)return super.off(a,b);b=new Set(Array.isArray(b)?b:[b]);const d=(a,b)=>{if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0},f=this._delegatedListeners?this._delegatedListeners[a]:void 0;return f&&(a=>{for(let f=0;f{b?this.fire(new a.ErrorEvent(b)):d&&this._updateDiff(d,c)})}else"object"==typeof b&&this._updateDiff(b,c)}_updateDiff(b,c){try{this.style.setState(b)&&this._update(!0)}catch(d){a.warnOnce(`Unable to perform style diff: ${d.message||d.error||d}. Rebuilding the style from scratch.`),this._updateStyle(b,c)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(a,b){return this._lazyInitEmptyStyle(),this.style.addSource(a,b),this._update(!0)}isSourceLoaded(b){const c=this.style&&this.style._getSourceCaches(b);if(0!==c.length)return c.every(a=>a.loaded());this.fire(new a.ErrorEvent(Error(`There is no source with ID '${b}'`)))}areTilesLoaded(){const a=this.style&&this.style._sourceCaches;for(const b in a){const c=a[b]._tiles;for(const d in c){const f=c[d];if("loaded"!==f.state&&"errored"!==f.state)return!1}}return!0}addSourceType(a,b,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,b,c)}removeSource(a){return this.style.removeSource(a),this._updateTerrain(),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(b,c,{pixelRatio:d=1,sdf:f=!1,stretchX:g,stretchY:h,content:i}={}){if(this._lazyInitEmptyStyle(),c instanceof dc||de&&c instanceof de){const{width:j,height:k,data:l}=a.exported.getImageData(c);this.style.addImage(b,{data:new a.RGBAImage({width:j,height:k},l),pixelRatio:d,stretchX:g,stretchY:h,content:i,sdf:f,version:0})}else{if(void 0===c.width|| void 0===c.height)return this.fire(new a.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:m,height:n,data:o}=c,p=c;this.style.addImage(b,{data:new a.RGBAImage({width:m,height:n},new Uint8Array(o)),pixelRatio:d,stretchX:g,stretchY:h,content:i,sdf:f,version:0,userImage:p}),p.onAdd&&p.onAdd(this,b)}}}updateImage(b,c){const d=this.style.getImage(b);if(!d)return this.fire(new a.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const f=c instanceof dc||de&&c instanceof de?a.exported.getImageData(c):c,{width:g,height:h,data:i}=f;return void 0===g|| void 0===h?this.fire(new a.ErrorEvent(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`"))):g!==d.data.width||h!==d.data.height?this.fire(new a.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(d.data.replace(i,!(c instanceof dc||de&&c instanceof de)),void this.style.updateImage(b,d))}hasImage(b){return b?!!this.style.getImage(b):(this.fire(new a.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(b,c){a.getImage(this._requestManager.transformRequest(b,a.ResourceType.Image),(b,d)=>{c(b,d instanceof dc?a.exported.getImageData(d):d)})}listImages(){return this.style.listImages()}addLayer(a,b){return this._lazyInitEmptyStyle(),this.style.addLayer(a,b),this._update(!0)}moveLayer(a,b){return this.style.moveLayer(a,b),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,b,c){return this.style.setLayerZoomRange(a,b,c),this._update(!0)}setFilter(a,b,c={}){return this.style.setFilter(a,b,c),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,b,c,d={}){return this.style.setPaintProperty(a,b,c,d),this._update(!0)}getPaintProperty(a,b){return this.style.getPaintProperty(a,b)}setLayoutProperty(a,b,c,d={}){return this.style.setLayoutProperty(a,b,c,d),this._update(!0)}getLayoutProperty(a,b){return this.style.getLayoutProperty(a,b)}setLight(a,b={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,b),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=a.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(b){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.LngLat.convert(b),this.transform):0}setFeatureState(a,b){return this.style.setFeatureState(a,b),this._update()}removeFeatureState(a,b){return this.style.removeFeatureState(a,b),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}_updateContainerDimensions(){if(!this._container)return;const b=this._container.getBoundingClientRect().width||400,c=this._container.getBoundingClientRect().height||300;let d,f=this._container;for(;f&&!d;){const g=a.window.getComputedStyle(f).transform;g&&"none"!==g&&(d=g.match(/matrix.*\((.+)\)/)[1].split(", ")),f=f.parentElement}d?(this._containerWidth=d[0]&&"0"!==d[0]?Math.abs(b/d[0]):b,this._containerHeight=d[3]&&"0"!==d[3]?Math.abs(c/d[3]):c):(this._containerWidth=b,this._containerHeight=c)}_detectMissingCSS(){"rgb(250, 128, 114)"!==a.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&a.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 a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=h.create("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const b=this._canvasContainer=h.create("div","mapboxgl-canvas-container",a);this._interactive&&b.classList.add("mapboxgl-interactive"),this._canvas=h.create("canvas","mapboxgl-canvas",b),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const c=this._controlContainer=h.create("div","mapboxgl-control-container",a),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(a=>{d[a]=h.create("div",`mapboxgl-ctrl-${a}`,c)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(b,c){const d=a.exported.devicePixelRatio||1;this._canvas.width=d*Math.ceil(b),this._canvas.height=d*Math.ceil(c),this._canvas.style.width=`${b}px`,this._canvas.style.height=`${c}px`}_addMarker(a){this._markers.push(a)}_removeMarker(a){const b=this._markers.indexOf(a);-1!==b&&this._markers.splice(b,1)}_setupPainter(){const c=a.extend({},b.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl",c)||this._canvas.getContext("experimental-webgl",c);d?(a.storeAuthState(d,!0),this.painter=new b9(d,this.transform),this.on("data",a=>{"source"===a.dataType&&this.painter.setTileLoadedFlag(!0)}),a.exported$1.testSupport(d)):this.fire(new a.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(b){b.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:b}))}_contextRestored(b){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:b}))}_onMapScroll(a){if(a.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(a){return this.style&&(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(b){let c;const d=this.painter.context.extTimerQuery,f=a.exported.now();this.listens("gpu-timing-frame")&&(c=d.createQueryEXT(),d.beginQueryEXT(d.TIME_ELAPSED_EXT,c));let g=this._updateAverageElevation(f);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(b),this._domRenderTaskQueue.run(b),this._removed)return;this._updateProjection();let h=!1;const i=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const j=this.transform.zoom,k=this.transform.pitch,l=a.exported.now();this.style.zoomHistory.update(j,l);const m=new a.EvaluationParameters(j,{now:l,fadeDuration:i,pitch:k,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=m.crossFadingFactor();1===n&&n===this._crossFadingFactor||(h=!0,this._crossFadingFactor=n),this.style.update(m)}if(this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),this.style._updateSources(this.transform),this._forceMarkerUpdate()),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,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:i,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||h)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const o=a.exported.now()-f;d.endQueryEXT(d.TIME_ELAPSED_EXT,c),setTimeout(()=>{const b=d.getQueryObjectEXT(c,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(c),this.fire(new a.Event("gpu-timing-frame",{cpuTime:o,gpuTime:b}))},50)}if(this.listens("gpu-timing-layer")){const p=this.painter.collectGpuTimers();setTimeout(()=>{const b=this.painter.queryGpuTimers(p);this.fire(new a.Event("gpu-timing-layer",{layerTimes:b}))},50)}const q=this._sourcesDirty||this._styleDirty||this._placementDirty||g;if(q||this._repaint)this.triggerRepaint();else{const r=!this.isMoving()&&this.loaded();if(r&&(g=this._updateAverageElevation(f,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),r&&(this.fire(new a.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const s=this._calculateSpeedIndex();this.fire(new a.Event("speedindexcompleted",{speedIndex:s})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||q||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const a of this._markers)a._update()}_updateAverageElevation(a,b=!1){const c=a=>(this.transform.averageElevation=a,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&c(0);if((b||a-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(a)){const d=this.transform.averageElevation;let f=this.transform.sampleAverageElevation();isNaN(f)?f=0:this._averageElevationLastSampledAt=a;const g=Math.abs(d-f);if(g>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(f),c(f);this._averageElevation.easeTo(f,a,300)}else if(g>1e-4)return this._averageElevation.jumpTo(f),c(f)}return!!this._averageElevation.isEasing(a)&&c(this._averageElevation.getValue(a))}_authenticate(){a.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,b=>{if(b&&(b.message===a.AUTH_ERR_MSG||401===b.status)){const c=this.painter.context.gl;a.storeAuthState(c,!1),this._logoControl instanceof c7&&this._logoControl._updateLogo(),c&&c.clear(c.DEPTH_BUFFER_BIT|c.COLOR_BUFFER_BIT|c.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.ErrorEvent(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/")))}}),a.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const a=this.painter.canvasCopy(),b=this.painter.getCanvasCopiesAndTimestamps();b.timeStamps.push(performance.now());const c=this.painter.context.gl,d=c.createFramebuffer();function f(a){c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,a,0);const b=new Uint8Array(c.drawingBufferWidth*c.drawingBufferHeight*4);return c.readPixels(0,0,c.drawingBufferWidth,c.drawingBufferHeight,c.RGBA,c.UNSIGNED_BYTE,b),b}return c.bindFramebuffer(c.FRAMEBUFFER,d),this._canvasPixelComparison(f(a),b.canvasCopies.map(f),b.timeStamps)}_canvasPixelComparison(a,b,c){let d=c[1]-c[0];const f=a.length/4;for(let g=0;g{const b=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,b&&this._render(a)}))}_preloadTiles(b){const c=this.style&&Object.values(this.style._sourceCaches)||[];return a.asyncAll(c,(a,c)=>a._preloadTiles(b,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(b,c){a.setCacheLimits(b,c)}get version(){return a.version}},NavigationControl:class{constructor(b){this.options=a.extend({},{showCompass:!0,showZoom:!0,visualizePitch:!1},b),this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",a=>a.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",a=>this._map.zoomIn({},{originalEvent:a})),h.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",a=>this._map.zoomOut({},{originalEvent:a})),h.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",a=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:a}):this._map.resetNorth({},{originalEvent:a})}),this._compassIcon=h.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const a=this._map.getZoom(),b=a===this._map.getMaxZoom(),c=a===this._map.getMinZoom();this._zoomInButton.disabled=b,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",b.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._map._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=a)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new dg(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(a,b){const c=h.create("button",a,this._container);return c.type="button",c.addEventListener("click",b),c}_setButtonTitle(a,b){const c=this._map._getUIString(`NavigationControl.${b}`);a.setAttribute("aria-label",c),a.firstElementChild&&a.firstElementChild.setAttribute("title",c)}},GeolocateControl:class extends a.Evented{constructor(b){super(),this.options=a.extend({},{positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},b),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=co(this._updateMarkerRotation,20)}onAdd(b){var c;return this._map=b,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),c=this._setupUI,void 0!==dh?c(dh):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(dh="denied"!==a.state)}):c(dh=!!a.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,di=0,dj=!1}_isOutOfMapMaxBounds(a){const b=this._map.getMaxBounds(),c=a.coords;return b&&(c.longitudeb.getEast()||c.latitudeb.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(b){if(this._map){if(this._isOutOfMapMaxBounds(b))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",b)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=b,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(b),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(b),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",b)),this._finish()}}_updateCamera(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude),d=b.coords.accuracy,f=this._map.getBearing(),g=a.extend({bearing:f},this.options.fitBoundsOptions);this._map.fitBounds(c.toBounds(d),g,{geolocateSource:!0})}_updateMarker(b){if(b){const c=new a.LngLat(b.coords.longitude,b.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=b.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._containerHeight/2,b=this._map.unproject([0,a]),c=this._map.unproject([100,a]),d=b.distanceTo(c)/100,f=Math.ceil(2*this._accuracy/d);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}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(b){if(this._map){if(this.options.trackUserLocation){if(1===b.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 c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===b.code&&dj)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",b)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(b){if(this._container.addEventListener("contextmenu",a=>a.preventDefault()),this._geolocateButton=h.create("button","mapboxgl-ctrl-geolocate",this._container),h.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===b){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",c),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",c)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=h.create("div","mapboxgl-user-location"),this._dotElement.appendChild(h.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(h.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new db({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=h.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new db({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",b=>{b.geolocateSource||"ACTIVE_LOCK"!==this._watchState||b.originalEvent&&"resize"===b.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:!0===a.absolute&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":di--,dj=!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 a.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 a.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 b;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++di>1?(b={maximumAge:6e5,timeout:0},dj=!0):(b=this.options.positionOptions,dj=!1),this._geolocationWatchID=a.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,b),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else a.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const b=()=>{a.window.addEventListener("ondeviceorientationabsolute"in a.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==a.window.DeviceMotionEvent&&"function"==typeof a.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(a=>{"granted"===a&&b()}).catch(console.error):b()}_clearWatch(){a.window.navigator.geolocation.clearWatch(this._geolocationWatchID),a.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),a.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientationListener),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:c6,ScaleControl:class{constructor(b){this.options=a.extend({},{maxWidth:100,unit:"metric"},b),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){dk(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,dk(this._map,this._container,this.options)}},FullscreenControl:class{constructor(b){this._fullscreen=!1,b&&b.container&&(b.container instanceof a.window.HTMLElement?this._container=b.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in a.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in a.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(b){return this._map=b,this._container||(this._container=this._map.getContainer()),this._controlContainer=h.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,a.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!a.window.document.fullscreenEnabled&&!a.window.document.webkitFullscreenEnabled)}_setupUI(){const b=this._fullscreenButton=h.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);h.create("span","mapboxgl-ctrl-icon",b).setAttribute("aria-hidden",!0),b.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(a.window.document.fullscreenElement||a.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()?a.window.document.exitFullscreen?a.window.document.exitFullscreen():a.window.document.webkitCancelFullScreen&&a.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends a.Evented{constructor(b){super(),this.options=a.extend(Object.create({closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}),b),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(b&&b.className?b.className.trim().split(/\s+/):[])}addTo(b){return this._map&&this.remove(),this._map=b,this.options.closeOnClick&&this._map.on("preclick",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(b){return this._lngLat=a.LngLat.convert(b),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._map._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(b){return this.setDOMContent(a.window.document.createTextNode(b))}setHTML(b){const c=a.window.document.createDocumentFragment(),d=a.window.document.createElement("body");let f;for(d.innerHTML=b;f=d.firstChild;)c.appendChild(f);return this.setDOMContent(c)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=h.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._container&&this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._container&&this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){let b;return this._classList.delete(a)?b=!1:(this._classList.add(a),b=!0),this._container&&this._updateClassList(),b}_createCloseButton(){this.options.closeButton&&(this._closeButton=h.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.setAttribute("aria-hidden","true"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_getAnchor(a){if(this.options.anchor)return this.options.anchor;const b=this._pos,c=this._container.offsetWidth,d=this._container.offsetHeight;let f;return f=b.y+a.bottom.ythis._map.transform.height-d?["bottom"]:[],b.xthis._map.transform.width-c/2&&f.push("right"),0===f.length?"bottom":f.join("-")}_updateClassList(){const a=[...this._classList];a.push("mapboxgl-popup"),this._anchor&&a.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&a.push("mapboxgl-popup-track-pointer"),this._container.className=a.join(" ")}_update(b){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=h.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=h.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=c9(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||b){const c=this._pos=this._trackPointer&&b?b:this._map.project(this._lngLat),d=function(b){if(b||(b=new a.pointGeometry(0,0)),"number"==typeof b){const c=Math.round(Math.sqrt(.5*Math.pow(b,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,b),"top-left":new a.pointGeometry(c,c),"top-right":new a.pointGeometry(-c,c),bottom:new a.pointGeometry(0,-b),"bottom-left":new a.pointGeometry(c,-c),"bottom-right":new a.pointGeometry(-c,-c),left:new a.pointGeometry(b,0),right:new a.pointGeometry(-b,0)}}if(b instanceof a.pointGeometry||Array.isArray(b)){const d=a.pointGeometry.convert(b);return{center:d,top:d,"top-left":d,"top-right":d,bottom:d,"bottom-left":d,"bottom-right":d,left:d,right:d}}return{center:a.pointGeometry.convert(b.center||[0,0,]),top:a.pointGeometry.convert(b.top||[0,0]),"top-left":a.pointGeometry.convert(b["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(b["top-right"]||[0,0]),bottom:a.pointGeometry.convert(b.bottom||[0,0,]),"bottom-left":a.pointGeometry.convert(b["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(b["bottom-right"]||[0,0]),left:a.pointGeometry.convert(b.left||[0,0]),right:a.pointGeometry.convert(b.right||[0,0,])}}(this.options.offset),f=this._anchor=this._getAnchor(d),g=c.add(d[f]).round();this._map._requestDomTask(()=>{this._container&&f&&(this._container.style.transform=`${da[f]} translate(${g.x}px,${g.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._content&&(this._content.style.opacity=a),this._tip&&(this._tip.style.opacity=a)}},Marker:db,Style:aW,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,FreeCameraOptions:cf,Evented:a.Evented,config:a.config,prewarm:function(){aa().acquire(Z)},clearPrewarmedResources:function(){const a=_;a&&(a.isPreloaded()&&1===a.numActive()?(a.release(Z),_=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 a.config.ACCESS_TOKEN},set accessToken(t){a.config.ACCESS_TOKEN=t},get baseApiUrl(){return a.config.API_URL},set baseApiUrl(t){a.config.API_URL=t},get workerCount(){return $.workerCount},set workerCount(e){$.workerCount=e},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){a.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(b){a.clearTileCache(b)},workerUrl:"",workerClass:null,setNow:a.exported.setNow,restoreNow:a.exported.restoreNow};return dm}),c})}},]) diff --git a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js index 1b24a0a671b5..46cf4db55072 100644 --- a/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js +++ b/crates/swc_ecma_minifier/tests/full/feedback-mapbox/785-e1932cc99ac3bb67/output.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[785],{840:function(a,b,c){var d;!function(e,f,g,h){"use strict";var i,j=["","webkit","Moz","MS","ms","o"],k=f.createElement("div"),l=Math.round,m=Math.abs,n=Date.now;function o(a,b,c){return setTimeout(v(a,c),b)}function p(a,b,c){return!!Array.isArray(a)&&(q(a,c[b],c),!0)}function q(a,b,c){var d;if(a){if(a.forEach)a.forEach(b,c);else if(h!==a.length)for(d=0;d\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=e.console&&(e.console.warn||e.console.log);return f&&f.call(e.console,d,c),a.apply(this,arguments)}}i="function"!=typeof Object.assign?function(a){if(a===h||null===a)throw TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c -1}function C(a){return a.trim().split(/\s+/g)}function D(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dD(e,g)&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function G(a,b){for(var c,d,e=b[0].toUpperCase()+b.slice(1),f=0;f1&&!c.firstMultiple?c.firstMultiple=V(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=W(d);b.timeStamp=n(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=$(h,i),b.distance=Z(h,i),T(c,b),b.offsetDirection=Y(b.deltaX,b.deltaY);var j=X(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=m(j.x)>m(j.y)?j.x:j.y,b.scale=g?aa(g.pointers,d):1,b.rotation=g?_(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,U(c,b);var k=a.element;A(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function T(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function U(a,b){var c,d,e,f,g=a.lastInterval||b,i=b.timeStamp-g.timeStamp;if(8!=b.eventType&&(i>25||h===g.velocity)){var j=b.deltaX-g.deltaX,k=b.deltaY-g.deltaY,l=X(i,j,k);d=l.x,e=l.y,c=m(l.x)>m(l.y)?l.x:l.y,f=Y(j,k),a.lastInterval=b}else c=g.velocity,d=g.velocityX,e=g.velocityY,f=g.direction;b.velocity=c,b.velocityX=d,b.velocityY=e,b.direction=f}function V(a){for(var b=[],c=0;c=m(b)?a<0?2:4:b<0?8:16}function Z(a,b,c){c||(c=O);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function $(a,b,c){c||(c=O);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function _(a,b){return $(b[1],b[0],P)+$(a[1],a[0],P)}function aa(a,b){return Z(b[0],b[1],P)/Z(a[0],a[1],P)}Q.prototype={handler:function(){},init:function(){this.evEl&&y(this.element,this.evEl,this.domHandler),this.evTarget&&y(this.target,this.evTarget,this.domHandler),this.evWin&&y(I(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&z(this.element,this.evEl,this.domHandler),this.evTarget&&z(this.target,this.evTarget,this.domHandler),this.evWin&&z(I(this.element),this.evWin,this.domHandler)}};var ab={mousedown:1,mousemove:2,mouseup:4};function ac(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,Q.apply(this,arguments)}u(ac,Q,{handler:function(a){var b=ab[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:N,srcEvent:a}))}});var ad={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ae={2:M,3:"pen",4:N,5:"kinect"},af="pointerdown",ag="pointermove pointerup pointercancel";function ah(){this.evEl=af,this.evWin=ag,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(af="MSPointerDown",ag="MSPointerMove MSPointerUp MSPointerCancel"),u(ah,Q,{handler:function(a){var b=this.store,c=!1,d=ad[a.type.toLowerCase().replace("ms","")],e=ae[a.pointerType]||a.pointerType,f=D(b,a.pointerId,"pointerId");1&d&&(0===a.button||e==M)?f<0&&(b.push(a),f=b.length-1):12&d&&(c=!0),!(f<0)&&(b[f]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:e,srcEvent:a}),c&&b.splice(f,1))}});var ai={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function aj(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Q.apply(this,arguments)}function ak(a,b){var c=E(a.touches),d=E(a.changedTouches);return 12&b&&(c=F(c.concat(d),"identifier",!0)),[c,d]}u(aj,Q,{handler:function(a){var b=ai[a.type];if(1===b&&(this.started=!0),this.started){var c=ak.call(this,a,b);12&b&&c[0].length-c[1].length==0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:M,srcEvent:a})}}});var al={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function am(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},Q.apply(this,arguments)}function an(a,b){var c=E(a.touches),d=this.targetIds;if(3&b&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=E(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return A(a.target,i)}),1===b)for(e=0;e -1&&d.splice(a,1)},2500)}}function ar(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){var b=this,c=this.state;function d(c){b.manager.emit(c,a)}c<8&&d(b.options.event+aD(c)),d(b.options.event),a.additionalEvent&&d(a.additionalEvent),c>=8&&d(b.options.event+aD(c))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ab.threshold&&e&b.direction},attrTest:function(a){return aG.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=aE(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),u(aI,aG,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ax]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),u(aJ,aC,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[av]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=o(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=n(),this.manager.emit(this.options.event,this._input)))}}),u(aK,aG,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ax]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),u(aL,aG,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return aH.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&m(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=aE(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),u(aM,aC,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[aw]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var c=1;ca.length)&&(b=a.length);for(var c=0,d=Array(b);cc?c:a}Math.hypot||(Math.hypot=function(){for(var a=0,b=arguments.length;b--;)a+=arguments[b]*arguments[b];return Math.sqrt(a)}),ab=new l(4),l!=Float32Array&&(ab[0]=0,ab[1]=0,ab[2]=0,ab[3]=0);const r=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function s(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],s=b[15],t=c[0],u=c[1],v=c[2],w=c[3];return a[0]=t*d+u*h+v*l+w*p,a[1]=t*e+u*i+v*m+w*q,a[2]=t*f+u*j+v*n+w*r,a[3]=t*g+u*k+v*o+w*s,t=c[4],u=c[5],v=c[6],w=c[7],a[4]=t*d+u*h+v*l+w*p,a[5]=t*e+u*i+v*m+w*q,a[6]=t*f+u*j+v*n+w*r,a[7]=t*g+u*k+v*o+w*s,t=c[8],u=c[9],v=c[10],w=c[11],a[8]=t*d+u*h+v*l+w*p,a[9]=t*e+u*i+v*m+w*q,a[10]=t*f+u*j+v*n+w*r,a[11]=t*g+u*k+v*o+w*s,t=c[12],u=c[13],v=c[14],w=c[15],a[12]=t*d+u*h+v*l+w*p,a[13]=t*e+u*i+v*m+w*q,a[14]=t*f+u*j+v*n+w*r,a[15]=t*g+u*k+v*o+w*s,a}function t(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p=c[0],q=c[1],r=c[2];return b===a?(a[12]=b[0]*p+b[4]*q+b[8]*r+b[12],a[13]=b[1]*p+b[5]*q+b[9]*r+b[13],a[14]=b[2]*p+b[6]*q+b[10]*r+b[14],a[15]=b[3]*p+b[7]*q+b[11]*r+b[15]):(d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],a[0]=d,a[1]=e,a[2]=f,a[3]=g,a[4]=h,a[5]=i,a[6]=j,a[7]=k,a[8]=l,a[9]=m,a[10]=n,a[11]=o,a[12]=d*p+h*q+l*r+b[12],a[13]=e*p+i*q+m*r+b[13],a[14]=f*p+j*q+n*r+b[14],a[15]=g*p+k*q+o*r+b[15]),a}function u(a,b,c){var d=c[0],e=c[1],f=c[2];return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a[4]=b[4]*e,a[5]=b[5]*e,a[6]=b[6]*e,a[7]=b[7]*e,a[8]=b[8]*f,a[9]=b[9]*f,a[10]=b[10]*f,a[11]=b[11]*f,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a}function v(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=1e-6*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=1e-6*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=1e-6*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=1e-6*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=1e-6*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=1e-6*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=1e-6*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=1e-6*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=1e-6*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=1e-6*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=1e-6*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=1e-6*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=1e-6*Math.max(1,Math.abs(r),Math.abs(H))}function w(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function x(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a}function y(a,b){if(!a)throw Error(b||"@math.gl/web-mercator: assertion failed.")}ac=new l(2),l!=Float32Array&&(ac[0]=0,ac[1]=0),ad=new l(3),l!=Float32Array&&(ad[0]=0,ad[1]=0,ad[2]=0);const z=Math.PI,A=z/4,B=z/180,C=180/z;function D(a){return Math.pow(2,a)}function E([a,b]){y(Number.isFinite(a)),y(Number.isFinite(b)&&b>= -90&&b<=90,"invalid latitude");const c=512*(z+Math.log(Math.tan(A+.5*(b*B))))/(2*z);return[512*(a*B+z)/(2*z),c]}function F([a,b]){const c=2*(Math.atan(Math.exp(b/512*(2*z)-z))-A);return[(a/512*(2*z)-z)*C,c*C,]}function G(a){return 2*Math.atan(.5/a)*C}function H(a){return .5/Math.tan(.5*a*B)}function I(a,b,c=0){const[d,e,f]=a;if(y(Number.isFinite(d)&&Number.isFinite(e),"invalid pixel coordinate"),Number.isFinite(f)){const g=n(b,[d,e,f,1,]);return g}const h=n(b,[d,e,0,1,]),i=n(b,[d,e,1,1,]),j=h[2],k=i[2];return x([],h,i,j===k?0:((c||0)-j)/(k-j))}const J=Math.PI/180;function K(a,b,c){const{pixelUnprojectionMatrix:d}=a,e=n(d,[b,0,1,1,]),f=n(d,[b,a.height,1,1,]),g=c*a.distanceScales.unitsPerMeter[2],h=(g-e[2])/(f[2]-e[2]),i=x([],e,f,h),j=F(i);return j[2]=c,j}class L{constructor({width:a,height:b,latitude:c=0,longitude:d=0,zoom:e=0,pitch:f=0,bearing:g=0,altitude:h=null,fovy:i=null,position:j=null,nearZMultiplier:k=.02,farZMultiplier:l=1.01}={width:1,height:1}){a=a||1,b=b||1,null===i&&null===h?i=G(h=1.5):null===i?i=G(h):null===h&&(h=H(i));const n=D(e);h=Math.max(.75,h);const o=function({latitude:a,longitude:b,highPrecision:c=!1}){y(Number.isFinite(a)&&Number.isFinite(b));const d={},e=Math.cos(a*B),f=512/360,g=f/e,h=512/4003e4/e;if(d.unitsPerMeter=[h,h,h,],d.metersPerUnit=[1/h,1/h,1/h,],d.unitsPerDegree=[f,g,h,],d.degreesPerUnit=[1/f,1/g,1/h,],c){const i=B*Math.tan(a*B)/e,j=f*i/2,k=512/4003e4*i,l=k/g*h;d.unitsPerDegree2=[0,j,k,],d.unitsPerMeter2=[l,0,l,]}return d}({longitude:d,latitude:c}),p=E([d,c]);if(p[2]=0,j){var q,r,s,v,w,x;v=p,w=p,x=(q=[],r=j,s=o.unitsPerMeter,q[0]=r[0]*s[0],q[1]=r[1]*s[1],q[2]=r[2]*s[2],q),v[0]=w[0]+x[0],v[1]=w[1]+x[1],v[2]=w[2]+x[2]}this.projectionMatrix=function({width:a,height:b,pitch:c,altitude:d,fovy:e,nearZMultiplier:f,farZMultiplier:g}){var h,i,j,k,l,m,n;const{fov:o,aspect:p,near:q,far:r}=function({width:a,height:b,fovy:c=G(1.5),altitude:d,pitch:e=0,nearZMultiplier:f=1,farZMultiplier:g=1}){void 0!==d&&(c=G(d));const h=.5*c*B,i=H(c),j=e*B,k=Math.sin(h)*i/Math.sin(Math.min(Math.max(Math.PI/2-j-h,.01),Math.PI-.01)),l=Math.sin(j)*k+i;return{fov:2*h,aspect:a/b,focalDistance:i,near:f,far:l*g}}({width:a,height:b,altitude:d,fovy:e,pitch:c,nearZMultiplier:f,farZMultiplier:g}),s=(h=[],i=o,j=p,k=q,l=r,n=1/Math.tan(i/2),h[0]=n/j,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=n,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=-1,h[12]=0,h[13]=0,h[15]=0,null!=l&&l!==1/0?(m=1/(k-l),h[10]=(l+k)*m,h[14]=2*l*k*m):(h[10]=-1,h[14]=-2*k),h);return s}({width:a,height:b,pitch:f,fovy:i,nearZMultiplier:k,farZMultiplier:l}),this.viewMatrix=function({height:a,pitch:b,bearing:c,altitude:d,scale:e,center:f=null}){var g,h,i,j,k,l,n,o,p,q,r,s,v,w,x,y,z,A,C,D,E,F,G,H,I,J,K,L;const M=m();return t(M,M,[0,0,-d]),g=M,h=M,i=-b*B,j=Math.sin(i),k=Math.cos(i),l=h[4],n=h[5],o=h[6],p=h[7],q=h[8],r=h[9],s=h[10],v=h[11],h!==g&&(g[0]=h[0],g[1]=h[1],g[2]=h[2],g[3]=h[3],g[12]=h[12],g[13]=h[13],g[14]=h[14],g[15]=h[15]),g[4]=l*k+q*j,g[5]=n*k+r*j,g[6]=o*k+s*j,g[7]=p*k+v*j,g[8]=q*k-l*j,g[9]=r*k-n*j,g[10]=s*k-o*j,g[11]=v*k-p*j,w=M,x=M,y=c*B,z=Math.sin(y),A=Math.cos(y),C=x[0],D=x[1],E=x[2],F=x[3],G=x[4],H=x[5],I=x[6],J=x[7],x!==w&&(w[8]=x[8],w[9]=x[9],w[10]=x[10],w[11]=x[11],w[12]=x[12],w[13]=x[13],w[14]=x[14],w[15]=x[15]),w[0]=C*A+G*z,w[1]=D*A+H*z,w[2]=E*A+I*z,w[3]=F*A+J*z,w[4]=G*A-C*z,w[5]=H*A-D*z,w[6]=I*A-E*z,w[7]=J*A-F*z,u(M,M,[e/=a,e,e]),f&&t(M,M,(K=[],L=f,K[0]=-L[0],K[1]=-L[1],K[2]=-L[2],K)),M}({height:b,scale:n,center:p,pitch:f,bearing:g,altitude:h}),this.width=a,this.height=b,this.scale=n,this.latitude=c,this.longitude=d,this.zoom=e,this.pitch=f,this.bearing=g,this.altitude=h,this.fovy=i,this.center=p,this.meterOffset=j||[0,0,0],this.distanceScales=o,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,q,r,v,w,x,y,z,A,B,C,D,E,F,G,H,I;const{width:J,height:K,projectionMatrix:L,viewMatrix:M}=this,N=m();s(N,N,L),s(N,N,M),this.viewProjectionMatrix=N;const O=m();u(O,O,[J/2,-K/2,1]),t(O,O,[1,-1,0]),s(O,O,N);const P=(a=m(),c=(b=O)[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],v=b[15],w=c*h-d*g,x=c*i-e*g,y=c*j-f*g,z=d*i-e*h,A=d*j-f*h,B=e*j-f*i,C=k*q-l*p,D=k*r-n*p,E=k*v-o*p,F=l*r-n*q,G=l*v-o*q,H=n*v-o*r,I=w*H-x*G+y*F+z*E-A*D+B*C,I?(I=1/I,a[0]=(h*H-i*G+j*F)*I,a[1]=(e*G-d*H-f*F)*I,a[2]=(q*B-r*A+v*z)*I,a[3]=(n*A-l*B-o*z)*I,a[4]=(i*E-g*H-j*D)*I,a[5]=(c*H-e*E+f*D)*I,a[6]=(r*y-p*B-v*x)*I,a[7]=(k*B-n*y+o*x)*I,a[8]=(g*G-h*E+j*C)*I,a[9]=(d*E-c*G-f*C)*I,a[10]=(p*A-q*y+v*w)*I,a[11]=(l*y-k*A-o*w)*I,a[12]=(h*D-g*F-i*C)*I,a[13]=(c*F-d*D+e*C)*I,a[14]=(q*x-p*z-r*w)*I,a[15]=(k*z-l*x+n*w)*I,a):null);if(!P)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=O,this.pixelUnprojectionMatrix=P}equals(a){return a instanceof L&&a.width===this.width&&a.height===this.height&&v(a.projectionMatrix,this.projectionMatrix)&&v(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:b=!0}={}){const c=this.projectPosition(a),d=function(a,b){const[c,d,e=0]=a;return y(Number.isFinite(c)&&Number.isFinite(d)&&Number.isFinite(e)),n(b,[c,d,e,1])}(c,this.pixelProjectionMatrix),[e,f]=d,g=b?f:this.height-f;return 2===a.length?[e,g]:[e,g,d[2]]}unproject(a,{topLeft:b=!0,targetZ:c}={}){const[d,e,f]=a,g=b?e:this.height-e,h=c&&c*this.distanceScales.unitsPerMeter[2],i=I([d,g,f],this.pixelUnprojectionMatrix,h),[j,k,l]=this.unprojectPosition(i);return Number.isFinite(f)?[j,k,l]:Number.isFinite(c)?[j,k,c]:[j,k]}projectPosition(a){const[b,c]=E(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=F(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return E(a)}unprojectFlat(a){return F(a)}getMapCenterByLngLatPosition({lngLat:a,pos:b}){var c,d;const e=I(b,this.pixelUnprojectionMatrix),f=E(a),g=w([],f,(c=[],d=e,c[0]=-d[0],c[1]=-d[1],c)),h=w([],this.center,g);return F(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(a,b={}){const{width:c,height:d}=this,{longitude:e,latitude:f,zoom:g}=function({width:a,height:b,bounds:c,minExtent:d=0,maxZoom:e=24,padding:f=0,offset:g=[0,0]}){const[[h,i],[j,k]]=c;if(Number.isFinite(f)){const l=f;f={top:l,bottom:l,left:l,right:l}}else y(Number.isFinite(f.top)&&Number.isFinite(f.bottom)&&Number.isFinite(f.left)&&Number.isFinite(f.right));const m=E([h,q(k,-85.051129,85.051129),]),n=E([j,q(i,-85.051129,85.051129),]),o=[Math.max(Math.abs(n[0]-m[0]),d),Math.max(Math.abs(n[1]-m[1]),d),],p=[a-f.left-f.right-2*Math.abs(g[0]),b-f.top-f.bottom-2*Math.abs(g[1]),];y(p[0]>0&&p[1]>0);const s=p[0]/o[0],t=p[1]/o[1],u=(f.right-f.left)/2/s,v=(f.bottom-f.top)/2/t,w=[(n[0]+m[0])/2+u,(n[1]+m[1])/2+v,],x=F(w),z=Math.min(e,r(Math.abs(Math.min(s,t))));return y(Number.isFinite(z)),{longitude:x[0],latitude:x[1],zoom:z}}(Object.assign({width:c,height:d,bounds:a},b));return new L({width:c,height:d,longitude:e,latitude:f,zoom:g})}getBounds(a){const b=this.getBoundingRegion(a),c=Math.min(...b.map(a=>a[0])),d=Math.max(...b.map(a=>a[0])),e=Math.min(...b.map(a=>a[1])),f=Math.max(...b.map(a=>a[1]));return[[c,e],[d,f],]}getBoundingRegion(a={}){return function(a,b=0){const{width:c,height:d,unproject:e}=a,f={targetZ:b},g=e([0,d],f),h=e([c,d],f);let i,j;const k=a.fovy?.5*a.fovy*J:Math.atan(.5/a.altitude),l=(90-a.pitch)*J;return k>l-.01?(i=K(a,0,b),j=K(a,c,b)):(i=e([0,0],f),j=e([c,0],f)),[g,h,j,i]}(this,a.z||0)}}const M=["longitude","latitude","zoom"],N={curve:1.414,speed:1.2};function O(a,b,c){var d,e,f,g,h,i;c=Object.assign({},N,c);const j=c.curve,k=a.zoom,l=[a.longitude,a.latitude],m=D(k),n=b.zoom,o=[b.longitude,b.latitude],p=D(n-k),q=E(l),r=E(o),s=(d=[],e=r,f=q,d[0]=e[0]-f[0],d[1]=e[1]-f[1],d),t=Math.max(a.width,a.height),u=t/p,v=(h=(g=s)[0],i=g[1],Math.hypot(h,i)*m),w=Math.max(v,.01),x=j*j,y=(u*u-t*t+x*x*w*w)/(2*t*x*w),z=(u*u-t*t-x*x*w*w)/(2*u*x*w),A=Math.log(Math.sqrt(y*y+1)-y),B=Math.log(Math.sqrt(z*z+1)-z);return{startZoom:k,startCenterXY:q,uDelta:s,w0:t,u1:v,S:(B-A)/j,rho:j,rho2:x,r0:A,r1:B}}var P=function(){if("undefined"!=typeof Map)return Map;function a(a,b){var c=-1;return a.some(function(a,d){return a[0]===b&&(c=d,!0)}),c}return function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(b){var c=a(this.__entries__,b),d=this.__entries__[c];return d&&d[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(b){var c=this.__entries__,d=a(c,b);~d&&c.splice(d,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(a,b){void 0===b&&(b=null);for(var c=0,d=this.__entries__;c0},a.prototype.connect_=function(){Q&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),U?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},a.prototype.disconnect_=function(){Q&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},a.prototype.onTransitionEnd_=function(a){var b=a.propertyName,c=void 0===b?"":b;T.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a),this.instance_},a.instance_=null,a}(),W=function(a,b){for(var c=0,d=Object.keys(b);c0},a}(),ah="undefined"!=typeof WeakMap?new WeakMap:new P,ai=function(){function a(b){if(!(this instanceof a))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var c=V.getInstance(),d=new ag(b,c,this);ah.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){ai.prototype[a]=function(){var b;return(b=ah.get(this))[a].apply(b,arguments)}});var aj=void 0!==R.ResizeObserver?R.ResizeObserver:ai;function ak(a,b){if(!(a instanceof b))throw TypeError("Cannot call a class as a function")}function al(a,b){for(var c=0;c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function ar(a,b){if(a){if("string"==typeof a)return as(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return as(a,b)}}function as(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c1&& void 0!==arguments[1]?arguments[1]:"component";a.debug&&j.checkPropTypes(aw,a,"prop",b)}var az=function(){function a(b){var c=this;if(ak(this,a),g(this,"props",ax),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return am(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var c=this._map.getContainer(),d=b.container;for(d.classList.add("mapboxgl-map");c.childNodes.length>0;)d.appendChild(c.childNodes[0]);this._map._container=d,a.savedMap=null,b.mapStyle&&this._map.setStyle(au(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=c,b.gl}}var d={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:au(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(d.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},d,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(a){var b=this;a=Object.assign({},ax,a),ay(a,"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||ax.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var c=a.container;Object.defineProperty(c,"offsetWidth",{configurable:!0,get:function(){return b.width}}),Object.defineProperty(c,"clientWidth",{configurable:!0,get:function(){return b.width}}),Object.defineProperty(c,"offsetHeight",{configurable:!0,get:function(){return b.height}}),Object.defineProperty(c,"clientHeight",{configurable:!0,get:function(){return b.height}});var d=this._map.getCanvas();d&&(d.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(a,b){if(this._map){ay(b=Object.assign({},this.props,b),"Mapbox");var c=this._updateMapViewport(a,b),d=this._updateMapSize(a,b);this._updateMapStyle(a,b),!b.asyncRender&&(c||d)&&this.redraw(),this.props=b}}},{key:"_updateMapStyle",value:function(a,b){a.mapStyle!==b.mapStyle&&this._map.setStyle(au(b.mapStyle),{diff:!b.preventStyleDiffing})}},{key:"_updateMapSize",value:function(a,b){var c=a.width!==b.width||a.height!==b.height;return c&&(this.width=b.width,this.height=b.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(a,b){var c=this._getViewState(a),d=this._getViewState(b),e=d.latitude!==c.latitude||d.longitude!==c.longitude||d.zoom!==c.zoom||d.pitch!==c.pitch||d.bearing!==c.bearing||d.altitude!==c.altitude;return e&&(this._map.jumpTo(this._viewStateToMapboxProps(d)),d.altitude!==c.altitude&&(this._map.transform.altitude=d.altitude)),e}},{key:"_getViewState",value:function(a){var b=a.viewState||a,c=b.longitude,d=b.latitude,e=b.zoom,f=b.pitch,g=b.bearing,h=b.altitude;return{longitude:c,latitude:d,zoom:e,pitch:void 0===f?0:f,bearing:void 0===g?0:g,altitude:void 0===h?1.5:h}}},{key:"_checkStyleSheet",value:function(){var a=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==an)try{var b=an.createElement("div");if(b.className="mapboxgl-map",b.style.display="none",an.body.appendChild(b),!("static"!==window.getComputedStyle(b).position)){var c=an.createElement("link");c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(a,"/mapbox-gl.css")),an.head.appendChild(c)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude,],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}},]),a}();g(az,"initialized",!1),g(az,"propTypes",aw),g(az,"defaultProps",ax),g(az,"savedMap",null);var aA=c(6158),aB=c.n(aA);function aC(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function aD(a,b){if(a===b)return!0;if(aC(a)&&aC(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function aE(a,b,c){return Math.max(b,Math.min(c,a))}function aF(a,b,c){return aC(a)?a.map(function(a,d){return aF(a,b[d],c)}):c*b+(1-c)*a}function aG(a,b){if(!a)throw Error(b||"react-map-gl: assertion failed.")}function aH(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function aI(a){for(var b=1;b0,"`scale` must be a positive number");var e=this._state,f=e.startZoom,g=e.startZoomLngLat;Number.isFinite(f)||(f=this._viewportProps.zoom,g=this._unproject(c)||this._unproject(b)),aG(g,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var h=this._calculateNewZoom({scale:d,startZoom:f||0}),i=new L(Object.assign({},this._viewportProps,{zoom:h})),j=i.getMapCenterByLngLatPosition({lngLat:g,pos:b}),l=k(j,2),m=l[0],n=l[1];return this._getUpdatedMapState({zoom:h,longitude:m,latitude:n})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=aE(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=aE(g,f,e),Object.assign(a,function({width:a,height:b,longitude:c,latitude:d,zoom:e,pitch:f=0,bearing:g=0}){(c< -180||c>180)&&(c=o(c+180,360)-180),(g< -180||g>180)&&(g=o(g+180,360)-180);const h=r(b/512);if(e<=h)e=h,d=0;else{const i=b/2/Math.pow(2,e),j=F([0,i])[1];if(dk&&(d=k)}}return{width:a,height:b,longitude:c,latitude:d,zoom:e,pitch:f,bearing:g}}(a)),a}},{key:"_unproject",value:function(a){var b=new L(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new L(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var b=a.scale,c=a.startZoom,d=this._viewportProps,e=d.maxZoom,f=d.minZoom,g=c+Math.log2(b);return aE(g,f,e)}},{key:"_calculateNewPitchAndBearing",value:function(a){var b=a.deltaScaleX,c=a.deltaScaleY,d=a.startBearing,e=a.startPitch;c=aE(c,-1,1);var f=this._viewportProps,g=f.minPitch,h=f.maxPitch,i=e;return c>0?i=e+c*(h-e):c<0&&(i=e-c*(g-e)),{pitch:i,bearing:d+180*b}}},{key:"_getRotationParams",value:function(a,b){var c=a[0]-b[0],d=a[1]-b[1],e=a[1],f=b[1],g=this._viewportProps,h=g.width,i=g.height,j=0;return d>0?Math.abs(i-f)>5&&(j=d/(f-i)*1.2):d<0&&f>5&&(j=1-e/f),{deltaScaleX:c/h,deltaScaleY:j=Math.min(1,Math.max(-1,j))}}},]),a}();function aM(a){return a[0].toLowerCase()+a.slice(1)}function aN(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function aO(a){for(var b=1;b1&& void 0!==arguments[1]?arguments[1]:{},d=a.current&&a.current.getMap();return d&&d.queryRenderedFeatures(b,c)}}},[]);var q=(0,i.useCallback)(function(a){var b=a.target;b===n.current&&b.scrollTo(0,0)},[]),r=p&&i.createElement(aQ,{value:aV(aV({},o),{},{viewport:o.viewport||aX(aV({map:p,props:a},g)),map:p,container:o.container||m.current})},i.createElement("div",{key:"map-overlays",className:"overlays",ref:n,style:aY,onScroll:q},a.children)),s=a.className,t=a.width,u=a.height,v=a.style,w=a.visibilityConstraints,x=Object.assign({position:"relative"},v,{width:t,height:u}),y=a.visible&&function(a){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:aJ;for(var c in b){var d=c.slice(0,3),e=aM(c.slice(3));if("min"===d&&a[e]b[c])return!1}return!0}(a.viewState||a,w),z=Object.assign({},aY,{visibility:y?"inherit":"hidden"});return i.createElement("div",{key:"map-container",ref:m,style:x},i.createElement("div",{key:"map-mapbox",ref:l,style:z,className:s}),r,!d&&!a.disableTokenWarning&&i.createElement(a_,null))});a0.supported=function(){return aB()&&aB().supported()},a0.propTypes=aZ,a0.defaultProps=a$;var a1=a0;function a2(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(d.s();!(c=d.n()).done;){var e=c.value;if(!aD(a[e],b[e]))return!1}}catch(f){d.e(f)}finally{d.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){aG(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(a,b){return b.transitionDuration}},]),a}();function a4(a){if(void 0===a)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function a5(a,b){return(a5=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function a6(a,b){if("function"!=typeof b&&null!==b)throw TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&a5(a,b)}function a7(a){return(a7="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function a8(a,b){if(b&&("object"===a7(b)||"function"==typeof b))return b;if(void 0!==b)throw TypeError("Derived constructors may only return object or undefined");return a4(a)}function a9(a){return(a9=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var ba={longitude:1,bearing:1};function bb(a){return Number.isFinite(a)||Array.isArray(a)}function bc(a,b,c){return a in ba&&Math.abs(c-b)>180&&(c=c<0?c+360:c-360),c}function bd(a,b){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=be(a))||b&&a&&"number"==typeof a.length){e&&(a=e);var c=0,d=function(){};return{s:d,n:function(){return c>=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function be(a,b){if(a){if("string"==typeof a)return bf(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return bf(a,b)}}function bf(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function bl(a,b){if(a){if("string"==typeof a)return bm(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return bm(a,b)}}function bm(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c0&& void 0!==arguments[0]?arguments[0]:{};return ak(this,e),g(a4(a=d.call(this)),"propNames",bg),a.props=Object.assign({},bj,b),a}am(e,[{key:"initializeProps",value:function(a,b){var c,d={},e={},f=bd(bh);try{for(f.s();!(c=f.n()).done;){var g=c.value,h=a[g],i=b[g];aG(bb(h)&&bb(i),"".concat(g," must be supplied for transition")),d[g]=h,e[g]=bc(g,h,i)}}catch(j){f.e(j)}finally{f.f()}var k,l=bd(bi);try{for(l.s();!(k=l.n()).done;){var m=k.value,n=a[m]||0,o=b[m]||0;d[m]=n,e[m]=bc(m,n,o)}}catch(p){l.e(p)}finally{l.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(a,b,c){var d,e=function(a,b,c,d={}){var e,f,g;const h={},{startZoom:i,startCenterXY:j,uDelta:k,w0:l,u1:m,S:n,rho:o,rho2:q,r0:s}=O(a,b,d);if(m<.01){for(const t of M){const u=a[t],v=b[t];h[t]=p(u,v,c)}return h}const x=c*n,y=Math.cosh(s)/Math.cosh(s+o*x),z=l*((Math.cosh(s)*Math.tanh(s+o*x)-Math.sinh(s))/q)/m,A=i+r(1/y),B=(e=[],f=k,g=z,e[0]=f[0]*g,e[1]=f[1]*g,e);w(B,B,j);const C=F(B);return h.longitude=C[0],h.latitude=C[1],h.zoom=A,h}(a,b,c,this.props),f=bd(bi);try{for(f.s();!(d=f.n()).done;){var g=d.value;e[g]=aF(a[g],b[g],c)}}catch(h){f.e(h)}finally{f.f()}return e}},{key:"getDuration",value:function(a,b){var c=b.transitionDuration;return"auto"===c&&(c=function(a,b,c={}){c=Object.assign({},N,c);const{screenSpeed:d,speed:e,maxDuration:f}=c,{S:g,rho:h}=O(a,b,c),i=1e3*g;let j;return j=Number.isFinite(d)?i/(d/h):i/e,Number.isFinite(f)&&j>f?0:j}(a,b,this.props)),c}},])}(a3);var bn=["longitude","latitude","zoom","bearing","pitch",],bo=function(a){a6(e,a);var b,c,d=(b=e,c=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,d=a9(b);if(c){var e=a9(this).constructor;a=Reflect.construct(d,arguments,e)}else a=d.apply(this,arguments);return a8(this,a)});function e(){var a,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return ak(this,e),a=d.call(this),Array.isArray(b)&&(b={transitionProps:b}),a.propNames=b.transitionProps||bn,b.around&&(a.around=b.around),a}return am(e,[{key:"initializeProps",value:function(a,b){var c={},d={};if(this.around){c.around=this.around;var e=new L(a).unproject(this.around);Object.assign(d,b,{around:new L(b).project(e),aroundLngLat:e})}var f,g=bk(this.propNames);try{for(g.s();!(f=g.n()).done;){var h=f.value,i=a[h],j=b[h];aG(bb(i)&&bb(j),"".concat(h," must be supplied for transition")),c[h]=i,d[h]=bc(h,i,j)}}catch(k){g.e(k)}finally{g.f()}return{start:c,end:d}}},{key:"interpolateProps",value:function(a,b,c){var d,e={},f=bk(this.propNames);try{for(f.s();!(d=f.n()).done;){var g=d.value;e[g]=aF(a[g],b[g],c)}}catch(h){f.e(h)}finally{f.f()}if(b.around){var i=new L(Object.assign({},b,e)).getMapCenterByLngLatPosition({lngLat:b.aroundLngLat,pos:aF(a.around,b.around,c)}),j=k(i,2),l=j[0],m=j[1];e.longitude=l,e.latitude=m}return e}},]),e}(a3),bp=function(){},bq={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},br={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new bo,transitionInterruption:bq.BREAK,onTransitionStart:bp,onTransitionInterrupt:bp,onTransitionEnd:bp},bs=function(){function a(){var b=this,c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};ak(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){b._animationFrame=requestAnimationFrame(b._onTransitionFrame),b._updateViewport()}),this.props=null,this.onViewportChange=c.onViewportChange||bp,this.onStateChange=c.onStateChange||bp,this.time=c.getTime||Date.now}return am(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(a){var b=this.props;if(this.props=a,!b||this._shouldIgnoreViewportChange(b,a))return!1;if(this._isTransitionEnabled(a)){var c=Object.assign({},b),d=Object.assign({},a);if(this._isTransitionInProgress()&&(b.onTransitionInterrupt(),this.state.interruption===bq.SNAP_TO_END?Object.assign(c,this.state.endProps):Object.assign(c,this.state.propsInTransition),this.state.interruption===bq.UPDATE)){var e,f,g,h=this.time(),i=(h-this.state.startTime)/this.state.duration;d.transitionDuration=this.state.duration-(h-this.state.startTime),d.transitionEasing=(g=(e=this.state.easing)(f=i),function(a){return 1/(1-g)*(e(a*(1-f)+f)-g)}),d.transitionInterpolator=c.transitionInterpolator}return d.onTransitionStart(),this._triggerTransition(c,d),!0}return this._isTransitionInProgress()&&(b.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(a,b){return!a||(this._isTransitionInProgress()?this.state.interruption===bq.IGNORE||this._isUpdateDueToCurrentTransition(b):!this._isTransitionEnabled(b)||b.transitionInterpolator.arePropsEqual(a,b))}},{key:"_triggerTransition",value:function(a,b){aG(this._isTransitionEnabled(b)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=b.transitionInterpolator,d=c.getDuration?c.getDuration(a,b):b.transitionDuration;if(0!==d){var e=b.transitionInterpolator.initializeProps(a,b),f={inTransition:!0,isZooming:a.zoom!==b.zoom,isPanning:a.longitude!==b.longitude||a.latitude!==b.latitude,isRotating:a.bearing!==b.bearing||a.pitch!==b.pitch};this.state={duration:d,easing:b.transitionEasing,interpolator:b.transitionInterpolator,interruption:b.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var a=this.time(),b=this.state,c=b.startTime,d=b.duration,e=b.easing,f=b.interpolator,g=b.startProps,h=b.endProps,i=!1,j=(a-c)/d;j>=1&&(j=1,i=!0),j=e(j);var k=f.interpolateProps(g,h,j),l=new aL(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),i&&(this._endTransition(),this.props.onTransitionEnd())}},]),a}();g(bs,"defaultProps",br);var bt=c(840),bu=c.n(bt);const bv={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&&!function(a,b){for(let c=0;cb.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(bu().PointerEventInput),bu().MouseInput.prototype.handler=function(a){let b=bv[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const bw=bu().Manager;var bx=bu();const by=bx?[[bx.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[bx.Rotate,{enable:!1},],[bx.Pinch,{enable:!1},],[bx.Swipe,{enable:!1},],[bx.Pan,{threshold:0,enable:!1},],[bx.Press,{enable:!1},],[bx.Tap,{event:"doubletap",taps:2,enable:!1},],[bx.Tap,{event:"anytap",enable:!1},],[bx.Tap,{enable:!1},],]:null,bz={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},bA={doubletap:["tap"]},bB={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},bC={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},bD={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},bE={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},bF="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",bG="undefined"!=typeof window?window:c.g;void 0!==c.g?c.g:window;let bH=!1;try{const bI={get passive(){return bH=!0,!0}};bG.addEventListener("test",bI,bI),bG.removeEventListener("test",bI,bI)}catch(bJ){}const bK=-1!==bF.indexOf("firefox"),{WHEEL_EVENTS:bL}=bC,bM="wheel";class bN{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.events=bL.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(b=>a.addEventListener(b,this.handleEvent,!!bH&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bM&&(this.options.enable=b)}handleEvent(a){if(!this.options.enable)return;let b=a.deltaY;bG.WheelEvent&&(bK&&a.deltaMode===bG.WheelEvent.DOM_DELTA_PIXEL&&(b/=bG.devicePixelRatio),a.deltaMode===bG.WheelEvent.DOM_DELTA_LINE&&(b*=40));const c={x:a.clientX,y:a.clientY};0!==b&&b%4.000244140625==0&&(b=Math.floor(b/4.000244140625)),a.shiftKey&&b&&(b*=.25),this._onWheel(a,-b,c)}_onWheel(a,b,c){this.callback({type:bM,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:bO}=bC,bP="pointermove",bQ="pointerover",bR="pointerout",bS="pointerleave";class bT{constructor(a,b,c={}){this.element=a,this.callback=b,this.pressed=!1,this.options=Object.assign({enable:!0},c),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=bO.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bP&&(this.enableMoveEvent=b),a===bQ&&(this.enableOverEvent=b),a===bR&&(this.enableOutEvent=b),a===bS&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:bQ,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:bR,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:bS,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:bP,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:bU}=bC,bV="keydown",bW="keyup";class bX{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=bU.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=c.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bV&&(this.enableDownEvent=b),a===bW&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:bV,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:bW,srcEvent:a,key:a.key,target:a.target}))}}const bY="contextmenu";class bZ{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===bY&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:bY,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const b$={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},b_={srcElement:"root",priority:0};class b0{constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(a,b,c,d=!1,e=!1){const{handlers:f,handlersByElement:g}=this;c&&("object"!=typeof c||c.addEventListener)&&(c={srcElement:c}),c=c?Object.assign({},b_,c):b_;let h=g.get(c.srcElement);h||(h=[],g.set(c.srcElement,h));const i={type:a,handler:b,srcElement:c.srcElement,priority:c.priority};d&&(i.once=!0),e&&(i.passive=!0),f.push(i),this._active=this._active||!i.passive;let j=h.length-1;for(;j>=0&&!(h[j].priority>=i.priority);)j--;h.splice(j+1,0,i)}remove(a,b){const{handlers:c,handlersByElement:d}=this;for(let e=c.length-1;e>=0;e--){const f=c[e];if(f.type===a&&f.handler===b){c.splice(e,1);const g=d.get(f.srcElement);g.splice(g.indexOf(f),1),0===g.length&&d.delete(f.srcElement)}}this._active=c.some(a=>!a.passive)}handleEvent(a){if(this.isEmpty())return;const b=this._normalizeEvent(a);let c=a.srcEvent.target;for(;c&&c!==b.rootElement;){if(this._emit(b,c),b.handled)return;c=c.parentNode}this._emit(b,"root")}_emit(a,b){const c=this.handlersByElement.get(b);if(c){let d=!1;const e=()=>{a.handled=!0},f=()=>{a.handled=!0,d=!0},g=[];for(let h=0;h{const b=this.manager.get(a);b&&bz[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[g,h]of(this.wheelInput=new bN(a,this._onOtherEvent,{enable:!1}),this.moveInput=new bT(a,this._onOtherEvent,{enable:!1}),this.keyInput=new bX(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new bZ(a,this._onOtherEvent,{enable:!1}),this.events))h.isEmpty()||(this._toggleRecognizer(h.recognizerName,!0),this.manager.on(g,h.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:c}=this;if(!c)return;const d=c.get(a);if(d&&d.options.enable!==b){d.set({enable:b});const e=bA[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=c.get(e);b?(f.requireFailure(a),d.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(a,b,c,d,e){if("string"!=typeof a){for(const f in c=b,a)this._addEventHandler(f,a[f],c,d,e);return}const{manager:g,events:h}=this,i=bE[a]||a;let j=h.get(i);!j&&(j=new b0(this),h.set(i,j),j.recognizerName=bD[i]||i,g&&g.on(i,j.handleEvent)),j.add(a,b,c,d,e),j.isEmpty()||this._toggleRecognizer(j.recognizerName,!0)}_removeEventHandler(a,b){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,e=bE[a]||a,f=d.get(e);if(f&&(f.remove(a,b),f.isEmpty())){const{recognizerName:g}=f;let h=!1;for(const i of d.values())if(i.recognizerName===g&&!i.isEmpty()){h=!0;break}h||this._toggleRecognizer(g,!1)}}_onBasicInput(a){const{srcEvent:b}=a,c=bB[b.type];c&&this.manager.emit(c,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function b2(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function b3(a){for(var b=1;b0),g=f&&!this.state.isHovering,h=!f&&this.state.isHovering;(d||g)&&(a.features=b,d&&d(a)),g&&cg.call(this,"onMouseEnter",a),h&&cg.call(this,"onMouseLeave",a),(g||h)&&this.setState({isHovering:f})}}function ck(a){var b=this.props,c=b.onClick,d=b.onNativeClick,e=b.onDblClick,f=b.doubleClickZoom,g=[],h=e||f;switch(a.type){case"anyclick":g.push(d),h||g.push(c);break;case"click":h&&g.push(c)}(g=g.filter(Boolean)).length&&((a=ce.call(this,a)).features=cf.call(this,a.point),g.forEach(function(b){return b(a)}))}var cl=(0,i.forwardRef)(function(a,b){var c,g,h=(0,i.useContext)(aR),j=(0,i.useMemo)(function(){return a.controller||new b8},[]),k=(0,i.useMemo)(function(){return new b1(null,{touchAction:a.touchAction,recognizerOptions:a.eventRecognizerOptions})},[]),l=(0,i.useRef)(null),m=(0,i.useRef)(null),n=(0,i.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;n.props=a,n.map=m.current&&m.current.getMap(),n.setState=function(b){n.state=ca(ca({},n.state),b),l.current.style.cursor=a.getCursor(n.state)};var o=!0,p=function(a,b,d){if(o){c=[a,b,d,];return}var e=n.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(a,"position",{get:function(){return[0,0,aT(n.map,a),]}}),f&&f({viewState:a,interactionState:b,oldViewState:d}),g&&g(a,b,d)};(0,i.useImperativeHandle)(b,function(){var a;return{getMap:(a=m).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var q=(0,i.useMemo)(function(){return ca(ca({},h),{},{eventManager:k,container:h.container||l.current})},[h,l.current]);q.onViewportChange=p,q.viewport=h.viewport||aX(n),n.viewport=q.viewport;var r=function(a){var b=a.isDragging,c=void 0!==b&&b;if(c!==n.state.isDragging&&n.setState({isDragging:c}),o){g=a;return}var d=n.props.onInteractionStateChange;d&&d(a)},s=function(){n.width&&n.height&&j.setOptions(ca(ca(ca({},n.props),n.props.viewState),{},{isInteractive:Boolean(n.props.onViewStateChange||n.props.onViewportChange),onViewportChange:p,onStateChange:r,eventManager:k,width:n.width,height:n.height}))},t=function(a){var b=a.width,c=a.height;n.width=b,n.height=c,s(),n.props.onResize({width:b,height:c})};(0,i.useEffect)(function(){return k.setElement(l.current),k.on({pointerdown:ch.bind(n),pointermove:cj.bind(n),pointerup:ci.bind(n),pointerleave:cg.bind(n,"onMouseOut"),click:ck.bind(n),anyclick:ck.bind(n),dblclick:cg.bind(n,"onDblClick"),wheel:cg.bind(n,"onWheel"),contextmenu:cg.bind(n,"onContextMenu")}),function(){k.destroy()}},[]),aS(function(){if(c){var a;p.apply(void 0,function(a){if(Array.isArray(a))return e(a)}(a=c)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||f(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}g&&r(g)}),s();var u=a.width,v=a.height,w=a.style,x=a.getCursor,y=(0,i.useMemo)(function(){return ca(ca({position:"relative"},w),{},{width:u,height:v,cursor:x(n.state)})},[w,u,v,x,n.state]);return c&&n._child||(n._child=i.createElement(aQ,{value:q},i.createElement("div",{key:"event-canvas",ref:l,style:y},i.createElement(a1,d({},a,{width:"100%",height:"100%",style:null,onResize:t,ref:m}))))),o=!1,n._child});cl.supported=a1.supported,cl.propTypes=cb,cl.defaultProps=cd;var cm=cl;function cn(a,b){if(a===b)return!0;if(!a||!b)return!1;if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(var c=0;c prop: ".concat(d))}}(l,a,c.current):l=function(a,b,c){if(a.style&&a.style._loaded){var d=function(a){for(var b=1;b=0||(e[c]=a[c]);return e}(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d=0)&&Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}(c,["layout","paint","filter","minzoom","maxzoom","beforeId",]);if(l!==d.beforeId&&a.moveLayer(b,l),f!==d.layout){var n=d.layout||{};for(var o in f)cn(f[o],n[o])||a.setLayoutProperty(b,o,f[o]);for(var p in n)f.hasOwnProperty(p)||a.setLayoutProperty(b,p,void 0)}if(h!==d.paint){var q=d.paint||{};for(var r in h)cn(h[r],q[r])||a.setPaintProperty(b,r,h[r]);for(var s in q)h.hasOwnProperty(s)||a.setPaintProperty(b,s,void 0)}for(var t in cn(i,d.filter)||a.setFilter(b,i),(j!==d.minzoom||k!==d.maxzoom)&&a.setLayerZoomRange(b,j,k),m)cn(m[t],d[t])||a.setLayerProperty(b,t,m[t])}(a,b,c,d)}catch(e){console.warn(e)}}(h,g,a,c.current):function(a,b,c){if(a.style&&a.style._loaded){var d=cs(cs({},c),{},{id:b});delete d.beforeId,a.addLayer(d,c.beforeId)}}(h,g,a),c.current=a,null}).propTypes=ct;var cv={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},cw={captureScroll:j.bool,captureDrag:j.bool,captureClick:j.bool,captureDoubleClick:j.bool,capturePointerMove:j.bool};function cx(){var a=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},b=(0,i.useContext)(aR),c=(0,i.useRef)(null),d=(0,i.useRef)({props:a,state:{},context:b,containerRef:c}),e=d.current;return e.props=a,e.context=b,(0,i.useEffect)(function(){return function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(b){var c=a.props;c.captureScroll&&b.stopPropagation(),c.onScroll&&c.onScroll(b,a)},panstart:function(b){var c=a.props;c.captureDrag&&b.stopPropagation(),c.onDragStart&&c.onDragStart(b,a)},anyclick:function(b){var c=a.props;c.captureClick&&b.stopPropagation(),c.onNativeClick&&c.onNativeClick(b,a)},click:function(b){var c=a.props;c.captureClick&&b.stopPropagation(),c.onClick&&c.onClick(b,a)},dblclick:function(b){var c=a.props;c.captureDoubleClick&&b.stopPropagation(),c.onDoubleClick&&c.onDoubleClick(b,a)},pointermove:function(b){var c=a.props;c.capturePointerMove&&b.stopPropagation(),c.onPointerMove&&c.onPointerMove(b,a)}};return c.watch(d,b),function(){c.off(d)}}}(e)},[b.eventManager]),e}function cy(a){var b=a.instance,c=cx(a),d=c.context,e=c.containerRef;return b._context=d,b._containerRef=e,b._render()}var cz=function(a){a6(f,a);var b,c,e=(b=f,c=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,d=a9(b);if(c){var e=a9(this).constructor;a=Reflect.construct(d,arguments,e)}else a=d.apply(this,arguments);return a8(this,a)});function f(){var a;ak(this,f);for(var b=arguments.length,c=Array(b),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var d="x"===c?a.offsetWidth:a.offsetHeight;return cI(b/100*d)/d*100};function cK(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}var cL=Object.assign({},cC,{className:j.string,longitude:j.number.isRequired,latitude:j.number.isRequired,style:j.object}),cM=Object.assign({},cD,{className:""});function cN(a){var b,c,d,e,f,h,j,l,m=(b=a,d=(c=k((0,i.useState)(null),2))[0],e=c[1],f=k((0,i.useState)(null),2),h=f[0],j=f[1],l=cx(cB(cB({},b),{},{onDragStart:cG})),l.callbacks=b,l.state.dragPos=d,l.state.setDragPos=e,l.state.dragOffset=h,l.state.setDragOffset=j,(0,i.useEffect)(function(){return function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return function(a,b){var c=b.props,d=b.callbacks,e=b.state,f=b.context;a.stopPropagation();var g=cE(a);e.setDragPos(g);var h=e.dragOffset;if(d.onDrag&&h){var i=Object.assign({},a);i.lngLat=cF(g,h,c,f),d.onDrag(i)}}(b,a)},panend:function(b){return function(a,b){var c=b.props,d=b.callbacks,e=b.state,f=b.context;a.stopPropagation();var g=e.dragPos,h=e.dragOffset;if(e.setDragPos(null),e.setDragOffset(null),d.onDragEnd&&g&&h){var i=Object.assign({},a);i.lngLat=cF(g,h,c,f),d.onDragEnd(i)}}(b,a)},pancancel:function(b){var c,d;return c=b,d=a.state,void(c.stopPropagation(),d.setDragPos(null),d.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}}(l)},[l.context.eventManager,Boolean(d)]),l),n=m.state,o=m.containerRef,p=a.children,q=a.className,r=a.draggable,s=a.style,t=n.dragPos,u=function(a){var b=a.props,c=a.state,d=a.context,e=b.longitude,f=b.latitude,g=b.offsetLeft,h=b.offsetTop,i=c.dragPos,j=c.dragOffset,l=d.viewport,m=d.map;if(i&&j)return[i[0]+j[0],i[1]+j[1],];var n=aT(m,{longitude:e,latitude:f}),o=l.project([e,f,n,]),p=k(o,2),q=p[0],r=p[1];return[q+=g,r+=h]}(m),v=k(u,2),w=v[0],x=v[1],y="translate(".concat(cI(w),"px, ").concat(cI(x),"px)"),z=r?t?"grabbing":"grab":"auto",A=(0,i.useMemo)(function(){var a=function(a){for(var b=1;b0){var q=m,r=p;for(m=0;m<=1;m+=.5)o=(n=c-m*g)+g,p=Math.max(0,j-n)+Math.max(0,o-e+j),p0){var w=l,x=v;for(l=0;l<=1;l+=s)u=(t=b-l*f)+f,v=Math.max(0,j-t)+Math.max(0,u-d+j),v1||I< -1||G<0||G>B.width||H<0||H>B.height?P.display="none":P.zIndex=Math.floor((1-I)/2*1e5)),P),T=(0,i.useCallback)(function(a){c.props.onClose();var b=c.context.eventManager;b&&b.once("click",function(a){return a.stopPropagation()},a.target)},[]);return i.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(R," ").concat(j),style:S,ref:e},i.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:n}}),i.createElement("div",{key:"content",ref:b,className:"mapboxgl-popup-content"},o&&i.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:T},"\xd7"),p))}function cT(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}cS.propTypes=cQ,cS.defaultProps=cR,i.memo(cS);var cU=Object.assign({},cw,{toggleLabel:j.string,className:j.string,style:j.object,compact:j.bool,customAttribution:j.oneOfType([j.string,j.arrayOf(j.string),])}),cV=Object.assign({},cv,{className:"",toggleLabel:"Toggle Attribution"});function cW(a){var b=cx(a),c=b.context,d=b.containerRef,e=(0,i.useRef)(null),f=k((0,i.useState)(!1),2),h=f[0],j=f[1];(0,i.useEffect)(function(){var b,f,g,h,i,j;return c.map&&(b=(f={customAttribution:a.customAttribution},g=c.map,h=d.current,i=e.current,(j=new(aB()).AttributionControl(f))._map=g,j._container=h,j._innerContainer=i,j._updateAttributions(),j._updateEditLink(),g.on("styledata",j._updateData),g.on("sourcedata",j._updateData),j)),function(){var a;return b&&void((a=b)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[c.map]);var l=void 0===a.compact?c.viewport.width<=640:a.compact;(0,i.useEffect)(function(){!l&&h&&j(!1)},[l]);var m=(0,i.useCallback)(function(){return j(function(a){return!a})},[]),n=(0,i.useMemo)(function(){return function(a){for(var b=1;bg)return 1}return 0}(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),d=b.viewport.bearing,e={transform:"rotate(".concat(-d,"deg)")},2===c?i.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:e}):i.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:e})))))}function db(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}da.propTypes=c6,da.defaultProps=c7,i.memo(da);var dc=Object.assign({},cw,{className:j.string,style:j.object,maxWidth:j.number,unit:j.oneOf(["imperial","metric","nautical"])}),dd=Object.assign({},cv,{className:"",maxWidth:100,unit:"metric"});function de(a){var b=cx(a),c=b.context,d=b.containerRef,e=k((0,i.useState)(null),2),f=e[0],h=e[1];(0,i.useEffect)(function(){if(c.map){var a=new(aB()).ScaleControl;a._map=c.map,a._container=d.current,h(a)}},[c.map]),f&&(f.options=a,f._onMove());var j=(0,i.useMemo)(function(){return function(a){for(var b=1;b\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",f=e.console&&(e.console.warn||e.console.log);return f&&f.call(e.console,d,c),a.apply(this,arguments)}}i="function"!=typeof Object.assign?function(a){if(a===h||null===a)throw TypeError("Cannot convert undefined or null to object");for(var b=Object(a),c=1;c -1}function B(a){return a.trim().split(/\s+/g)}function C(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dC(e,g)&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function F(a,b){for(var c,d,e=b[0].toUpperCase()+b.slice(1),f=0;f1&&!c.firstMultiple?c.firstMultiple=U(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=V(d);b.timeStamp=n(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=Z(h,i),b.distance=Y(h,i),S(c,b),b.offsetDirection=X(b.deltaX,b.deltaY);var j=W(b.deltaTime,b.deltaX,b.deltaY);b.overallVelocityX=j.x,b.overallVelocityY=j.y,b.overallVelocity=m(j.x)>m(j.y)?j.x:j.y,b.scale=g?_(g.pointers,d):1,b.rotation=g?$(g.pointers,d):0,b.maxPointers=c.prevInput?b.pointers.length>c.prevInput.maxPointers?b.pointers.length:c.prevInput.maxPointers:b.pointers.length,T(c,b);var k=a.element;z(b.srcEvent.target,k)&&(k=b.srcEvent.target),b.target=k}function S(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(1===b.eventType||4===f.eventType)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function T(a,b){var c,d,e,f,g=a.lastInterval||b,i=b.timeStamp-g.timeStamp;if(8!=b.eventType&&(i>25||h===g.velocity)){var j=b.deltaX-g.deltaX,k=b.deltaY-g.deltaY,l=W(i,j,k);d=l.x,e=l.y,c=m(l.x)>m(l.y)?l.x:l.y,f=X(j,k),a.lastInterval=b}else c=g.velocity,d=g.velocityX,e=g.velocityY,f=g.direction;b.velocity=c,b.velocityX=d,b.velocityY=e,b.direction=f}function U(a){for(var b=[],c=0;c=m(b)?a<0?2:4:b<0?8:16}function Y(a,b,c){c||(c=N);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function Z(a,b,c){c||(c=N);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function $(a,b){return Z(b[1],b[0],O)+Z(a[1],a[0],O)}function _(a,b){return Y(b[0],b[1],O)/Y(a[0],a[1],O)}P.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(H(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&y(this.element,this.evEl,this.domHandler),this.evTarget&&y(this.target,this.evTarget,this.domHandler),this.evWin&&y(H(this.element),this.evWin,this.domHandler)}};var aa={mousedown:1,mousemove:2,mouseup:4};function ab(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,P.apply(this,arguments)}u(ab,P,{handler:function(a){var b=aa[a.type];1&b&&0===a.button&&(this.pressed=!0),2&b&&1!==a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:M,srcEvent:a}))}});var ac={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},ad={2:L,3:"pen",4:M,5:"kinect"},ae="pointerdown",af="pointermove pointerup pointercancel";function ag(){this.evEl=ae,this.evWin=af,P.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(ae="MSPointerDown",af="MSPointerMove MSPointerUp MSPointerCancel"),u(ag,P,{handler:function(a){var b=this.store,c=!1,d=ac[a.type.toLowerCase().replace("ms","")],e=ad[a.pointerType]||a.pointerType,f=C(b,a.pointerId,"pointerId");1&d&&(0===a.button||e==L)?f<0&&(b.push(a),f=b.length-1):12&d&&(c=!0),!(f<0)&&(b[f]=a,this.callback(this.manager,d,{pointers:b,changedPointers:[a],pointerType:e,srcEvent:a}),c&&b.splice(f,1))}});var ah={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ai(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,P.apply(this,arguments)}function aj(a,b){var c=D(a.touches),d=D(a.changedTouches);return 12&b&&(c=E(c.concat(d),"identifier",!0)),[c,d]}u(ai,P,{handler:function(a){var b=ah[a.type];if(1===b&&(this.started=!0),this.started){var c=aj.call(this,a,b);12&b&&c[0].length-c[1].length==0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:L,srcEvent:a})}}});var ak={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function al(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},P.apply(this,arguments)}function am(a,b){var c=D(a.touches),d=this.targetIds;if(3&b&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=D(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return z(a.target,i)}),1===b)for(e=0;e -1&&d.splice(a,1)},2500)}}function aq(a){for(var b=a.srcEvent.clientX,c=a.srcEvent.clientY,d=0;d -1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){var b=this,c=this.state;function d(c){b.manager.emit(c,a)}c<8&&d(b.options.event+aC(c)),d(b.options.event),a.additionalEvent&&d(a.additionalEvent),c>=8&&d(b.options.event+aC(c))},tryEmit:function(a){if(this.canEmit())return this.emit(a);this.state=32},canEmit:function(){for(var a=0;ab.threshold&&e&b.direction},attrTest:function(a){return aF.prototype.attrTest.call(this,a)&&(2&this.state|| !(2&this.state)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=aD(a.direction);b&&(a.additionalEvent=this.options.event+b),this._super.emit.call(this,a)}}),u(aH,aF,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[aw]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||2&this.state)},emit:function(a){if(1!==a.scale){var b=a.scale<1?"in":"out";a.additionalEvent=this.options.event+b}this._super.emit.call(this,a)}}),u(aI,aB,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[au]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,d&&c&&(!(12&a.eventType)||e)){if(1&a.eventType)this.reset(),this._timer=o(function(){this.state=8,this.tryEmit()},b.time,this);else if(4&a.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(a){8===this.state&&(a&&4&a.eventType?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=n(),this.manager.emit(this.options.event,this._input)))}}),u(aJ,aF,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[aw]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||2&this.state)}}),u(aK,aF,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return aG.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return 30&c?b=a.overallVelocity:6&c?b=a.overallVelocityX:24&c&&(b=a.overallVelocityY),this._super.attrTest.call(this,a)&&c&a.offsetDirection&&a.distance>this.options.threshold&&a.maxPointers==this.options.pointers&&m(b)>this.options.velocity&&4&a.eventType},emit:function(a){var b=aD(a.offsetDirection);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),u(aL,aB,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[av]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance1)for(var c=1;ca.length)&&(b=a.length);for(var c=0,d=Array(b);c= -90&&b<=90,"invalid latitude");const c=512*(x+Math.log(Math.tan(y+.5*(b*z))))/(2*x);return[512*(a*z+x)/(2*x),c]}function D([a,b]){const c=2*(Math.atan(Math.exp(b/512*(2*x)-x))-y);return[(a/512*(2*x)-x)*A,c*A,]}function E(a){return 2*Math.atan(.5/a)*A}function F(a){return .5/Math.tan(.5*a*z)}function G(a,b,c=0){const[d,e,f]=a;if(w(Number.isFinite(d)&&Number.isFinite(e),"invalid pixel coordinate"),Number.isFinite(f)){const g=n(b,[d,e,f,1,]);return g}const h=n(b,[d,e,0,1,]),i=n(b,[d,e,1,1,]),j=h[2],k=i[2];return v([],h,i,j===k?0:((c||0)-j)/(k-j))}const H=Math.PI/180;function I(a,b,c){const{pixelUnprojectionMatrix:d}=a,e=n(d,[b,0,1,1,]),f=n(d,[b,a.height,1,1,]),g=c*a.distanceScales.unitsPerMeter[2],h=(g-e[2])/(f[2]-e[2]),i=v([],e,f,h),j=D(i);return j[2]=c,j}class J{constructor({width:a,height:b,latitude:c=0,longitude:d=0,zoom:e=0,pitch:f=0,bearing:g=0,altitude:h=null,fovy:i=null,position:j=null,nearZMultiplier:k=.02,farZMultiplier:l=1.01}={width:1,height:1}){a=a||1,b=b||1,null===i&&null===h?i=E(h=1.5):null===i?i=E(h):null===h&&(h=F(i));const n=B(e);h=Math.max(.75,h);const o=function({latitude:a,longitude:b,highPrecision:c=!1}){w(Number.isFinite(a)&&Number.isFinite(b));const d={},e=Math.cos(a*z),f=512/360,g=f/e,h=512/4003e4/e;if(d.unitsPerMeter=[h,h,h,],d.metersPerUnit=[1/h,1/h,1/h,],d.unitsPerDegree=[f,g,h,],d.degreesPerUnit=[1/f,1/g,1/h,],c){const i=z*Math.tan(a*z)/e,j=f*i/2,k=512/4003e4*i,l=k/g*h;d.unitsPerDegree2=[0,j,k,],d.unitsPerMeter2=[l,0,l,]}return d}({longitude:d,latitude:c}),p=C([d,c]);if(p[2]=0,j){var q,t,u,v,x,y;v=p,x=p,y=(q=[],t=j,u=o.unitsPerMeter,q[0]=t[0]*u[0],q[1]=t[1]*u[1],q[2]=t[2]*u[2],q),v[0]=x[0]+y[0],v[1]=x[1]+y[1],v[2]=x[2]+y[2]}this.projectionMatrix=function({width:a,height:b,pitch:c,altitude:d,fovy:e,nearZMultiplier:f,farZMultiplier:g}){var h,i,j,k,l,m,n;const{fov:o,aspect:p,near:q,far:r}=function({width:a,height:b,fovy:c=E(1.5),altitude:d,pitch:e=0,nearZMultiplier:f=1,farZMultiplier:g=1}){void 0!==d&&(c=E(d));const h=.5*c*z,i=F(c),j=e*z,k=Math.sin(h)*i/Math.sin(Math.min(Math.max(Math.PI/2-j-h,.01),Math.PI-.01)),l=Math.sin(j)*k+i;return{fov:2*h,aspect:a/b,focalDistance:i,near:f,far:l*g}}({width:a,height:b,altitude:d,fovy:e,pitch:c,nearZMultiplier:f,farZMultiplier:g}),s=(h=[],i=o,j=p,k=q,l=r,n=1/Math.tan(i/2),h[0]=n/j,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=n,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[11]=-1,h[12]=0,h[13]=0,h[15]=0,null!=l&&l!==1/0?(m=1/(k-l),h[10]=(l+k)*m,h[14]=2*l*k*m):(h[10]=-1,h[14]=-2*k),h);return s}({width:a,height:b,pitch:f,fovy:i,nearZMultiplier:k,farZMultiplier:l}),this.viewMatrix=function({height:a,pitch:b,bearing:c,altitude:d,scale:e,center:f=null}){var g,h,i,j,k,l,n,o,p,q,t,u,v,w,x,y,A,B,C,D,E,F,G,H,I,J,K,L;const M=m();return r(M,M,[0,0,-d]),g=M,h=M,i=-b*z,j=Math.sin(i),k=Math.cos(i),l=h[4],n=h[5],o=h[6],p=h[7],q=h[8],t=h[9],u=h[10],v=h[11],h!==g&&(g[0]=h[0],g[1]=h[1],g[2]=h[2],g[3]=h[3],g[12]=h[12],g[13]=h[13],g[14]=h[14],g[15]=h[15]),g[4]=l*k+q*j,g[5]=n*k+t*j,g[6]=o*k+u*j,g[7]=p*k+v*j,g[8]=q*k-l*j,g[9]=t*k-n*j,g[10]=u*k-o*j,g[11]=v*k-p*j,w=M,x=M,y=c*z,A=Math.sin(y),B=Math.cos(y),C=x[0],D=x[1],E=x[2],F=x[3],G=x[4],H=x[5],I=x[6],J=x[7],x!==w&&(w[8]=x[8],w[9]=x[9],w[10]=x[10],w[11]=x[11],w[12]=x[12],w[13]=x[13],w[14]=x[14],w[15]=x[15]),w[0]=C*B+G*A,w[1]=D*B+H*A,w[2]=E*B+I*A,w[3]=F*B+J*A,w[4]=G*B-C*A,w[5]=H*B-D*A,w[6]=I*B-E*A,w[7]=J*B-F*A,s(M,M,[e/=a,e,e]),f&&r(M,M,(K=[],L=f,K[0]=-L[0],K[1]=-L[1],K[2]=-L[2],K)),M}({height:b,scale:n,center:p,pitch:f,bearing:g,altitude:h}),this.width=a,this.height=b,this.scale=n,this.latitude=c,this.longitude=d,this.zoom=e,this.pitch=f,this.bearing=g,this.altitude=h,this.fovy=i,this.center=p,this.meterOffset=j||[0,0,0],this.distanceScales=o,this._initMatrices(),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),Object.freeze(this)}_initMatrices(){var a,b,c,d,e,f,g,h,i,j,k,l,n,o,p,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;const{width:J,height:K,projectionMatrix:L,viewMatrix:M}=this,N=m();q(N,N,L),q(N,N,M),this.viewProjectionMatrix=N;const O=m();s(O,O,[J/2,-K/2,1]),r(O,O,[1,-1,0]),q(O,O,N);const P=(a=m(),c=(b=O)[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],n=b[10],o=b[11],p=b[12],t=b[13],u=b[14],v=b[15],w=c*h-d*g,x=c*i-e*g,y=c*j-f*g,z=d*i-e*h,A=d*j-f*h,B=e*j-f*i,C=k*t-l*p,D=k*u-n*p,E=k*v-o*p,F=l*u-n*t,G=l*v-o*t,H=n*v-o*u,I=w*H-x*G+y*F+z*E-A*D+B*C,I?(I=1/I,a[0]=(h*H-i*G+j*F)*I,a[1]=(e*G-d*H-f*F)*I,a[2]=(t*B-u*A+v*z)*I,a[3]=(n*A-l*B-o*z)*I,a[4]=(i*E-g*H-j*D)*I,a[5]=(c*H-e*E+f*D)*I,a[6]=(u*y-p*B-v*x)*I,a[7]=(k*B-n*y+o*x)*I,a[8]=(g*G-h*E+j*C)*I,a[9]=(d*E-c*G-f*C)*I,a[10]=(p*A-t*y+v*w)*I,a[11]=(l*y-k*A-o*w)*I,a[12]=(h*D-g*F-i*C)*I,a[13]=(c*F-d*D+e*C)*I,a[14]=(t*x-p*z-u*w)*I,a[15]=(k*z-l*x+n*w)*I,a):null);if(!P)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=O,this.pixelUnprojectionMatrix=P}equals(a){return a instanceof J&&a.width===this.width&&a.height===this.height&&t(a.projectionMatrix,this.projectionMatrix)&&t(a.viewMatrix,this.viewMatrix)}project(a,{topLeft:b=!0}={}){const c=this.projectPosition(a),d=function(a,b){const[c,d,e=0]=a;return w(Number.isFinite(c)&&Number.isFinite(d)&&Number.isFinite(e)),n(b,[c,d,e,1])}(c,this.pixelProjectionMatrix),[e,f]=d,g=b?f:this.height-f;return 2===a.length?[e,g]:[e,g,d[2]]}unproject(a,{topLeft:b=!0,targetZ:c}={}){const[d,e,f]=a,g=b?e:this.height-e,h=c&&c*this.distanceScales.unitsPerMeter[2],i=G([d,g,f],this.pixelUnprojectionMatrix,h),[j,k,l]=this.unprojectPosition(i);return Number.isFinite(f)?[j,k,l]:Number.isFinite(c)?[j,k,c]:[j,k]}projectPosition(a){const[b,c]=C(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=D(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return C(a)}unprojectFlat(a){return D(a)}getMapCenterByLngLatPosition({lngLat:a,pos:b}){var c,d;const e=G(b,this.pixelUnprojectionMatrix),f=C(a),g=u([],f,(c=[],d=e,c[0]=-d[0],c[1]=-d[1],c)),h=u([],this.center,g);return D(h)}getLocationAtPoint({lngLat:a,pos:b}){return this.getMapCenterByLngLatPosition({lngLat:a,pos:b})}fitBounds(a,b={}){const{width:c,height:d}=this,{longitude:e,latitude:f,zoom:g}=function({width:a,height:b,bounds:c,minExtent:d=0,maxZoom:e=24,padding:f=0,offset:g=[0,0]}){var h,i,j,k,l,m;const[[n,o],[q,r]]=c;if(Number.isFinite(f)){const s=f;f={top:s,bottom:s,left:s,right:s}}else w(Number.isFinite(f.top)&&Number.isFinite(f.bottom)&&Number.isFinite(f.left)&&Number.isFinite(f.right));const t=C([n,(i=-85.051129,j=85.051129,(h=r)j?j:h),]),u=C([q,(l=-85.051129,m=85.051129,(k=o)m?m:k),]),v=[Math.max(Math.abs(u[0]-t[0]),d),Math.max(Math.abs(u[1]-t[1]),d),],x=[a-f.left-f.right-2*Math.abs(g[0]),b-f.top-f.bottom-2*Math.abs(g[1]),];w(x[0]>0&&x[1]>0);const y=x[0]/v[0],z=x[1]/v[1],A=(f.right-f.left)/2/y,B=(f.bottom-f.top)/2/z,E=[(u[0]+t[0])/2+A,(u[1]+t[1])/2+B,],F=D(E),G=Math.min(e,p(Math.abs(Math.min(y,z))));return w(Number.isFinite(G)),{longitude:F[0],latitude:F[1],zoom:G}}(Object.assign({width:c,height:d,bounds:a},b));return new J({width:c,height:d,longitude:e,latitude:f,zoom:g})}getBounds(a){const b=this.getBoundingRegion(a),c=Math.min(...b.map(a=>a[0])),d=Math.max(...b.map(a=>a[0])),e=Math.min(...b.map(a=>a[1])),f=Math.max(...b.map(a=>a[1]));return[[c,e],[d,f],]}getBoundingRegion(a={}){return function(a,b=0){const{width:c,height:d,unproject:e}=a,f={targetZ:b},g=e([0,d],f),h=e([c,d],f);let i,j;const k=a.fovy?.5*a.fovy*H:Math.atan(.5/a.altitude),l=(90-a.pitch)*H;return k>l-.01?(i=I(a,0,b),j=I(a,c,b)):(i=e([0,0],f),j=e([c,0],f)),[g,h,j,i]}(this,a.z||0)}}const K=["longitude","latitude","zoom"],L={curve:1.414,speed:1.2};function M(a,b,c){var d,e,f,g,h,i;c=Object.assign({},L,c);const j=c.curve,k=a.zoom,l=[a.longitude,a.latitude],m=B(k),n=b.zoom,o=[b.longitude,b.latitude],p=B(n-k),q=C(l),r=C(o),s=(d=[],e=r,f=q,d[0]=e[0]-f[0],d[1]=e[1]-f[1],d),t=Math.max(a.width,a.height),u=t/p,v=(h=(g=s)[0],i=g[1],Math.hypot(h,i)*m),w=Math.max(v,.01),x=j*j,y=(u*u-t*t+x*x*w*w)/(2*t*x*w),z=(u*u-t*t-x*x*w*w)/(2*u*x*w),A=Math.log(Math.sqrt(y*y+1)-y),D=Math.log(Math.sqrt(z*z+1)-z);return{startZoom:k,startCenterXY:q,uDelta:s,w0:t,u1:v,S:(D-A)/j,rho:j,rho2:x,r0:A,r1:D}}var N=function(){if("undefined"!=typeof Map)return Map;function a(a,b){var c=-1;return a.some(function(a,d){return a[0]===b&&(c=d,!0)}),c}return function(){function b(){this.__entries__=[]}return Object.defineProperty(b.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),b.prototype.get=function(b){var c=a(this.__entries__,b),d=this.__entries__[c];return d&&d[1]},b.prototype.set=function(b,c){var d=a(this.__entries__,b);~d?this.__entries__[d][1]=c:this.__entries__.push([b,c])},b.prototype.delete=function(b){var c=this.__entries__,d=a(c,b);~d&&c.splice(d,1)},b.prototype.has=function(b){return!!~a(this.__entries__,b)},b.prototype.clear=function(){this.__entries__.splice(0)},b.prototype.forEach=function(a,b){void 0===b&&(b=null);for(var c=0,d=this.__entries__;c0},a.prototype.connect_=function(){O&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),S?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},a.prototype.disconnect_=function(){O&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},a.prototype.onTransitionEnd_=function(a){var b=a.propertyName,c=void 0===b?"":b;R.some(function(a){return!!~c.indexOf(a)})&&this.refresh()},a.getInstance=function(){return this.instance_||(this.instance_=new a),this.instance_},a.instance_=null,a}(),U=function(a,b){for(var c=0,d=Object.keys(b);c0},a}(),af="undefined"!=typeof WeakMap?new WeakMap:new N,ag=function(){function a(b){if(!(this instanceof a))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var c=T.getInstance(),d=new ae(b,c,this);af.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){ag.prototype[a]=function(){var b;return(b=af.get(this))[a].apply(b,arguments)}});var ah=void 0!==P.ResizeObserver?P.ResizeObserver:ag;function ai(a,b){if(!(a instanceof b))throw TypeError("Cannot call a class as a function")}function aj(a,b){for(var c=0;c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function ap(a,b){if(a){if("string"==typeof a)return aq(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return aq(a,b)}}function aq(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c1&& void 0!==arguments[1]?arguments[1]:"component";a.debug&&j.checkPropTypes(au,a,"prop",b)}var ax=function(){function a(b){var c=this;if(ai(this,a),g(this,"props",av),g(this,"width",0),g(this,"height",0),g(this,"_fireLoadEvent",function(){c.props.onLoad({type:"load",target:c._map})}),g(this,"_handleError",function(a){c.props.onError(a)}),!b.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=b.mapboxgl,a.initialized||(a.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(b)}return ak(a,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(a){return this._update(this.props,a),this}},{key:"redraw",value:function(){var a=this._map;a.style&&(a._frame&&(a._frame.cancel(),a._frame=null),a._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(b){this._map=a.savedMap;var c=this._map.getContainer(),d=b.container;for(d.classList.add("mapboxgl-map");c.childNodes.length>0;)d.appendChild(c.childNodes[0]);this._map._container=d,a.savedMap=null,b.mapStyle&&this._map.setStyle(as(b.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(b){if(b.reuseMaps&&a.savedMap)this._reuse(b);else{if(b.gl){var c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=c,b.gl}}var d={container:b.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:as(b.mapStyle),interactive:!1,trackResize:!1,attributionControl:b.attributionControl,preserveDrawingBuffer:b.preserveDrawingBuffer};b.transformRequest&&(d.transformRequest=b.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},d,b.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!a.savedMap?(a.savedMap=this._map,this._map.off("load",this._fireLoadEvent),this._map.off("error",this._handleError),this._map.off("styledata",this._fireLoadEvent)):this._map.remove(),this._map=null)}},{key:"_initialize",value:function(a){var b=this;a=Object.assign({},av,a),aw(a,"Mapbox"),this.mapboxgl.accessToken=a.mapboxApiAccessToken||av.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=a.mapboxApiUrl,this._create(a);var c=a.container;Object.defineProperty(c,"offsetWidth",{configurable:!0,get:function(){return b.width}}),Object.defineProperty(c,"clientWidth",{configurable:!0,get:function(){return b.width}}),Object.defineProperty(c,"offsetHeight",{configurable:!0,get:function(){return b.height}}),Object.defineProperty(c,"clientHeight",{configurable:!0,get:function(){return b.height}});var d=this._map.getCanvas();d&&(d.style.outline="none"),this._updateMapViewport({},a),this._updateMapSize({},a),this.props=a}},{key:"_update",value:function(a,b){if(this._map){aw(b=Object.assign({},this.props,b),"Mapbox");var c=this._updateMapViewport(a,b),d=this._updateMapSize(a,b);this._updateMapStyle(a,b),!b.asyncRender&&(c||d)&&this.redraw(),this.props=b}}},{key:"_updateMapStyle",value:function(a,b){a.mapStyle!==b.mapStyle&&this._map.setStyle(as(b.mapStyle),{diff:!b.preventStyleDiffing})}},{key:"_updateMapSize",value:function(a,b){var c=a.width!==b.width||a.height!==b.height;return c&&(this.width=b.width,this.height=b.height,this._map.resize()),c}},{key:"_updateMapViewport",value:function(a,b){var c=this._getViewState(a),d=this._getViewState(b),e=d.latitude!==c.latitude||d.longitude!==c.longitude||d.zoom!==c.zoom||d.pitch!==c.pitch||d.bearing!==c.bearing||d.altitude!==c.altitude;return e&&(this._map.jumpTo(this._viewStateToMapboxProps(d)),d.altitude!==c.altitude&&(this._map.transform.altitude=d.altitude)),e}},{key:"_getViewState",value:function(a){var b=a.viewState||a,c=b.longitude,d=b.latitude,e=b.zoom,f=b.pitch,g=b.bearing,h=b.altitude;return{longitude:c,latitude:d,zoom:e,pitch:void 0===f?0:f,bearing:void 0===g?0:g,altitude:void 0===h?1.5:h}}},{key:"_checkStyleSheet",value:function(){var a=arguments.length>0&& void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==al)try{var b=al.createElement("div");if(b.className="mapboxgl-map",b.style.display="none",al.body.appendChild(b),!("static"!==window.getComputedStyle(b).position)){var c=al.createElement("link");c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(a,"/mapbox-gl.css")),al.head.appendChild(c)}}catch(d){}}},{key:"_viewStateToMapboxProps",value:function(a){return{center:[a.longitude,a.latitude,],zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}}},]),a}();g(ax,"initialized",!1),g(ax,"propTypes",au),g(ax,"defaultProps",av),g(ax,"savedMap",null);var ay=c(6158),az=c.n(ay);function aA(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function aB(a,b){if(a===b)return!0;if(aA(a)&&aA(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function aC(a,b,c){return Math.max(b,Math.min(c,a))}function aD(a,b,c){return aA(a)?a.map(function(a,d){return aD(a,b[d],c)}):c*b+(1-c)*a}function aE(a,b){if(!a)throw Error(b||"react-map-gl: assertion failed.")}function aF(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function aG(a){for(var b=1;b0,"`scale` must be a positive number");var e=this._state,f=e.startZoom,g=e.startZoomLngLat;Number.isFinite(f)||(f=this._viewportProps.zoom,g=this._unproject(c)||this._unproject(b)),aE(g,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var h=this._calculateNewZoom({scale:d,startZoom:f||0}),i=new J(Object.assign({},this._viewportProps,{zoom:h})),j=i.getMapCenterByLngLatPosition({lngLat:g,pos:b}),l=k(j,2),m=l[0],n=l[1];return this._getUpdatedMapState({zoom:h,longitude:m,latitude:n})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(b){return new a(Object.assign({},this._viewportProps,this._state,b))}},{key:"_applyConstraints",value:function(a){var b=a.maxZoom,c=a.minZoom,d=a.zoom;a.zoom=aC(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=aC(g,f,e),Object.assign(a,function({width:a,height:b,longitude:c,latitude:d,zoom:e,pitch:f=0,bearing:g=0}){(c< -180||c>180)&&(c=o(c+180,360)-180),(g< -180||g>180)&&(g=o(g+180,360)-180);const h=p(b/512);if(e<=h)e=h,d=0;else{const i=b/2/Math.pow(2,e),j=D([0,i])[1];if(dk&&(d=k)}}return{width:a,height:b,longitude:c,latitude:d,zoom:e,pitch:f,bearing:g}}(a)),a}},{key:"_unproject",value:function(a){var b=new J(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new J(this._viewportProps);return d.getMapCenterByLngLatPosition({lngLat:b,pos:c})}},{key:"_calculateNewZoom",value:function(a){var b=a.scale,c=a.startZoom,d=this._viewportProps,e=d.maxZoom,f=d.minZoom,g=c+Math.log2(b);return aC(g,f,e)}},{key:"_calculateNewPitchAndBearing",value:function(a){var b=a.deltaScaleX,c=a.deltaScaleY,d=a.startBearing,e=a.startPitch;c=aC(c,-1,1);var f=this._viewportProps,g=f.minPitch,h=f.maxPitch,i=e;return c>0?i=e+c*(h-e):c<0&&(i=e-c*(g-e)),{pitch:i,bearing:d+180*b}}},{key:"_getRotationParams",value:function(a,b){var c=a[0]-b[0],d=a[1]-b[1],e=a[1],f=b[1],g=this._viewportProps,h=g.width,i=g.height,j=0;return d>0?Math.abs(i-f)>5&&(j=d/(f-i)*1.2):d<0&&f>5&&(j=1-e/f),{deltaScaleX:c/h,deltaScaleY:j=Math.min(1,Math.max(-1,j))}}},]),a}();function aK(a){return a[0].toLowerCase()+a.slice(1)}function aL(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function aM(a){for(var b=1;b1&& void 0!==arguments[1]?arguments[1]:{},d=a.current&&a.current.getMap();return d&&d.queryRenderedFeatures(b,c)}}},[]);var q=(0,i.useCallback)(function(a){var b=a.target;b===n.current&&b.scrollTo(0,0)},[]),r=p&&i.createElement(aO,{value:aT(aT({},o),{},{viewport:o.viewport||aV(aT({map:p,props:a},g)),map:p,container:o.container||m.current})},i.createElement("div",{key:"map-overlays",className:"overlays",ref:n,style:aW,onScroll:q},a.children)),s=a.className,t=a.width,u=a.height,v=a.style,w=a.visibilityConstraints,x=Object.assign({position:"relative"},v,{width:t,height:u}),y=a.visible&&function(a){var b=arguments.length>1&& void 0!==arguments[1]?arguments[1]:aH;for(var c in b){var d=c.slice(0,3),e=aK(c.slice(3));if("min"===d&&a[e]b[c])return!1}return!0}(a.viewState||a,w),z=Object.assign({},aW,{visibility:y?"inherit":"hidden"});return i.createElement("div",{key:"map-container",ref:m,style:x},i.createElement("div",{key:"map-mapbox",ref:l,style:z,className:s}),r,!d&&!a.disableTokenWarning&&i.createElement(aZ,null))});a$.supported=function(){return az()&&az().supported()},a$.propTypes=aX,a$.defaultProps=aY;var a_=a$;function a0(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}(this.propNames||[]);try{for(d.s();!(c=d.n()).done;){var e=c.value;if(!aB(a[e],b[e]))return!1}}catch(f){d.e(f)}finally{d.f()}return!0}},{key:"initializeProps",value:function(a,b){return{start:a,end:b}}},{key:"interpolateProps",value:function(a,b,c){aE(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(a,b){return b.transitionDuration}},]),a}();function a2(a){if(void 0===a)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function a3(a,b){return(a3=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function a4(a,b){if("function"!=typeof b&&null!==b)throw TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&a3(a,b)}function a5(a){return(a5="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function a6(a,b){if(b&&("object"===a5(b)||"function"==typeof b))return b;if(void 0!==b)throw TypeError("Derived constructors may only return object or undefined");return a2(a)}function a7(a){return(a7=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var a8={longitude:1,bearing:1};function a9(a){return Number.isFinite(a)||Array.isArray(a)}function ba(a,b,c){return a in a8&&Math.abs(c-b)>180&&(c=c<0?c+360:c-360),c}function bb(a,b){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=bc(a))||b&&a&&"number"==typeof a.length){e&&(a=e);var c=0,d=function(){};return{s:d,n:function(){return c>=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function bc(a,b){if(a){if("string"==typeof a)return bd(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return bd(a,b)}}function bd(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c=a.length?{done:!0}:{done:!1,value:a[c++]}},e:function(a){throw a},f:d}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var e,f,g=!0,h=!1;return{s:function(){e=a[Symbol.iterator]()},n:function(){var a=e.next();return g=a.done,a},e:function(a){h=!0,f=a},f:function(){try{g||null==e.return||e.return()}finally{if(h)throw f}}}}function bj(a,b){if(a){if("string"==typeof a)return bk(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c)return Array.from(a);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return bk(a,b)}}function bk(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c0&& void 0!==arguments[0]?arguments[0]:{};return ai(this,e),g(a2(a=d.call(this)),"propNames",be),a.props=Object.assign({},bh,b),a}ak(e,[{key:"initializeProps",value:function(a,b){var c,d={},e={},f=bb(bf);try{for(f.s();!(c=f.n()).done;){var g=c.value,h=a[g],i=b[g];aE(a9(h)&&a9(i),"".concat(g," must be supplied for transition")),d[g]=h,e[g]=ba(g,h,i)}}catch(j){f.e(j)}finally{f.f()}var k,l=bb(bg);try{for(l.s();!(k=l.n()).done;){var m=k.value,n=a[m]||0,o=b[m]||0;d[m]=n,e[m]=ba(m,n,o)}}catch(p){l.e(p)}finally{l.f()}return{start:d,end:e}}},{key:"interpolateProps",value:function(a,b,c){var d,e=function(a,b,c,d={}){var e,f,g,h,i,j;const k={},{startZoom:l,startCenterXY:m,uDelta:n,w0:o,u1:q,S:r,rho:s,rho2:t,r0:v}=M(a,b,d);if(q<.01){for(const w of K){const x=a[w],y=b[w];k[w]=(e=x,f=y,(g=c)*f+(1-g)*e)}return k}const z=c*r,A=Math.cosh(v)/Math.cosh(v+s*z),B=o*((Math.cosh(v)*Math.tanh(v+s*z)-Math.sinh(v))/t)/q,C=l+p(1/A),E=(h=[],i=n,j=B,h[0]=i[0]*j,h[1]=i[1]*j,h);u(E,E,m);const F=D(E);return k.longitude=F[0],k.latitude=F[1],k.zoom=C,k}(a,b,c,this.props),f=bb(bg);try{for(f.s();!(d=f.n()).done;){var g=d.value;e[g]=aD(a[g],b[g],c)}}catch(h){f.e(h)}finally{f.f()}return e}},{key:"getDuration",value:function(a,b){var c=b.transitionDuration;return"auto"===c&&(c=function(a,b,c={}){c=Object.assign({},L,c);const{screenSpeed:d,speed:e,maxDuration:f}=c,{S:g,rho:h}=M(a,b,c),i=1e3*g;let j;return j=Number.isFinite(d)?i/(d/h):i/e,Number.isFinite(f)&&j>f?0:j}(a,b,this.props)),c}},])}(a1);var bl=["longitude","latitude","zoom","bearing","pitch",],bm=function(a){a4(e,a);var b,c,d=(b=e,c=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,d=a7(b);if(c){var e=a7(this).constructor;a=Reflect.construct(d,arguments,e)}else a=d.apply(this,arguments);return a6(this,a)});function e(){var a,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return ai(this,e),a=d.call(this),Array.isArray(b)&&(b={transitionProps:b}),a.propNames=b.transitionProps||bl,b.around&&(a.around=b.around),a}return ak(e,[{key:"initializeProps",value:function(a,b){var c={},d={};if(this.around){c.around=this.around;var e=new J(a).unproject(this.around);Object.assign(d,b,{around:new J(b).project(e),aroundLngLat:e})}var f,g=bi(this.propNames);try{for(g.s();!(f=g.n()).done;){var h=f.value,i=a[h],j=b[h];aE(a9(i)&&a9(j),"".concat(h," must be supplied for transition")),c[h]=i,d[h]=ba(h,i,j)}}catch(k){g.e(k)}finally{g.f()}return{start:c,end:d}}},{key:"interpolateProps",value:function(a,b,c){var d,e={},f=bi(this.propNames);try{for(f.s();!(d=f.n()).done;){var g=d.value;e[g]=aD(a[g],b[g],c)}}catch(h){f.e(h)}finally{f.f()}if(b.around){var i=new J(Object.assign({},b,e)).getMapCenterByLngLatPosition({lngLat:b.aroundLngLat,pos:aD(a.around,b.around,c)}),j=k(i,2),l=j[0],m=j[1];e.longitude=l,e.latitude=m}return e}},]),e}(a1),bn=function(){},bo={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},bp={transitionDuration:0,transitionEasing:function(a){return a},transitionInterpolator:new bm,transitionInterruption:bo.BREAK,onTransitionStart:bn,onTransitionInterrupt:bn,onTransitionEnd:bn},bq=function(){function a(){var b=this,c=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};ai(this,a),g(this,"_animationFrame",null),g(this,"_onTransitionFrame",function(){b._animationFrame=requestAnimationFrame(b._onTransitionFrame),b._updateViewport()}),this.props=null,this.onViewportChange=c.onViewportChange||bn,this.onStateChange=c.onStateChange||bn,this.time=c.getTime||Date.now}return ak(a,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(a){var b=this.props;if(this.props=a,!b||this._shouldIgnoreViewportChange(b,a))return!1;if(this._isTransitionEnabled(a)){var c=Object.assign({},b),d=Object.assign({},a);if(this._isTransitionInProgress()&&(b.onTransitionInterrupt(),this.state.interruption===bo.SNAP_TO_END?Object.assign(c,this.state.endProps):Object.assign(c,this.state.propsInTransition),this.state.interruption===bo.UPDATE)){var e,f,g,h=this.time(),i=(h-this.state.startTime)/this.state.duration;d.transitionDuration=this.state.duration-(h-this.state.startTime),d.transitionEasing=(g=(e=this.state.easing)(f=i),function(a){return 1/(1-g)*(e(a*(1-f)+f)-g)}),d.transitionInterpolator=c.transitionInterpolator}return d.onTransitionStart(),this._triggerTransition(c,d),!0}return this._isTransitionInProgress()&&(b.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(a){var b=a.transitionDuration,c=a.transitionInterpolator;return(b>0||"auto"===b)&&Boolean(c)}},{key:"_isUpdateDueToCurrentTransition",value:function(a){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(a,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(a,b){return!a||(this._isTransitionInProgress()?this.state.interruption===bo.IGNORE||this._isUpdateDueToCurrentTransition(b):!this._isTransitionEnabled(b)||b.transitionInterpolator.arePropsEqual(a,b))}},{key:"_triggerTransition",value:function(a,b){aE(this._isTransitionEnabled(b)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var c=b.transitionInterpolator,d=c.getDuration?c.getDuration(a,b):b.transitionDuration;if(0!==d){var e=b.transitionInterpolator.initializeProps(a,b),f={inTransition:!0,isZooming:a.zoom!==b.zoom,isPanning:a.longitude!==b.longitude||a.latitude!==b.latitude,isRotating:a.bearing!==b.bearing||a.pitch!==b.pitch};this.state={duration:d,easing:b.transitionEasing,interpolator:b.transitionInterpolator,interruption:b.transitionInterruption,startTime:this.time(),startProps:e.start,endProps:e.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(f)}}},{key:"_endTransition",value:function(){this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=null),this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1})}},{key:"_updateViewport",value:function(){var a=this.time(),b=this.state,c=b.startTime,d=b.duration,e=b.easing,f=b.interpolator,g=b.startProps,h=b.endProps,i=!1,j=(a-c)/d;j>=1&&(j=1,i=!0),j=e(j);var k=f.interpolateProps(g,h,j),l=new aJ(Object.assign({},this.props,k));this.state.propsInTransition=l.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),i&&(this._endTransition(),this.props.onTransitionEnd())}},]),a}();g(bq,"defaultProps",bp);var br=c(840),bs=c.n(br);const bt={mousedown:1,mousemove:2,mouseup:4};!function(a){const b=a.prototype.handler;a.prototype.handler=function(a){const c=this.store;a.button>0&&"pointerdown"===a.type&&!function(a,b){for(let c=0;cb.pointerId===a.pointerId)&&c.push(a),b.call(this,a)}}(bs().PointerEventInput),bs().MouseInput.prototype.handler=function(a){let b=bt[a.type];1&b&&a.button>=0&&(this.pressed=!0),2&b&&0===a.which&&(b=4),this.pressed&&(4&b&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:"mouse",srcEvent:a}))};const bu=bs().Manager;var bv=bs();const bw=bv?[[bv.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[bv.Rotate,{enable:!1},],[bv.Pinch,{enable:!1},],[bv.Swipe,{enable:!1},],[bv.Pan,{threshold:0,enable:!1},],[bv.Press,{enable:!1},],[bv.Tap,{event:"doubletap",taps:2,enable:!1},],[bv.Tap,{event:"anytap",enable:!1},],[bv.Tap,{enable:!1},],]:null,bx={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},by={doubletap:["tap"]},bz={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},bA={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},bB={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},bC={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},bD="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",bE="undefined"!=typeof window?window:c.g;void 0!==c.g?c.g:window;let bF=!1;try{const bG={get passive(){return bF=!0,!0}};bE.addEventListener("test",bG,bG),bE.removeEventListener("test",bG,bG)}catch(bH){}const bI=-1!==bD.indexOf("firefox"),{WHEEL_EVENTS:bJ}=bA,bK="wheel";class bL{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.events=bJ.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(b=>a.addEventListener(b,this.handleEvent,!!bF&&{passive:!1}))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bK&&(this.options.enable=b)}handleEvent(a){if(!this.options.enable)return;let b=a.deltaY;bE.WheelEvent&&(bI&&a.deltaMode===bE.WheelEvent.DOM_DELTA_PIXEL&&(b/=bE.devicePixelRatio),a.deltaMode===bE.WheelEvent.DOM_DELTA_LINE&&(b*=40));const c={x:a.clientX,y:a.clientY};0!==b&&b%4.000244140625==0&&(b=Math.floor(b/4.000244140625)),a.shiftKey&&b&&(b*=.25),this._onWheel(a,-b,c)}_onWheel(a,b,c){this.callback({type:bK,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:bM}=bA,bN="pointermove",bO="pointerover",bP="pointerout",bQ="pointerleave";class bR{constructor(a,b,c={}){this.element=a,this.callback=b,this.pressed=!1,this.options=Object.assign({enable:!0},c),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=bM.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bN&&(this.enableMoveEvent=b),a===bO&&(this.enableOverEvent=b),a===bP&&(this.enableOutEvent=b),a===bQ&&(this.enableLeaveEvent=b)}handleEvent(a){this.handleOverEvent(a),this.handleOutEvent(a),this.handleLeaveEvent(a),this.handleMoveEvent(a)}handleOverEvent(a){this.enableOverEvent&&"mouseover"===a.type&&this.callback({type:bO,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:bP,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:bQ,srcEvent:a,pointerType:"mouse",target:a.target})}handleMoveEvent(a){if(this.enableMoveEvent)switch(a.type){case"mousedown":a.button>=0&&(this.pressed=!0);break;case"mousemove":0===a.which&&(this.pressed=!1),this.pressed||this.callback({type:bN,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:bS}=bA,bT="keydown",bU="keyup";class bV{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=bS.concat(c.events||[]),this.handleEvent=this.handleEvent.bind(this),a.tabIndex=c.tabIndex||0,a.style.outline="none",this.events.forEach(b=>a.addEventListener(b,this.handleEvent))}destroy(){this.events.forEach(a=>this.element.removeEventListener(a,this.handleEvent))}enableEventType(a,b){a===bT&&(this.enableDownEvent=b),a===bU&&(this.enableUpEvent=b)}handleEvent(a){const b=a.target||a.srcElement;("INPUT"!==b.tagName||"text"!==b.type)&&"TEXTAREA"!==b.tagName&&(this.enableDownEvent&&"keydown"===a.type&&this.callback({type:bT,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:bU,srcEvent:a,key:a.key,target:a.target}))}}const bW="contextmenu";class bX{constructor(a,b,c={}){this.element=a,this.callback=b,this.options=Object.assign({enable:!0},c),this.handleEvent=this.handleEvent.bind(this),a.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(a,b){a===bW&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:bW,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const bY={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},bZ={srcElement:"root",priority:0};class b${constructor(a){this.eventManager=a,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(a,b,c,d=!1,e=!1){const{handlers:f,handlersByElement:g}=this;c&&("object"!=typeof c||c.addEventListener)&&(c={srcElement:c}),c=c?Object.assign({},bZ,c):bZ;let h=g.get(c.srcElement);h||(h=[],g.set(c.srcElement,h));const i={type:a,handler:b,srcElement:c.srcElement,priority:c.priority};d&&(i.once=!0),e&&(i.passive=!0),f.push(i),this._active=this._active||!i.passive;let j=h.length-1;for(;j>=0&&!(h[j].priority>=i.priority);)j--;h.splice(j+1,0,i)}remove(a,b){const{handlers:c,handlersByElement:d}=this;for(let e=c.length-1;e>=0;e--){const f=c[e];if(f.type===a&&f.handler===b){c.splice(e,1);const g=d.get(f.srcElement);g.splice(g.indexOf(f),1),0===g.length&&d.delete(f.srcElement)}}this._active=c.some(a=>!a.passive)}handleEvent(a){if(this.isEmpty())return;const b=this._normalizeEvent(a);let c=a.srcEvent.target;for(;c&&c!==b.rootElement;){if(this._emit(b,c),b.handled)return;c=c.parentNode}this._emit(b,"root")}_emit(a,b){const c=this.handlersByElement.get(b);if(c){let d=!1;const e=()=>{a.handled=!0},f=()=>{a.handled=!0,d=!0},g=[];for(let h=0;h{const b=this.manager.get(a);b&&bx[a].forEach(a=>{b.recognizeWith(a)})}),b.recognizerOptions){const e=this.manager.get(d);if(e){const f=b.recognizerOptions[d];delete f.enable,e.set(f)}}for(const[g,h]of(this.wheelInput=new bL(a,this._onOtherEvent,{enable:!1}),this.moveInput=new bR(a,this._onOtherEvent,{enable:!1}),this.keyInput=new bV(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new bX(a,this._onOtherEvent,{enable:!1}),this.events))h.isEmpty()||(this._toggleRecognizer(h.recognizerName,!0),this.manager.on(g,h.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(a,b,c){this._addEventHandler(a,b,c,!1)}once(a,b,c){this._addEventHandler(a,b,c,!0)}watch(a,b,c){this._addEventHandler(a,b,c,!1,!0)}off(a,b){this._removeEventHandler(a,b)}_toggleRecognizer(a,b){const{manager:c}=this;if(!c)return;const d=c.get(a);if(d&&d.options.enable!==b){d.set({enable:b});const e=by[a];e&&!this.options.recognizers&&e.forEach(e=>{const f=c.get(e);b?(f.requireFailure(a),d.dropRequireFailure(e)):f.dropRequireFailure(a)})}this.wheelInput.enableEventType(a,b),this.moveInput.enableEventType(a,b),this.keyInput.enableEventType(a,b),this.contextmenuInput.enableEventType(a,b)}_addEventHandler(a,b,c,d,e){if("string"!=typeof a){for(const f in c=b,a)this._addEventHandler(f,a[f],c,d,e);return}const{manager:g,events:h}=this,i=bC[a]||a;let j=h.get(i);!j&&(j=new b$(this),h.set(i,j),j.recognizerName=bB[i]||i,g&&g.on(i,j.handleEvent)),j.add(a,b,c,d,e),j.isEmpty()||this._toggleRecognizer(j.recognizerName,!0)}_removeEventHandler(a,b){if("string"!=typeof a){for(const c in a)this._removeEventHandler(c,a[c]);return}const{events:d}=this,e=bC[a]||a,f=d.get(e);if(f&&(f.remove(a,b),f.isEmpty())){const{recognizerName:g}=f;let h=!1;for(const i of d.values())if(i.recognizerName===g&&!i.isEmpty()){h=!0;break}h||this._toggleRecognizer(g,!1)}}_onBasicInput(a){const{srcEvent:b}=a,c=bz[b.type];c&&this.manager.emit(c,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function b0(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function b1(a){for(var b=1;b0),g=f&&!this.state.isHovering,h=!f&&this.state.isHovering;(d||g)&&(a.features=b,d&&d(a)),g&&ce.call(this,"onMouseEnter",a),h&&ce.call(this,"onMouseLeave",a),(g||h)&&this.setState({isHovering:f})}}function ci(a){var b=this.props,c=b.onClick,d=b.onNativeClick,e=b.onDblClick,f=b.doubleClickZoom,g=[],h=e||f;switch(a.type){case"anyclick":g.push(d),h||g.push(c);break;case"click":h&&g.push(c)}(g=g.filter(Boolean)).length&&((a=cc.call(this,a)).features=cd.call(this,a.point),g.forEach(function(b){return b(a)}))}var cj=(0,i.forwardRef)(function(a,b){var c,g,h=(0,i.useContext)(aP),j=(0,i.useMemo)(function(){return a.controller||new b6},[]),k=(0,i.useMemo)(function(){return new b_(null,{touchAction:a.touchAction,recognizerOptions:a.eventRecognizerOptions})},[]),l=(0,i.useRef)(null),m=(0,i.useRef)(null),n=(0,i.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;n.props=a,n.map=m.current&&m.current.getMap(),n.setState=function(b){n.state=b8(b8({},n.state),b),l.current.style.cursor=a.getCursor(n.state)};var o=!0,p=function(a,b,d){if(o){c=[a,b,d,];return}var e=n.props,f=e.onViewStateChange,g=e.onViewportChange;Object.defineProperty(a,"position",{get:function(){return[0,0,aR(n.map,a),]}}),f&&f({viewState:a,interactionState:b,oldViewState:d}),g&&g(a,b,d)};(0,i.useImperativeHandle)(b,function(){var a;return{getMap:(a=m).current&&a.current.getMap,queryRenderedFeatures:a.current&&a.current.queryRenderedFeatures}},[]);var q=(0,i.useMemo)(function(){return b8(b8({},h),{},{eventManager:k,container:h.container||l.current})},[h,l.current]);q.onViewportChange=p,q.viewport=h.viewport||aV(n),n.viewport=q.viewport;var r=function(a){var b=a.isDragging,c=void 0!==b&&b;if(c!==n.state.isDragging&&n.setState({isDragging:c}),o){g=a;return}var d=n.props.onInteractionStateChange;d&&d(a)},s=function(){n.width&&n.height&&j.setOptions(b8(b8(b8({},n.props),n.props.viewState),{},{isInteractive:Boolean(n.props.onViewStateChange||n.props.onViewportChange),onViewportChange:p,onStateChange:r,eventManager:k,width:n.width,height:n.height}))},t=function(a){var b=a.width,c=a.height;n.width=b,n.height=c,s(),n.props.onResize({width:b,height:c})};(0,i.useEffect)(function(){return k.setElement(l.current),k.on({pointerdown:cf.bind(n),pointermove:ch.bind(n),pointerup:cg.bind(n),pointerleave:ce.bind(n,"onMouseOut"),click:ci.bind(n),anyclick:ci.bind(n),dblclick:ce.bind(n,"onDblClick"),wheel:ce.bind(n,"onWheel"),contextmenu:ce.bind(n,"onContextMenu")}),function(){k.destroy()}},[]),aQ(function(){if(c){var a;p.apply(void 0,function(a){if(Array.isArray(a))return e(a)}(a=c)||function(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}(a)||f(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}g&&r(g)}),s();var u=a.width,v=a.height,w=a.style,x=a.getCursor,y=(0,i.useMemo)(function(){return b8(b8({position:"relative"},w),{},{width:u,height:v,cursor:x(n.state)})},[w,u,v,x,n.state]);return c&&n._child||(n._child=i.createElement(aO,{value:q},i.createElement("div",{key:"event-canvas",ref:l,style:y},i.createElement(a_,d({},a,{width:"100%",height:"100%",style:null,onResize:t,ref:m}))))),o=!1,n._child});cj.supported=a_.supported,cj.propTypes=b9,cj.defaultProps=cb;var ck=cj;function cl(a,b){if(a===b)return!0;if(!a||!b)return!1;if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return!1;for(var c=0;c prop: ".concat(d))}}(l,a,c.current):l=function(a,b,c){if(a.style&&a.style._loaded){var d=function(a){for(var b=1;b=0||(e[c]=a[c]);return e}(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d=0)&&Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}(c,["layout","paint","filter","minzoom","maxzoom","beforeId",]);if(l!==d.beforeId&&a.moveLayer(b,l),f!==d.layout){var n=d.layout||{};for(var o in f)cl(f[o],n[o])||a.setLayoutProperty(b,o,f[o]);for(var p in n)f.hasOwnProperty(p)||a.setLayoutProperty(b,p,void 0)}if(h!==d.paint){var q=d.paint||{};for(var r in h)cl(h[r],q[r])||a.setPaintProperty(b,r,h[r]);for(var s in q)h.hasOwnProperty(s)||a.setPaintProperty(b,s,void 0)}for(var t in cl(i,d.filter)||a.setFilter(b,i),(j!==d.minzoom||k!==d.maxzoom)&&a.setLayerZoomRange(b,j,k),m)cl(m[t],d[t])||a.setLayerProperty(b,t,m[t])}(a,b,c,d)}catch(e){console.warn(e)}}(h,g,a,c.current):function(a,b,c){if(a.style&&a.style._loaded){var d=cq(cq({},c),{},{id:b});delete d.beforeId,a.addLayer(d,c.beforeId)}}(h,g,a),c.current=a,null}).propTypes=cr;var ct={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},cu={captureScroll:j.bool,captureDrag:j.bool,captureClick:j.bool,captureDoubleClick:j.bool,capturePointerMove:j.bool};function cv(){var a=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{},b=(0,i.useContext)(aP),c=(0,i.useRef)(null),d=(0,i.useRef)({props:a,state:{},context:b,containerRef:c}),e=d.current;return e.props=a,e.context=b,(0,i.useEffect)(function(){return function(a){var b=a.containerRef.current,c=a.context.eventManager;if(b&&c){var d={wheel:function(b){var c=a.props;c.captureScroll&&b.stopPropagation(),c.onScroll&&c.onScroll(b,a)},panstart:function(b){var c=a.props;c.captureDrag&&b.stopPropagation(),c.onDragStart&&c.onDragStart(b,a)},anyclick:function(b){var c=a.props;c.captureClick&&b.stopPropagation(),c.onNativeClick&&c.onNativeClick(b,a)},click:function(b){var c=a.props;c.captureClick&&b.stopPropagation(),c.onClick&&c.onClick(b,a)},dblclick:function(b){var c=a.props;c.captureDoubleClick&&b.stopPropagation(),c.onDoubleClick&&c.onDoubleClick(b,a)},pointermove:function(b){var c=a.props;c.capturePointerMove&&b.stopPropagation(),c.onPointerMove&&c.onPointerMove(b,a)}};return c.watch(d,b),function(){c.off(d)}}}(e)},[b.eventManager]),e}function cw(a){var b=a.instance,c=cv(a),d=c.context,e=c.containerRef;return b._context=d,b._containerRef=e,b._render()}var cx=function(a){a4(f,a);var b,c,e=(b=f,c=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,d=a7(b);if(c){var e=a7(this).constructor;a=Reflect.construct(d,arguments,e)}else a=d.apply(this,arguments);return a6(this,a)});function f(){var a;ai(this,f);for(var b=arguments.length,c=Array(b),d=0;d2&& void 0!==arguments[2]?arguments[2]:"x";if(null===a)return b;var d="x"===c?a.offsetWidth:a.offsetHeight;return cG(b/100*d)/d*100};function cI(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}var cJ=Object.assign({},cA,{className:j.string,longitude:j.number.isRequired,latitude:j.number.isRequired,style:j.object}),cK=Object.assign({},cB,{className:""});function cL(a){var b,c,d,e,f,h,j,l,m=(b=a,d=(c=k((0,i.useState)(null),2))[0],e=c[1],f=k((0,i.useState)(null),2),h=f[0],j=f[1],l=cv(cz(cz({},b),{},{onDragStart:cE})),l.callbacks=b,l.state.dragPos=d,l.state.setDragPos=e,l.state.dragOffset=h,l.state.setDragOffset=j,(0,i.useEffect)(function(){return function(a){var b=a.context.eventManager;if(b&&a.state.dragPos){var c={panmove:function(b){return function(a,b){var c=b.props,d=b.callbacks,e=b.state,f=b.context;a.stopPropagation();var g=cC(a);e.setDragPos(g);var h=e.dragOffset;if(d.onDrag&&h){var i=Object.assign({},a);i.lngLat=cD(g,h,c,f),d.onDrag(i)}}(b,a)},panend:function(b){return function(a,b){var c=b.props,d=b.callbacks,e=b.state,f=b.context;a.stopPropagation();var g=e.dragPos,h=e.dragOffset;if(e.setDragPos(null),e.setDragOffset(null),d.onDragEnd&&g&&h){var i=Object.assign({},a);i.lngLat=cD(g,h,c,f),d.onDragEnd(i)}}(b,a)},pancancel:function(b){var c,d;return c=b,d=a.state,void(c.stopPropagation(),d.setDragPos(null),d.setDragOffset(null))}};return b.watch(c),function(){b.off(c)}}}(l)},[l.context.eventManager,Boolean(d)]),l),n=m.state,o=m.containerRef,p=a.children,q=a.className,r=a.draggable,s=a.style,t=n.dragPos,u=function(a){var b=a.props,c=a.state,d=a.context,e=b.longitude,f=b.latitude,g=b.offsetLeft,h=b.offsetTop,i=c.dragPos,j=c.dragOffset,l=d.viewport,m=d.map;if(i&&j)return[i[0]+j[0],i[1]+j[1],];var n=aR(m,{longitude:e,latitude:f}),o=l.project([e,f,n,]),p=k(o,2),q=p[0],r=p[1];return[q+=g,r+=h]}(m),v=k(u,2),w=v[0],x=v[1],y="translate(".concat(cG(w),"px, ").concat(cG(x),"px)"),z=r?t?"grabbing":"grab":"auto",A=(0,i.useMemo)(function(){var a=function(a){for(var b=1;b0){var q=m,r=p;for(m=0;m<=1;m+=.5)o=(n=c-m*g)+g,p=Math.max(0,j-n)+Math.max(0,o-e+j),p0){var w=l,x=v;for(l=0;l<=1;l+=s)u=(t=b-l*f)+f,v=Math.max(0,j-t)+Math.max(0,u-d+j),v1||I< -1||G<0||G>B.width||H<0||H>B.height?P.display="none":P.zIndex=Math.floor((1-I)/2*1e5)),P),T=(0,i.useCallback)(function(a){c.props.onClose();var b=c.context.eventManager;b&&b.once("click",function(a){return a.stopPropagation()},a.target)},[]);return i.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(R," ").concat(j),style:S,ref:e},i.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:n}}),i.createElement("div",{key:"content",ref:b,className:"mapboxgl-popup-content"},o&&i.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:T},"\xd7"),p))}function cR(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}cQ.propTypes=cO,cQ.defaultProps=cP,i.memo(cQ);var cS=Object.assign({},cu,{toggleLabel:j.string,className:j.string,style:j.object,compact:j.bool,customAttribution:j.oneOfType([j.string,j.arrayOf(j.string),])}),cT=Object.assign({},ct,{className:"",toggleLabel:"Toggle Attribution"});function cU(a){var b=cv(a),c=b.context,d=b.containerRef,e=(0,i.useRef)(null),f=k((0,i.useState)(!1),2),h=f[0],j=f[1];(0,i.useEffect)(function(){var b,f,g,h,i,j;return c.map&&(b=(f={customAttribution:a.customAttribution},g=c.map,h=d.current,i=e.current,(j=new(az()).AttributionControl(f))._map=g,j._container=h,j._innerContainer=i,j._updateAttributions(),j._updateEditLink(),g.on("styledata",j._updateData),g.on("sourcedata",j._updateData),j)),function(){var a;return b&&void((a=b)._map.off("styledata",a._updateData),a._map.off("sourcedata",a._updateData))}},[c.map]);var l=void 0===a.compact?c.viewport.width<=640:a.compact;(0,i.useEffect)(function(){!l&&h&&j(!1)},[l]);var m=(0,i.useCallback)(function(){return j(function(a){return!a})},[]),n=(0,i.useMemo)(function(){return function(a){for(var b=1;bg)return 1}return 0}(b.map.version,"1.6.0")>=0?2:1:2},[b.map]),d=b.viewport.bearing,e={transform:"rotate(".concat(-d,"deg)")},2===c?i.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:e}):i.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:e})))))}function c9(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}c8.propTypes=c4,c8.defaultProps=c5,i.memo(c8);var da=Object.assign({},cu,{className:j.string,style:j.object,maxWidth:j.number,unit:j.oneOf(["imperial","metric","nautical"])}),db=Object.assign({},ct,{className:"",maxWidth:100,unit:"metric"});function dc(a){var b=cv(a),c=b.context,d=b.containerRef,e=k((0,i.useState)(null),2),f=e[0],h=e[1];(0,i.useEffect)(function(){if(c.map){var a=new(az()).ScaleControl;a._map=c.map,a._container=d.current,h(a)}},[c.map]),f&&(f.options=a,f._onMove());var j=(0,i.useMemo)(function(){return function(a){for(var b=1;b component higher in the tree to provide a loading indicator or placeholder to display."); } - renderDidError(), value = createCapturedValue(value, sourceFiber); + 5 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2), value = createCapturedValue(value, sourceFiber); var workInProgress = returnFiber; do { switch(workInProgress.tag){ @@ -7696,8 +7635,8 @@ var instance = node.stateNode; isHidden ? hideInstance(instance) : unhideInstance(node.stateNode, node.memoizedProps); } else if (6 === node.tag) { - var _instance3 = node.stateNode; - isHidden ? hideTextInstance(_instance3) : unhideTextInstance(_instance3, node.memoizedProps); + var textInstance, textInstance1, text, _instance3 = node.stateNode; + isHidden ? _instance3.nodeValue = "" : (textInstance1 = _instance3, text = node.memoizedProps, textInstance1.nodeValue = text); } else if ((23 === node.tag || 24 === node.tag) && null !== node.memoizedState && node !== finishedWork) ; else if (null !== node.child) { node.child.return = node, node = node.child; @@ -7790,7 +7729,7 @@ return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag; } function commitPlacement(finishedWork) { - var parent, isContainer, parentFiber = function(fiber) { + var domElement, parent, isContainer, parentFiber = function(fiber) { for(var parent = fiber.return; null !== parent;){ if (isHostParent(parent)) return parent; parent = parent.return; @@ -7808,7 +7747,7 @@ default: throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."); } - 16 & parentFiber.flags && (resetTextContent(parent), parentFiber.flags &= -17); + 16 & parentFiber.flags && (setTextContent(parent, ""), parentFiber.flags &= -17); var before = function(fiber) { var node = fiber; siblings: for(;;){ @@ -7877,7 +7816,9 @@ } currentParentIsValid = !0; } - if (5 === node.tag || 6 === node.tag) commitNestedUnmounts(finishedRoot, node), currentParentIsContainer ? removeChildFromContainer(currentParent, node.stateNode) : removeChild(currentParent, node.stateNode); + if (5 === node.tag || 6 === node.tag) commitNestedUnmounts(finishedRoot, node), currentParentIsContainer ? removeChildFromContainer(currentParent, node.stateNode) : function(parentInstance, child) { + parentInstance.removeChild(child); + }(currentParent, node.stateNode); else if (4 === node.tag) { if (null !== node.child) { currentParent = node.stateNode.containerInfo, currentParentIsContainer = !0, node.child.return = node, node = node.child; @@ -7977,7 +7918,7 @@ throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); } function commitSuspenseComponent(finishedWork) { - null !== finishedWork.memoizedState && (markCommitTimeOfFallback(), hideOrUnhideAllChildren(finishedWork.child, !0)); + null !== finishedWork.memoizedState && (globalMostRecentFallbackTime = now(), hideOrUnhideAllChildren(finishedWork.child, !0)); } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { @@ -8013,7 +7954,8 @@ return !1; } function commitResetTextContent(current) { - resetTextContent(current.stateNode); + var domElement; + setTextContent(current.stateNode, ""); } if ("function" == typeof Symbol && Symbol.for) { var symbolFor$1 = Symbol.for; @@ -8072,7 +8014,7 @@ return 3 !== node.tag ? null : node.stateNode; } function ensureRootIsScheduled(root, currentTime) { - var callback, newCallbackNode, existingCallbackNode = root.callbackNode; + var callbackNode, callbackNode1, callback, newCallbackNode, existingCallbackNode = root.callbackNode; !function(root, currentTime) { for(var pendingLanes = root.pendingLanes, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = pendingLanes; lanes > 0;){ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index, expirationTime = expirationTimes[index]; @@ -8081,12 +8023,12 @@ }(root, currentTime); var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes), newCallbackPriority = return_highestLanePriority; if (nextLanes === NoLanes) { - null !== existingCallbackNode && (cancelCallback(existingCallbackNode), root.callbackNode = null, root.callbackPriority = 0); + null !== existingCallbackNode && ((callbackNode = existingCallbackNode) !== fakeCallbackNode && Scheduler_cancelCallback(callbackNode), root.callbackNode = null, root.callbackPriority = 0); return; } if (null !== existingCallbackNode) { if (root.callbackPriority === newCallbackPriority) return; - cancelCallback(existingCallbackNode); + (callbackNode1 = existingCallbackNode) !== fakeCallbackNode && Scheduler_cancelCallback(callbackNode1); } if (15 === newCallbackPriority) newCallbackNode = (callback = performSyncWorkOnRoot.bind(null, root), null === syncQueue ? (syncQueue = [ callback @@ -8152,12 +8094,12 @@ commitRoot(root); break; case 3: - if (markRootSuspended$1(root, lanes), includesOnlyRetries(lanes) && !shouldForceFlushFallbacksInDEV()) { + if (markRootSuspended$1(root, lanes), includesOnlyRetries(lanes) && !(actingUpdatesScopeDepth > 0)) { var msUntilTimeout = globalMostRecentFallbackTime + 500 - now(); if (msUntilTimeout > 10) { if (getNextLanes(root, NoLanes) !== NoLanes) break; - var suspendedLanes = root.suspendedLanes; - if (!isSubsetOfLanes(suspendedLanes, lanes)) { + var set, subset, suspendedLanes = root.suspendedLanes; + if (((set = suspendedLanes) & (subset = lanes)) !== subset) { requestEventTime(), markRootPinged(root, suspendedLanes); break; } @@ -8169,7 +8111,7 @@ break; case 4: if (markRootSuspended$1(root, lanes), (4186112 & (lanes1 = lanes)) === lanes1) break; - if (!shouldForceFlushFallbacksInDEV()) { + if (!(actingUpdatesScopeDepth > 0)) { var lanes1, eventTimeMs = function(root, lanes) { for(var eventTimes = root.eventTimes, mostRecentEventTime = -1; lanes > 0;){ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index, eventTime = eventTimes[index]; @@ -8269,9 +8211,6 @@ var prevDispatcher = ReactCurrentDispatcher$2.current; return (ReactCurrentDispatcher$2.current = ContextOnlyDispatcher, null === prevDispatcher) ? ContextOnlyDispatcher : prevDispatcher; } - function popDispatcher(prevDispatcher) { - ReactCurrentDispatcher$2.current = prevDispatcher; - } function pushInteractions(root) { var prevInteractions = __interactionsRef.current; return __interactionsRef.current = root.memoizedInteractions, prevInteractions; @@ -8279,29 +8218,17 @@ function popInteractions(prevInteractions) { __interactionsRef.current = prevInteractions; } - function markCommitTimeOfFallback() { - globalMostRecentFallbackTime = now(); - } function markSkippedUpdateLanes(lane) { var a, b; workInProgressRootSkippedLanes = (a = lane) | workInProgressRootSkippedLanes; } - function renderDidSuspend() { - 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3); - } function renderDidSuspendDelayIfPossible() { (0 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus) && (workInProgressRootExitStatus = 4), null !== workInProgressRoot && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes)) && markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); } - function renderDidError() { - 5 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); - } - function renderHasNotSuspendedYet() { - return 0 === workInProgressRootExitStatus; - } function renderRootSync(root, lanes) { - var prevExecutionContext = executionContext; + var prevDispatcher, prevExecutionContext = executionContext; executionContext |= 16; - var prevDispatcher = pushDispatcher(); + var prevDispatcher1 = pushDispatcher(); (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) && (prepareFreshStack(root, lanes), startWorkOnPendingInteractions(root, lanes)); for(var prevInteractions = pushInteractions(root);;)try { workLoopSync(); @@ -8309,16 +8236,16 @@ } catch (thrownValue) { handleError(root, thrownValue); } - if (resetContextDependencies(), popInteractions(prevInteractions), executionContext = prevExecutionContext, popDispatcher(prevDispatcher), null !== workInProgress) throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."); + if (resetContextDependencies(), popInteractions(prevInteractions), executionContext = prevExecutionContext, prevDispatcher = prevDispatcher1, ReactCurrentDispatcher$2.current = prevDispatcher, null !== workInProgress) throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."); return workInProgressRoot = null, workInProgressRootRenderLanes = NoLanes, workInProgressRootExitStatus; } function workLoopSync() { for(; null !== workInProgress;)performUnitOfWork(workInProgress); } function renderRootConcurrent(root, lanes) { - var prevExecutionContext = executionContext; + var prevDispatcher, prevExecutionContext = executionContext; executionContext |= 16; - var prevDispatcher = pushDispatcher(); + var prevDispatcher1 = pushDispatcher(); (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) && (resetRenderTimer(), prepareFreshStack(root, lanes), startWorkOnPendingInteractions(root, lanes)); for(var prevInteractions = pushInteractions(root);;)try { workLoopConcurrent(); @@ -8326,7 +8253,7 @@ } catch (thrownValue) { handleError(root, thrownValue); } - return (resetContextDependencies(), popInteractions(prevInteractions), popDispatcher(prevDispatcher), executionContext = prevExecutionContext, null !== workInProgress) ? 0 : (workInProgressRoot = null, workInProgressRootRenderLanes = NoLanes, workInProgressRootExitStatus); + return (resetContextDependencies(), popInteractions(prevInteractions), prevDispatcher = prevDispatcher1, ReactCurrentDispatcher$2.current = prevDispatcher, executionContext = prevExecutionContext, null !== workInProgress) ? 0 : (workInProgressRoot = null, workInProgressRootRenderLanes = NoLanes, workInProgressRootExitStatus); } function workLoopConcurrent() { for(; null !== workInProgress && !shouldYield();)performUnitOfWork(workInProgress); @@ -8404,9 +8331,9 @@ entanglements[index] = NoLanes, eventTimes[index] = -1, expirationTimes[index] = -1, lanes &= ~lane; } }(root, remainingLanes), null !== rootsWithPendingDiscreteUpdates && (24 & remainingLanes) === NoLanes && rootsWithPendingDiscreteUpdates.has(root) && rootsWithPendingDiscreteUpdates.delete(root), root === workInProgressRoot && (workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = NoLanes), finishedWork.flags > 1 ? null !== finishedWork.lastEffect ? (finishedWork.lastEffect.nextEffect = finishedWork, firstEffect = finishedWork.firstEffect) : firstEffect = finishedWork : firstEffect = finishedWork.firstEffect, null !== firstEffect) { - var a, b, lanes1, prevExecutionContext = executionContext; + var a, b, lanes1, enabled, prevExecutionContext = executionContext; executionContext |= 32; - var focusedElem, input, prevInteractions = pushInteractions(root); + var focusedElem, enabled1, input, prevInteractions = pushInteractions(root); ReactCurrentOwner$2.current = null, focusedInstanceHandle = (root.containerInfo, eventsEnabled = _enabled, selectionInformation = { focusedElem: focusedElem = getActiveElementDeep(), selectionRange: hasSelectionCapabilities(focusedElem) ? ("selectionStart" in (input = focusedElem) ? { @@ -8441,14 +8368,14 @@ start: 0, end: 0 } : null - }, setEnabled(!1), null), shouldFireAfterActiveInstanceBlur = !1, nextEffect = firstEffect; + }, _enabled = !1, null), shouldFireAfterActiveInstanceBlur = !1, nextEffect = firstEffect; do if (invokeGuardedCallback(null, commitBeforeMutationEffects, null), hasError) { if (!(null !== nextEffect)) throw Error("Should be working on an effect."); var error1 = clearCaughtError(); captureCommitPhaseError(nextEffect, error1), nextEffect = nextEffect.nextEffect; } while (null !== nextEffect) - focusedInstanceHandle = null, recordCommitTime(), nextEffect = firstEffect; + focusedInstanceHandle = null, commitTime = now$1(), nextEffect = firstEffect; do if (invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel), hasError) { if (!(null !== nextEffect)) throw Error("Should be working on an effect."); var _error = clearCaughtError(); @@ -8485,7 +8412,7 @@ info.element.scrollLeft = info.left, info.element.scrollTop = info.top; } } - }(selectionInformation), setEnabled(eventsEnabled), eventsEnabled = null, selectionInformation = null, root.current = finishedWork, nextEffect = firstEffect; + }(selectionInformation), _enabled = !!eventsEnabled, eventsEnabled = null, selectionInformation = null, root.current = finishedWork, nextEffect = firstEffect; do if (invokeGuardedCallback(null, commitLayoutEffects, null, root, lanes), hasError) { if (!(null !== nextEffect)) throw Error("Should be working on an effect."); var _error2 = clearCaughtError(); @@ -8493,7 +8420,7 @@ } while (null !== nextEffect) nextEffect = null, requestPaint(), popInteractions(prevInteractions), executionContext = prevExecutionContext; - } else root.current = finishedWork, recordCommitTime(); + } else root.current = finishedWork, commitTime = now$1(); var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; if (rootDoesHavePassiveEffects) rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = root, pendingPassiveEffectsLanes = lanes, pendingPassiveEffectsRenderPriority = renderPriorityLevel; else for(nextEffect = firstEffect; null !== nextEffect;){ @@ -8680,8 +8607,8 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { var a, b, pingCache = root.pingCache; null !== pingCache && pingCache.delete(wakeable); - var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes), workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes) && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, NoLanes) : workInProgressRootPingedLanes = (a = workInProgressRootPingedLanes) | pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); + var set, subset, eventTime = requestEventTime(); + markRootPinged(root, pingedLanes), workInProgressRoot === root && ((set = workInProgressRootRenderLanes) & (subset = pingedLanes)) === subset && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, NoLanes) : workInProgressRootPingedLanes = (a = workInProgressRootPingedLanes) | pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); } function resolveRetryWakeable(boundaryFiber, wakeable) { var retryCache, boundaryFiber1, retryLane, eventTime, root, fiber, wipLanes, lane, mode; @@ -8866,9 +8793,6 @@ }); } } - function shouldForceFlushFallbacksInDEV() { - return actingUpdatesScopeDepth > 0; - } var actingUpdatesScopeDepth = 0; function detachFiberAfterEffects(fiber) { fiber.sibling = null, fiber.stateNode = null; @@ -9364,7 +9288,8 @@ "function" == typeof arguments[0] && error("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."); var root = this._internalRoot, container = root.containerInfo; updateContainer(null, root, null, function() { - unmarkContainerAsRoot(container); + var node; + container[internalContainerInstanceKey] = null; }); }; var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner, warnedAboutHydrateAPI = !1; @@ -9591,18 +9516,21 @@ return hostFiber.stateNode; }(componentOrElement, "findDOMNode"); }, exports1.flushSync = flushSync, exports1.hydrate = function(element, container, callback) { + var node; if (!isValidContainer(container)) throw Error("Target container is not a DOM element."); - return isContainerMarkedAsRoot(container) && void 0 === container._reactRootContainer && error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call createRoot(container, {hydrate: true}).render(element)?"), legacyRenderSubtreeIntoContainer(null, element, container, !0, callback); + return container[internalContainerInstanceKey] && void 0 === container._reactRootContainer && error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call createRoot(container, {hydrate: true}).render(element)?"), legacyRenderSubtreeIntoContainer(null, element, container, !0, callback); }, exports1.render = function(element, container, callback) { + var node; if (!isValidContainer(container)) throw Error("Target container is not a DOM element."); - return isContainerMarkedAsRoot(container) && void 0 === container._reactRootContainer && error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.render(element)?"), legacyRenderSubtreeIntoContainer(null, element, container, !1, callback); + return container[internalContainerInstanceKey] && void 0 === container._reactRootContainer && error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.render(element)?"), legacyRenderSubtreeIntoContainer(null, element, container, !1, callback); }, exports1.unmountComponentAtNode = function(container) { if (!isValidContainer(container)) throw Error("unmountComponentAtNode(...): Target container is not a DOM element."); - if (isContainerMarkedAsRoot(container) && void 0 === container._reactRootContainer && error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?"), container._reactRootContainer) { - var rootEl = getReactRootElementInContainer(container); + if (container[internalContainerInstanceKey] && void 0 === container._reactRootContainer && error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?"), container._reactRootContainer) { + var node, rootEl = getReactRootElementInContainer(container); return rootEl && !getInstanceFromNode(rootEl) && error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React."), unbatchedUpdates(function() { legacyRenderSubtreeIntoContainer(null, null, container, !1, function() { - container._reactRootContainer = null, unmarkContainerAsRoot(container); + var node; + container._reactRootContainer = null, container[internalContainerInstanceKey] = null; }); }), !0; } diff --git a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2783/output.js b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2783/output.js index dcaafb684daf..af5097f0f2d1 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2783/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2783/output.js @@ -1,10 +1,8 @@ -(function() { - return function(o, i) { - while(i--)console.log(f(o)); - }; - function f(a) { - return a.b || a; +(function(o, i) { + while(i--){ + var a; + console.log((a = o).b || a); } -})()({ +})({ b: "PASS" }, 1);