import { __async, __commonJS, __export, __objRest, __require, __spreadProps, __spreadValues, __superGet, __toESM } from "./chunk-PGJZKRXO.js"; // node_modules/lodash/lodash.js var require_lodash = __commonJS({ "node_modules/lodash/lodash.js"(exports, module) { "use strict"; (function() { var undefined2; var VERSION7 = "4.17.21"; var LARGE_ARRAY_SIZE = 200; var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; var HASH_UNDEFINED = "__lodash_hash_undefined__"; var MAX_MEMOIZE_SIZE = 500; var PLACEHOLDER = "__lodash_placeholder__"; var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; var HOT_COUNT = 800, HOT_SPAN = 16; var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER2 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; var wrapFlags = [ ["ary", WRAP_ARY_FLAG], ["bind", WRAP_BIND_FLAG], ["bindKey", WRAP_BIND_KEY_FLAG], ["curry", WRAP_CURRY_FLAG], ["curryRight", WRAP_CURRY_RIGHT_FLAG], ["flip", WRAP_FLIP_FLAG], ["partial", WRAP_PARTIAL_FLAG], ["partialRight", WRAP_PARTIAL_RIGHT_FLAG], ["rearg", WRAP_REARG_FLAG] ]; var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); var reTrimStart = /^\s+/; var reWhitespace = /\s/; var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; var reEscapeChar = /\\(\\)?/g; var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; var reFlags = /\w*$/; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; var reIsHostCtor = /^\[object .+?Constructor\]$/; var reIsOctal = /^0o[0-7]+$/i; var reIsUint = /^(?:0|[1-9]\d*)$/; var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; var reNoMatch = /($^)/; var reUnescapedString = /['\n\r\u2028\u2029\\]/g; var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d"; var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; var reApos = RegExp(rsApos, "g"); var reComboMark = RegExp(rsCombo, "g"); var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); var reUnicodeWord = RegExp([ rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, rsUpper + "+" + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji ].join("|"), "g"); var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; var contextProps = [ "Array", "Buffer", "DataView", "Date", "Error", "Float32Array", "Float64Array", "Function", "Int8Array", "Int16Array", "Int32Array", "Map", "Math", "Object", "Promise", "RegExp", "Set", "String", "Symbol", "TypeError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap", "_", "clearTimeout", "isFinite", "parseInt", "setTimeout" ]; var templateCounter = -1; var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; var deburredLetters = { // Latin-1 Supplement block. "\xC0": "A", "\xC1": "A", "\xC2": "A", "\xC3": "A", "\xC4": "A", "\xC5": "A", "\xE0": "a", "\xE1": "a", "\xE2": "a", "\xE3": "a", "\xE4": "a", "\xE5": "a", "\xC7": "C", "\xE7": "c", "\xD0": "D", "\xF0": "d", "\xC8": "E", "\xC9": "E", "\xCA": "E", "\xCB": "E", "\xE8": "e", "\xE9": "e", "\xEA": "e", "\xEB": "e", "\xCC": "I", "\xCD": "I", "\xCE": "I", "\xCF": "I", "\xEC": "i", "\xED": "i", "\xEE": "i", "\xEF": "i", "\xD1": "N", "\xF1": "n", "\xD2": "O", "\xD3": "O", "\xD4": "O", "\xD5": "O", "\xD6": "O", "\xD8": "O", "\xF2": "o", "\xF3": "o", "\xF4": "o", "\xF5": "o", "\xF6": "o", "\xF8": "o", "\xD9": "U", "\xDA": "U", "\xDB": "U", "\xDC": "U", "\xF9": "u", "\xFA": "u", "\xFB": "u", "\xFC": "u", "\xDD": "Y", "\xFD": "y", "\xFF": "y", "\xC6": "Ae", "\xE6": "ae", "\xDE": "Th", "\xFE": "th", "\xDF": "ss", // Latin Extended-A block. "\u0100": "A", "\u0102": "A", "\u0104": "A", "\u0101": "a", "\u0103": "a", "\u0105": "a", "\u0106": "C", "\u0108": "C", "\u010A": "C", "\u010C": "C", "\u0107": "c", "\u0109": "c", "\u010B": "c", "\u010D": "c", "\u010E": "D", "\u0110": "D", "\u010F": "d", "\u0111": "d", "\u0112": "E", "\u0114": "E", "\u0116": "E", "\u0118": "E", "\u011A": "E", "\u0113": "e", "\u0115": "e", "\u0117": "e", "\u0119": "e", "\u011B": "e", "\u011C": "G", "\u011E": "G", "\u0120": "G", "\u0122": "G", "\u011D": "g", "\u011F": "g", "\u0121": "g", "\u0123": "g", "\u0124": "H", "\u0126": "H", "\u0125": "h", "\u0127": "h", "\u0128": "I", "\u012A": "I", "\u012C": "I", "\u012E": "I", "\u0130": "I", "\u0129": "i", "\u012B": "i", "\u012D": "i", "\u012F": "i", "\u0131": "i", "\u0134": "J", "\u0135": "j", "\u0136": "K", "\u0137": "k", "\u0138": "k", "\u0139": "L", "\u013B": "L", "\u013D": "L", "\u013F": "L", "\u0141": "L", "\u013A": "l", "\u013C": "l", "\u013E": "l", "\u0140": "l", "\u0142": "l", "\u0143": "N", "\u0145": "N", "\u0147": "N", "\u014A": "N", "\u0144": "n", "\u0146": "n", "\u0148": "n", "\u014B": "n", "\u014C": "O", "\u014E": "O", "\u0150": "O", "\u014D": "o", "\u014F": "o", "\u0151": "o", "\u0154": "R", "\u0156": "R", "\u0158": "R", "\u0155": "r", "\u0157": "r", "\u0159": "r", "\u015A": "S", "\u015C": "S", "\u015E": "S", "\u0160": "S", "\u015B": "s", "\u015D": "s", "\u015F": "s", "\u0161": "s", "\u0162": "T", "\u0164": "T", "\u0166": "T", "\u0163": "t", "\u0165": "t", "\u0167": "t", "\u0168": "U", "\u016A": "U", "\u016C": "U", "\u016E": "U", "\u0170": "U", "\u0172": "U", "\u0169": "u", "\u016B": "u", "\u016D": "u", "\u016F": "u", "\u0171": "u", "\u0173": "u", "\u0174": "W", "\u0175": "w", "\u0176": "Y", "\u0177": "y", "\u0178": "Y", "\u0179": "Z", "\u017B": "Z", "\u017D": "Z", "\u017A": "z", "\u017C": "z", "\u017E": "z", "\u0132": "IJ", "\u0133": "ij", "\u0152": "Oe", "\u0153": "oe", "\u0149": "'n", "\u017F": "s" }; var htmlEscapes = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }; var htmlUnescapes = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'" }; var stringEscapes = { "\\": "\\", "'": "'", "\n": "n", "\r": "r", "\u2028": "u2028", "\u2029": "u2029" }; var freeParseFloat = parseFloat, freeParseInt = parseInt; var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function("return this")(); var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; var moduleExports = freeModule && freeModule.exports === freeExports; var freeProcess = moduleExports && freeGlobal.process; var nodeUtil = (function() { try { var types = freeModule && freeModule.require && freeModule.require("util").types; if (types) { return types; } return freeProcess && freeProcess.binding && freeProcess.binding("util"); } catch (e56) { } })(); var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } function arrayAggregator(array, setter, iteratee, accumulator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { var value = array[index]; setter(accumulator, value, iteratee(value), array); } return accumulator; } function arrayEach(array, iteratee) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } function arrayEachRight(array, iteratee) { var length = array == null ? 0 : array.length; while (length--) { if (iteratee(array[length], length, array) === false) { break; } } return array; } function arrayEvery(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (!predicate(array[index], index, array)) { return false; } } return true; } function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } function arrayIncludesWith(array, value, comparator) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (comparator(value, array[index])) { return true; } } return false; } function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } function arrayPush(array, values3) { var index = -1, length = values3.length, offset2 = array.length; while (++index < length) { array[offset2 + index] = values3[index]; } return array; } function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } function arrayReduceRight(array, iteratee, accumulator, initAccum) { var length = array == null ? 0 : array.length; if (initAccum && length) { accumulator = array[--length]; } while (length--) { accumulator = iteratee(accumulator, array[length], length, array); } return accumulator; } function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } var asciiSize = baseProperty("length"); function asciiToArray(string) { return string.split(""); } function asciiWords(string) { return string.match(reAsciiWord) || []; } function baseFindKey(collection, predicate, eachFunc) { var result; eachFunc(collection, function(value, key, collection2) { if (predicate(value, key, collection2)) { result = key; return false; } }); return result; } function baseFindIndex(array, predicate, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 1 : -1); while (fromRight ? index-- : ++index < length) { if (predicate(array[index], index, array)) { return index; } } return -1; } function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } function baseIndexOfWith(array, value, fromIndex, comparator) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (comparator(array[index], value)) { return index; } } return -1; } function baseIsNaN(value) { return value !== value; } function baseMean(array, iteratee) { var length = array == null ? 0 : array.length; return length ? baseSum(array, iteratee) / length : NAN; } function baseProperty(key) { return function(object) { return object == null ? undefined2 : object[key]; }; } function basePropertyOf(object) { return function(key) { return object == null ? undefined2 : object[key]; }; } function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection2) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); }); return accumulator; } function baseSortBy(array, comparer) { var length = array.length; array.sort(comparer); while (length--) { array[length] = array[length].value; } return array; } function baseSum(array, iteratee) { var result, index = -1, length = array.length; while (++index < length) { var current = iteratee(array[index]); if (current !== undefined2) { result = result === undefined2 ? current : result + current; } } return result; } function baseTimes(n44, iteratee) { var index = -1, result = Array(n44); while (++index < n44) { result[index] = iteratee(index); } return result; } function baseToPairs(object, props) { return arrayMap(props, function(key) { return [key, object[key]]; }); } function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; } function baseUnary(func) { return function(value) { return func(value); }; } function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } function cacheHas(cache2, key) { return cache2.has(key); } function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { } return index; } function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { } return index; } function countHolders(array, placeholder) { var length = array.length, result = 0; while (length--) { if (array[length] === placeholder) { ++result; } } return result; } var deburrLetter = basePropertyOf(deburredLetters); var escapeHtmlChar = basePropertyOf(htmlEscapes); function escapeStringChar(chr) { return "\\" + stringEscapes[chr]; } function getValue(object, key) { return object == null ? undefined2 : object[key]; } function hasUnicode(string) { return reHasUnicode.test(string); } function hasUnicodeWord(string) { return reHasUnicodeWord.test(string); } function iteratorToArray(iterator3) { var data, result = []; while (!(data = iterator3.next()).done) { result.push(data.value); } return result; } function mapToArray(map4) { var index = -1, result = Array(map4.size); map4.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } function replaceHolders(array, placeholder) { var index = -1, length = array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value === placeholder || value === PLACEHOLDER) { array[index] = PLACEHOLDER; result[resIndex++] = index; } } return result; } function setToArray(set2) { var index = -1, result = Array(set2.size); set2.forEach(function(value) { result[++index] = value; }); return result; } function setToPairs(set2) { var index = -1, result = Array(set2.size); set2.forEach(function(value) { result[++index] = [value, value]; }); return result; } function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } function strictLastIndexOf(array, value, fromIndex) { var index = fromIndex + 1; while (index--) { if (array[index] === value) { return index; } } return index; } function stringSize(string) { return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); } function stringToArray(string) { return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); } function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) { } return index; } var unescapeHtmlChar = basePropertyOf(htmlUnescapes); function unicodeSize(string) { var result = reUnicode.lastIndex = 0; while (reUnicode.test(string)) { ++result; } return result; } function unicodeToArray(string) { return string.match(reUnicode) || []; } function unicodeWords(string) { return string.match(reUnicodeWord) || []; } var runInContext = (function runInContext2(context2) { context2 = context2 == null ? root : _3.defaults(root.Object(), context2, _3.pick(root, contextProps)); var Array2 = context2.Array, Date2 = context2.Date, Error2 = context2.Error, Function2 = context2.Function, Math2 = context2.Math, Object2 = context2.Object, RegExp2 = context2.RegExp, String2 = context2.String, TypeError2 = context2.TypeError; var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto2 = Object2.prototype; var coreJsData = context2["__core-js_shared__"]; var funcToString = funcProto.toString; var hasOwnProperty = objectProto2.hasOwnProperty; var idCounter = 0; var maskSrcKey = (function() { var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid2 ? "Symbol(src)_1." + uid2 : ""; })(); var nativeObjectToString = objectProto2.toString; var objectCtorString = funcToString.call(Object2); var oldDash = root._; var reIsNative = RegExp2( "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); var Buffer2 = moduleExports ? context2.Buffer : undefined2, Symbol2 = context2.Symbol, Uint8Array2 = context2.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto2.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2; var defineProperty = (function() { try { var func = getNative(Object2, "defineProperty"); func({}, "", {}); return func; } catch (e56) { } })(); var ctxClearTimeout = context2.clearTimeout !== root.clearTimeout && context2.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context2.setTimeout !== root.setTimeout && context2.setTimeout; var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context2.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context2.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; var DataView2 = getNative(context2, "DataView"), Map3 = getNative(context2, "Map"), Promise2 = getNative(context2, "Promise"), Set2 = getNative(context2, "Set"), WeakMap2 = getNative(context2, "WeakMap"), nativeCreate = getNative(Object2, "create"); var metaMap = WeakMap2 && new WeakMap2(); var realNames = {}; var dataViewCtorString = toSource(DataView2), mapCtorString = toSource(Map3), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2); var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2; function lodash(value) { if (isObjectLike(value) && !isArray7(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty.call(value, "__wrapped__")) { return wrapperClone(value); } } return new LodashWrapper(value); } var baseCreate = /* @__PURE__ */ (function() { function object() { } return function(proto) { if (!isObject4(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result2 = new object(); object.prototype = undefined2; return result2; }; })(); function baseLodash() { } function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = undefined2; } lodash.templateSettings = { /** * Used to detect `data` property values to be HTML-escaped. * * @memberOf _.templateSettings * @type {RegExp} */ "escape": reEscape, /** * Used to detect code to be evaluated. * * @memberOf _.templateSettings * @type {RegExp} */ "evaluate": reEvaluate, /** * Used to detect `data` property values to inject. * * @memberOf _.templateSettings * @type {RegExp} */ "interpolate": reInterpolate, /** * Used to reference the data object in the template text. * * @memberOf _.templateSettings * @type {string} */ "variable": "", /** * Used to import variables into the compiled template. * * @memberOf _.templateSettings * @type {Object} */ "imports": { /** * A reference to the `lodash` function. * * @memberOf _.templateSettings.imports * @type {Function} */ "_": lodash } }; lodash.prototype = baseLodash.prototype; lodash.prototype.constructor = lodash; LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH; this.__views__ = []; } function lazyClone() { var result2 = new LazyWrapper(this.__wrapped__); result2.__actions__ = copyArray(this.__actions__); result2.__dir__ = this.__dir__; result2.__filtered__ = this.__filtered__; result2.__iteratees__ = copyArray(this.__iteratees__); result2.__takeCount__ = this.__takeCount__; result2.__views__ = copyArray(this.__views__); return result2; } function lazyReverse() { if (this.__filtered__) { var result2 = new LazyWrapper(this); result2.__dir__ = -1; result2.__filtered__ = true; } else { result2 = this.clone(); result2.__dir__ *= -1; } return result2; } function lazyValue() { var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray7(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || !isRight && arrLength == length && takeCount == length) { return baseWrapperValue(array, this.__actions__); } var result2 = []; outer: while (length-- && resIndex < takeCount) { index += dir; var iterIndex = -1, value = array[index]; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed2 = iteratee2(value); if (type == LAZY_MAP_FLAG) { value = computed2; } else if (!computed2) { if (type == LAZY_FILTER_FLAG) { continue outer; } else { break outer; } } } result2[resIndex++] = value; } return result2; } LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } function hashDelete(key) { var result2 = this.has(key) && delete this.__data__[key]; this.size -= result2 ? 1 : 0; return result2; } function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result2 = data[key]; return result2 === HASH_UNDEFINED ? undefined2 : result2; } return hasOwnProperty.call(data, key) ? data[key] : undefined2; } function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key); } function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value; return this; } Hash.prototype.clear = hashClear; Hash.prototype["delete"] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function listCacheClear() { this.__data__ = []; this.size = 0; } function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined2 : data[index][1]; } function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } ListCache.prototype.clear = listCacheClear; ListCache.prototype["delete"] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } function mapCacheClear() { this.size = 0; this.__data__ = { "hash": new Hash(), "map": new (Map3 || ListCache)(), "string": new Hash() }; } function mapCacheDelete(key) { var result2 = getMapData(this, key)["delete"](key); this.size -= result2 ? 1 : 0; return result2; } function mapCacheGet(key) { return getMapData(this, key).get(key); } function mapCacheHas(key) { return getMapData(this, key).has(key); } function mapCacheSet(key, value) { var data = getMapData(this, key), size2 = data.size; data.set(key, value); this.size += data.size == size2 ? 0 : 1; return this; } MapCache.prototype.clear = mapCacheClear; MapCache.prototype["delete"] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; function SetCache(values4) { var index = -1, length = values4 == null ? 0 : values4.length; this.__data__ = new MapCache(); while (++index < length) { this.add(values4[index]); } } function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } function setCacheHas(value) { return this.__data__.has(value); } SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } function stackClear() { this.__data__ = new ListCache(); this.size = 0; } function stackDelete(key) { var data = this.__data__, result2 = data["delete"](key); this.size = data.size; return result2; } function stackGet(key) { return this.__data__.get(key); } function stackHas(key) { return this.__data__.has(key); } function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map3 || pairs.length < LARGE_ARRAY_SIZE - 1) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } Stack.prototype.clear = stackClear; Stack.prototype["delete"] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; function arrayLikeKeys(value, inherited) { var isArr = isArray7(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType2 = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType2, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. isIndex(key, length)))) { result2.push(key); } } return result2; } function arraySample(array) { var length = array.length; return length ? array[baseRandom(0, length - 1)] : undefined2; } function arraySampleSize(array, n44) { return shuffleSelf(copyArray(array), baseClamp(n44, 0, array.length)); } function arrayShuffle(array) { return shuffleSelf(copyArray(array)); } function assignMergeValue(object, key, value) { if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) { baseAssignValue(object, key, value); } } function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) { baseAssignValue(object, key, value); } } function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq2(array[length][0], key)) { return length; } } return -1; } function baseAggregator(collection, setter, iteratee2, accumulator) { baseEach(collection, function(value, key, collection2) { setter(accumulator, value, iteratee2(value), collection2); }); return accumulator; } function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } function baseAssignIn(object, source) { return object && copyObject(source, keysIn(source), object); } function baseAssignValue(object, key, value) { if (key == "__proto__" && defineProperty) { defineProperty(object, key, { "configurable": true, "enumerable": true, "value": value, "writable": true }); } else { object[key] = value; } } function baseAt(object, paths) { var index = -1, length = paths.length, result2 = Array2(length), skip3 = object == null; while (++index < length) { result2[index] = skip3 ? undefined2 : get(object, paths[index]); } return result2; } function baseClamp(number, lower, upper) { if (number === number) { if (upper !== undefined2) { number = number <= upper ? number : upper; } if (lower !== undefined2) { number = number >= lower ? number : lower; } } return number; } function baseClone(value, bitmask, customizer, key, object, stack) { var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; if (customizer) { result2 = object ? customizer(value, key, object, stack) : customizer(value); } if (result2 !== undefined2) { return result2; } if (!isObject4(value)) { return value; } var isArr = isArray7(value); if (isArr) { result2 = initCloneArray(value); if (!isDeep) { return copyArray(value, result2); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || isFunc && !object) { result2 = isFlat || isFunc ? {} : initCloneObject(value); if (!isDeep) { return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result2 = initCloneByTag(value, tag, isDeep); } } stack || (stack = new Stack()); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result2); if (isSet2(value)) { value.forEach(function(subValue) { result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); } else if (isMap(value)) { value.forEach(function(subValue, key2) { result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); }); } var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; var props = isArr ? undefined2 : keysFunc(value); arrayEach(props || value, function(subValue, key2) { if (props) { key2 = subValue; subValue = value[key2]; } assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); }); return result2; } function baseConforms(source) { var props = keys(source); return function(object) { return baseConformsTo(object, source, props); }; } function baseConformsTo(object, source, props) { var length = props.length; if (object == null) { return !length; } object = Object2(object); while (length--) { var key = props[length], predicate = source[key], value = object[key]; if (value === undefined2 && !(key in object) || !predicate(value)) { return false; } } return true; } function baseDelay(func, wait, args) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } return setTimeout2(function() { func.apply(undefined2, args); }, wait); } function baseDifference(array, values4, iteratee2, comparator) { var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values4.length; if (!length) { return result2; } if (iteratee2) { values4 = arrayMap(values4, baseUnary(iteratee2)); } if (comparator) { includes2 = arrayIncludesWith; isCommon = false; } else if (values4.length >= LARGE_ARRAY_SIZE) { includes2 = cacheHas; isCommon = false; values4 = new SetCache(values4); } outer: while (++index < length) { var value = array[index], computed2 = iteratee2 == null ? value : iteratee2(value); value = comparator || value !== 0 ? value : 0; if (isCommon && computed2 === computed2) { var valuesIndex = valuesLength; while (valuesIndex--) { if (values4[valuesIndex] === computed2) { continue outer; } } result2.push(value); } else if (!includes2(values4, computed2, comparator)) { result2.push(value); } } return result2; } var baseEach = createBaseEach(baseForOwn); var baseEachRight = createBaseEach(baseForOwnRight, true); function baseEvery(collection, predicate) { var result2 = true; baseEach(collection, function(value, index, collection2) { result2 = !!predicate(value, index, collection2); return result2; }); return result2; } function baseExtremum(array, iteratee2, comparator) { var index = -1, length = array.length; while (++index < length) { var value = array[index], current = iteratee2(value); if (current != null && (computed2 === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed2))) { var computed2 = current, result2 = value; } } return result2; } function baseFill(array, value, start, end) { var length = array.length; start = toInteger2(start); if (start < 0) { start = -start > length ? 0 : length + start; } end = end === undefined2 || end > length ? length : toInteger2(end); if (end < 0) { end += length; } end = start > end ? 0 : toLength(end); while (start < end) { array[start++] = value; } return array; } function baseFilter(collection, predicate) { var result2 = []; baseEach(collection, function(value, index, collection2) { if (predicate(value, index, collection2)) { result2.push(value); } }); return result2; } function baseFlatten(array, depth, predicate, isStrict, result2) { var index = -1, length = array.length; predicate || (predicate = isFlattenable); result2 || (result2 = []); while (++index < length) { var value = array[index]; if (depth > 0 && predicate(value)) { if (depth > 1) { baseFlatten(value, depth - 1, predicate, isStrict, result2); } else { arrayPush(result2, value); } } else if (!isStrict) { result2[result2.length] = value; } } return result2; } var baseFor = createBaseFor(); var baseForRight = createBaseFor(true); function baseForOwn(object, iteratee2) { return object && baseFor(object, iteratee2, keys); } function baseForOwnRight(object, iteratee2) { return object && baseForRight(object, iteratee2, keys); } function baseFunctions(object, props) { return arrayFilter(props, function(key) { return isFunction5(object[key]); }); } function baseGet(object, path) { path = castPath(path, object); var index = 0, length = path.length; while (object != null && index < length) { object = object[toKey(path[index++])]; } return index && index == length ? object : undefined2; } function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result2 = keysFunc(object); return isArray7(object) ? result2 : arrayPush(result2, symbolsFunc(object)); } function baseGetTag(value) { if (value == null) { return value === undefined2 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value); } function baseGt(value, other) { return value > other; } function baseHas(object, key) { return object != null && hasOwnProperty.call(object, key); } function baseHasIn(object, key) { return object != null && key in Object2(object); } function baseInRange(number, start, end) { return number >= nativeMin(start, end) && number < nativeMax(start, end); } function baseIntersection(arrays, iteratee2, comparator) { var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches2 = Array2(othLength), maxLength = Infinity, result2 = []; while (othIndex--) { var array = arrays[othIndex]; if (othIndex && iteratee2) { array = arrayMap(array, baseUnary(iteratee2)); } maxLength = nativeMin(array.length, maxLength); caches2[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2; } array = arrays[0]; var index = -1, seen = caches2[0]; outer: while (++index < length && result2.length < maxLength) { var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (!(seen ? cacheHas(seen, computed2) : includes2(result2, computed2, comparator))) { othIndex = othLength; while (--othIndex) { var cache2 = caches2[othIndex]; if (!(cache2 ? cacheHas(cache2, computed2) : includes2(arrays[othIndex], computed2, comparator))) { continue outer; } } if (seen) { seen.push(computed2); } result2.push(value); } } return result2; } function baseInverter(object, setter, iteratee2, accumulator) { baseForOwn(object, function(value, key, object2) { setter(accumulator, iteratee2(value), key, object2); }); return accumulator; } function baseInvoke(object, path, args) { path = castPath(path, object); object = parent2(object, path); var func = object == null ? object : object[toKey(last5(path))]; return func == null ? undefined2 : apply(func, object, args); } function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } function baseIsArrayBuffer(value) { return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; } function baseIsDate(value) { return isObjectLike(value) && baseGetTag(value) == dateTag; } function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray7(object), othIsArr = isArray7(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack()); return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack()); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack()); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } function baseIsMap(value) { return isObjectLike(value) && getTag(value) == mapTag; } function baseIsMatch(object, source, matchData, customizer) { var index = matchData.length, length = index, noCustomizer = !customizer; if (object == null) { return !length; } object = Object2(object); while (index--) { var data = matchData[index]; if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { return false; } } while (++index < length) { data = matchData[index]; var key = data[0], objValue = object[key], srcValue = data[1]; if (noCustomizer && data[2]) { if (objValue === undefined2 && !(key in object)) { return false; } } else { var stack = new Stack(); if (customizer) { var result2 = customizer(objValue, srcValue, key, object, source, stack); } if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { return false; } } } return true; } function baseIsNative(value) { if (!isObject4(value) || isMasked(value)) { return false; } var pattern = isFunction5(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function baseIsRegExp(value) { return isObjectLike(value) && baseGetTag(value) == regexpTag; } function baseIsSet(value) { return isObjectLike(value) && getTag(value) == setTag; } function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } function baseIteratee(value) { if (typeof value == "function") { return value; } if (value == null) { return identity2; } if (typeof value == "object") { return isArray7(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); } return property(value); } function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result2 = []; for (var key in Object2(object)) { if (hasOwnProperty.call(object, key) && key != "constructor") { result2.push(key); } } return result2; } function baseKeysIn(object) { if (!isObject4(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result2 = []; for (var key in object) { if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) { result2.push(key); } } return result2; } function baseLt(value, other) { return value < other; } function baseMap(collection, iteratee2) { var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value, key, collection2) { result2[++index] = iteratee2(value, key, collection2); }); return result2; } function baseMatches(source) { var matchData = getMatchData(source); if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } return function(object) { var objValue = get(object, path); return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack()); if (isObject4(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet2(object, key), srcValue, key + "", object, source, stack) : undefined2; if (newValue === undefined2) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet2(object, key), srcValue = safeGet2(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2; var isCommon = newValue === undefined2; if (isCommon) { var isArr = isArray7(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray7(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject2(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject4(objValue) || isFunction5(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack["delete"](srcValue); } assignMergeValue(object, key, newValue); } function baseNth(array, n44) { var length = array.length; if (!length) { return; } n44 += n44 < 0 ? length : 0; return isIndex(n44, length) ? array[n44] : undefined2; } function baseOrderBy(collection, iteratees, orders) { if (iteratees.length) { iteratees = arrayMap(iteratees, function(iteratee2) { if (isArray7(iteratee2)) { return function(value) { return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); }; } return iteratee2; }); } else { iteratees = [identity2]; } var index = -1; iteratees = arrayMap(iteratees, baseUnary(getIteratee())); var result2 = baseMap(collection, function(value, key, collection2) { var criteria = arrayMap(iteratees, function(iteratee2) { return iteratee2(value); }); return { "criteria": criteria, "index": ++index, "value": value }; }); return baseSortBy(result2, function(object, other) { return compareMultiple(object, other, orders); }); } function basePick(object, paths) { return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } function basePickBy(object, paths, predicate) { var index = -1, length = paths.length, result2 = {}; while (++index < length) { var path = paths[index], value = baseGet(object, path); if (predicate(value, path)) { baseSet(result2, castPath(path, object), value); } } return result2; } function basePropertyDeep(path) { return function(object) { return baseGet(object, path); }; } function basePullAll(array, values4, iteratee2, comparator) { var indexOf4 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values4.length, seen = array; if (array === values4) { values4 = copyArray(values4); } if (iteratee2) { seen = arrayMap(array, baseUnary(iteratee2)); } while (++index < length) { var fromIndex = 0, value = values4[index], computed2 = iteratee2 ? iteratee2(value) : value; while ((fromIndex = indexOf4(seen, computed2, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } } return array; } function basePullAt(array, indexes) { var length = array ? indexes.length : 0, lastIndex = length - 1; while (length--) { var index = indexes[length]; if (length == lastIndex || index !== previous) { var previous = index; if (isIndex(index)) { splice.call(array, index, 1); } else { baseUnset(array, index); } } } return array; } function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } function baseRange(start, end, step, fromRight) { var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); while (length--) { result2[fromRight ? length : ++index] = start; start += step; } return result2; } function baseRepeat(string, n44) { var result2 = ""; if (!string || n44 < 1 || n44 > MAX_SAFE_INTEGER2) { return result2; } do { if (n44 % 2) { result2 += string; } n44 = nativeFloor(n44 / 2); if (n44) { string += string; } } while (n44); return result2; } function baseRest(func, start) { return setToString(overRest(func, start, identity2), func + ""); } function baseSample(collection) { return arraySample(values3(collection)); } function baseSampleSize(collection, n44) { var array = values3(collection); return shuffleSelf(array, baseClamp(n44, 0, array.length)); } function baseSet(object, path, value, customizer) { if (!isObject4(object)) { return object; } path = castPath(path, object); var index = -1, length = path.length, lastIndex = length - 1, nested = object; while (nested != null && ++index < length) { var key = toKey(path[index]), newValue = value; if (key === "__proto__" || key === "constructor" || key === "prototype") { return object; } if (index != lastIndex) { var objValue = nested[key]; newValue = customizer ? customizer(objValue, key, nested) : undefined2; if (newValue === undefined2) { newValue = isObject4(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; } } assignValue(nested, key, newValue); nested = nested[key]; } return object; } var baseSetData = !metaMap ? identity2 : function(func, data) { metaMap.set(func, data); return func; }; var baseSetToString = !defineProperty ? identity2 : function(func, string) { return defineProperty(func, "toString", { "configurable": true, "enumerable": false, "value": constant(string), "writable": true }); }; function baseShuffle(collection) { return shuffleSelf(values3(collection)); } function baseSlice(array, start, end) { var index = -1, length = array.length; if (start < 0) { start = -start > length ? 0 : length + start; } end = end > length ? length : end; if (end < 0) { end += length; } length = start > end ? 0 : end - start >>> 0; start >>>= 0; var result2 = Array2(length); while (++index < length) { result2[index] = array[index + start]; } return result2; } function baseSome(collection, predicate) { var result2; baseEach(collection, function(value, index, collection2) { result2 = predicate(value, index, collection2); return !result2; }); return !!result2; } function baseSortedIndex(array, value, retHighest) { var low = 0, high = array == null ? low : array.length; if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { while (low < high) { var mid = low + high >>> 1, computed2 = array[mid]; if (computed2 !== null && !isSymbol2(computed2) && (retHighest ? computed2 <= value : computed2 < value)) { low = mid + 1; } else { high = mid; } } return high; } return baseSortedIndexBy(array, value, identity2, retHighest); } function baseSortedIndexBy(array, value, iteratee2, retHighest) { var low = 0, high = array == null ? 0 : array.length; if (high === 0) { return 0; } value = iteratee2(value); var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2; while (low < high) { var mid = nativeFloor((low + high) / 2), computed2 = iteratee2(array[mid]), othIsDefined = computed2 !== undefined2, othIsNull = computed2 === null, othIsReflexive = computed2 === computed2, othIsSymbol = isSymbol2(computed2); if (valIsNaN) { var setLow = retHighest || othIsReflexive; } else if (valIsUndefined) { setLow = othIsReflexive && (retHighest || othIsDefined); } else if (valIsNull) { setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); } else if (valIsSymbol) { setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); } else if (othIsNull || othIsSymbol) { setLow = false; } else { setLow = retHighest ? computed2 <= value : computed2 < value; } if (setLow) { low = mid + 1; } else { high = mid; } } return nativeMin(high, MAX_ARRAY_INDEX); } function baseSortedUniq(array, iteratee2) { var index = -1, length = array.length, resIndex = 0, result2 = []; while (++index < length) { var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; if (!index || !eq2(computed2, seen)) { var seen = computed2; result2[resIndex++] = value === 0 ? 0 : value; } } return result2; } function baseToNumber(value) { if (typeof value == "number") { return value; } if (isSymbol2(value)) { return NAN; } return +value; } function baseToString(value) { if (typeof value == "string") { return value; } if (isArray7(value)) { return arrayMap(value, baseToString) + ""; } if (isSymbol2(value)) { return symbolToString ? symbolToString.call(value) : ""; } var result2 = value + ""; return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2; } function baseUniq(array, iteratee2, comparator) { var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; if (comparator) { isCommon = false; includes2 = arrayIncludesWith; } else if (length >= LARGE_ARRAY_SIZE) { var set3 = iteratee2 ? null : createSet(array); if (set3) { return setToArray(set3); } isCommon = false; includes2 = cacheHas; seen = new SetCache(); } else { seen = iteratee2 ? [] : result2; } outer: while (++index < length) { var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (isCommon && computed2 === computed2) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed2) { continue outer; } } if (iteratee2) { seen.push(computed2); } result2.push(value); } else if (!includes2(seen, computed2, comparator)) { if (seen !== result2) { seen.push(computed2); } result2.push(value); } } return result2; } function baseUnset(object, path) { path = castPath(path, object); object = parent2(object, path); return object == null || delete object[toKey(last5(path))]; } function baseUpdate(object, path, updater, customizer) { return baseSet(object, path, updater(baseGet(object, path)), customizer); } function baseWhile(array, predicate, isDrop, fromRight) { var length = array.length, index = fromRight ? length : -1; while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { } return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); } function baseWrapperValue(value, actions) { var result2 = value; if (result2 instanceof LazyWrapper) { result2 = result2.value(); } return arrayReduce(actions, function(result3, action) { return action.func.apply(action.thisArg, arrayPush([result3], action.args)); }, result2); } function baseXor(arrays, iteratee2, comparator) { var length = arrays.length; if (length < 2) { return length ? baseUniq(arrays[0]) : []; } var index = -1, result2 = Array2(length); while (++index < length) { var array = arrays[index], othIndex = -1; while (++othIndex < length) { if (othIndex != index) { result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator); } } } return baseUniq(baseFlatten(result2, 1), iteratee2, comparator); } function baseZipObject(props, values4, assignFunc) { var index = -1, length = props.length, valsLength = values4.length, result2 = {}; while (++index < length) { var value = index < valsLength ? values4[index] : undefined2; assignFunc(result2, props[index], value); } return result2; } function castArrayLikeObject(value) { return isArrayLikeObject(value) ? value : []; } function castFunction(value) { return typeof value == "function" ? value : identity2; } function castPath(value, object) { if (isArray7(value)) { return value; } return isKey(value, object) ? [value] : stringToPath(toString2(value)); } var castRest = baseRest; function castSlice(array, start, end) { var length = array.length; end = end === undefined2 ? length : end; return !start && end >= length ? array : baseSlice(array, start, end); } var clearTimeout2 = ctxClearTimeout || function(id) { return root.clearTimeout(id); }; function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result2); return result2; } function cloneArrayBuffer(arrayBuffer) { var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); return result2; } function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } function cloneRegExp(regexp) { var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result2.lastIndex = regexp.lastIndex; return result2; } function cloneSymbol(symbol) { return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; } function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } function compareAscending(value, other) { if (value !== other) { var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value); var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other); if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { return 1; } if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { return -1; } } return 0; } function compareMultiple(object, other, orders) { var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; while (++index < length) { var result2 = compareAscending(objCriteria[index], othCriteria[index]); if (result2) { if (index >= ordersLength) { return result2; } var order = orders[index]; return result2 * (order == "desc" ? -1 : 1); } } return object.index - other.index; } function composeArgs(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; while (++leftIndex < leftLength) { result2[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result2[holders[argsIndex]] = args[argsIndex]; } } while (rangeLength--) { result2[leftIndex++] = args[argsIndex++]; } return result2; } function composeArgsRight(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; while (++argsIndex < rangeLength) { result2[argsIndex] = args[argsIndex]; } var offset2 = argsIndex; while (++rightIndex < rightLength) { result2[offset2 + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result2[offset2 + holders[holdersIndex]] = args[argsIndex++]; } } return result2; } function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array2(length)); while (++index < length) { array[index] = source[index]; } return array; } function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2; if (newValue === undefined2) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } function copySymbolsIn(source, object) { return copyObject(source, getSymbolsIn(source), object); } function createAggregator(setter, initializer) { return function(collection, iteratee2) { var func = isArray7(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; return func(collection, setter, getIteratee(iteratee2, 2), accumulator); }; } function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2; customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined2 : customizer; length = 1; } object = Object2(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee2) { if (collection == null) { return collection; } if (!isArrayLike2(collection)) { return eachFunc(collection, iteratee2); } var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); while (fromRight ? index-- : ++index < length) { if (iteratee2(iterable[index], index, iterable) === false) { break; } } return collection; }; } function createBaseFor(fromRight) { return function(object, iteratee2, keysFunc) { var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee2(iterable[key], key, iterable) === false) { break; } } return object; }; } function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var fn = this && this !== root && this instanceof wrapper ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } return wrapper; } function createCaseFirst(methodName) { return function(string) { string = toString2(string); var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2; var chr = strSymbols ? strSymbols[0] : string.charAt(0); var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); return chr[methodName]() + trailing; }; } function createCompounder(callback2) { return function(string) { return arrayReduce(words(deburr(string).replace(reApos, "")), callback2, ""); }; } function createCtor(Ctor) { return function() { var args = arguments; switch (args.length) { case 0: return new Ctor(); case 1: return new Ctor(args[0]); case 2: return new Ctor(args[0], args[1]); case 3: return new Ctor(args[0], args[1], args[2]); case 4: return new Ctor(args[0], args[1], args[2], args[3]); case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); return isObject4(result2) ? result2 : thisBinding; }; } function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper); while (index--) { args[index] = arguments[index]; } var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, undefined2, args, holders, undefined2, undefined2, arity - length ); } var fn = this && this !== root && this instanceof wrapper ? Ctor : func; return apply(fn, this, args); } return wrapper; } function createFind(findIndexFunc) { return function(collection, predicate, fromIndex) { var iterable = Object2(collection); if (!isArrayLike2(collection)) { var iteratee2 = getIteratee(predicate, 3); collection = keys(collection); predicate = function(key) { return iteratee2(iterable[key], key, iterable); }; } var index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2; }; } function createFlow(fromRight) { return flatRest(function(funcs) { var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; if (fromRight) { funcs.reverse(); } while (index--) { var func = funcs[index]; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } if (prereq && !wrapper && getFuncName(func) == "wrapper") { var wrapper = new LodashWrapper([], true); } } index = wrapper ? index : length; while (++index < length) { func = funcs[index]; var funcName = getFuncName(func), data = funcName == "wrapper" ? getData2(func) : undefined2; if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { var args = arguments, value = args[0]; if (wrapper && args.length == 1 && isArray7(value)) { return wrapper.plant(value).value(); } var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; while (++index2 < length) { result2 = funcs[index2].call(this, result2); } return result2; }; }); } function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func); function wrapper() { var length = arguments.length, args = Array2(length), index = length; while (index--) { args[index] = arguments[index]; } if (isCurried) { var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); } if (partials) { args = composeArgs(args, partials, holders, isCurried); } if (partialsRight) { args = composeArgsRight(args, partialsRight, holdersRight, isCurried); } length -= holdersCount; if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary2, arity - length ); } var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; length = args.length; if (argPos) { args = reorder(args, argPos); } else if (isFlip && length > 1) { args.reverse(); } if (isAry && ary2 < length) { args.length = ary2; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); } return wrapper; } function createInverter(setter, toIteratee) { return function(object, iteratee2) { return baseInverter(object, setter, toIteratee(iteratee2), {}); }; } function createMathOperation(operator, defaultValue) { return function(value, other) { var result2; if (value === undefined2 && other === undefined2) { return defaultValue; } if (value !== undefined2) { result2 = value; } if (other !== undefined2) { if (result2 === undefined2) { return other; } if (typeof value == "string" || typeof other == "string") { value = baseToString(value); other = baseToString(other); } else { value = baseToNumber(value); other = baseToNumber(other); } result2 = operator(value, other); } return result2; }; } function createOver(arrayFunc) { return flatRest(function(iteratees) { iteratees = arrayMap(iteratees, baseUnary(getIteratee())); return baseRest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee2) { return apply(iteratee2, thisArg, args); }); }); }); } function createPadding(length, chars2) { chars2 = chars2 === undefined2 ? " " : baseToString(chars2); var charsLength = chars2.length; if (charsLength < 2) { return charsLength ? baseRepeat(chars2, length) : chars2; } var result2 = baseRepeat(chars2, nativeCeil(length / stringSize(chars2))); return hasUnicode(chars2) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); } function createPartial(func, bitmask, thisArg, partials) { var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); function wrapper() { var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; } while (argsLength--) { args[leftIndex++] = arguments[++argsIndex]; } return apply(fn, isBind ? thisArg : this, args); } return wrapper; } function createRange(fromRight) { return function(start, end, step) { if (step && typeof step != "number" && isIterateeCall(start, end, step)) { end = step = undefined2; } start = toFinite(start); if (end === undefined2) { end = start; start = 0; } else { end = toFinite(end); } step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step); return baseRange(start, end, step, fromRight); }; } function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == "string" && typeof other == "string")) { value = toNumber2(value); other = toNumber2(other); } return operator(value, other); }; } function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials; bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG; bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); } var newData = [ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary2, arity ]; var result2 = wrapFunc.apply(undefined2, newData); if (isLaziable(func)) { setData(result2, newData); } result2.placeholder = placeholder; return setWrapToString(result2, func, bitmask); } function createRound(methodName) { var func = Math2[methodName]; return function(number, precision) { number = toNumber2(number); precision = precision == null ? 0 : nativeMin(toInteger2(precision), 292); if (precision && nativeIsFinite(number)) { var pair = (toString2(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); pair = (toString2(value) + "e").split("e"); return +(pair[0] + "e" + (+pair[1] - precision)); } return func(number); }; } var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY2) ? noop5 : function(values4) { return new Set2(values4); }; function createToPairs(keysFunc) { return function(object) { var tag = getTag(object); if (tag == mapTag) { return mapToArray(object); } if (tag == setTag) { return setToPairs(object); } return baseToPairs(object, keysFunc(object)); }; } function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; if (!isBindKey && typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); partials = holders = undefined2; } ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger2(ary2), 0); arity = arity === undefined2 ? arity : toInteger2(arity); length -= holders ? holders.length : 0; if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; partials = holders = undefined2; } var data = isBindKey ? undefined2 : getData2(func); var newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity ]; if (data) { mergeData(newData, data); } func = newData[0]; bitmask = newData[1]; thisArg = newData[2]; partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); } if (!bitmask || bitmask == WRAP_BIND_FLAG) { var result2 = createBind(func, bitmask, thisArg); } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { result2 = createCurry(func, bitmask, arity); } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { result2 = createPartial(func, bitmask, thisArg, partials); } else { result2 = createHybrid.apply(undefined2, newData); } var setter = data ? baseSetData : setData; return setWrapToString(setter(result2, newData), func, bitmask); } function customDefaultsAssignIn(objValue, srcValue, key, object) { if (objValue === undefined2 || eq2(objValue, objectProto2[key]) && !hasOwnProperty.call(object, key)) { return srcValue; } return objValue; } function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { if (isObject4(objValue) && isObject4(srcValue)) { stack.set(srcValue, objValue); baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack); stack["delete"](srcValue); } return objValue; } function customOmitClone(value) { return isPlainObject2(value) ? undefined2 : value; } function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } var arrStacked = stack.get(array); var othStacked = stack.get(other); if (arrStacked && othStacked) { return arrStacked == other && othStacked == array; } var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2; stack.set(array, other); stack.set(other, array); while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined2) { if (compared) { continue; } result2 = false; break; } if (seen) { if (!arraySome(other, function(othValue2, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result2 = false; break; } } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { result2 = false; break; } } stack["delete"](array); stack["delete"](other); return result2; } function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: return eq2(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: return object == other + ""; case mapTag: var convert2 = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert2 || (convert2 = setToArray); if (object.size != other.size && !isPartial) { return false; } var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; stack.set(object, other); var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack); stack["delete"](object); return result2; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } var objStacked = stack.get(object); var othStacked = stack.get(other); if (objStacked && othStacked) { return objStacked == other && othStacked == object; } var result2 = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { result2 = false; break; } skipCtor || (skipCtor = key == "constructor"); } if (result2 && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { result2 = false; } } stack["delete"](object); stack["delete"](other); return result2; } function flatRest(func) { return setToString(overRest(func, undefined2, flatten3), func + ""); } function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } function getAllKeysIn(object) { return baseGetAllKeys(object, keysIn, getSymbolsIn); } var getData2 = !metaMap ? noop5 : function(func) { return metaMap.get(func); }; function getFuncName(func) { var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result2; } function getHolder(func) { var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func; return object.placeholder; } function getIteratee() { var result2 = lodash.iteratee || iteratee; result2 = result2 === iteratee ? baseIteratee : result2; return arguments.length ? result2(arguments[0], arguments[1]) : result2; } function getMapData(map5, key) { var data = map5.__data__; return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; } function getMatchData(object) { var result2 = keys(object), length = result2.length; while (length--) { var key = result2[length], value = object[key]; result2[length] = [key, value, isStrictComparable(value)]; } return result2; } function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined2; } function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined2; var unmasked = true; } catch (e56) { } var result2 = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result2; } var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object2(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result2 = []; while (object) { arrayPush(result2, getSymbols(object)); object = getPrototype(object); } return result2; }; var getTag = baseGetTag; if (DataView2 && getTag(new DataView2(new ArrayBuffer(1))) != dataViewTag || Map3 && getTag(new Map3()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) { getTag = function(value) { var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : ""; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result2; }; } function getView(start, end, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data = transforms[index], size2 = data.size; switch (data.type) { case "drop": start += size2; break; case "dropRight": end -= size2; break; case "take": end = nativeMin(end, start + size2); break; case "takeRight": start = nativeMax(start, end - size2); break; } } return { "start": start, "end": end }; } function getWrapDetails(source) { var match3 = source.match(reWrapDetails); return match3 ? match3[1].split(reSplitDetails) : []; } function hasPath(object, path, hasFunc) { path = castPath(path, object); var index = -1, length = path.length, result2 = false; while (++index < length) { var key = toKey(path[index]); if (!(result2 = object != null && hasFunc(object, key))) { break; } object = object[key]; } if (result2 || ++index != length) { return result2; } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && (isArray7(object) || isArguments(object)); } function initCloneArray(array) { var length = array.length, result2 = new array.constructor(length); if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) { result2.index = array.index; result2.input = array.input; } return result2; } function initCloneObject(object) { return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; } function initCloneByTag(object, tag, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return new Ctor(); case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return new Ctor(); case symbolTag: return cloneSymbol(object); } } function insertWrapDetails(source, details) { var length = details.length; if (!length) { return source; } var lastIndex = length - 1; details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; details = details.join(length > 2 ? ", " : " "); return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); } function isFlattenable(value) { return isArray7(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); } function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER2 : length; return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } function isIterateeCall(value, index, object) { if (!isObject4(object)) { return false; } var type = typeof index; if (type == "number" ? isArrayLike2(object) && isIndex(index, object.length) : type == "string" && index in object) { return eq2(object[index], value); } return false; } function isKey(value, object) { if (isArray7(value)) { return false; } var type = typeof value; if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol2(value)) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); } function isKeyable(value) { var type = typeof value; return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; } function isLaziable(func) { var funcName = getFuncName(func), other = lodash[funcName]; if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { return false; } if (func === other) { return true; } var data = getData2(other); return !!data && func === data[0]; } function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } var isMaskable = coreJsData ? isFunction5 : stubFalse; function isPrototype(value) { var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto2; return value === proto; } function isStrictComparable(value) { return value === value && !isObject4(value); } function matchesStrictComparable(key, srcValue) { return function(object) { if (object == null) { return false; } return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); }; } function memoizeCapped(func) { var result2 = memoize(func, function(key) { if (cache2.size === MAX_MEMOIZE_SIZE) { cache2.clear(); } return key; }); var cache2 = result2.cache; return result2; } function mergeData(data, source) { var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; if (!(isCommon || isCombo)) { return data; } if (srcBitmask & WRAP_BIND_FLAG) { data[2] = source[2]; newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; } var value = source[3]; if (value) { var partials = data[3]; data[3] = partials ? composeArgs(partials, value, source[4]) : value; data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; } value = source[5]; if (value) { partials = data[5]; data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; } value = source[7]; if (value) { data[7] = value; } if (srcBitmask & WRAP_ARY_FLAG) { data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); } if (data[9] == null) { data[9] = source[9]; } data[0] = source[0]; data[1] = newBitmask; return data; } function nativeKeysIn(object) { var result2 = []; if (object != null) { for (var key in Object2(object)) { result2.push(key); } } return result2; } function objectToString(value) { return nativeObjectToString.call(value); } function overRest(func, start, transform2) { start = nativeMax(start === undefined2 ? func.length - 1 : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array2(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform2(array); return apply(func, this, otherArgs); }; } function parent2(object, path) { return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); } function reorder(array, indexes) { var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2; } return array; } function safeGet2(object, key) { if (key === "constructor" && typeof object[key] === "function") { return; } if (key == "__proto__") { return; } return object[key]; } var setData = shortOut(baseSetData); var setTimeout2 = ctxSetTimeout || function(func, wait) { return root.setTimeout(func, wait); }; var setToString = shortOut(baseSetToString); function setWrapToString(wrapper, reference, bitmask) { var source = reference + ""; return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); } function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined2, arguments); }; } function shuffleSelf(array, size2) { var index = -1, length = array.length, lastIndex = length - 1; size2 = size2 === undefined2 ? length : size2; while (++index < size2) { var rand = baseRandom(index, lastIndex), value = array[rand]; array[rand] = array[index]; array[index] = value; } array.length = size2; return array; } var stringToPath = memoizeCapped(function(string) { var result2 = []; if (string.charCodeAt(0) === 46) { result2.push(""); } string.replace(rePropName, function(match3, number, quote, subString) { result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match3); }); return result2; }); function toKey(value) { if (typeof value == "string" || isSymbol2(value)) { return value; } var result2 = value + ""; return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2; } function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e56) { } try { return func + ""; } catch (e56) { } } return ""; } function updateWrapDetails(details, bitmask) { arrayEach(wrapFlags, function(pair) { var value = "_." + pair[0]; if (bitmask & pair[1] && !arrayIncludes(details, value)) { details.push(value); } }); return details.sort(); } function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result2.__actions__ = copyArray(wrapper.__actions__); result2.__index__ = wrapper.__index__; result2.__values__ = wrapper.__values__; return result2; } function chunk(array, size2, guard) { if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) { size2 = 1; } else { size2 = nativeMax(toInteger2(size2), 0); } var length = array == null ? 0 : array.length; if (!length || size2 < 1) { return []; } var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2)); while (index < length) { result2[resIndex++] = baseSlice(array, index, index += size2); } return result2; } function compact2(array) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; while (++index < length) { var value = array[index]; if (value) { result2[resIndex++] = value; } } return result2; } function concat3() { var length = arguments.length; if (!length) { return []; } var args = Array2(length - 1), array = arguments[0], index = length; while (index--) { args[index - 1] = arguments[index]; } return arrayPush(isArray7(array) ? copyArray(array) : [array], baseFlatten(args, 1)); } var difference = baseRest(function(array, values4) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values4, 1, isArrayLikeObject, true)) : []; }); var differenceBy = baseRest(function(array, values4) { var iteratee2 = last5(values4); if (isArrayLikeObject(iteratee2)) { iteratee2 = undefined2; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values4, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; }); var differenceWith = baseRest(function(array, values4) { var comparator = last5(values4); if (isArrayLikeObject(comparator)) { comparator = undefined2; } return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values4, 1, isArrayLikeObject, true), undefined2, comparator) : []; }); function drop2(array, n44, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n44 = guard || n44 === undefined2 ? 1 : toInteger2(n44); return baseSlice(array, n44 < 0 ? 0 : n44, length); } function dropRight(array, n44, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n44 = guard || n44 === undefined2 ? 1 : toInteger2(n44); n44 = length - n44; return baseSlice(array, 0, n44 < 0 ? 0 : n44); } function dropRightWhile(array, predicate) { return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } function dropWhile(array, predicate) { return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; } function fill2(array, value, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (start && typeof start != "number" && isIterateeCall(array, value, start)) { start = 0; end = length; } return baseFill(array, value, start, end); } function findIndex2(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger2(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseFindIndex(array, getIteratee(predicate, 3), index); } function findLastIndex(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length - 1; if (fromIndex !== undefined2) { index = toInteger2(fromIndex); index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return baseFindIndex(array, getIteratee(predicate, 3), index, true); } function flatten3(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, 1) : []; } function flattenDeep(array) { var length = array == null ? 0 : array.length; return length ? baseFlatten(array, INFINITY2) : []; } function flattenDepth(array, depth) { var length = array == null ? 0 : array.length; if (!length) { return []; } depth = depth === undefined2 ? 1 : toInteger2(depth); return baseFlatten(array, depth); } function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; while (++index < length) { var pair = pairs[index]; result2[pair[0]] = pair[1]; } return result2; } function head(array) { return array && array.length ? array[0] : undefined2; } function indexOf3(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger2(fromIndex); if (index < 0) { index = nativeMax(length + index, 0); } return baseIndexOf(array, value, index); } function initial(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 0, -1) : []; } var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; }); var intersectionBy = baseRest(function(arrays) { var iteratee2 = last5(arrays), mapped = arrayMap(arrays, castArrayLikeObject); if (iteratee2 === last5(mapped)) { iteratee2 = undefined2; } else { mapped.pop(); } return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; }); var intersectionWith = baseRest(function(arrays) { var comparator = last5(arrays), mapped = arrayMap(arrays, castArrayLikeObject); comparator = typeof comparator == "function" ? comparator : undefined2; if (comparator) { mapped.pop(); } return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : []; }); function join(array, separator) { return array == null ? "" : nativeJoin.call(array, separator); } function last5(array) { var length = array == null ? 0 : array.length; return length ? array[length - 1] : undefined2; } function lastIndexOf2(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = length; if (fromIndex !== undefined2) { index = toInteger2(fromIndex); index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); } return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); } function nth(array, n44) { return array && array.length ? baseNth(array, toInteger2(n44)) : undefined2; } var pull = baseRest(pullAll); function pullAll(array, values4) { return array && array.length && values4 && values4.length ? basePullAll(array, values4) : array; } function pullAllBy(array, values4, iteratee2) { return array && array.length && values4 && values4.length ? basePullAll(array, values4, getIteratee(iteratee2, 2)) : array; } function pullAllWith(array, values4, comparator) { return array && array.length && values4 && values4.length ? basePullAll(array, values4, undefined2, comparator) : array; } var pullAt = flatRest(function(array, indexes) { var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); basePullAt(array, arrayMap(indexes, function(index) { return isIndex(index, length) ? +index : index; }).sort(compareAscending)); return result2; }); function remove2(array, predicate) { var result2 = []; if (!(array && array.length)) { return result2; } var index = -1, indexes = [], length = array.length; predicate = getIteratee(predicate, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result2.push(value); indexes.push(index); } } basePullAt(array, indexes); return result2; } function reverse(array) { return array == null ? array : nativeReverse.call(array); } function slice(array, start, end) { var length = array == null ? 0 : array.length; if (!length) { return []; } if (end && typeof end != "number" && isIterateeCall(array, start, end)) { start = 0; end = length; } else { start = start == null ? 0 : toInteger2(start); end = end === undefined2 ? length : toInteger2(end); } return baseSlice(array, start, end); } function sortedIndex(array, value) { return baseSortedIndex(array, value); } function sortedIndexBy(array, value, iteratee2) { return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); } function sortedIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value); if (index < length && eq2(array[index], value)) { return index; } } return -1; } function sortedLastIndex(array, value) { return baseSortedIndex(array, value, true); } function sortedLastIndexBy(array, value, iteratee2) { return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); } function sortedLastIndexOf(array, value) { var length = array == null ? 0 : array.length; if (length) { var index = baseSortedIndex(array, value, true) - 1; if (eq2(array[index], value)) { return index; } } return -1; } function sortedUniq(array) { return array && array.length ? baseSortedUniq(array) : []; } function sortedUniqBy(array, iteratee2) { return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; } function tail(array) { var length = array == null ? 0 : array.length; return length ? baseSlice(array, 1, length) : []; } function take3(array, n44, guard) { if (!(array && array.length)) { return []; } n44 = guard || n44 === undefined2 ? 1 : toInteger2(n44); return baseSlice(array, 0, n44 < 0 ? 0 : n44); } function takeRight(array, n44, guard) { var length = array == null ? 0 : array.length; if (!length) { return []; } n44 = guard || n44 === undefined2 ? 1 : toInteger2(n44); n44 = length - n44; return baseSlice(array, n44 < 0 ? 0 : n44, length); } function takeRightWhile(array, predicate) { return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; } function takeWhile2(array, predicate) { return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; } var union = baseRest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); var unionBy = baseRest(function(arrays) { var iteratee2 = last5(arrays); if (isArrayLikeObject(iteratee2)) { iteratee2 = undefined2; } return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); }); var unionWith = baseRest(function(arrays) { var comparator = last5(arrays); comparator = typeof comparator == "function" ? comparator : undefined2; return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator); }); function uniq(array) { return array && array.length ? baseUniq(array) : []; } function uniqBy(array, iteratee2) { return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; } function uniqWith(array, comparator) { comparator = typeof comparator == "function" ? comparator : undefined2; return array && array.length ? baseUniq(array, undefined2, comparator) : []; } function unzip(array) { if (!(array && array.length)) { return []; } var length = 0; array = arrayFilter(array, function(group2) { if (isArrayLikeObject(group2)) { length = nativeMax(group2.length, length); return true; } }); return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } function unzipWith(array, iteratee2) { if (!(array && array.length)) { return []; } var result2 = unzip(array); if (iteratee2 == null) { return result2; } return arrayMap(result2, function(group2) { return apply(iteratee2, undefined2, group2); }); } var without = baseRest(function(array, values4) { return isArrayLikeObject(array) ? baseDifference(array, values4) : []; }); var xor = baseRest(function(arrays) { return baseXor(arrayFilter(arrays, isArrayLikeObject)); }); var xorBy = baseRest(function(arrays) { var iteratee2 = last5(arrays); if (isArrayLikeObject(iteratee2)) { iteratee2 = undefined2; } return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); }); var xorWith = baseRest(function(arrays) { var comparator = last5(arrays); comparator = typeof comparator == "function" ? comparator : undefined2; return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator); }); var zip = baseRest(unzip); function zipObject(props, values4) { return baseZipObject(props || [], values4 || [], assignValue); } function zipObjectDeep(props, values4) { return baseZipObject(props || [], values4 || [], baseSet); } var zipWith = baseRest(function(arrays) { var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2; iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2; return unzipWith(arrays, iteratee2); }); function chain(value) { var result2 = lodash(value); result2.__chain__ = true; return result2; } function tap2(value, interceptor) { interceptor(value); return value; } function thru(value, interceptor) { return interceptor(value); } var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { return this.thru(interceptor); } value = value.slice(start, +start + (length ? 1 : 0)); value.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined2); } return array; }); }); function wrapperChain() { return chain(this); } function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } function wrapperNext() { if (this.__values__ === undefined2) { this.__values__ = toArray2(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; return { "done": done, "value": value }; } function wrapperToIterator() { return this; } function wrapperPlant(value) { var result2, parent3 = this; while (parent3 instanceof baseLodash) { var clone4 = wrapperClone(parent3); clone4.__index__ = 0; clone4.__values__ = undefined2; if (result2) { previous.__wrapped__ = clone4; } else { result2 = clone4; } var previous = clone4; parent3 = parent3.__wrapped__; } previous.__wrapped__ = value; return result2; } function wrapperReverse() { var value = this.__wrapped__; if (value instanceof LazyWrapper) { var wrapped = value; if (this.__actions__.length) { wrapped = new LazyWrapper(this); } wrapped = wrapped.reverse(); wrapped.__actions__.push({ "func": thru, "args": [reverse], "thisArg": undefined2 }); return new LodashWrapper(wrapped, this.__chain__); } return this.thru(reverse); } function wrapperValue() { return baseWrapperValue(this.__wrapped__, this.__actions__); } var countBy = createAggregator(function(result2, value, key) { if (hasOwnProperty.call(result2, key)) { ++result2[key]; } else { baseAssignValue(result2, key, 1); } }); function every(collection, predicate, guard) { var func = isArray7(collection) ? arrayEvery : baseEvery; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined2; } return func(collection, getIteratee(predicate, 3)); } function filter3(collection, predicate) { var func = isArray7(collection) ? arrayFilter : baseFilter; return func(collection, getIteratee(predicate, 3)); } var find = createFind(findIndex2); var findLast = createFind(findLastIndex); function flatMap(collection, iteratee2) { return baseFlatten(map4(collection, iteratee2), 1); } function flatMapDeep(collection, iteratee2) { return baseFlatten(map4(collection, iteratee2), INFINITY2); } function flatMapDepth(collection, iteratee2, depth) { depth = depth === undefined2 ? 1 : toInteger2(depth); return baseFlatten(map4(collection, iteratee2), depth); } function forEach(collection, iteratee2) { var func = isArray7(collection) ? arrayEach : baseEach; return func(collection, getIteratee(iteratee2, 3)); } function forEachRight(collection, iteratee2) { var func = isArray7(collection) ? arrayEachRight : baseEachRight; return func(collection, getIteratee(iteratee2, 3)); } var groupBy2 = createAggregator(function(result2, value, key) { if (hasOwnProperty.call(result2, key)) { result2[key].push(value); } else { baseAssignValue(result2, key, [value]); } }); function includes(collection, value, fromIndex, guard) { collection = isArrayLike2(collection) ? collection : values3(collection); fromIndex = fromIndex && !guard ? toInteger2(fromIndex) : 0; var length = collection.length; if (fromIndex < 0) { fromIndex = nativeMax(length + fromIndex, 0); } return isString3(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; } var invokeMap = baseRest(function(collection, path, args) { var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : []; baseEach(collection, function(value) { result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); }); return result2; }); var keyBy = createAggregator(function(result2, value, key) { baseAssignValue(result2, key, value); }); function map4(collection, iteratee2) { var func = isArray7(collection) ? arrayMap : baseMap; return func(collection, getIteratee(iteratee2, 3)); } function orderBy(collection, iteratees, orders, guard) { if (collection == null) { return []; } if (!isArray7(iteratees)) { iteratees = iteratees == null ? [] : [iteratees]; } orders = guard ? undefined2 : orders; if (!isArray7(orders)) { orders = orders == null ? [] : [orders]; } return baseOrderBy(collection, iteratees, orders); } var partition = createAggregator(function(result2, value, key) { result2[key ? 0 : 1].push(value); }, function() { return [[], []]; }); function reduce2(collection, iteratee2, accumulator) { var func = isArray7(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); } function reduceRight(collection, iteratee2, accumulator) { var func = isArray7(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); } function reject(collection, predicate) { var func = isArray7(collection) ? arrayFilter : baseFilter; return func(collection, negate3(getIteratee(predicate, 3))); } function sample2(collection) { var func = isArray7(collection) ? arraySample : baseSample; return func(collection); } function sampleSize(collection, n44, guard) { if (guard ? isIterateeCall(collection, n44, guard) : n44 === undefined2) { n44 = 1; } else { n44 = toInteger2(n44); } var func = isArray7(collection) ? arraySampleSize : baseSampleSize; return func(collection, n44); } function shuffle(collection) { var func = isArray7(collection) ? arrayShuffle : baseShuffle; return func(collection); } function size(collection) { if (collection == null) { return 0; } if (isArrayLike2(collection)) { return isString3(collection) ? stringSize(collection) : collection.length; } var tag = getTag(collection); if (tag == mapTag || tag == setTag) { return collection.size; } return baseKeys(collection).length; } function some(collection, predicate, guard) { var func = isArray7(collection) ? arraySome : baseSome; if (guard && isIterateeCall(collection, predicate, guard)) { predicate = undefined2; } return func(collection, getIteratee(predicate, 3)); } var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { return []; } var length = iteratees.length; if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { iteratees = []; } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); var now = ctxNow || function() { return root.Date.now(); }; function after(n44, func) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } n44 = toInteger2(n44); return function() { if (--n44 < 1) { return func.apply(this, arguments); } }; } function ary(func, n44, guard) { n44 = guard ? undefined2 : n44; n44 = func && n44 == null ? func.length : n44; return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n44); } function before(n44, func) { var result2; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } n44 = toInteger2(n44); return function() { if (--n44 > 0) { result2 = func.apply(this, arguments); } if (n44 <= 1) { func = undefined2; } return result2; }; } var bind2 = baseRest(function(func, thisArg, partials) { var bitmask = WRAP_BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind2)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(func, bitmask, thisArg, partials, holders); }); var bindKey = baseRest(function(object, key, partials) { var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bindKey)); bitmask |= WRAP_PARTIAL_FLAG; } return createWrap(key, bitmask, object, partials, holders); }); function curry(func, arity, guard) { arity = guard ? undefined2 : arity; var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); result2.placeholder = curry.placeholder; return result2; } function curryRight(func, arity, guard) { arity = guard ? undefined2 : arity; var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity); result2.placeholder = curryRight.placeholder; return result2; } function debounce2(func, wait, options) { var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } wait = toNumber2(wait) || 0; if (isObject4(options)) { leading = !!options.leading; maxing = "maxWait" in options; maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait; trailing = "trailing" in options ? !!options.trailing : trailing; } function invokeFunc(time2) { var args = lastArgs, thisArg = lastThis; lastArgs = lastThis = undefined2; lastInvokeTime = time2; result2 = func.apply(thisArg, args); return result2; } function leadingEdge(time2) { lastInvokeTime = time2; timerId = setTimeout2(timerExpired, wait); return leading ? invokeFunc(time2) : result2; } function remainingWait(time2) { var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; } function shouldInvoke(time2) { var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime; return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { var time2 = now(); if (shouldInvoke(time2)) { return trailingEdge(time2); } timerId = setTimeout2(timerExpired, remainingWait(time2)); } function trailingEdge(time2) { timerId = undefined2; if (trailing && lastArgs) { return invokeFunc(time2); } lastArgs = lastThis = undefined2; return result2; } function cancel() { if (timerId !== undefined2) { clearTimeout2(timerId); } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined2; } function flush() { return timerId === undefined2 ? result2 : trailingEdge(now()); } function debounced() { var time2 = now(), isInvoking = shouldInvoke(time2); lastArgs = arguments; lastThis = this; lastCallTime = time2; if (isInvoking) { if (timerId === undefined2) { return leadingEdge(lastCallTime); } if (maxing) { clearTimeout2(timerId); timerId = setTimeout2(timerExpired, wait); return invokeFunc(lastCallTime); } } if (timerId === undefined2) { timerId = setTimeout2(timerExpired, wait); } return result2; } debounced.cancel = cancel; debounced.flush = flush; return debounced; } var defer2 = baseRest(function(func, args) { return baseDelay(func, 1, args); }); var delay3 = baseRest(function(func, wait, args) { return baseDelay(func, toNumber2(wait) || 0, args); }); function flip(func) { return createWrap(func, WRAP_FLIP_FLAG); } function memoize(func, resolver) { if (typeof func != "function" || resolver != null && typeof resolver != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; if (cache2.has(key)) { return cache2.get(key); } var result2 = func.apply(this, args); memoized.cache = cache2.set(key, result2) || cache2; return result2; }; memoized.cache = new (memoize.Cache || MapCache)(); return memoized; } memoize.Cache = MapCache; function negate3(predicate) { if (typeof predicate != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } return function() { var args = arguments; switch (args.length) { case 0: return !predicate.call(this); case 1: return !predicate.call(this, args[0]); case 2: return !predicate.call(this, args[0], args[1]); case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; } function once(func) { return before(2, func); } var overArgs = castRest(function(func, transforms) { transforms = transforms.length == 1 && isArray7(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); var funcsLength = transforms.length; return baseRest(function(args) { var index = -1, length = nativeMin(args.length, funcsLength); while (++index < length) { args[index] = transforms[index].call(this, args[index]); } return apply(func, this, args); }); }); var partial = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partial)); return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders); }); var partialRight = baseRest(function(func, partials) { var holders = replaceHolders(partials, getHolder(partialRight)); return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); }); var rearg = flatRest(function(func, indexes) { return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); }); function rest(func, start) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } start = start === undefined2 ? start : toInteger2(start); return baseRest(func, start); } function spread(func, start) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } start = start == null ? 0 : nativeMax(toInteger2(start), 0); return baseRest(function(args) { var array = args[start], otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); } function throttle(func, wait, options) { var leading = true, trailing = true; if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } if (isObject4(options)) { leading = "leading" in options ? !!options.leading : leading; trailing = "trailing" in options ? !!options.trailing : trailing; } return debounce2(func, wait, { "leading": leading, "maxWait": wait, "trailing": trailing }); } function unary(func) { return ary(func, 1); } function wrap(value, wrapper) { return partial(castFunction(wrapper), value); } function castArray() { if (!arguments.length) { return []; } var value = arguments[0]; return isArray7(value) ? value : [value]; } function clone3(value) { return baseClone(value, CLONE_SYMBOLS_FLAG); } function cloneWith(value, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); } function cloneDeep(value) { return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); } function cloneDeepWith(value, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); } function conformsTo(object, source) { return source == null || baseConformsTo(object, source, keys(source)); } function eq2(value, other) { return value === other || value !== value && other !== other; } var gt2 = createRelationalOperation(baseGt); var gte = createRelationalOperation(function(value, other) { return value >= other; }); var isArguments = baseIsArguments(/* @__PURE__ */ (function() { return arguments; })()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); }; var isArray7 = Array2.isArray; var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; function isArrayLike2(value) { return value != null && isLength(value.length) && !isFunction5(value); } function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike2(value); } function isBoolean3(value) { return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; } var isBuffer = nativeIsBuffer || stubFalse; var isDate4 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; function isElement(value) { return isObjectLike(value) && value.nodeType === 1 && !isPlainObject2(value); } function isEmpty2(value) { if (value == null) { return true; } if (isArrayLike2(value) && (isArray7(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); if (tag == mapTag || tag == setTag) { return !value.size; } if (isPrototype(value)) { return !baseKeys(value).length; } for (var key in value) { if (hasOwnProperty.call(value, key)) { return false; } } return true; } function isEqual(value, other) { return baseIsEqual(value, other); } function isEqualWith(value, other, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; var result2 = customizer ? customizer(value, other) : undefined2; return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2; } function isError2(value) { if (!isObjectLike(value)) { return false; } var tag = baseGetTag(value); return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value); } function isFinite2(value) { return typeof value == "number" && nativeIsFinite(value); } function isFunction5(value) { if (!isObject4(value)) { return false; } var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } function isInteger(value) { return typeof value == "number" && value == toInteger2(value); } function isLength(value) { return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2; } function isObject4(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } function isObjectLike(value) { return value != null && typeof value == "object"; } var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; function isMatch(object, source) { return object === source || baseIsMatch(object, source, getMatchData(source)); } function isMatchWith(object, source, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; return baseIsMatch(object, source, getMatchData(source), customizer); } function isNaN2(value) { return isNumber5(value) && value != +value; } function isNative(value) { if (isMaskable(value)) { throw new Error2(CORE_ERROR_TEXT); } return baseIsNative(value); } function isNull(value) { return value === null; } function isNil(value) { return value == null; } function isNumber5(value) { return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; } function isPlainObject2(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor; return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; function isSafeInteger(value) { return isInteger(value) && value >= -MAX_SAFE_INTEGER2 && value <= MAX_SAFE_INTEGER2; } var isSet2 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; function isString3(value) { return typeof value == "string" || !isArray7(value) && isObjectLike(value) && baseGetTag(value) == stringTag; } function isSymbol2(value) { return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; } var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; function isUndefined2(value) { return value === undefined2; } function isWeakMap(value) { return isObjectLike(value) && getTag(value) == weakMapTag; } function isWeakSet(value) { return isObjectLike(value) && baseGetTag(value) == weakSetTag; } var lt = createRelationalOperation(baseLt); var lte = createRelationalOperation(function(value, other) { return value <= other; }); function toArray2(value) { if (!value) { return []; } if (isArrayLike2(value)) { return isString3(value) ? stringToArray(value) : copyArray(value); } if (symIterator && value[symIterator]) { return iteratorToArray(value[symIterator]()); } var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values3; return func(value); } function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber2(value); if (value === INFINITY2 || value === -INFINITY2) { var sign3 = value < 0 ? -1 : 1; return sign3 * MAX_INTEGER; } return value === value ? value : 0; } function toInteger2(value) { var result2 = toFinite(value), remainder = result2 % 1; return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; } function toLength(value) { return value ? baseClamp(toInteger2(value), 0, MAX_ARRAY_LENGTH) : 0; } function toNumber2(value) { if (typeof value == "number") { return value; } if (isSymbol2(value)) { return NAN; } if (isObject4(value)) { var other = typeof value.valueOf == "function" ? value.valueOf() : value; value = isObject4(other) ? other + "" : other; } if (typeof value != "string") { return value === 0 ? value : +value; } value = baseTrim(value); var isBinary = reIsBinary.test(value); return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; } function toPlainObject(value) { return copyObject(value, keysIn(value)); } function toSafeInteger(value) { return value ? baseClamp(toInteger2(value), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value === 0 ? value : 0; } function toString2(value) { return value == null ? "" : baseToString(value); } var assign = createAssigner(function(object, source) { if (isPrototype(source) || isArrayLike2(source)) { copyObject(source, keys(source), object); return; } for (var key in source) { if (hasOwnProperty.call(source, key)) { assignValue(object, key, source[key]); } } }); var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keysIn(source), object, customizer); }); var assignWith = createAssigner(function(object, source, srcIndex, customizer) { copyObject(source, keys(source), object, customizer); }); var at2 = flatRest(baseAt); function create(prototype, properties) { var result2 = baseCreate(prototype); return properties == null ? result2 : baseAssign(result2, properties); } var defaults4 = baseRest(function(object, sources) { object = Object2(object); var index = -1; var length = sources.length; var guard = length > 2 ? sources[2] : undefined2; if (guard && isIterateeCall(sources[0], sources[1], guard)) { length = 1; } while (++index < length) { var source = sources[index]; var props = keysIn(source); var propsIndex = -1; var propsLength = props.length; while (++propsIndex < propsLength) { var key = props[propsIndex]; var value = object[key]; if (value === undefined2 || eq2(value, objectProto2[key]) && !hasOwnProperty.call(object, key)) { object[key] = source[key]; } } } return object; }); var defaultsDeep = baseRest(function(args) { args.push(undefined2, customDefaultsMerge); return apply(mergeWith, undefined2, args); }); function findKey3(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); } function findLastKey(object, predicate) { return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); } function forIn(object, iteratee2) { return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); } function forInRight(object, iteratee2) { return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); } function forOwn(object, iteratee2) { return object && baseForOwn(object, getIteratee(iteratee2, 3)); } function forOwnRight(object, iteratee2) { return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); } function functions(object) { return object == null ? [] : baseFunctions(object, keys(object)); } function functionsIn(object) { return object == null ? [] : baseFunctions(object, keysIn(object)); } function get(object, path, defaultValue) { var result2 = object == null ? undefined2 : baseGet(object, path); return result2 === undefined2 ? defaultValue : result2; } function has(object, path) { return object != null && hasPath(object, path, baseHas); } function hasIn(object, path) { return object != null && hasPath(object, path, baseHasIn); } var invert = createInverter(function(result2, value, key) { if (value != null && typeof value.toString != "function") { value = nativeObjectToString.call(value); } result2[value] = key; }, constant(identity2)); var invertBy = createInverter(function(result2, value, key) { if (value != null && typeof value.toString != "function") { value = nativeObjectToString.call(value); } if (hasOwnProperty.call(result2, value)) { result2[value].push(key); } else { result2[value] = [key]; } }, getIteratee); var invoke2 = baseRest(baseInvoke); function keys(object) { return isArrayLike2(object) ? arrayLikeKeys(object) : baseKeys(object); } function keysIn(object) { return isArrayLike2(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } function mapKeys(object, iteratee2) { var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); baseForOwn(object, function(value, key, object2) { baseAssignValue(result2, iteratee2(value, key, object2), value); }); return result2; } function mapValues(object, iteratee2) { var result2 = {}; iteratee2 = getIteratee(iteratee2, 3); baseForOwn(object, function(value, key, object2) { baseAssignValue(result2, key, iteratee2(value, key, object2)); }); return result2; } var merge4 = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); var omit = flatRest(function(object, paths) { var result2 = {}; if (object == null) { return result2; } var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); isDeep || (isDeep = path.length > 1); return path; }); copyObject(object, getAllKeysIn(object), result2); if (isDeep) { result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); } var length = paths.length; while (length--) { baseUnset(result2, paths[length]); } return result2; }); function omitBy(object, predicate) { return pickBy(object, negate3(getIteratee(predicate))); } var pick = flatRest(function(object, paths) { return object == null ? {} : basePick(object, paths); }); function pickBy(object, predicate) { if (object == null) { return {}; } var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = getIteratee(predicate); return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } function result(object, path, defaultValue) { path = castPath(path, object); var index = -1, length = path.length; if (!length) { length = 1; object = undefined2; } while (++index < length) { var value = object == null ? undefined2 : object[toKey(path[index])]; if (value === undefined2) { index = length; value = defaultValue; } object = isFunction5(value) ? value.call(object) : value; } return object; } function set2(object, path, value) { return object == null ? object : baseSet(object, path, value); } function setWith(object, path, value, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; return object == null ? object : baseSet(object, path, value, customizer); } var toPairs = createToPairs(keys); var toPairsIn = createToPairs(keysIn); function transform(object, iteratee2, accumulator) { var isArr = isArray7(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); iteratee2 = getIteratee(iteratee2, 4); if (accumulator == null) { var Ctor = object && object.constructor; if (isArrLike) { accumulator = isArr ? new Ctor() : []; } else if (isObject4(object)) { accumulator = isFunction5(Ctor) ? baseCreate(getPrototype(object)) : {}; } else { accumulator = {}; } } (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { return iteratee2(accumulator, value, index, object2); }); return accumulator; } function unset(object, path) { return object == null ? true : baseUnset(object, path); } function update(object, path, updater) { return object == null ? object : baseUpdate(object, path, castFunction(updater)); } function updateWith(object, path, updater, customizer) { customizer = typeof customizer == "function" ? customizer : undefined2; return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); } function values3(object) { return object == null ? [] : baseValues(object, keys(object)); } function valuesIn(object) { return object == null ? [] : baseValues(object, keysIn(object)); } function clamp3(number, lower, upper) { if (upper === undefined2) { upper = lower; lower = undefined2; } if (upper !== undefined2) { upper = toNumber2(upper); upper = upper === upper ? upper : 0; } if (lower !== undefined2) { lower = toNumber2(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber2(number), lower, upper); } function inRange2(number, start, end) { start = toFinite(start); if (end === undefined2) { end = start; start = 0; } else { end = toFinite(end); } number = toNumber2(number); return baseInRange(number, start, end); } function random(lower, upper, floating) { if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { upper = floating = undefined2; } if (floating === undefined2) { if (typeof upper == "boolean") { floating = upper; upper = undefined2; } else if (typeof lower == "boolean") { floating = lower; lower = undefined2; } } if (lower === undefined2 && upper === undefined2) { lower = 0; upper = 1; } else { lower = toFinite(lower); if (upper === undefined2) { upper = lower; lower = 0; } else { upper = toFinite(upper); } } if (lower > upper) { var temp = lower; lower = upper; upper = temp; } if (floating || lower % 1 || upper % 1) { var rand = nativeRandom(); return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); } return baseRandom(lower, upper); } var camelCase = createCompounder(function(result2, word, index) { word = word.toLowerCase(); return result2 + (index ? capitalize(word) : word); }); function capitalize(string) { return upperFirst(toString2(string).toLowerCase()); } function deburr(string) { string = toString2(string); return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); } function endsWith2(string, target, position) { string = toString2(string); target = baseToString(target); var length = string.length; position = position === undefined2 ? length : baseClamp(toInteger2(position), 0, length); var end = position; position -= target.length; return position >= 0 && string.slice(position, end) == target; } function escape2(string) { string = toString2(string); return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } function escapeRegExp(string) { string = toString2(string); return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; } var kebabCase = createCompounder(function(result2, word, index) { return result2 + (index ? "-" : "") + word.toLowerCase(); }); var lowerCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + word.toLowerCase(); }); var lowerFirst = createCaseFirst("toLowerCase"); function pad(string, length, chars2) { string = toString2(string); length = toInteger2(length); var strLength = length ? stringSize(string) : 0; if (!length || strLength >= length) { return string; } var mid = (length - strLength) / 2; return createPadding(nativeFloor(mid), chars2) + string + createPadding(nativeCeil(mid), chars2); } function padEnd(string, length, chars2) { string = toString2(string); length = toInteger2(length); var strLength = length ? stringSize(string) : 0; return length && strLength < length ? string + createPadding(length - strLength, chars2) : string; } function padStart2(string, length, chars2) { string = toString2(string); length = toInteger2(length); var strLength = length ? stringSize(string) : 0; return length && strLength < length ? createPadding(length - strLength, chars2) + string : string; } function parseInt3(string, radix, guard) { if (guard || radix == null) { radix = 0; } else if (radix) { radix = +radix; } return nativeParseInt(toString2(string).replace(reTrimStart, ""), radix || 0); } function repeat2(string, n44, guard) { if (guard ? isIterateeCall(string, n44, guard) : n44 === undefined2) { n44 = 1; } else { n44 = toInteger2(n44); } return baseRepeat(toString2(string), n44); } function replace2() { var args = arguments, string = toString2(args[0]); return args.length < 3 ? string : string.replace(args[1], args[2]); } var snakeCase = createCompounder(function(result2, word, index) { return result2 + (index ? "_" : "") + word.toLowerCase(); }); function split3(string, separator, limit2) { if (limit2 && typeof limit2 != "number" && isIterateeCall(string, separator, limit2)) { separator = limit2 = undefined2; } limit2 = limit2 === undefined2 ? MAX_ARRAY_LENGTH : limit2 >>> 0; if (!limit2) { return []; } string = toString2(string); if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { separator = baseToString(separator); if (!separator && hasUnicode(string)) { return castSlice(stringToArray(string), 0, limit2); } } return string.split(separator, limit2); } var startCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + upperFirst(word); }); function startsWith2(string, target, position) { string = toString2(string); position = position == null ? 0 : baseClamp(toInteger2(position), 0, string.length); target = baseToString(target); return string.slice(position, position + target.length) == target; } function template(string, options, guard) { var settings = lodash.templateSettings; if (guard && isIterateeCall(string, options, guard)) { options = undefined2; } string = toString2(string); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); var isEscaping, isEvaluating, index = 0, interpolate3 = options.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp2( (options.escape || reNoMatch).source + "|" + interpolate3.source + "|" + (interpolate3 === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g" ); var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; string.replace(reDelimiters, function(match3, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { interpolateValue || (interpolateValue = esTemplateValue); source += string.slice(index, offset2).replace(reUnescapedString, escapeStringChar); if (escapeValue) { isEscaping = true; source += "' +\n__e(" + escapeValue + ") +\n'"; } if (evaluateValue) { isEvaluating = true; source += "';\n" + evaluateValue + ";\n__p += '"; } if (interpolateValue) { source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } index = offset2 + match3.length; return match3; }); source += "';\n"; var variable = hasOwnProperty.call(options, "variable") && options.variable; if (!variable) { source = "with (obj) {\n" + source + "\n}\n"; } else if (reForbiddenIdentifierChars.test(variable)) { throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); } source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; var result2 = attempt(function() { return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues); }); result2.source = source; if (isError2(result2)) { throw result2; } return result2; } function toLower(value) { return toString2(value).toLowerCase(); } function toUpper(value) { return toString2(value).toUpperCase(); } function trim2(string, chars2, guard) { string = toString2(string); if (string && (guard || chars2 === undefined2)) { return baseTrim(string); } if (!string || !(chars2 = baseToString(chars2))) { return string; } var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars2), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; return castSlice(strSymbols, start, end).join(""); } function trimEnd(string, chars2, guard) { string = toString2(string); if (string && (guard || chars2 === undefined2)) { return string.slice(0, trimmedEndIndex(string) + 1); } if (!string || !(chars2 = baseToString(chars2))) { return string; } var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars2)) + 1; return castSlice(strSymbols, 0, end).join(""); } function trimStart(string, chars2, guard) { string = toString2(string); if (string && (guard || chars2 === undefined2)) { return string.replace(reTrimStart, ""); } if (!string || !(chars2 = baseToString(chars2))) { return string; } var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars2)); return castSlice(strSymbols, start).join(""); } function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject4(options)) { var separator = "separator" in options ? options.separator : separator; length = "length" in options ? toInteger2(options.length) : length; omission = "omission" in options ? baseToString(options.omission) : omission; } string = toString2(string); var strLength = string.length; if (hasUnicode(string)) { var strSymbols = stringToArray(string); strLength = strSymbols.length; } if (length >= strLength) { return string; } var end = length - stringSize(omission); if (end < 1) { return omission; } var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); if (separator === undefined2) { return result2 + omission; } if (strSymbols) { end += result2.length - end; } if (isRegExp(separator)) { if (string.slice(end).search(separator)) { var match3, substring2 = result2; if (!separator.global) { separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g"); } separator.lastIndex = 0; while (match3 = separator.exec(substring2)) { var newEnd = match3.index; } result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd); } } else if (string.indexOf(baseToString(separator), end) != end) { var index = result2.lastIndexOf(separator); if (index > -1) { result2 = result2.slice(0, index); } } return result2 + omission; } function unescape2(string) { string = toString2(string); return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } var upperCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + word.toUpperCase(); }); var upperFirst = createCaseFirst("toUpperCase"); function words(string, pattern, guard) { string = toString2(string); pattern = guard ? undefined2 : pattern; if (pattern === undefined2) { return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); } return string.match(pattern) || []; } var attempt = baseRest(function(func, args) { try { return apply(func, undefined2, args); } catch (e56) { return isError2(e56) ? e56 : new Error2(e56); } }); var bindAll = flatRest(function(object, methodNames) { arrayEach(methodNames, function(key) { key = toKey(key); baseAssignValue(object, key, bind2(object[key], object)); }); return object; }); function cond(pairs) { var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); pairs = !length ? [] : arrayMap(pairs, function(pair) { if (typeof pair[1] != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } return [toIteratee(pair[0]), pair[1]]; }); return baseRest(function(args) { var index = -1; while (++index < length) { var pair = pairs[index]; if (apply(pair[0], this, args)) { return apply(pair[1], this, args); } } }); } function conforms(source) { return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); } function constant(value) { return function() { return value; }; } function defaultTo(value, defaultValue) { return value == null || value !== value ? defaultValue : value; } var flow = createFlow(); var flowRight = createFlow(true); function identity2(value) { return value; } function iteratee(func) { return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); } function matches(source) { return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); } function matchesProperty(path, srcValue) { return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); } var method = baseRest(function(path, args) { return function(object) { return baseInvoke(object, path, args); }; }); var methodOf = baseRest(function(object, args) { return function(path) { return baseInvoke(object, path, args); }; }); function mixin(object, source, options) { var props = keys(source), methodNames = baseFunctions(source, props); if (options == null && !(isObject4(source) && (methodNames.length || !props.length))) { options = source; source = object; object = this; methodNames = baseFunctions(source, keys(source)); } var chain2 = !(isObject4(options) && "chain" in options) || !!options.chain, isFunc = isFunction5(object); arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain2 || chainAll) { var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); actions.push({ "func": func, "args": arguments, "thisArg": object }); result2.__chain__ = chainAll; return result2; } return func.apply(object, arrayPush([this.value()], arguments)); }; } }); return object; } function noConflict() { if (root._ === this) { root._ = oldDash; } return this; } function noop5() { } function nthArg(n44) { n44 = toInteger2(n44); return baseRest(function(args) { return baseNth(args, n44); }); } var over = createOver(arrayMap); var overEvery = createOver(arrayEvery); var overSome = createOver(arraySome); function property(path) { return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } function propertyOf(object) { return function(path) { return object == null ? undefined2 : baseGet(object, path); }; } var range2 = createRange(); var rangeRight = createRange(true); function stubArray() { return []; } function stubFalse() { return false; } function stubObject() { return {}; } function stubString() { return ""; } function stubTrue() { return true; } function times(n44, iteratee2) { n44 = toInteger2(n44); if (n44 < 1 || n44 > MAX_SAFE_INTEGER2) { return []; } var index = MAX_ARRAY_LENGTH, length = nativeMin(n44, MAX_ARRAY_LENGTH); iteratee2 = getIteratee(iteratee2); n44 -= MAX_ARRAY_LENGTH; var result2 = baseTimes(length, iteratee2); while (++index < n44) { iteratee2(index); } return result2; } function toPath(value) { if (isArray7(value)) { return arrayMap(value, toKey); } return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value))); } function uniqueId(prefix) { var id = ++idCounter; return toString2(prefix) + id; } var add2 = createMathOperation(function(augend, addend) { return augend + addend; }, 0); var ceil = createRound("ceil"); var divide2 = createMathOperation(function(dividend, divisor) { return dividend / divisor; }, 1); var floor = createRound("floor"); function max(array) { return array && array.length ? baseExtremum(array, identity2, baseGt) : undefined2; } function maxBy(array, iteratee2) { return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2; } function mean(array) { return baseMean(array, identity2); } function meanBy(array, iteratee2) { return baseMean(array, getIteratee(iteratee2, 2)); } function min(array) { return array && array.length ? baseExtremum(array, identity2, baseLt) : undefined2; } function minBy(array, iteratee2) { return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2; } var multiply2 = createMathOperation(function(multiplier, multiplicand) { return multiplier * multiplicand; }, 1); var round3 = createRound("round"); var subtract2 = createMathOperation(function(minuend, subtrahend) { return minuend - subtrahend; }, 0); function sum3(array) { return array && array.length ? baseSum(array, identity2) : 0; } function sumBy(array, iteratee2) { return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; } lodash.after = after; lodash.ary = ary; lodash.assign = assign; lodash.assignIn = assignIn; lodash.assignInWith = assignInWith; lodash.assignWith = assignWith; lodash.at = at2; lodash.before = before; lodash.bind = bind2; lodash.bindAll = bindAll; lodash.bindKey = bindKey; lodash.castArray = castArray; lodash.chain = chain; lodash.chunk = chunk; lodash.compact = compact2; lodash.concat = concat3; lodash.cond = cond; lodash.conforms = conforms; lodash.constant = constant; lodash.countBy = countBy; lodash.create = create; lodash.curry = curry; lodash.curryRight = curryRight; lodash.debounce = debounce2; lodash.defaults = defaults4; lodash.defaultsDeep = defaultsDeep; lodash.defer = defer2; lodash.delay = delay3; lodash.difference = difference; lodash.differenceBy = differenceBy; lodash.differenceWith = differenceWith; lodash.drop = drop2; lodash.dropRight = dropRight; lodash.dropRightWhile = dropRightWhile; lodash.dropWhile = dropWhile; lodash.fill = fill2; lodash.filter = filter3; lodash.flatMap = flatMap; lodash.flatMapDeep = flatMapDeep; lodash.flatMapDepth = flatMapDepth; lodash.flatten = flatten3; lodash.flattenDeep = flattenDeep; lodash.flattenDepth = flattenDepth; lodash.flip = flip; lodash.flow = flow; lodash.flowRight = flowRight; lodash.fromPairs = fromPairs; lodash.functions = functions; lodash.functionsIn = functionsIn; lodash.groupBy = groupBy2; lodash.initial = initial; lodash.intersection = intersection; lodash.intersectionBy = intersectionBy; lodash.intersectionWith = intersectionWith; lodash.invert = invert; lodash.invertBy = invertBy; lodash.invokeMap = invokeMap; lodash.iteratee = iteratee; lodash.keyBy = keyBy; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map4; lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge4; lodash.mergeWith = mergeWith; lodash.method = method; lodash.methodOf = methodOf; lodash.mixin = mixin; lodash.negate = negate3; lodash.nthArg = nthArg; lodash.omit = omit; lodash.omitBy = omitBy; lodash.once = once; lodash.orderBy = orderBy; lodash.over = over; lodash.overArgs = overArgs; lodash.overEvery = overEvery; lodash.overSome = overSome; lodash.partial = partial; lodash.partialRight = partialRight; lodash.partition = partition; lodash.pick = pick; lodash.pickBy = pickBy; lodash.property = property; lodash.propertyOf = propertyOf; lodash.pull = pull; lodash.pullAll = pullAll; lodash.pullAllBy = pullAllBy; lodash.pullAllWith = pullAllWith; lodash.pullAt = pullAt; lodash.range = range2; lodash.rangeRight = rangeRight; lodash.rearg = rearg; lodash.reject = reject; lodash.remove = remove2; lodash.rest = rest; lodash.reverse = reverse; lodash.sampleSize = sampleSize; lodash.set = set2; lodash.setWith = setWith; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; lodash.sortedUniq = sortedUniq; lodash.sortedUniqBy = sortedUniqBy; lodash.split = split3; lodash.spread = spread; lodash.tail = tail; lodash.take = take3; lodash.takeRight = takeRight; lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile2; lodash.tap = tap2; lodash.throttle = throttle; lodash.thru = thru; lodash.toArray = toArray2; lodash.toPairs = toPairs; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; lodash.unary = unary; lodash.union = union; lodash.unionBy = unionBy; lodash.unionWith = unionWith; lodash.uniq = uniq; lodash.uniqBy = uniqBy; lodash.uniqWith = uniqWith; lodash.unset = unset; lodash.unzip = unzip; lodash.unzipWith = unzipWith; lodash.update = update; lodash.updateWith = updateWith; lodash.values = values3; lodash.valuesIn = valuesIn; lodash.without = without; lodash.words = words; lodash.wrap = wrap; lodash.xor = xor; lodash.xorBy = xorBy; lodash.xorWith = xorWith; lodash.zip = zip; lodash.zipObject = zipObject; lodash.zipObjectDeep = zipObjectDeep; lodash.zipWith = zipWith; lodash.entries = toPairs; lodash.entriesIn = toPairsIn; lodash.extend = assignIn; lodash.extendWith = assignInWith; mixin(lodash, lodash); lodash.add = add2; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; lodash.ceil = ceil; lodash.clamp = clamp3; lodash.clone = clone3; lodash.cloneDeep = cloneDeep; lodash.cloneDeepWith = cloneDeepWith; lodash.cloneWith = cloneWith; lodash.conformsTo = conformsTo; lodash.deburr = deburr; lodash.defaultTo = defaultTo; lodash.divide = divide2; lodash.endsWith = endsWith2; lodash.eq = eq2; lodash.escape = escape2; lodash.escapeRegExp = escapeRegExp; lodash.every = every; lodash.find = find; lodash.findIndex = findIndex2; lodash.findKey = findKey3; lodash.findLast = findLast; lodash.findLastIndex = findLastIndex; lodash.findLastKey = findLastKey; lodash.floor = floor; lodash.forEach = forEach; lodash.forEachRight = forEachRight; lodash.forIn = forIn; lodash.forInRight = forInRight; lodash.forOwn = forOwn; lodash.forOwnRight = forOwnRight; lodash.get = get; lodash.gt = gt2; lodash.gte = gte; lodash.has = has; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity2; lodash.includes = includes; lodash.indexOf = indexOf3; lodash.inRange = inRange2; lodash.invoke = invoke2; lodash.isArguments = isArguments; lodash.isArray = isArray7; lodash.isArrayBuffer = isArrayBuffer2; lodash.isArrayLike = isArrayLike2; lodash.isArrayLikeObject = isArrayLikeObject; lodash.isBoolean = isBoolean3; lodash.isBuffer = isBuffer; lodash.isDate = isDate4; lodash.isElement = isElement; lodash.isEmpty = isEmpty2; lodash.isEqual = isEqual; lodash.isEqualWith = isEqualWith; lodash.isError = isError2; lodash.isFinite = isFinite2; lodash.isFunction = isFunction5; lodash.isInteger = isInteger; lodash.isLength = isLength; lodash.isMap = isMap; lodash.isMatch = isMatch; lodash.isMatchWith = isMatchWith; lodash.isNaN = isNaN2; lodash.isNative = isNative; lodash.isNil = isNil; lodash.isNull = isNull; lodash.isNumber = isNumber5; lodash.isObject = isObject4; lodash.isObjectLike = isObjectLike; lodash.isPlainObject = isPlainObject2; lodash.isRegExp = isRegExp; lodash.isSafeInteger = isSafeInteger; lodash.isSet = isSet2; lodash.isString = isString3; lodash.isSymbol = isSymbol2; lodash.isTypedArray = isTypedArray; lodash.isUndefined = isUndefined2; lodash.isWeakMap = isWeakMap; lodash.isWeakSet = isWeakSet; lodash.join = join; lodash.kebabCase = kebabCase; lodash.last = last5; lodash.lastIndexOf = lastIndexOf2; lodash.lowerCase = lowerCase; lodash.lowerFirst = lowerFirst; lodash.lt = lt; lodash.lte = lte; lodash.max = max; lodash.maxBy = maxBy; lodash.mean = mean; lodash.meanBy = meanBy; lodash.min = min; lodash.minBy = minBy; lodash.stubArray = stubArray; lodash.stubFalse = stubFalse; lodash.stubObject = stubObject; lodash.stubString = stubString; lodash.stubTrue = stubTrue; lodash.multiply = multiply2; lodash.nth = nth; lodash.noConflict = noConflict; lodash.noop = noop5; lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart2; lodash.parseInt = parseInt3; lodash.random = random; lodash.reduce = reduce2; lodash.reduceRight = reduceRight; lodash.repeat = repeat2; lodash.replace = replace2; lodash.result = result; lodash.round = round3; lodash.runInContext = runInContext2; lodash.sample = sample2; lodash.size = size; lodash.snakeCase = snakeCase; lodash.some = some; lodash.sortedIndex = sortedIndex; lodash.sortedIndexBy = sortedIndexBy; lodash.sortedIndexOf = sortedIndexOf; lodash.sortedLastIndex = sortedLastIndex; lodash.sortedLastIndexBy = sortedLastIndexBy; lodash.sortedLastIndexOf = sortedLastIndexOf; lodash.startCase = startCase; lodash.startsWith = startsWith2; lodash.subtract = subtract2; lodash.sum = sum3; lodash.sumBy = sumBy; lodash.template = template; lodash.times = times; lodash.toFinite = toFinite; lodash.toInteger = toInteger2; lodash.toLength = toLength; lodash.toLower = toLower; lodash.toNumber = toNumber2; lodash.toSafeInteger = toSafeInteger; lodash.toString = toString2; lodash.toUpper = toUpper; lodash.trim = trim2; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; lodash.unescape = unescape2; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; lodash.each = forEach; lodash.eachRight = forEachRight; lodash.first = head; mixin(lodash, (function() { var source = {}; baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } }); return source; })(), { "chain": false }); lodash.VERSION = VERSION7; arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { lodash[methodName].placeholder = lodash; }); arrayEach(["drop", "take"], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n44) { n44 = n44 === undefined2 ? 1 : nativeMax(toInteger2(n44), 0); var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); if (result2.__filtered__) { result2.__takeCount__ = nativeMin(n44, result2.__takeCount__); } else { result2.__views__.push({ "size": nativeMin(n44, MAX_ARRAY_LENGTH), "type": methodName + (result2.__dir__ < 0 ? "Right" : "") }); } return result2; }; LazyWrapper.prototype[methodName + "Right"] = function(n44) { return this.reverse()[methodName](n44).reverse(); }; }); arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; LazyWrapper.prototype[methodName] = function(iteratee2) { var result2 = this.clone(); result2.__iteratees__.push({ "iteratee": getIteratee(iteratee2, 3), "type": type }); result2.__filtered__ = result2.__filtered__ || isFilter; return result2; }; }); arrayEach(["head", "last"], function(methodName, index) { var takeName = "take" + (index ? "Right" : ""); LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); arrayEach(["initial", "tail"], function(methodName, index) { var dropName = "drop" + (index ? "" : "Right"); LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); LazyWrapper.prototype.compact = function() { return this.filter(identity2); }; LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { if (typeof path == "function") { return new LazyWrapper(this); } return this.map(function(value) { return baseInvoke(value, path, args); }); }); LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate3(getIteratee(predicate))); }; LazyWrapper.prototype.slice = function(start, end) { start = toInteger2(start); var result2 = this; if (result2.__filtered__ && (start > 0 || end < 0)) { return new LazyWrapper(result2); } if (start < 0) { result2 = result2.takeRight(-start); } else if (start) { result2 = result2.drop(start); } if (end !== undefined2) { end = toInteger2(end); result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); } return result2; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); if (!lodashFunc) { return; } lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray7(value); var interceptor = function(value2) { var result3 = lodashFunc.apply(lodash, arrayPush([value2], args)); return isTaker && chainAll ? result3[0] : result3; }; if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { isLazy = useLazy = false; } var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); var result2 = func.apply(value, args); result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 }); return new LodashWrapper(result2, chainAll); } if (isUnwrapped && onlyLazy) { return func.apply(this, args); } result2 = this.thru(interceptor); return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; }; }); arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { var value = this.value(); return func.apply(isArray7(value) ? value : [], args); } return this[chainName](function(value2) { return func.apply(isArray7(value2) ? value2 : [], args); }); }; }); baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = lodashFunc.name + ""; if (!hasOwnProperty.call(realNames, key)) { realNames[key] = []; } realNames[key].push({ "name": methodName, "func": lodashFunc }); } }); realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{ "name": "wrapper", "func": undefined2 }]; LazyWrapper.prototype.clone = lazyClone; LazyWrapper.prototype.reverse = lazyReverse; LazyWrapper.prototype.value = lazyValue; lodash.prototype.at = wrapperAt; lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; lodash.prototype.next = wrapperNext; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue; lodash.prototype.first = lodash.prototype.head; if (symIterator) { lodash.prototype[symIterator] = wrapperToIterator; } return lodash; }); var _3 = runInContext(); if (typeof define == "function" && typeof define.amd == "object" && define.amd) { root._ = _3; define(function() { return _3; }); } else if (freeModule) { (freeModule.exports = _3)._ = _3; freeExports._ = _3; } else { root._ = _3; } }).call(exports); } }); // node_modules/mapbox-gl/dist/mapbox-gl.js var require_mapbox_gl = __commonJS({ "node_modules/mapbox-gl/dist/mapbox-gl.js"(exports, module) { "use strict"; (function(global2, factory) { typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.mapboxgl = factory()); })(exports, (function() { "use strict"; var shared, worker, mapboxgl2; function define2(_3, chunk) { if (!shared) { shared = chunk; } else if (!worker) { worker = chunk; } else { var workerBundleString = "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 = {}; (" + shared + ")(sharedChunk); (" + worker + ")(sharedChunk); self.onerror = null;"; var sharedChunk = {}; shared(sharedChunk); mapboxgl2 = chunk(sharedChunk); if (typeof window !== "undefined" && window && window.URL && window.URL.createObjectURL) { mapboxgl2.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: "text/javascript" })); } } } define2(["exports"], (function(t44) { var e56 = 1e-6, r85 = "undefined" != typeof Float32Array ? Float32Array : Array; function n44(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = r86 * s18 - i26 * n45; return o88 ? (t45[0] = s18 * (o88 = 1 / o88), t45[1] = -n45 * o88, t45[2] = -i26 * o88, t45[3] = r86 * o88, t45) : null; } function i25() { var t45 = new r85(9); return r85 != Float32Array && (t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[5] = 0, t45[6] = 0, t45[7] = 0), t45[0] = 1, t45[4] = 1, t45[8] = 1, t45; } function s17(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = e57[4], a46 = e57[5], l21 = e57[6], u12 = e57[7], c28 = e57[8]; return t45[0] = o88 * c28 - a46 * u12, t45[1] = i26 * u12 - n45 * c28, t45[2] = n45 * a46 - i26 * o88, t45[3] = a46 * l21 - s18 * c28, t45[4] = r86 * c28 - i26 * l21, t45[5] = i26 * s18 - r86 * a46, t45[6] = s18 * u12 - o88 * l21, t45[7] = n45 * l21 - r86 * u12, t45[8] = r86 * o88 - n45 * s18, t45; } function o87(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = e57[4], l21 = e57[5], u12 = e57[6], c28 = e57[7], h8 = e57[8], p9 = r86[0], d34 = r86[1], f8 = r86[2], m6 = r86[3], y4 = r86[4], g9 = r86[5], x4 = r86[6], v8 = r86[7], b8 = r86[8]; return t45[0] = p9 * n45 + d34 * o88 + f8 * u12, t45[1] = p9 * i26 + d34 * a46 + f8 * c28, t45[2] = p9 * s18 + d34 * l21 + f8 * h8, t45[3] = m6 * n45 + y4 * o88 + g9 * u12, t45[4] = m6 * i26 + y4 * a46 + g9 * c28, t45[5] = m6 * s18 + y4 * l21 + g9 * h8, t45[6] = x4 * n45 + v8 * o88 + b8 * u12, t45[7] = x4 * i26 + v8 * a46 + b8 * c28, t45[8] = x4 * s18 + v8 * l21 + b8 * h8, t45; } function a45() { var t45 = new r85(16); return r85 != Float32Array && (t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[4] = 0, t45[6] = 0, t45[7] = 0, t45[8] = 0, t45[9] = 0, t45[11] = 0, t45[12] = 0, t45[13] = 0, t45[14] = 0), t45[0] = 1, t45[5] = 1, t45[10] = 1, t45[15] = 1, t45; } function l20(t45) { return t45[0] = 1, t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[4] = 0, t45[5] = 1, t45[6] = 0, t45[7] = 0, t45[8] = 0, t45[9] = 0, t45[10] = 1, t45[11] = 0, t45[12] = 0, t45[13] = 0, t45[14] = 0, t45[15] = 1, t45; } function u11(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = e57[4], a46 = e57[5], l21 = e57[6], u12 = e57[7], c28 = e57[8], h8 = e57[9], p9 = e57[10], d34 = e57[11], f8 = e57[12], m6 = e57[13], y4 = e57[14], g9 = e57[15], x4 = r86 * a46 - n45 * o88, v8 = r86 * l21 - i26 * o88, b8 = r86 * u12 - s18 * o88, w4 = n45 * l21 - i26 * a46, _4 = n45 * u12 - s18 * a46, A4 = i26 * u12 - s18 * l21, M5 = c28 * m6 - h8 * f8, I4 = c28 * y4 - p9 * f8, S5 = c28 * g9 - d34 * f8, P4 = h8 * y4 - p9 * m6, k7 = h8 * g9 - d34 * m6, z4 = p9 * g9 - d34 * y4, E5 = x4 * z4 - v8 * k7 + b8 * P4 + w4 * S5 - _4 * I4 + A4 * M5; return E5 ? (t45[0] = (a46 * z4 - l21 * k7 + u12 * P4) * (E5 = 1 / E5), t45[1] = (i26 * k7 - n45 * z4 - s18 * P4) * E5, t45[2] = (m6 * A4 - y4 * _4 + g9 * w4) * E5, t45[3] = (p9 * _4 - h8 * A4 - d34 * w4) * E5, t45[4] = (l21 * S5 - o88 * z4 - u12 * I4) * E5, t45[5] = (r86 * z4 - i26 * S5 + s18 * I4) * E5, t45[6] = (y4 * b8 - f8 * A4 - g9 * v8) * E5, t45[7] = (c28 * A4 - p9 * b8 + d34 * v8) * E5, t45[8] = (o88 * k7 - a46 * S5 + u12 * M5) * E5, t45[9] = (n45 * S5 - r86 * k7 - s18 * M5) * E5, t45[10] = (f8 * _4 - m6 * b8 + g9 * x4) * E5, t45[11] = (h8 * b8 - c28 * _4 - d34 * x4) * E5, t45[12] = (a46 * I4 - o88 * P4 - l21 * M5) * E5, t45[13] = (r86 * P4 - n45 * I4 + i26 * M5) * E5, t45[14] = (m6 * v8 - f8 * w4 - y4 * x4) * E5, t45[15] = (c28 * w4 - h8 * v8 + p9 * x4) * E5, t45) : null; } function c27(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = e57[4], l21 = e57[5], u12 = e57[6], c28 = e57[7], h8 = e57[8], p9 = e57[9], d34 = e57[10], f8 = e57[11], m6 = e57[12], y4 = e57[13], g9 = e57[14], x4 = e57[15], v8 = r86[0], b8 = r86[1], w4 = r86[2], _4 = r86[3]; return t45[0] = v8 * n45 + b8 * a46 + w4 * h8 + _4 * m6, t45[1] = v8 * i26 + b8 * l21 + w4 * p9 + _4 * y4, t45[2] = v8 * s18 + b8 * u12 + w4 * d34 + _4 * g9, t45[3] = v8 * o88 + b8 * c28 + w4 * f8 + _4 * x4, t45[4] = (v8 = r86[4]) * n45 + (b8 = r86[5]) * a46 + (w4 = r86[6]) * h8 + (_4 = r86[7]) * m6, t45[5] = v8 * i26 + b8 * l21 + w4 * p9 + _4 * y4, t45[6] = v8 * s18 + b8 * u12 + w4 * d34 + _4 * g9, t45[7] = v8 * o88 + b8 * c28 + w4 * f8 + _4 * x4, t45[8] = (v8 = r86[8]) * n45 + (b8 = r86[9]) * a46 + (w4 = r86[10]) * h8 + (_4 = r86[11]) * m6, t45[9] = v8 * i26 + b8 * l21 + w4 * p9 + _4 * y4, t45[10] = v8 * s18 + b8 * u12 + w4 * d34 + _4 * g9, t45[11] = v8 * o88 + b8 * c28 + w4 * f8 + _4 * x4, t45[12] = (v8 = r86[12]) * n45 + (b8 = r86[13]) * a46 + (w4 = r86[14]) * h8 + (_4 = r86[15]) * m6, t45[13] = v8 * i26 + b8 * l21 + w4 * p9 + _4 * y4, t45[14] = v8 * s18 + b8 * u12 + w4 * d34 + _4 * g9, t45[15] = v8 * o88 + b8 * c28 + w4 * f8 + _4 * x4, t45; } function h7(t45, e57, r86) { var n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6 = r86[0], y4 = r86[1], g9 = r86[2]; return e57 === t45 ? (t45[12] = e57[0] * m6 + e57[4] * y4 + e57[8] * g9 + e57[12], t45[13] = e57[1] * m6 + e57[5] * y4 + e57[9] * g9 + e57[13], t45[14] = e57[2] * m6 + e57[6] * y4 + e57[10] * g9 + e57[14], t45[15] = e57[3] * m6 + e57[7] * y4 + e57[11] * g9 + e57[15]) : (i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = e57[4], l21 = e57[5], u12 = e57[6], c28 = e57[7], h8 = e57[8], p9 = e57[9], d34 = e57[10], f8 = e57[11], t45[0] = n45 = e57[0], t45[1] = i26, t45[2] = s18, t45[3] = o88, t45[4] = a46, t45[5] = l21, t45[6] = u12, t45[7] = c28, t45[8] = h8, t45[9] = p9, t45[10] = d34, t45[11] = f8, t45[12] = n45 * m6 + a46 * y4 + h8 * g9 + e57[12], t45[13] = i26 * m6 + l21 * y4 + p9 * g9 + e57[13], t45[14] = s18 * m6 + u12 * y4 + d34 * g9 + e57[14], t45[15] = o88 * m6 + c28 * y4 + f8 * g9 + e57[15]), t45; } function p8(t45, e57, r86) { var n45 = r86[0], i26 = r86[1], s18 = r86[2]; return t45[0] = e57[0] * n45, t45[1] = e57[1] * n45, t45[2] = e57[2] * n45, t45[3] = e57[3] * n45, t45[4] = e57[4] * i26, t45[5] = e57[5] * i26, t45[6] = e57[6] * i26, t45[7] = e57[7] * i26, t45[8] = e57[8] * s18, t45[9] = e57[9] * s18, t45[10] = e57[10] * s18, t45[11] = e57[11] * s18, t45[12] = e57[12], t45[13] = e57[13], t45[14] = e57[14], t45[15] = e57[15], t45; } function d33(t45, e57, r86) { var n45 = Math.sin(r86), i26 = Math.cos(r86), s18 = e57[4], o88 = e57[5], a46 = e57[6], l21 = e57[7], u12 = e57[8], c28 = e57[9], h8 = e57[10], p9 = e57[11]; return e57 !== t45 && (t45[0] = e57[0], t45[1] = e57[1], t45[2] = e57[2], t45[3] = e57[3], t45[12] = e57[12], t45[13] = e57[13], t45[14] = e57[14], t45[15] = e57[15]), t45[4] = s18 * i26 + u12 * n45, t45[5] = o88 * i26 + c28 * n45, t45[6] = a46 * i26 + h8 * n45, t45[7] = l21 * i26 + p9 * n45, t45[8] = u12 * i26 - s18 * n45, t45[9] = c28 * i26 - o88 * n45, t45[10] = h8 * i26 - a46 * n45, t45[11] = p9 * i26 - l21 * n45, t45; } function f7(t45, e57, r86) { var n45 = Math.sin(r86), i26 = Math.cos(r86), s18 = e57[0], o88 = e57[1], a46 = e57[2], l21 = e57[3], u12 = e57[8], c28 = e57[9], h8 = e57[10], p9 = e57[11]; return e57 !== t45 && (t45[4] = e57[4], t45[5] = e57[5], t45[6] = e57[6], t45[7] = e57[7], t45[12] = e57[12], t45[13] = e57[13], t45[14] = e57[14], t45[15] = e57[15]), t45[0] = s18 * i26 - u12 * n45, t45[1] = o88 * i26 - c28 * n45, t45[2] = a46 * i26 - h8 * n45, t45[3] = l21 * i26 - p9 * n45, t45[8] = s18 * n45 + u12 * i26, t45[9] = o88 * n45 + c28 * i26, t45[10] = a46 * n45 + h8 * i26, t45[11] = l21 * n45 + p9 * i26, t45; } function m5(t45, e57, r86) { var n45 = Math.sin(r86), i26 = Math.cos(r86), s18 = e57[0], o88 = e57[1], a46 = e57[2], l21 = e57[3], u12 = e57[4], c28 = e57[5], h8 = e57[6], p9 = e57[7]; return e57 !== t45 && (t45[8] = e57[8], t45[9] = e57[9], t45[10] = e57[10], t45[11] = e57[11], t45[12] = e57[12], t45[13] = e57[13], t45[14] = e57[14], t45[15] = e57[15]), t45[0] = s18 * i26 + u12 * n45, t45[1] = o88 * i26 + c28 * n45, t45[2] = a46 * i26 + h8 * n45, t45[3] = l21 * i26 + p9 * n45, t45[4] = u12 * i26 - s18 * n45, t45[5] = c28 * i26 - o88 * n45, t45[6] = h8 * i26 - a46 * n45, t45[7] = p9 * i26 - l21 * n45, t45; } function y3(t45, e57) { return t45[0] = e57[0], t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[4] = 0, t45[5] = e57[1], t45[6] = 0, t45[7] = 0, t45[8] = 0, t45[9] = 0, t45[10] = e57[2], t45[11] = 0, t45[12] = 0, t45[13] = 0, t45[14] = 0, t45[15] = 1, t45; } function g8(t45, r86, n45) { var i26, s18, o88, a46 = n45[0], l21 = n45[1], u12 = n45[2], c28 = Math.sqrt(a46 * a46 + l21 * l21 + u12 * u12); return c28 < e56 ? null : (a46 *= c28 = 1 / c28, l21 *= c28, u12 *= c28, i26 = Math.sin(r86), s18 = Math.cos(r86), t45[0] = a46 * a46 * (o88 = 1 - s18) + s18, t45[1] = l21 * a46 * o88 + u12 * i26, t45[2] = u12 * a46 * o88 - l21 * i26, t45[3] = 0, t45[4] = a46 * l21 * o88 - u12 * i26, t45[5] = l21 * l21 * o88 + s18, t45[6] = u12 * l21 * o88 + a46 * i26, t45[7] = 0, t45[8] = a46 * u12 * o88 + l21 * i26, t45[9] = l21 * u12 * o88 - a46 * i26, t45[10] = u12 * u12 * o88 + s18, t45[11] = 0, t45[12] = 0, t45[13] = 0, t45[14] = 0, t45[15] = 1, t45); } function x3(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = r86 + r86, a46 = n45 + n45, l21 = i26 + i26, u12 = r86 * o88, c28 = n45 * o88, h8 = n45 * a46, p9 = i26 * o88, d34 = i26 * a46, f8 = i26 * l21, m6 = s18 * o88, y4 = s18 * a46, g9 = s18 * l21; return t45[0] = 1 - h8 - f8, t45[1] = c28 + g9, t45[2] = p9 - y4, t45[3] = 0, t45[4] = c28 - g9, t45[5] = 1 - u12 - f8, t45[6] = d34 + m6, t45[7] = 0, t45[8] = p9 + y4, t45[9] = d34 - m6, t45[10] = 1 - u12 - h8, t45[11] = 0, t45[12] = 0, t45[13] = 0, t45[14] = 0, t45[15] = 1, t45; } var v7 = c27; function b7() { var t45 = new r85(3); return r85 != Float32Array && (t45[0] = 0, t45[1] = 0, t45[2] = 0), t45; } function w3(t45) { var e57 = new r85(3); return e57[0] = t45[0], e57[1] = t45[1], e57[2] = t45[2], e57; } function _3(t45) { var e57 = t45[0], r86 = t45[1], n45 = t45[2]; return Math.sqrt(e57 * e57 + r86 * r86 + n45 * n45); } function A3(t45, e57, n45) { var i26 = new r85(3); return i26[0] = t45, i26[1] = e57, i26[2] = n45, i26; } function M4(t45, e57, r86, n45) { return t45[0] = e57, t45[1] = r86, t45[2] = n45, t45; } function I3(t45, e57, r86) { return t45[0] = e57[0] + r86[0], t45[1] = e57[1] + r86[1], t45[2] = e57[2] + r86[2], t45; } function S4(t45, e57, r86) { return t45[0] = e57[0] - r86[0], t45[1] = e57[1] - r86[1], t45[2] = e57[2] - r86[2], t45; } function P3(t45, e57, r86) { return t45[0] = e57[0] * r86[0], t45[1] = e57[1] * r86[1], t45[2] = e57[2] * r86[2], t45; } function k6(t45, e57, r86) { return t45[0] = Math.min(e57[0], r86[0]), t45[1] = Math.min(e57[1], r86[1]), t45[2] = Math.min(e57[2], r86[2]), t45; } function z3(t45, e57, r86) { return t45[0] = Math.max(e57[0], r86[0]), t45[1] = Math.max(e57[1], r86[1]), t45[2] = Math.max(e57[2], r86[2]), t45; } function E4(t45, e57, r86) { return t45[0] = e57[0] * r86, t45[1] = e57[1] * r86, t45[2] = e57[2] * r86, t45; } function T4(t45, e57, r86, n45) { return t45[0] = e57[0] + r86[0] * n45, t45[1] = e57[1] + r86[1] * n45, t45[2] = e57[2] + r86[2] * n45, t45; } function B5(t45, e57) { var r86 = e57[0] - t45[0], n45 = e57[1] - t45[1], i26 = e57[2] - t45[2]; return r86 * r86 + n45 * n45 + i26 * i26; } function V3(t45) { var e57 = t45[0], r86 = t45[1], n45 = t45[2]; return e57 * e57 + r86 * r86 + n45 * n45; } function F16(t45, e57) { return t45[0] = -e57[0], t45[1] = -e57[1], t45[2] = -e57[2], t45; } function C5(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = r86 * r86 + n45 * n45 + i26 * i26; return s18 > 0 && (s18 = 1 / Math.sqrt(s18)), t45[0] = e57[0] * s18, t45[1] = e57[1] * s18, t45[2] = e57[2] * s18, t45; } function D4(t45, e57) { return t45[0] * e57[0] + t45[1] * e57[1] + t45[2] * e57[2]; } function R4(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = r86[0], a46 = r86[1], l21 = r86[2]; return t45[0] = i26 * l21 - s18 * a46, t45[1] = s18 * o88 - n45 * l21, t45[2] = n45 * a46 - i26 * o88, t45; } function L2(t45, e57, r86, n45) { var i26 = e57[0], s18 = e57[1], o88 = e57[2]; return t45[0] = i26 + n45 * (r86[0] - i26), t45[1] = s18 + n45 * (r86[1] - s18), t45[2] = o88 + n45 * (r86[2] - o88), t45; } function O3(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = r86[3] * n45 + r86[7] * i26 + r86[11] * s18 + r86[15]; return t45[0] = (r86[0] * n45 + r86[4] * i26 + r86[8] * s18 + r86[12]) / (o88 = o88 || 1), t45[1] = (r86[1] * n45 + r86[5] * i26 + r86[9] * s18 + r86[13]) / o88, t45[2] = (r86[2] * n45 + r86[6] * i26 + r86[10] * s18 + r86[14]) / o88, t45; } function U3(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2]; return t45[0] = n45 * r86[0] + i26 * r86[3] + s18 * r86[6], t45[1] = n45 * r86[1] + i26 * r86[4] + s18 * r86[7], t45[2] = n45 * r86[2] + i26 * r86[5] + s18 * r86[8], t45; } function N4(t45, e57, r86) { var n45 = r86[0], i26 = r86[1], s18 = r86[2], o88 = r86[3], a46 = e57[0], l21 = e57[1], u12 = e57[2], c28 = i26 * u12 - s18 * l21, h8 = s18 * a46 - n45 * u12, p9 = n45 * l21 - i26 * a46; return t45[0] = a46 + o88 * (c28 += c28) + i26 * (p9 += p9) - s18 * (h8 += h8), t45[1] = l21 + o88 * h8 + s18 * c28 - n45 * p9, t45[2] = u12 + o88 * p9 + n45 * h8 - i26 * c28, t45; } function j3(t45) { return t45[0] = 0, t45[1] = 0, t45[2] = 0, t45; } function $4(t45, e57) { return t45[0] === e57[0] && t45[1] === e57[1] && t45[2] === e57[2]; } var G4 = S4, H3 = P3, q2 = _3; function X2() { var t45 = new r85(4); return r85 != Float32Array && (t45[0] = 0, t45[1] = 0, t45[2] = 0, t45[3] = 0), t45; } function Z2(t45, e57, r86) { return t45[0] = e57[0] * r86, t45[1] = e57[1] * r86, t45[2] = e57[2] * r86, t45[3] = e57[3] * r86, t45; } function W3(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = r86 * r86 + n45 * n45 + i26 * i26 + s18 * s18; return o88 > 0 && (o88 = 1 / Math.sqrt(o88)), t45[0] = r86 * o88, t45[1] = n45 * o88, t45[2] = i26 * o88, t45[3] = s18 * o88, t45; } function Y5(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3]; return t45[0] = r86[0] * n45 + r86[4] * i26 + r86[8] * s18 + r86[12] * o88, t45[1] = r86[1] * n45 + r86[5] * i26 + r86[9] * s18 + r86[13] * o88, t45[2] = r86[2] * n45 + r86[6] * i26 + r86[10] * s18 + r86[14] * o88, t45[3] = r86[3] * n45 + r86[7] * i26 + r86[11] * s18 + r86[15] * o88, t45; } function K4() { var t45 = new r85(4); return r85 != Float32Array && (t45[0] = 0, t45[1] = 0, t45[2] = 0), t45[3] = 1, t45; } function J3(t45) { return t45[0] = 0, t45[1] = 0, t45[2] = 0, t45[3] = 1, t45; } function Q4(t45, e57, r86) { r86 *= 0.5; var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = Math.sin(r86), l21 = Math.cos(r86); return t45[0] = n45 * l21 + o88 * a46, t45[1] = i26 * l21 + s18 * a46, t45[2] = s18 * l21 - i26 * a46, t45[3] = o88 * l21 - n45 * a46, t45; } function tt(t45, e57, r86) { r86 *= 0.5; var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = Math.sin(r86), l21 = Math.cos(r86); return t45[0] = n45 * l21 - s18 * a46, t45[1] = i26 * l21 + o88 * a46, t45[2] = s18 * l21 + n45 * a46, t45[3] = o88 * l21 - i26 * a46, t45; } b7(), X2(); var et2, rt3, nt2, it = W3, st3 = (et2 = b7(), rt3 = A3(1, 0, 0), nt2 = A3(0, 1, 0), function(t45, e57, r86) { var n45 = D4(e57, r86); return n45 < -0.999999 ? (R4(et2, rt3, e57), q2(et2) < 1e-6 && R4(et2, nt2, e57), C5(et2, et2), (function(t46, e58, r87) { r87 *= 0.5; var n46 = Math.sin(r87); t46[0] = n46 * e58[0], t46[1] = n46 * e58[1], t46[2] = n46 * e58[2], t46[3] = Math.cos(r87); })(t45, et2, Math.PI), t45) : n45 > 0.999999 ? (t45[0] = 0, t45[1] = 0, t45[2] = 0, t45[3] = 1, t45) : (R4(et2, e57, r86), t45[0] = et2[0], t45[1] = et2[1], t45[2] = et2[2], t45[3] = 1 + n45, it(t45, t45)); }); function ot() { var t45 = new r85(2); return r85 != Float32Array && (t45[0] = 0, t45[1] = 0), t45; } function at2(t45, e57) { var n45 = new r85(2); return n45[0] = t45, n45[1] = e57, n45; } function lt(t45, e57, r86) { return t45[0] = e57, t45[1] = r86, t45; } function ut2(t45, e57, r86) { return t45[0] = e57[0] + r86[0], t45[1] = e57[1] + r86[1], t45; } function ct(t45, e57, r86) { return t45[0] = e57[0] - r86[0], t45[1] = e57[1] - r86[1], t45; } function ht2(t45, e57, r86) { return t45[0] = e57[0] * r86, t45[1] = e57[1] * r86, t45; } function pt(t45) { var e57 = t45[0], r86 = t45[1]; return Math.sqrt(e57 * e57 + r86 * r86); } function dt3(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = r86 * r86 + n45 * n45; return i26 > 0 && (i26 = 1 / Math.sqrt(i26)), t45[0] = e57[0] * i26, t45[1] = e57[1] * i26, t45; } function ft(t45, e57) { return t45[0] * e57[0] + t45[1] * e57[1]; } K4(), K4(), i25(); var mt, yt, gt2 = ct; function xt(t45) { return t45 && t45.__esModule && Object.prototype.hasOwnProperty.call(t45, "default") ? t45.default : t45; } ot(); var vt2 = (function() { if (yt) return mt; function t45(t46, e57, r86, n45) { this.cx = 3 * t46, this.bx = 3 * (r86 - t46) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e57, this.by = 3 * (n45 - e57) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t46, this.p1y = e57, this.p2x = r86, this.p2y = n45; } return yt = 1, mt = t45, t45.prototype = { sampleCurveX: function(t46) { return ((this.ax * t46 + this.bx) * t46 + this.cx) * t46; }, sampleCurveY: function(t46) { return ((this.ay * t46 + this.by) * t46 + this.cy) * t46; }, sampleCurveDerivativeX: function(t46) { return (3 * this.ax * t46 + 2 * this.bx) * t46 + this.cx; }, solveCurveX: function(t46, e57) { if (void 0 === e57 && (e57 = 1e-6), t46 < 0) return 0; if (t46 > 1) return 1; for (var r86 = t46, n45 = 0; n45 < 8; n45++) { var i26 = this.sampleCurveX(r86) - t46; if (Math.abs(i26) < e57) return r86; var s18 = this.sampleCurveDerivativeX(r86); if (Math.abs(s18) < 1e-6) break; r86 -= i26 / s18; } var o88 = 0, a46 = 1; for (r86 = t46, n45 = 0; n45 < 20 && (i26 = this.sampleCurveX(r86), !(Math.abs(i26 - t46) < e57)); n45++) t46 > i26 ? o88 = r86 : a46 = r86, r86 = 0.5 * (a46 - o88) + o88; return r86; }, solve: function(t46, e57) { return this.sampleCurveY(this.solveCurveX(t46, e57)); } }, mt; })(), bt2 = xt(vt2); function wt(t45, e57) { this.x = t45, this.y = e57; } function _t(t45, e57) { if (Array.isArray(t45)) { if (!Array.isArray(e57) || t45.length !== e57.length) return false; for (let r86 = 0; r86 < t45.length; r86++) if (!_t(t45[r86], e57[r86])) return false; return true; } if ("object" == typeof t45 && null !== t45 && null !== e57) { if ("object" != typeof e57) return false; if (Object.keys(t45).length !== Object.keys(e57).length) return false; for (const r86 in t45) if (!_t(t45[r86], e57[r86])) return false; return true; } return t45 === e57; } wt.prototype = { clone() { return new wt(this.x, this.y); }, add(t45) { return this.clone()._add(t45); }, sub(t45) { return this.clone()._sub(t45); }, multByPoint(t45) { return this.clone()._multByPoint(t45); }, divByPoint(t45) { return this.clone()._divByPoint(t45); }, mult(t45) { return this.clone()._mult(t45); }, div(t45) { return this.clone()._div(t45); }, rotate(t45) { return this.clone()._rotate(t45); }, rotateAround(t45, e57) { return this.clone()._rotateAround(t45, e57); }, matMult(t45) { return this.clone()._matMult(t45); }, unit() { return this.clone()._unit(); }, perp() { return this.clone()._perp(); }, round() { return this.clone()._round(); }, mag() { return Math.sqrt(this.x * this.x + this.y * this.y); }, equals(t45) { return this.x === t45.x && this.y === t45.y; }, dist(t45) { return Math.sqrt(this.distSqr(t45)); }, distSqr(t45) { const e57 = t45.x - this.x, r86 = t45.y - this.y; return e57 * e57 + r86 * r86; }, angle() { return Math.atan2(this.y, this.x); }, angleTo(t45) { return Math.atan2(this.y - t45.y, this.x - t45.x); }, angleWith(t45) { return this.angleWithSep(t45.x, t45.y); }, angleWithSep(t45, e57) { return Math.atan2(this.x * e57 - this.y * t45, this.x * t45 + this.y * e57); }, _matMult(t45) { const e57 = t45[2] * this.x + t45[3] * this.y; return this.x = t45[0] * this.x + t45[1] * this.y, this.y = e57, this; }, _add(t45) { return this.x += t45.x, this.y += t45.y, this; }, _sub(t45) { return this.x -= t45.x, this.y -= t45.y, this; }, _mult(t45) { return this.x *= t45, this.y *= t45, this; }, _div(t45) { return this.x /= t45, this.y /= t45, this; }, _multByPoint(t45) { return this.x *= t45.x, this.y *= t45.y, this; }, _divByPoint(t45) { return this.x /= t45.x, this.y /= t45.y, this; }, _unit() { return this._div(this.mag()), this; }, _perp() { const t45 = this.y; return this.y = this.x, this.x = -t45, this; }, _rotate(t45) { const e57 = Math.cos(t45), r86 = Math.sin(t45), n45 = r86 * this.x + e57 * this.y; return this.x = e57 * this.x - r86 * this.y, this.y = n45, this; }, _rotateAround(t45, e57) { const r86 = Math.cos(t45), n45 = Math.sin(t45), i26 = e57.y + n45 * (this.x - e57.x) + r86 * (this.y - e57.y); return this.x = e57.x + r86 * (this.x - e57.x) - n45 * (this.y - e57.y), this.y = i26, this; }, _round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this; }, constructor: wt }, wt.convert = function(t45) { if (t45 instanceof wt) return t45; if (Array.isArray(t45)) return new wt(+t45[0], +t45[1]); if (void 0 !== t45.x && void 0 !== t45.y) return new wt(+t45.x, +t45.y); throw new Error("Expected [x, y] or {x, y} point format"); }; const At = Math.PI / 180, Mt2 = 180 / Math.PI; function It(t45) { return t45 * At; } function St(t45) { return t45 * Mt2; } const Pt = [[0, 0], [1, 0], [1, 1], [0, 1]]; function kt(t45) { if (t45 <= 0) return 0; if (t45 >= 1) return 1; const e57 = t45 * t45, r86 = e57 * t45; return 4 * (t45 < 0.5 ? r86 : 3 * (t45 - e57) + r86 - 0.75); } function zt2(t45, e57, r86, n45) { const i26 = new bt2(t45, e57, r86, n45); return function(t46) { return i26.solve(t46); }; } const Et = zt2(0.25, 0.1, 0.25, 1); function Tt2(t45, e57, r86) { return Math.min(r86, Math.max(e57, t45)); } function Bt(t45, e57, r86) { return (r86 = Tt2((r86 - t45) / (e57 - t45), 0, 1)) * r86 * (3 - 2 * r86); } function Vt(t45, e57, r86) { const n45 = r86 - e57, i26 = ((t45 - e57) % n45 + n45) % n45 + e57; return i26 === e57 ? r86 : i26; } function Ft(t45, e57, r86) { if (!t45.length) return r86(null, []); let n45 = t45.length; const i26 = new Array(t45.length); let s18 = null; t45.forEach(((t46, o88) => { e57(t46, ((t47, e58) => { t47 && (s18 = t47), i26[o88] = e58, 0 == --n45 && r86(s18, i26); })); })); } let Ct = 1; function Dt() { return Ct++; } function Rt2(t45) { return t45 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log2(t45))); } function Lt2(t45, e57) { t45.forEach(((t46) => { e57[t46] && (e57[t46] = e57[t46].bind(e57)); })); } function Ot(t45, e57, r86) { const n45 = {}; for (const r87 in t45) n45[r87] = e57.call(this, t45[r87], r87, t45); return n45; } function Ut2(t45, e57, r86) { const n45 = {}; for (const r87 in t45) e57.call(this, t45[r87], r87, t45) && (n45[r87] = t45[r87]); return n45; } function Nt(t45) { return Array.isArray(t45) ? t45.map(Nt) : "object" == typeof t45 && t45 ? Ot(t45, Nt) : t45; } function jt(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) if (e57.indexOf(t45[r86]) >= 0) return true; return false; } const $t = {}; function Gt(t45) { $t[t45] || ("undefined" != typeof console && console.warn(t45), $t[t45] = true); } function Ht2(t45, e57, r86) { return (r86.y - t45.y) * (e57.x - t45.x) > (e57.y - t45.y) * (r86.x - t45.x); } function qt(t45) { let e57 = 0; for (let r86, n45, i26 = 0, s18 = t45.length, o88 = s18 - 1; i26 < s18; o88 = i26++) r86 = t45[i26], n45 = t45[o88], e57 += (n45.x - r86.x) * (r86.y + n45.y); return e57; } function Xt([t45, e57, r86]) { const n45 = It(e57 + 90), i26 = It(r86); return { x: t45 * Math.cos(n45) * Math.sin(i26), y: t45 * Math.sin(n45) * Math.sin(i26), z: t45 * Math.cos(i26), azimuthal: e57, polar: r86 }; } function Zt2(t45) { return ("undefined" != typeof self || void 0 !== t45) && "undefined" != typeof WorkerGlobalScope && (void 0 !== t45 ? t45 : self) instanceof WorkerGlobalScope; } function Wt(t45) { const e57 = {}; if (t45.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, ((t46, r86, n45, i26) => { const s18 = n45 || i26; return e57[r86] = !s18 || s18.toLowerCase(), ""; })), e57["max-age"]) { const t46 = parseInt(e57["max-age"], 10); isNaN(t46) ? delete e57["max-age"] : e57["max-age"] = t46; } return e57; } let Yt2 = null; function Kt2(t45, e57) { return [t45[4 * e57], t45[4 * e57 + 1], t45[4 * e57 + 2], t45[4 * e57 + 3]]; } function Jt2(t45, e57, r86, n45) { for (; e57 < r86; ) { const i26 = e57 + r86 >> 1; t45[i26] < n45 ? e57 = i26 + 1 : r86 = i26; } return e57; } function Qt2(t45, e57, r86, n45) { for (; e57 < r86; ) { const i26 = e57 + r86 >> 1; t45[i26] <= n45 ? e57 = i26 + 1 : r86 = i26; } return e57; } function te(t45) { return t45 > 0 ? 1 / (1.001 - t45) : 1 + t45; } function ee2(t45) { return t45 > 0 ? 1 - 1 / (1.001 - t45) : -t45; } function re2(t45, e57, r86) { return (t45 - e57.min) * (r86.max - r86.min) / (e57.max - e57.min) + r86.min; } const ne2 = { API_URL: "https://api.mapbox.com", get API_URL_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i; }, get API_TILEJSON_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i; }, get API_SPRITE_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i; }, get API_FONTS_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i; }, get API_STYLE_REGEX() { return /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i; }, get API_CDN_URL_REGEX() { return /^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i; }, get EVENTS_URL() { if (!ne2.API_URL) return null; try { const t45 = new URL(ne2.API_URL); return "api.mapbox.cn" === t45.hostname ? "https://events.mapbox.cn/events/v2" : "api.mapbox.com" === t45.hostname ? "https://events.mapbox.com/events/v2" : null; } catch (t45) { return null; } }, SESSION_PATH: "/map-sessions/v1", FEEDBACK_URL: "https://apps.mapbox.com/feedback", TILE_URL_VERSION: "v4", RASTER_URL_PREFIX: "raster/v1", RASTERARRAYS_URL_PREFIX: "rasterarrays/v1", REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, DEFAULT_STYLE: "mapbox://styles/mapbox/standard", MAX_PARALLEL_IMAGE_REQUESTS: 16, DRACO_URL: "https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm", MESHOPT_URL: "https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm", MESHOPT_SIMD_URL: "https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm", BUILDING_GEN_URL: "https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.3.wasm", GLYPHS_URL: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", TILES3D_URL_PREFIX: "3dtiles/v1" }; function ie2(t45) { return ne2.API_URL_REGEX.test(t45); } function se(t45) { return ne2.API_SPRITE_REGEX.test(t45); } let oe3, ae2, le2, ue3, ce2, he; function pe() { return null == oe3 && (oe3 = self.OffscreenCanvas && new OffscreenCanvas(1, 1).getContext("2d") && "function" == typeof self.createImageBitmap), oe3; } const de3 = { now: () => void 0 !== ue3 ? ue3 : performance.now(), setNow(t45) { ue3 = t45; }, restoreNow() { ue3 = void 0; }, frame(t45) { const e57 = requestAnimationFrame(t45); return { cancel: () => cancelAnimationFrame(e57) }; }, getImageData(t45, e57 = 0) { const { width: r86, height: n45 } = t45; ce2 || (ce2 = document.createElement("canvas")); const i26 = ce2.getContext("2d", { willReadFrequently: true }); if (!i26) throw new Error("failed to create canvas 2d context"); return (r86 > ce2.width || n45 > ce2.height) && (ce2.width = r86, ce2.height = n45), i26.clearRect(-e57, -e57, r86 + 2 * e57, n45 + 2 * e57), i26.drawImage(t45, 0, 0, r86, n45), i26.getImageData(-e57, -e57, r86 + 2 * e57, n45 + 2 * e57); }, resolveURL: (t45) => (ae2 || (ae2 = document.createElement("a")), ae2.href = t45, ae2.href), get devicePixelRatio() { return window.devicePixelRatio; }, get prefersReducedMotion() { return !!window.matchMedia && (null == le2 && (le2 = window.matchMedia("(prefers-reduced-motion: reduce)")), le2.matches); }, hasCanvasFingerprintNoise() { if (void 0 !== he) return he; if (!pe()) return he = false, false; const t45 = new OffscreenCanvas(85, 1), e57 = t45.getContext("2d", { willReadFrequently: true }); let r86 = 0; for (let n46 = 0; n46 < t45.width; ++n46) e57.fillStyle = `rgba(${r86++},${r86++},${r86++}, 255)`, e57.fillRect(n46, 0, 1, 1); const n45 = e57.getImageData(0, 0, t45.width, t45.height); r86 = 0; for (let t46 = 0; t46 < n45.data.length; ++t46) if (t46 % 4 != 3 && r86++ !== n45.data[t46]) return he = true, true; return he = false, false; } }; function fe2(t45, e57) { const r86 = t45.indexOf("?"); if (r86 < 0) return `${t45}?${new URLSearchParams(e57).toString()}`; const n45 = new URLSearchParams(t45.slice(r86)); for (const t46 in e57) n45.set(t46, e57[t46]); return `${t45.slice(0, r86)}?${n45.toString()}`; } function me(t45, e57 = { persistentParams: [] }) { const r86 = t45.indexOf("?"); if (r86 < 0) return t45; const n45 = new URLSearchParams(), i26 = new URLSearchParams(t45.slice(r86)); for (const t46 of e57.persistentParams) { const e58 = i26.get(t46); e58 && n45.set(t46, e58); } const s18 = n45.toString(); return `${t45.slice(0, r86)}${s18.length > 0 ? `?${s18}` : ""}`; } const ye = "mapbox-tiles"; let ge = 500, xe2 = 50; const ve2 = ["language", "worldview", "jobid"]; let be2, we; function _e2() { try { return caches; } catch (t45) { } } function Ae() { const t45 = _e2(); t45 && null == be2 && (be2 = t45.open(ye)); } let Me = 1 / 0; const Ie = { supported: false, testSupport: function(t45) { !ke2 && Pe && (ze ? Te(t45) : Se = t45); } }; let Se, Pe, ke2 = false, ze = false; const Ee = "undefined" != typeof self ? self : {}; function Te(t45) { const e57 = t45.createTexture(); t45.bindTexture(t45.TEXTURE_2D, e57); try { if (t45.texImage2D(t45.TEXTURE_2D, 0, t45.RGBA, t45.RGBA, t45.UNSIGNED_BYTE, Pe), t45.isContextLost()) return; Ie.supported = true; } catch (t46) { } t45.deleteTexture(e57), ke2 = true; } Ee.document && (Pe = Ee.document.createElement("img"), Pe.onload = function() { Se && Te(Se), Se = null, ze = true; }, Pe.onerror = function() { ke2 = true, Se = null; }, Pe.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="); const Be = { Unknown: "Unknown", Style: "Style", Source: "Source", Tile: "Tile", Glyphs: "Glyphs", SpriteImage: "SpriteImage", SpriteJSON: "SpriteJSON", Iconset: "Iconset", Image: "Image", Model: "Model" }; "function" == typeof Object.freeze && Object.freeze(Be); class Ve extends Error { constructor(t45, e57, r86) { 401 === e57 && ie2(r86) && (t45 += ": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"), super(t45), this.status = e57, this.url = r86; } toString() { return `${this.name}: ${this.message} (${this.status}): ${this.url}`; } } const Fe = Zt2() ? () => self.worker.referrer : () => ("blob:" === location.protocol ? parent : self).location.href; const Ce = function(t45, e57) { if (!(/^file:/.test(r86 = t45.url) || /^file:/.test(Fe()) && !/^\w+:/.test(r86))) { if (self.fetch && self.Request && self.AbortController && Request.prototype.hasOwnProperty("signal")) return (function(t46, e58) { const r87 = new AbortController(), n45 = new Request(t46.url, { method: t46.method || "GET", body: t46.body, credentials: t46.credentials, headers: t46.headers, referrer: Fe(), referrerPolicy: t46.referrerPolicy, signal: r87.signal }); let i26 = false, s18 = false; const o88 = (a46 = n45.url).indexOf("sku=") > 0 && ie2(a46); var a46; "json" === t46.type && n45.headers.set("Accept", "application/json"); const l21 = (r88, i27, a47) => { if (s18) return; if (r88 && "SecurityError" !== r88.message && Gt(r88.toString()), i27 && a47) return u12(i27); const l22 = Date.now(); fetch(n45).then(((r89) => { if (r89.ok) { const t47 = o88 ? r89.clone() : null; return u12(r89, t47, l22); } return e58(new Ve(r89.statusText, r89.status, t46.url)); })).catch(((r89) => { "AbortError" !== r89.name && e58(new Error(`${r89.message} ${t46.url}`)); })); }, u12 = (r88, o89, a47) => { ("arrayBuffer" === t46.type ? r88.arrayBuffer() : "json" === t46.type ? r88.json() : r88.text()).then(((t47) => { s18 || (o89 && a47 && (function(t48, e59, r89) { if (Ae(), null == be2) return; const n46 = Wt(e59.headers.get("Cache-Control") || ""); if (n46["no-store"]) return; const i27 = { status: e59.status, statusText: e59.statusText, headers: new Headers() }; e59.headers.forEach(((t49, e60) => i27.headers.set(e60, t49))), n46["max-age"] && i27.headers.set("Expires", new Date(r89 + 1e3 * n46["max-age"]).toUTCString()); const s19 = i27.headers.get("Expires"); if (!s19) return; if (new Date(s19).getTime() - r89 < 42e4) return; let o90 = me(t48.url, { persistentParams: ve2 }); if (206 === e59.status) { const e60 = t48.headers.get("Range"); if (!e60) return; i27.status = 200, o90 = fe2(o90, { range: e60 }); } !(function(t49, e60) { if (void 0 === we) try { new Response(new ReadableStream()), we = true; } catch (t50) { we = false; } we ? e60(t49.body) : t49.blob().then(e60).catch(((t50) => Gt(t50.message))); })(e59, ((t49) => { const r90 = new Response(200 !== (n47 = e59.status) && 404 !== n47 && [101, 103, 204, 205, 304].includes(n47) ? null : t49, i27); var n47; Ae(), null != be2 && be2.then(((t50) => t50.put(o90, r90))).catch(((t50) => Gt(t50.message))); })); })(n45, o89, a47), i26 = true, e58(null, t47, r88.headers.get("Cache-Control"), r88.headers.get("Expires"))); })).catch(((t47) => { s18 || e58(new Error(t47.message)); })); }; return o88 ? (function(t47, e59) { if (Ae(), null == be2) return e59(null); be2.then(((r88) => { let n46 = me(t47.url, { persistentParams: ve2 }); const i27 = t47.headers.get("Range"); i27 && (n46 = fe2(n46, { range: i27 })), r88.match(n46).then(((t48) => { const i28 = (function(t49) { if (!t49) return false; const e60 = new Date(t49.headers.get("Expires") || 0), r89 = Wt(t49.headers.get("Cache-Control") || ""); return Number(e60) > Date.now() && !r89["no-cache"]; })(t48); r88.delete(n46).catch(e59), i28 && r88.put(n46, t48.clone()).catch(e59), e59(null, t48, i28); })).catch(e59); })).catch(e59); })(n45, l21) : l21(null, null), { cancel: () => { s18 = true, i26 || r87.abort(); } }; })(t45, e57); if (Zt2(self) && self.worker.actor) return self.worker.actor.send("getResource", t45, e57, void 0, true); } var r86; return (function(t46, e58) { const r87 = new XMLHttpRequest(); r87.open(t46.method || "GET", t46.url, true), "arrayBuffer" === t46.type && (r87.responseType = "arraybuffer"); for (const e59 in t46.headers) r87.setRequestHeader(e59, t46.headers[e59]); return "json" === t46.type && (r87.responseType = "text", r87.setRequestHeader("Accept", "application/json")), r87.withCredentials = "include" === t46.credentials, r87.onerror = () => { e58(new Error(r87.statusText)); }, r87.onload = () => { if ((r87.status >= 200 && r87.status < 300 || 0 === r87.status) && null !== r87.response) { let n45 = r87.response; if ("json" === t46.type) try { n45 = JSON.parse(r87.response); } catch (t47) { return e58(t47); } e58(null, n45, r87.getResponseHeader("Cache-Control"), r87.getResponseHeader("Expires")); } else e58(new Ve(r87.statusText, r87.status, t46.url)); }, r87.send(t46.body), { cancel: () => r87.abort() }; })(t45, e57); }, De = function(t45, e57) { return Ce(Object.assign(t45, { type: "arrayBuffer" }), e57); }; function Re2(t45) { const e57 = document.createElement("a"); return e57.href = t45, e57.protocol === location.protocol && e57.host === location.host; } const Le = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="; let Oe, Ue; Oe = [], Ue = 0; const Ne = function(t45, e57) { if (Ie.supported && (t45.headers || (t45.headers = {}), t45.headers.accept = "image/webp,*/*"), Ue >= ne2.MAX_PARALLEL_IMAGE_REQUESTS) { const r87 = { requestParameters: t45, callback: e57, cancelled: false, cancel() { this.cancelled = true; } }; return Oe.push(r87), r87; } Ue++; let r86 = false; const n45 = () => { if (!r86) for (r86 = true, Ue--; Oe.length && Ue < ne2.MAX_PARALLEL_IMAGE_REQUESTS; ) { const t46 = Oe.shift(), { requestParameters: e58, callback: r87, cancelled: n46 } = t46; n46 || (t46.cancel = Ne(e58, r87).cancel); } }, i26 = De(t45, ((t46, r87, i27, s18) => { n45(), t46 ? e57(t46) : r87 && (self.createImageBitmap ? (function(t47, e58) { const r88 = new Blob([new Uint8Array(t47)], { type: "image/png" }); createImageBitmap(r88).then(((t48) => { e58(null, t48); })).catch(((t48) => { e58(new Error(`Could not load image because of ${t48.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)); })); })(r87, ((t47, r88) => e57(t47, r88, i27, s18))) : (function(t47, e58) { const r88 = new Image(); r88.onload = () => { e58(null, r88), URL.revokeObjectURL(r88.src), r88.onload = null, requestAnimationFrame((() => { r88.src = Le; })); }, r88.onerror = () => e58(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")); const n46 = new Blob([new Uint8Array(t47)], { type: "image/png" }); r88.src = t47.byteLength ? URL.createObjectURL(n46) : Le; })(r87, ((t47, r88) => e57(t47, r88, i27, s18)))); })); return { cancel: () => { i26.cancel(), n45(); } }; }; var je, $e, Ge, He = { exports: {} }, qe = { exports: {} }, Xe = { exports: {} }, Ze = (function() { if (Ge) return He.exports; Ge = 1; var t45 = (je || (je = 1, qe.exports = function(t46, e58) { var r86, n45, i26, s18, o88, a46, l21, u12; for (n45 = t46.length - (r86 = 3 & t46.length), i26 = e58, o88 = 3432918353, a46 = 461845907, u12 = 0; u12 < n45; ) l21 = 255 & t46.charCodeAt(u12) | (255 & t46.charCodeAt(++u12)) << 8 | (255 & t46.charCodeAt(++u12)) << 16 | (255 & t46.charCodeAt(++u12)) << 24, ++u12, i26 = 27492 + (65535 & (s18 = 5 * (65535 & (i26 = (i26 ^= l21 = (65535 & (l21 = (l21 = (65535 & l21) * o88 + (((l21 >>> 16) * o88 & 65535) << 16) & 4294967295) << 15 | l21 >>> 17)) * a46 + (((l21 >>> 16) * a46 & 65535) << 16) & 4294967295) << 13 | i26 >>> 19)) + ((5 * (i26 >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (s18 >>> 16) & 65535) << 16); switch (l21 = 0, r86) { case 3: l21 ^= (255 & t46.charCodeAt(u12 + 2)) << 16; case 2: l21 ^= (255 & t46.charCodeAt(u12 + 1)) << 8; case 1: i26 ^= l21 = (65535 & (l21 = (l21 = (65535 & (l21 ^= 255 & t46.charCodeAt(u12))) * o88 + (((l21 >>> 16) * o88 & 65535) << 16) & 4294967295) << 15 | l21 >>> 17)) * a46 + (((l21 >>> 16) * a46 & 65535) << 16) & 4294967295; } return i26 ^= t46.length, i26 = 2246822507 * (65535 & (i26 ^= i26 >>> 16)) + ((2246822507 * (i26 >>> 16) & 65535) << 16) & 4294967295, i26 = 3266489909 * (65535 & (i26 ^= i26 >>> 13)) + ((3266489909 * (i26 >>> 16) & 65535) << 16) & 4294967295, (i26 ^= i26 >>> 16) >>> 0; }), qe.exports), e57 = ($e || ($e = 1, Xe.exports = function(t46, e58) { for (var r86, n45 = t46.length, i26 = e58 ^ n45, s18 = 0; n45 >= 4; ) r86 = 1540483477 * (65535 & (r86 = 255 & t46.charCodeAt(s18) | (255 & t46.charCodeAt(++s18)) << 8 | (255 & t46.charCodeAt(++s18)) << 16 | (255 & t46.charCodeAt(++s18)) << 24)) + ((1540483477 * (r86 >>> 16) & 65535) << 16), i26 = 1540483477 * (65535 & i26) + ((1540483477 * (i26 >>> 16) & 65535) << 16) ^ (r86 = 1540483477 * (65535 & (r86 ^= r86 >>> 24)) + ((1540483477 * (r86 >>> 16) & 65535) << 16)), n45 -= 4, ++s18; switch (n45) { case 3: i26 ^= (255 & t46.charCodeAt(s18 + 2)) << 16; case 2: i26 ^= (255 & t46.charCodeAt(s18 + 1)) << 8; case 1: i26 = 1540483477 * (65535 & (i26 ^= 255 & t46.charCodeAt(s18))) + ((1540483477 * (i26 >>> 16) & 65535) << 16); } return i26 = 1540483477 * (65535 & (i26 ^= i26 >>> 13)) + ((1540483477 * (i26 >>> 16) & 65535) << 16), (i26 ^= i26 >>> 15) >>> 0; }), Xe.exports); return He.exports = t45, He.exports.murmur3 = t45, He.exports.murmur2 = e57, He.exports; })(), We = xt(Ze); class Ye { constructor(t45, ...e57) { Object.assign(this, e57[0] || {}), this.type = t45; } } class Ke extends Ye { constructor(t45, e57 = {}) { super("error", Object.assign({ error: t45 }, e57)); } } function Je(t45, e57, r86) { r86[t45] && -1 !== r86[t45].indexOf(e57) || (r86[t45] = r86[t45] || [], r86[t45].push(e57)); } function Qe(t45, e57, r86) { if (r86 && r86[t45]) { const n45 = r86[t45].indexOf(e57); -1 !== n45 && r86[t45].splice(n45, 1); } } class tr { on(t45, e57) { return this._listeners = this._listeners || {}, Je(t45, e57, this._listeners), this; } off(t45, e57) { return Qe(t45, e57, this._listeners), Qe(t45, e57, this._oneTimeListeners), this; } once(t45, e57) { return e57 ? (this._oneTimeListeners = this._oneTimeListeners || {}, Je(t45, e57, this._oneTimeListeners), this) : new Promise(((e58) => { this.once(t45, e58); })); } fire(t45, e57) { const r86 = "string" == typeof t45 ? new Ye(t45, e57) : t45, n45 = r86.type; if (this.listens(n45)) { r86.target = this; const t46 = this._listeners && this._listeners[n45] ? this._listeners[n45].slice() : []; for (const e59 of t46) e59.call(this, r86); const e58 = this._oneTimeListeners && this._oneTimeListeners[n45] ? this._oneTimeListeners[n45].slice() : []; for (const t47 of e58) Qe(n45, t47, this._oneTimeListeners), t47.call(this, r86); const i26 = this._eventedParent; if (i26) { const t47 = "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData; Object.assign(r86, t47), i26.fire(r86); } } else r86 instanceof Ke && console.error(r86.error); return this; } listens(t45) { return !!(this._listeners && this._listeners[t45] && this._listeners[t45].length > 0 || this._oneTimeListeners && this._oneTimeListeners[t45] && this._oneTimeListeners[t45].length > 0 || this._eventedParent && this._eventedParent.listens(t45)); } setEventedParent(t45, e57) { return this._eventedParent = t45, this._eventedParentData = e57, this; } } class er { constructor(t45) { "string" == typeof t45 ? this.name = t45 : (this.name = t45.name, this.iconsetId = t45.iconsetId); } static from(t45) { return new er(t45); } static toString(t45) { return t45.iconsetId ? `${t45.name}${t45.iconsetId}` : t45.name; } static parse(t45) { const [e57, r86] = t45.split(""); return new er({ name: e57, iconsetId: r86 }); } static isEqual(t45, e57) { return t45.name === e57.name && t45.iconsetId === e57.iconsetId; } toString() { return er.toString(this); } serialize() { return { name: this.name, iconsetId: this.iconsetId }; } } var rr2, nr = {}, ir = (function() { if (rr2) return nr; rr2 = 1; var t45 = { 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 e57(t46) { return (t46 = Math.round(t46)) < 0 ? 0 : t46 > 255 ? 255 : t46; } function r86(t46) { return e57("%" === t46[t46.length - 1] ? parseFloat(t46) / 100 * 255 : parseInt(t46)); } function n45(t46) { return (e58 = "%" === t46[t46.length - 1] ? parseFloat(t46) / 100 : parseFloat(t46)) < 0 ? 0 : e58 > 1 ? 1 : e58; var e58; } function i26(t46, e58, r87) { return r87 < 0 ? r87 += 1 : r87 > 1 && (r87 -= 1), 6 * r87 < 1 ? t46 + (e58 - t46) * r87 * 6 : 2 * r87 < 1 ? e58 : 3 * r87 < 2 ? t46 + (e58 - t46) * (2 / 3 - r87) * 6 : t46; } try { nr.parseCSSColor = function(s18) { var o88, a46 = s18.replace(/ /g, "").toLowerCase(); if (a46 in t45) return t45[a46].slice(); if ("#" === a46[0]) return 4 === a46.length ? (o88 = parseInt(a46.substr(1), 16)) >= 0 && o88 <= 4095 ? [(3840 & o88) >> 4 | (3840 & o88) >> 8, 240 & o88 | (240 & o88) >> 4, 15 & o88 | (15 & o88) << 4, 1] : null : 7 === a46.length && (o88 = parseInt(a46.substr(1), 16)) >= 0 && o88 <= 16777215 ? [(16711680 & o88) >> 16, (65280 & o88) >> 8, 255 & o88, 1] : null; var l21 = a46.indexOf("("), u12 = a46.indexOf(")"); if (-1 !== l21 && u12 + 1 === a46.length) { var c28 = a46.substr(0, l21), h8 = a46.substr(l21 + 1, u12 - (l21 + 1)).split(","), p9 = 1; switch (c28) { case "rgba": if (4 !== h8.length) return null; p9 = n45(h8.pop()); case "rgb": return 3 !== h8.length ? null : [r86(h8[0]), r86(h8[1]), r86(h8[2]), p9]; case "hsla": if (4 !== h8.length) return null; p9 = n45(h8.pop()); case "hsl": if (3 !== h8.length) return null; var d34 = (parseFloat(h8[0]) % 360 + 360) % 360 / 360, f8 = n45(h8[1]), m6 = n45(h8[2]), y4 = m6 <= 0.5 ? m6 * (f8 + 1) : m6 + f8 - m6 * f8, g9 = 2 * m6 - y4; return [e57(255 * i26(g9, y4, d34 + 1 / 3)), e57(255 * i26(g9, y4, d34)), e57(255 * i26(g9, y4, d34 - 1 / 3)), p9]; default: return null; } } return null; }; } catch (t46) { } return nr; })(); class sr { constructor(t45, e57, r86, n45 = 1) { this.r = t45, this.g = e57, this.b = r86, this.a = n45; } static parse(t45) { if (!t45) return; if (t45 instanceof sr) return t45; if ("string" != typeof t45) return; const e57 = ir.parseCSSColor(t45); return e57 ? new sr(e57[0] / 255, e57[1] / 255, e57[2] / 255, e57[3]) : void 0; } toString() { const [t45, e57, r86, n45] = [this.r, this.g, this.b, this.a]; return `rgba(${Math.round(255 * t45)},${Math.round(255 * e57)},${Math.round(255 * r86)},${n45})`; } toNonPremultipliedRenderColor(t45) { const { r: e57, g: r86, b: n45, a: i26 } = this; return new ar2(t45, e57, r86, n45, i26); } toPremultipliedRenderColor(t45) { const { r: e57, g: r86, b: n45, a: i26 } = this; return new lr(t45, e57 * i26, r86 * i26, n45 * i26, i26); } clone() { return new sr(this.r, this.g, this.b, this.a); } } class or { constructor(t45, e57, r86, n45, i26, s18 = false) { if (this.premultiplied = false, this.premultiplied = s18, t45) { const s19 = t45.image.height, o88 = s19 * s19; this.premultiplied ? (e57 = 0 === i26 ? 0 : e57 / i26 * (s19 - 1), r86 = 0 === i26 ? 0 : r86 / i26 * (s19 - 1), n45 = 0 === i26 ? 0 : n45 / i26 * (s19 - 1)) : (e57 *= s19 - 1, r86 *= s19 - 1, n45 *= s19 - 1); const a46 = Math.floor(e57), l21 = Math.floor(r86), u12 = Math.floor(n45), c28 = Math.ceil(e57), h8 = Math.ceil(r86), p9 = Math.ceil(n45), d34 = e57 - a46, f8 = r86 - l21, m6 = n45 - u12, y4 = t45.image.data, g9 = 4 * (a46 + l21 * o88 + u12 * s19), x4 = 4 * (a46 + l21 * o88 + p9 * s19), v8 = 4 * (a46 + h8 * o88 + u12 * s19), b8 = 4 * (a46 + h8 * o88 + p9 * s19), w4 = 4 * (c28 + l21 * o88 + u12 * s19), _4 = 4 * (c28 + l21 * o88 + p9 * s19), A4 = 4 * (c28 + h8 * o88 + u12 * s19), M5 = 4 * (c28 + h8 * o88 + p9 * s19); if (g9 < 0 || M5 >= y4.length) throw new Error("out of range"); this.r = ur(ur(ur(y4[g9], y4[x4], m6), ur(y4[v8], y4[b8], m6), f8), ur(ur(y4[w4], y4[_4], m6), ur(y4[A4], y4[M5], m6), f8), d34) / 255 * (this.premultiplied ? i26 : 1), this.g = ur(ur(ur(y4[g9 + 1], y4[x4 + 1], m6), ur(y4[v8 + 1], y4[b8 + 1], m6), f8), ur(ur(y4[w4 + 1], y4[_4 + 1], m6), ur(y4[A4 + 1], y4[M5 + 1], m6), f8), d34) / 255 * (this.premultiplied ? i26 : 1), this.b = ur(ur(ur(y4[g9 + 2], y4[x4 + 2], m6), ur(y4[v8 + 2], y4[b8 + 2], m6), f8), ur(ur(y4[w4 + 2], y4[_4 + 2], m6), ur(y4[A4 + 2], y4[M5 + 2], m6), f8), d34) / 255 * (this.premultiplied ? i26 : 1), this.a = i26; } else this.r = e57, this.g = r86, this.b = n45, this.a = i26; } toArray() { const { r: t45, g: e57, b: r86, a: n45 } = this; return [255 * t45, 255 * e57, 255 * r86, n45]; } toHslaArray() { let { r: t45, g: e57, b: r86, a: n45 } = this; if (this.premultiplied) { if (0 === n45) return [0, 0, 0, 0]; const i27 = 1 / n45; t45 *= i27, e57 *= i27, r86 *= i27; } const i26 = Math.min(Math.max(t45, 0), 1), s18 = Math.min(Math.max(e57, 0), 1), o88 = Math.min(Math.max(r86, 0), 1), a46 = Math.min(i26, s18, o88), l21 = Math.max(i26, s18, o88), u12 = l21 - a46, c28 = 0.5 * (a46 + l21); if (0 === u12) return [0, 0, 100 * c28, n45]; const h8 = c28 > 0.5 ? u12 / (2 - l21 - a46) : u12 / (l21 + a46); let p9; switch (l21) { case i26: p9 = 60 * ((s18 - o88) / u12 + (s18 < o88 ? 6 : 0)); break; case s18: p9 = 60 * ((o88 - i26) / u12 + 2); break; default: p9 = 60 * ((i26 - s18) / u12 + 4); } return [p9, 100 * h8, 100 * c28, n45]; } toArray01() { const { r: t45, g: e57, b: r86, a: n45 } = this; return [t45, e57, r86, n45]; } toArray01Scaled(t45) { const { r: e57, g: r86, b: n45 } = this; return [e57 * t45, r86 * t45, n45 * t45]; } toArray01Linear() { const { r: t45, g: e57, b: r86, a: n45 } = this; return [Math.pow(t45, 2.2), Math.pow(e57, 2.2), Math.pow(r86, 2.2), n45]; } } class ar2 extends or { constructor(t45, e57, r86, n45, i26) { super(t45, e57, r86, n45, i26, false); } } class lr extends or { constructor(t45, e57, r86, n45, i26) { super(t45, e57, r86, n45, i26, true); } } function ur(t45, e57, r86) { return t45 * (1 - r86) + e57 * r86; } function cr(t45, e57, r86) { return t45.map(((t46, n45) => ur(t46, e57[n45], r86))); } sr.black = new sr(0, 0, 0, 1), sr.white = new sr(1, 1, 1, 1), sr.transparent = new sr(0, 0, 0, 0), sr.red = new sr(1, 0, 0, 1), sr.blue = new sr(0, 0, 1, 1); var hr = Object.freeze({ __proto__: null, array: cr, color: function(t45, e57, r86) { return new sr(ur(t45.r, e57.r, r86), ur(t45.g, e57.g, r86), ur(t45.b, e57.b, r86), ur(t45.a, e57.a, r86)); }, number: ur }); class pr extends Error { constructor(t45, e57) { super(e57), this.message = e57, this.key = t45; } } class dr { constructor(t45, e57 = []) { this.parent = t45, this.bindings = {}; for (const [t46, r86] of e57) this.bindings[t46] = r86; } concat(t45) { return new dr(this, t45); } get(t45) { if (this.bindings[t45]) return this.bindings[t45]; if (this.parent) return this.parent.get(t45); throw new Error(`${t45} not found in scope.`); } has(t45) { return !!this.bindings[t45] || !!this.parent && this.parent.has(t45); } } const fr = { kind: "null" }, mr = { kind: "number" }, yr = { kind: "string" }, gr = { kind: "boolean" }, xr = { kind: "color" }, vr = { kind: "object" }, br = { kind: "value" }, wr = { kind: "collator" }, _r = { kind: "formatted" }, Ar = { kind: "resolvedImage" }; function Mr(t45, e57) { return { kind: "array", itemType: t45, N: e57 }; } function Ir(t45) { if ("array" === t45.kind) { const e57 = Ir(t45.itemType); return "number" == typeof t45.N ? `array<${e57}, ${t45.N}>` : "value" === t45.itemType.kind ? "array" : `array<${e57}>`; } return t45.kind; } const Sr = [fr, mr, yr, gr, xr, _r, vr, Mr(br), Ar]; function Pr(t45, e57) { if ("error" === e57.kind) return null; if ("array" === t45.kind) { if ("array" === e57.kind && (0 === e57.N && "value" === e57.itemType.kind || !Pr(t45.itemType, e57.itemType)) && ("number" != typeof t45.N || t45.N === e57.N)) return null; } else { if (t45.kind === e57.kind) return null; if ("value" === t45.kind) { for (const t46 of Sr) if (!Pr(t46, e57)) return null; } } return `Expected ${Ir(t45)} but found ${Ir(e57)} instead.`; } function kr(t45, e57) { return e57.some(((e58) => e58.kind === t45.kind)); } function zr(t45, e57) { return e57.some(((e58) => "null" === e58 ? null === t45 : "array" === e58 ? Array.isArray(t45) : "object" === e58 ? t45 && !Array.isArray(t45) && "object" == typeof t45 : e58 === typeof t45)); } function Er(t45, e57) { return "array" === t45.kind && "array" === e57.kind ? t45.N === e57.N && Er(t45.itemType, e57.itemType) : t45.kind === e57.kind; } class Tr { constructor(t45, e57, r86) { this.sensitivity = t45 ? e57 ? "variant" : "case" : e57 ? "accent" : "base", this.locale = r86, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" }); } compare(t45, e57) { return this.collator.compare(t45, e57); } resolvedLocale() { return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale; } } class Br { constructor(t45, e57, r86, n45, i26) { this.text = t45.normalize ? t45.normalize() : t45, this.image = e57, this.scale = r86, this.fontStack = n45, this.textColor = i26; } } class Vr { constructor(t45) { this.sections = t45; } static fromString(t45) { return new Vr([new Br(t45, null, null, null, null)]); } isEmpty() { return 0 === this.sections.length || !this.sections.some(((t45) => 0 !== t45.text.length || !!t45.image && t45.image.hasPrimary())); } static factory(t45) { return t45 instanceof Vr ? t45 : Vr.fromString(t45); } toString() { return 0 === this.sections.length ? "" : this.sections.map(((t45) => t45.text)).join(""); } serialize() { const t45 = ["format"]; for (const e57 of this.sections) { if (e57.image) { const r87 = e57.image.getPrimary().id.toString(); t45.push(["image", r87]); continue; } t45.push(e57.text); const r86 = {}; e57.fontStack && (r86["text-font"] = ["literal", e57.fontStack.split(",")]), e57.scale && (r86["font-scale"] = e57.scale), e57.textColor && (r86["text-color"] = ["rgba"].concat(e57.textColor.toNonPremultipliedRenderColor(null).toArray())), t45.push(r86); } return t45; } } class Fr { constructor(t45, e57 = {}) { if (this.id = er.from(t45), this.options = Object.assign({}, e57), e57.transform) { const { a: t46, b: r86, c: n45, d: i26, e: s18, f: o88 } = e57.transform; this.options.transform = new DOMMatrix([t46, r86, n45, i26, s18, o88]); } else this.options.transform = new DOMMatrix([1, 0, 0, 1, 0, 0]); } toString() { const { a: t45, b: e57, c: r86, d: n45, e: i26, f: s18 } = this.options.transform; return JSON.stringify({ name: this.id.name, iconsetId: this.id.iconsetId, params: this.options.params, transform: { a: t45, b: e57, c: r86, d: n45, e: i26, f: s18 } }); } static parse(t45) { let e57, r86, n45, i26; try { ({ name: e57, iconsetId: r86, params: n45, transform: i26 } = JSON.parse(t45) || {}); } catch (t46) { return null; } if (!e57) return null; const { a: s18, b: o88, c: a46, d: l21, e: u12, f: c28 } = i26 || {}; return new Fr({ name: e57, iconsetId: r86 }, { params: n45, transform: new DOMMatrix([s18, o88, a46, l21, u12, c28]) }); } scaleSelf(t45, e57) { return this.options.transform.scaleSelf(t45, e57), this; } } class Cr { constructor(t45, e57, r86, n45, i26 = false) { this.primaryId = er.from(t45), this.primaryOptions = e57, r86 && (this.secondaryId = er.from(r86)), this.secondaryOptions = n45, this.available = i26; } toString() { return this.primaryId && this.secondaryId ? `[${this.primaryId.name},${this.secondaryId.name}]` : this.primaryId.name; } hasPrimary() { return !!this.primaryId; } getPrimary() { return new Fr(this.primaryId, this.primaryOptions); } hasSecondary() { return !!this.secondaryId; } getSecondary() { return this.secondaryId ? new Fr(this.secondaryId, this.secondaryOptions) : null; } static from(t45) { return "string" == typeof t45 ? Cr.build({ name: t45 }) : t45; } static build(t45, e57, r86, n45) { return !t45 || "object" == typeof t45 && !("name" in t45) ? null : new Cr(t45, r86, e57, n45); } } function Dr(t45, e57, r86, n45) { return "number" == typeof t45 && t45 >= 0 && t45 <= 255 && "number" == typeof e57 && e57 >= 0 && e57 <= 255 && "number" == typeof r86 && r86 >= 0 && r86 <= 255 ? void 0 === n45 || "number" == typeof n45 && n45 >= 0 && n45 <= 1 ? null : `Invalid rgba value [${[t45, e57, r86, n45].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid rgba value [${("number" == typeof n45 ? [t45, e57, r86, n45] : [t45, e57, r86]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`; } function Rr(t45) { if (null === t45) return true; if ("string" == typeof t45) return true; if ("boolean" == typeof t45) return true; if ("number" == typeof t45) return true; if (t45 instanceof sr) return true; if (t45 instanceof Tr) return true; if (t45 instanceof Vr) return true; if (t45 instanceof Cr) return true; if (Array.isArray(t45)) { for (const e57 of t45) if (!Rr(e57)) return false; return true; } if ("object" == typeof t45) { for (const e57 in t45) if (!Rr(t45[e57])) return false; return true; } return false; } function Lr(t45) { if (null === t45) return fr; if ("string" == typeof t45) return yr; if ("boolean" == typeof t45) return gr; if ("number" == typeof t45) return mr; if (t45 instanceof sr) return xr; if (t45 instanceof Tr) return wr; if (t45 instanceof Vr) return _r; if (t45 instanceof Cr) return Ar; if (Array.isArray(t45)) { const e57 = t45.length; let r86; for (const e58 of t45) { const t46 = Lr(e58); if (r86) { if (r86 === t46) continue; r86 = br; break; } r86 = t46; } return Mr(r86 || br, e57); } return vr; } function Or(t45) { const e57 = typeof t45; return null === t45 ? "" : "string" === e57 || "number" === e57 || "boolean" === e57 ? String(t45) : t45 instanceof Vr || t45 instanceof Cr || t45 instanceof sr ? t45.toString() : JSON.stringify(t45); } class Ur { constructor(t45, e57) { this.type = t45, this.value = e57; } static parse(t45, e57) { if (2 !== t45.length) return e57.error(`'literal' expression requires exactly one argument, but found ${t45.length - 1} instead.`); if (!Rr(t45[1])) return e57.error("invalid value"); const r86 = t45[1]; let n45 = Lr(r86); const i26 = e57.expectedType; return "array" !== n45.kind || 0 !== n45.N || !i26 || "array" !== i26.kind || "number" == typeof i26.N && 0 !== i26.N || (n45 = i26), new Ur(n45, r86); } evaluate() { return this.value; } eachChild() { } outputDefined() { return true; } serialize() { return "array" === this.type.kind || "object" === this.type.kind ? ["literal", this.value] : this.value instanceof sr ? ["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()) : this.value instanceof Vr ? this.value.serialize() : this.value; } } class Nr { constructor(t45) { this.name = "ExpressionEvaluationError", this.message = t45; } toJSON() { return this.message; } } const jr = { string: yr, number: mr, boolean: gr, object: vr }; class $r { constructor(t45, e57) { this.type = t45, this.args = e57; } static parse(t45, e57) { if (t45.length < 2) return e57.error("Expected at least one argument."); let r86, n45 = 1; const i26 = t45[0]; if ("array" === i26) { let i27, s19; if (t45.length > 2) { const r87 = t45[1]; if ("string" != typeof r87 || !(r87 in jr) || "object" === r87) return e57.error('The item type argument of "array" must be one of string, number, boolean', 1); i27 = jr[r87], n45++; } else i27 = br; if (t45.length > 3) { if (null !== t45[2] && ("number" != typeof t45[2] || t45[2] < 0 || t45[2] !== Math.floor(t45[2]))) return e57.error('The length argument to "array" must be a positive integer literal', 2); s19 = t45[2], n45++; } r86 = Mr(i27, s19); } else r86 = jr[i26]; const s18 = []; for (; n45 < t45.length; n45++) { const r87 = e57.parse(t45[n45], n45, br); if (!r87) return null; s18.push(r87); } return new $r(r86, s18); } evaluate(t45) { for (let e57 = 0; e57 < this.args.length; e57++) { const r86 = this.args[e57].evaluate(t45); if (!Pr(this.type, Lr(r86))) return r86; if (e57 === this.args.length - 1) throw new Nr(`The expression ${JSON.stringify(this.args[e57].serialize())} evaluated to ${Ir(Lr(r86))} but was expected to be of type ${Ir(this.type)}.`); } return null; } eachChild(t45) { this.args.forEach(t45); } outputDefined() { return this.args.every(((t45) => t45.outputDefined())); } serialize() { const t45 = this.type, e57 = [t45.kind]; if ("array" === t45.kind) { const r86 = t45.itemType; if ("string" === r86.kind || "number" === r86.kind || "boolean" === r86.kind) { e57.push(r86.kind); const n45 = t45.N; ("number" == typeof n45 || this.args.length > 1) && e57.push(n45); } } return e57.concat(this.args.map(((t46) => t46.serialize()))); } } class Gr { constructor(t45) { this.type = _r, this.sections = t45; } static parse(t45, e57) { if (t45.length < 2) return e57.error("Expected at least one argument."); const r86 = t45[1]; if (!Array.isArray(r86) && "object" == typeof r86) return e57.error("First argument must be an image or text section."); const n45 = []; let i26 = false; for (let r87 = 1; r87 <= t45.length - 1; ++r87) { const s18 = t45[r87]; if (i26 && "object" == typeof s18 && !Array.isArray(s18)) { i26 = false; let t46 = null; if (s18["font-scale"] && (t46 = e57.parseObjectValue(s18["font-scale"], r87, "font-scale", mr), !t46)) return null; let o88 = null; if (s18["text-font"] && (o88 = e57.parseObjectValue(s18["text-font"], r87, "text-font", Mr(yr)), !o88)) return null; let a46 = null; if (s18["text-color"] && (a46 = e57.parseObjectValue(s18["text-color"], r87, "text-color", xr), !a46)) return null; const l21 = n45[n45.length - 1]; l21.scale = t46, l21.font = o88, l21.textColor = a46; } else { const s19 = e57.parse(t45[r87], r87, br); if (!s19) return null; const o88 = s19.type.kind; if ("string" !== o88 && "value" !== o88 && "null" !== o88 && "resolvedImage" !== o88) return e57.error("Formatted text type must be 'string', 'value', 'image' or 'null'."); i26 = true, n45.push({ content: s19, scale: null, font: null, textColor: null }); } } return new Gr(n45); } evaluate(t45) { return new Vr(this.sections.map(((e57) => { const r86 = e57.content.evaluate(t45); return Er(Lr(r86), Ar) ? new Br("", r86, null, null, null) : new Br(Or(r86), null, e57.scale ? e57.scale.evaluate(t45) : null, e57.font ? e57.font.evaluate(t45).join(",") : null, e57.textColor ? e57.textColor.evaluate(t45) : null); }))); } eachChild(t45) { for (const e57 of this.sections) t45(e57.content), e57.scale && t45(e57.scale), e57.font && t45(e57.font), e57.textColor && t45(e57.textColor); } outputDefined() { return false; } serialize() { const t45 = ["format"]; for (const e57 of this.sections) { t45.push(e57.content.serialize()); const r86 = {}; e57.scale && (r86["font-scale"] = e57.scale.serialize()), e57.font && (r86["text-font"] = e57.font.serialize()), e57.textColor && (r86["text-color"] = e57.textColor.serialize()), t45.push(r86); } return t45; } } class Hr { constructor(t45, e57, r86, n45) { this._imageWarnHistory = {}, this.type = Ar, this.namePrimary = t45, this.nameSecondary = e57, r86 && (this.paramsPrimary = r86.params, this.iconsetIdPrimary = r86.iconset ? r86.iconset.id : void 0), n45 && (this.paramsSecondary = n45.params, this.iconsetIdSecondary = n45.iconset ? n45.iconset.id : void 0); } static parse(t45, e57) { if (t45.length < 2) return e57.error("Expected two or more arguments."); let r86 = 1; const n45 = []; function i26() { if (r86 < t45.length) { const i27 = e57.parse(t45[r86], r86++, yr); return i27 ? (n45.push({ image: i27, options: {} }), true) : (e57.error(n45.length ? "Secondary image variant is not a string." : "No image name provided."), false); } return true; } function s18() { if (r86 < t45.length) { const s19 = t45[r86]; if (null === (i27 = s19) || "object" != typeof i27 || Array.isArray(i27)) return true; const o88 = s19.params, a46 = s19.iconset, l21 = e57.concat(r86); if (!o88 && !a46) return r86++, true; if (o88) { if ("object" != typeof o88 || o88.constructor !== Object) return l21.error('Image options "params" should be an object'), false; const t46 = {}, e58 = l21.concat(void 0, "params"); for (const r87 in o88) { if (!r87) return e58.error("Image parameter name should be non-empty"), false; const n46 = e58.concat(void 0, r87).parse(o88[r87], void 0, xr, void 0, { typeAnnotation: "coerce" }); if (!n46) return false; t46[r87] = n46; } n45[n45.length - 1].options.params = t46; } if (a46) { if ("object" != typeof a46 || a46.constructor !== Object) return l21.error('Image options "iconset" should be an object'), false; if (!a46.id) return l21.error('Image options "iconset" should have an "id" property'), false; n45[n45.length - 1].options.iconset = a46; } return r86++, true; } var i27; return true; } for (let t46 = 0; t46 < 2; t46++) if (!i26() || !s18()) return; return new Hr(n45[0].image, n45[1] ? n45[1].image : void 0, n45[0].options, n45[1] ? n45[1].options : void 0); } evaluateParams(t45, e57) { const r86 = {}; if (e57) { for (const n45 in e57) if (e57[n45]) try { r86[n45] = e57[n45].evaluate(t45); } catch (t46) { continue; } if (0 !== Object.keys(r86).length) return { params: r86 }; } } evaluate(t45) { const e57 = { name: this.namePrimary.evaluate(t45), iconsetId: this.iconsetIdPrimary }, r86 = this.nameSecondary ? { name: this.nameSecondary.evaluate(t45), iconsetId: this.iconsetIdSecondary } : void 0, n45 = Cr.build(e57, r86, this.paramsPrimary ? this.evaluateParams(t45, this.paramsPrimary) : void 0, this.paramsSecondary ? this.evaluateParams(t45, this.paramsSecondary) : void 0); if (n45 && t45.availableImages) { const e58 = n45.getPrimary().id; if (n45.available = t45.availableImages.some(((t46) => er.isEqual(t46, e58))), n45.available) { const e59 = n45.getSecondary() ? n45.getSecondary().id : null; e59 && (n45.available = t45.availableImages.some(((t46) => er.isEqual(t46, e59)))); } } return n45; } eachChild(t45) { if (t45(this.namePrimary), this.paramsPrimary) for (const e57 in this.paramsPrimary) this.paramsPrimary[e57] && t45(this.paramsPrimary[e57]); if (this.nameSecondary && (t45(this.nameSecondary), this.paramsSecondary)) for (const e57 in this.paramsSecondary) this.paramsSecondary[e57] && t45(this.paramsSecondary[e57]); } outputDefined() { return false; } serializeOptions(t45, e57) { const r86 = {}; if (e57 && (r86.iconset = { id: e57 }), t45) { r86.params = {}; for (const e58 in t45) t45[e58] && (r86.params[e58] = t45[e58].serialize()); } return Object.keys(r86).length > 0 ? r86 : void 0; } serialize() { const t45 = ["image", this.namePrimary.serialize()]; if (this.paramsPrimary || this.iconsetIdPrimary) { const e57 = this.serializeOptions(this.paramsPrimary, this.iconsetIdPrimary); e57 && t45.push(e57); } if (this.nameSecondary && (t45.push(this.nameSecondary.serialize()), this.paramsSecondary || this.iconsetIdSecondary)) { const e57 = this.serializeOptions(this.paramsSecondary, this.iconsetIdSecondary); e57 && t45.push(e57); } return t45; } } function qr(t45) { return Zr(t45) ? "string" : Wr(t45) ? "number" : Yr(t45) ? "boolean" : Array.isArray(t45) ? "array" : null === t45 ? "null" : Xr(t45) ? "object" : typeof t45; } function Xr(t45) { return null != t45 && !Array.isArray(t45) && "function" != typeof t45 && !(t45 instanceof String || t45 instanceof Number || t45 instanceof Boolean) && "object" == typeof t45; } function Zr(t45) { return "string" == typeof t45 || t45 instanceof String; } function Wr(t45) { return "number" == typeof t45 || t45 instanceof Number; } function Yr(t45) { return "boolean" == typeof t45 || t45 instanceof Boolean; } const Kr = { "to-boolean": gr, "to-color": xr, "to-number": mr, "to-string": yr }; class Jr { constructor(t45, e57) { this.type = t45, this.args = e57; } static parse(t45, e57) { if (t45.length < 2) return e57.error("Expected at least one argument."); const r86 = t45[0], n45 = []; let i26 = fr; if ("to-array" === r86) { if (!Array.isArray(t45[1])) return null; const r87 = t45[1].length; if (e57.expectedType) { if ("array" !== e57.expectedType.kind) return e57.error(`Expected ${e57.expectedType.kind} but found array.`); i26 = Mr(e57.expectedType.itemType, r87); } else { if (!(r87 > 0 && Rr(t45[1][0]))) return null; i26 = Mr(Lr(t45[1][0]), r87); } for (let s18 = 0; s18 < r87; s18++) { const r88 = t45[1][s18]; let o88; if (Array.isArray(r88)) o88 = e57.parse(r88, void 0, i26.itemType); else { const t46 = qr(r88); if (t46 !== i26.itemType.kind) return e57.error(`Expected ${i26.itemType.kind} but found ${t46}.`); o88 = e57.registry.literal.parse(["literal", void 0 === r88 ? null : r88], e57); } if (!o88) return null; n45.push(o88); } } else { if (("to-boolean" === r86 || "to-string" === r86) && 2 !== t45.length) return e57.error("Expected one argument."); i26 = Kr[r86]; for (let r87 = 1; r87 < t45.length; r87++) { const i27 = e57.parse(t45[r87], r87, br); if (!i27) return null; n45.push(i27); } } return new Jr(i26, n45); } evaluate(t45) { if ("boolean" === this.type.kind) return Boolean(this.args[0].evaluate(t45)); if ("color" === this.type.kind) { let e57, r86; for (const n45 of this.args) { if (e57 = n45.evaluate(t45), r86 = null, e57 instanceof sr) return e57; if ("string" == typeof e57) { const r87 = t45.parseColor(e57); if (r87) return r87; } else if (Array.isArray(e57) && (r86 = e57.length < 3 || e57.length > 4 ? `Invalid rbga value ${JSON.stringify(e57)}: expected an array containing either three or four numeric values.` : Dr(e57[0], e57[1], e57[2], e57[3]), !r86)) return new sr(e57[0] / 255, e57[1] / 255, e57[2] / 255, e57[3]); } throw new Nr(r86 || `Could not parse color from value '${"string" == typeof e57 ? e57 : String(JSON.stringify(e57))}'`); } if ("number" === this.type.kind) { let e57 = null; for (const r86 of this.args) { if (e57 = r86.evaluate(t45), null === e57) return 0; const n45 = Number(e57); if (!isNaN(n45)) return n45; } throw new Nr(`Could not convert ${JSON.stringify(e57)} to number.`); } return "formatted" === this.type.kind ? Vr.fromString(Or(this.args[0].evaluate(t45))) : "resolvedImage" === this.type.kind ? Cr.build(Or(this.args[0].evaluate(t45))) : "array" === this.type.kind ? this.args.map(((e57) => e57.evaluate(t45))) : Or(this.args[0].evaluate(t45)); } eachChild(t45) { this.args.forEach(t45); } outputDefined() { return this.args.every(((t45) => t45.outputDefined())); } serialize() { if ("formatted" === this.type.kind) return new Gr([{ content: this.args[0], scale: null, font: null, textColor: null }]).serialize(); if ("resolvedImage" === this.type.kind) return new Hr(this.args[0]).serialize(); const t45 = "array" === this.type.kind ? [] : [`to-${this.type.kind}`]; return this.eachChild(((e57) => { t45.push(e57.serialize()); })), t45; } } const Qr = ["Unknown", "Point", "LineString", "Polygon"]; class tn { constructor(t45, e57, r86) { 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, this.scope = t45, this.options = e57, this.iconImageUseTheme = r86; } id() { return this.feature && void 0 !== this.feature.id ? this.feature.id : null; } geometryType() { return this.feature ? "number" == typeof this.feature.type ? Qr[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 || {}; } measureLight(t45) { return this.globals.brightness || 0; } distanceFromCenter() { if (this.featureTileCoord && this.featureDistanceData) { const t45 = this.featureDistanceData.center, e57 = this.featureDistanceData.scale, { x: r86, y: n45 } = this.featureTileCoord; return this.featureDistanceData.bearing[0] * (r86 * e57 - t45[0]) + this.featureDistanceData.bearing[1] * (n45 * e57 - t45[1]); } return 0; } parseColor(t45) { let e57 = this._parseColorCache[t45]; return e57 || (e57 = this._parseColorCache[t45] = sr.parse(t45)), e57; } getConfig(t45) { return this.options ? this.options.get(t45) : null; } } class en { constructor(t45, e57, r86, n45, i26) { this.name = t45, this.type = e57, this._evaluate = r86, this.args = n45, this._overloadIndex = i26; } evaluate(t45) { if (!this._evaluate) { const t46 = en.definitions[this.name]; this._evaluate = Array.isArray(t46) ? t46[2] : t46.overloads[this._overloadIndex][1]; } return this._evaluate(t45, this.args); } eachChild(t45) { this.args.forEach(t45); } outputDefined() { return false; } serialize() { return [this.name].concat(this.args.map(((t45) => t45.serialize()))); } static parse(t45, e57) { const r86 = t45[0], n45 = en.definitions[r86]; if (!n45) return e57.error(`Unknown expression "${r86}". If you wanted a literal array, use ["literal", [...]].`, 0); const i26 = Array.isArray(n45) ? n45[0] : n45.type, s18 = Array.isArray(n45) ? [[n45[1], n45[2]]] : n45.overloads, o88 = []; let a46 = null, l21 = -1; for (const [n46, u12] of s18) { if (Array.isArray(n46) && n46.length !== t45.length - 1) continue; o88.push(n46), l21++, a46 = new Ai(e57.registry, e57.path, null, e57.scope, void 0, e57._scope, e57.options, e57.iconImageUseTheme); const s19 = []; let c28 = false; for (let e58 = 1; e58 < t45.length; e58++) { const r87 = t45[e58], i27 = Array.isArray(n46) ? n46[e58 - 1] : n46.type, o89 = a46.parse(r87, 1 + s19.length, i27); if (!o89) { c28 = true; break; } s19.push(o89); } if (!c28) if (Array.isArray(n46) && n46.length !== s19.length) a46.error(`Expected ${n46.length} arguments, but found ${s19.length} instead.`); else { for (let t46 = 0; t46 < s19.length; t46++) { const e58 = Array.isArray(n46) ? n46[t46] : n46.type, r87 = s19[t46]; a46.concat(t46 + 1).checkSubtype(e58, r87.type); } if (0 === a46.errors.length) return new en(r86, i26, u12, s19, l21); } } if (1 === o88.length) e57.errors.push(...a46.errors); else { const r87 = (o88.length ? o88 : s18.map((([t46]) => t46))).map(rn).join(" | "), n46 = []; for (let r88 = 1; r88 < t45.length; r88++) { const i27 = e57.parse(t45[r88], 1 + n46.length); if (!i27) return null; n46.push(Ir(i27.type)); } e57.error(`Expected arguments of type ${r87}, but found (${n46.join(", ")}) instead.`); } return null; } static register(t45, e57) { en.definitions = e57; for (const r86 in e57) t45[r86] = en; } } function rn(t45) { return Array.isArray(t45) ? `(${t45.map(Ir).join(", ")})` : `(${Ir(t45.type)}...)`; } class nn { constructor(t45, e57, r86) { this.type = wr, this.locale = r86, this.caseSensitive = t45, this.diacriticSensitive = e57; } static parse(t45, e57) { if (2 !== t45.length) return e57.error("Expected one argument."); const r86 = t45[1]; if ("object" != typeof r86 || Array.isArray(r86)) return e57.error("Collator options argument must be an object."); const n45 = void 0 === r86["case-sensitive"] ? e57.parse(false, 1, gr) : e57.parseObjectValue(r86["case-sensitive"], 1, "case-sensitive", gr); if (!n45) return null; const i26 = void 0 === r86["diacritic-sensitive"] ? e57.parse(false, 1, gr) : e57.parseObjectValue(r86["diacritic-sensitive"], 1, "diacritic-sensitive", gr); if (!i26) return null; let s18 = null; return r86.locale && (s18 = e57.parseObjectValue(r86.locale, 1, "locale", yr), !s18) ? null : new nn(n45, i26, s18); } evaluate(t45) { return new Tr(this.caseSensitive.evaluate(t45), this.diacriticSensitive.evaluate(t45), this.locale ? this.locale.evaluate(t45) : null); } eachChild(t45) { t45(this.caseSensitive), t45(this.diacriticSensitive), this.locale && t45(this.locale); } outputDefined() { return false; } serialize() { const t45 = {}; return t45["case-sensitive"] = this.caseSensitive.serialize(), t45["diacritic-sensitive"] = this.diacriticSensitive.serialize(), this.locale && (t45.locale = this.locale.serialize()), ["collator", t45]; } } function sn(t45, e57, r86 = 0, n45 = t45.length - 1, i26 = an) { for (; n45 > r86; ) { if (n45 - r86 > 600) { const s19 = n45 - r86 + 1, o89 = e57 - r86 + 1, a47 = Math.log(s19), l21 = 0.5 * Math.exp(2 * a47 / 3), u12 = 0.5 * Math.sqrt(a47 * l21 * (s19 - l21) / s19) * (o89 - s19 / 2 < 0 ? -1 : 1); sn(t45, e57, Math.max(r86, Math.floor(e57 - o89 * l21 / s19 + u12)), Math.min(n45, Math.floor(e57 + (s19 - o89) * l21 / s19 + u12)), i26); } const s18 = t45[e57]; let o88 = r86, a46 = n45; for (on(t45, r86, e57), i26(t45[n45], s18) > 0 && on(t45, r86, n45); o88 < a46; ) { for (on(t45, o88, a46), o88++, a46--; i26(t45[o88], s18) < 0; ) o88++; for (; i26(t45[a46], s18) > 0; ) a46--; } 0 === i26(t45[r86], s18) ? on(t45, r86, a46) : (a46++, on(t45, a46, n45)), a46 <= e57 && (r86 = a46 + 1), e57 <= a46 && (n45 = a46 - 1); } } function on(t45, e57, r86) { const n45 = t45[e57]; t45[e57] = t45[r86], t45[r86] = n45; } function an(t45, e57) { return t45 < e57 ? -1 : t45 > e57 ? 1 : 0; } function ln(t45) { let e57 = 0; for (let r86, n45, i26 = 0, s18 = t45.length, o88 = s18 - 1; i26 < s18; o88 = i26++) r86 = t45[i26], n45 = t45[o88], e57 += (n45.x - r86.x) * (r86.y + n45.y); return e57; } function un(t45, e57) { t45[0] = Math.min(t45[0], e57[0]), t45[1] = Math.min(t45[1], e57[1]), t45[2] = Math.max(t45[2], e57[0]), t45[3] = Math.max(t45[3], e57[1]); } function cn(t45, e57) { return !(t45[0] <= e57[0] || t45[2] >= e57[2] || t45[1] <= e57[1] || t45[3] >= e57[3]); } function hn(t45, e57, r86) { const n45 = t45[0] - e57[0], i26 = t45[1] - e57[1], s18 = t45[0] - r86[0], o88 = t45[1] - r86[1]; return n45 * o88 - s18 * i26 == 0 && n45 * s18 <= 0 && i26 * o88 <= 0; } function pn(t45, e57, r86 = false) { let n45 = false; for (let a46 = 0, l21 = e57.length; a46 < l21; a46++) { const l22 = e57[a46]; for (let e58 = 0, a47 = l22.length, u12 = a47 - 1; e58 < a47; u12 = e58++) { const a48 = l22[u12], c28 = l22[e58]; if (hn(t45, a48, c28)) return r86; (s18 = a48)[1] > (i26 = t45)[1] != (o88 = c28)[1] > i26[1] && i26[0] < (o88[0] - s18[0]) * (i26[1] - s18[1]) / (o88[1] - s18[1]) + s18[0] && (n45 = !n45); } } var i26, s18, o88; return n45; } function dn(t45, e57, r86, n45) { const i26 = n45[0] - r86[0], s18 = n45[1] - r86[1], o88 = (t45[0] - r86[0]) * s18 - i26 * (t45[1] - r86[1]), a46 = (e57[0] - r86[0]) * s18 - i26 * (e57[1] - r86[1]); return o88 > 0 && a46 < 0 || o88 < 0 && a46 > 0; } function fn(t45, e57, r86, n45) { return 0 != (i26 = [n45[0] - r86[0], n45[1] - r86[1]])[0] * (s18 = [e57[0] - t45[0], e57[1] - t45[1]])[1] - i26[1] * s18[0] && !(!dn(t45, e57, r86, n45) || !dn(r86, n45, t45, e57)); var i26, s18; } function mn(t45) { const e57 = new wt(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), r86 = new wt(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); for (const n45 of t45[0]) e57.x > n45.x && (e57.x = n45.x), e57.y > n45.y && (e57.y = n45.y), r86.x < n45.x && (r86.x = n45.x), r86.y < n45.y && (r86.y = n45.y); return { min: e57, max: r86 }; } const yn = 8192; function gn(t45, e57) { const r86 = (180 + t45[0]) / 360, n45 = (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t45[1] * Math.PI / 360))) / 360, i26 = Math.pow(2, e57.z); return [Math.round(r86 * i26 * yn), Math.round(n45 * i26 * yn)]; } function xn(t45, e57) { for (let r86 = 0; r86 < e57.length; r86++) if (pn(t45, e57[r86])) return true; return false; } function vn(t45, e57, r86) { for (const n45 of r86) for (let r87 = 0, i26 = n45.length, s18 = i26 - 1; r87 < i26; s18 = r87++) if (fn(t45, e57, n45[s18], n45[r87])) return true; return false; } function bn(t45, e57) { for (let r86 = 0; r86 < t45.length; ++r86) if (!pn(t45[r86], e57)) return false; for (let r86 = 0; r86 < t45.length - 1; ++r86) if (vn(t45[r86], t45[r86 + 1], e57)) return false; return true; } function wn(t45, e57) { for (let r86 = 0; r86 < e57.length; r86++) if (bn(t45, e57[r86])) return true; return false; } function _n(t45, e57, r86) { const n45 = []; for (let i26 = 0; i26 < t45.length; i26++) { const s18 = []; for (let n46 = 0; n46 < t45[i26].length; n46++) { const o88 = gn(t45[i26][n46], r86); un(e57, o88), s18.push(o88); } n45.push(s18); } return n45; } function An(t45, e57, r86) { const n45 = []; for (let i26 = 0; i26 < t45.length; i26++) { const s18 = _n(t45[i26], e57, r86); n45.push(s18); } return n45; } function Mn(t45, e57, r86, n45) { if (t45[0] < r86[0] || t45[0] > r86[2]) { const e58 = 0.5 * n45; let i26 = t45[0] - r86[0] > e58 ? -n45 : r86[0] - t45[0] > e58 ? n45 : 0; 0 === i26 && (i26 = t45[0] - r86[2] > e58 ? -n45 : r86[2] - t45[0] > e58 ? n45 : 0), t45[0] += i26; } un(e57, t45); } function In(t45, e57, r86, n45) { const i26 = Math.pow(2, n45.z) * yn, s18 = [n45.x * yn, n45.y * yn], o88 = []; if (!t45) return o88; for (const n46 of t45) for (const t46 of n46) { const n47 = [t46.x + s18[0], t46.y + s18[1]]; Mn(n47, e57, r86, i26), o88.push(n47); } return o88; } function Sn(t45, e57, r86, n45) { const i26 = Math.pow(2, n45.z) * yn, s18 = [n45.x * yn, n45.y * yn], o88 = []; if (!t45) return o88; for (const r87 of t45) { const t46 = []; for (const n46 of r87) { const r88 = [n46.x + s18[0], n46.y + s18[1]]; un(e57, r88), t46.push(r88); } o88.push(t46); } if (e57[2] - e57[0] <= i26 / 2) { (a46 = e57)[0] = a46[1] = 1 / 0, a46[2] = a46[3] = -1 / 0; for (const t46 of o88) for (const n46 of t46) Mn(n46, e57, r86, i26); } var a46; return o88; } class Pn { constructor(t45, e57) { this.type = gr, this.geojson = t45, this.geometries = e57; } static parse(t45, e57) { if (2 !== t45.length) return e57.error(`'within' expression requires exactly one argument, but found ${t45.length - 1} instead.`); if (Rr(t45[1])) { const e58 = t45[1]; if ("FeatureCollection" === e58.type) for (let t46 = 0; t46 < e58.features.length; ++t46) { const r86 = e58.features[t46].geometry.type; if ("Polygon" === r86 || "MultiPolygon" === r86) return new Pn(e58, e58.features[t46].geometry); } else if ("Feature" === e58.type) { const t46 = e58.geometry.type; if ("Polygon" === t46 || "MultiPolygon" === t46) return new Pn(e58, e58.geometry); } else if ("Polygon" === e58.type || "MultiPolygon" === e58.type) return new Pn(e58, e58); } return e57.error("'within' expression requires valid geojson object that contains polygon geometry type."); } evaluate(t45) { if (null != t45.geometry() && null != t45.canonicalID()) { if ("Point" === t45.geometryType()) return (function(t46, e57) { const r86 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n45 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i26 = t46.canonicalID(); if (!i26) return false; if ("Polygon" === e57.type) { const s18 = _n(e57.coordinates, n45, i26), o88 = In(t46.geometry(), r86, n45, i26); if (!cn(r86, n45)) return false; for (const t47 of o88) if (!pn(t47, s18)) return false; } if ("MultiPolygon" === e57.type) { const s18 = An(e57.coordinates, n45, i26), o88 = In(t46.geometry(), r86, n45, i26); if (!cn(r86, n45)) return false; for (const t47 of o88) if (!xn(t47, s18)) return false; } return true; })(t45, this.geometries); if ("LineString" === t45.geometryType()) return (function(t46, e57) { const r86 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], n45 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], i26 = t46.canonicalID(); if (!i26) return false; if ("Polygon" === e57.type) { const s18 = _n(e57.coordinates, n45, i26), o88 = Sn(t46.geometry(), r86, n45, i26); if (!cn(r86, n45)) return false; for (const t47 of o88) if (!bn(t47, s18)) return false; } if ("MultiPolygon" === e57.type) { const s18 = An(e57.coordinates, n45, i26), o88 = Sn(t46.geometry(), r86, n45, i26); if (!cn(r86, n45)) return false; for (const t47 of o88) if (!wn(t47, s18)) return false; } return true; })(t45, this.geometries); } return false; } eachChild() { } outputDefined() { return true; } serialize() { return ["within", this.geojson]; } } const kn = { kilometers: 1, miles: 1e3 / 1609.344, nauticalmiles: 1e3 / 1852, meters: 1e3, metres: 1e3, yards: 1e3 / 0.9144, feet: 1e3 / 0.3048, inches: 1e3 / 0.0254 }, zn = 1 / 298.257223563, En = zn * (2 - zn), Tn = Math.PI / 180; class Bn { static fromTile(t45, e57, r86) { const n45 = Math.PI * (1 - 2 * (t45 + 0.5) / Math.pow(2, e57)), i26 = Math.atan(0.5 * (Math.exp(n45) - Math.exp(-n45))) / Tn; return new Bn(i26, r86); } static get units() { return kn; } constructor(t45, e57) { if (void 0 === t45) throw new Error("No latitude given."); if (e57 && !kn[e57]) throw new Error(`Unknown unit ${e57}. Use one of: ${Object.keys(kn).join(", ")}`); const r86 = 6378.137 * Tn * (e57 ? kn[e57] : 1), n45 = Math.cos(t45 * Tn), i26 = 1 / (1 - En * (1 - n45 * n45)), s18 = Math.sqrt(i26); this.kx = r86 * s18 * n45, this.ky = r86 * s18 * i26 * (1 - En); } distance(t45, e57) { const r86 = Cn(t45[0] - e57[0]) * this.kx, n45 = (t45[1] - e57[1]) * this.ky; return Math.sqrt(r86 * r86 + n45 * n45); } bearing(t45, e57) { const r86 = Cn(e57[0] - t45[0]) * this.kx; return Math.atan2(r86, (e57[1] - t45[1]) * this.ky) / Tn; } destination(t45, e57, r86) { const n45 = r86 * Tn; return this.offset(t45, Math.sin(n45) * e57, Math.cos(n45) * e57); } offset(t45, e57, r86) { return [t45[0] + e57 / this.kx, t45[1] + r86 / this.ky]; } lineDistance(t45) { let e57 = 0; for (let r86 = 0; r86 < t45.length - 1; r86++) e57 += this.distance(t45[r86], t45[r86 + 1]); return e57; } area(t45) { let e57 = 0; for (let r86 = 0; r86 < t45.length; r86++) { const n45 = t45[r86]; for (let t46 = 0, i26 = n45.length, s18 = i26 - 1; t46 < i26; s18 = t46++) e57 += Cn(n45[t46][0] - n45[s18][0]) * (n45[t46][1] + n45[s18][1]) * (r86 ? -1 : 1); } return Math.abs(e57) / 2 * this.kx * this.ky; } along(t45, e57) { let r86 = 0; if (e57 <= 0) return t45[0]; for (let n45 = 0; n45 < t45.length - 1; n45++) { const i26 = t45[n45], s18 = t45[n45 + 1], o88 = this.distance(i26, s18); if (r86 += o88, r86 > e57) return Fn(i26, s18, (e57 - (r86 - o88)) / o88); } return t45[t45.length - 1]; } pointToSegmentDistance(t45, e57, r86) { let [n45, i26] = e57, s18 = Cn(r86[0] - n45) * this.kx, o88 = (r86[1] - i26) * this.ky; if (0 !== s18 || 0 !== o88) { const e58 = (Cn(t45[0] - n45) * this.kx * s18 + (t45[1] - i26) * this.ky * o88) / (s18 * s18 + o88 * o88); e58 > 1 ? (n45 = r86[0], i26 = r86[1]) : e58 > 0 && (n45 += s18 / this.kx * e58, i26 += o88 / this.ky * e58); } return s18 = Cn(t45[0] - n45) * this.kx, o88 = (t45[1] - i26) * this.ky, Math.sqrt(s18 * s18 + o88 * o88); } pointOnLine(t45, e57) { let r86 = 1 / 0, n45 = t45[0][0], i26 = t45[0][1], s18 = 0, o88 = 0; for (let a46 = 0; a46 < t45.length - 1; a46++) { let l21 = t45[a46][0], u12 = t45[a46][1], c28 = Cn(t45[a46 + 1][0] - l21) * this.kx, h8 = (t45[a46 + 1][1] - u12) * this.ky, p9 = 0; 0 === c28 && 0 === h8 || (p9 = (Cn(e57[0] - l21) * this.kx * c28 + (e57[1] - u12) * this.ky * h8) / (c28 * c28 + h8 * h8), p9 > 1 ? (l21 = t45[a46 + 1][0], u12 = t45[a46 + 1][1]) : p9 > 0 && (l21 += c28 / this.kx * p9, u12 += h8 / this.ky * p9)), c28 = Cn(e57[0] - l21) * this.kx, h8 = (e57[1] - u12) * this.ky; const d34 = c28 * c28 + h8 * h8; d34 < r86 && (r86 = d34, n45 = l21, i26 = u12, s18 = a46, o88 = p9); } return { point: [n45, i26], index: s18, t: Math.max(0, Math.min(1, o88)) }; } lineSlice(t45, e57, r86) { let n45 = this.pointOnLine(r86, t45), i26 = this.pointOnLine(r86, e57); if (n45.index > i26.index || n45.index === i26.index && n45.t > i26.t) { const t46 = n45; n45 = i26, i26 = t46; } const s18 = [n45.point], o88 = n45.index + 1, a46 = i26.index; !Vn(r86[o88], s18[0]) && o88 <= a46 && s18.push(r86[o88]); for (let t46 = o88 + 1; t46 <= a46; t46++) s18.push(r86[t46]); return Vn(r86[a46], i26.point) || s18.push(i26.point), s18; } lineSliceAlong(t45, e57, r86) { let n45 = 0; const i26 = []; for (let s18 = 0; s18 < r86.length - 1; s18++) { const o88 = r86[s18], a46 = r86[s18 + 1], l21 = this.distance(o88, a46); if (n45 += l21, n45 > t45 && 0 === i26.length && i26.push(Fn(o88, a46, (t45 - (n45 - l21)) / l21)), n45 >= e57) return i26.push(Fn(o88, a46, (e57 - (n45 - l21)) / l21)), i26; n45 > t45 && i26.push(a46); } return i26; } bufferPoint(t45, e57) { const r86 = e57 / this.ky, n45 = e57 / this.kx; return [t45[0] - n45, t45[1] - r86, t45[0] + n45, t45[1] + r86]; } bufferBBox(t45, e57) { const r86 = e57 / this.ky, n45 = e57 / this.kx; return [t45[0] - n45, t45[1] - r86, t45[2] + n45, t45[3] + r86]; } insideBBox(t45, e57) { return Cn(t45[0] - e57[0]) >= 0 && Cn(t45[0] - e57[2]) <= 0 && t45[1] >= e57[1] && t45[1] <= e57[3]; } } function Vn(t45, e57) { return t45[0] === e57[0] && t45[1] === e57[1]; } function Fn(t45, e57, r86) { const n45 = Cn(e57[0] - t45[0]); return [t45[0] + n45 * r86, t45[1] + (e57[1] - t45[1]) * r86]; } function Cn(t45) { for (; t45 < -180; ) t45 += 360; for (; t45 > 180; ) t45 -= 360; return t45; } class Dn { constructor(t45 = [], e57 = ((t46, e58) => t46 < e58 ? -1 : t46 > e58 ? 1 : 0)) { if (this.data = t45, this.length = this.data.length, this.compare = e57, this.length > 0) for (let t46 = (this.length >> 1) - 1; t46 >= 0; t46--) this._down(t46); } push(t45) { this.data.push(t45), this._up(this.length++); } pop() { if (0 === this.length) return; const t45 = this.data[0], e57 = this.data.pop(); return --this.length > 0 && (this.data[0] = e57, this._down(0)), t45; } peek() { return this.data[0]; } _up(t45) { const { data: e57, compare: r86 } = this, n45 = e57[t45]; for (; t45 > 0; ) { const i26 = t45 - 1 >> 1, s18 = e57[i26]; if (r86(n45, s18) >= 0) break; e57[t45] = s18, t45 = i26; } e57[t45] = n45; } _down(t45) { const { data: e57, compare: r86 } = this, n45 = this.length >> 1, i26 = e57[t45]; for (; t45 < n45; ) { let n46 = 1 + (t45 << 1); const s18 = n46 + 1; if (s18 < this.length && r86(e57[s18], e57[n46]) < 0 && (n46 = s18), r86(e57[n46], i26) >= 0) break; e57[t45] = e57[n46], t45 = n46; } e57[t45] = i26; } } var Rn = 8192; function Ln(t45, e57) { return e57.dist - t45.dist; } const On = 100, Un = 50; function Nn(t45) { const e57 = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; if (e57.length !== t45.length) return false; for (let r86 = 0; r86 < e57.length; r86++) if (e57[r86] !== t45[r86]) return false; return true; } function jn(t45) { return t45[1] - t45[0] + 1; } function $n(t45, e57) { const r86 = t45[1] >= t45[0] && t45[1] < e57; return r86 || console.warn("Distance Expression: Index is out of range"), r86; } function Gn(t45, e57) { if (t45[0] > t45[1]) return [null, null]; const r86 = jn(t45); if (e57) { if (2 === r86) return [t45, null]; const e58 = Math.floor(r86 / 2); return [[t45[0], t45[0] + e58], [t45[0] + e58, t45[1]]]; } { if (1 === r86) return [t45, null]; const e58 = Math.floor(r86 / 2) - 1; return [[t45[0], t45[0] + e58], [t45[0] + e58 + 1, t45[1]]]; } } function Hn(t45, e57) { const r86 = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; if (!$n(e57, t45.length)) return r86; for (let n45 = e57[0]; n45 <= e57[1]; ++n45) un(r86, t45[n45]); return r86; } function qn(t45) { const e57 = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; for (let r86 = 0; r86 < t45.length; ++r86) for (let n45 = 0; n45 < t45[r86].length; ++n45) un(e57, t45[r86][n45]); return e57; } function Xn(t45, e57, r86) { if (Nn(t45) || Nn(e57)) return NaN; let n45 = 0, i26 = 0; return t45[2] < e57[0] && (n45 = e57[0] - t45[2]), t45[0] > e57[2] && (n45 = t45[0] - e57[2]), t45[1] > e57[3] && (i26 = t45[1] - e57[3]), t45[3] < e57[1] && (i26 = e57[1] - t45[3]), r86.distance([0, 0], [n45, i26]); } function Zn(t45) { return 360 * t45 - 180; } function Wn(t45) { return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t45) * Math.PI / 180)) - 90; } function Yn(t45, e57) { const r86 = Math.pow(2, e57.z), n45 = (t45.y / Rn + e57.y) / r86; return [Zn((t45.x / Rn + e57.x) / r86), Wn(n45)]; } function Kn(t45, e57) { const r86 = []; for (let n45 = 0; n45 < t45.length; ++n45) r86.push(Yn(t45[n45], e57)); return r86; } function Jn(t45, e57, r86) { const n45 = r86.pointOnLine(e57, t45).point; return r86.distance(t45, n45); } function Qn(t45, e57, r86, n45, i26) { const s18 = r86.slice(n45[0], n45[1] + 1); let o88 = 1 / 0; for (let r87 = e57[0]; r87 <= e57[1]; ++r87) if (0 === (o88 = Math.min(o88, Jn(t45[r87], s18, i26)))) return 0; return o88; } function ti(t45, e57, r86, n45, i26) { const s18 = Math.min(i26.pointToSegmentDistance(t45, r86, n45), i26.pointToSegmentDistance(e57, r86, n45)), o88 = Math.min(i26.pointToSegmentDistance(r86, t45, e57), i26.pointToSegmentDistance(n45, t45, e57)); return Math.min(s18, o88); } function ei(t45, e57, r86, n45, i26) { if (!$n(e57, t45.length) || !$n(n45, r86.length)) return NaN; let s18 = 1 / 0; for (let o88 = e57[0]; o88 < e57[1]; ++o88) for (let e58 = n45[0]; e58 < n45[1]; ++e58) { if (fn(t45[o88], t45[o88 + 1], r86[e58], r86[e58 + 1])) return 0; s18 = Math.min(s18, ti(t45[o88], t45[o88 + 1], r86[e58], r86[e58 + 1], i26)); } return s18; } function ri(t45, e57, r86, n45, i26) { if (!$n(e57, t45.length) || !$n(n45, r86.length)) return NaN; let s18 = 1 / 0; for (let o88 = e57[0]; o88 <= e57[1]; ++o88) for (let e58 = n45[0]; e58 <= n45[1]; ++e58) if (0 === (s18 = Math.min(s18, i26.distance(t45[o88], r86[e58])))) return s18; return s18; } function ni(t45, e57, r86) { if (pn(t45, e57, true)) return 0; let n45 = 1 / 0; for (const i26 of e57) { const e58 = i26.length; if (e58 < 2) return console.warn("Distance Expression: Invalid polygon!"), NaN; if (i26[0] !== i26[e58 - 1] && 0 === (n45 = Math.min(n45, r86.pointToSegmentDistance(t45, i26[e58 - 1], i26[0])))) return n45; if (0 === (n45 = Math.min(n45, Jn(t45, i26, r86)))) return n45; } return n45; } function ii(t45, e57, r86, n45) { if (!$n(e57, t45.length)) return NaN; for (let n46 = e57[0]; n46 <= e57[1]; ++n46) if (pn(t45[n46], r86, true)) return 0; let i26 = 1 / 0; for (let s18 = e57[0]; s18 < e57[1]; ++s18) for (const e58 of r86) for (let r87 = 0, o88 = e58.length, a46 = o88 - 1; r87 < o88; a46 = r87++) { if (fn(t45[s18], t45[s18 + 1], e58[a46], e58[r87])) return 0; i26 = Math.min(i26, ti(t45[s18], t45[s18 + 1], e58[a46], e58[r87], n45)); } return i26; } function si(t45, e57) { for (const r86 of t45) for (let t46 = 0; t46 <= r86.length - 1; ++t46) if (pn(r86[t46], e57, true)) return true; return false; } function oi(t45, e57, r86, n45 = 1 / 0) { const i26 = qn(t45), s18 = qn(e57); if (n45 !== 1 / 0 && Xn(i26, s18, r86) >= n45) return n45; if (cn(i26, s18)) { if (si(t45, e57)) return 0; } else if (si(e57, t45)) return 0; let o88 = n45; for (const n46 of t45) for (let t46 = 0, i27 = n46.length, s19 = i27 - 1; t46 < i27; s19 = t46++) for (const i28 of e57) for (let e58 = 0, a46 = i28.length, l21 = a46 - 1; e58 < a46; l21 = e58++) { if (fn(n46[s19], n46[t46], i28[l21], i28[e58])) return 0; o88 = Math.min(o88, ti(n46[s19], n46[t46], i28[l21], i28[e58], r86)); } return o88; } function ai(t45, e57, r86, n45, i26, s18, o88) { if (null === s18 || null === o88) return; const a46 = Xn(Hn(n45, s18), Hn(i26, o88), r86); a46 < e57 && t45.push({ dist: a46, range1: s18, range2: o88 }); } function li(t45, e57, r86, n45, i26 = 1 / 0) { let s18 = Math.min(n45.distance(t45[0], r86[0][0]), i26); if (0 === s18) return s18; const o88 = new Dn([{ dist: 0, range1: [0, t45.length - 1], range2: [0, 0] }], Ln), a46 = e57 ? Un : On, l21 = qn(r86); for (; o88.length; ) { const i27 = o88.pop(); if (i27.dist >= s18) continue; const u12 = i27.range1; if (jn(u12) <= a46) { if (!$n(u12, t45.length)) return NaN; if (e57) { const e58 = ii(t45, u12, r86, n45); if (0 === (s18 = Math.min(s18, e58))) return s18; } else for (let e58 = u12[0]; e58 <= u12[1]; ++e58) { const i28 = ni(t45[e58], r86, n45); if (0 === (s18 = Math.min(s18, i28))) return s18; } } else { const r87 = Gn(u12, e57); if (null !== r87[0]) { const e58 = Xn(Hn(t45, r87[0]), l21, n45); e58 < s18 && o88.push({ dist: e58, range1: r87[0], range2: [0, 0] }); } if (null !== r87[1]) { const e58 = Xn(Hn(t45, r87[1]), l21, n45); e58 < s18 && o88.push({ dist: e58, range1: r87[1], range2: [0, 0] }); } } } return s18; } function ui(t45, e57, r86, n45, i26, s18 = 1 / 0) { let o88 = Math.min(s18, i26.distance(t45[0], r86[0])); if (0 === o88) return o88; const a46 = new Dn([{ dist: 0, range1: [0, t45.length - 1], range2: [0, r86.length - 1] }], Ln), l21 = e57 ? Un : On, u12 = n45 ? Un : On; for (; a46.length; ) { const s19 = a46.pop(); if (s19.dist >= o88) continue; const c28 = s19.range1, h8 = s19.range2; if (jn(c28) <= l21 && jn(h8) <= u12) { if (!$n(c28, t45.length) || !$n(h8, r86.length)) return NaN; if (e57 && n45 ? o88 = Math.min(o88, ei(t45, c28, r86, h8, i26)) : e57 || n45 ? e57 && !n45 ? o88 = Math.min(o88, Qn(r86, h8, t45, c28, i26)) : !e57 && n45 && (o88 = Math.min(o88, Qn(t45, c28, r86, h8, i26))) : o88 = Math.min(o88, ri(t45, c28, r86, h8, i26)), 0 === o88) return o88; } else { const s20 = Gn(c28, e57), l22 = Gn(h8, n45); ai(a46, o88, i26, t45, r86, s20[0], l22[0]), ai(a46, o88, i26, t45, r86, s20[0], l22[1]), ai(a46, o88, i26, t45, r86, s20[1], l22[0]), ai(a46, o88, i26, t45, r86, s20[1], l22[1]); } } return o88; } function ci(t45, e57, r86, n45, i26 = 1 / 0) { let s18 = i26; const o88 = Hn(t45, [0, t45.length - 1]); for (const i27 of r86) if (!(s18 !== 1 / 0 && Xn(o88, Hn(i27, [0, i27.length - 1]), n45) >= s18) && (s18 = Math.min(s18, ui(t45, e57, i27, true, n45, s18)), 0 === s18)) return s18; return s18; } function hi(t45, e57, r86, n45, i26 = 1 / 0) { let s18 = i26; const o88 = Hn(t45, [0, t45.length - 1]); for (const i27 of r86) { if (s18 !== 1 / 0 && Xn(o88, qn(i27), n45) >= s18) continue; const r87 = li(t45, e57, i27, n45, s18); if (isNaN(r87)) return r87; if (0 === (s18 = Math.min(s18, r87))) return s18; } return s18; } function pi(t45) { return "Point" === t45 || "MultiPoint" === t45 || "LineString" === t45 || "MultiLineString" === t45 || "Polygon" === t45 || "MultiPolygon" === t45; } class di { constructor(t45, e57) { this.type = mr, this.geojson = t45, this.geometries = e57; } static parse(t45, e57) { if (2 !== t45.length) return e57.error(`'distance' expression requires either one argument, but found ' ${t45.length - 1} instead.`); if (Rr(t45[1])) { const e58 = t45[1]; if ("FeatureCollection" === e58.type) { for (let t46 = 0; t46 < e58.features.length; ++t46) if (pi(e58.features[t46].geometry.type)) return new di(e58, e58.features[t46].geometry); } else if ("Feature" === e58.type) { if (pi(e58.geometry.type)) return new di(e58, e58.geometry); } else if (pi(e58.type)) return new di(e58, e58); } return e57.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj]."); } evaluate(t45) { const e57 = t45.geometry(), r86 = t45.canonicalID(); if (null != e57 && null != r86) { if ("Point" === t45.geometryType()) return (function(t46, e58, r87) { const n45 = []; for (const r88 of t46) for (const t47 of r88) n45.push(Yn(t47, e58)); const i26 = new Bn(n45[0][1], "meters"); return "Point" === r87.type || "MultiPoint" === r87.type || "LineString" === r87.type ? ui(n45, false, "Point" === r87.type ? [r87.coordinates] : r87.coordinates, "LineString" === r87.type, i26) : "MultiLineString" === r87.type ? ci(n45, false, r87.coordinates, i26) : "Polygon" === r87.type || "MultiPolygon" === r87.type ? hi(n45, false, "Polygon" === r87.type ? [r87.coordinates] : r87.coordinates, i26) : null; })(e57, r86, this.geometries); if ("LineString" === t45.geometryType()) return (function(t46, e58, r87) { const n45 = []; for (const r88 of t46) { const t47 = []; for (const n46 of r88) t47.push(Yn(n46, e58)); n45.push(t47); } const i26 = new Bn(n45[0][0][1], "meters"); if ("Point" === r87.type || "MultiPoint" === r87.type || "LineString" === r87.type) return ci("Point" === r87.type ? [r87.coordinates] : r87.coordinates, "LineString" === r87.type, n45, i26); if ("MultiLineString" === r87.type) { let t47 = 1 / 0; for (let e59 = 0; e59 < r87.coordinates.length; e59++) { const s18 = ci(r87.coordinates[e59], true, n45, i26, t47); if (isNaN(s18)) return s18; if (0 === (t47 = Math.min(t47, s18))) return t47; } return t47; } if ("Polygon" === r87.type || "MultiPolygon" === r87.type) { let t47 = 1 / 0; for (let e59 = 0; e59 < n45.length; e59++) { const s18 = hi(n45[e59], true, "Polygon" === r87.type ? [r87.coordinates] : r87.coordinates, i26, t47); if (isNaN(s18)) return s18; if (0 === (t47 = Math.min(t47, s18))) return t47; } return t47; } return null; })(e57, r86, this.geometries); if ("Polygon" === t45.geometryType()) return (function(t46, e58, r87) { const n45 = []; for (const r88 of (function(t47, e59) { const r89 = t47.length; if (r89 <= 1) return [t47]; const n46 = []; let i27, s18; for (let e60 = 0; e60 < r89; e60++) { const r90 = ln(t47[e60]); 0 !== r90 && (t47[e60].area = Math.abs(r90), void 0 === s18 && (s18 = r90 < 0), s18 === r90 < 0 ? (i27 && n46.push(i27), i27 = [t47[e60]]) : i27.push(t47[e60])); } return i27 && n46.push(i27), n46; })(t46)) { const t47 = []; for (let n46 = 0; n46 < r88.length; ++n46) t47.push(Kn(r88[n46], e58)); n45.push(t47); } const i26 = new Bn(n45[0][0][0][1], "meters"); if ("Point" === r87.type || "MultiPoint" === r87.type || "LineString" === r87.type) return hi("Point" === r87.type ? [r87.coordinates] : r87.coordinates, "LineString" === r87.type, n45, i26); if ("MultiLineString" === r87.type) { let t47 = 1 / 0; for (let e59 = 0; e59 < r87.coordinates.length; e59++) { const s18 = hi(r87.coordinates[e59], true, n45, i26, t47); if (isNaN(s18)) return s18; if (0 === (t47 = Math.min(t47, s18))) return t47; } return t47; } return "Polygon" === r87.type || "MultiPolygon" === r87.type ? (function(t47, e59, r88) { let n46 = 1 / 0; for (const i27 of t47) for (const t48 of e59) { const e60 = oi(i27, t48, r88, n46); if (isNaN(e60)) return e60; if (0 === (n46 = Math.min(n46, e60))) return n46; } return n46; })("Polygon" === r87.type ? [r87.coordinates] : r87.coordinates, n45, i26) : null; })(e57, r86, this.geometries); console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."); } else console.warn("Distance Expression: requirs valid feature and canonical information."); return null; } eachChild() { } outputDefined() { return true; } serialize() { return ["distance", this.geojson]; } } function fi(t45) { if (t45 instanceof en) { if ("get" === t45.name && 1 === t45.args.length) return false; if ("feature-state" === t45.name) return false; if ("has" === t45.name && 1 === t45.args.length) return false; if ("properties" === t45.name || "geometry-type" === t45.name || "id" === t45.name) return false; if (/^filter-/.test(t45.name)) return false; } if (t45 instanceof Pn) return false; if (t45 instanceof di) return false; if (t45 instanceof wi) return t45.featureConstant; let e57 = true; return t45.eachChild(((t46) => { e57 && !fi(t46) && (e57 = false); })), e57; } function mi(t45) { if (t45 instanceof en && "feature-state" === t45.name) return false; let e57 = true; return t45.eachChild(((t46) => { e57 && !mi(t46) && (e57 = false); })), e57; } function yi(t45) { if (t45 instanceof wi) return /* @__PURE__ */ new Set([t45.key]); let e57 = /* @__PURE__ */ new Set(); return t45.eachChild(((t46) => { e57 = /* @__PURE__ */ new Set([...e57, ...yi(t46)]); })), e57; } function gi(t45, e57) { if (t45 instanceof en && e57.indexOf(t45.name) >= 0) return false; let r86 = true; return t45.eachChild(((t46) => { r86 && !gi(t46, e57) && (r86 = false); })), r86; } function xi(t45, e57, r86) { return [t45, e57, r86].filter(Boolean).join(""); } function vi(t45, e57) { switch (t45) { case "string": return Or(e57); case "number": return +e57; case "boolean": return !!e57; case "color": return sr.parse(e57); case "formatted": return Vr.fromString(Or(e57)); case "resolvedImage": return Cr.build(Or(e57)); } return e57; } function bi(t45, e57, r86, n45) { return void 0 !== n45 && (t45 = n45 * Math.round(t45 / n45)), void 0 !== e57 && t45 < e57 && (t45 = e57), void 0 !== r86 && t45 > r86 && (t45 = r86), t45; } class wi { constructor(t45, e57, r86, n45 = false) { this.type = t45, this.key = e57, this.scope = r86, this.featureConstant = n45; } static parse(t45, e57) { let r86 = e57.expectedType; if (null == r86 && (r86 = br), t45.length < 2 || t45.length > 3) return e57.error("Invalid number of arguments for 'config' expression."); const n45 = e57.parse(t45[1], 1); if (!(n45 instanceof Ur)) return e57.error("Key name of 'config' expression must be a string literal."); let i26, s18 = true; const o88 = Or(n45.value); if (t45.length >= 3) { const r87 = e57.parse(t45[2], 2); if (!(r87 instanceof Ur)) return e57.error("Scope of 'config' expression must be a string literal."); i26 = Or(r87.value); } if (e57.options) { const t46 = xi(o88, i26, e57._scope), r87 = e57.options.get(t46); r87 && (s18 = fi(r87.value || r87.default)); } return new wi(r86, o88, i26, s18); } evaluate(t45) { const e57 = xi(this.key, this.scope, t45.scope), r86 = t45.getConfig(e57); if (!r86) return null; const { type: n45, value: i26, values: s18, minValue: o88, maxValue: a46, stepValue: l21 } = r86, u12 = r86.default.evaluate(t45); let c28 = u12; if (i26) { const e58 = t45.scope; t45.scope = (e58 || "").split("").slice(1).join(""), c28 = i26.evaluate(t45), t45.scope = e58; } return n45 && (c28 = vi(n45, c28)), void 0 === c28 || void 0 === o88 && void 0 === a46 && void 0 === l21 || ("number" == typeof c28 ? c28 = bi(c28, o88, a46, l21) : Array.isArray(c28) && (c28 = c28.map(((t46) => "number" == typeof t46 ? bi(t46, o88, a46, l21) : t46)))), void 0 !== i26 && void 0 !== c28 && s18 && !s18.includes(c28) && (c28 = u12, n45 && (c28 = vi(n45, c28))), (n45 && n45 !== this.type || void 0 !== c28 && !Er(Lr(c28), this.type)) && (c28 = vi(this.type.kind, c28)), c28; } eachChild() { } outputDefined() { return false; } serialize() { const t45 = ["config", this.key]; return this.scope && t45.concat(this.scope), t45; } } class _i { constructor(t45, e57) { this.type = e57.type, this.name = t45, this.boundExpression = e57; } static parse(t45, e57) { if (2 !== t45.length || "string" != typeof t45[1]) return e57.error("'var' expression requires exactly one string literal argument."); const r86 = t45[1]; return e57.scope.has(r86) ? new _i(r86, e57.scope.get(r86)) : e57.error(`Unknown variable "${r86}". Make sure "${r86}" has been bound in an enclosing "let" expression before using it.`, 1); } evaluate(t45) { return this.boundExpression.evaluate(t45); } eachChild() { } outputDefined() { return false; } serialize() { return ["var", this.name]; } } class Ai { constructor(t45, e57 = [], r86, n45 = new dr(), i26 = [], s18, o88, a46) { this.registry = t45, this.path = e57, this.key = e57.map(((t46) => "string" == typeof t46 ? `['${t46}']` : `[${t46}]`)).join(""), this.scope = n45, this.errors = i26, this.expectedType = r86, this._scope = s18, this.options = o88, this.iconImageUseTheme = a46; } parse(t45, e57, r86, n45, i26 = {}) { return e57 || r86 ? this.concat(e57, null, r86, n45)._parse(t45, i26) : this._parse(t45, i26); } parseObjectValue(t45, e57, r86, n45, i26, s18 = {}) { return this.concat(e57, r86, n45, i26)._parse(t45, s18); } _parse(t45, e57) { function r86(t46, e58, r87) { return "assert" === r87 ? new $r(e58, [t46]) : "coerce" === r87 ? new Jr(e58, [t46]) : t46; } if (null !== t45 && "string" != typeof t45 && "boolean" != typeof t45 && "number" != typeof t45 || (t45 = ["literal", t45]), Array.isArray(t45)) { if (0 === t45.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].'); const n45 = "string" == typeof t45[0] ? this.registry[t45[0]] : void 0; if (n45) { let i26 = n45.parse(t45, this); if (!i26) return null; if (this.expectedType) { const t46 = this.expectedType, n46 = i26.type; if ("string" !== t46.kind && "number" !== t46.kind && "boolean" !== t46.kind && "object" !== t46.kind && "array" !== t46.kind || "value" !== n46.kind) if ("color" !== t46.kind && "formatted" !== t46.kind && "resolvedImage" !== t46.kind || "value" !== n46.kind && "string" !== n46.kind) { if (this.checkSubtype(t46, n46)) return null; } else i26 = r86(i26, t46, e57.typeAnnotation || "coerce"); else i26 = r86(i26, t46, e57.typeAnnotation || "assert"); } if (!(i26 instanceof Ur) && "resolvedImage" !== i26.type.kind && Mi(i26)) { const t46 = new tn(this._scope, this.options, this.iconImageUseTheme); try { i26 = new Ur(i26.type, i26.evaluate(t46)); } catch (t47) { return this.error(t47.message), null; } } return i26; } return Jr.parse(["to-array", t45], this); } return this.error(void 0 === t45 ? "'undefined' value invalid. Use null instead." : "object" == typeof t45 ? 'Bare objects invalid. Use ["literal", {...}] instead.' : `Expected an array, but found ${typeof t45} instead.`); } concat(t45, e57, r86, n45) { let i26 = "number" == typeof t45 ? this.path.concat(t45) : this.path; i26 = "string" == typeof e57 ? i26.concat(e57) : i26; const s18 = n45 ? this.scope.concat(n45) : this.scope; return new Ai(this.registry, i26, r86 || null, s18, this.errors, this._scope, this.options, this.iconImageUseTheme); } error(t45, ...e57) { const r86 = `${this.key}${e57.map(((t46) => `[${t46}]`)).join("")}`; this.errors.push(new pr(r86, t45)); } checkSubtype(t45, e57) { const r86 = Pr(t45, e57); return r86 && this.error(r86), r86; } } function Mi(t45) { if (t45 instanceof _i) return Mi(t45.boundExpression); if (t45 instanceof en && "error" === t45.name) return false; if (t45 instanceof nn) return false; if (t45 instanceof Pn) return false; if (t45 instanceof di) return false; if (t45 instanceof wi) return false; const e57 = t45 instanceof Jr || t45 instanceof $r; let r86 = true; return t45.eachChild(((t46) => { r86 = e57 ? r86 && Mi(t46) : r86 && t46 instanceof Ur; })), !!r86 && fi(t45) && gi(t45, ["zoom", "heatmap-density", "worldview", "line-progress", "raster-value", "sky-radial-progress", "accumulated", "is-supported-script", "pitch", "distance-from-center", "measure-light", "raster-particle-speed"]); } function Ii(t45, e57) { const r86 = t45.length - 1; let n45, i26, s18 = 0, o88 = r86, a46 = 0; for (; s18 <= o88; ) if (a46 = Math.floor((s18 + o88) / 2), n45 = t45[a46], i26 = t45[a46 + 1], n45 <= e57) { if (a46 === r86 || e57 < i26) return a46; s18 = a46 + 1; } else { if (!(n45 > e57)) throw new Nr("Input is not a number."); o88 = a46 - 1; } return 0; } class Si { constructor(t45, e57, r86) { this.type = t45, this.input = e57, this.labels = [], this.outputs = []; for (const [t46, e58] of r86) this.labels.push(t46), this.outputs.push(e58); } static parse(t45, e57) { if (t45.length - 1 < 4) return e57.error(`Expected at least 4 arguments, but found only ${t45.length - 1}.`); if ((t45.length - 1) % 2 != 0) return e57.error("Expected an even number of arguments."); const r86 = e57.parse(t45[1], 1, mr); if (!r86) return null; const n45 = []; let i26 = null; e57.expectedType && "value" !== e57.expectedType.kind && (i26 = e57.expectedType); for (let r87 = 1; r87 < t45.length; r87 += 2) { const s18 = 1 === r87 ? -1 / 0 : t45[r87], o88 = t45[r87 + 1], a46 = r87, l21 = r87 + 1; if ("number" != typeof s18) return e57.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', a46); if (n45.length && n45[n45.length - 1][0] >= s18) return e57.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', a46); const u12 = e57.parse(o88, l21, i26); if (!u12) return null; i26 = i26 || u12.type, n45.push([s18, u12]); } return new Si(i26, r86, n45); } evaluate(t45) { const e57 = this.labels, r86 = this.outputs; if (1 === e57.length) return r86[0].evaluate(t45); const n45 = this.input.evaluate(t45); if (n45 <= e57[0]) return r86[0].evaluate(t45); const i26 = e57.length; return n45 >= e57[i26 - 1] ? r86[i26 - 1].evaluate(t45) : r86[Ii(e57, n45)].evaluate(t45); } eachChild(t45) { t45(this.input); for (const e57 of this.outputs) t45(e57); } outputDefined() { return this.outputs.every(((t45) => t45.outputDefined())); } serialize() { const t45 = ["step", this.input.serialize()]; for (let e57 = 0; e57 < this.labels.length; e57++) e57 > 0 && t45.push(this.labels[e57]), t45.push(this.outputs[e57].serialize()); return t45; } } const Pi = 0.95047, ki = 1.08883, zi = 4 / 29, Ei = 6 / 29, Ti = 3 * Ei * Ei, Bi = Ei * Ei * Ei, Vi = Math.PI / 180, Fi = 180 / Math.PI; function Ci(t45) { return t45 > Bi ? Math.pow(t45, 1 / 3) : t45 / Ti + zi; } function Di(t45) { return t45 > Ei ? t45 * t45 * t45 : Ti * (t45 - zi); } function Ri(t45) { return 255 * (t45 <= 31308e-7 ? 12.92 * t45 : 1.055 * Math.pow(t45, 1 / 2.4) - 0.055); } function Li(t45) { return (t45 /= 255) <= 0.04045 ? t45 / 12.92 : Math.pow((t45 + 0.055) / 1.055, 2.4); } function Oi(t45) { const e57 = Li(t45.r), r86 = Li(t45.g), n45 = Li(t45.b), i26 = Ci((0.4124564 * e57 + 0.3575761 * r86 + 0.1804375 * n45) / Pi), s18 = Ci((0.2126729 * e57 + 0.7151522 * r86 + 0.072175 * n45) / 1); return { l: 116 * s18 - 16, a: 500 * (i26 - s18), b: 200 * (s18 - Ci((0.0193339 * e57 + 0.119192 * r86 + 0.9503041 * n45) / ki)), alpha: t45.a }; } function Ui(t45) { let e57 = (t45.l + 16) / 116, r86 = isNaN(t45.a) ? e57 : e57 + t45.a / 500, n45 = isNaN(t45.b) ? e57 : e57 - t45.b / 200; return e57 = 1 * Di(e57), r86 = Pi * Di(r86), n45 = ki * Di(n45), new sr(Ri(3.2404542 * r86 - 1.5371385 * e57 - 0.4985314 * n45), Ri(-0.969266 * r86 + 1.8760108 * e57 + 0.041556 * n45), Ri(0.0556434 * r86 - 0.2040259 * e57 + 1.0572252 * n45), t45.alpha); } function Ni(t45, e57, r86) { const n45 = e57 - t45; return t45 + r86 * (n45 > 180 || n45 < -180 ? n45 - 360 * Math.round(n45 / 360) : n45); } const ji = { forward: Oi, reverse: Ui, interpolate: function(t45, e57, r86) { return { l: ur(t45.l, e57.l, r86), a: ur(t45.a, e57.a, r86), b: ur(t45.b, e57.b, r86), alpha: ur(t45.alpha, e57.alpha, r86) }; } }, $i = { forward: function(t45) { const { l: e57, a: r86, b: n45 } = Oi(t45), i26 = Math.atan2(n45, r86) * Fi; return { h: i26 < 0 ? i26 + 360 : i26, c: Math.sqrt(r86 * r86 + n45 * n45), l: e57, alpha: t45.a }; }, reverse: function(t45) { const e57 = t45.h * Vi, r86 = t45.c; return Ui({ l: t45.l, a: Math.cos(e57) * r86, b: Math.sin(e57) * r86, alpha: t45.alpha }); }, interpolate: function(t45, e57, r86) { return { h: Ni(t45.h, e57.h, r86), c: ur(t45.c, e57.c, r86), l: ur(t45.l, e57.l, r86), alpha: ur(t45.alpha, e57.alpha, r86) }; } }; var Gi = Object.freeze({ __proto__: null, hcl: $i, lab: ji }); class Hi { constructor(t45, e57, r86, n45, i26) { this.type = t45, this.operator = e57, this.interpolation = r86, this.input = n45, this.labels = [], this.outputs = []; for (const [t46, e58] of i26) this.labels.push(t46), this.outputs.push(e58); } static interpolationFactor(t45, e57, r86, n45) { let i26 = 0; if ("exponential" === t45.name) i26 = qi(e57, t45.base, r86, n45); else if ("linear" === t45.name) i26 = qi(e57, 1, r86, n45); else if ("cubic-bezier" === t45.name) { const s18 = t45.controlPoints; i26 = new bt2(s18[0], s18[1], s18[2], s18[3]).solve(qi(e57, 1, r86, n45)); } return i26; } static parse(t45, e57) { let [r86, n45, i26, ...s18] = t45; if (!Array.isArray(n45) || 0 === n45.length) return e57.error("Expected an interpolation type expression.", 1); if ("linear" === n45[0]) n45 = { name: "linear" }; else if ("exponential" === n45[0]) { const t46 = n45[1]; if ("number" != typeof t46) return e57.error("Exponential interpolation requires a numeric base.", 1, 1); n45 = { name: "exponential", base: t46 }; } else { if ("cubic-bezier" !== n45[0]) return e57.error(`Unknown interpolation type ${String(n45[0])}`, 1, 0); { const t46 = n45.slice(1); if (4 !== t46.length || t46.some(((t47) => "number" != typeof t47 || t47 < 0 || t47 > 1))) return e57.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1); n45 = { name: "cubic-bezier", controlPoints: t46 }; } } if (t45.length - 1 < 4) return e57.error(`Expected at least 4 arguments, but found only ${t45.length - 1}.`); if (t45.length - 1 > 3 && (t45.length - 1) % 2 != 0) return e57.error("Expected an even number of arguments."); if (i26 = e57.parse(i26, 2, mr), !i26) return null; const o88 = []; let a46 = null; "interpolate-hcl" === r86 || "interpolate-lab" === r86 ? a46 = xr : e57.expectedType && "value" !== e57.expectedType.kind && (a46 = e57.expectedType); for (let t46 = 0; t46 < s18.length; t46 += 2) { const r87 = s18[t46], n46 = s18[t46 + 1], i27 = t46 + 3, l21 = t46 + 4; if ("number" != typeof r87) return e57.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', i27); if (o88.length && o88[o88.length - 1][0] >= r87) return e57.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', i27); const u12 = e57.parse(n46, l21, a46); if (!u12) return null; a46 = a46 || u12.type, o88.push([r87, u12]); } return "number" === a46.kind || "color" === a46.kind || "array" === a46.kind && "number" === a46.itemType.kind && "number" == typeof a46.N ? new Hi(a46, r86, n45, i26, o88) : e57.error(`Type ${Ir(a46)} is not interpolatable.`); } evaluate(t45) { const e57 = this.labels, r86 = this.outputs; if (1 === e57.length) return r86[0].evaluate(t45); const n45 = this.input.evaluate(t45); if (n45 <= e57[0]) return r86[0].evaluate(t45); const i26 = e57.length; if (n45 >= e57[i26 - 1]) return r86[i26 - 1].evaluate(t45); const s18 = Ii(e57, n45), o88 = Hi.interpolationFactor(this.interpolation, n45, e57[s18], e57[s18 + 1]), a46 = r86[s18].evaluate(t45), l21 = r86[s18 + 1].evaluate(t45); return "interpolate" === this.operator ? hr[this.type.kind.toLowerCase()](a46, l21, o88) : "interpolate-hcl" === this.operator ? $i.reverse($i.interpolate($i.forward(a46), $i.forward(l21), o88)) : ji.reverse(ji.interpolate(ji.forward(a46), ji.forward(l21), o88)); } eachChild(t45) { t45(this.input); for (const e57 of this.outputs) t45(e57); } outputDefined() { return this.outputs.every(((t45) => t45.outputDefined())); } serialize() { let t45; t45 = "linear" === this.interpolation.name ? ["linear"] : "exponential" === this.interpolation.name ? 1 === this.interpolation.base ? ["linear"] : ["exponential", this.interpolation.base] : ["cubic-bezier", ...this.interpolation.controlPoints]; const e57 = [this.operator, t45, this.input.serialize()]; for (let t46 = 0; t46 < this.labels.length; t46++) e57.push(this.labels[t46], this.outputs[t46].serialize()); return e57; } } function qi(t45, e57, r86, n45) { const i26 = n45 - r86, s18 = t45 - r86; return 0 === i26 ? 0 : 1 === e57 ? s18 / i26 : (Math.pow(e57, s18) - 1) / (Math.pow(e57, i26) - 1); } class Xi { constructor(t45, e57) { this.type = t45, this.args = e57; } static parse(t45, e57) { if (t45.length < 2) return e57.error("Expectected at least one argument."); let r86 = null; const n45 = e57.expectedType; n45 && "value" !== n45.kind && (r86 = n45); const i26 = []; for (const n46 of t45.slice(1)) { const t46 = e57.parse(n46, 1 + i26.length, r86, void 0, { typeAnnotation: "omit" }); if (!t46) return null; r86 = r86 || t46.type, i26.push(t46); } const s18 = n45 && i26.some(((t46) => Pr(n45, t46.type))); return new Xi(s18 ? br : r86, i26); } evaluate(t45) { let e57, r86 = null, n45 = 0; for (const i26 of this.args) { if (n45++, r86 = i26.evaluate(t45), r86 && r86 instanceof Cr && !r86.available && (e57 || (e57 = r86), r86 = null, n45 === this.args.length)) return e57; if (null !== r86) break; } return r86; } eachChild(t45) { this.args.forEach(t45); } outputDefined() { return this.args.every(((t45) => t45.outputDefined())); } serialize() { const t45 = ["coalesce"]; return this.eachChild(((e57) => { t45.push(e57.serialize()); })), t45; } } class Zi { constructor(t45, e57) { this.type = e57.type, this.bindings = [].concat(t45), this.result = e57; } evaluate(t45) { return this.result.evaluate(t45); } eachChild(t45) { for (const e57 of this.bindings) t45(e57[1]); t45(this.result); } static parse(t45, e57) { if (t45.length < 4) return e57.error(`Expected at least 3 arguments, but found ${t45.length - 1} instead.`); const r86 = []; for (let n46 = 1; n46 < t45.length - 1; n46 += 2) { const i26 = t45[n46]; if ("string" != typeof i26) return e57.error(`Expected string, but found ${typeof i26} instead.`, n46); if (/[^a-zA-Z0-9_]/.test(i26)) return e57.error("Variable names must contain only alphanumeric characters or '_'.", n46); const s18 = e57.parse(t45[n46 + 1], n46 + 1); if (!s18) return null; r86.push([i26, s18]); } const n45 = e57.parse(t45[t45.length - 1], t45.length - 1, e57.expectedType, r86); return n45 ? new Zi(r86, n45) : null; } outputDefined() { return this.result.outputDefined(); } serialize() { const t45 = ["let"]; for (const [e57, r86] of this.bindings) t45.push(e57, r86.serialize()); return t45.push(this.result.serialize()), t45; } } class Wi { constructor(t45, e57, r86) { this.type = t45, this.index = e57, this.input = r86; } static parse(t45, e57) { if (3 !== t45.length) return e57.error(`Expected 2 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, mr), n45 = e57.parse(t45[2], 2, Mr(e57.expectedType || br)); return r86 && n45 ? new Wi(n45.type.itemType, r86, n45) : null; } evaluate(t45) { const e57 = this.index.evaluate(t45), r86 = this.input.evaluate(t45); if (e57 < 0) throw new Nr("Array index out of bounds: negative index"); if (e57 >= r86.length) throw new Nr("Array index out of bounds: index exceeds array size"); if (e57 !== Math.floor(e57)) throw new Nr("Array index must be an integer. Use at-interpolated for fractional indices"); return r86[e57]; } eachChild(t45) { t45(this.index), t45(this.input); } outputDefined() { return false; } serialize() { return ["at", this.index.serialize(), this.input.serialize()]; } } class Yi { constructor(t45, e57, r86) { this.type = t45, this.index = e57, this.input = r86; } static parse(t45, e57) { if (3 !== t45.length) return e57.error(`Expected 2 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, mr), n45 = e57.parse(t45[2], 2, Mr(e57.expectedType || br)); return r86 && n45 ? new Yi(n45.type.itemType, r86, n45) : null; } evaluate(t45) { const e57 = this.index.evaluate(t45), r86 = this.input.evaluate(t45); if (e57 < 0) throw new Nr(`Array index out of bounds: ${e57} < 0.`); if (e57 > r86.length - 1) throw new Nr(`Array index out of bounds: ${e57} > ${r86.length - 1}.`); if (e57 === Math.floor(e57)) return r86[e57]; const n45 = Math.floor(e57), i26 = Math.ceil(e57), s18 = r86[n45], o88 = r86[i26]; if ("number" != typeof s18 || "number" != typeof o88) throw new Nr(`Cannot interpolate between non-number values at index ${e57}.`); const a46 = e57 - n45; return s18 * (1 - a46) + o88 * a46; } eachChild(t45) { t45(this.index), t45(this.input); } outputDefined() { return false; } serialize() { return ["at-interpolated", this.index.serialize(), this.input.serialize()]; } } class Ki { constructor(t45, e57) { this.type = gr, this.needle = t45, this.haystack = e57; } static parse(t45, e57) { if (3 !== t45.length) return e57.error(`Expected 2 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, br), n45 = e57.parse(t45[2], 2, br); return r86 && n45 ? kr(r86.type, [gr, yr, mr, fr, br]) ? new Ki(r86, n45) : e57.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ir(r86.type)} instead`) : null; } evaluate(t45) { const e57 = this.needle.evaluate(t45), r86 = this.haystack.evaluate(t45); if (null == r86) return false; if (!zr(e57, ["boolean", "string", "number", "null"])) throw new Nr(`Expected first argument to be of type boolean, string, number or null, but found ${Ir(Lr(e57))} instead.`); if (!zr(r86, ["string", "array"])) throw new Nr(`Expected second argument to be of type array or string, but found ${Ir(Lr(r86))} instead.`); return r86.indexOf(e57) >= 0; } eachChild(t45) { t45(this.needle), t45(this.haystack); } outputDefined() { return true; } serialize() { return ["in", this.needle.serialize(), this.haystack.serialize()]; } } class Ji { constructor(t45, e57, r86) { this.type = mr, this.needle = t45, this.haystack = e57, this.fromIndex = r86; } static parse(t45, e57) { if (t45.length <= 2 || t45.length >= 5) return e57.error(`Expected 3 or 4 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, br), n45 = e57.parse(t45[2], 2, br); if (!r86 || !n45) return null; if (!kr(r86.type, [gr, yr, mr, fr, br])) return e57.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ir(r86.type)} instead`); if (4 === t45.length) { const i26 = e57.parse(t45[3], 3, mr); return i26 ? new Ji(r86, n45, i26) : null; } return new Ji(r86, n45); } evaluate(t45) { const e57 = this.needle.evaluate(t45), r86 = this.haystack.evaluate(t45); if (!zr(e57, ["boolean", "string", "number", "null"])) throw new Nr(`Expected first argument to be of type boolean, string, number or null, but found ${Ir(Lr(e57))} instead.`); if (!zr(r86, ["string", "array"])) throw new Nr(`Expected second argument to be of type array or string, but found ${Ir(Lr(r86))} instead.`); if (this.fromIndex) { const n45 = this.fromIndex.evaluate(t45); return r86.indexOf(e57, n45); } return r86.indexOf(e57); } eachChild(t45) { t45(this.needle), t45(this.haystack), this.fromIndex && t45(this.fromIndex); } outputDefined() { return false; } serialize() { if (null != this.fromIndex && void 0 !== this.fromIndex) { const t45 = this.fromIndex.serialize(); return ["index-of", this.needle.serialize(), this.haystack.serialize(), t45]; } return ["index-of", this.needle.serialize(), this.haystack.serialize()]; } } class Qi { constructor(t45, e57, r86, n45, i26, s18) { this.inputType = t45, this.type = e57, this.input = r86, this.cases = n45, this.outputs = i26, this.otherwise = s18; } static parse(t45, e57) { if (t45.length < 5) return e57.error(`Expected at least 4 arguments, but found only ${t45.length - 1}.`); if (t45.length % 2 != 1) return e57.error("Expected an even number of arguments."); let r86, n45; e57.expectedType && "value" !== e57.expectedType.kind && (n45 = e57.expectedType); const i26 = {}, s18 = []; for (let o89 = 2; o89 < t45.length - 1; o89 += 2) { let a47 = t45[o89]; const l21 = t45[o89 + 1]; Array.isArray(a47) || (a47 = [a47]); const u12 = e57.concat(o89); if (0 === a47.length) return u12.error("Expected at least one branch label."); for (const t46 of a47) { if ("number" != typeof t46 && "string" != typeof t46) return u12.error("Branch labels must be numbers or strings."); if ("number" == typeof t46 && Math.abs(t46) > Number.MAX_SAFE_INTEGER) return u12.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`); if ("number" == typeof t46 && Math.floor(t46) !== t46) return u12.error("Numeric branch labels must be integer values."); if (r86) { if (u12.checkSubtype(r86, Lr(t46))) return null; } else r86 = Lr(t46); if (void 0 !== i26[String(t46)]) return u12.error("Branch labels must be unique."); i26[String(t46)] = s18.length; } const c28 = e57.parse(l21, o89, n45); if (!c28) return null; n45 = n45 || c28.type, s18.push(c28); } const o88 = e57.parse(t45[1], 1, br); if (!o88) return null; const a46 = e57.parse(t45[t45.length - 1], t45.length - 1, n45); return a46 ? "value" !== o88.type.kind && e57.concat(1).checkSubtype(r86, o88.type) ? null : new Qi(r86, n45, o88, i26, s18, a46) : null; } evaluate(t45) { const e57 = this.input.evaluate(t45); return (Er(Lr(e57), this.inputType) && this.outputs[this.cases[e57]] || this.otherwise).evaluate(t45); } eachChild(t45) { t45(this.input), this.outputs.forEach(t45), t45(this.otherwise); } outputDefined() { return this.outputs.every(((t45) => t45.outputDefined())) && this.otherwise.outputDefined(); } serialize() { const t45 = ["match", this.input.serialize()], e57 = Object.keys(this.cases).sort(), r86 = [], n45 = {}; for (const t46 of e57) { const e58 = n45[this.cases[t46]]; void 0 === e58 ? (n45[this.cases[t46]] = r86.length, r86.push([this.cases[t46], [t46]])) : r86[e58][1].push(t46); } const i26 = (t46) => "number" === this.inputType.kind ? Number(t46) : t46; for (const [e58, n46] of r86) t45.push(1 === n46.length ? i26(n46[0]) : n46.map(i26)), t45.push(this.outputs[e58].serialize()); return t45.push(this.otherwise.serialize()), t45; } } class ts { constructor(t45, e57, r86) { this.type = t45, this.branches = e57, this.otherwise = r86; } static parse(t45, e57) { if (t45.length < 4) return e57.error(`Expected at least 3 arguments, but found only ${t45.length - 1}.`); if (t45.length % 2 != 0) return e57.error("Expected an odd number of arguments."); let r86; e57.expectedType && "value" !== e57.expectedType.kind && (r86 = e57.expectedType); const n45 = []; for (let i27 = 1; i27 < t45.length - 1; i27 += 2) { const s18 = e57.parse(t45[i27], i27, gr); if (!s18) return null; const o88 = e57.parse(t45[i27 + 1], i27 + 1, r86); if (!o88) return null; n45.push([s18, o88]), r86 = r86 || o88.type; } const i26 = e57.parse(t45[t45.length - 1], t45.length - 1, r86); return i26 ? new ts(r86, n45, i26) : null; } evaluate(t45) { for (const [e57, r86] of this.branches) if (e57.evaluate(t45)) return r86.evaluate(t45); return this.otherwise.evaluate(t45); } eachChild(t45) { for (const [e57, r86] of this.branches) t45(e57), t45(r86); t45(this.otherwise); } outputDefined() { return this.branches.every((([t45, e57]) => e57.outputDefined())) && this.otherwise.outputDefined(); } serialize() { const t45 = ["case"]; return this.eachChild(((e57) => { t45.push(e57.serialize()); })), t45; } } class es { constructor(t45, e57, r86, n45) { this.type = t45, this.input = e57, this.beginIndex = r86, this.endIndex = n45; } static parse(t45, e57) { if (t45.length <= 2 || t45.length >= 5) return e57.error(`Expected 3 or 4 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, br), n45 = e57.parse(t45[2], 2, mr); if (!r86 || !n45) return null; if (!kr(r86.type, [Mr(br), yr, br])) return e57.error(`Expected first argument to be of type array or string, but found ${Ir(r86.type)} instead`); if (4 === t45.length) { const i26 = e57.parse(t45[3], 3, mr); return i26 ? new es(r86.type, r86, n45, i26) : null; } return new es(r86.type, r86, n45); } evaluate(t45) { const e57 = this.input.evaluate(t45), r86 = this.beginIndex.evaluate(t45); if (!zr(e57, ["string", "array"])) throw new Nr(`Expected first argument to be of type array or string, but found ${Ir(Lr(e57))} instead.`); if (this.endIndex) { const n45 = this.endIndex.evaluate(t45); return e57.slice(r86, n45); } return e57.slice(r86); } eachChild(t45) { t45(this.input), t45(this.beginIndex), this.endIndex && t45(this.endIndex); } outputDefined() { return false; } serialize() { if (null != this.endIndex && void 0 !== this.endIndex) { const t45 = this.endIndex.serialize(); return ["slice", this.input.serialize(), this.beginIndex.serialize(), t45]; } return ["slice", this.input.serialize(), this.beginIndex.serialize()]; } } class rs { constructor(t45, e57) { this.type = Mr(yr), this.str = t45, this.delimiter = e57; } static parse(t45, e57) { if (3 !== t45.length) return e57.error(`Expected 2 arguments, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1, yr), n45 = e57.parse(t45[2], 2, yr); return r86 && n45 ? new rs(r86, n45) : void 0; } evaluate(t45) { const e57 = this.str.evaluate(t45), r86 = this.delimiter.evaluate(t45); return e57.split(r86); } eachChild(t45) { t45(this.str), t45(this.delimiter); } outputDefined() { return false; } serialize() { return ["split", this.str.serialize(), this.delimiter.serialize()]; } } function ns(t45, e57) { return "==" === t45 || "!=" === t45 ? "boolean" === e57.kind || "string" === e57.kind || "number" === e57.kind || "null" === e57.kind || "value" === e57.kind : "string" === e57.kind || "number" === e57.kind || "value" === e57.kind; } function is(t45, e57, r86, n45) { return 0 === n45.compare(e57, r86); } function ss(t45, e57, r86) { const n45 = "==" !== t45 && "!=" !== t45; return class i26 { constructor(t46, e58, r87) { this.type = gr, this.lhs = t46, this.rhs = e58, this.collator = r87, this.hasUntypedArgument = "value" === t46.type.kind || "value" === e58.type.kind; } static parse(t46, e58) { if (3 !== t46.length && 4 !== t46.length) return e58.error("Expected two or three arguments."); const r87 = t46[0]; let s18 = e58.parse(t46[1], 1, br); if (!s18) return null; if (!ns(r87, s18.type)) return e58.concat(1).error(`"${r87}" comparisons are not supported for type '${Ir(s18.type)}'.`); let o88 = e58.parse(t46[2], 2, br); if (!o88) return null; if (!ns(r87, o88.type)) return e58.concat(2).error(`"${r87}" comparisons are not supported for type '${Ir(o88.type)}'.`); if (s18.type.kind !== o88.type.kind && "value" !== s18.type.kind && "value" !== o88.type.kind) return e58.error(`Cannot compare types '${Ir(s18.type)}' and '${Ir(o88.type)}'.`); n45 && ("value" === s18.type.kind && "value" !== o88.type.kind ? s18 = new $r(o88.type, [s18]) : "value" !== s18.type.kind && "value" === o88.type.kind && (o88 = new $r(s18.type, [o88]))); let a46 = null; if (4 === t46.length) { if ("string" !== s18.type.kind && "string" !== o88.type.kind && "value" !== s18.type.kind && "value" !== o88.type.kind) return e58.error("Cannot use collator to compare non-string types."); if (a46 = e58.parse(t46[3], 3, wr), !a46) return null; } return new i26(s18, o88, a46); } evaluate(i27) { const s18 = this.lhs.evaluate(i27), o88 = this.rhs.evaluate(i27); if (n45 && this.hasUntypedArgument) { const e58 = Lr(s18), r87 = Lr(o88); if (e58.kind !== r87.kind || "string" !== e58.kind && "number" !== e58.kind) throw new Nr(`Expected arguments for "${t45}" to be (string, string) or (number, number), but found (${e58.kind}, ${r87.kind}) instead.`); } if (this.collator && !n45 && this.hasUntypedArgument) { const t46 = Lr(s18), r87 = Lr(o88); if ("string" !== t46.kind || "string" !== r87.kind) return e57(i27, s18, o88); } return this.collator ? r86(i27, s18, o88, this.collator.evaluate(i27)) : e57(i27, s18, o88); } eachChild(t46) { t46(this.lhs), t46(this.rhs), this.collator && t46(this.collator); } outputDefined() { return true; } serialize() { const e58 = [t45]; return this.eachChild(((t46) => { e58.push(t46.serialize()); })), e58; } }; } const os = ss("==", (function(t45, e57, r86) { return e57 === r86; }), is), as = ss("!=", (function(t45, e57, r86) { return e57 !== r86; }), (function(t45, e57, r86, n45) { return !is(0, e57, r86, n45); })), ls = ss("<", (function(t45, e57, r86) { return e57 < r86; }), (function(t45, e57, r86, n45) { return n45.compare(e57, r86) < 0; })), us = ss(">", (function(t45, e57, r86) { return e57 > r86; }), (function(t45, e57, r86, n45) { return n45.compare(e57, r86) > 0; })), cs = ss("<=", (function(t45, e57, r86) { return e57 <= r86; }), (function(t45, e57, r86, n45) { return n45.compare(e57, r86) <= 0; })), hs = ss(">=", (function(t45, e57, r86) { return e57 >= r86; }), (function(t45, e57, r86, n45) { return n45.compare(e57, r86) >= 0; })); class ps { constructor(t45, e57, r86, n45, i26, s18) { this.type = yr, this.number = t45, this.locale = e57, this.currency = r86, this.unit = n45, this.minFractionDigits = i26, this.maxFractionDigits = s18; } static parse(t45, e57) { if (3 !== t45.length) return e57.error("Expected two arguments."); const r86 = e57.parse(t45[1], 1, mr); if (!r86) return null; const n45 = t45[2]; if ("object" != typeof n45 || Array.isArray(n45)) return e57.error("NumberFormat options argument must be an object."); let i26 = null; if (n45.locale && (i26 = e57.parseObjectValue(n45.locale, 2, "locale", yr), !i26)) return null; let s18 = null; if (n45.currency && (s18 = e57.parseObjectValue(n45.currency, 2, "currency", yr), !s18)) return null; let o88 = null; if (n45.unit && (o88 = e57.parseObjectValue(n45.unit, 2, "unit", yr), !o88)) return null; let a46 = null; if (n45["min-fraction-digits"] && (a46 = e57.parseObjectValue(n45["min-fraction-digits"], 2, "min-fraction-digits", mr), !a46)) return null; let l21 = null; return n45["max-fraction-digits"] && (l21 = e57.parseObjectValue(n45["max-fraction-digits"], 2, "max-fraction-digits", mr), !l21) ? null : new ps(r86, i26, s18, o88, a46, l21); } evaluate(t45) { return new Intl.NumberFormat(this.locale ? this.locale.evaluate(t45) : [], { style: (this.currency ? "currency" : this.unit && "unit") || "decimal", currency: this.currency ? this.currency.evaluate(t45) : void 0, unit: this.unit ? this.unit.evaluate(t45) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(t45) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(t45) : void 0 }).format(this.number.evaluate(t45)); } eachChild(t45) { t45(this.number), this.locale && t45(this.locale), this.currency && t45(this.currency), this.unit && t45(this.unit), this.minFractionDigits && t45(this.minFractionDigits), this.maxFractionDigits && t45(this.maxFractionDigits); } outputDefined() { return false; } serialize() { const t45 = {}; return this.locale && (t45.locale = this.locale.serialize()), this.currency && (t45.currency = this.currency.serialize()), this.unit && (t45.unit = this.unit.serialize()), this.minFractionDigits && (t45["min-fraction-digits"] = this.minFractionDigits.serialize()), this.maxFractionDigits && (t45["max-fraction-digits"] = this.maxFractionDigits.serialize()), ["number-format", this.number.serialize(), t45]; } } class ds { constructor(t45) { this.type = mr, this.input = t45; } static parse(t45, e57) { if (2 !== t45.length) return e57.error(`Expected 1 argument, but found ${t45.length - 1} instead.`); const r86 = e57.parse(t45[1], 1); return r86 ? "array" !== r86.type.kind && "string" !== r86.type.kind && "value" !== r86.type.kind ? e57.error(`Expected argument of type string or array, but found ${Ir(r86.type)} instead.`) : new ds(r86) : null; } evaluate(t45) { const e57 = this.input.evaluate(t45); if ("string" == typeof e57) return e57.length; if (Array.isArray(e57)) return e57.length; throw new Nr(`Expected value to be of type string or array, but found ${Ir(Lr(e57))} instead.`); } eachChild(t45) { t45(this.input); } outputDefined() { return false; } serialize() { const t45 = ["length"]; return this.eachChild(((e57) => { t45.push(e57.serialize()); })), t45; } } function fs(t45) { return function() { t45 = 1831565813 + (t45 |= 0) | 0; let e57 = Math.imul(t45 ^ t45 >>> 15, 1 | t45); return e57 = e57 + Math.imul(e57 ^ e57 >>> 7, 61 | e57) ^ e57, ((e57 ^ e57 >>> 14) >>> 0) / 4294967296; }; } const ms = { "==": os, "!=": as, ">": us, "<": ls, ">=": hs, "<=": cs, array: $r, at: Wi, "at-interpolated": Yi, boolean: $r, case: ts, coalesce: Xi, collator: nn, format: Gr, image: Hr, in: Ki, "index-of": Ji, interpolate: Hi, "interpolate-hcl": Hi, "interpolate-lab": Hi, length: ds, let: Zi, literal: Ur, match: Qi, number: $r, "number-format": ps, object: $r, slice: es, step: Si, string: $r, "to-boolean": Jr, "to-color": Jr, "to-number": Jr, "to-string": Jr, var: _i, within: Pn, distance: di, config: wi, split: rs }; function ys(t45, [e57, r86, n45, i26]) { e57 = e57.evaluate(t45), r86 = r86.evaluate(t45), n45 = n45.evaluate(t45); const s18 = i26 ? i26.evaluate(t45) : 1, o88 = Dr(e57, r86, n45, s18); if (o88) throw new Nr(o88); return new sr(e57 / 255, r86 / 255, n45 / 255, s18); } function gs(t45, [e57, r86, n45, i26]) { e57 = e57.evaluate(t45), r86 = r86.evaluate(t45), n45 = n45.evaluate(t45); const s18 = i26 ? i26.evaluate(t45) : 1, o88 = (function(t46, e58, r87, n46) { return "number" == typeof t46 && t46 >= 0 && t46 <= 360 ? "number" == typeof e58 && e58 >= 0 && e58 <= 100 && "number" == typeof r87 && r87 >= 0 && r87 <= 100 ? void 0 === n46 || "number" == typeof n46 && n46 >= 0 && n46 <= 1 ? null : `Invalid hsla value [${[t46, e58, r87, n46].join(", ")}]: 'a' must be between 0 and 1.` : `Invalid hsla value [${("number" == typeof n46 ? [t46, e58, r87, n46] : [t46, e58, r87]).join(", ")}]: 's', and 'l' must be between 0 and 100.` : `Invalid hsla value [${("number" == typeof n46 ? [t46, e58, r87, n46] : [t46, e58, r87]).join(", ")}]: 'h' must be between 0 and 360.`; })(e57, r86, n45, s18); if (o88) throw new Nr(o88); const a46 = `hsla(${e57}, ${r86}%, ${n45}%, ${s18})`, l21 = sr.parse(a46); if (!l21) throw new Nr(`Failed to parse HSLA color: ${a46}`); return l21; } function xs(t45, e57) { return t45 in e57; } function vs(t45, e57) { const r86 = e57[t45]; return void 0 === r86 ? null : r86; } function bs(t45) { return { type: t45 }; } function ws(t45) { return { result: "success", value: t45 }; } function _s(t45) { return { result: "error", value: t45 }; } function As(t45, e57) { return !!t45 && !!t45.parameters && t45.parameters.indexOf(e57) > -1; } function Ms(t45) { return "data-driven" === t45["property-type"]; } function Is(t45) { return As(t45.expression, "measure-light"); } function Ss(t45) { return As(t45.expression, "zoom"); } function Ps(t45) { return !!t45.expression && t45.expression.interpolated; } function ks(t45) { return "object" == typeof t45 && null !== t45 && !Array.isArray(t45); } function zs(t45) { return t45; } function Es(t45, e57) { const r86 = "color" === e57.type, n45 = t45.stops && "object" == typeof t45.stops[0][0], i26 = n45 || !(n45 || void 0 !== t45.property), s18 = t45.type || (Ps(e57) ? "exponential" : "interval"); if (r86 && ((t45 = Object.assign({}, t45)).stops && (t45.stops = t45.stops.map(((t46) => [t46[0], sr.parse(t46[1])]))), t45.default = sr.parse(t45.default ? t45.default : e57.default)), t45.colorSpace && "rgb" !== t45.colorSpace && !Gi[t45.colorSpace]) throw new Error(`Unknown color space: ${t45.colorSpace}`); let o88, a46, l21; if ("exponential" === s18) o88 = Fs; else if ("interval" === s18) o88 = Vs; else if ("categorical" === s18) { o88 = Bs, a46 = /* @__PURE__ */ Object.create(null); for (const e58 of t45.stops) a46[e58[0]] = e58[1]; l21 = typeof t45.stops[0][0]; } else { if ("identity" !== s18) throw new Error(`Unknown function type "${s18}"`); o88 = Cs; } if (n45) { const r87 = {}, n46 = []; for (let e58 = 0; e58 < t45.stops.length; e58++) { const i28 = t45.stops[e58], s20 = i28[0].zoom; void 0 === r87[s20] && (r87[s20] = { zoom: s20, type: t45.type, property: t45.property, default: t45.default, stops: [] }, n46.push(s20)), r87[s20].stops.push([i28[0].value, i28[1]]); } const i27 = []; for (const t46 of n46) i27.push([r87[t46].zoom, Es(r87[t46], e57)]); const s19 = { name: "linear" }; return { kind: "composite", interpolationType: s19, interpolationFactor: Hi.interpolationFactor.bind(void 0, s19), zoomStops: i27.map(((t46) => t46[0])), evaluate: ({ zoom: r88 }, n47) => Fs({ stops: i27, base: t45.base }, e57, r88).evaluate(r88, n47) }; } if (i26) { const r87 = "exponential" === s18 ? { name: "exponential", base: void 0 !== t45.base ? t45.base : 1 } : null; return { kind: "camera", interpolationType: r87, interpolationFactor: Hi.interpolationFactor.bind(void 0, r87), zoomStops: t45.stops.map(((t46) => t46[0])), evaluate: ({ zoom: r88 }) => o88(t45, e57, r88, a46, l21) }; } return { kind: "source", evaluate(r87, n46) { const i27 = n46 && n46.properties ? n46.properties[t45.property] : void 0; return void 0 === i27 ? Ts(t45.default, e57.default) : o88(t45, e57, i27, a46, l21); } }; } function Ts(t45, e57, r86) { return void 0 !== t45 ? t45 : void 0 !== e57 ? e57 : void 0 !== r86 ? r86 : void 0; } function Bs(t45, e57, r86, n45, i26) { return Ts(typeof r86 === i26 ? n45[r86] : void 0, t45.default, e57.default); } function Vs(t45, e57, r86) { if (!Wr(r86)) return Ts(t45.default, e57.default); const n45 = t45.stops.length; if (1 === n45) return t45.stops[0][1]; if (r86 <= t45.stops[0][0]) return t45.stops[0][1]; if (r86 >= t45.stops[n45 - 1][0]) return t45.stops[n45 - 1][1]; const i26 = Ii(t45.stops.map(((t46) => t46[0])), r86); return t45.stops[i26][1]; } function Fs(t45, e57, r86) { const n45 = void 0 !== t45.base ? t45.base : 1; if (!Wr(r86)) return Ts(t45.default, e57.default); const i26 = t45.stops.length; if (1 === i26) return t45.stops[0][1]; if (r86 <= t45.stops[0][0]) return t45.stops[0][1]; if (r86 >= t45.stops[i26 - 1][0]) return t45.stops[i26 - 1][1]; const s18 = Ii(t45.stops.map(((t46) => t46[0])), r86), o88 = (function(t46, e58, r87, n46) { const i27 = n46 - r87, s19 = t46 - r87; return 0 === i27 ? 0 : 1 === e58 ? s19 / i27 : (Math.pow(e58, s19) - 1) / (Math.pow(e58, i27) - 1); })(r86, n45, t45.stops[s18][0], t45.stops[s18 + 1][0]), a46 = t45.stops[s18][1], l21 = t45.stops[s18 + 1][1]; let u12 = hr[e57.type] || zs; if (t45.colorSpace && "rgb" !== t45.colorSpace) { const e58 = Gi[t45.colorSpace]; u12 = (t46, r87) => e58.reverse(e58.interpolate(e58.forward(t46), e58.forward(r87), o88)); } return "function" == typeof a46.evaluate ? { evaluate(...t46) { const e58 = a46.evaluate.apply(void 0, t46), r87 = l21.evaluate.apply(void 0, t46); if (void 0 !== e58 && void 0 !== r87) return u12(e58, r87, o88); } } : u12(a46, l21, o88); } function Cs(t45, e57, r86) { return "color" === e57.type ? r86 = sr.parse(r86) : "formatted" === e57.type ? r86 = Vr.fromString(r86.toString()) : "resolvedImage" === e57.type ? r86 = Cr.build(r86.toString()) : qr(r86) === e57.type || "enum" === e57.type && e57.values[r86] || (r86 = void 0), Ts(r86, t45.default, e57.default); } en.register(ms, { error: [{ kind: "error" }, [yr], (t45, [e57]) => { throw new Nr(e57.evaluate(t45)); }], typeof: [yr, [br], (t45, [e57]) => Ir(Lr(e57.evaluate(t45)))], "to-rgba": [Mr(mr, 4), [xr], (t45, [e57]) => e57.evaluate(t45).toNonPremultipliedRenderColor(null).toArray()], "to-hsla": [Mr(mr, 4), [xr], (t45, [e57]) => e57.evaluate(t45).toNonPremultipliedRenderColor(null).toHslaArray()], rgb: [xr, [mr, mr, mr], ys], rgba: [xr, [mr, mr, mr, mr], ys], hsl: [xr, [mr, mr, mr], gs], hsla: [xr, [mr, mr, mr, mr], gs], has: { type: gr, overloads: [[[yr], (t45, [e57]) => xs(e57.evaluate(t45), t45.properties())], [[yr, vr], (t45, [e57, r86]) => xs(e57.evaluate(t45), r86.evaluate(t45))]] }, get: { type: br, overloads: [[[yr], (t45, [e57]) => vs(e57.evaluate(t45), t45.properties())], [[yr, vr], (t45, [e57, r86]) => vs(e57.evaluate(t45), r86.evaluate(t45))]] }, "feature-state": [br, [yr], (t45, [e57]) => vs(e57.evaluate(t45), t45.featureState || {})], properties: [vr, [], (t45) => t45.properties()], "geometry-type": [yr, [], (t45) => t45.geometryType()], worldview: [yr, [], (t45) => t45.globals.worldview || ""], id: [br, [], (t45) => t45.id()], zoom: [mr, [], (t45) => t45.globals.zoom], pitch: [mr, [], (t45) => t45.globals.pitch || 0], "distance-from-center": [mr, [], (t45) => t45.distanceFromCenter()], "measure-light": [mr, [yr], (t45, [e57]) => t45.measureLight(e57.evaluate(t45))], "heatmap-density": [mr, [], (t45) => t45.globals.heatmapDensity || 0], "line-progress": [mr, [], (t45) => t45.globals.lineProgress || 0], "raster-value": [mr, [], (t45) => t45.globals.rasterValue || 0], "raster-particle-speed": [mr, [], (t45) => t45.globals.rasterParticleSpeed || 0], "sky-radial-progress": [mr, [], (t45) => t45.globals.skyRadialProgress || 0], accumulated: [br, [], (t45) => void 0 === t45.globals.accumulated ? null : t45.globals.accumulated], "+": [mr, bs(mr), (t45, e57) => { let r86 = 0; for (const n45 of e57) r86 += n45.evaluate(t45); return r86; }], "*": [mr, bs(mr), (t45, e57) => { let r86 = 1; for (const n45 of e57) r86 *= n45.evaluate(t45); return r86; }], "-": { type: mr, overloads: [[[mr, mr], (t45, [e57, r86]) => e57.evaluate(t45) - r86.evaluate(t45)], [[mr], (t45, [e57]) => -e57.evaluate(t45)]] }, "/": [mr, [mr, mr], (t45, [e57, r86]) => e57.evaluate(t45) / r86.evaluate(t45)], "%": [mr, [mr, mr], (t45, [e57, r86]) => e57.evaluate(t45) % r86.evaluate(t45)], ln2: [mr, [], () => Math.LN2], pi: [mr, [], () => Math.PI], e: [mr, [], () => Math.E], "^": [mr, [mr, mr], (t45, [e57, r86]) => Math.pow(e57.evaluate(t45), r86.evaluate(t45))], sqrt: [mr, [mr], (t45, [e57]) => Math.sqrt(e57.evaluate(t45))], log10: [mr, [mr], (t45, [e57]) => Math.log(e57.evaluate(t45)) / Math.LN10], ln: [mr, [mr], (t45, [e57]) => Math.log(e57.evaluate(t45))], log2: [mr, [mr], (t45, [e57]) => Math.log2(e57.evaluate(t45))], sin: [mr, [mr], (t45, [e57]) => Math.sin(e57.evaluate(t45))], cos: [mr, [mr], (t45, [e57]) => Math.cos(e57.evaluate(t45))], tan: [mr, [mr], (t45, [e57]) => Math.tan(e57.evaluate(t45))], asin: [mr, [mr], (t45, [e57]) => Math.asin(e57.evaluate(t45))], acos: [mr, [mr], (t45, [e57]) => Math.acos(e57.evaluate(t45))], atan: [mr, [mr], (t45, [e57]) => Math.atan(e57.evaluate(t45))], min: [mr, bs(mr), (t45, e57) => Math.min(...e57.map(((e58) => e58.evaluate(t45))))], max: [mr, bs(mr), (t45, e57) => Math.max(...e57.map(((e58) => e58.evaluate(t45))))], abs: [mr, [mr], (t45, [e57]) => Math.abs(e57.evaluate(t45))], round: [mr, [mr], (t45, [e57]) => { const r86 = e57.evaluate(t45); return r86 < 0 ? -Math.round(-r86) : Math.round(r86); }], floor: [mr, [mr], (t45, [e57]) => Math.floor(e57.evaluate(t45))], ceil: [mr, [mr], (t45, [e57]) => Math.ceil(e57.evaluate(t45))], "filter-==": [gr, [yr, br], (t45, [e57, r86]) => t45.properties()[e57.value] === r86.value], "filter-id-==": [gr, [br], (t45, [e57]) => t45.id() === e57.value], "filter-type-==": [gr, [yr], (t45, [e57]) => t45.geometryType() === e57.value], "filter-<": [gr, [yr, br], (t45, [e57, r86]) => { const n45 = t45.properties()[e57.value], i26 = r86.value; return typeof n45 == typeof i26 && n45 < i26; }], "filter-id-<": [gr, [br], (t45, [e57]) => { const r86 = t45.id(), n45 = e57.value; return typeof r86 == typeof n45 && r86 < n45; }], "filter->": [gr, [yr, br], (t45, [e57, r86]) => { const n45 = t45.properties()[e57.value], i26 = r86.value; return typeof n45 == typeof i26 && n45 > i26; }], "filter-id->": [gr, [br], (t45, [e57]) => { const r86 = t45.id(), n45 = e57.value; return typeof r86 == typeof n45 && r86 > n45; }], "filter-<=": [gr, [yr, br], (t45, [e57, r86]) => { const n45 = t45.properties()[e57.value], i26 = r86.value; return typeof n45 == typeof i26 && n45 <= i26; }], "filter-id-<=": [gr, [br], (t45, [e57]) => { const r86 = t45.id(), n45 = e57.value; return typeof r86 == typeof n45 && r86 <= n45; }], "filter->=": [gr, [yr, br], (t45, [e57, r86]) => { const n45 = t45.properties()[e57.value], i26 = r86.value; return typeof n45 == typeof i26 && n45 >= i26; }], "filter-id->=": [gr, [br], (t45, [e57]) => { const r86 = t45.id(), n45 = e57.value; return typeof r86 == typeof n45 && r86 >= n45; }], "filter-has": [gr, [br], (t45, [e57]) => e57.value in t45.properties()], "filter-has-id": [gr, [], (t45) => null !== t45.id() && void 0 !== t45.id()], "filter-type-in": [gr, [Mr(yr)], (t45, [e57]) => e57.value.indexOf(t45.geometryType()) >= 0], "filter-id-in": [gr, [Mr(br)], (t45, [e57]) => e57.value.indexOf(t45.id()) >= 0], "filter-in-small": [gr, [yr, Mr(br)], (t45, [e57, r86]) => r86.value.indexOf(t45.properties()[e57.value]) >= 0], "filter-in-large": [gr, [yr, Mr(br)], (t45, [e57, r86]) => (function(t46, e58, r87, n45) { for (; r87 <= n45; ) { const i26 = r87 + n45 >> 1; if (e58[i26] === t46) return true; e58[i26] > t46 ? n45 = i26 - 1 : r87 = i26 + 1; } return false; })(t45.properties()[e57.value], r86.value, 0, r86.value.length - 1)], all: { type: gr, overloads: [[[gr, gr], (t45, [e57, r86]) => e57.evaluate(t45) && r86.evaluate(t45)], [bs(gr), (t45, e57) => { for (const r86 of e57) if (!r86.evaluate(t45)) return false; return true; }]] }, any: { type: gr, overloads: [[[gr, gr], (t45, [e57, r86]) => e57.evaluate(t45) || r86.evaluate(t45)], [bs(gr), (t45, e57) => { for (const r86 of e57) if (r86.evaluate(t45)) return true; return false; }]] }, "!": [gr, [gr], (t45, [e57]) => !e57.evaluate(t45)], "is-supported-script": [gr, [yr], (t45, [e57]) => { const r86 = t45.globals && t45.globals.isSupportedScript; return !r86 || r86(e57.evaluate(t45)); }], upcase: [yr, [yr], (t45, [e57]) => e57.evaluate(t45).toUpperCase()], downcase: [yr, [yr], (t45, [e57]) => e57.evaluate(t45).toLowerCase()], concat: [yr, bs(br), (t45, e57) => e57.map(((e58) => Or(e58.evaluate(t45)))).join("")], "resolved-locale": [yr, [wr], (t45, [e57]) => e57.evaluate(t45).resolvedLocale()], random: [mr, [mr, mr, br], (t45, e57) => { const [r86, n45, i26] = e57.map(((e58) => e58.evaluate(t45))); if (r86 > n45) return r86; if (r86 === n45) return r86; let s18; if ("string" == typeof i26) s18 = (function(t46) { let e58 = 0; if (0 === t46.length) return e58; for (let r87 = 0; r87 < t46.length; r87++) e58 = (e58 << 5) - e58 + t46.charCodeAt(r87), e58 |= 0; return e58; })(i26); else { if ("number" != typeof i26) throw new Nr(`Invalid seed input: ${i26}`); s18 = i26; } return r86 + fs(s18)() * (n45 - r86); }] }); class Ds { constructor(t45, e57, r86, n45, i26) { this.expression = t45, this._warningHistory = {}, this._evaluator = new tn(r86, n45, i26), this._defaultValue = e57 ? (function(t46) { return "color" === t46.type && (ks(t46.default) || Array.isArray(t46.default)) ? new sr(0, 0, 0, 0) : "color" === t46.type ? sr.parse(t46.default) || null : void 0 === t46.default ? null : t46.default; })(e57) : null, this._enumValues = e57 && "enum" === e57.type ? e57.values : null, this.configDependencies = yi(t45); } evaluateWithoutErrorHandling(t45, e57, r86, n45, i26, s18, o88, a46) { return this._evaluator.globals = t45, this._evaluator.feature = e57, this._evaluator.featureState = r86, this._evaluator.canonical = n45 || null, this._evaluator.availableImages = i26 || null, this._evaluator.formattedSection = s18, this._evaluator.featureTileCoord = o88 || null, this._evaluator.featureDistanceData = a46 || null, this.expression.evaluate(this._evaluator); } evaluate(t45, e57, r86, n45, i26, s18, o88, a46, l21) { this._evaluator.globals = t45, this._evaluator.feature = e57 || null, this._evaluator.featureState = r86 || null, this._evaluator.canonical = n45 || null, this._evaluator.availableImages = i26 || null, this._evaluator.formattedSection = s18 || null, this._evaluator.featureTileCoord = o88 || null, this._evaluator.featureDistanceData = a46 || null, this._evaluator.iconImageUseTheme = l21 || null; try { const t46 = this.expression.evaluate(this._evaluator); if (null == t46 || "number" == typeof t46 && t46 != t46) return this._defaultValue; if (this._enumValues && !(t46 in this._enumValues)) throw new Nr(`Expected value to be one of ${Object.keys(this._enumValues).map(((t47) => JSON.stringify(t47))).join(", ")}, but found ${JSON.stringify(t46)} instead.`); return t46; } catch (t46) { return this._warningHistory[t46.message] || (this._warningHistory[t46.message] = true, "undefined" != typeof console && console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${t46.message}`)), this._defaultValue; } } } function Rs(t45) { return Array.isArray(t45) && t45.length > 0 && "string" == typeof t45[0] && t45[0] in ms; } function Ls(t45, e57, r86, n45, i26) { const s18 = new Ai(ms, [], e57 ? (function(t46) { const e58 = { color: xr, string: yr, number: mr, enum: yr, boolean: gr, formatted: _r, resolvedImage: Ar }; return "array" === t46.type ? Mr(e58[t46.value] || br, t46.length) : e58[t46.type]; })(e57) : void 0, void 0, void 0, r86, n45, i26), o88 = s18.parse(t45, void 0, void 0, void 0, e57 && "string" === e57.type ? { typeAnnotation: "coerce" } : void 0); return o88 ? ws(new Ds(o88, e57, r86, n45, i26)) : _s(s18.errors); } class Os { constructor(t45, e57, r86, n45) { this.kind = t45, this._styleExpression = e57, this.isLightConstant = r86, this.isLineProgressConstant = n45, this.isStateDependent = "constant" !== t45 && !mi(e57.expression), this.configDependencies = yi(e57.expression); } evaluateWithoutErrorHandling(t45, e57, r86, n45, i26, s18) { return this._styleExpression.evaluateWithoutErrorHandling(t45, e57, r86, n45, i26, s18); } evaluate(t45, e57, r86, n45, i26, s18, o88) { return this._styleExpression.evaluate(t45, e57, r86, n45, i26, s18, void 0, void 0, o88); } } class Us { constructor(t45, e57, r86, n45, i26, s18) { this.kind = t45, this.zoomStops = r86, this._styleExpression = e57, this.isStateDependent = "camera" !== t45 && !mi(e57.expression), this.isLightConstant = i26, this.isLineProgressConstant = s18, this.configDependencies = yi(e57.expression), this.interpolationType = n45; } evaluateWithoutErrorHandling(t45, e57, r86, n45, i26, s18) { return this._styleExpression.evaluateWithoutErrorHandling(t45, e57, r86, n45, i26, s18); } evaluate(t45, e57, r86, n45, i26, s18) { return this._styleExpression.evaluate(t45, e57, r86, n45, i26, s18); } interpolationFactor(t45, e57, r86) { return this.interpolationType ? Hi.interpolationFactor(this.interpolationType, t45, e57, r86) : 0; } } function Ns(t45, e57, r86, n45, i26) { if ("error" === (t45 = Ls(t45, e57, r86, n45, i26)).result) return t45; const s18 = t45.value.expression, o88 = fi(s18); if (!o88 && !Ms(e57)) return _s([new pr("", "data expressions not supported")]); const a46 = gi(s18, ["zoom", "pitch", "distance-from-center"]); if (!a46 && !Ss(e57)) return _s([new pr("", "zoom expressions not supported")]); const l21 = gi(s18, ["measure-light"]); if (!l21 && !Is(e57)) return _s([new pr("", "measure-light expression not supported")]); const u12 = gi(s18, ["line-progress"]); if (!u12 && !(function(t46) { return As(t46.expression, "line-progress"); })(e57)) return _s([new pr("", "line-progress expression not supported")]); const c28 = e57.expression && e57.expression.relaxZoomRestriction, h8 = $s(s18); return h8 || a46 || c28 ? h8 instanceof pr ? _s([h8]) : h8 instanceof Hi && !Ps(e57) ? _s([new pr("", '"interpolate" expressions cannot be used with this property')]) : ws(h8 ? new Us(o88 && u12 ? "camera" : "composite", t45.value, h8.labels, h8 instanceof Hi ? h8.interpolation : void 0, l21, u12) : new Os(o88 && u12 ? "constant" : "source", t45.value, l21, u12)) : _s([new pr("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')]); } class js { constructor(t45, e57) { this._parameters = t45, this._specification = e57, Object.assign(this, Es(this._parameters, this._specification)); } static deserialize(t45) { return new js(t45._parameters, t45._specification); } static serialize(t45) { return { _parameters: t45._parameters, _specification: t45._specification }; } } function $s(t45) { let e57 = null; if (t45 instanceof Zi) e57 = $s(t45.result); else if (t45 instanceof Xi) { for (const r86 of t45.args) if (e57 = $s(r86), e57) break; } else (t45 instanceof Si || t45 instanceof Hi) && t45.input instanceof en && "zoom" === t45.input.name && (e57 = t45); return e57 instanceof pr || t45.eachChild(((t46) => { const r86 = $s(t46); r86 instanceof pr ? e57 = r86 : e57 && r86 && e57 !== r86 && (e57 = new pr("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.')); })), e57; } var Gs, Hs, qs = (function() { if (Hs) return Gs; Hs = 1, Gs = e57; var t45 = 3; function e57(e58, r86, n45) { var i26 = this.cells = []; if (e58 instanceof ArrayBuffer) { this.arrayBuffer = e58; var s18 = new Int32Array(this.arrayBuffer); e58 = s18[0], this.d = (r86 = s18[1]) + 2 * (n45 = s18[2]); for (var o88 = 0; o88 < this.d * this.d; o88++) { var a46 = s18[t45 + o88], l21 = s18[t45 + o88 + 1]; i26.push(a46 === l21 ? null : s18.subarray(a46, l21)); } var u12 = s18[t45 + i26.length + 1]; this.keys = s18.subarray(s18[t45 + i26.length], u12), this.bboxes = s18.subarray(u12), this.insert = this._insertReadonly; } else { this.d = r86 + 2 * n45; for (var c28 = 0; c28 < this.d * this.d; c28++) i26.push([]); this.keys = [], this.bboxes = []; } this.n = r86, this.extent = e58, this.padding = n45, this.scale = r86 / e58, this.uid = 0; var h8 = n45 / r86 * e58; this.min = -h8, this.max = e58 + h8; } return e57.prototype.insert = function(t46, e58, r86, n45, i26) { this._forEachCell(e58, r86, n45, i26, this._insertCell, this.uid++), this.keys.push(t46), this.bboxes.push(e58), this.bboxes.push(r86), this.bboxes.push(n45), this.bboxes.push(i26); }, e57.prototype._insertReadonly = function() { throw "Cannot insert into a GridIndex created from an ArrayBuffer."; }, e57.prototype._insertCell = function(t46, e58, r86, n45, i26, s18) { this.cells[i26].push(s18); }, e57.prototype.query = function(t46, e58, r86, n45, i26) { var s18 = this.min, o88 = this.max; if (t46 <= s18 && e58 <= s18 && o88 <= r86 && o88 <= n45 && !i26) return Array.prototype.slice.call(this.keys); var a46 = []; return this._forEachCell(t46, e58, r86, n45, this._queryCell, a46, {}, i26), a46; }, e57.prototype._queryCell = function(t46, e58, r86, n45, i26, s18, o88, a46) { var l21 = this.cells[i26]; if (null !== l21) for (var u12 = this.keys, c28 = this.bboxes, h8 = 0; h8 < l21.length; h8++) { var p9 = l21[h8]; if (void 0 === o88[p9]) { var d34 = 4 * p9; (a46 ? a46(c28[d34 + 0], c28[d34 + 1], c28[d34 + 2], c28[d34 + 3]) : t46 <= c28[d34 + 2] && e58 <= c28[d34 + 3] && r86 >= c28[d34 + 0] && n45 >= c28[d34 + 1]) ? (o88[p9] = true, s18.push(u12[p9])) : o88[p9] = false; } } }, e57.prototype._forEachCell = function(t46, e58, r86, n45, i26, s18, o88, a46) { for (var l21 = this._convertToCellCoord(t46), u12 = this._convertToCellCoord(e58), c28 = this._convertToCellCoord(r86), h8 = this._convertToCellCoord(n45), p9 = l21; p9 <= c28; p9++) for (var d34 = u12; d34 <= h8; d34++) { var f8 = this.d * d34 + p9; if ((!a46 || a46(this._convertFromCellCoord(p9), this._convertFromCellCoord(d34), this._convertFromCellCoord(p9 + 1), this._convertFromCellCoord(d34 + 1))) && i26.call(this, t46, e58, r86, n45, f8, s18, o88, a46)) return; } }, e57.prototype._convertFromCellCoord = function(t46) { return (t46 - this.padding) / this.scale; }, e57.prototype._convertToCellCoord = function(t46) { return Math.max(0, Math.min(this.d - 1, Math.floor(t46 * this.scale) + this.padding)); }, e57.prototype.toArrayBuffer = function() { if (this.arrayBuffer) return this.arrayBuffer; for (var e58 = this.cells, r86 = t45 + this.cells.length + 1 + 1, n45 = 0, i26 = 0; i26 < this.cells.length; i26++) n45 += this.cells[i26].length; var s18 = new Int32Array(r86 + n45 + this.keys.length + this.bboxes.length); s18[0] = this.extent, s18[1] = this.n, s18[2] = this.padding; for (var o88 = r86, a46 = 0; a46 < e58.length; a46++) { var l21 = e58[a46]; s18[t45 + a46] = o88, s18.set(l21, o88), o88 += l21.length; } return s18[t45 + e58.length] = o88, s18.set(this.keys, o88), s18[t45 + e58.length + 1] = o88 += this.keys.length, s18.set(this.bboxes, o88), o88 += this.bboxes.length, s18.buffer; }, Gs; })(), Xs = xt(qs); const Zs = {}; function Ws(t45, e57, r86 = {}) { Object.defineProperty(t45, "_classRegistryKey", { value: e57, writable: false }), Zs[e57] = { klass: t45, omit: r86.omit || [] }; } Ws(Object, "Object"), Xs.serialize = function(t45, e57) { const r86 = t45.toArrayBuffer(); return e57 && e57.add(r86), { buffer: r86 }; }, Xs.deserialize = function(t45) { return new Xs(t45.buffer); }, Object.defineProperty(Xs, "name", { value: "Grid" }), Ws(Xs, "Grid"), delete wt.prototype.constructor, "undefined" != typeof DOMMatrix && Ws(DOMMatrix, "DOMMatrix"), Ws(sr, "Color"), Ws(Error, "Error"), Ws(Vr, "Formatted"), Ws(Br, "FormattedSection"), Ws(Ve, "AJAXError"), Ws(Cr, "ResolvedImage"), Ws(js, "StylePropertyFunction"), Ws(Ds, "StyleExpression", { omit: ["_evaluator"] }), Ws(er, "ImageId"), Ws(Fr, "ImageVariant"), Ws(Us, "ZoomDependentExpression"), Ws(Os, "ZoomConstantExpression"), Ws(en, "CompoundExpression", { omit: ["_evaluate"] }); for (const t45 in ms) Zs[ms[t45]._classRegistryKey] || Ws(ms[t45], `Expression${t45}`); function Ys(t45) { return t45 && "undefined" != typeof ArrayBuffer && (t45 instanceof ArrayBuffer || t45.constructor && "ArrayBuffer" === t45.constructor.name); } function Ks(t45) { return self.ImageBitmap && t45 instanceof ImageBitmap; } function Js(t45, e57) { if (null == t45 || "boolean" == typeof t45 || "number" == typeof t45 || "string" == typeof t45 || t45 instanceof Boolean || t45 instanceof Number || t45 instanceof String || t45 instanceof Date || t45 instanceof RegExp) return t45; if (Ys(t45) || Ks(t45)) return e57 && e57.add(t45), t45; if (ArrayBuffer.isView(t45)) return e57 && e57.add(t45.buffer), t45; if (t45 instanceof ImageData) return e57 && e57.add(t45.data.buffer), t45; if (Array.isArray(t45)) { const r86 = []; for (const n45 of t45) r86.push(Js(n45, e57)); return r86; } if (t45 instanceof Map) { const r86 = { $name: "Map", entries: [] }; for (const [n45, i26] of t45.entries()) r86.entries.push(Js(n45), Js(i26, e57)); return r86; } if (t45 instanceof Set) { const e58 = { $name: "Set" }; let r86 = 0; for (const n45 of t45.values()) e58[++r86] = Js(n45); return e58; } if (t45 instanceof DOMMatrix) { const e58 = { $name: "DOMMatrix" }, r86 = ["is2D", "m11", "m12", "m13", "m14", "m21", "m22", "m23", "m24", "m31", "m32", "m33", "m34", "m41", "m42", "m43", "m44", "a", "b", "c", "d", "e", "f"]; for (const n45 of r86) e58[n45] = t45[n45]; return e58; } if ("bigint" == typeof t45) return { $name: "BigInt", value: t45.toString() }; if ("object" == typeof t45) { const r86 = t45.constructor, n45 = r86._classRegistryKey; if (!n45) throw new Error(`Can't serialize object of unregistered class "${r86.name}".`); const i26 = r86.serialize ? r86.serialize(t45, e57) : {}; if (!r86.serialize) { for (const r87 in t45) t45.hasOwnProperty(r87) && (Zs[n45].omit.indexOf(r87) >= 0 || (i26[r87] = Js(t45[r87], e57))); t45 instanceof Error && (i26.message = t45.message); } if (i26.$name) throw new Error("$name property is reserved for worker serialization logic."); return "Object" !== n45 && (i26.$name = n45), i26; } throw new Error("can't serialize object of type " + typeof t45); } function Qs(t45) { if (null == t45 || "boolean" == typeof t45 || "number" == typeof t45 || "string" == typeof t45 || t45 instanceof Boolean || t45 instanceof Number || t45 instanceof String || t45 instanceof Date || t45 instanceof RegExp || Ys(t45) || Ks(t45) || ArrayBuffer.isView(t45) || t45 instanceof ImageData) return t45; if (Array.isArray(t45)) return t45.map(Qs); if ("object" == typeof t45) { const e57 = t45.$name || "Object"; if ("Map" === e57) { const e58 = t45.entries || [], r87 = /* @__PURE__ */ new Map(); for (let t46 = 0; t46 < e58.length; t46 += 2) r87.set(Qs(e58[t46]), Qs(e58[t46 + 1])); return r87; } if ("Set" === e57) { const e58 = /* @__PURE__ */ new Set(); for (const r87 of Object.keys(t45)) "$name" !== r87 && e58.add(Qs(t45[r87])); return e58; } if ("DOMMatrix" === e57) { let e58; return e58 = t45.is2D ? [t45.a, t45.b, t45.c, t45.d, t45.e, t45.f] : [t45.m11, t45.m12, t45.m13, t45.m14, t45.m21, t45.m22, t45.m23, t45.m24, t45.m31, t45.m32, t45.m33, t45.m34, t45.m41, t45.m42, t45.m43, t45.m44], new DOMMatrix(e58); } if ("BigInt" === e57) return BigInt(t45.value); const { klass: r86 } = Zs[e57]; if (!r86) throw new Error(`Can't deserialize unregistered class "${e57}".`); if (r86.deserialize) return r86.deserialize(t45); const n45 = Object.create(r86.prototype); for (const e58 of Object.keys(t45)) "$name" !== e58 && (n45[e58] = Qs(t45[e58])); return n45; } throw new Error("can't deserialize object of type " + typeof t45); } const to3 = { "Latin-1 Supplement": (t45) => t45 >= 128 && t45 <= 255, Arabic: (t45) => t45 >= 1536 && t45 <= 1791, "Arabic Supplement": (t45) => t45 >= 1872 && t45 <= 1919, "Arabic Extended-A": (t45) => t45 >= 2208 && t45 <= 2303, "Hangul Jamo": (t45) => t45 >= 4352 && t45 <= 4607, "Unified Canadian Aboriginal Syllabics": (t45) => t45 >= 5120 && t45 <= 5759, Khmer: (t45) => t45 >= 6016 && t45 <= 6143, "Unified Canadian Aboriginal Syllabics Extended": (t45) => t45 >= 6320 && t45 <= 6399, "General Punctuation": (t45) => t45 >= 8192 && t45 <= 8303, "Letterlike Symbols": (t45) => t45 >= 8448 && t45 <= 8527, "Number Forms": (t45) => t45 >= 8528 && t45 <= 8591, "Miscellaneous Technical": (t45) => t45 >= 8960 && t45 <= 9215, "Control Pictures": (t45) => t45 >= 9216 && t45 <= 9279, "Optical Character Recognition": (t45) => t45 >= 9280 && t45 <= 9311, "Enclosed Alphanumerics": (t45) => t45 >= 9312 && t45 <= 9471, "Geometric Shapes": (t45) => t45 >= 9632 && t45 <= 9727, "Miscellaneous Symbols": (t45) => t45 >= 9728 && t45 <= 9983, "Miscellaneous Symbols and Arrows": (t45) => t45 >= 11008 && t45 <= 11263, "CJK Radicals Supplement": (t45) => t45 >= 11904 && t45 <= 12031, "Kangxi Radicals": (t45) => t45 >= 12032 && t45 <= 12255, "Ideographic Description Characters": (t45) => t45 >= 12272 && t45 <= 12287, "CJK Symbols and Punctuation": (t45) => t45 >= 12288 && t45 <= 12351, Hiragana: (t45) => t45 >= 12352 && t45 <= 12447, Katakana: (t45) => t45 >= 12448 && t45 <= 12543, Bopomofo: (t45) => t45 >= 12544 && t45 <= 12591, "Hangul Compatibility Jamo": (t45) => t45 >= 12592 && t45 <= 12687, Kanbun: (t45) => t45 >= 12688 && t45 <= 12703, "Bopomofo Extended": (t45) => t45 >= 12704 && t45 <= 12735, "CJK Strokes": (t45) => t45 >= 12736 && t45 <= 12783, "Katakana Phonetic Extensions": (t45) => t45 >= 12784 && t45 <= 12799, "Enclosed CJK Letters and Months": (t45) => t45 >= 12800 && t45 <= 13055, "CJK Compatibility": (t45) => t45 >= 13056 && t45 <= 13311, "CJK Unified Ideographs Extension A": (t45) => t45 >= 13312 && t45 <= 19903, "Yijing Hexagram Symbols": (t45) => t45 >= 19904 && t45 <= 19967, "CJK Unified Ideographs": (t45) => t45 >= 19968 && t45 <= 40959, "Yi Syllables": (t45) => t45 >= 40960 && t45 <= 42127, "Yi Radicals": (t45) => t45 >= 42128 && t45 <= 42191, "Hangul Jamo Extended-A": (t45) => t45 >= 43360 && t45 <= 43391, "Hangul Syllables": (t45) => t45 >= 44032 && t45 <= 55215, "Hangul Jamo Extended-B": (t45) => t45 >= 55216 && t45 <= 55295, "Private Use Area": (t45) => t45 >= 57344 && t45 <= 63743, "CJK Compatibility Ideographs": (t45) => t45 >= 63744 && t45 <= 64255, "Arabic Presentation Forms-A": (t45) => t45 >= 64336 && t45 <= 65023, "Vertical Forms": (t45) => t45 >= 65040 && t45 <= 65055, "CJK Compatibility Forms": (t45) => t45 >= 65072 && t45 <= 65103, "Small Form Variants": (t45) => t45 >= 65104 && t45 <= 65135, "Arabic Presentation Forms-B": (t45) => t45 >= 65136 && t45 <= 65279, "Halfwidth and Fullwidth Forms": (t45) => t45 >= 65280 && t45 <= 65519, Osage: (t45) => t45 >= 66736 && t45 <= 66815, "CJK Unified Ideographs Extension B": (t45) => t45 >= 131072 && t45 <= 173791 }; function eo(t45) { for (const e57 of t45) if (io(e57.charCodeAt(0))) return true; return false; } function ro(t45) { for (const e57 of t45) if (!no(e57.charCodeAt(0))) return false; return true; } function no(t45) { return !(to3.Arabic(t45) || to3["Arabic Supplement"](t45) || to3["Arabic Extended-A"](t45) || to3["Arabic Presentation Forms-A"](t45) || to3["Arabic Presentation Forms-B"](t45)); } function io(t45) { return !(746 !== t45 && 747 !== t45 && (t45 < 4352 || !(to3["Bopomofo Extended"](t45) || to3.Bopomofo(t45) || to3["CJK Compatibility Forms"](t45) && !(t45 >= 65097 && t45 <= 65103) || to3["CJK Compatibility Ideographs"](t45) || to3["CJK Compatibility"](t45) || to3["CJK Radicals Supplement"](t45) || to3["CJK Strokes"](t45) || !(!to3["CJK Symbols and Punctuation"](t45) || t45 >= 12296 && t45 <= 12305 || t45 >= 12308 && t45 <= 12319 || 12336 === t45) || to3["CJK Unified Ideographs Extension A"](t45) || to3["CJK Unified Ideographs"](t45) || to3["Enclosed CJK Letters and Months"](t45) || to3["Hangul Compatibility Jamo"](t45) || to3["Hangul Jamo Extended-A"](t45) || to3["Hangul Jamo Extended-B"](t45) || to3["Hangul Jamo"](t45) || to3["Hangul Syllables"](t45) || to3.Hiragana(t45) || to3["Ideographic Description Characters"](t45) || to3.Kanbun(t45) || to3["Kangxi Radicals"](t45) || to3["Katakana Phonetic Extensions"](t45) || to3.Katakana(t45) && 12540 !== t45 || !(!to3["Halfwidth and Fullwidth Forms"](t45) || 65288 === t45 || 65289 === t45 || 65293 === t45 || t45 >= 65306 && t45 <= 65310 || 65339 === t45 || 65341 === t45 || 65343 === t45 || t45 >= 65371 && t45 <= 65503 || 65507 === t45 || t45 >= 65512 && t45 <= 65519) || !(!to3["Small Form Variants"](t45) || t45 >= 65112 && t45 <= 65118 || t45 >= 65123 && t45 <= 65126) || to3["Unified Canadian Aboriginal Syllabics"](t45) || to3["Unified Canadian Aboriginal Syllabics Extended"](t45) || to3["Vertical Forms"](t45) || to3["Yijing Hexagram Symbols"](t45) || to3["Yi Syllables"](t45) || to3["Yi Radicals"](t45)))); } function so(t45) { return !(io(t45) || (function(t46) { return !!(to3["Latin-1 Supplement"](t46) && (167 === t46 || 169 === t46 || 174 === t46 || 177 === t46 || 188 === t46 || 189 === t46 || 190 === t46 || 215 === t46 || 247 === t46) || to3["General Punctuation"](t46) && (8214 === t46 || 8224 === t46 || 8225 === t46 || 8240 === t46 || 8241 === t46 || 8251 === t46 || 8252 === t46 || 8258 === t46 || 8263 === t46 || 8264 === t46 || 8265 === t46 || 8273 === t46) || to3["Letterlike Symbols"](t46) || to3["Number Forms"](t46) || to3["Miscellaneous Technical"](t46) && (t46 >= 8960 && t46 <= 8967 || t46 >= 8972 && t46 <= 8991 || t46 >= 8996 && t46 <= 9e3 || 9003 === t46 || t46 >= 9085 && t46 <= 9114 || t46 >= 9150 && t46 <= 9165 || 9167 === t46 || t46 >= 9169 && t46 <= 9179 || t46 >= 9186 && t46 <= 9215) || to3["Control Pictures"](t46) && 9251 !== t46 || to3["Optical Character Recognition"](t46) || to3["Enclosed Alphanumerics"](t46) || to3["Geometric Shapes"](t46) || to3["Miscellaneous Symbols"](t46) && !(t46 >= 9754 && t46 <= 9759) || to3["Miscellaneous Symbols and Arrows"](t46) && (t46 >= 11026 && t46 <= 11055 || t46 >= 11088 && t46 <= 11097 || t46 >= 11192 && t46 <= 11243) || to3["CJK Symbols and Punctuation"](t46) || to3.Katakana(t46) || to3["Private Use Area"](t46) || to3["CJK Compatibility Forms"](t46) || to3["Small Form Variants"](t46) || to3["Halfwidth and Fullwidth Forms"](t46) || 8734 === t46 || 8756 === t46 || 8757 === t46 || t46 >= 9984 && t46 <= 10087 || t46 >= 10102 && t46 <= 10131 || 65532 === t46 || 65533 === t46); })(t45)); } function oo(t45) { return to3.Arabic(t45) || to3["Arabic Supplement"](t45) || to3["Arabic Extended-A"](t45) || to3["Arabic Presentation Forms-A"](t45) || to3["Arabic Presentation Forms-B"](t45); } function ao(t45) { return t45 >= 1424 && t45 <= 2303 || to3["Arabic Presentation Forms-A"](t45) || to3["Arabic Presentation Forms-B"](t45); } function lo(t45, e57) { return !(!e57 && ao(t45) || t45 >= 2304 && t45 <= 3583 || t45 >= 3840 && t45 <= 4255 || to3.Khmer(t45)); } function uo(t45) { for (const e57 of t45) if (ao(e57.charCodeAt(0))) return true; return false; } const co = { unavailable: "unavailable", deferred: "deferred", loading: "loading", parsing: "parsing", parsed: "parsed", loaded: "loaded", error: "error" }; let ho = null, po = co.unavailable, fo = null; const mo = function(t45) { t45 && "string" == typeof t45 && t45.indexOf("NetworkError") > -1 && (po = co.error), ho && ho(t45); }; function yo() { go.fire(new Ye("pluginStateChange", { pluginStatus: po, pluginURL: fo })); } const go = new tr(), xo = function() { return po; }, vo = function() { if (po !== co.deferred || !fo) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified"); po = co.loading, yo(), fo && De({ url: fo }, ((t45) => { t45 ? mo(t45) : (po = co.loaded, yo()); })); }, bo = { applyArabicShaping: null, processBidirectionalText: null, processStyledBidirectionalText: null, isLoaded: () => po === co.loaded || null != bo.applyArabicShaping, isLoading: () => po === co.loading, setState(t45) { po = t45.pluginStatus, fo = t45.pluginURL; }, isParsing: () => po === co.parsing, isParsed: () => po === co.parsed, getPluginURL: () => fo }; class wo { constructor(t45, e57) { this.zoom = t45, e57 ? (this.now = e57.now, this.fadeDuration = e57.fadeDuration, this.transition = e57.transition, this.pitch = e57.pitch, this.brightness = e57.brightness, this.worldview = e57.worldview) : (this.now = 0, this.fadeDuration = 0, this.transition = {}, this.pitch = 0, this.brightness = 0); } isSupportedScript(t45) { return (function(t46, e57) { for (const r86 of t46) if (!lo(r86.charCodeAt(0), e57)) return false; return true; })(t45, bo.isLoaded()); } } class _o { constructor(t45, e57, r86, n45, i26) { this.property = t45, this.value = e57, this.expression = (function(t46, e58, r87, n46, i27) { if (ks(t46)) return new js(t46, e58); if (Rs(t46) || Array.isArray(t46) && t46.length > 0) { const s18 = Ns(t46, e58, r87, n46, i27); if ("error" === s18.result) throw new Error(s18.value.map(((t47) => `${t47.key}: ${t47.message}`)).join(", ")); return s18.value; } { let r88 = t46; return "string" == typeof t46 && "color" === e58.type && (r88 = sr.parse(t46)), { kind: "constant", configDependencies: /* @__PURE__ */ new Set(), evaluate: () => r88 }; } })(void 0 === e57 ? t45.specification.default : e57, t45.specification, r86, n45, i26); } isDataDriven() { return "source" === this.expression.kind || "composite" === this.expression.kind; } possiblyEvaluate(t45, e57, r86, n45) { return this.property.possiblyEvaluate(this, t45, e57, r86, n45); } } class Ao { constructor(t45, e57, r86, n45) { this.property = t45, this.value = new _o(t45, void 0, e57, r86, n45); } transitioned(t45, e57) { return new Io(this.property, this.value, e57, Object.assign({}, t45.transition, this.transition), t45.now); } untransitioned() { return new Io(this.property, this.value, null, {}, 0); } } class Mo { constructor(t45, e57, r86, n45) { this._properties = t45, this._values = Object.create(t45.defaultTransitionablePropertyValues), this._scope = e57, this._options = r86, this._iconImageUseTheme = n45, this.configDependencies = /* @__PURE__ */ new Set(); } getValue(t45) { return Nt(this._values[t45].value.value); } setValue(t45, e57) { this._values.hasOwnProperty(t45) || (this._values[t45] = new Ao(this._values[t45].property, this._scope, this._options, this._iconImageUseTheme)), this._values[t45].value = new _o(this._values[t45].property, null === e57 ? void 0 : Nt(e57), this._scope, this._options, this._iconImageUseTheme), this._values[t45].value.expression.configDependencies && (this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...this._values[t45].value.expression.configDependencies])); } setTransitionOrValue(t45, e57) { e57 && (this._options = e57); const r86 = this._properties.properties; if (t45) for (const e58 in t45) { const n45 = t45[e58]; if (e58.endsWith("-transition")) { const t46 = e58.slice(0, -11); r86[t46] && this.setTransition(t46, n45); } else r86.hasOwnProperty(e58) && this.setValue(e58, n45); } } getTransition(t45) { return Nt(this._values[t45].transition); } setTransition(t45, e57) { this._values.hasOwnProperty(t45) || (this._values[t45] = new Ao(this._values[t45].property)), this._values[t45].transition = Nt(e57) || void 0; } serialize() { const t45 = {}; for (const e57 of Object.keys(this._values)) { const r86 = this.getValue(e57); void 0 !== r86 && (t45[e57] = r86); const n45 = this.getTransition(e57); void 0 !== n45 && (t45[`${e57}-transition`] = n45); } return t45; } transitioned(t45, e57) { const r86 = new So(this._properties); for (const n45 of Object.keys(this._values)) r86._values[n45] = this._values[n45].transitioned(t45, e57._values[n45]); return r86; } untransitioned() { const t45 = new So(this._properties); for (const e57 of Object.keys(this._values)) t45._values[e57] = this._values[e57].untransitioned(); return t45; } } class Io { constructor(t45, e57, r86, n45, i26) { const s18 = n45.delay || 0, o88 = n45.duration || 0; i26 = i26 || 0, this.property = t45, this.value = e57, this.begin = i26 + s18, this.end = this.begin + o88, t45.specification.transition && (n45.delay || n45.duration) && (this.prior = r86); } possiblyEvaluate(t45, e57, r86) { const n45 = t45.now || 0, i26 = this.value.possiblyEvaluate(t45, e57, r86), s18 = this.prior; if (s18) { if (n45 > this.end) return this.prior = null, i26; if (this.value.isDataDriven()) return this.prior = null, i26; if (n45 < this.begin) return s18.possiblyEvaluate(t45, e57, r86); { const o88 = (n45 - this.begin) / (this.end - this.begin); return this.property.interpolate(s18.possiblyEvaluate(t45, e57, r86), i26, kt(o88)); } } return i26; } } class So { constructor(t45) { this._properties = t45, this._values = Object.create(t45.defaultTransitioningPropertyValues); } possiblyEvaluate(t45, e57, r86) { const n45 = new zo(this._properties); for (const i26 of Object.keys(this._values)) n45._values[i26] = this._values[i26].possiblyEvaluate(t45, e57, r86); return n45; } hasTransition() { for (const t45 of Object.keys(this._values)) if (this._values[t45].prior) return true; return false; } } class Po { constructor(t45, e57, r86, n45) { this._properties = t45, this._values = Object.create(t45.defaultPropertyValues), this._scope = e57, this._options = r86, this._iconImageUseTheme = n45, this.configDependencies = /* @__PURE__ */ new Set(); } getValue(t45) { return Nt(this._values[t45].value); } setValue(t45, e57) { this._values[t45] = new _o(this._values[t45].property, null === e57 ? void 0 : Nt(e57), this._scope, this._options, this._iconImageUseTheme), this._values[t45].expression.configDependencies && (this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...this._values[t45].expression.configDependencies])); } serialize() { const t45 = {}; for (const e57 of Object.keys(this._values)) { const r86 = this.getValue(e57); void 0 !== r86 && (t45[e57] = r86); } return t45; } possiblyEvaluate(t45, e57, r86, n45) { const i26 = new zo(this._properties); for (const s18 of Object.keys(this._values)) i26._values[s18] = this._values[s18].possiblyEvaluate(t45, e57, r86, n45); return i26; } } class ko { constructor(t45, e57, r86, n45) { this.property = t45, this.value = e57, this.parameters = r86, this.iconImageUseTheme = n45; } isConstant() { return "constant" === this.value.kind; } constantOr(t45) { return "constant" === this.value.kind ? this.value.value : t45; } evaluate(t45, e57, r86, n45) { return this.property.evaluate(this.value, this.parameters, t45, e57, r86, n45, this.iconImageUseTheme); } } class zo { constructor(t45) { this._properties = t45, this._values = Object.create(t45.defaultPossiblyEvaluatedValues); } get(t45) { return this._values[t45]; } } class Eo { constructor(t45) { this.specification = t45; } possiblyEvaluate(t45, e57) { return t45.expression.evaluate(e57); } interpolate(t45, e57, r86) { const n45 = hr[this.specification.type]; return n45 ? n45(t45, e57, r86) : t45; } } class To { constructor(t45, e57) { this.specification = t45, this.overrides = e57; } possiblyEvaluate(t45, e57, r86, n45, i26) { return "constant" === t45.expression.kind || "camera" === t45.expression.kind ? new ko(this, { kind: "constant", value: t45.expression.evaluate(e57, null, {}, r86, n45, void 0, i26) }, e57) : new ko(this, t45.expression, e57, i26); } interpolate(t45, e57, r86) { if ("constant" !== t45.value.kind || "constant" !== e57.value.kind) return t45; if (void 0 === t45.value.value || void 0 === e57.value.value) return new ko(this, { kind: "constant", value: void 0 }, t45.parameters); const n45 = hr[this.specification.type]; return n45 ? new ko(this, { kind: "constant", value: n45(t45.value.value, e57.value.value, r86) }, t45.parameters) : t45; } evaluate(t45, e57, r86, n45, i26, s18, o88) { return "constant" === t45.kind ? t45.value : t45.evaluate(e57, r86, n45, i26, s18, void 0, o88); } } class Bo { constructor(t45) { this.specification = t45; } possiblyEvaluate(t45, e57, r86, n45) { return !!t45.expression.evaluate(e57, null, {}, r86, n45); } interpolate() { return false; } } class Vo { constructor(t45) { this.properties = t45, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = []; const e57 = new wo(0, {}); for (const r86 in t45) { const n45 = t45[r86]; n45.specification.overridable && this.overridableProperties.push(r86); const i26 = this.defaultPropertyValues[r86] = new _o(n45, void 0), s18 = this.defaultTransitionablePropertyValues[r86] = new Ao(n45); this.defaultTransitioningPropertyValues[r86] = s18.untransitioned(), this.defaultPossiblyEvaluatedValues[r86] = i26.possiblyEvaluate(e57); } } } Ws(To, "DataDrivenProperty"), Ws(Eo, "DataConstantProperty"), Ws(Bo, "ColorRampProperty"); var Fo = JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"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":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"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"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"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","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","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_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"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","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"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"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}'); function Co(t45) { return t45 instanceof Number || t45 instanceof String || t45 instanceof Boolean ? t45.valueOf() : t45; } function Do(t45) { if (Array.isArray(t45)) return t45.map(Do); if (t45 instanceof Object && !(t45 instanceof Number || t45 instanceof String || t45 instanceof Boolean)) { const e57 = {}; for (const r86 in t45) e57[r86] = Do(t45[r86]); return e57; } return Co(t45); } function Ro(t45) { if (true === t45 || false === t45) return true; if (!Array.isArray(t45) || 0 === t45.length) return false; switch (t45[0]) { case "has": return t45.length >= 2 && "$id" !== t45[1] && "$type" !== t45[1]; case "in": return t45.length >= 3 && ("string" != typeof t45[1] || Array.isArray(t45[2])); case "!in": case "!has": case "none": return false; case "==": case "!=": case ">": case ">=": case "<": case "<=": return 3 !== t45.length || Array.isArray(t45[1]) || Array.isArray(t45[2]); case "any": case "all": for (const e57 of t45.slice(1)) if (!Ro(e57) && "boolean" != typeof e57) return false; return true; default: return true; } } function Lo(t45, e57 = "", r86 = null, n45 = "fill") { if (null == t45) return { filter: () => true, needGeometry: false, needFeature: false }; Ro(t45) || (t45 = Ho(t45)); const i26 = t45; let s18 = true; try { s18 = (function(t46) { if (!No(t46)) return t46; let e58 = Do(t46); return Uo(e58), e58 = Oo(e58), e58; })(i26); } catch (t46) { 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(i26, null, 2)} `); } let o88 = null, a46 = null; if ("background" !== n45 && "sky" !== n45 && "slot" !== n45) { a46 = Fo[`filter_${n45}`]; const t46 = Ls(s18, a46, e57, r86); if ("error" === t46.result) throw new Error(t46.value.map(((t47) => `${t47.key}: ${t47.message}`)).join(", ")); o88 = (e58, r87, n46) => t46.value.evaluate(e58, r87, {}, n46); } let l21 = null, u12 = null; if (s18 !== i26) { const t46 = Ls(i26, a46, e57, r86); if ("error" === t46.result) throw new Error(t46.value.map(((t47) => `${t47.key}: ${t47.message}`)).join(", ")); l21 = (e58, r87, n46, i27, s19) => t46.value.evaluate(e58, r87, {}, n46, void 0, void 0, i27, s19), u12 = !fi(t46.value.expression); } return { filter: o88, dynamicFilter: l21 || void 0, needGeometry: Go(s18), needFeature: !!u12 }; } function Oo(t45) { if (!Array.isArray(t45)) return t45; const e57 = (function(t46) { if (jo.has(t46[0])) { for (let e58 = 1; e58 < t46.length; e58++) if (No(t46[e58])) return true; } return t46; })(t45); return true === e57 ? e57 : e57.map(((t46) => Oo(t46))); } function Uo(t45) { let e57 = false; const r86 = []; if ("case" === t45[0]) { for (let n45 = 1; n45 < t45.length - 1; n45 += 2) e57 = e57 || No(t45[n45]), r86.push(t45[n45 + 1]); r86.push(t45[t45.length - 1]); } else if ("match" === t45[0]) { e57 = e57 || No(t45[1]); for (let e58 = 2; e58 < t45.length - 1; e58 += 2) r86.push(t45[e58 + 1]); r86.push(t45[t45.length - 1]); } else if ("step" === t45[0]) { e57 = e57 || No(t45[1]); for (let e58 = 1; e58 < t45.length - 1; e58 += 2) r86.push(t45[e58 + 1]); } e57 && (t45.length = 0, t45.push("any", ...r86)); for (let e58 = 1; e58 < t45.length; e58++) Uo(t45[e58]); } function No(t45) { if (!Array.isArray(t45)) return false; if ("pitch" === (e57 = t45[0]) || "distance-from-center" === e57) return true; var e57; for (let e58 = 1; e58 < t45.length; e58++) if (No(t45[e58])) return true; return false; } const jo = /* @__PURE__ */ new Set(["in", "==", "!=", ">", ">=", "<", "<=", "to-boolean"]); function $o(t45, e57) { return t45 < e57 ? -1 : t45 > e57 ? 1 : 0; } function Go(t45) { if (!Array.isArray(t45)) return false; if ("within" === t45[0] || "distance" === t45[0]) return true; for (let e57 = 1; e57 < t45.length; e57++) if (Go(t45[e57])) return true; return false; } function Ho(t45) { if (!t45) return true; const e57 = t45[0]; return t45.length <= 1 ? "any" !== e57 : "==" === e57 ? qo(t45[1], t45[2], "==") : "!=" === e57 ? Wo(qo(t45[1], t45[2], "==")) : "<" === e57 || ">" === e57 || "<=" === e57 || ">=" === e57 ? qo(t45[1], t45[2], e57) : "any" === e57 ? (r86 = t45.slice(1), ["any"].concat(r86.map(Ho))) : "all" === e57 ? ["all"].concat(t45.slice(1).map(Ho)) : "none" === e57 ? ["all"].concat(t45.slice(1).map(Ho).map(Wo)) : "in" === e57 ? Xo(t45[1], t45.slice(2)) : "!in" === e57 ? Wo(Xo(t45[1], t45.slice(2))) : "has" === e57 ? Zo(t45[1]) : "!has" !== e57 || Wo(Zo(t45[1])); var r86; } function qo(t45, e57, r86) { switch (t45) { case "$type": return [`filter-type-${r86}`, e57]; case "$id": return [`filter-id-${r86}`, e57]; default: return [`filter-${r86}`, t45, e57]; } } function Xo(t45, e57) { if (0 === e57.length) return false; switch (t45) { case "$type": return ["filter-type-in", ["literal", e57]]; case "$id": return ["filter-id-in", ["literal", e57]]; default: return e57.length > 200 && !e57.some(((t46) => typeof t46 != typeof e57[0])) ? ["filter-in-large", t45, ["literal", e57.sort($o)]] : ["filter-in-small", t45, ["literal", e57]]; } } function Zo(t45) { switch (t45) { case "$type": return true; case "$id": return ["filter-has-id"]; default: return ["filter-has", t45]; } } function Wo(t45) { return ["!", t45]; } const Yo = ""; function Ko(t45, e57) { return e57 ? `${t45}${Yo}${e57}` : t45; } let Jo; const Qo = () => Jo || (Jo = new Vo({ "icon-size": new To(Fo.layout_symbol["icon-size"]), "icon-image": new To(Fo.layout_symbol["icon-image"]), "icon-rotate": new To(Fo.layout_symbol["icon-rotate"]), "icon-offset": new To(Fo.layout_symbol["icon-offset"]) })); class ta { constructor(t45, e57, r86, n45, i26, s18) { const o88 = Ls(t45, Fo.appearance.condition); if ("success" === o88.result && (this.condition = o88.value), this.name = e57, r86) { this.properties = new zo(Qo()), this.unevaluatedLayout = new Po(Qo(), n45, i26, s18); for (const t46 in r86) this.unevaluatedLayout.setValue(t46, r86[t46]); } } isActive(t45) { return !(this.condition || !t45.isHidden || "hidden" !== this.name) || this.condition.evaluate(t45.globals, t45.feature, t45.featureState, t45.canonical); } getCondition() { return this.condition; } getName() { return this.name; } getProperty(t45) { return this.properties.get(t45); } getUnevaluatedProperties() { return this.unevaluatedLayout; } serialize() { const t45 = {}; return t45.condition = this.condition.expression.serialize(), this.name && (t45.name = this.name), this.properties && (t45.properties = this.properties), t45; } } const ea2 = "-transition", ra = /* @__PURE__ */ new Set(["fill", "line", "background", "hillshade", "raster"]); class na extends tr { constructor(t45, e57, r86, n45, i26, s18) { if (super(), this.id = t45.id, this.fqid = Ko(this.id, r86), this.type = t45.type, this.scope = r86, this.lut = n45, this.options = i26, this.iconImageUseTheme = s18, this.appearances = new Array(), this._featureFilter = { filter: () => true, needGeometry: false, needFeature: false }, this._filterCompiled = false, this.configDependencies = /* @__PURE__ */ new Set(), "custom" !== t45.type) { if (this.metadata = t45.metadata, this.minzoom = t45.minzoom, this.maxzoom = t45.maxzoom, t45.type && "background" !== t45.type && "sky" !== t45.type && "slot" !== t45.type) { this.source = t45.source, this.sourceLayer = t45["source-layer"], this.filter = t45.filter; const e58 = Ls(this.filter, Fo[`filter_${t45.type}`]); "error" !== e58.result && (this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...e58.value.configDependencies])); } if (t45.slot && (this.slot = t45.slot), t45.appearances && t45.appearances.forEach(((t46) => { this.appearances.push(new ta(t46.condition, t46.name, t46.properties, this.scope, i26, this.iconImageUseTheme)); })), e57.layout && (this._unevaluatedLayout = new Po(e57.layout, this.scope, i26, this.iconImageUseTheme), this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...this._unevaluatedLayout.configDependencies])), e57.paint) { this._transitionablePaint = new Mo(e57.paint, this.scope, i26); for (const e58 in t45.paint) this.setPaintProperty(e58, t45.paint[e58]); for (const e58 in t45.layout) this.setLayoutProperty(e58, t45.layout[e58]); this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...this._transitionablePaint.configDependencies]), this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new zo(e57.paint); } } } onAdd(t45) { } onRemove(t45) { } isDraped(t45) { return !this.is3D(true) && ra.has(this.type); } getLayoutProperty(t45) { return "visibility" === t45 ? this.visibility : this._unevaluatedLayout.getValue(t45); } setLayoutProperty(t45, e57) { if ("custom" === this.type && "visibility" === t45) return void (this.visibility = e57); const r86 = this._unevaluatedLayout; r86._properties.properties[t45] && (r86.setValue(t45, e57), this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...r86.configDependencies]), "visibility" === t45 && this.possiblyEvaluateVisibility()); } possiblyEvaluateVisibility() { this._unevaluatedLayout._values.visibility && (this.visibility = this._unevaluatedLayout._values.visibility.possiblyEvaluate({ zoom: 0 })); } getPaintProperty(t45) { return t45.endsWith(ea2) ? this._transitionablePaint.getTransition(t45.slice(0, -11)) : this._transitionablePaint.getValue(t45); } setPaintProperty(t45, e57) { const r86 = this._transitionablePaint, n45 = r86._properties.properties; if (t45.endsWith(ea2)) { const i27 = t45.slice(0, -11); return n45[i27] && r86.setTransition(i27, e57 || void 0), false; } if (!n45[t45]) return false; const i26 = r86._values[t45], s18 = i26.value.isDataDriven(), o88 = i26.value; r86.setValue(t45, e57), this.configDependencies = /* @__PURE__ */ new Set([...this.configDependencies, ...r86.configDependencies]), this._handleSpecialPaintPropertyUpdate(t45); const a46 = r86._values[t45].value, l21 = a46.isDataDriven(), u12 = t45.endsWith("pattern") || "line-dasharray" === t45; return l21 || s18 || u12 || this._handleOverridablePaintPropertyUpdate(t45, o88, a46); } _handleSpecialPaintPropertyUpdate(t45) { } getProgramIds() { return null; } getDefaultProgramParams(t45, e57, r86) { return null; } _handleOverridablePaintPropertyUpdate(t45, e57, r86) { return false; } isHidden(t45) { return !!(this.minzoom && t45 < this.minzoom) || !!(this.maxzoom && t45 >= this.maxzoom) || "none" === this.visibility; } updateTransitions(t45) { this._transitioningPaint = this._transitionablePaint.transitioned(t45, this._transitioningPaint); } hasTransition() { return this._transitioningPaint.hasTransition(); } recalculate(t45, e57) { this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t45, void 0, e57, this.iconImageUseTheme)), this.paint = this._transitioningPaint.possiblyEvaluate(t45, void 0, e57); } serialize() { const t45 = { id: this.id, type: this.type, slot: this.slot, 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 0 !== this.appearances.length && (t45.appearances = this.appearances.map(((t46) => t46.serialize()))), Ut2(t45, ((t46, e57) => !(void 0 === t46 || "layout" === e57 && !Object.keys(t46).length || "paint" === e57 && !Object.keys(t46).length))); } is3D(t45) { return false; } hasElevation() { return false; } isSky() { return false; } isTileClipped() { return false; } hasOffscreenPass() { return false; } hasShadowPass() { return false; } canCastShadows() { return false; } hasLightBeamPass() { return false; } cutoffRange() { return 0; } tileCoverLift() { return 0; } resize() { } _clear() { } isStateDependent() { for (const t45 in this.paint._values) { const e57 = this.paint.get(t45); if (e57 instanceof ko && Ms(e57.property.specification) && ("source" === e57.value.kind || "composite" === e57.value.kind) && e57.value.isStateDependent) return true; } return false; } compileFilter(t45) { this._filterCompiled || (this._featureFilter = Lo(this.filter, this.scope, t45), this._filterCompiled = true); } invalidateCompiledFilter() { this._filterCompiled = false; } dynamicFilter() { return this._featureFilter.dynamicFilter; } dynamicFilterNeedsFeature() { return this._featureFilter.needFeature; } getLayerRenderingStats() { return this._stats; } resetLayerRenderingStats(t45) { this._stats && ("shadow" === t45.renderPass ? this._stats.numRenderedVerticesInShadowPass = 0 : this._stats.numRenderedVerticesInTransparentPass = 0); } getAppearances() { return this.appearances; } queryRadius(t45) { } queryIntersectsFeature(t45, e57, r86, n45, i26, s18, o88, a46, l21) { } } const ia = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array }; class sa { constructor(t45, e57) { this._structArray = t45, this._pos1 = e57 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8; } } class oa { constructor() { this.capacity = -1, this.resize(0); } static serialize(t45, e57) { return t45._trim(), e57 && e57.add(t45.arrayBuffer), { length: t45.length, arrayBuffer: t45.arrayBuffer }; } static deserialize(t45) { const e57 = Object.create(this.prototype); return e57.arrayBuffer = t45.arrayBuffer, e57.length = t45.length, e57.capacity = t45.arrayBuffer.byteLength / e57.bytesPerElement, e57._refreshViews(), e57; } _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(t45) { this.reserve(t45), this.length = t45; } reserve(t45) { if (t45 > this.capacity) { this.capacity = Math.max(t45, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); const e57 = this.uint8; this._refreshViews(), e57 && this.uint8.set(e57); } } _refreshViews() { throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout"); } emplace(...t45) { throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout"); } emplaceBack(...t45) { throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout"); } destroy() { this.int8 = this.uint8 = this.int16 = this.uint16 = this.int32 = this.uint32 = this.float32 = null, this.arrayBuffer = null; } } function aa2(t45, e57 = 1) { let r86 = 0, n45 = 0; return { members: t45.map(((t46) => { const i26 = ia[t46.type].BYTES_PER_ELEMENT, s18 = r86 = la(r86, Math.max(e57, i26)), o88 = t46.components || 1; return n45 = Math.max(n45, i26), r86 += i26 * o88, { name: t46.name, type: t46.type, components: o88, offset: s18 }; })), size: la(r86, Math.max(n45, e57)), alignment: e57 }; } function la(t45, e57) { return Math.ceil(t45 / e57) * e57; } class ua extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57) { const r86 = this.length; return this.resize(r86 + 1), this.emplace(r86, t45, e57); } emplace(t45, e57, r86) { const n45 = 2 * t45; return this.int16[n45 + 0] = e57, this.int16[n45 + 1] = r86, t45; } } ua.prototype.bytesPerElement = 4, Ws(ua, "StructArrayLayout2i4"); class ca3 extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86) { const n45 = this.length; return this.resize(n45 + 1), this.emplace(n45, t45, e57, r86); } emplace(t45, e57, r86, n45) { const i26 = 3 * t45; return this.int16[i26 + 0] = e57, this.int16[i26 + 1] = r86, this.int16[i26 + 2] = n45, t45; } } ca3.prototype.bytesPerElement = 6, Ws(ca3, "StructArrayLayout3i6"); class ha extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45) { const i26 = this.length; return this.resize(i26 + 1), this.emplace(i26, t45, e57, r86, n45); } emplace(t45, e57, r86, n45, i26) { const s18 = 4 * t45; return this.int16[s18 + 0] = e57, this.int16[s18 + 1] = r86, this.int16[s18 + 2] = n45, this.int16[s18 + 3] = i26, t45; } } ha.prototype.bytesPerElement = 8, Ws(ha, "StructArrayLayout4i8"); class pa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45) { const e57 = this.length; return this.resize(e57 + 1), this.emplace(e57, t45); } emplace(t45, e57) { return this.float32[1 * t45 + 0] = e57, t45; } } pa.prototype.bytesPerElement = 4, Ws(pa, "StructArrayLayout1f4"); class da2 extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86) { const n45 = this.length; return this.resize(n45 + 1), this.emplace(n45, t45, e57, r86); } emplace(t45, e57, r86, n45) { const i26 = 4 * t45, s18 = 2 * t45; return this.int16[i26 + 0] = e57, this.int16[i26 + 1] = r86, this.float32[s18 + 1] = n45, t45; } } da2.prototype.bytesPerElement = 8, Ws(da2, "StructArrayLayout2i1f8"); class fa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86) { const n45 = this.length; return this.resize(n45 + 1), this.emplace(n45, t45, e57, r86); } emplace(t45, e57, r86, n45) { const i26 = 4 * t45; return this.int16[i26 + 0] = e57, this.int16[i26 + 1] = r86, this.int16[i26 + 2] = n45, t45; } } fa.prototype.bytesPerElement = 8, Ws(fa, "StructArrayLayout3i8"); class ma extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26) { const s18 = this.length; return this.resize(s18 + 1), this.emplace(s18, t45, e57, r86, n45, i26); } emplace(t45, e57, r86, n45, i26, s18) { const o88 = 5 * t45; return this.int16[o88 + 0] = e57, this.int16[o88 + 1] = r86, this.int16[o88 + 2] = n45, this.int16[o88 + 3] = i26, this.int16[o88 + 4] = s18, t45; } } ma.prototype.bytesPerElement = 10, Ws(ma, "StructArrayLayout5i10"); class ya extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88) { const a46 = this.length; return this.resize(a46 + 1), this.emplace(a46, t45, e57, r86, n45, i26, s18, o88); } emplace(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = 6 * t45, u12 = 12 * t45, c28 = 3 * t45; return this.int16[l21 + 0] = e57, this.int16[l21 + 1] = r86, this.uint8[u12 + 4] = n45, this.uint8[u12 + 5] = i26, this.uint8[u12 + 6] = s18, this.uint8[u12 + 7] = o88, this.float32[c28 + 2] = a46, t45; } } ya.prototype.bytesPerElement = 12, Ws(ya, "StructArrayLayout2i4ub1f12"); class ga extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86) { const n45 = this.length; return this.resize(n45 + 1), this.emplace(n45, t45, e57, r86); } emplace(t45, e57, r86, n45) { const i26 = 3 * t45; return this.float32[i26 + 0] = e57, this.float32[i26 + 1] = r86, this.float32[i26 + 2] = n45, t45; } } ga.prototype.bytesPerElement = 12, Ws(ga, "StructArrayLayout3f12"); class xa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26) { const s18 = this.length; return this.resize(s18 + 1), this.emplace(s18, t45, e57, r86, n45, i26); } emplace(t45, e57, r86, n45, i26, s18) { const o88 = 6 * t45, a46 = 3 * t45; return this.uint16[o88 + 0] = e57, this.uint16[o88 + 1] = r86, this.uint16[o88 + 2] = n45, this.uint16[o88 + 3] = i26, this.float32[a46 + 2] = s18, t45; } } xa.prototype.bytesPerElement = 12, Ws(xa, "StructArrayLayout4ui1f12"); class va extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45) { const i26 = this.length; return this.resize(i26 + 1), this.emplace(i26, t45, e57, r86, n45); } emplace(t45, e57, r86, n45, i26) { const s18 = 4 * t45; return this.uint16[s18 + 0] = e57, this.uint16[s18 + 1] = r86, this.uint16[s18 + 2] = n45, this.uint16[s18 + 3] = i26, t45; } } va.prototype.bytesPerElement = 8, Ws(va, "StructArrayLayout4ui8"); class ba extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18) { const o88 = this.length; return this.resize(o88 + 1), this.emplace(o88, t45, e57, r86, n45, i26, s18); } emplace(t45, e57, r86, n45, i26, s18, o88) { const a46 = 6 * t45; return this.int16[a46 + 0] = e57, this.int16[a46 + 1] = r86, this.int16[a46 + 2] = n45, this.int16[a46 + 3] = i26, this.int16[a46 + 4] = s18, this.int16[a46 + 5] = o88, t45; } } ba.prototype.bytesPerElement = 12, Ws(ba, "StructArrayLayout6i12"); class wa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8) { const p9 = this.length; return this.resize(p9 + 1), this.emplace(p9, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9) { const d34 = 12 * t45; return this.int16[d34 + 0] = e57, this.int16[d34 + 1] = r86, this.int16[d34 + 2] = n45, this.int16[d34 + 3] = i26, this.uint16[d34 + 4] = s18, this.uint16[d34 + 5] = o88, this.uint16[d34 + 6] = a46, this.uint16[d34 + 7] = l21, this.int16[d34 + 8] = u12, this.int16[d34 + 9] = c28, this.int16[d34 + 10] = h8, this.int16[d34 + 11] = p9, t45; } } wa.prototype.bytesPerElement = 24, Ws(wa, "StructArrayLayout4i4ui4i24"); class _a12 extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18) { const o88 = this.length; return this.resize(o88 + 1), this.emplace(o88, t45, e57, r86, n45, i26, s18); } emplace(t45, e57, r86, n45, i26, s18, o88) { const a46 = 10 * t45, l21 = 5 * t45; return this.int16[a46 + 0] = e57, this.int16[a46 + 1] = r86, this.int16[a46 + 2] = n45, this.float32[l21 + 2] = i26, this.float32[l21 + 3] = s18, this.float32[l21 + 4] = o88, t45; } } _a12.prototype.bytesPerElement = 20, Ws(_a12, "StructArrayLayout3i3f20"); class Aa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45) { const i26 = this.length; return this.resize(i26 + 1), this.emplace(i26, t45, e57, r86, n45); } emplace(t45, e57, r86, n45, i26) { const s18 = 4 * t45; return this.float32[s18 + 0] = e57, this.float32[s18 + 1] = r86, this.float32[s18 + 2] = n45, this.float32[s18 + 3] = i26, t45; } } Aa.prototype.bytesPerElement = 16, Ws(Aa, "StructArrayLayout4f16"); class Ma extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); } emplaceBack(t45) { const e57 = this.length; return this.resize(e57 + 1), this.emplace(e57, t45); } emplace(t45, e57) { return this.uint32[1 * t45 + 0] = e57, t45; } } Ma.prototype.bytesPerElement = 4, Ws(Ma, "StructArrayLayout1ul4"); class Ia extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45, e57) { const r86 = this.length; return this.resize(r86 + 1), this.emplace(r86, t45, e57); } emplace(t45, e57, r86) { const n45 = 2 * t45; return this.uint16[n45 + 0] = e57, this.uint16[n45 + 1] = r86, t45; } } Ia.prototype.bytesPerElement = 4, Ws(Ia, "StructArrayLayout2ui4"); class Sa extends oa { _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(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9) { const d34 = this.length; return this.resize(d34 + 1), this.emplace(d34, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34) { const f8 = 20 * t45, m6 = 10 * t45; return this.int16[f8 + 0] = e57, this.int16[f8 + 1] = r86, this.int16[f8 + 2] = n45, this.int16[f8 + 3] = i26, this.int16[f8 + 4] = s18, this.float32[m6 + 3] = o88, this.float32[m6 + 4] = a46, this.float32[m6 + 5] = l21, this.float32[m6 + 6] = u12, this.int16[f8 + 14] = c28, this.uint32[m6 + 8] = h8, this.uint16[f8 + 18] = p9, this.uint16[f8 + 19] = d34, t45; } } Sa.prototype.bytesPerElement = 40, Ws(Sa, "StructArrayLayout5i4f1i1ul2ui40"); class Pa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88) { const a46 = this.length; return this.resize(a46 + 1), this.emplace(a46, t45, e57, r86, n45, i26, s18, o88); } emplace(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = 8 * t45; return this.int16[l21 + 0] = e57, this.int16[l21 + 1] = r86, this.int16[l21 + 2] = n45, this.int16[l21 + 4] = i26, this.int16[l21 + 5] = s18, this.int16[l21 + 6] = o88, this.int16[l21 + 7] = a46, t45; } } Pa.prototype.bytesPerElement = 16, Ws(Pa, "StructArrayLayout3i2i2i16"); class ka extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26) { const s18 = this.length; return this.resize(s18 + 1), this.emplace(s18, t45, e57, r86, n45, i26); } emplace(t45, e57, r86, n45, i26, s18) { const o88 = 4 * t45, a46 = 8 * t45; return this.float32[o88 + 0] = e57, this.float32[o88 + 1] = r86, this.float32[o88 + 2] = n45, this.int16[a46 + 6] = i26, this.int16[a46 + 7] = s18, t45; } } ka.prototype.bytesPerElement = 16, Ws(ka, "StructArrayLayout2f1f2i16"); class za extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18) { const o88 = this.length; return this.resize(o88 + 1), this.emplace(o88, t45, e57, r86, n45, i26, s18); } emplace(t45, e57, r86, n45, i26, s18, o88) { const a46 = 20 * t45, l21 = 5 * t45; return this.uint8[a46 + 0] = e57, this.uint8[a46 + 1] = r86, this.float32[l21 + 1] = n45, this.float32[l21 + 2] = i26, this.float32[l21 + 3] = s18, this.float32[l21 + 4] = o88, t45; } } za.prototype.bytesPerElement = 20, Ws(za, "StructArrayLayout2ub4f20"); class Ea extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86) { const n45 = this.length; return this.resize(n45 + 1), this.emplace(n45, t45, e57, r86); } emplace(t45, e57, r86, n45) { const i26 = 3 * t45; return this.uint16[i26 + 0] = e57, this.uint16[i26 + 1] = r86, this.uint16[i26 + 2] = n45, t45; } } Ea.prototype.bytesPerElement = 6, Ws(Ea, "StructArrayLayout3ui6"); class Ta extends oa { _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(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8) { const w4 = this.length; return this.resize(w4 + 1), this.emplace(w4, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8, w4) { const _4 = 30 * t45, A4 = 15 * t45, M5 = 60 * t45; return this.int16[_4 + 0] = e57, this.int16[_4 + 1] = r86, this.int16[_4 + 2] = n45, this.float32[A4 + 2] = i26, this.float32[A4 + 3] = s18, this.uint16[_4 + 8] = o88, this.uint16[_4 + 9] = a46, this.uint32[A4 + 5] = l21, this.uint32[A4 + 6] = u12, this.uint32[A4 + 7] = c28, this.uint16[_4 + 16] = h8, this.uint16[_4 + 17] = p9, this.uint16[_4 + 18] = d34, this.float32[A4 + 10] = f8, this.float32[A4 + 11] = m6, this.uint8[M5 + 48] = y4, this.uint8[M5 + 49] = g9, this.uint8[M5 + 50] = x4, this.uint32[A4 + 13] = v8, this.int16[_4 + 28] = b8, this.uint8[M5 + 58] = w4, t45; } } Ta.prototype.bytesPerElement = 60, Ws(Ta, "StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60"); class Ba extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8, w4, _4, A4, M5, I4, S5, P4, k7, z4, E5, T5, B6) { const V4 = this.length; return this.resize(V4 + 1), this.emplace(V4, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8, w4, _4, A4, M5, I4, S5, P4, k7, z4, E5, T5, B6); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8, b8, w4, _4, A4, M5, I4, S5, P4, k7, z4, E5, T5, B6, V4) { const F17 = 20 * t45, C6 = 40 * t45, D5 = 80 * t45; return this.float32[F17 + 0] = e57, this.float32[F17 + 1] = r86, this.int16[C6 + 4] = n45, this.int16[C6 + 5] = i26, this.int16[C6 + 6] = s18, this.int16[C6 + 7] = o88, this.int16[C6 + 8] = a46, this.int16[C6 + 9] = l21, this.int16[C6 + 10] = u12, this.int16[C6 + 11] = c28, this.int16[C6 + 12] = h8, this.uint16[C6 + 13] = p9, this.uint16[C6 + 14] = d34, this.uint16[C6 + 15] = f8, this.uint16[C6 + 16] = m6, this.uint16[C6 + 17] = y4, this.uint16[C6 + 18] = g9, this.uint16[C6 + 19] = x4, this.uint16[C6 + 20] = v8, this.uint16[C6 + 21] = b8, this.uint16[C6 + 22] = w4, this.uint16[C6 + 23] = _4, this.uint16[C6 + 24] = A4, this.uint16[C6 + 25] = M5, this.uint16[C6 + 26] = I4, this.uint16[C6 + 27] = S5, this.uint32[F17 + 14] = P4, this.float32[F17 + 15] = k7, this.float32[F17 + 16] = z4, this.float32[F17 + 17] = E5, this.float32[F17 + 18] = T5, this.uint8[D5 + 76] = B6, this.uint16[C6 + 39] = V4, t45; } } Ba.prototype.bytesPerElement = 80, Ws(Ba, "StructArrayLayout2f9i15ui1ul4f1ub1ui80"); class Va extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18) { const o88 = this.length; return this.resize(o88 + 1), this.emplace(o88, t45, e57, r86, n45, i26, s18); } emplace(t45, e57, r86, n45, i26, s18, o88) { const a46 = 6 * t45; return this.float32[a46 + 0] = e57, this.float32[a46 + 1] = r86, this.float32[a46 + 2] = n45, this.float32[a46 + 3] = i26, this.float32[a46 + 4] = s18, this.float32[a46 + 5] = o88, t45; } } Va.prototype.bytesPerElement = 24, Ws(Va, "StructArrayLayout6f24"); class Fa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26) { const s18 = this.length; return this.resize(s18 + 1), this.emplace(s18, t45, e57, r86, n45, i26); } emplace(t45, e57, r86, n45, i26, s18) { const o88 = 5 * t45; return this.float32[o88 + 0] = e57, this.float32[o88 + 1] = r86, this.float32[o88 + 2] = n45, this.float32[o88 + 3] = i26, this.float32[o88 + 4] = s18, t45; } } Fa.prototype.bytesPerElement = 20, Ws(Fa, "StructArrayLayout5f20"); class Ca extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88) { const a46 = this.length; return this.resize(a46 + 1), this.emplace(a46, t45, e57, r86, n45, i26, s18, o88); } emplace(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = 7 * t45; return this.float32[l21 + 0] = e57, this.float32[l21 + 1] = r86, this.float32[l21 + 2] = n45, this.float32[l21 + 3] = i26, this.float32[l21 + 4] = s18, this.float32[l21 + 5] = o88, this.float32[l21 + 6] = a46, t45; } } Ca.prototype.bytesPerElement = 28, Ws(Ca, "StructArrayLayout7f28"); class Da extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28) { const h8 = this.length; return this.resize(h8 + 1), this.emplace(h8, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8) { const p9 = 11 * t45; return this.float32[p9 + 0] = e57, this.float32[p9 + 1] = r86, this.float32[p9 + 2] = n45, this.float32[p9 + 3] = i26, this.float32[p9 + 4] = s18, this.float32[p9 + 5] = o88, this.float32[p9 + 6] = a46, this.float32[p9 + 7] = l21, this.float32[p9 + 8] = u12, this.float32[p9 + 9] = c28, this.float32[p9 + 10] = h8, t45; } } Da.prototype.bytesPerElement = 44, Ws(Da, "StructArrayLayout11f44"); class Ra extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = this.length; return this.resize(u12 + 1), this.emplace(u12, t45, e57, r86, n45, i26, s18, o88, a46, l21); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) { const c28 = 9 * t45; return this.float32[c28 + 0] = e57, this.float32[c28 + 1] = r86, this.float32[c28 + 2] = n45, this.float32[c28 + 3] = i26, this.float32[c28 + 4] = s18, this.float32[c28 + 5] = o88, this.float32[c28 + 6] = a46, this.float32[c28 + 7] = l21, this.float32[c28 + 8] = u12, t45; } } Ra.prototype.bytesPerElement = 36, Ws(Ra, "StructArrayLayout9f36"); class La extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57) { const r86 = this.length; return this.resize(r86 + 1), this.emplace(r86, t45, e57); } emplace(t45, e57, r86) { const n45 = 2 * t45; return this.float32[n45 + 0] = e57, this.float32[n45 + 1] = r86, t45; } } La.prototype.bytesPerElement = 8, Ws(La, "StructArrayLayout2f8"); class Oa extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45) { const i26 = this.length; return this.resize(i26 + 1), this.emplace(i26, t45, e57, r86, n45); } emplace(t45, e57, r86, n45, i26) { const s18 = 6 * t45; return this.uint32[3 * t45 + 0] = e57, this.uint16[s18 + 2] = r86, this.uint16[s18 + 3] = n45, this.uint16[s18 + 4] = i26, t45; } } Oa.prototype.bytesPerElement = 12, Ws(Oa, "StructArrayLayout1ul3ui12"); class Ua extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); } emplaceBack(t45) { const e57 = this.length; return this.resize(e57 + 1), this.emplace(e57, t45); } emplace(t45, e57) { return this.uint16[1 * t45 + 0] = e57, t45; } } Ua.prototype.bytesPerElement = 2, Ws(Ua, "StructArrayLayout1ui2"); class Na extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6) { const y4 = this.length; return this.resize(y4 + 1), this.emplace(y4, t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6); } emplace(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4) { const g9 = 16 * t45; return this.float32[g9 + 0] = e57, this.float32[g9 + 1] = r86, this.float32[g9 + 2] = n45, this.float32[g9 + 3] = i26, this.float32[g9 + 4] = s18, this.float32[g9 + 5] = o88, this.float32[g9 + 6] = a46, this.float32[g9 + 7] = l21, this.float32[g9 + 8] = u12, this.float32[g9 + 9] = c28, this.float32[g9 + 10] = h8, this.float32[g9 + 11] = p9, this.float32[g9 + 12] = d34, this.float32[g9 + 13] = f8, this.float32[g9 + 14] = m6, this.float32[g9 + 15] = y4, t45; } } Na.prototype.bytesPerElement = 64, Ws(Na, "StructArrayLayout16f64"); class ja extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); } emplaceBack(t45, e57, r86, n45, i26, s18, o88) { const a46 = this.length; return this.resize(a46 + 1), this.emplace(a46, t45, e57, r86, n45, i26, s18, o88); } emplace(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = 10 * t45, u12 = 5 * t45; return this.uint16[l21 + 0] = e57, this.uint16[l21 + 1] = r86, this.uint16[l21 + 2] = n45, this.uint16[l21 + 3] = i26, this.float32[u12 + 2] = s18, this.float32[u12 + 3] = o88, this.float32[u12 + 4] = a46, t45; } } ja.prototype.bytesPerElement = 20, Ws(ja, "StructArrayLayout4ui3f20"); class $a extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); } emplaceBack(t45) { const e57 = this.length; return this.resize(e57 + 1), this.emplace(e57, t45); } emplace(t45, e57) { return this.int16[1 * t45 + 0] = e57, t45; } } $a.prototype.bytesPerElement = 2, Ws($a, "StructArrayLayout1i2"); class Ga extends oa { _refreshViews() { this.uint8 = new Uint8Array(this.arrayBuffer); } emplaceBack(t45) { const e57 = this.length; return this.resize(e57 + 1), this.emplace(e57, t45); } emplace(t45, e57) { return this.uint8[1 * t45 + 0] = e57, t45; } } Ga.prototype.bytesPerElement = 1, Ws(Ga, "StructArrayLayout1ub1"); class Ha extends sa { 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]; } } Ha.prototype.size = 40; class qa extends Sa { get(t45) { return new Ha(this, t45); } } Ws(qa, "CollisionBoxArray"); class Xa extends sa { 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(t45) { this._structArray.uint8[this._pos1 + 49] = t45; } get hidden() { return this._structArray.uint8[this._pos1 + 50]; } set hidden(t45) { this._structArray.uint8[this._pos1 + 50] = t45; } get crossTileID() { return this._structArray.uint32[this._pos4 + 13]; } set crossTileID(t45) { this._structArray.uint32[this._pos4 + 13] = t45; } get associatedIconIndex() { return this._structArray.int16[this._pos2 + 28]; } get flipState() { return this._structArray.uint8[this._pos1 + 58]; } set flipState(t45) { this._structArray.uint8[this._pos1 + 58] = t45; } } Xa.prototype.size = 60; class Za extends Ta { get(t45) { return new Xa(this, t45); } } Ws(Za, "PlacedSymbolArray"); class Wa extends sa { get tileAnchorX() { return this._structArray.float32[this._pos4 + 0]; } get tileAnchorY() { return this._structArray.float32[this._pos4 + 1]; } get projectedAnchorX() { return this._structArray.int16[this._pos2 + 4]; } get projectedAnchorY() { return this._structArray.int16[this._pos2 + 5]; } get projectedAnchorZ() { return this._structArray.int16[this._pos2 + 6]; } get rightJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 7]; } get centerJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 8]; } get leftJustifiedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 9]; } get verticalPlacedTextSymbolIndex() { return this._structArray.int16[this._pos2 + 10]; } get placedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 11]; } get verticalPlacedIconSymbolIndex() { return this._structArray.int16[this._pos2 + 12]; } get key() { return this._structArray.uint16[this._pos2 + 13]; } get textBoxStartIndex() { return this._structArray.uint16[this._pos2 + 14]; } get textBoxEndIndex() { return this._structArray.uint16[this._pos2 + 15]; } get verticalTextBoxStartIndex() { return this._structArray.uint16[this._pos2 + 16]; } get verticalTextBoxEndIndex() { return this._structArray.uint16[this._pos2 + 17]; } get iconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 18]; } get iconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 19]; } get verticalIconBoxStartIndex() { return this._structArray.uint16[this._pos2 + 20]; } get verticalIconBoxEndIndex() { return this._structArray.uint16[this._pos2 + 21]; } get featureIndex() { return this._structArray.uint16[this._pos2 + 22]; } get numHorizontalGlyphVertices() { return this._structArray.uint16[this._pos2 + 23]; } get numVerticalGlyphVertices() { return this._structArray.uint16[this._pos2 + 24]; } get numIconVertices() { return this._structArray.uint16[this._pos2 + 25]; } get numVerticalIconVertices() { return this._structArray.uint16[this._pos2 + 26]; } get useRuntimeCollisionCircles() { return this._structArray.uint16[this._pos2 + 27]; } get crossTileID() { return this._structArray.uint32[this._pos4 + 14]; } set crossTileID(t45) { this._structArray.uint32[this._pos4 + 14] = t45; } get textOffset0() { return this._structArray.float32[this._pos4 + 15]; } get textOffset1() { return this._structArray.float32[this._pos4 + 16]; } get collisionCircleDiameter() { return this._structArray.float32[this._pos4 + 17]; } get zOffset() { return this._structArray.float32[this._pos4 + 18]; } set zOffset(t45) { this._structArray.float32[this._pos4 + 18] = t45; } get hasIconTextFit() { return this._structArray.uint8[this._pos1 + 76]; } get elevationFeatureIndex() { return this._structArray.uint16[this._pos2 + 39]; } } Wa.prototype.size = 80; class Ya extends Ba { get(t45) { return new Wa(this, t45); } } Ws(Ya, "SymbolInstanceArray"); class Ka extends pa { getoffsetX(t45) { return this.float32[1 * t45 + 0]; } } Ws(Ka, "GlyphOffsetArray"); class Ja extends ua { getx(t45) { return this.int16[2 * t45 + 0]; } gety(t45) { return this.int16[2 * t45 + 1]; } } Ws(Ja, "SymbolLineVertexArray"); class Qa extends sa { 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]; } } Qa.prototype.size = 12; class tl extends Oa { get(t45) { return new Qa(this, t45); } } Ws(tl, "FeatureIndexArray"); class el extends Ia { geta_centroid_pos0(t45) { return this.uint16[2 * t45 + 0]; } geta_centroid_pos1(t45) { return this.uint16[2 * t45 + 1]; } } Ws(el, "FillExtrusionCentroidArray"); class rl extends sa { get a_join_normal_inside0() { return this._structArray.int16[this._pos2 + 0]; } get a_join_normal_inside1() { return this._structArray.int16[this._pos2 + 1]; } get a_join_normal_inside2() { return this._structArray.int16[this._pos2 + 2]; } } rl.prototype.size = 6; class nl extends ca3 { get(t45) { return new rl(this, t45); } } Ws(nl, "FillExtrusionWallArray"); const il = aa2([{ name: "a_pos", components: 2, type: "Int16" }], 4), sl = aa2([{ name: "a_circle_z_offset", components: 1, type: "Float32" }], 4), ol = aa2([{ name: "a_pos_3", components: 3, type: "Int16" }, { name: "a_pos_normal_3", components: 3, type: "Int16" }]); class al { constructor(t45 = []) { this.segments = t45; } _prepareSegment(t45, e57, r86, n45) { let i26 = this.segments[this.segments.length - 1]; return t45 > al.MAX_VERTEX_ARRAY_LENGTH && Gt(`Max vertices per segment is ${al.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t45}`), (!i26 || i26.vertexLength + t45 > al.MAX_VERTEX_ARRAY_LENGTH || i26.sortKey !== n45) && (i26 = { vertexOffset: e57, primitiveOffset: r86, vertexLength: 0, primitiveLength: 0 }, void 0 !== n45 && (i26.sortKey = n45), this.segments.push(i26)), i26; } prepareSegment(t45, e57, r86, n45) { return this._prepareSegment(t45, e57.length, r86.length, n45); } get() { return this.segments; } destroy() { for (const t45 of this.segments) for (const e57 in t45.vaos) t45.vaos[e57].destroy(); } static simpleSegment(t45, e57, r86, n45) { return new al([{ vertexOffset: t45, primitiveOffset: e57, vertexLength: r86, primitiveLength: n45, vaos: {}, sortKey: 0 }]); } } function ll(t45, e57) { return 256 * (t45 = Tt2(Math.floor(t45), 0, 255)) + Tt2(Math.floor(e57), 0, 255); } al.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, Ws(al, "SegmentVector"); const ul = aa2([{ name: "a_pattern", components: 4, type: "Uint16" }, { name: "a_pixel_ratio", components: 1, type: "Float32" }]), cl = aa2([{ name: "a_pattern_b", components: 4, type: "Uint16" }]), hl = aa2([{ name: "a_dash", components: 4, type: "Uint16" }]); class pl { constructor() { this.ids = [], this.uniqueIds = [], this.positions = [], this.indexed = false; } add(t45, e57, r86, n45) { this.ids.push(dl(t45)), this.positions.push(e57, r86, n45); } eachPosition(t45, e57) { const r86 = dl(t45); let n45 = 0, i26 = this.ids.length - 1; for (; n45 < i26; ) { const t46 = n45 + i26 >> 1; this.ids[t46] >= r86 ? i26 = t46 : n45 = t46 + 1; } for (; this.ids[n45] === r86; ) e57(this.positions[3 * n45], this.positions[3 * n45 + 1], this.positions[3 * n45 + 2]), n45++; } static serialize(t45, e57) { const r86 = new Float64Array(t45.ids), n45 = new Uint32Array(t45.positions); return fl(r86, n45, 0, r86.length - 1), e57 && (e57.add(r86.buffer), e57.add(n45.buffer)), { ids: r86, positions: n45 }; } static deserialize(t45) { const e57 = new pl(); let r86; e57.ids = t45.ids, e57.positions = t45.positions; for (const t46 of e57.ids) t46 !== r86 && e57.uniqueIds.push(t46), r86 = t46; return e57.indexed = true, e57; } } function dl(t45) { const e57 = +t45; return Number.isSafeInteger(e57) ? e57 : We(String(t45)); } function fl(t45, e57, r86, n45) { for (; r86 < n45; ) { const i26 = t45[r86 + n45 >> 1]; let s18 = r86 - 1, o88 = n45 + 1; for (; ; ) { do { s18++; } while (t45[s18] < i26); do { o88--; } while (t45[o88] > i26); if (s18 >= o88) break; ml(t45, s18, o88), ml(e57, 3 * s18, 3 * o88), ml(e57, 3 * s18 + 1, 3 * o88 + 1), ml(e57, 3 * s18 + 2, 3 * o88 + 2); } o88 - r86 < n45 - o88 ? (fl(t45, e57, r86, o88), r86 = o88 + 1) : (fl(t45, e57, o88 + 1, n45), n45 = o88); } } function ml(t45, e57, r86) { const n45 = t45[e57]; t45[e57] = t45[r86], t45[r86] = n45; } Ws(pl, "FeaturePositionMap"); class yl { constructor(t45) { this.gl = t45.gl, this.initialized = false; } fetchUniformLocation(t45, e57) { return this.location || this.initialized || (this.location = this.gl.getUniformLocation(t45, e57), this.initialized = true), !!this.location; } set(t45, e57, r86) { throw new Error("Uniform#set() must be implemented by each concrete Uniform"); } } class gl extends yl { constructor(t45) { super(t45), this.current = 0; } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && this.current !== r86 && (this.current = r86, this.gl.uniform1i(this.location, r86)); } } class xl extends yl { constructor(t45) { super(t45), this.current = 0; } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && this.current !== r86 && (this.current = r86, this.gl.uniform1f(this.location, r86)); } } class vl extends yl { constructor(t45) { super(t45), this.current = [0, 0]; } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && (r86[0] === this.current[0] && r86[1] === this.current[1] || (this.current = r86, this.gl.uniform2f(this.location, r86[0], r86[1]))); } } class bl extends yl { constructor(t45) { super(t45), this.current = [0, 0, 0]; } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && (r86[0] === this.current[0] && r86[1] === this.current[1] && r86[2] === this.current[2] || (this.current = r86, this.gl.uniform3f(this.location, r86[0], r86[1], r86[2]))); } } class wl extends yl { constructor(t45) { super(t45), this.current = [0, 0, 0, 0]; } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && (r86[0] === this.current[0] && r86[1] === this.current[1] && r86[2] === this.current[2] && r86[3] === this.current[3] || (this.current = r86, this.gl.uniform4f(this.location, r86[0], r86[1], r86[2], r86[3]))); } } class _l extends yl { constructor(t45) { super(t45), this.current = sr.transparent.toPremultipliedRenderColor(null); } set(t45, e57, r86) { this.fetchUniformLocation(t45, e57) && (r86.r === this.current.r && r86.g === this.current.g && r86.b === this.current.b && r86.a === this.current.a || (this.current = r86, this.gl.uniform4f(this.location, r86.r, r86.g, r86.b, r86.a))); } } const Al = new Float32Array(16); class Ml extends yl { constructor(t45) { super(t45), this.current = Al; } set(t45, e57, r86) { if (this.fetchUniformLocation(t45, e57)) { if (r86[12] !== this.current[12] || r86[0] !== this.current[0]) return this.current = r86, void this.gl.uniformMatrix4fv(this.location, false, r86); for (let t46 = 1; t46 < 16; t46++) if (r86[t46] !== this.current[t46]) { this.current = r86, this.gl.uniformMatrix4fv(this.location, false, r86); break; } } } } const Il = new Float32Array(9), Sl = new Float32Array(4); class Pl extends yl { constructor(t45) { super(t45), this.current = Sl; } set(t45, e57, r86) { if (this.fetchUniformLocation(t45, e57)) { for (let t46 = 0; t46 < 4; t46++) if (r86[t46] !== this.current[t46]) { this.current = r86, this.gl.uniformMatrix2fv(this.location, false, r86); break; } } } } function kl(t45) { return [ll(255 * t45.r, 255 * t45.g), ll(255 * t45.b, 255 * t45.a)]; } class zl { constructor(t45, e57, r86, n45) { this.value = t45, this.uniformNames = e57.map(((t46) => `u_${t46}`)), this.type = r86, this.context = n45; } setUniform(t45, e57, r86, n45, i26) { const s18 = n45.constantOr(this.value); e57.set(t45, i26, s18 instanceof sr ? s18.toPremultipliedRenderColor(this.lutExpression && "constant" === this.lutExpression.kind && "none" === this.lutExpression.value ? null : this.context.lut) : s18); } getBinding(t45, e57) { return "color" === this.type ? new _l(t45) : new xl(t45); } } class El { constructor(t45, e57) { this.uniformNames = e57.map(((t46) => `u_${t46}`)), this.pattern = null, this.patternTransition = null, this.pixelRatio = 1; } setConstantPatternPositions(t45, e57) { this.pixelRatio = t45.pixelRatio || 1, this.pattern = t45.tl.concat(t45.br), this.patternTransition = e57 ? e57.tl.concat(e57.br) : this.pattern; } setUniform(t45, e57, r86, n45, i26) { let s18 = null; "u_pattern" !== i26 && "u_dash" !== i26 || (s18 = this.pattern), "u_pattern_b" === i26 && (s18 = this.patternTransition), "u_pixel_ratio" === i26 && (s18 = this.pixelRatio), s18 && e57.set(t45, i26, s18); } getBinding(t45, e57) { return "u_pattern" === e57 || "u_pattern_b" === e57 || "u_dash" === e57 ? new wl(t45) : new xl(t45); } } class Tl { constructor(t45, e57, r86, n45) { this.expression = t45, this.type = r86, this.maxValue = 0, this.paintVertexAttributes = e57.map(((t46) => ({ name: `a_${t46}`, type: "Float32", components: "color" === r86 ? 2 : 1, offset: 0 }))), this.paintVertexArray = new n45(); } populatePaintArray(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = this.paintVertexArray.length, u12 = "composite" === this.expression.kind || "source" === this.expression.kind ? this.expression.evaluate(new wo(0, { brightness: s18, worldview: a46 }), e57, {}, i26, n45, o88) : "constant" === this.expression.kind && this.expression.value, c28 = !!this.lutExpression && "none" === ("composite" === this.lutExpression.kind || "source" === this.lutExpression.kind ? this.lutExpression.evaluate(new wo(0, { brightness: s18, worldview: a46 }), e57, {}, i26, n45, o88) : this.lutExpression.value); this.paintVertexArray.resize(t45), this._setPaintValue(l21, t45, u12, c28 ? null : this.context.lut); } updatePaintArray(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = "composite" === this.expression.kind || "source" === this.expression.kind ? this.expression.evaluate({ zoom: 0, brightness: o88, worldview: a46 }, r86, n45, void 0, i26) : "constant" === this.expression.kind && this.expression.value, u12 = !!this.lutExpression && "none" === ("composite" === this.lutExpression.kind || "source" === this.lutExpression.kind ? this.lutExpression.evaluate(new wo(0, { brightness: o88, worldview: a46 }), r86, n45, void 0, i26) : this.lutExpression.value); this._setPaintValue(t45, e57, l21, u12 ? null : this.context.lut); } _setPaintValue(t45, e57, r86, n45) { if ("color" === this.type) { const i26 = kl(r86.toPremultipliedRenderColor(n45)); for (let r87 = t45; r87 < e57; r87++) this.paintVertexArray.emplace(r87, i26[0], i26[1]); } else { for (let n46 = t45; n46 < e57; n46++) this.paintVertexArray.emplace(n46, r86); this.maxValue = Math.max(this.maxValue, Math.abs(r86)); } } upload(t45) { this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t45.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.lutExpression && "constant" !== this.lutExpression.kind && (this.lutExpression.isStateDependent || !this.lutExpression.isLightConstant) || "constant" !== this.expression.kind && (this.expression.isStateDependent || !this.expression.isLightConstant))); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); } } class Bl { constructor(t45, e57, r86, n45, i26, s18) { this.expression = t45, this.uniformNames = e57.map(((t46) => `u_${t46}_t`)), this.type = r86, this.useIntegerZoom = n45, this.context = i26, this.maxValue = 0, this.paintVertexAttributes = e57.map(((t46) => ({ name: `a_${t46}`, type: "Float32", components: "color" === r86 ? 4 : 2, offset: 0 }))), this.paintVertexArray = new s18(); } populatePaintArray(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = this.expression.evaluate(new wo(this.context.zoom, { brightness: s18, worldview: a46 }), e57, {}, i26, n45, o88), u12 = this.expression.evaluate(new wo(this.context.zoom + 1, { brightness: s18, worldview: a46 }), e57, {}, i26, n45, o88), c28 = !!this.lutExpression && "none" === ("composite" === this.lutExpression.kind || "source" === this.lutExpression.kind ? this.lutExpression.evaluate(new wo(0, { brightness: s18, worldview: a46 }), e57, {}, i26, n45, o88) : this.lutExpression.value), h8 = this.paintVertexArray.length; this.paintVertexArray.resize(t45), this._setPaintValue(h8, t45, l21, u12, c28 ? null : this.context.lut); } updatePaintArray(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = this.expression.evaluate({ zoom: this.context.zoom, brightness: o88, worldview: a46 }, r86, n45, void 0, i26), u12 = this.expression.evaluate({ zoom: this.context.zoom + 1, brightness: o88, worldview: a46 }, r86, n45, void 0, i26), c28 = !!this.lutExpression && "none" === ("composite" === this.lutExpression.kind || "source" === this.lutExpression.kind ? this.lutExpression.evaluate(new wo(0, { brightness: o88, worldview: a46 }), r86, n45, void 0, i26) : this.lutExpression.value); this._setPaintValue(t45, e57, l21, u12, c28 ? null : this.context.lut); } _setPaintValue(t45, e57, r86, n45, i26) { if ("color" === this.type) { const n46 = kl(r86.toPremultipliedRenderColor(i26)), s18 = kl(r86.toPremultipliedRenderColor(i26)); for (let r87 = t45; r87 < e57; r87++) this.paintVertexArray.emplace(r87, n46[0], n46[1], s18[0], s18[1]); } else { for (let i27 = t45; i27 < e57; i27++) this.paintVertexArray.emplace(i27, r86, n45); this.maxValue = Math.max(this.maxValue, Math.abs(r86), Math.abs(n45)); } } upload(t45) { this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t45.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent || !this.expression.isLightConstant)); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); } setUniform(t45, e57, r86, n45, i26) { const s18 = this.useIntegerZoom ? Math.floor(r86.zoom) : r86.zoom, o88 = Tt2(this.expression.interpolationFactor(s18, this.context.zoom, this.context.zoom + 1), 0, 1); e57.set(t45, i26, o88); } getBinding(t45, e57) { return new xl(t45); } } class Vl { constructor(t45, e57, r86, n45, i26) { this.expression = t45, this.layerId = i26, this.paintVertexAttributes = ("array" === r86 ? hl : ul).members; for (let t46 = 0; t46 < e57.length; ++t46) ; this.paintVertexArray = new n45(), this.paintTransitionVertexArray = new va(); } populatePaintArray(t45, e57, r86, n45) { const i26 = this.paintVertexArray.length; this.paintVertexArray.resize(t45), this._setPaintValues(i26, t45, e57.patterns && e57.patterns[this.layerId], r86); } updatePaintArray(t45, e57, r86, n45, i26, s18, o88) { this._setPaintValues(t45, e57, r86.patterns && r86.patterns[this.layerId], s18); } _setPaintValues(t45, e57, r86, n45) { if (!n45 || !r86) return; const i26 = n45[r86[0]], s18 = n45[r86[1]]; if (i26) { if (i26) { const { tl: r87, br: n46, pixelRatio: s19 } = i26; for (let i27 = t45; i27 < e57; i27++) this.paintVertexArray.emplace(i27, r87[0], r87[1], n46[0], n46[1], s19); } if (s18) { this.paintTransitionVertexArray.resize(this.paintVertexArray.length); const { tl: r87, br: n46 } = s18; for (let i27 = t45; i27 < e57; i27++) this.paintTransitionVertexArray.emplace(i27, r87[0], r87[1], n46[0], n46[1]); } } } upload(t45) { const e57 = this.expression.isStateDependent || !this.expression.isLightConstant; this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer = t45.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, e57)), this.paintTransitionVertexArray && this.paintTransitionVertexArray.length && (this.paintTransitionVertexBuffer = t45.createVertexBuffer(this.paintTransitionVertexArray, cl.members, e57)); } destroy() { this.paintVertexBuffer && this.paintVertexBuffer.destroy(), this.paintTransitionVertexBuffer && this.paintTransitionVertexBuffer.destroy(); } } class Fl { constructor(t45, e57, r86 = (() => true)) { this.binders = {}, this._buffers = [], this.context = e57; const n45 = []; for (const i26 in t45.paint._values) { const s18 = t45.paint.get(i26); if (i26.endsWith("-use-theme")) continue; if (!r86(i26)) continue; if (!(s18 instanceof ko && Ms(s18.property.specification))) continue; const o88 = Rl(i26, t45.type), a46 = s18.value, l21 = s18.property.specification.type, u12 = !!s18.property.useIntegerZoom, c28 = "line-dasharray" === i26 || i26.endsWith("pattern"), h8 = t45.paint.get(`${i26}-use-theme`), p9 = "line-dasharray" === i26 && "constant" !== t45.layout.get("line-cap").value.kind || h8 && "constant" !== h8.value.kind; if ("constant" !== a46.kind || p9) if ("source" === a46.kind || p9 || c28) { const e58 = Ul(i26, l21, "source"); this.binders[i26] = c28 ? new Vl(a46, o88, l21, e58, t45.id) : new Tl(a46, o88, l21, e58), n45.push(`/a_${i26}`); } else { const t46 = Ul(i26, l21, "composite"); this.binders[i26] = new Bl(a46, o88, l21, u12, e57, t46), n45.push(`/z_${i26}`); } else this.binders[i26] = c28 ? new El(a46.value, o88) : new zl(a46.value, o88, l21, e57), n45.push(`/u_${i26}`); h8 && (this.binders[i26].lutExpression = h8.value); } this.cacheKey = n45.sort().join(""); } getMaxValue(t45) { const e57 = this.binders[t45]; return e57 instanceof Tl || e57 instanceof Bl ? e57.maxValue : 0; } populatePaintArrays(t45, e57, r86, n45, i26, s18, o88, a46) { for (const l21 in this.binders) { const u12 = this.binders[l21]; u12.context = this.context, (u12 instanceof Tl || u12 instanceof Bl || u12 instanceof Vl) && u12.populatePaintArray(t45, e57, r86, n45, i26, s18, o88, a46); } } setConstantPatternPositions(t45, e57) { for (const r86 in this.binders) { const n45 = this.binders[r86]; n45 instanceof El && n45.setConstantPatternPositions(t45, e57); } } getPatternTransitionVertexBuffer(t45) { const e57 = this.binders[t45]; return e57 instanceof Vl ? e57.paintTransitionVertexBuffer : null; } updatePaintArrays(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) { let c28 = false; const h8 = Object.keys(t45), p9 = 0 !== h8.length && !a46, d34 = p9 ? h8 : e57.uniqueIds; this.context.lut = i26.lut; for (const a47 in this.binders) { const h9 = this.binders[a47]; if (h9.context = this.context, (h9 instanceof Tl || h9 instanceof Bl || h9 instanceof Vl) && h9.expression && h9.expression.kind && "constant" !== h9.expression.kind && (true === h9.expression.isStateDependent || false === h9.expression.isLightConstant)) { const f8 = i26.paint.get(a47); h9.expression = f8.value; for (const r87 of d34) { const i27 = t45[r87.toString()]; e57.eachPosition(r87, ((t46, e58, r88) => { const a48 = n45.feature(t46); h9.updatePaintArray(e58, r88, a48, i27, s18, o88, l21, u12); })); } if (!p9) for (const e58 of r86.uniqueIds) { const i27 = t45[e58.toString()]; r86.eachPosition(e58, ((t46, e59, r87) => { const a48 = n45.feature(t46); h9.updatePaintArray(e59, r87, a48, i27, s18, o88, l21, u12); })); } c28 = true; } } return c28; } defines() { const t45 = []; for (const e57 in this.binders) { const r86 = this.binders[e57]; (r86 instanceof zl || r86 instanceof El) && t45.push(...r86.uniformNames.map(((t46) => `#define HAS_UNIFORM_${t46}`))); } return t45; } getPaintVertexBuffers() { return this._buffers; } getUniforms(t45) { const e57 = []; for (const r86 in this.binders) { const n45 = this.binders[r86]; if (n45 instanceof zl || n45 instanceof El || n45 instanceof Bl) for (const i26 of n45.uniformNames) e57.push({ name: i26, property: r86, binding: n45.getBinding(t45, i26) }); } return e57; } setUniforms(t45, e57, r86, n45, i26) { for (const { name: e58, property: s18, binding: o88 } of r86) this.binders[s18].setUniform(t45, o88, i26, n45.get(s18), e58); } updatePaintBuffers() { this._buffers = []; for (const t45 in this.binders) { const e57 = this.binders[t45]; (e57 instanceof Tl || e57 instanceof Bl || e57 instanceof Vl) && e57.paintVertexBuffer && this._buffers.push(e57.paintVertexBuffer), e57 instanceof Vl && e57.paintTransitionVertexBuffer && this._buffers.push(e57.paintTransitionVertexBuffer); } } upload(t45) { for (const e57 in this.binders) { const r86 = this.binders[e57]; (r86 instanceof Tl || r86 instanceof Bl || r86 instanceof Vl) && r86.upload(t45); } this.updatePaintBuffers(); } destroy() { for (const t45 in this.binders) { const e57 = this.binders[t45]; (e57 instanceof Tl || e57 instanceof Bl || e57 instanceof Vl) && e57.destroy(); } } } class Cl { constructor(t45, e57, r86 = (() => true)) { this.programConfigurations = {}; for (const n45 of t45) this.programConfigurations[n45.id] = new Fl(n45, e57, r86); this.needsUpload = false, this._featureMap = new pl(), this._featureMapWithoutIds = new pl(), this._bufferOffset = 0, this._idlessCounter = 0; } populatePaintArrays(t45, e57, r86, n45, i26, s18, o88, a46, l21) { for (const r87 in this.programConfigurations) this.programConfigurations[r87].populatePaintArrays(t45, e57, n45, i26, s18, o88, a46, l21); void 0 !== e57.id ? this._featureMap.add(e57.id, r86, this._bufferOffset, t45) : (this._featureMapWithoutIds.add(this._idlessCounter, r86, this._bufferOffset, t45), this._idlessCounter += 1), this._bufferOffset = t45, this.needsUpload = true; } updatePaintArrays(t45, e57, r86, n45, i26, s18, o88, a46) { for (const l21 of r86) this.needsUpload = this.programConfigurations[l21.id].updatePaintArrays(t45, this._featureMap, this._featureMapWithoutIds, e57, l21, n45, i26, s18, o88 || 0, a46) || this.needsUpload; } get(t45) { return this.programConfigurations[t45]; } upload(t45) { if (this.needsUpload) { for (const e57 in this.programConfigurations) this.programConfigurations[e57].upload(t45); this.needsUpload = false; } } destroy() { for (const t45 in this.programConfigurations) this.programConfigurations[t45].destroy(); } } const Dl = { "text-opacity": ["opacity"], "icon-opacity": ["opacity"], "text-occlusion-opacity": ["occlusion_opacity"], "icon-occlusion-opacity": ["occlusion_opacity"], "text-color": ["fill_color"], "icon-color": ["fill_color"], "text-emissive-strength": ["emissive_strength"], "icon-emissive-strength": ["emissive_strength"], "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"], "symbol-z-offset": ["z_offset"], "line-gap-width": ["gapwidth"], "line-pattern": ["pattern", "pixel_ratio", "pattern_b"], "fill-pattern": ["pattern", "pixel_ratio", "pattern_b"], "fill-extrusion-pattern": ["pattern", "pixel_ratio", "pattern_b"], "line-dasharray": ["dash"], "fill-bridge-guard-rail-color": ["structure_color"], "fill-tunnel-structure-color": ["structure_color"] }; function Rl(t45, e57) { return Dl[t45] || [t45.replace(`${e57}-`, "").replace(/-/g, "_")]; } const Ll = { "line-pattern": { source: xa, composite: xa }, "fill-pattern": { source: xa, composite: xa }, "fill-extrusion-pattern": { source: xa, composite: xa }, "line-dasharray": { source: va, composite: va } }, Ol = { color: { source: La, composite: Aa }, number: { source: pa, composite: La } }; function Ul(t45, e57, r86) { const n45 = Ll[t45]; return n45 && n45[r86] || Ol[e57][r86]; } Ws(zl, "ConstantBinder"), Ws(El, "PatternConstantBinder"), Ws(Tl, "SourceExpressionBinder"), Ws(Vl, "PatternCompositeBinder"), Ws(Bl, "CompositeExpressionBinder"), Ws(Fl, "ProgramConfiguration", { omit: ["_buffers"] }), Ws(Cl, "ProgramConfigurationSet"); const Nl = Rn / Math.PI / 2, jl = 5, $l = 6, Gl = 16383, Hl = 64, ql = [Hl, 32, 16], Xl = -Nl, Zl = Nl; function Wl(t45, e57, r86, n45 = Nl) { return r86 = It(r86), [t45 * Math.sin(r86) * n45, -e57 * n45, t45 * Math.cos(r86) * n45]; } function Yl(t45, e57, r86) { return Wl(Math.cos(It(t45)), Math.sin(It(t45)), e57, r86); } const Kl = 63710088e-1, Jl = 2 * Math.PI * Kl; class Ql { constructor(t45, e57) { if (isNaN(t45) || isNaN(e57)) throw new Error(`Invalid LngLat object: (${t45}, ${e57})`); if (this.lng = +t45, this.lat = +e57, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90"); } wrap() { return new Ql(Vt(this.lng, -180, 180), this.lat); } toArray() { return [this.lng, this.lat]; } toString() { return `LngLat(${this.lng}, ${this.lat})`; } distanceTo(t45) { const e57 = Math.PI / 180, r86 = this.lat * e57, n45 = t45.lat * e57, i26 = Math.sin(r86) * Math.sin(n45) + Math.cos(r86) * Math.cos(n45) * Math.cos((t45.lng - this.lng) * e57); return Kl * Math.acos(Math.min(i26, 1)); } toBounds(t45 = 0) { const e57 = 360 * t45 / 40075017, r86 = e57 / Math.cos(Math.PI / 180 * this.lat); return new tu({ lng: this.lng - r86, lat: this.lat - e57 }, { lng: this.lng + r86, lat: this.lat + e57 }); } toEcef(t45) { return Yl(this.lat, this.lng, Nl + t45 * Nl / Kl); } static convert(t45) { if (t45 instanceof Ql) return t45; if (Array.isArray(t45) && (2 === t45.length || 3 === t45.length)) return new Ql(Number(t45[0]), Number(t45[1])); if (!Array.isArray(t45) && "object" == typeof t45 && null !== t45) return new Ql(Number("lng" in t45 ? t45.lng : t45.lon), Number(t45.lat)); throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]"); } } class tu { constructor(t45, e57) { t45 && (e57 ? this.setSouthWest(t45).setNorthEast(e57) : Array.isArray(t45) && 4 === t45.length ? this.setSouthWest([t45[0], t45[1]]).setNorthEast([t45[2], t45[3]]) : this.setSouthWest(t45[0]).setNorthEast(t45[1])); } setNorthEast(t45) { return this._ne = t45 instanceof Ql ? new Ql(t45.lng, t45.lat) : Ql.convert(t45), this; } setSouthWest(t45) { return this._sw = t45 instanceof Ql ? new Ql(t45.lng, t45.lat) : Ql.convert(t45), this; } extend(t45) { const e57 = this._sw, r86 = this._ne; let n45, i26; if (t45 instanceof Ql) n45 = t45, i26 = t45; else { if (!(t45 instanceof tu)) return Array.isArray(t45) ? 4 === t45.length || t45.every(Array.isArray) ? this.extend(tu.convert(t45)) : this.extend(Ql.convert(t45)) : "object" == typeof t45 && null !== t45 && t45.hasOwnProperty("lat") && (t45.hasOwnProperty("lon") || t45.hasOwnProperty("lng")) ? this.extend(Ql.convert(t45)) : this; if (n45 = t45._sw, i26 = t45._ne, !n45 || !i26) return this; } return e57 || r86 ? (e57.lng = Math.min(n45.lng, e57.lng), e57.lat = Math.min(n45.lat, e57.lat), r86.lng = Math.max(i26.lng, r86.lng), r86.lat = Math.max(i26.lat, r86.lat)) : (this._sw = new Ql(n45.lng, n45.lat), this._ne = new Ql(i26.lng, i26.lat)), this; } getCenter() { return new Ql((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 Ql(this.getWest(), this.getNorth()); } getSouthEast() { return new Ql(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(t45) { const { lng: e57, lat: r86 } = Ql.convert(t45); let n45 = this._sw.lng <= e57 && e57 <= this._ne.lng; return this._sw.lng > this._ne.lng && (n45 = this._sw.lng >= e57 && e57 >= this._ne.lng), this._sw.lat <= r86 && r86 <= this._ne.lat && n45; } static convert(t45) { if (t45) return t45 instanceof tu ? t45 : new tu(t45); } } const eu = 0, ru = 25.5; function nu(t45) { return Jl * Math.cos(t45 * Math.PI / 180); } function iu(t45) { return (180 + t45) / 360; } function su(t45) { return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t45 * Math.PI / 360))) / 360; } function ou(t45, e57) { return t45 / nu(e57); } function au(t45) { return 360 * t45 - 180; } function lu(t45) { return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * t45) * Math.PI / 180)) - 90; } function uu(t45, e57) { return t45 * nu(lu(e57)); } const cu = 85.051129; function hu(t45) { return Math.cos(It(Tt2(t45, -cu, cu))); } function pu(t45, e57) { const r86 = Tt2(e57, eu, ru), n45 = Math.pow(2, r86); return hu(t45) * Jl / (512 * n45); } function du(t45) { return 1 / Math.cos(t45 * Math.PI / 180); } function fu(t45, e57 = 0) { const r86 = Math.exp(Math.PI * (1 - (t45.y + e57 / Rn) / (1 << t45.z) * 2)); return 80150034 * r86 / (r86 * r86 + 1) / Rn / (1 << t45.z); } class mu { constructor(t45, e57, r86 = 0) { this.x = +t45, this.y = +e57, this.z = +r86; } static fromLngLat(t45, e57 = 0) { const r86 = Ql.convert(t45); return new mu(iu(r86.lng), su(r86.lat), ou(e57, r86.lat)); } toLngLat() { return new Ql(au(this.x), lu(this.y)); } toAltitude() { return uu(this.z, this.y); } meterInMercatorCoordinateUnits() { return 1 / Jl * du(lu(this.y)); } } function yu(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = (e57 + n45) / 2, c28 = (r86 + i26) / 2, h8 = new wt(u12, c28); a46(h8), (function(t46, e58, r87, n46, i27, s19) { const o89 = r87 - i27, a47 = n46 - s19; return Math.abs((n46 - e58) * o89 - (r87 - t46) * a47) / Math.hypot(o89, a47); })(h8.x, h8.y, s18.x, s18.y, o88.x, o88.y) >= l21 ? (yu(t45, e57, r86, u12, c28, s18, h8, a46, l21), yu(t45, u12, c28, n45, i26, h8, o88, a46, l21)) : t45.push(o88); } function gu(t45, e57, r86) { let n45 = t45[0], i26 = n45.x, s18 = n45.y; e57(n45); const o88 = [n45]; for (let a46 = 1; a46 < t45.length; a46++) { const l21 = t45[a46], { x: u12, y: c28 } = l21; e57(l21), yu(o88, i26, s18, u12, c28, n45, l21, e57, r86), i26 = u12, s18 = c28, n45 = l21; } return o88; } function xu(t45, e57, r86, n45) { if (n45(e57, r86)) { const i26 = e57.add(r86)._mult(0.5); xu(t45, e57, i26, n45), xu(t45, i26, r86, n45); } else t45.push(r86); } function vu(t45, e57) { let r86 = t45[0]; const n45 = [r86]; for (let i26 = 1; i26 < t45.length; i26++) { const s18 = t45[i26]; xu(n45, r86, s18, e57), r86 = s18; } return n45; } const bu = Math.pow(2, 14) - 1, wu = -bu - 1; function _u(t45, e57) { const r86 = Math.round(t45.x * e57), n45 = Math.round(t45.y * e57); return t45.x = Tt2(r86, wu, bu), t45.y = Tt2(n45, wu, bu), (r86 < t45.x || r86 > t45.x + 1 || n45 < t45.y || n45 > t45.y + 1) && Gt("Geometry exceeds allowed extent, reduce your vector tile buffer size"), t45; } function Au(t45, e57, r86) { const n45 = t45.loadGeometry(), i26 = t45.extent, s18 = Rn / i26; if (e57 && r86 && r86.projection.isReprojectedInTileSpace) { const s19 = 1 << e57.z, { scale: o88, x: a46, y: l21, projection: u12 } = r86, c28 = (t46) => { const r87 = au((e57.x + t46.x / i26) / s19), n46 = lu((e57.y + t46.y / i26) / s19), c29 = u12.project(r87, n46); t46.x = (c29.x * o88 - a46) * i26, t46.y = (c29.y * o88 - l21) * i26; }; for (let e58 = 0; e58 < n45.length; e58++) if (1 !== t45.type) n45[e58] = gu(n45[e58], c28, 1); else { const t46 = []; for (const r87 of n45[e58]) r87.x < 0 || r87.x >= i26 || r87.y < 0 || r87.y >= i26 || (c28(r87), t46.push(r87)); n45[e58] = t46; } } for (const t46 of n45) for (const e58 of t46) _u(e58, s18); return n45; } function Mu(t45, e57) { return { type: t45.type, id: t45.id, properties: t45.properties, geometry: e57 ? Au(t45) : [] }; } class Iu { constructor(t45, e57, r86, n45, i26) { this.properties = {}, this.extent = r86, this.type = 0, this.id = void 0, this._pbf = t45, this._geometry = -1, this._keys = n45, this._values = i26, t45.readFields(Su, this, e57); } loadGeometry() { const t45 = this._pbf; t45.pos = this._geometry; const e57 = t45.readVarint() + t45.pos, r86 = []; let n45, i26 = 1, s18 = 0, o88 = 0, a46 = 0; for (; t45.pos < e57; ) { if (s18 <= 0) { const e58 = t45.readVarint(); i26 = 7 & e58, s18 = e58 >> 3; } if (s18--, 1 === i26 || 2 === i26) o88 += t45.readSVarint(), a46 += t45.readSVarint(), 1 === i26 && (n45 && r86.push(n45), n45 = []), n45 && n45.push(new wt(o88, a46)); else { if (7 !== i26) throw new Error(`unknown command ${i26}`); n45 && n45.push(n45[0].clone()); } } return n45 && r86.push(n45), r86; } bbox() { const t45 = this._pbf; t45.pos = this._geometry; const e57 = t45.readVarint() + t45.pos; let r86 = 1, n45 = 0, i26 = 0, s18 = 0, o88 = 1 / 0, a46 = -1 / 0, l21 = 1 / 0, u12 = -1 / 0; for (; t45.pos < e57; ) { if (n45 <= 0) { const e58 = t45.readVarint(); r86 = 7 & e58, n45 = e58 >> 3; } if (n45--, 1 === r86 || 2 === r86) i26 += t45.readSVarint(), s18 += t45.readSVarint(), i26 < o88 && (o88 = i26), i26 > a46 && (a46 = i26), s18 < l21 && (l21 = s18), s18 > u12 && (u12 = s18); else if (7 !== r86) throw new Error(`unknown command ${r86}`); } return [o88, l21, a46, u12]; } toGeoJSON(t45, e57, r86) { const n45 = this.extent * Math.pow(2, r86), i26 = this.extent * t45, s18 = this.extent * e57, o88 = this.loadGeometry(); function a46(t46) { return [360 * (t46.x + i26) / n45 - 180, 360 / Math.PI * Math.atan(Math.exp((1 - 2 * (t46.y + s18) / n45) * Math.PI)) - 90]; } function l21(t46) { return t46.map(a46); } let u12; if (1 === this.type) { const t46 = []; for (const e59 of o88) t46.push(e59[0]); const e58 = l21(t46); u12 = 1 === t46.length ? { type: "Point", coordinates: e58[0] } : { type: "MultiPoint", coordinates: e58 }; } else if (2 === this.type) { const t46 = o88.map(l21); u12 = 1 === t46.length ? { type: "LineString", coordinates: t46[0] } : { type: "MultiLineString", coordinates: t46 }; } else { if (3 !== this.type) throw new Error("unknown feature type"); { const t46 = (function(t47) { const e59 = t47.length; if (e59 <= 1) return [t47]; const r87 = []; let n46, i27; for (let s19 = 0; s19 < e59; s19++) { const e60 = Pu(t47[s19]); 0 !== e60 && (void 0 === i27 && (i27 = e60 < 0), i27 === e60 < 0 ? (n46 && r87.push(n46), n46 = [t47[s19]]) : n46 && n46.push(t47[s19])); } return n46 && r87.push(n46), r87; })(o88), e58 = []; for (const r87 of t46) e58.push(r87.map(l21)); u12 = 1 === e58.length ? { type: "Polygon", coordinates: e58[0] } : { type: "MultiPolygon", coordinates: e58 }; } } const c28 = { type: "Feature", geometry: u12, properties: this.properties }; return null != this.id && (c28.id = this.id), c28; } } function Su(t45, e57, r86) { 1 === t45 ? e57.id = r86.readVarint() : 2 === t45 ? (function(t46, e58) { const r87 = t46.readVarint() + t46.pos; for (; t46.pos < r87; ) { const r88 = e58._keys[t46.readVarint()], n45 = e58._values[t46.readVarint()]; e58.properties[r88] = n45; } })(r86, e57) : 3 === t45 ? e57.type = r86.readVarint() : 4 === t45 && (e57._geometry = r86.pos); } function Pu(t45) { let e57 = 0; for (let r86, n45, i26 = 0, s18 = t45.length, o88 = s18 - 1; i26 < s18; o88 = i26++) r86 = t45[i26], n45 = t45[o88], e57 += (n45.x - r86.x) * (r86.y + n45.y); return e57; } Iu.types = ["Unknown", "Point", "LineString", "Polygon"]; class ku { constructor(t45, e57) { this.version = 1, this.name = "", this.extent = 4096, this.length = 0, this._pbf = t45, this._keys = [], this._values = [], this._features = [], t45.readFields(zu, this, e57), this.length = this._features.length; } feature(t45) { if (t45 < 0 || t45 >= this._features.length) throw new Error("feature index out of bounds"); this._pbf.pos = this._features[t45]; const e57 = this._pbf.readVarint() + this._pbf.pos; return new Iu(this._pbf, e57, this.extent, this._keys, this._values); } } function zu(t45, e57, r86) { 15 === t45 ? e57.version = r86.readVarint() : 1 === t45 ? e57.name = r86.readString() : 5 === t45 ? e57.extent = r86.readVarint() : 2 === t45 ? e57._features.push(r86.pos) : 3 === t45 ? e57._keys.push(r86.readString()) : 4 === t45 && e57._values.push((function(t46) { let e58 = null; const r87 = t46.readVarint() + t46.pos; for (; t46.pos < r87; ) { const r88 = t46.readVarint() >> 3; e58 = 1 === r88 ? t46.readString() : 2 === r88 ? t46.readFloat() : 3 === r88 ? t46.readDouble() : 4 === r88 ? t46.readVarint64() : 5 === r88 ? t46.readVarint() : 6 === r88 ? t46.readSVarint() : 7 === r88 ? t46.readBoolean() : null; } if (null == e58) throw new Error("unknown feature value"); return e58; })(r86)); } class Eu { constructor(t45, e57) { this.layers = t45.readFields(Tu, {}, e57); } } function Tu(t45, e57, r86) { if (3 === t45) { const t46 = new ku(r86, r86.readVarint() + r86.pos); t46.length && (e57[t46.name] = t46); } } const Bu = "3d_elevation_id", Vu = "level"; class Fu { constructor() { this._valid = false; } reset(t45) { return this.feature = t45, this._valid = true, this._geometry = t45.loadGeometry(), 0 !== this._geometry.length && 0 !== this._geometry[0].length || (this._valid = false), this; } geometry(t45, e57) { return this._valid && t45(e57(this._geometry)), this; } require(t45, e57, r86) { return this.get(t45, true, e57, r86); } optional(t45, e57, r86) { return this.get(t45, false, e57, r86); } success() { return this._valid; } get(t45, e57, r86, n45) { const i26 = this.feature.properties.hasOwnProperty(t45) ? +this.feature.properties[t45] : void 0; return this._valid && void 0 !== i26 && !Number.isNaN(i26) ? r86(n45 ? n45(i26) : i26) : e57 && (this._valid = false), this; } } class Cu { constructor(t45, e57) { this.featureFunc = t45, this.vertexFunc = e57; } parseFeature(t45, e57, r86) { return this.featureFunc(t45, e57, r86); } parseVertex(t45, e57, r86) { return this.vertexFunc(t45, e57, r86); } } const Du = new Cu(((t45, e57, r86) => t45.reset(e57).require(Bu, ((t46) => { r86.id = t46; })).optional("fixed_height_relative", ((t46) => { r86.constantHeight = t46; }), Lu.decodeRelativeHeight).geometry(((t46) => { r86.bounds = t46; }), mn).success()), ((t45, e57, r86) => t45.reset(e57).require(Bu, ((t46) => { r86.id = t46; })).require("elevation_idx", ((t46) => { r86.idx = t46; })).require("extent", ((t46) => { r86.extent = t46; })).require("height_relative", ((t46) => { r86.height = t46; }), Lu.decodeRelativeHeight).geometry(((t46) => { r86.position = t46; }), Lu.getPoint).success())), Ru = new Cu(((t45, e57, r86) => t45.reset(e57).require(Bu, ((t46) => { r86.id = t46; })).optional("fixed_height", ((t46) => { r86.constantHeight = t46; }), Lu.decodeMetricHeight).geometry(((t46) => { r86.bounds = t46; }), mn).success()), ((t45, e57, r86) => t45.reset(e57).require(Bu, ((t46) => { r86.id = t46; })).require("elevation_idx", ((t46) => { r86.idx = t46; })).require("extent", ((t46) => { r86.extent = t46; })).require("height", ((t46) => { r86.height = t46; }), Lu.decodeMetricHeight).geometry(((t46) => { r86.position = t46; }), Lu.getPoint).success())); class Lu { static getPoint(t45) { return at2(t45[0][0].x, t45[0][0].y); } static decodeRelativeHeight(t45) { return 1e-4 * t45 * 5; } static decodeMetricHeight(t45) { return 1e-4 * t45; } static getVersionSchema(t45) { return t45 ? "1.0.1" === t45 ? Ru : void 0 : Du; } static parse(t45) { const e57 = [], r86 = [], n45 = t45.length, i26 = new Fu(); for (let s18 = 0; s18 < n45; s18++) { const n46 = t45.feature(s18), o88 = n46.properties.version, a46 = Lu.getVersionSchema(o88); if (void 0 === a46) { Gt(`Unknown elevation feature version number ${o88 || "(unknown)"}`); continue; } const l21 = n46.properties.type; if (!l21) continue; const u12 = Iu.types[n46.type]; if ("Point" === u12 && "curve_point" === l21) { const t46 = {}; a46.parseVertex(i26, n46, t46) && e57.push(t46); } else if ("Polygon" === u12 && "curve_meta" === l21) { const t46 = {}; a46.parseFeature(i26, n46, t46) && r86.push(t46); } } return { vertices: e57, features: r86 }; } } class Ou { constructor(t45, e57) { this.pos = t45, this.dir = e57; } intersectsPlane(t45, e57, r86) { const n45 = ft(e57, this.dir); if (Math.abs(n45) < 1e-6) return false; const i26 = ((t45[0] - this.pos[0]) * e57[0] + (t45[1] - this.pos[1]) * e57[1]) / n45; return r86[0] = this.pos[0] + this.dir[0] * i26, r86[1] = this.pos[1] + this.dir[1] * i26, true; } } class Uu { constructor(t45, e57) { this.pos = t45, this.dir = e57; } intersectsPlane(t45, e57, r86) { const n45 = D4(e57, this.dir); if (Math.abs(n45) < 1e-6) return false; const i26 = ((t45[0] - this.pos[0]) * e57[0] + (t45[1] - this.pos[1]) * e57[1] + (t45[2] - this.pos[2]) * e57[2]) / n45; return r86[0] = this.pos[0] + this.dir[0] * i26, r86[1] = this.pos[1] + this.dir[1] * i26, r86[2] = this.pos[2] + this.dir[2] * i26, true; } closestPointOnSphere(t45, r86, n45) { if ((function(t46, r87) { var n46 = t46[0], i27 = t46[1], s19 = t46[2], o89 = r87[0], a47 = r87[1], l22 = r87[2]; return Math.abs(n46 - o89) <= e56 * Math.max(1, Math.abs(n46), Math.abs(o89)) && Math.abs(i27 - a47) <= e56 * Math.max(1, Math.abs(i27), Math.abs(a47)) && Math.abs(s19 - l22) <= e56 * Math.max(1, Math.abs(s19), Math.abs(l22)); })(this.pos, t45) || 0 === r86) return n45[0] = n45[1] = n45[2] = 0, false; const [i26, s18, o88] = this.dir, a46 = this.pos[0] - t45[0], l21 = this.pos[1] - t45[1], u12 = this.pos[2] - t45[2], c28 = i26 * i26 + s18 * s18 + o88 * o88, h8 = 2 * (a46 * i26 + l21 * s18 + u12 * o88), p9 = h8 * h8 - 4 * c28 * (a46 * a46 + l21 * l21 + u12 * u12 - r86 * r86); if (p9 < 0) { const t46 = Math.max(-h8 / 2, 0), e57 = a46 + i26 * t46, c29 = l21 + s18 * t46, p10 = u12 + o88 * t46, d34 = Math.hypot(e57, c29, p10); return n45[0] = e57 * r86 / d34, n45[1] = c29 * r86 / d34, n45[2] = p10 * r86 / d34, false; } { const t46 = (-h8 - Math.sqrt(p9)) / (2 * c28); if (t46 < 0) { const t47 = Math.hypot(a46, l21, u12); return n45[0] = a46 * r86 / t47, n45[1] = l21 * r86 / t47, n45[2] = u12 * r86 / t47, false; } return n45[0] = a46 + i26 * t46, n45[1] = l21 + s18 * t46, n45[2] = u12 + o88 * t46, true; } } } class Nu { constructor(t45, e57, r86, n45, i26) { this.TL = t45, this.TR = e57, this.BR = r86, this.BL = n45, this.horizon = i26; } static fromInvProjectionMatrix(t45, e57, r86) { const n45 = [-1, 1, 1], i26 = [1, 1, 1], s18 = [1, -1, 1], o88 = [-1, -1, 1], a46 = O3(n45, n45, t45), l21 = O3(i26, i26, t45), u12 = O3(s18, s18, t45), c28 = O3(o88, o88, t45); return new Nu(a46, l21, u12, c28, e57 / r86); } } function ju(t45, e57, r86) { let n45 = 1 / 0, i26 = -1 / 0; const s18 = []; for (const o88 of t45) { G4(s18, o88, e57); const t46 = D4(s18, r86); n45 = Math.min(n45, t46), i26 = Math.max(i26, t46); } return [n45, i26]; } function $u(t45, e57) { let r86 = true; for (let n45 = 0; n45 < t45.planes.length; n45++) { const i26 = t45.planes[n45]; let s18 = 0; for (let t46 = 0; t46 < e57.length; t46++) s18 += +(D4(i26, e57[t46]) + i26[3] >= 0); if (0 === s18) return 0; s18 !== e57.length && (r86 = false); } return r86 ? 2 : 1; } function Gu(t45, e57) { for (const r86 of t45.projections) { const n45 = ju(e57, t45.points[0], r86.axis); if (r86.projection[1] < n45[0] || r86.projection[0] > n45[1]) return 0; } return 1; } function Hu(t45, e57) { let r86 = 0; const n45 = [0, 0, 0, 0]; for (let o88 = 0; o88 < t45.length; o88++) n45[0] = t45[o88][0], n45[1] = t45[o88][1], n45[2] = t45[o88][2], n45[3] = 1, (i26 = n45)[0] * (s18 = e57)[0] + i26[1] * s18[1] + i26[2] * s18[2] + i26[3] * s18[3] >= 0 && r86++; var i26, s18; return r86; } class qu { constructor(t45, e57) { this.points = t45 || new Array(8).fill([0, 0, 0]), this.planes = e57 || new Array(6).fill([0, 0, 0, 0]), this.bounds = Xu.fromPoints(this.points), this.projections = [], this.frustumEdges = [G4([], this.points[2], this.points[3]), G4([], this.points[0], this.points[3]), G4([], this.points[4], this.points[0]), G4([], this.points[5], this.points[1]), G4([], this.points[6], this.points[2]), G4([], this.points[7], this.points[3])]; for (const t46 of this.frustumEdges) { const e58 = [0, -t46[2], t46[1]], r86 = [t46[2], 0, -t46[0]]; this.projections.push({ axis: e58, projection: ju(this.points, this.points[0], e58) }), this.projections.push({ axis: r86, projection: ju(this.points, this.points[0], r86) }); } } static fromInvProjectionMatrix(t45, e57, r86, n45) { const i26 = Math.pow(2, r86), s18 = [[-1, 1, -1, 1], [1, 1, -1, 1], [1, -1, -1, 1], [-1, -1, -1, 1], [-1, 1, 1, 1], [1, 1, 1, 1], [1, -1, 1, 1], [-1, -1, 1, 1]].map(((r87) => { const s19 = Y5([], r87, t45), o89 = 1 / s19[3] / e57 * i26; return (a47 = s19)[0] = (l21 = s19)[0] * (u12 = [o89, o89, n45 ? 1 / s19[3] : o89, o89])[0], a47[1] = l21[1] * u12[1], a47[2] = l21[2] * u12[2], a47[3] = l21[3] * u12[3], a47; var a47, l21, u12; })), o88 = [[0, 1, 2], [6, 5, 4], [0, 3, 7], [2, 1, 5], [3, 2, 6], [0, 4, 5]].map(((t46) => { const e58 = C5([], R4([], G4([], s18[t46[0]], s18[t46[1]]), G4([], s18[t46[2]], s18[t46[1]]))), r87 = -D4(e58, s18[t46[1]]); return e58.concat(r87); })), a46 = []; for (let t46 = 0; t46 < s18.length; t46++) a46.push([s18[t46][0], s18[t46][1], s18[t46][2]]); return new qu(a46, o88); } intersectsPrecise(t45, e57, r86) { for (let r87 = 0; r87 < e57.length; r87++) if (!Hu(t45, e57[r87])) return 0; for (let e58 = 0; e58 < this.planes.length; e58++) if (!Hu(t45, this.planes[e58])) return 0; for (const e58 of r86) for (const r87 of this.frustumEdges) { const n45 = R4([], e58, r87), i26 = _3(n45); if (0 === i26) continue; E4(n45, n45, 1 / i26); const s18 = ju(this.points, this.points[0], n45), o88 = ju(t45, this.points[0], n45); if (s18[0] > o88[1] || o88[0] > s18[1]) return 0; } return 1; } containsPoint(t45) { for (const e57 of this.planes) { const r86 = e57[3]; if (D4([e57[0], e57[1], e57[2]], t45) + r86 < 0) return false; } return true; } } class Xu { static fromPoints(t45) { const e57 = [1 / 0, 1 / 0, 1 / 0], r86 = [-1 / 0, -1 / 0, -1 / 0]; for (const n45 of t45) k6(e57, e57, n45), z3(r86, r86, n45); return new Xu(e57, r86); } static fromTileIdAndHeight(t45, e57, r86) { const n45 = 1 << t45.canonical.z, i26 = t45.canonical.x, s18 = t45.canonical.y; return new Xu([i26 / n45, s18 / n45, e57], [(i26 + 1) / n45, (s18 + 1) / n45, r86]); } static applyTransform(t45, e57) { const r86 = t45.getCorners(); for (let t46 = 0; t46 < r86.length; ++t46) O3(r86[t46], r86[t46], e57); return Xu.fromPoints(r86); } static applyTransformFast(t45, e57) { const r86 = [e57[12], e57[13], e57[14]], n45 = [...r86]; for (let i26 = 0; i26 < 3; i26++) for (let s18 = 0; s18 < 3; s18++) { const o88 = e57[4 * s18 + i26], a46 = o88 * t45.min[s18], l21 = o88 * t45.max[s18]; r86[i26] += Math.min(a46, l21), n45[i26] += Math.max(a46, l21); } return new Xu(r86, n45); } static projectAabbCorners(t45, e57) { const r86 = t45.getCorners(); for (let t46 = 0; t46 < r86.length; ++t46) O3(r86[t46], r86[t46], e57); return r86; } constructor(t45, e57) { this.min = t45, this.max = e57, this.center = E4([], I3([], this.min, this.max), 0.5); } quadrant(t45) { const e57 = [t45 % 2 == 0, t45 < 2], r86 = w3(this.min), n45 = w3(this.max); for (let t46 = 0; t46 < e57.length; t46++) r86[t46] = e57[t46] ? this.min[t46] : this.center[t46], n45[t46] = e57[t46] ? this.center[t46] : this.max[t46]; return n45[2] = this.max[2], new Xu(r86, n45); } distanceX(t45) { return Math.max(Math.min(this.max[0], t45[0]), this.min[0]) - t45[0]; } distanceY(t45) { return Math.max(Math.min(this.max[1], t45[1]), this.min[1]) - t45[1]; } distanceZ(t45) { return Math.max(Math.min(this.max[2], t45[2]), this.min[2]) - t45[2]; } getCorners() { const t45 = this.min, e57 = this.max; return [[t45[0], t45[1], t45[2]], [e57[0], t45[1], t45[2]], [e57[0], e57[1], t45[2]], [t45[0], e57[1], t45[2]], [t45[0], t45[1], e57[2]], [e57[0], t45[1], e57[2]], [e57[0], e57[1], e57[2]], [t45[0], e57[1], e57[2]]]; } intersects(t45) { return this.intersectsAabb(t45.bounds) ? $u(t45, this.getCorners()) : 0; } intersectsFlat(t45) { return this.intersectsAabb(t45.bounds) ? $u(t45, [[this.min[0], this.min[1], 0], [this.max[0], this.min[1], 0], [this.max[0], this.max[1], 0], [this.min[0], this.max[1], 0]]) : 0; } intersectsPrecise(t45, e57) { return e57 || this.intersects(t45) ? Gu(t45, this.getCorners()) : 0; } intersectsPreciseFlat(t45, e57) { return e57 || this.intersectsFlat(t45) ? Gu(t45, [[this.min[0], this.min[1], 0], [this.max[0], this.min[1], 0], [this.max[0], this.max[1], 0], [this.min[0], this.max[1], 0]]) : 0; } intersectsAabb(t45) { for (let e57 = 0; e57 < 3; ++e57) if (this.min[e57] > t45.max[e57] || t45.min[e57] > this.max[e57]) return false; return true; } intersectsAabbXY(t45) { return !(this.min[0] > t45.max[0] || t45.min[0] > this.max[0] || this.min[1] > t45.max[1] || t45.min[1] > this.max[1]); } encapsulate(t45) { for (let e57 = 0; e57 < 3; e57++) this.min[e57] = Math.min(this.min[e57], t45.min[e57]), this.max[e57] = Math.max(this.max[e57], t45.max[e57]); } encapsulatePoint(t45) { for (let e57 = 0; e57 < 3; e57++) this.min[e57] = Math.min(this.min[e57], t45[e57]), this.max[e57] = Math.max(this.max[e57], t45[e57]); } closestPoint(t45) { return [Math.max(Math.min(this.max[0], t45[0]), this.min[0]), Math.max(Math.min(this.max[1], t45[1]), this.min[1]), Math.max(Math.min(this.max[2], t45[2]), this.min[2])]; } } Ws(Xu, "Aabb"); class Zu { constructor(t45, e57) { this.feature = t45, this.metersToTile = e57, this.index = 0; } get() { const t45 = this.feature.vertices[this.index], e57 = this.feature.vertexProps[this.index].dir, r86 = e57[1], n45 = -e57[0], i26 = (t45.extent + 1) * this.metersToTile; return [new wt(Math.trunc(t45.position[0] + r86 * i26), Math.trunc(t45.position[1] + n45 * i26)), new wt(Math.trunc(t45.position[0] - r86 * i26), Math.trunc(t45.position[1] - n45 * i26))]; } next() { this.index++; } valid() { return this.index < this.feature.vertices.length; } } class Wu { constructor(t45, e57, r86, n45, i26, s18) { if (this.vertices = new Array(), this.vertexProps = new Array(), this.edges = new Array(), this.edgeProps = new Array(), this._tmpVec2 = [ot(), ot(), ot(), ot(), ot(), ot(), ot()], this.id = t45, this.heightRange = { min: r86, max: r86 }, this.safeArea = e57, this.constantHeight = r86, null == this.constantHeight && (null != this.constantHeight || 0 !== n45.length)) { this.vertices = n45, this.edges = i26, this.edges = this.edges.filter(((t46) => { return t46.a < this.vertices.length && t46.b < this.vertices.length && !((e58 = this.vertices[t46.a].position)[0] === (r87 = this.vertices[t46.b].position)[0] && e58[1] === r87[1]); var e58, r87; })), this.heightRange = { min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY }; for (const t46 of this.vertices) this.vertexProps.push({ dir: at2(0, 0) }), this.heightRange.min = Math.min(this.heightRange.min, t46.height), this.heightRange.max = Math.max(this.heightRange.max, t46.height); for (const t46 of this.edges) { const e58 = this.vertices[t46.a].position, r87 = this.vertices[t46.b].position, n46 = ct(ot(), r87, e58), i27 = pt(n46), s19 = ht2(ot(), n46, 1 / i27); this.edgeProps.push({ vec: n46, dir: s19, len: i27 }); const o88 = this.vertexProps[t46.a].dir, a46 = this.vertexProps[t46.b].dir; ut2(o88, o88, s19), ut2(a46, a46, s19); } for (const t46 of this.vertexProps) 0 === t46.dir[0] && 0 === t46.dir[1] || dt3(t46.dir, t46.dir); this.tessellate(s18); } } pointElevation(t45) { if (null != this.constantHeight) return this.constantHeight; const e57 = this.getClosestEdge(t45); if (null == e57) return 0; const [r86, n45] = e57; return ur(this.vertices[this.edges[r86].a].height, this.vertices[this.edges[r86].b].height, n45); } computeSlopeNormal(t45, e57) { const r86 = this.getClosestEdge(t45); if (!r86) return A3(0, 0, 1); const n45 = r86[0], i26 = this.edges[n45], s18 = this.edgeProps[n45].vec, o88 = A3(s18[0], s18[1], (this.vertices[i26.b].height - this.vertices[i26.a].height) * e57), a46 = A3(o88[1], -o88[0], 0); R4(a46, a46, o88); const l21 = _3(a46); return l21 > 0 ? E4(a46, a46, 1 / l21) : M4(a46, 0, 0, 1); } getSafeArea() { return this.safeArea; } isTunnel() { return this.heightRange.max <= -5; } getClosestEdge(t45) { if (0 === this.edges.length) return; let e57 = 0, r86 = Number.POSITIVE_INFINITY, n45 = 0; const [i26, s18, o88, a46, l21, u12, c28] = this._tmpVec2; lt(c28, t45.x, t45.y); const h8 = new Ou(c28, null); for (let t46 = 0; t46 < this.edges.length; t46++) { const p9 = this.edges[t46], d34 = this.edgeProps[t46].dir; h8.dir = d34; const f8 = this.vertices[p9.a].position, m6 = this.vertices[p9.b].position, y4 = h8.intersectsPlane(f8, this.vertexProps[p9.a].dir, i26), g9 = h8.intersectsPlane(m6, this.vertexProps[p9.b].dir, s18); if (!y4 || !g9) continue; ct(o88, s18, i26), ct(a46, c28, i26); const x4 = ft(o88, o88), v8 = x4 > 0 ? ft(a46, o88) / x4 : 0, b8 = Tt2(v8, 0, 1), w4 = Math.abs((v8 - b8) * this.edgeProps[t46].len); ct(l21, c28, f8), lt(u12, d34[1], -d34[0]); const _4 = w4 + Math.abs(ft(l21, u12)); _4 < r86 && (e57 = t46, r86 = _4, n45 = b8); } return [e57, n45]; } tessellate(t45) { const e57 = b7(), r86 = b7(), n45 = b7(), i26 = b7(); for (let s18 = this.edges.length - 1; s18 >= 0; --s18) { const o88 = this.edges[s18].a, a46 = this.edges[s18].b, { position: l21, height: u12, extent: c28 } = this.vertices[o88], { position: h8, height: p9, extent: d34 } = this.vertices[a46], f8 = this.vertexProps[o88].dir, m6 = this.vertexProps[a46].dir; if (M4(e57, l21[0] / t45, l21[1] / t45, u12), M4(r86, h8[0] / t45, h8[1] / t45, p9), M4(n45, f8[1], -f8[0], 0), E4(n45, n45, c28), M4(i26, m6[1], -m6[0], 0), E4(i26, i26, d34), this.distSqLines(A3(e57[0] + 0.5 * n45[0], e57[1] + 0.5 * n45[1], e57[2] + 0.5 * n45[2]), A3(r86[0] - 0.5 * i26[0], r86[1] - 0.5 * i26[1], r86[2] - 0.5 * i26[2]), A3(e57[0] - 0.5 * n45[0], e57[1] - 0.5 * n45[1], e57[2] - 0.5 * n45[2]), A3(r86[0] + 0.5 * i26[0], r86[1] + 0.5 * i26[1], r86[2] + 0.5 * i26[2])) <= 0.0025000000000000005) continue; const y4 = this.vertices.length, g9 = ut2(ot(), l21, h8); this.vertices.push({ position: ht2(g9, g9, 0.5), height: 0.5 * (u12 + p9), extent: 0.5 * (c28 + d34) }); const x4 = ut2(ot(), f8, m6); this.vertexProps.push({ dir: dt3(x4, x4) }), this.edges.splice(s18, 1), this.edgeProps.splice(s18, 1), this.edges.push({ a: o88, b: y4 }), this.edges.push({ a: y4, b: a46 }); const v8 = ct(ot(), this.vertices[y4].position, l21), b8 = pt(v8), w4 = { vec: v8, dir: ht2(ot(), v8, 1 / b8), len: b8 }; this.edgeProps.push(w4), this.edgeProps.push(w4); } } distSqLines(t45, e57, r86, n45) { const i26 = S4(b7(), e57, t45), s18 = S4(b7(), n45, r86), o88 = S4(b7(), t45, r86), a46 = D4(i26, i26), l21 = D4(i26, s18), u12 = D4(i26, o88), c28 = D4(s18, s18), h8 = D4(s18, o88), p9 = a46 * c28 - l21 * l21; if (0 === p9) return B5(L2(i26, r86, n45, D4(o88, s18) / D4(s18, s18)), t45); const d34 = (a46 * h8 - l21 * u12) / p9; return B5(L2(i26, t45, e57, (l21 * h8 - u12 * c28) / p9), L2(s18, r86, n45, d34)); } } class Yu { static parseFrom(t45, e57) { const r86 = Lu.parse(t45); if (!r86) return []; let { vertices: n45, features: i26 } = r86; const s18 = 1 / fu(e57); i26.sort(((t46, e58) => t46.id - e58.id)), n45.sort(((t46, e58) => t46.id - e58.id || t46.idx - e58.idx)), n45 = n45.filter(((t46, e58, r87) => e58 === r87.findIndex(((e59) => e59.id === t46.id && e59.idx === t46.idx)))); const o88 = new Array(); let a46 = 0; const l21 = n45.length; for (const t46 of i26) { if (t46.constantHeight) { o88.push(new Wu(t46.id, t46.bounds, t46.constantHeight)); continue; } for (; a46 !== l21 && n45[a46].id < t46.id; ) a46++; if (a46 === l21 || n45[a46].id !== t46.id) continue; const e58 = new Array(), r87 = new Array(), i27 = a46; for (; a46 !== l21 && n45[a46].id === t46.id; ) { const t47 = n45[a46]; if (e58.push({ position: t47.position, height: t47.height, extent: t47.extent }), a46 !== i27 && n45[a46 - 1].idx === t47.idx - 1) { const t48 = a46 - i27; r87.push({ a: t48 - 1, b: t48 }); } a46++; } o88.push(new Wu(t46.id, t46.bounds, void 0, e58, r87, s18)); } return o88; } static getElevationFeature(t45, e57) { if (!e57) return; const r86 = +t45.properties[Bu]; return Number.isNaN(r86) ? void 0 : e57.find(((t46) => t46.id === r86)); } } class Ku { constructor(t45, e57) { this.zScale = 1, this.xOffset = 0, this.yOffset = 0, t45.equals(e57) || (this.zScale = Math.pow(2, e57.z - t45.z), this.xOffset = (t45.x * this.zScale - e57.x) * Rn, this.yOffset = (t45.y * this.zScale - e57.y) * Rn); } constantElevation(t45, e57) { if (null != t45.constantHeight) return this.computeBiasedHeight(t45.constantHeight, e57); } pointElevation(t45, e57, r86) { const n45 = this.constantElevation(e57, r86); return null != n45 ? n45 : (t45.x = t45.x * this.zScale + this.xOffset, t45.y = t45.y * this.zScale + this.yOffset, this.computeBiasedHeight(e57.pointElevation(t45), r86)); } computeBiasedHeight(t45, e57) { return e57 <= 0 ? t45 : t45 + e57 * Bt(0, e57, t45 >= 0 ? t45 : Math.abs(0.5 * t45)); } } Ws(Wu, "ElevationFeature"); class Ju { constructor(t45) { this.zoom = t45.zoom, this.overscaling = t45.overscaling, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.hasPattern = false, this.projection = t45.projection, this.layoutVertexArray = new ua(), this.indexArray = new Ea(), this.segments = new al(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.elevationMode = this.layers[0].layout.get("circle-elevation-reference"), this.hasElevation = false, "none" !== this.elevationMode && (this.elevatedLayoutVertexArray = new pa()), this.worldview = t45.worldview; } updateFootprints(t45, e57) { } populate(t45, e57, r86, n45) { const i26 = this.layers[0], s18 = []; let o88 = null; "circle" === i26.type && (o88 = i26.layout.get("circle-sort-key")); for (const { feature: e58, id: i27, index: a47, sourceLayerIndex: l21 } of t45) { const t46 = this.layers[0]._featureFilter.needGeometry, u12 = Mu(e58, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), u12, r86)) continue; const c28 = o88 ? o88.evaluate(u12, {}, r86) : void 0, h8 = { id: i27, properties: e58.properties, type: e58.type, sourceLayerIndex: l21, index: a47, geometry: t46 ? u12.geometry : Au(e58, r86, n45), patterns: {}, sortKey: c28 }; s18.push(h8); } o88 && s18.sort(((t46, e58) => t46.sortKey - e58.sortKey)); let a46 = null; "globe" === n45.projection.name && (this.globeExtVertexArray = new ba(), a46 = n45.projection); for (const n46 of s18) { const { geometry: i27, index: s19, sourceLayerIndex: o89 } = n46, l21 = t45[s19].feature; this.addFeature(n46, i27, s19, e57.availableImages, r86, a46, e57.brightness, e57.elevationFeatures), e57.featureIndex.insert(l21, i27, s19, o89, this.index); } this.hasElevation || (this.elevatedLayoutVertexArray = void 0); } update(t45, e57, r86, n45, i26, s18, o88) { this.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, this.worldview); } isEmpty() { return 0 === this.layoutVertexArray.length; } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload; } upload(t45) { this.uploaded || (this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, il.members), this.indexBuffer = t45.createIndexBuffer(this.indexArray), this.globeExtVertexArray && (this.globeExtVertexBuffer = t45.createVertexBuffer(this.globeExtVertexArray, ol.members)), this.elevatedLayoutVertexArray && (this.elevatedLayoutVertexBuffer = t45.createVertexBuffer(this.elevatedLayoutVertexArray, sl.members))), this.programConfigurations.upload(t45), this.uploaded = true; } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy(), this.elevatedLayoutVertexBuffer && this.elevatedLayoutVertexBuffer.destroy()); } addFeature(t45, e57, r86, n45, i26, s18, o88, a46) { let l21; "none" !== this.elevationMode && (l21 = Yu.getElevationFeature(t45, a46)); for (const r87 of e57) for (const e58 of r87) { const r88 = e58.x, n46 = e58.y; if (r88 < 0 || r88 >= Rn || n46 < 0 || n46 >= Rn) continue; if (s18) { const t46 = s18.projectTilePoint(r88, n46, i26), e59 = s18.upVector(i26, r88, n46); this.addGlobeExtVertex(t46, e59), this.addGlobeExtVertex(t46, e59), this.addGlobeExtVertex(t46, e59), this.addGlobeExtVertex(t46, e59); } const o89 = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, t45.sortKey), a47 = o89.vertexLength; if (this.addCircleVertex(r88, n46, -1, -1), this.addCircleVertex(r88, n46, 1, -1), this.addCircleVertex(r88, n46, 1, 1), this.addCircleVertex(r88, n46, -1, 1), "none" !== this.elevationMode) { const t46 = l21 ? l21.pointElevation(new wt(r88, n46)) : 0; this.hasElevation = this.hasElevation || 0 !== t46; for (let e59 = 0; e59 < 4; e59++) this.elevatedLayoutVertexArray.emplaceBack(t46); } this.indexArray.emplaceBack(a47, a47 + 1, a47 + 2), this.indexArray.emplaceBack(a47, a47 + 2, a47 + 3), o89.vertexLength += 4, o89.primitiveLength += 2; } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t45, r86, {}, n45, i26, o88, void 0, this.worldview); } addCircleVertex(t45, e57, r86, n45) { this.layoutVertexArray.emplaceBack(2 * t45 + (r86 + 1) / 2, 2 * e57 + (n45 + 1) / 2); } addGlobeExtVertex(t45, e57) { const r86 = 16384; this.globeExtVertexArray.emplaceBack(t45.x, t45.y, t45.z, e57[0] * r86, e57[1] * r86, e57[2] * r86); } } function Qu(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) if (cc2(e57, t45[r86])) return true; for (let r86 = 0; r86 < e57.length; r86++) if (cc2(t45, e57[r86])) return true; return !!nc(t45, e57); } function tc(t45, e57, r86) { return !!cc2(t45, e57) || !!ac2(e57, t45, r86); } function ec(t45, e57) { if (1 === t45.length) return uc(e57, t45[0]); for (let r86 = 0; r86 < e57.length; r86++) { const n45 = e57[r86]; for (let e58 = 0; e58 < n45.length; e58++) if (cc2(t45, n45[e58])) return true; } for (let r86 = 0; r86 < t45.length; r86++) if (uc(e57, t45[r86])) return true; for (let r86 = 0; r86 < e57.length; r86++) if (nc(t45, e57[r86])) return true; return false; } function rc(t45, e57, r86) { if (t45.length > 1) { if (nc(t45, e57)) return true; for (let n45 = 0; n45 < e57.length; n45++) if (ac2(e57[n45], t45, r86)) return true; } for (let n45 = 0; n45 < t45.length; n45++) if (ac2(t45[n45], e57, r86)) return true; return false; } function nc(t45, e57) { if (0 === t45.length || 0 === e57.length) return false; for (let r86 = 0; r86 < t45.length - 1; r86++) { const n45 = t45[r86], i26 = t45[r86 + 1]; for (let t46 = 0; t46 < e57.length - 1; t46++) if (ic(n45, i26, e57[t46], e57[t46 + 1])) return true; } return false; } function ic(t45, e57, r86, n45) { return Ht2(t45, r86, n45) !== Ht2(e57, r86, n45) && Ht2(t45, e57, r86) !== Ht2(t45, e57, n45); } function sc(t45, e57, r86) { return (t45.x - r86.x) * (e57.y - r86.y) - (t45.y - r86.y) * (e57.x - r86.x); } function oc(t45, e57, r86, n45) { const i26 = sc(t45, e57, n45), s18 = sc(t45, e57, r86); if (Math.sign(i26) === Math.sign(s18)) return; const o88 = sc(r86, n45, t45), a46 = o88 + s18 - i26; return Math.sign(o88) !== Math.sign(a46) ? [o88 / (o88 - a46), s18 / (s18 - i26)] : void 0; } function ac2(t45, e57, r86) { const n45 = r86 * r86; if (1 === e57.length) return t45.distSqr(e57[0]) < n45; for (let r87 = 1; r87 < e57.length; r87++) if (lc(t45, e57[r87 - 1], e57[r87]) < n45) return true; return false; } function lc(t45, e57, r86) { const n45 = e57.distSqr(r86); if (0 === n45) return t45.distSqr(e57); const i26 = ((t45.x - e57.x) * (r86.x - e57.x) + (t45.y - e57.y) * (r86.y - e57.y)) / n45; return t45.distSqr(i26 < 0 ? e57 : i26 > 1 ? r86 : r86.sub(e57)._mult(i26)._add(e57)); } function uc(t45, e57) { let r86, n45, i26, s18 = false; for (let o88 = 0; o88 < t45.length; o88++) { r86 = t45[o88]; for (let t46 = 0, o89 = r86.length - 1; t46 < r86.length; o89 = t46++) n45 = r86[t46], i26 = r86[o89], n45.y > e57.y != i26.y > e57.y && e57.x < (i26.x - n45.x) * (e57.y - n45.y) / (i26.y - n45.y) + n45.x && (s18 = !s18); } return s18; } function cc2(t45, e57) { let r86 = false; for (let n45 = 0, i26 = t45.length - 1; n45 < t45.length; i26 = n45++) { const s18 = t45[n45], o88 = t45[i26]; s18.y > e57.y != o88.y > e57.y && e57.x < (o88.x - s18.x) * (e57.y - s18.y) / (o88.y - s18.y) + s18.x && (r86 = !r86); } return r86; } function hc(t45, e57, r86, n45, i26) { for (const s19 of t45) if (e57 <= s19.x && r86 <= s19.y && n45 >= s19.x && i26 >= s19.y) return true; const s18 = [new wt(e57, r86), new wt(e57, i26), new wt(n45, i26), new wt(n45, r86)]; if (t45.length > 2) { for (const e58 of s18) if (cc2(t45, e58)) return true; } for (let e58 = 0; e58 < t45.length - 1; e58++) if (pc(t45[e58], t45[e58 + 1], s18)) return true; return false; } function pc(t45, e57, r86) { const n45 = r86[0], i26 = r86[2]; if (t45.x < n45.x && e57.x < n45.x || t45.x > i26.x && e57.x > i26.x || t45.y < n45.y && e57.y < n45.y || t45.y > i26.y && e57.y > i26.y) return false; const s18 = Ht2(t45, e57, r86[0]); return s18 !== Ht2(t45, e57, r86[1]) || s18 !== Ht2(t45, e57, r86[2]) || s18 !== Ht2(t45, e57, r86[3]); } function dc(t45, e57, r86, n45, i26, s18) { let o88 = e57.y - t45.y, a46 = t45.x - e57.x; if (s18 = s18 || 0) { const t46 = o88 * o88 + a46 * a46; if (0 === t46) return true; const e58 = Math.sqrt(t46); o88 /= e58, a46 /= e58; } return !((r86.x - t45.x) * o88 + (r86.y - t45.y) * a46 - s18 < 0 || (n45.x - t45.x) * o88 + (n45.y - t45.y) * a46 - s18 < 0 || (i26.x - t45.x) * o88 + (i26.y - t45.y) * a46 - s18 < 0); } function fc(t45, e57, r86, n45, i26, s18, o88) { return !(dc(t45, e57, n45, i26, s18, o88) || dc(e57, r86, n45, i26, s18, o88) || dc(r86, t45, n45, i26, s18, o88) || dc(n45, i26, t45, e57, r86, o88) || dc(i26, s18, t45, e57, r86, o88) || dc(s18, n45, t45, e57, r86, o88)); } function mc(t45, e57, r86) { const n45 = e57.paint.get(t45).value; return "constant" === n45.kind ? n45.value : r86.programConfigurations.get(e57.id).getMaxValue(t45); } function yc(t45) { return Math.sqrt(t45[0] * t45[0] + t45[1] * t45[1]); } function gc(t45, e57, r86, n45, i26) { if (!e57[0] && !e57[1]) return t45; const s18 = wt.convert(e57)._mult(i26); "viewport" === r86 && s18._rotate(-n45); const o88 = []; for (let e58 = 0; e58 < t45.length; e58++) o88.push(t45[e58].sub(s18)); return o88; } function xc(t45, e57, r86, n45) { const i26 = wt.convert(t45)._mult(n45); return "viewport" === e57 && i26._rotate(-r86), i26; } let vc, bc4; function wc(t45, e57, r86) { var n45 = 2 * Math.PI * 6378137 / 256 / Math.pow(2, r86); return [t45 * n45 - 2 * Math.PI * 6378137 / 2, e57 * n45 - 2 * Math.PI * 6378137 / 2]; } Ws(Ju, "CircleBucket", { omit: ["layers"] }); class _c61 { constructor(t45, e57, r86) { this.z = t45, this.x = e57, this.y = r86, this.key = Ic(0, t45, t45, e57, r86); } equals(t45) { return this.z === t45.z && this.x === t45.x && this.y === t45.y; } isChildOf(t45) { const e57 = this.z - t45.z; return 0 === t45.z || t45.z < this.z && t45.x === this.x >> e57 && t45.y === this.y >> e57; } url(t45, e57) { const r86 = (function(t46, e58, r87) { var n46 = wc(256 * t46, 256 * (e58 = Math.pow(2, r87) - e58 - 1), r87), i26 = wc(256 * (t46 + 1), 256 * (e58 + 1), r87); return n46[0] + "," + n46[1] + "," + i26[0] + "," + i26[1]; })(this.x, this.y, this.z), n45 = (function(t46, e58, r87) { let n46, i26 = ""; for (let s18 = t46; s18 > 0; s18--) n46 = 1 << s18 - 1, i26 += (e58 & n46 ? 1 : 0) + (r87 & n46 ? 2 : 0); return i26; })(this.z, this.x, this.y); return t45[(this.x + this.y) % t45.length].replace("{prefix}", (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(/{z}/g, String(this.z)).replace(/{x}/g, String(this.x)).replace(/{y}/g, String("tms" === e57 ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace("{quadkey}", n45).replace("{bbox-epsg-3857}", r86); } toString() { return `${this.z}/${this.x}/${this.y}`; } } class Ac { constructor(t45, e57) { this.wrap = t45, this.canonical = e57, this.key = Ic(t45, e57.z, e57.z, e57.x, e57.y); } } class Mc { constructor(t45, e57, r86, n45, i26) { this.overscaledZ = t45, this.wrap = e57, this.canonical = new _c61(r86, +n45, +i26), this.key = 0 === e57 && t45 === r86 ? this.canonical.key : Ic(e57, t45, r86, n45, i26); } equals(t45) { return this.overscaledZ === t45.overscaledZ && this.wrap === t45.wrap && this.canonical.equals(t45.canonical); } scaledTo(t45) { const e57 = this.canonical.z - t45; return t45 > this.canonical.z ? new Mc(t45, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new Mc(t45, this.wrap, t45, this.canonical.x >> e57, this.canonical.y >> e57); } calculateScaledKey(t45, e57 = true) { if (this.overscaledZ === t45 && e57) return this.key; if (t45 > this.canonical.z) return Ic(this.wrap * +e57, t45, this.canonical.z, this.canonical.x, this.canonical.y); { const r86 = this.canonical.z - t45; return Ic(this.wrap * +e57, t45, t45, this.canonical.x >> r86, this.canonical.y >> r86); } } isChildOf(t45) { if (t45.wrap !== this.wrap) return false; const e57 = this.canonical.z - t45.canonical.z; return 0 === t45.overscaledZ || t45.overscaledZ < this.overscaledZ && t45.canonical.z < this.canonical.z && t45.canonical.x === this.canonical.x >> e57 && t45.canonical.y === this.canonical.y >> e57; } children(t45) { if (this.overscaledZ >= t45) return [new Mc(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)]; const e57 = this.canonical.z + 1, r86 = 2 * this.canonical.x, n45 = 2 * this.canonical.y; return [new Mc(e57, this.wrap, e57, r86, n45), new Mc(e57, this.wrap, e57, r86 + 1, n45), new Mc(e57, this.wrap, e57, r86, n45 + 1), new Mc(e57, this.wrap, e57, r86 + 1, n45 + 1)]; } isLessThan(t45) { return this.wrap < t45.wrap || !(this.wrap > t45.wrap) && (this.overscaledZ < t45.overscaledZ || !(this.overscaledZ > t45.overscaledZ) && (this.canonical.x < t45.canonical.x || !(this.canonical.x > t45.canonical.x) && this.canonical.y < t45.canonical.y)); } wrapped() { return new Mc(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y); } unwrapTo(t45) { return new Mc(this.overscaledZ, t45, this.canonical.z, this.canonical.x, this.canonical.y); } overscaleFactor() { return Math.pow(2, this.overscaledZ - this.canonical.z); } toUnwrapped() { return new Ac(this.wrap, this.canonical); } toString() { return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`; } } function Ic(t45, e57, r86, n45, i26) { const s18 = 1 << Math.min(r86, 22); let o88 = s18 * (i26 % s18) + n45 % s18; return t45 && r86 < 22 && (o88 += s18 * s18 * ((t45 < 0 ? -2 * t45 - 1 : 2 * t45) % (1 << 2 * (22 - r86)))), 16 * (32 * o88 + r86) + (e57 - r86); } const Sc = [(t45) => { let e57 = t45.canonical.x - 1, r86 = t45.wrap; return e57 < 0 && (e57 = (1 << t45.canonical.z) - 1, r86--), new Mc(t45.overscaledZ, r86, t45.canonical.z, e57, t45.canonical.y); }, (t45) => { let e57 = t45.canonical.x + 1, r86 = t45.wrap; return e57 === 1 << t45.canonical.z && (e57 = 0, r86++), new Mc(t45.overscaledZ, r86, t45.canonical.z, e57, t45.canonical.y); }, (t45) => new Mc(t45.overscaledZ, t45.wrap, t45.canonical.z, t45.canonical.x, (0 === t45.canonical.y ? 1 << t45.canonical.z : t45.canonical.y) - 1), (t45) => new Mc(t45.overscaledZ, t45.wrap, t45.canonical.z, t45.canonical.x, t45.canonical.y === (1 << t45.canonical.z) - 1 ? 0 : t45.canonical.y + 1)]; Ws(_c61, "CanonicalTileID"), Ws(Mc, "OverscaledTileID", { omit: ["projMatrix", "expandedProjMatrix"] }); const Pc = aa2([{ type: "Float32", name: "a_globe_pos", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }]), { members: kc } = Pc, zc = aa2([{ name: "a_pos_3", components: 3, type: "Int16" }]); var Ec = aa2([{ name: "a_pos", type: "Int16", components: 2 }]); function Tc(t45) { return t45 * Nl / Kl; } const Bc = [new Xu([Xl, Xl, Xl], [Zl, Zl, Zl]), new Xu([Xl, Xl, Xl], [0, 0, Zl]), new Xu([0, Xl, Xl], [Zl, 0, Zl]), new Xu([Xl, 0, Xl], [0, Zl, Zl]), new Xu([0, 0, Xl], [Zl, Zl, Zl])]; function Vc(t45, e57, r86, n45 = true) { const i26 = E4([], t45._camera.position, t45.worldSize), s18 = [e57, r86, 1, 1]; Y5(s18, s18, t45.pixelMatrixInverse), Z2(s18, s18, 1 / s18[3]); const o88 = C5([], G4([], s18, i26)), a46 = t45.globeMatrix, l21 = [a46[12], a46[13], a46[14]], u12 = G4([], l21, i26), c28 = _3(u12), h8 = C5([], u12), p9 = t45.worldSize / (2 * Math.PI), d34 = D4(h8, o88), f8 = Math.asin(p9 / c28); if (f8 < Math.acos(d34)) { if (!n45) return null; const t46 = [], e58 = []; E4(t46, o88, c28 / d34), C5(e58, G4(e58, t46, u12)), C5(o88, I3(o88, u12, E4(o88, e58, Math.tan(f8) * c28))); } const m6 = []; new Uu(i26, o88).closestPointOnSphere(l21, p9, m6); const y4 = C5([], Kt2(a46, 0)), g9 = C5([], Kt2(a46, 1)), x4 = C5([], Kt2(a46, 2)), v8 = D4(y4, m6), b8 = D4(g9, m6), w4 = D4(x4, m6), A4 = St(Math.asin(-b8 / p9)); let M5 = St(Math.atan2(v8, w4)); M5 = t45.center.lng + (function(t46, e58) { const r87 = (e58 - t46 + 180) % 360 - 180; return r87 < -180 ? r87 + 360 : r87; })(t45.center.lng, M5); const S5 = iu(M5), P4 = Tt2(su(A4), 0, 1); return new mu(S5, P4); } class Fc { constructor(t45, e57, r86) { this.a = G4([], t45, r86), this.b = G4([], e57, r86), this.center = r86; const n45 = C5([], this.a), i26 = C5([], this.b); this.angle = Math.acos(D4(n45, i26)); } } function Cc(t45, e57) { if (0 === t45.angle) return null; let r86; return r86 = 0 === t45.a[e57] ? 1 / t45.angle * 0.5 * Math.PI : 1 / t45.angle * Math.atan(t45.b[e57] / t45.a[e57] / Math.sin(t45.angle) - 1 / Math.tan(t45.angle)), r86 < 0 || r86 > 1 ? null : (function(t46, e58, r87, n45) { const i26 = Math.sin(r87); return t46 * (Math.sin((1 - n45) * r87) / i26) + e58 * (Math.sin(n45 * r87) / i26); })(t45.a[e57], t45.b[e57], t45.angle, Tt2(r86, 0, 1)) + t45.center[e57]; } function Dc(t45) { if (t45.z <= 1) return Bc[t45.z + 2 * t45.y + t45.x]; const e57 = Nc(Uc(t45)); return Xu.fromPoints(e57); } function Rc(t45, e57, r86) { return E4(t45, t45, 1 - r86), T4(t45, t45, e57, r86); } function Lc(t45, e57, r86) { for (const n45 of t45) O3(n45, n45, e57), E4(n45, n45, r86); } function Oc(t45, e57, r86, n45) { const i26 = e57 / t45.worldSize, s18 = t45.globeMatrix; if (r86.z <= 1) { const t46 = Dc(r86).getCorners(); return Lc(t46, s18, i26), Xu.fromPoints(t46); } const o88 = Uc(r86, n45), a46 = Nc(o88, Nl + Tc(t45._tileCoverLift)); Lc(a46, s18, i26); const l21 = Number.MAX_VALUE, u12 = [-l21, -l21, -l21], c28 = [l21, l21, l21]; if (o88.contains(t45.center)) { for (const t46 of a46) k6(c28, c28, t46), z3(u12, u12, t46); u12[2] = 0; const e58 = t45.point, r87 = [e58.x * i26, e58.y * i26, 0]; return k6(c28, c28, r87), z3(u12, u12, r87), new Xu(c28, u12); } if (t45._tileCoverLift > 0) { for (const t46 of a46) k6(c28, c28, t46), z3(u12, u12, t46); return new Xu(c28, u12); } const h8 = [s18[12] * i26, s18[13] * i26, s18[14] * i26], p9 = o88.getCenter(), d34 = Tt2(t45.center.lat, -cu, cu), f8 = Tt2(p9.lat, -cu, cu), m6 = iu(t45.center.lng), y4 = su(d34); let g9 = m6 - iu(p9.lng); const x4 = y4 - su(f8); g9 > 0.5 ? g9 -= 1 : g9 < -0.5 && (g9 += 1); let v8 = 0; Math.abs(g9) > Math.abs(x4) ? v8 = g9 >= 0 ? 1 : 3 : (v8 = x4 >= 0 ? 0 : 2, T4(h8, h8, [s18[4] * i26, s18[5] * i26, s18[6] * i26], -Math.sin(It(x4 >= 0 ? o88.getSouth() : o88.getNorth())) * Nl)); const b8 = a46[v8], w4 = a46[(v8 + 1) % 4], _4 = new Fc(b8, w4, h8), A4 = [Cc(_4, 0) || b8[0], Cc(_4, 1) || b8[1], Cc(_4, 2) || b8[2]], M5 = Yc(t45.zoom); if (M5 > 0) { const n46 = (function({ x: t46, y: e58, z: r87 }, n47, i28, s19, o89) { const a47 = 1 / (1 << r87); let l22 = t46 * a47, u13 = l22 + a47, c29 = e58 * a47, h9 = c29 + a47, p10 = 0; const d35 = (l22 + u13) / 2 - s19; return d35 > 0.5 ? p10 = -1 : d35 < -0.5 && (p10 = 1), l22 = ((l22 + p10) * n47 - (s19 *= n47)) * i28 + s19, u13 = ((u13 + p10) * n47 - s19) * i28 + s19, c29 = (c29 * n47 - (o89 *= n47)) * i28 + o89, h9 = (h9 * n47 - o89) * i28 + o89, [[l22, h9, 0], [u13, h9, 0], [u13, c29, 0], [l22, c29, 0]]; })(r86, e57, t45._pixelsPerMercatorPixel, m6, y4); for (let t46 = 0; t46 < a46.length; t46++) Rc(a46[t46], n46[t46], M5); const i27 = I3([], n46[v8], n46[(v8 + 1) % 4]); E4(i27, i27, 0.5), Rc(A4, i27, M5); } for (const t46 of a46) k6(c28, c28, t46), z3(u12, u12, t46); return c28[2] = Math.min(b8[2], w4[2]), k6(c28, c28, A4), z3(u12, u12, A4), new Xu(c28, u12); } function Uc({ x: t45, y: e57, z: r86 }, n45 = false) { const i26 = 1 / (1 << r86), s18 = new Ql(au(t45 * i26), e57 === (1 << r86) - 1 && n45 ? -90 : lu((e57 + 1) * i26)), o88 = new Ql(au((t45 + 1) * i26), 0 === e57 && n45 ? 90 : lu(e57 * i26)); return new tu(s18, o88); } function Nc(t45, e57 = Nl) { const r86 = It(t45.getNorth()), n45 = It(t45.getSouth()), i26 = Math.cos(r86), s18 = Math.cos(n45), o88 = Math.sin(r86), a46 = Math.sin(n45), l21 = t45.getWest(), u12 = t45.getEast(); return [Wl(s18, a46, l21, e57), Wl(s18, a46, u12, e57), Wl(i26, o88, u12, e57), Wl(i26, o88, l21, e57)]; } function jc(t45, e57, r86, n45) { const i26 = 1 << r86.z, s18 = (t45 / Rn + r86.x) / i26; return Yl(lu((e57 / Rn + r86.y) / i26), au(s18), n45); } function $c({ min: t45, max: e57 }) { return Gl / Math.max(e57[0] - t45[0], e57[1] - t45[1], e57[2] - t45[2]); } const Gc = new Float64Array(16); function Hc(t45) { const e57 = $c(t45), r86 = y3(Gc, [e57, e57, e57]); return h7(r86, r86, F16([], t45.min)); } function qc(t45) { const e57 = (n45 = t45.min, (r86 = Gc)[0] = 1, r86[1] = 0, r86[2] = 0, r86[3] = 0, r86[4] = 0, r86[5] = 1, r86[6] = 0, r86[7] = 0, r86[8] = 0, r86[9] = 0, r86[10] = 1, r86[11] = 0, r86[12] = n45[0], r86[13] = n45[1], r86[14] = n45[2], r86[15] = 1, r86); var r86, n45; const i26 = 1 / $c(t45); return p8(e57, e57, [i26, i26, i26]); } function Xc(t45) { const e57 = Rn / (2 * Math.PI); return t45 / (2 * Math.PI) / e57; } function Zc(t45, e57) { return Rn / (512 * Math.pow(2, t45)) * $c(Dc(e57)); } function Wc(t45, e57, r86, n45, i26) { const s18 = Xc(r86), o88 = [t45, e57, -r86 / (2 * Math.PI)], a46 = l20(new Float64Array(16)); return h7(a46, a46, o88), p8(a46, a46, [s18, s18, s18]), d33(a46, a46, It(-i26)), f7(a46, a46, It(-n45)), a46; } function Yc(t45) { return Bt(jl, $l, t45); } function Kc(t45, e57) { const r86 = Yl(e57.lat, e57.lng), n45 = (function(t46) { const e58 = Yl(t46._center.lat, t46._center.lng); let r87 = R4([], A3(0, 1, 0), e58); const n46 = g8([], -t46.angle, e58); r87 = O3(r87, r87, n46), g8(n46, -t46._pitch, r87); const i27 = C5([], e58); return E4(i27, i27, Tc(t46.cameraToCenterDistance / t46.pixelsPerMeter)), O3(i27, i27, n46), I3([], e58, i27); })(t45); return o88 = (i26 = S4([], n45, r86))[0], a46 = i26[1], l21 = i26[2], u12 = (s18 = r86)[0], c28 = s18[1], h8 = s18[2], d34 = (p9 = Math.sqrt((o88 * o88 + a46 * a46 + l21 * l21) * (u12 * u12 + c28 * c28 + h8 * h8))) && D4(i26, s18) / p9, Math.acos(Math.min(Math.max(d34, -1), 1)); var i26, s18, o88, a46, l21, u12, c28, h8, p9, d34; } function Jc(t45, e57) { return Kc(t45, e57) > Math.PI / 2 * 1.01; } const Qc = It(85), th = Math.cos(Qc), eh = Math.sin(Qc), rh = a45(), nh = (t45) => { const e57 = []; return "map" === t45.paint.get("circle-pitch-alignment") && e57.push("PITCH_WITH_MAP"), "map" === t45.paint.get("circle-pitch-scale") && e57.push("SCALE_WITH_MAP"), e57; }; function ih(t45, e57, r86, n45, i26, s18, o88, a46, l21) { if (s18 && t45.queryGeometry.isAboveHorizon) return false; s18 && (l21 *= t45.pixelToTileUnitsFactor); const u12 = t45.tileID.canonical, c28 = r86.projection.upVectorScale(u12, r86.center.lat, r86.worldSize).metersToTile; for (const h8 of e57) for (const e58 of h8) { const h9 = e58.add(a46), p9 = i26 && r86.elevation ? r86.elevation.exaggeration() * i26.getElevationAt(h9.x, h9.y, true) : 0, d34 = r86.projection.projectTilePoint(h9.x, h9.y, u12); if (p9 > 0) { const t46 = r86.projection.upVector(u12, h9.x, h9.y); d34.x += t46[0] * c28 * p9, d34.y += t46[1] * c28 * p9, d34.z += t46[2] * c28 * p9; } const f8 = s18 ? h9 : sh(d34.x, d34.y, d34.z, n45), m6 = s18 ? t45.tilespaceRays.map(((t46) => lh(t46, p9))) : t45.queryGeometry.screenGeometry, y4 = Y5([], [d34.x, d34.y, d34.z, 1], n45); if (!o88 && s18 ? l21 *= y4[3] / r86.cameraToCenterDistance : o88 && !s18 && (l21 *= r86.cameraToCenterDistance / y4[3]), s18) { const t46 = lu((e58.y / Rn + u12.y) / (1 << u12.z)); l21 /= r86.projection.pixelsPerMeter(t46, 1) / ou(1, t46); } if (tc(m6, f8, l21)) return true; } return false; } function sh(t45, e57, r86, n45) { const i26 = Y5([], [t45, e57, r86, 1], n45); return new wt(i26[0] / i26[3], i26[1] / i26[3]); } const oh = A3(0, 0, 0), ah = A3(0, 0, 1); function lh(t45, e57) { const r86 = b7(); return oh[2] = e57, t45.intersectsPlane(oh, ah, r86), new wt(r86[0], r86[1]); } class uh extends Ju { } let ch, hh, ph, dh; function fh(t45, { width: e57, height: r86 }, n45, i26) { if (i26) { if (i26 instanceof Uint8ClampedArray) i26 = new Uint8Array(i26.buffer); else if (i26.length !== e57 * r86 * n45) throw new RangeError("mismatched image size"); } else i26 = new Uint8Array(e57 * r86 * n45); return t45.width = e57, t45.height = r86, t45.data = i26, t45; } function mh(t45, e57, r86) { const { width: n45, height: i26 } = e57; n45 === t45.width && i26 === t45.height || (yh(t45, e57, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t45.width, n45), height: Math.min(t45.height, i26) }, r86, null), t45.width = n45, t45.height = i26, t45.data = e57.data); } function yh(t45, e57, r86, n45, i26, s18, o88, a46) { if (0 === i26.width || 0 === i26.height) return e57; if (i26.width > t45.width || i26.height > t45.height || r86.x > t45.width - i26.width || r86.y > t45.height - i26.height) throw new RangeError("out of range source coordinates for image copy"); if (i26.width > e57.width || i26.height > e57.height || n45.x > e57.width - i26.width || n45.y > e57.height - i26.height) throw new RangeError("out of range destination coordinates for image copy"); const l21 = t45.data, u12 = e57.data, c28 = 4 === s18 && a46; for (let a47 = 0; a47 < i26.height; a47++) { const h8 = ((r86.y + a47) * t45.width + r86.x) * s18, p9 = ((n45.y + a47) * e57.width + n45.x) * s18; if (c28) for (let t46 = 0; t46 < i26.width; t46++) { const e58 = h8 + t46 * s18 + 3, r87 = p9 + t46 * s18; u12[r87 + 0] = 255, u12[r87 + 1] = 255, u12[r87 + 2] = 255, u12[r87 + 3] = l21[e58]; } else if (o88) for (let t46 = 0; t46 < i26.width; t46++) { const e58 = h8 + t46 * s18, r87 = p9 + t46 * s18, n46 = new sr(l21[e58 + 0] / 255, l21[e58 + 1] / 255, l21[e58 + 2] / 255, l21[e58 + 3]).toNonPremultipliedRenderColor(o88).toArray(); u12[r87 + 0] = n46[0], u12[r87 + 1] = n46[1], u12[r87 + 2] = n46[2], u12[r87 + 3] = n46[3]; } else for (let t46 = 0; t46 < i26.width * s18; t46++) u12[p9 + t46] = l21[h8 + t46]; } return e57; } Ws(uh, "HeatmapBucket", { omit: ["layers"] }); class gh { constructor(t45, e57) { fh(this, t45, 1, e57); } resize(t45) { mh(this, new gh(t45), 1); } clone() { return new gh({ width: this.width, height: this.height }, new Uint8Array(this.data)); } static copy(t45, e57, r86, n45, i26) { yh(t45, e57, r86, n45, i26, 1, null); } } class xh { constructor(t45, e57) { fh(this, t45, 4, e57); } resize(t45) { mh(this, new xh(t45), 4); } replace(t45, e57) { e57 ? this.data.set(t45) : this.data = t45 instanceof Uint8ClampedArray ? new Uint8Array(t45.buffer) : t45; } clone() { return new xh({ width: this.width, height: this.height }, new Uint8Array(this.data)); } static copy(t45, e57, r86, n45, i26, s18, o88) { yh(t45, e57, r86, n45, i26, 4, s18, o88); } } class vh { constructor(t45, e57) { this.width = t45.width, this.height = t45.height, this.data = e57 instanceof Uint8Array ? new Float32Array(e57.buffer) : e57; } } function bh(t45) { const e57 = {}, r86 = t45.resolution || 256, n45 = t45.clips ? t45.clips.length : 1, i26 = t45.image || new xh({ width: r86, height: n45 }), s18 = (r87, n46, s19) => { e57[t45.evaluationKey] = s19; const o88 = t45.expression.evaluate(e57), a46 = o88 ? o88.toNonPremultipliedRenderColor(null) : null; a46 && (i26.data[r87 + n46 + 0] = Math.floor(255 * a46.r), i26.data[r87 + n46 + 1] = Math.floor(255 * a46.g), i26.data[r87 + n46 + 2] = Math.floor(255 * a46.b), i26.data[r87 + n46 + 3] = Math.floor(255 * a46.a)); }; if (t45.clips) for (let e58 = 0, i27 = 0; e58 < n45; ++e58, i27 += 4 * r86) for (let n46 = 0, o88 = 0; n46 < r86; n46++, o88 += 4) { const a46 = n46 / (r86 - 1), { start: l21, end: u12 } = t45.clips[e58]; s18(i27, o88, l21 * (1 - a46) + u12 * a46); } else for (let t46 = 0, e58 = 0; t46 < r86; t46++, e58 += 4) s18(0, e58, t46 / (r86 - 1)); return i26; } Ws(gh, "AlphaImage"), Ws(xh, "RGBAImage"); const wh = aa2([{ name: "a_pos", components: 2, type: "Int16" }], 4), _h = aa2([{ name: "a_road_z_offset", components: 1, type: "Float32" }], 4), Ah = aa2([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_height", components: 1, type: "Float32" }], 4), Mh = aa2([{ name: "a_pos_normal_3", components: 3, type: "Int16" }], 4); function Ih(t45, e57, r86 = 2) { const n45 = e57 && e57.length, i26 = n45 ? e57[0] * r86 : t45.length; let s18 = Sh(t45, 0, i26, r86, true); const o88 = []; if (!s18 || s18.next === s18.prev) return o88; let a46, l21, u12; if (n45 && (s18 = (function(t46, e58, r87, n46) { const i27 = []; for (let r88 = 0, s19 = e58.length; r88 < s19; r88++) { const o89 = Sh(t46, e58[r88] * n46, r88 < s19 - 1 ? e58[r88 + 1] * n46 : t46.length, n46, false); o89 === o89.next && (o89.steiner = true), i27.push(Rh(o89)); } i27.sort(Vh); for (let t47 = 0; t47 < i27.length; t47++) r87 = Fh(i27[t47], r87); return r87; })(t45, e57, s18, r86)), t45.length > 80 * r86) { a46 = t45[0], l21 = t45[1]; let e58 = a46, n46 = l21; for (let s19 = r86; s19 < i26; s19 += r86) { const r87 = t45[s19], i27 = t45[s19 + 1]; r87 < a46 && (a46 = r87), i27 < l21 && (l21 = i27), r87 > e58 && (e58 = r87), i27 > n46 && (n46 = i27); } u12 = Math.max(e58 - a46, n46 - l21), u12 = 0 !== u12 ? 32767 / u12 : 0; } return kh(s18, o88, r86, a46, l21, u12, 0), o88; } function Sh(t45, e57, r86, n45, i26) { let s18; if (i26 === (function(t46, e58, r87, n46) { let i27 = 0; for (let s19 = e58, o88 = r87 - n46; s19 < r87; s19 += n46) i27 += (t46[o88] - t46[s19]) * (t46[s19 + 1] + t46[o88 + 1]), o88 = s19; return i27; })(t45, e57, r86, n45) > 0) for (let i27 = e57; i27 < r86; i27 += n45) s18 = Zh(i27 / n45 | 0, t45[i27], t45[i27 + 1], s18); else for (let i27 = r86 - n45; i27 >= e57; i27 -= n45) s18 = Zh(i27 / n45 | 0, t45[i27], t45[i27 + 1], s18); return s18 && jh(s18, s18.next) && (Wh(s18), s18 = s18.next), s18; } function Ph(t45, e57) { if (!t45) return t45; e57 || (e57 = t45); let r86, n45 = t45; do { if (r86 = false, n45.steiner || !jh(n45, n45.next) && 0 !== Nh(n45.prev, n45, n45.next)) n45 = n45.next; else { if (Wh(n45), n45 = e57 = n45.prev, n45 === n45.next) break; r86 = true; } } while (r86 || n45 !== e57); return e57; } function kh(t45, e57, r86, n45, i26, s18, o88) { if (!t45) return; !o88 && s18 && (function(t46, e58, r87, n46) { let i27 = t46; do { 0 === i27.z && (i27.z = Dh(i27.x, i27.y, e58, r87, n46)), i27.prevZ = i27.prev, i27.nextZ = i27.next, i27 = i27.next; } while (i27 !== t46); i27.prevZ.nextZ = null, i27.prevZ = null, (function(t47) { let e59, r88 = 1; do { let n47, i28 = t47; t47 = null; let s19 = null; for (e59 = 0; i28; ) { e59++; let o89 = i28, a47 = 0; for (let t48 = 0; t48 < r88 && (a47++, o89 = o89.nextZ, o89); t48++) ; let l21 = r88; for (; a47 > 0 || l21 > 0 && o89; ) 0 !== a47 && (0 === l21 || !o89 || i28.z <= o89.z) ? (n47 = i28, i28 = i28.nextZ, a47--) : (n47 = o89, o89 = o89.nextZ, l21--), s19 ? s19.nextZ = n47 : t47 = n47, n47.prevZ = s19, s19 = n47; i28 = o89; } s19.nextZ = null, r88 *= 2; } while (e59 > 1); })(i27); })(t45, n45, i26, s18); let a46 = t45; for (; t45.prev !== t45.next; ) { const l21 = t45.prev, u12 = t45.next; if (s18 ? Eh(t45, n45, i26, s18) : zh(t45)) e57.push(l21.i, t45.i, u12.i), Wh(t45), t45 = u12.next, a46 = u12.next; else if ((t45 = u12) === a46) { o88 ? 1 === o88 ? kh(t45 = Th(Ph(t45), e57), e57, r86, n45, i26, s18, 2) : 2 === o88 && Bh(t45, e57, r86, n45, i26, s18) : kh(Ph(t45), e57, r86, n45, i26, s18, 1); break; } } } function zh(t45) { const e57 = t45.prev, r86 = t45, n45 = t45.next; if (Nh(e57, r86, n45) >= 0) return false; const i26 = e57.x, s18 = r86.x, o88 = n45.x, a46 = e57.y, l21 = r86.y, u12 = n45.y, c28 = Math.min(i26, s18, o88), h8 = Math.min(a46, l21, u12), p9 = Math.max(i26, s18, o88), d34 = Math.max(a46, l21, u12); let f8 = n45.next; for (; f8 !== e57; ) { if (f8.x >= c28 && f8.x <= p9 && f8.y >= h8 && f8.y <= d34 && Oh(i26, a46, s18, l21, o88, u12, f8.x, f8.y) && Nh(f8.prev, f8, f8.next) >= 0) return false; f8 = f8.next; } return true; } function Eh(t45, e57, r86, n45) { const i26 = t45.prev, s18 = t45, o88 = t45.next; if (Nh(i26, s18, o88) >= 0) return false; const a46 = i26.x, l21 = s18.x, u12 = o88.x, c28 = i26.y, h8 = s18.y, p9 = o88.y, d34 = Math.min(a46, l21, u12), f8 = Math.min(c28, h8, p9), m6 = Math.max(a46, l21, u12), y4 = Math.max(c28, h8, p9), g9 = Dh(d34, f8, e57, r86, n45), x4 = Dh(m6, y4, e57, r86, n45); let v8 = t45.prevZ, b8 = t45.nextZ; for (; v8 && v8.z >= g9 && b8 && b8.z <= x4; ) { if (v8.x >= d34 && v8.x <= m6 && v8.y >= f8 && v8.y <= y4 && v8 !== i26 && v8 !== o88 && Oh(a46, c28, l21, h8, u12, p9, v8.x, v8.y) && Nh(v8.prev, v8, v8.next) >= 0) return false; if (v8 = v8.prevZ, b8.x >= d34 && b8.x <= m6 && b8.y >= f8 && b8.y <= y4 && b8 !== i26 && b8 !== o88 && Oh(a46, c28, l21, h8, u12, p9, b8.x, b8.y) && Nh(b8.prev, b8, b8.next) >= 0) return false; b8 = b8.nextZ; } for (; v8 && v8.z >= g9; ) { if (v8.x >= d34 && v8.x <= m6 && v8.y >= f8 && v8.y <= y4 && v8 !== i26 && v8 !== o88 && Oh(a46, c28, l21, h8, u12, p9, v8.x, v8.y) && Nh(v8.prev, v8, v8.next) >= 0) return false; v8 = v8.prevZ; } for (; b8 && b8.z <= x4; ) { if (b8.x >= d34 && b8.x <= m6 && b8.y >= f8 && b8.y <= y4 && b8 !== i26 && b8 !== o88 && Oh(a46, c28, l21, h8, u12, p9, b8.x, b8.y) && Nh(b8.prev, b8, b8.next) >= 0) return false; b8 = b8.nextZ; } return true; } function Th(t45, e57) { let r86 = t45; do { const n45 = r86.prev, i26 = r86.next.next; !jh(n45, i26) && $h(n45, r86, r86.next, i26) && qh(n45, i26) && qh(i26, n45) && (e57.push(n45.i, r86.i, i26.i), Wh(r86), Wh(r86.next), r86 = t45 = i26), r86 = r86.next; } while (r86 !== t45); return Ph(r86); } function Bh(t45, e57, r86, n45, i26, s18) { let o88 = t45; do { let t46 = o88.next.next; for (; t46 !== o88.prev; ) { if (o88.i !== t46.i && Uh(o88, t46)) { let a46 = Xh(o88, t46); return o88 = Ph(o88, o88.next), a46 = Ph(a46, a46.next), kh(o88, e57, r86, n45, i26, s18, 0), void kh(a46, e57, r86, n45, i26, s18, 0); } t46 = t46.next; } o88 = o88.next; } while (o88 !== t45); } function Vh(t45, e57) { let r86 = t45.x - e57.x; return 0 === r86 && (r86 = t45.y - e57.y, 0 === r86) && (r86 = (t45.next.y - t45.y) / (t45.next.x - t45.x) - (e57.next.y - e57.y) / (e57.next.x - e57.x)), r86; } function Fh(t45, e57) { const r86 = (function(t46, e58) { let r87 = e58; const n46 = t46.x, i26 = t46.y; let s18, o88 = -1 / 0; if (jh(t46, r87)) return r87; do { if (jh(t46, r87.next)) return r87.next; if (i26 <= r87.y && i26 >= r87.next.y && r87.next.y !== r87.y) { const t47 = r87.x + (i26 - r87.y) * (r87.next.x - r87.x) / (r87.next.y - r87.y); if (t47 <= n46 && t47 > o88 && (o88 = t47, s18 = r87.x < r87.next.x ? r87 : r87.next, t47 === n46)) return s18; } r87 = r87.next; } while (r87 !== e58); if (!s18) return null; const a46 = s18, l21 = s18.x, u12 = s18.y; let c28 = 1 / 0; r87 = s18; do { if (n46 >= r87.x && r87.x >= l21 && n46 !== r87.x && Lh(i26 < u12 ? n46 : o88, i26, l21, u12, i26 < u12 ? o88 : n46, i26, r87.x, r87.y)) { const e59 = Math.abs(i26 - r87.y) / (n46 - r87.x); qh(r87, t46) && (e59 < c28 || e59 === c28 && (r87.x > s18.x || r87.x === s18.x && Ch(s18, r87))) && (s18 = r87, c28 = e59); } r87 = r87.next; } while (r87 !== a46); return s18; })(t45, e57); if (!r86) return e57; const n45 = Xh(r86, t45); return Ph(n45, n45.next), Ph(r86, r86.next); } function Ch(t45, e57) { return Nh(t45.prev, t45, e57.prev) < 0 && Nh(e57.next, t45, t45.next) < 0; } function Dh(t45, e57, r86, n45, i26) { return (t45 = 1431655765 & ((t45 = 858993459 & ((t45 = 252645135 & ((t45 = 16711935 & ((t45 = (t45 - r86) * i26 | 0) | t45 << 8)) | t45 << 4)) | t45 << 2)) | t45 << 1)) | (e57 = 1431655765 & ((e57 = 858993459 & ((e57 = 252645135 & ((e57 = 16711935 & ((e57 = (e57 - n45) * i26 | 0) | e57 << 8)) | e57 << 4)) | e57 << 2)) | e57 << 1)) << 1; } function Rh(t45) { let e57 = t45, r86 = t45; do { (e57.x < r86.x || e57.x === r86.x && e57.y < r86.y) && (r86 = e57), e57 = e57.next; } while (e57 !== t45); return r86; } function Lh(t45, e57, r86, n45, i26, s18, o88, a46) { return (i26 - o88) * (e57 - a46) >= (t45 - o88) * (s18 - a46) && (t45 - o88) * (n45 - a46) >= (r86 - o88) * (e57 - a46) && (r86 - o88) * (s18 - a46) >= (i26 - o88) * (n45 - a46); } function Oh(t45, e57, r86, n45, i26, s18, o88, a46) { return !(t45 === o88 && e57 === a46) && Lh(t45, e57, r86, n45, i26, s18, o88, a46); } function Uh(t45, e57) { return t45.next.i !== e57.i && t45.prev.i !== e57.i && !(function(t46, e58) { let r86 = t46; do { if (r86.i !== t46.i && r86.next.i !== t46.i && r86.i !== e58.i && r86.next.i !== e58.i && $h(r86, r86.next, t46, e58)) return true; r86 = r86.next; } while (r86 !== t46); return false; })(t45, e57) && (qh(t45, e57) && qh(e57, t45) && (function(t46, e58) { let r86 = t46, n45 = false; const i26 = (t46.x + e58.x) / 2, s18 = (t46.y + e58.y) / 2; do { r86.y > s18 != r86.next.y > s18 && r86.next.y !== r86.y && i26 < (r86.next.x - r86.x) * (s18 - r86.y) / (r86.next.y - r86.y) + r86.x && (n45 = !n45), r86 = r86.next; } while (r86 !== t46); return n45; })(t45, e57) && (Nh(t45.prev, t45, e57.prev) || Nh(t45, e57.prev, e57)) || jh(t45, e57) && Nh(t45.prev, t45, t45.next) > 0 && Nh(e57.prev, e57, e57.next) > 0); } function Nh(t45, e57, r86) { return (e57.y - t45.y) * (r86.x - e57.x) - (e57.x - t45.x) * (r86.y - e57.y); } function jh(t45, e57) { return t45.x === e57.x && t45.y === e57.y; } function $h(t45, e57, r86, n45) { const i26 = Hh(Nh(t45, e57, r86)), s18 = Hh(Nh(t45, e57, n45)), o88 = Hh(Nh(r86, n45, t45)), a46 = Hh(Nh(r86, n45, e57)); return i26 !== s18 && o88 !== a46 || !(0 !== i26 || !Gh(t45, r86, e57)) || !(0 !== s18 || !Gh(t45, n45, e57)) || !(0 !== o88 || !Gh(r86, t45, n45)) || !(0 !== a46 || !Gh(r86, e57, n45)); } function Gh(t45, e57, r86) { return e57.x <= Math.max(t45.x, r86.x) && e57.x >= Math.min(t45.x, r86.x) && e57.y <= Math.max(t45.y, r86.y) && e57.y >= Math.min(t45.y, r86.y); } function Hh(t45) { return t45 > 0 ? 1 : t45 < 0 ? -1 : 0; } function qh(t45, e57) { return Nh(t45.prev, t45, t45.next) < 0 ? Nh(t45, e57, t45.next) >= 0 && Nh(t45, t45.prev, e57) >= 0 : Nh(t45, e57, t45.prev) < 0 || Nh(t45, t45.next, e57) < 0; } function Xh(t45, e57) { const r86 = Yh(t45.i, t45.x, t45.y), n45 = Yh(e57.i, e57.x, e57.y), i26 = t45.next, s18 = e57.prev; return t45.next = e57, e57.prev = t45, r86.next = i26, i26.prev = r86, n45.next = r86, r86.prev = n45, s18.next = n45, n45.prev = s18, n45; } function Zh(t45, e57, r86, n45) { const i26 = Yh(t45, e57, r86); return n45 ? (i26.next = n45.next, i26.prev = n45, n45.next.prev = i26, n45.next = i26) : (i26.prev = i26, i26.next = i26), i26; } function Wh(t45) { t45.next.prev = t45.prev, t45.prev.next = t45.next, t45.prevZ && (t45.prevZ.nextZ = t45.nextZ), t45.nextZ && (t45.nextZ.prevZ = t45.prevZ); } function Yh(t45, e57, r86) { return { i: t45, x: e57, y: r86, prev: null, next: null, z: 0, prevZ: null, nextZ: null, steiner: false }; } function Kh(t45, e57) { const r86 = t45.length; if (r86 <= 1) return [t45]; const n45 = []; let i26, s18; for (let e58 = 0; e58 < r86; e58++) { const r87 = qt(t45[e58]); 0 !== r87 && (t45[e58].area = Math.abs(r87), void 0 === s18 && (s18 = r87 < 0), s18 === r87 < 0 ? (i26 && n45.push(i26), i26 = [t45[e58]]) : i26.push(t45[e58])); } if (i26 && n45.push(i26), e57 > 1) for (let t46 = 0; t46 < n45.length; t46++) n45[t46].length <= e57 || (sn(n45[t46], e57, 1, n45[t46].length - 1, Jh), n45[t46] = n45[t46].slice(0, e57)); return n45; } function Jh(t45, e57) { return e57.area - t45.area; } function Qh(t45, e57, r86 = 1) { if (!t45) return null; const n45 = "string" == typeof t45 ? Cr.from(t45).getPrimary() : t45.getPrimary(), i26 = "string" == typeof t45 ? null : t45.getSecondary(); for (const t46 of [n45, i26]) { if (!t46) continue; const n46 = t46.id.toString(); e57.has(n46) || e57.set(n46, []), t46.scaleSelf(r86), e57.get(n46).push(t46); } return { primary: n45.toString(), secondary: i26 ? i26.toString() : null }; } function tp(t45, e57, r86, n45) { const i26 = n45.patternDependencies; let s18 = false; for (const n46 of e57) { const e58 = n46.paint.get(`${t45}-pattern`); e58.isConstant() || (s18 = true), Qh(e58.constantOr(null), i26, r86) && (s18 = true); } return s18; } function ep(t45, e57, r86, n45, i26, s18) { const o88 = s18.patternDependencies; for (const a46 of e57) { const e58 = a46.paint.get(`${t45}-pattern`).value; if ("constant" !== e58.kind) { let t46 = e58.evaluate({ zoom: n45 }, r86, {}, s18.availableImages); t46 = t46 && t46.name ? t46.name : t46; const l21 = Qh(t46, o88, i26); if (!l21) continue; const { primary: u12, secondary: c28 } = l21; u12 && (r86.patterns[a46.id] = [u12, c28].filter(Boolean)); } } return r86; } class rp { constructor() { this.polygons = /* @__PURE__ */ new Map(); } add(t45, ...e57) { const r86 = this.polygons.get(t45); r86 ? r86.push(...e57) : this.polygons.set(t45, e57); } merge(t45) { for (const [e57, r86] of t45.polygons) this.add(e57, ...r86); } } class np { constructor() { this.portals = []; } static isOnBorder(t45, e57) { return t45 <= 0 && e57 <= 0 || t45 >= Rn && e57 >= Rn; } static evaluate(t45) { if (0 === t45.length) return new np(); let e57 = []; for (const r87 of t45) e57.push(...r87.portals); if (0 === e57.length) return new np(); for (const t46 of e57) { const e58 = t46.va, r87 = t46.vb; (np.isOnBorder(e58.x, r87.x) || np.isOnBorder(e58.y, r87.y)) && (t46.type = "border"); } const r86 = e57.filter(((t46) => "unevaluated" !== t46.type)), n45 = e57.filter(((t46) => "unevaluated" === t46.type)); if (0 === n45.length) return new np(); n45.sort(((t46, e58) => t46.hash === e58.hash ? t46.isTunnel === e58.isTunnel ? 0 : t46.isTunnel ? -1 : 1 : t46.hash < e58.hash ? 1 : -1)), e57 = r86.concat(n45); let i26 = r86.length, s18 = i26, o88 = i26; do { if (s18++, s18 === e57.length || e57[i26].hash !== e57[s18].hash) { if (s18 - i26 == 2) { o88 < i26 && (e57[o88] = e57[i26], e57[i26] = null); const t46 = e57[o88], r87 = e57[s18 - 1]; t46.type = t46.isTunnel !== r87.isTunnel ? "tunnel" : "polygon", t46.connection = { a: t46.connection.a, b: r87.connection.a }, o88++; } i26 = s18; } } while (i26 !== e57.length); return e57.splice(o88), e57.sort(((t46, e58) => t46.hash < e58.hash ? 1 : -1)), { portals: e57 }; } } Ws(np, "ElevationPortalGraph"), Ws(rp, "ElevationPolygons"); class ip { constructor(t45, e57, r86) { this.outPositions = t45, this.outNormals = e57, this.outIndices = r86, this.vertexLookup = /* @__PURE__ */ new Map(); } addVertex(t45, e57, r86) { let n45 = t45[2]; null != r86 && (n45 *= r86); const i26 = `${t45[0]},${t45[1]},${t45[2]},${e57[0]},${e57[1]},${e57[2]}`, s18 = this.vertexLookup.get(i26); if (null != s18) return s18; const o88 = this.outPositions.length; this.vertexLookup.set(i26, o88); const a46 = Math.trunc(16384 * e57[0]), l21 = Math.trunc(16384 * e57[1]), u12 = Math.trunc(16384 * e57[2]); return this.outPositions.emplaceBack(t45[0], t45[1], n45), this.outNormals.emplaceBack(a46, l21, u12), o88; } addTriangle(t45, e57, r86) { this.outIndices.emplaceBack(t45, e57, r86); } addTriangles(t45, e57, r86) { if (0 === t45.length) return; const n45 = 1 === r86.length, i26 = b7(), s18 = b7(); for (let o88 = 0; o88 < t45.length; o88 += 3) { const a46 = e57[t45[o88 + 0]], l21 = e57[t45[o88 + 1]], u12 = e57[t45[o88 + 2]], c28 = n45 ? r86[0] : r86[t45[o88 + 1]], h8 = n45 ? r86[0] : r86[t45[o88 + 2]]; M4(i26, a46.x, a46.y, n45 ? r86[0] : r86[t45[o88 + 0]]); const p9 = this.addVertex(i26, s18); M4(i26, l21.x, l21.y, c28); const d34 = this.addVertex(i26, s18); M4(i26, u12.x, u12.y, h8); const f8 = this.addVertex(i26, s18); this.outIndices.emplaceBack(p9, d34, f8); } } addQuad(t45, e57, r86, n45, i26, s18) { const o88 = this.addVertex(t45, i26, s18), a46 = this.addVertex(e57, i26, s18), l21 = this.addVertex(r86, i26, s18), u12 = this.addVertex(n45, i26, s18); this.addTriangle(o88, a46, l21), this.addTriangle(l21, u12, o88); } getVertexCount() { return this.outPositions.length; } clearVertexLookup() { this.vertexLookup.clear(); } } class sp { constructor(t45, e57, r86, n45) { this.unevaluatedPortals = new np(), this.portalPolygons = new rp(), this.bridgeFeatureSections = [], this.tunnelFeatureSections = [], this.vertexHashLookup = /* @__PURE__ */ new Map(), this.unevalVertices = [], this.unevalHeights = [], this.unevalTriangles = [], this.unevalTunnelTriangles = [], this.unevalEdges = [], this.vertexPositions = new da2(), this.vertexNormals = new fa(), this.indexArray = new Ea(), this.tileToMeters = fu(t45), this.bridgeProgramConfigurations = new Cl(e57, { zoom: r86, lut: n45 }, ((t46) => "fill-tunnel-structure-color" !== t46)), this.tunnelProgramConfigurations = new Cl(e57, { zoom: r86, lut: n45 }, ((t46) => "fill-bridge-guard-rail-color" !== t46)); } addVertices(t45, e57) { const r86 = this.unevalVertices.length; for (let r87 = 0; r87 < t45.length; r87++) this.unevalVertices.push(t45[r87]), this.unevalHeights.push(e57[r87]); return r86; } addTriangles(t45, e57, r86) { const n45 = r86 ? this.unevalTunnelTriangles : this.unevalTriangles; for (const r87 of t45) n45.push(r87 + e57); } addRenderableRing(t45, e57, r86, n45, i26, s18) { const o88 = [new wt(i26.min.x, i26.min.y), new wt(i26.max.x, i26.min.y), new wt(i26.max.x, i26.max.y), new wt(i26.min.x, i26.max.y)]; for (let a46 = 0; a46 < r86 - 1; a46++) { const r87 = e57 + a46, l21 = r87 + 1, u12 = this.unevalVertices[r87], c28 = this.unevalVertices[l21]; if (!(u12.x >= i26.min.x && u12.x <= i26.max.x && u12.y >= i26.min.y && u12.y <= i26.max.y || c28.x >= i26.min.x && c28.x <= i26.max.x && c28.y >= i26.min.y && c28.y <= i26.max.y || pc(u12, c28, o88))) continue; if (this.isOnBorder(u12.x, c28.x) || this.isOnBorder(u12.y, c28.y)) continue; const h8 = sp.computeEdgeHash(this.unevalVertices[r87], this.unevalVertices[l21]); let p9, d34 = this.vertexHashLookup.get(sp.computePosHash(u12)); null != d34 ? p9 = d34.next : (d34 = this.vertexHashLookup.get(sp.computePosHash(c28)), p9 = null != d34 ? d34.prev : h8), this.unevalEdges.push({ polygonIdx: t45, a: r87, b: l21, hash: h8, portalHash: p9, isTunnel: n45, type: "unevaluated", featureInfo: s18 }); } } addPortalCandidates(t45, e57, r86, n45, i26) { if (0 === e57.length) return; this.portalPolygons.add(t45, { geometry: e57, zLevel: i26 }); const s18 = e57[0]; this.vertexHashLookup.clear(); let o88 = sp.computeEdgeHash(s18[s18.length - 2], s18[s18.length - 1]); for (let e58 = 0; e58 < s18.length - 1; e58++) { const i27 = s18[e58 + 0], a46 = s18[e58 + 1], l21 = at2(a46.x - i27.x, a46.y - i27.y), u12 = pt(l21); if (0 === u12) continue; let c28 = "unevaluated"; const h8 = n45.pointElevation(i27), p9 = n45.pointElevation(a46); Math.abs(h8) < 0.01 && Math.abs(p9) < 0.01 ? c28 = "entrance" : (this.isOnBorder(i27.x, a46.x) || this.isOnBorder(i27.y, a46.y)) && (c28 = "border"); const d34 = sp.computeEdgeHash(i27, a46); this.unevaluatedPortals.portals.push({ connection: { a: t45, b: void 0 }, va: i27, vb: a46, vab: l21, length: u12, hash: d34, isTunnel: r86, type: c28 }); const f8 = sp.computePosHash(i27); this.vertexHashLookup.set(f8, { prev: o88, next: d34 }), o88 = d34; } } construct(t45) { if (0 === this.unevalVertices.length) return; const e57 = () => ({ vertexOffset: 0, primitiveOffset: this.indexArray.length }), r86 = (t46) => { t46.primitiveLength = this.indexArray.length - t46.primitiveOffset; }, n45 = new ip(this.vertexPositions, this.vertexNormals, this.indexArray); this.prepareEdges(t45.portals, this.unevalEdges); const i26 = e57(), s18 = e57(), o88 = e57(), a46 = (t46, e58) => { t46.sort(((t47, r88) => t47.type === e58 && r88.type !== e58 ? -1 : t47.type !== e58 && r88.type === e58 ? 1 : 0)); const r87 = t46.findIndex(((t47) => t47.type !== e58)); return r87 >= 0 ? r87 : t46.length; }; let l21 = 0; this.unevalEdges.length > 0 && (l21 = a46(this.unevalEdges, "none"), this.constructBridgeStructures(n45, this.unevalVertices, this.unevalHeights, this.unevalEdges, { min: 0, max: l21 }, this.tileToMeters)), r86(o88); const u12 = e57(), c28 = e57(); if (this.unevalEdges.length > 0) { const t46 = this.unevalEdges.splice(l21), e58 = a46(t46, "tunnel") + l21; this.unevalEdges.push(...t46), this.constructTunnelStructures(n45, this.unevalVertices, this.unevalHeights, this.unevalEdges, { min: 0, max: l21 }, { min: l21, max: e58 }); } r86(u12), n45.addTriangles(this.unevalTriangles, this.unevalVertices, this.unevalHeights), r86(c28), n45.addTriangles(this.unevalTunnelTriangles, this.unevalVertices, this.unevalHeights), r86(s18), n45.addTriangles(this.unevalTunnelTriangles, this.unevalVertices, [-0.1]), r86(i26), this.maskSegments = al.simpleSegment(0, c28.primitiveOffset, 0, c28.primitiveLength), this.depthSegments = al.simpleSegment(0, s18.primitiveOffset, 0, s18.primitiveLength), this.renderableBridgeSegments = al.simpleSegment(0, o88.primitiveOffset, 0, o88.primitiveLength), this.renderableTunnelSegments = al.simpleSegment(0, u12.primitiveOffset, 0, u12.primitiveLength), this.shadowCasterSegments = al.simpleSegment(0, i26.primitiveOffset, 0, i26.primitiveLength); } update(t45, e57, r86, n45, i26, s18, o88, a46) { this.bridgeProgramConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, a46), this.tunnelProgramConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, a46); } upload(t45) { this.vertexBuffer || 0 === this.vertexPositions.length || 0 === this.vertexNormals.length || 0 === this.indexArray.length || (this.vertexBuffer = t45.createVertexBuffer(this.vertexPositions, Ah.members), this.vertexBufferNormal = t45.createVertexBuffer(this.vertexNormals, Mh.members), this.indexBuffer = t45.createIndexBuffer(this.indexArray), this.bridgeProgramConfigurations.upload(t45), this.tunnelProgramConfigurations.upload(t45)); } destroy() { this.vertexBuffer && (this.vertexBuffer.destroy(), this.vertexBufferNormal.destroy(), this.indexBuffer.destroy()), this.maskSegments && (this.maskSegments.destroy(), this.depthSegments.destroy(), this.renderableBridgeSegments.destroy(), this.renderableTunnelSegments.destroy(), this.shadowCasterSegments.destroy()), this.bridgeProgramConfigurations.destroy(), this.tunnelProgramConfigurations.destroy(); } populatePaintArrays(t45, e57, r86, n45, i26) { const s18 = (s19, o88) => { for (let a46 = 0; a46 < o88.length - 1; a46++) { const l21 = o88[a46].featureIndex, u12 = o88[a46 + 1].vertexStart, c28 = t45.feature(l21); s19.populatePaintArrays(u12, c28, l21, {}, r86, e57, n45, void 0, i26); } }; s18(this.bridgeProgramConfigurations, this.bridgeFeatureSections), s18(this.tunnelProgramConfigurations, this.tunnelFeatureSections); } computeVertexConnections(t45, e57, r86, n45, i26) { const s18 = /* @__PURE__ */ new Map(); for (let o88 = n45; o88 < i26; o88++) { const n46 = r86[o88], i27 = n46.a, a46 = n46.b, l21 = sp.computePosHash(t45[i27]), u12 = sp.computePosHash(t45[a46]); let c28 = s18.get(l21); c28 || (c28 = {}, s18.set(l21, c28)); let h8 = s18.get(u12); h8 || (h8 = {}, s18.set(u12, h8)), e57[i27] <= 0 && e57[a46] <= 0 || (c28.to = a46, h8.from = i27); } return s18; } isTerminalVertex(t45, e57) { const r86 = sp.computePosHash(this.unevalVertices[t45]), n45 = e57.get(r86); return !n45 || !n45.from || !n45.to; } constructBridgeStructures(t45, e57, r86, n45, i26, s18) { t45.clearVertexLookup(); const o88 = this.computeVertexConnections(e57, r86, n45, i26.min, i26.max), a46 = 1 / s18, l21 = 0.5 * a46, u12 = (t46, n46) => M4(t46, e57[n46].x, e57[n46].y, r86[n46] * a46), c28 = b7(), h8 = b7(), p9 = b7(), d34 = b7(), f8 = b7(), m6 = (t46, r87) => { const n46 = o88.get(sp.computePosHash(e57[r87])), i27 = n46.from, s19 = n46.to; if (!i27 || !s19) return; u12(c28, i27), u12(h8, r87), u12(p9, s19), j3(d34), $4(c28, h8) || (G4(f8, h8, c28), C5(d34, f8)), $4(p9, h8) || (G4(f8, p9, h8), I3(d34, d34, C5(f8, f8))); const a47 = q2(d34); return a47 > 0 ? E4(t46, d34, 1 / a47) : void 0; }; let y4 = Number.POSITIVE_INFINITY; this.sortSubarray(n45, i26.min, i26.max, ((t46, e58) => t46.featureInfo.featureIndex - e58.featureInfo.featureIndex)); const g9 = b7(), x4 = b7(), v8 = b7(), w4 = b7(), _4 = b7(), A4 = b7(), S5 = b7(), P4 = b7(), k7 = b7(), z4 = [b7(), b7(), b7(), b7()], T5 = [b7(), b7(), b7(), b7()], B6 = [{ coord: new wt(0, 0), height: 0 }, { coord: new wt(0, 0), height: 0 }], V4 = (t46, e58) => t46 > e58; for (let u13 = i26.min; u13 < i26.max; u13++) { const i27 = n45[u13]; if (!i27.featureInfo.guardRailEnabled) continue; if (!this.prepareEdgePoints(B6, e57, r86, i27, V4)) continue; const [c29, h9] = B6; if (M4(g9, c29.coord.x, c29.coord.y, a46 * c29.height), M4(x4, h9.coord.x, h9.coord.y, a46 * h9.height), $4(g9, x4)) continue; G4(v8, x4, g9), C5(v8, v8); const p10 = m6(P4, i27.a) || v8, d35 = m6(k7, i27.b) || v8; M4(w4, p10[1], -p10[0], 0), C5(w4, w4), M4(_4, d35[1], -d35[0], 0), C5(_4, _4), R4(P4, w4, p10), C5(A4, P4), R4(P4, _4, d35), C5(S5, P4), I3(z4[0], g9, E4(P4, G4(P4, w4, A4), l21)), I3(z4[1], g9, E4(P4, I3(P4, w4, A4), l21)), I3(z4[2], g9, E4(P4, A4, l21)), z4[3] = g9, I3(T5[0], x4, E4(P4, G4(P4, _4, S5), l21)), I3(T5[1], x4, E4(P4, I3(P4, _4, S5), l21)), I3(T5[2], x4, E4(P4, S5, l21)), T5[3] = x4, y4 = this.addFeatureSection(i27.featureInfo.featureIndex, y4, this.bridgeFeatureSections, t45); const f9 = t45.addVertex(z4[0], w4, s18), b8 = t45.addVertex(z4[1], w4, s18), D5 = t45.addVertex(T5[0], _4, s18), L3 = t45.addVertex(T5[1], _4, s18); t45.addTriangle(f9, b8, D5), t45.addTriangle(b8, L3, D5); const O4 = t45.addVertex(z4[1], A4, s18), U4 = t45.addVertex(z4[2], A4, s18), N5 = t45.addVertex(T5[1], S5, s18), j4 = t45.addVertex(T5[2], S5, s18); t45.addTriangle(O4, U4, N5), t45.addTriangle(U4, j4, N5), F16(w4, w4), F16(_4, _4); const H4 = t45.addVertex(z4[2], w4, s18), q3 = t45.addVertex(z4[3], w4, s18), X3 = t45.addVertex(T5[2], _4, s18), Z3 = t45.addVertex(T5[3], _4, s18); t45.addTriangle(H4, q3, X3), t45.addTriangle(q3, Z3, X3); const W4 = this.isTerminalVertex(i27.a, o88), Y6 = this.isTerminalVertex(i27.b, o88); c29.height < 0.01 && W4 && t45.addQuad(z4[3], z4[2], z4[1], z4[0], F16(p10, p10), s18), h9.height < 0.01 && Y6 && t45.addQuad(T5[0], T5[1], T5[2], T5[3], d35, s18); } this.bridgeFeatureSections.push({ featureIndex: Number.POSITIVE_INFINITY, vertexStart: t45.getVertexCount() }); } constructTunnelStructures(t45, e57, r86, n45, i26, s18) { t45.clearVertexLookup(); let o88 = Number.POSITIVE_INFINITY; const a46 = (t46, e58) => t46.featureInfo.featureIndex - e58.featureInfo.featureIndex; this.sortSubarray(n45, i26.min, i26.max, a46), this.sortSubarray(n45, s18.min, s18.max, a46); const l21 = (t46) => C5(t46, t46), u12 = [{ coord: new wt(0, 0), height: 0 }, { coord: new wt(0, 0), height: 0 }], c28 = (t46, e58) => t46 < e58, h8 = b7(), p9 = b7(), d34 = b7(), f8 = b7(), m6 = b7(); for (let s19 = i26.min; s19 < i26.max; s19++) { if (!this.prepareEdgePoints(u12, e57, r86, n45[s19], c28)) continue; const [i27, a47] = u12, y4 = l21(M4(m6, -(a47.coord.y - i27.coord.y), a47.coord.x - i27.coord.x, 0)); o88 = this.addFeatureSection(n45[s19].featureInfo.featureIndex, o88, this.tunnelFeatureSections, t45), t45.addQuad(M4(h8, i27.coord.x, i27.coord.y, i27.height), M4(p9, a47.coord.x, a47.coord.y, a47.height), M4(d34, a47.coord.x, a47.coord.y, n45[s19].isTunnel ? -0.1 : 0), M4(f8, i27.coord.x, i27.coord.y, n45[s19].isTunnel ? -0.1 : 0), y4); } for (let i27 = s18.min; i27 < s18.max; i27++) { const s19 = n45[i27]; s19.isTunnel && ([s19.a, s19.b] = [s19.b, s19.a]); const a47 = e57[s19.a], u13 = e57[s19.b], c29 = l21(M4(m6, -(u13.y - a47.y), u13.x - a47.x, 0)); o88 = this.addFeatureSection(s19.featureInfo.featureIndex, o88, this.tunnelFeatureSections, t45), t45.addQuad(M4(h8, u13.x, u13.y, 0), M4(p9, a47.x, a47.y, 0), M4(d34, a47.x, a47.y, r86[s19.a] + 4), M4(f8, u13.x, u13.y, r86[s19.b] + 4), c29), t45.addQuad(M4(h8, a47.x, a47.y, 0), M4(p9, u13.x, u13.y, 0), M4(d34, u13.x, u13.y, r86[s19.b] + 4), M4(f8, a47.x, a47.y, r86[s19.a] + 4), c29); } this.tunnelFeatureSections.push({ featureIndex: Number.POSITIVE_INFINITY, vertexStart: t45.getVertexCount() }); } setElevatedPoint(t45, e57, r86, n45) { t45.coord.x = e57, t45.coord.y = r86, t45.height = n45; } prepareEdgePoints(t45, e57, r86, n45, i26) { let s18 = e57[n45.a].x, o88 = e57[n45.a].y, a46 = e57[n45.b].x, l21 = e57[n45.b].y, u12 = r86[n45.a], c28 = r86[n45.b]; const h8 = i26(u12, 0), p9 = i26(c28, 0); if (h8 && p9) return this.setElevatedPoint(t45[0], s18, o88, u12), this.setElevatedPoint(t45[1], a46, l21, c28), true; if (!h8 && !p9) return false; if (h8) { if (!p9) { const t46 = c28 / (c28 - u12); a46 = ur(a46, s18, t46), l21 = ur(l21, o88, t46), c28 = ur(c28, u12, t46); } } else { const t46 = u12 / (u12 - c28); s18 = ur(s18, a46, t46), o88 = ur(o88, l21, t46), u12 = ur(u12, c28, t46); } return this.setElevatedPoint(t45[0], s18, o88, u12), this.setElevatedPoint(t45[1], a46, l21, c28), true; } prepareEdges(t45, e57) { if (0 === e57.length) return; e57.sort(((t46, e58) => t46.hash === e58.hash ? e58.polygonIdx - t46.polygonIdx : e58.hash > t46.hash ? 1 : -1)); let r86 = 0, n45 = 0, i26 = 0, s18 = e57[r86].polygonIdx; do { n45++, (n45 === e57.length || e57[r86].hash !== e57[n45].hash) && ((1 == n45 - r86 || e57[n45 - 1].polygonIdx !== s18) && (i26 < r86 && (e57[i26] = e57[r86], e57[r86] = null), e57[i26].type = "none", i26++), r86 = n45, r86 !== e57.length && (s18 = e57[r86].polygonIdx)); } while (r86 !== e57.length); if (e57.splice(i26), 0 !== e57.length && 0 !== t45.length) { e57.sort(((t46, e58) => t46.portalHash < e58.portalHash ? 1 : -1)); let r87 = 0, n46 = 0; for (; r87 !== e57.length && n46 !== t45.length; ) { const i27 = e57[r87], s19 = t45[n46]; i27.portalHash > s19.hash ? r87++ : s19.hash > i27.portalHash ? n46++ : (i27.type = s19.type, r87++); } } } isOnBorder(t45, e57) { return t45 <= 0 && e57 <= 0 || t45 >= Rn && e57 >= Rn; } addFeatureSection(t45, e57, r86, n45) { return t45 !== e57 && (e57 = t45, r86.push({ featureIndex: t45, vertexStart: n45.getVertexCount() }), n45.clearVertexLookup()), e57; } sortSubarray(t45, e57, r86, n45) { const i26 = t45.slice(e57, r86); i26.sort(n45), t45.splice(e57, i26.length, ...i26); } static computeEdgeHash(t45, e57) { return (t45.y === e57.y && t45.x > e57.x || t45.y > e57.y) && ([t45, e57] = [e57, t45]), BigInt(sp.computePosHash(t45)) << 32n | BigInt(sp.computePosHash(e57)); } static computePosHash(t45) { return ((65535 & t45.x) << 16 | 65535 & t45.y) >>> 0; } } var op, ap = { exports: {} }, lp = (op || (op = 1, (function(t45, e57) { !(function(t46) { function e58(t47, e59) { return t47 > e59 ? 1 : t47 < e59 ? -1 : 0; } var r86 = function(t47, r87) { void 0 === t47 && (t47 = e58), void 0 === r87 && (r87 = false), this._compare = t47, this._root = null, this._size = 0, this._noDuplicates = !!r87; }, n45 = { size: { configurable: true } }; function i26(t47, e59, r87, n46, s19) { var o89 = s19 - n46; if (o89 > 0) { var a47 = n46 + Math.floor(o89 / 2), l22 = { key: e59[a47], data: r87[a47], parent: t47 }; return l22.left = i26(l22, e59, r87, n46, a47), l22.right = i26(l22, e59, r87, a47 + 1, s19), l22; } return null; } function s18(t47, e59, r87, n46, i27) { if (!(r87 >= n46)) { for (var o89 = t47[r87 + n46 >> 1], a47 = r87 - 1, l22 = n46 + 1; ; ) { do { a47++; } while (i27(t47[a47], o89) < 0); do { l22--; } while (i27(t47[l22], o89) > 0); if (a47 >= l22) break; var u13 = t47[a47]; t47[a47] = t47[l22], t47[l22] = u13, u13 = e59[a47], e59[a47] = e59[l22], e59[l22] = u13; } s18(t47, e59, r87, l22, i27), s18(t47, e59, l22 + 1, n46, i27); } } r86.prototype.rotateLeft = function(t47) { var e59 = t47.right; e59 && (t47.right = e59.left, e59.left && (e59.left.parent = t47), e59.parent = t47.parent), t47.parent ? t47 === t47.parent.left ? t47.parent.left = e59 : t47.parent.right = e59 : this._root = e59, e59 && (e59.left = t47), t47.parent = e59; }, r86.prototype.rotateRight = function(t47) { var e59 = t47.left; e59 && (t47.left = e59.right, e59.right && (e59.right.parent = t47), e59.parent = t47.parent), t47.parent ? t47 === t47.parent.left ? t47.parent.left = e59 : t47.parent.right = e59 : this._root = e59, e59 && (e59.right = t47), t47.parent = e59; }, r86.prototype._splay = function(t47) { for (; t47.parent; ) { var e59 = t47.parent; e59.parent ? e59.left === t47 && e59.parent.left === e59 ? (this.rotateRight(e59.parent), this.rotateRight(e59)) : e59.right === t47 && e59.parent.right === e59 ? (this.rotateLeft(e59.parent), this.rotateLeft(e59)) : e59.left === t47 && e59.parent.right === e59 ? (this.rotateRight(e59), this.rotateLeft(e59)) : (this.rotateLeft(e59), this.rotateRight(e59)) : e59.left === t47 ? this.rotateRight(e59) : this.rotateLeft(e59); } }, r86.prototype.splay = function(t47) { for (var e59, r87, n46, i27, s19; t47.parent; ) (r87 = (e59 = t47.parent).parent) && r87.parent ? ((n46 = r87.parent).left === r87 ? n46.left = t47 : n46.right = t47, t47.parent = n46) : (t47.parent = null, this._root = t47), i27 = t47.left, s19 = t47.right, t47 === e59.left ? (r87 && (r87.left === e59 ? (e59.right ? (r87.left = e59.right, r87.left.parent = r87) : r87.left = null, e59.right = r87, r87.parent = e59) : (i27 ? (r87.right = i27, i27.parent = r87) : r87.right = null, t47.left = r87, r87.parent = t47)), s19 ? (e59.left = s19, s19.parent = e59) : e59.left = null, t47.right = e59, e59.parent = t47) : (r87 && (r87.right === e59 ? (e59.left ? (r87.right = e59.left, r87.right.parent = r87) : r87.right = null, e59.left = r87, r87.parent = e59) : (s19 ? (r87.left = s19, s19.parent = r87) : r87.left = null, t47.right = r87, r87.parent = t47)), i27 ? (e59.right = i27, i27.parent = e59) : e59.right = null, t47.left = e59, e59.parent = t47); }, r86.prototype.replace = function(t47, e59) { t47.parent ? t47 === t47.parent.left ? t47.parent.left = e59 : t47.parent.right = e59 : this._root = e59, e59 && (e59.parent = t47.parent); }, r86.prototype.minNode = function(t47) { if (void 0 === t47 && (t47 = this._root), t47) for (; t47.left; ) t47 = t47.left; return t47; }, r86.prototype.maxNode = function(t47) { if (void 0 === t47 && (t47 = this._root), t47) for (; t47.right; ) t47 = t47.right; return t47; }, r86.prototype.insert = function(t47, e59) { var r87 = this._root, n46 = null, i27 = this._compare; if (this._noDuplicates) for (; r87; ) { if (n46 = r87, 0 === i27(r87.key, t47)) return; r87 = i27(r87.key, t47) < 0 ? r87.right : r87.left; } else for (; r87; ) n46 = r87, r87 = i27(r87.key, t47) < 0 ? r87.right : r87.left; return r87 = { key: t47, data: e59, left: null, right: null, parent: n46 }, n46 ? i27(n46.key, r87.key) < 0 ? n46.right = r87 : n46.left = r87 : this._root = r87, this.splay(r87), this._size++, r87; }, r86.prototype.find = function(t47) { for (var e59 = this._root, r87 = this._compare; e59; ) { var n46 = r87(e59.key, t47); if (n46 < 0) e59 = e59.right; else { if (!(n46 > 0)) return e59; e59 = e59.left; } } return null; }, r86.prototype.contains = function(t47) { for (var e59 = this._root, r87 = this._compare; e59; ) { var n46 = r87(t47, e59.key); if (0 === n46) return true; e59 = n46 < 0 ? e59.left : e59.right; } return false; }, r86.prototype.remove = function(t47) { var e59 = this.find(t47); if (!e59) return false; if (this.splay(e59), e59.left) if (e59.right) { var r87 = this.minNode(e59.right); r87.parent !== e59 && (this.replace(r87, r87.right), r87.right = e59.right, r87.right.parent = r87), this.replace(e59, r87), r87.left = e59.left, r87.left.parent = r87; } else this.replace(e59, e59.left); else this.replace(e59, e59.right); return this._size--, true; }, r86.prototype.removeNode = function(t47) { if (!t47) return false; if (this.splay(t47), t47.left) if (t47.right) { var e59 = this.minNode(t47.right); e59.parent !== t47 && (this.replace(e59, e59.right), e59.right = t47.right, e59.right.parent = e59), this.replace(t47, e59), e59.left = t47.left, e59.left.parent = e59; } else this.replace(t47, t47.left); else this.replace(t47, t47.right); return this._size--, true; }, r86.prototype.erase = function(t47) { var e59 = this.find(t47); if (e59) { this.splay(e59); var r87 = e59.left, n46 = e59.right, i27 = null; r87 && (r87.parent = null, i27 = this.maxNode(r87), this.splay(i27), this._root = i27), n46 && (r87 ? i27.right = n46 : this._root = n46, n46.parent = i27), this._size--; } }, r86.prototype.pop = function() { var t47 = this._root, e59 = null; if (t47) { for (; t47.left; ) t47 = t47.left; e59 = { key: t47.key, data: t47.data }, this.remove(t47.key); } return e59; }, r86.prototype.next = function(t47) { var e59 = t47; if (e59) if (e59.right) for (e59 = e59.right; e59 && e59.left; ) e59 = e59.left; else for (e59 = t47.parent; e59 && e59.right === t47; ) t47 = e59, e59 = e59.parent; return e59; }, r86.prototype.prev = function(t47) { var e59 = t47; if (e59) if (e59.left) for (e59 = e59.left; e59 && e59.right; ) e59 = e59.right; else for (e59 = t47.parent; e59 && e59.left === t47; ) t47 = e59, e59 = e59.parent; return e59; }, r86.prototype.forEach = function(t47) { for (var e59 = this._root, r87 = [], n46 = false, i27 = 0; !n46; ) e59 ? (r87.push(e59), e59 = e59.left) : r87.length > 0 ? (t47(e59 = r87.pop(), i27++), e59 = e59.right) : n46 = true; return this; }, r86.prototype.range = function(t47, e59, r87, n46) { for (var i27 = [], s19 = this._compare, o89 = this._root; 0 !== i27.length || o89; ) if (o89) i27.push(o89), o89 = o89.left; else { if (s19((o89 = i27.pop()).key, e59) > 0) break; if (s19(o89.key, t47) >= 0 && r87.call(n46, o89)) return this; o89 = o89.right; } return this; }, r86.prototype.keys = function() { for (var t47 = this._root, e59 = [], r87 = [], n46 = false; !n46; ) t47 ? (e59.push(t47), t47 = t47.left) : e59.length > 0 ? (t47 = e59.pop(), r87.push(t47.key), t47 = t47.right) : n46 = true; return r87; }, r86.prototype.values = function() { for (var t47 = this._root, e59 = [], r87 = [], n46 = false; !n46; ) t47 ? (e59.push(t47), t47 = t47.left) : e59.length > 0 ? (t47 = e59.pop(), r87.push(t47.data), t47 = t47.right) : n46 = true; return r87; }, r86.prototype.at = function(t47) { for (var e59 = this._root, r87 = [], n46 = false, i27 = 0; !n46; ) if (e59) r87.push(e59), e59 = e59.left; else if (r87.length > 0) { if (e59 = r87.pop(), i27 === t47) return e59; i27++, e59 = e59.right; } else n46 = true; return null; }, r86.prototype.load = function(t47, e59, r87) { if (void 0 === t47 && (t47 = []), void 0 === e59 && (e59 = []), void 0 === r87 && (r87 = false), 0 !== this._size) throw new Error("bulk-load: tree is not empty"); var n46 = t47.length; return r87 && s18(t47, e59, 0, n46 - 1, this._compare), this._root = i26(null, t47, e59, 0, n46), this._size = n46, this; }, r86.prototype.min = function() { var t47 = this.minNode(this._root); return t47 ? t47.key : null; }, r86.prototype.max = function() { var t47 = this.maxNode(this._root); return t47 ? t47.key : null; }, r86.prototype.isEmpty = function() { return null === this._root; }, n45.size.get = function() { return this._size; }, r86.createTree = function(t47, e59, n46, i27, s19) { return new r86(n46, s19).load(t47, e59, i27); }, Object.defineProperties(r86.prototype, n45); var o88 = 0, a46 = 1, l21 = 2, u12 = 3, c28 = 0, h8 = 1, p9 = 2, d34 = 3; function f8(t47, e59, r87) { null === e59 ? (t47.inOut = false, t47.otherInOut = true) : (t47.isSubject === e59.isSubject ? (t47.inOut = !e59.inOut, t47.otherInOut = e59.otherInOut) : (t47.inOut = !e59.otherInOut, t47.otherInOut = e59.isVertical() ? !e59.inOut : e59.inOut), e59 && (t47.prevInResult = !m6(e59, r87) || e59.isVertical() ? e59.prevInResult : e59)); var n46 = m6(t47, r87); t47.resultTransition = n46 ? (function(t48, e60) { var r88, n47 = !t48.inOut, i27 = !t48.otherInOut; switch (e60) { case c28: r88 = n47 && i27; break; case h8: r88 = n47 || i27; break; case d34: r88 = n47 ^ i27; break; case p9: r88 = t48.isSubject ? n47 && !i27 : i27 && !n47; } return r88 ? 1 : -1; })(t47, r87) : 0; } function m6(t47, e59) { switch (t47.type) { case o88: switch (e59) { case c28: return !t47.otherInOut; case h8: return t47.otherInOut; case p9: return t47.isSubject && t47.otherInOut || !t47.isSubject && !t47.otherInOut; case d34: return true; } break; case l21: return e59 === c28 || e59 === h8; case u12: return e59 === p9; case a46: return false; } return false; } var y4 = function(t47, e59, r87, n46, i27) { this.left = e59, this.point = t47, this.otherEvent = r87, this.isSubject = n46, this.type = i27 || o88, this.inOut = false, this.otherInOut = false, this.prevInResult = null, this.resultTransition = 0, this.otherPos = -1, this.outputContourId = -1, this.isExteriorRing = true; }, g9 = { inResult: { configurable: true } }; function x4(t47, e59) { return t47[0] === e59[0] && t47[1] === e59[1]; } y4.prototype.isBelow = function(t47) { var e59 = this.point, r87 = this.otherEvent.point; return this.left ? (e59[0] - t47[0]) * (r87[1] - t47[1]) - (r87[0] - t47[0]) * (e59[1] - t47[1]) > 0 : (r87[0] - t47[0]) * (e59[1] - t47[1]) - (e59[0] - t47[0]) * (r87[1] - t47[1]) > 0; }, y4.prototype.isAbove = function(t47) { return !this.isBelow(t47); }, y4.prototype.isVertical = function() { return this.point[0] === this.otherEvent.point[0]; }, g9.inResult.get = function() { return 0 !== this.resultTransition; }, y4.prototype.clone = function() { var t47 = new y4(this.point, this.left, this.otherEvent, this.isSubject, this.type); return t47.contourId = this.contourId, t47.resultTransition = this.resultTransition, t47.prevInResult = this.prevInResult, t47.isExteriorRing = this.isExteriorRing, t47.inOut = this.inOut, t47.otherInOut = this.otherInOut, t47; }, Object.defineProperties(y4.prototype, g9); var v8 = 11102230246251565e-32, b8 = 134217729, w4 = (3 + 8 * v8) * v8; function _4(t47, e59, r87, n46, i27) { var s19, o89, a47, l22, u13 = e59[0], c29 = n46[0], h9 = 0, p10 = 0; c29 > u13 == c29 > -u13 ? (s19 = u13, u13 = e59[++h9]) : (s19 = c29, c29 = n46[++p10]); var d35 = 0; if (h9 < t47 && p10 < r87) for (c29 > u13 == c29 > -u13 ? (a47 = s19 - ((o89 = u13 + s19) - u13), u13 = e59[++h9]) : (a47 = s19 - ((o89 = c29 + s19) - c29), c29 = n46[++p10]), s19 = o89, 0 !== a47 && (i27[d35++] = a47); h9 < t47 && p10 < r87; ) c29 > u13 == c29 > -u13 ? (a47 = s19 - ((o89 = s19 + u13) - (l22 = o89 - s19)) + (u13 - l22), u13 = e59[++h9]) : (a47 = s19 - ((o89 = s19 + c29) - (l22 = o89 - s19)) + (c29 - l22), c29 = n46[++p10]), s19 = o89, 0 !== a47 && (i27[d35++] = a47); for (; h9 < t47; ) a47 = s19 - ((o89 = s19 + u13) - (l22 = o89 - s19)) + (u13 - l22), u13 = e59[++h9], s19 = o89, 0 !== a47 && (i27[d35++] = a47); for (; p10 < r87; ) a47 = s19 - ((o89 = s19 + c29) - (l22 = o89 - s19)) + (c29 - l22), c29 = n46[++p10], s19 = o89, 0 !== a47 && (i27[d35++] = a47); return 0 === s19 && 0 !== d35 || (i27[d35++] = s19), d35; } function A4(t47) { return new Float64Array(t47); } var M5 = 33306690738754716e-32, I4 = 22204460492503146e-32, S5 = 11093356479670487e-47, P4 = A4(4), k7 = A4(8), z4 = A4(12), E5 = A4(16), T5 = A4(4); function B6(t47, e59, r87) { var n46 = (function(t48, e60, r88, n47, i27, s19) { var o89 = (e60 - s19) * (r88 - i27), a47 = (t48 - i27) * (n47 - s19), l22 = o89 - a47; if (0 === o89 || 0 === a47 || o89 > 0 != a47 > 0) return l22; var u13 = Math.abs(o89 + a47); return Math.abs(l22) >= M5 * u13 ? l22 : -(function(t49, e61, r89, n48, i28, s20, o90) { var a48, l23, u14, c29, h9, p10, d35, f9, m7, y5, g10, x5, v9, A5, M6, B7, V5, F18, C7 = t49 - i28, D6 = r89 - i28, R6 = e61 - s20, L4 = n48 - s20; P4[0] = (M6 = (f9 = C7 - (d35 = (p10 = b8 * C7) - (p10 - C7))) * (y5 = L4 - (m7 = (p10 = b8 * L4) - (p10 - L4))) - ((A5 = C7 * L4) - d35 * m7 - f9 * m7 - d35 * y5)) - ((g10 = M6 - (V5 = (f9 = R6 - (d35 = (p10 = b8 * R6) - (p10 - R6))) * (y5 = D6 - (m7 = (p10 = b8 * D6) - (p10 - D6))) - ((B7 = R6 * D6) - d35 * m7 - f9 * m7 - d35 * y5))) + (h9 = M6 - g10)) + (h9 - V5), P4[1] = (v9 = A5 - ((x5 = A5 + g10) - (h9 = x5 - A5)) + (g10 - h9)) - ((g10 = v9 - B7) + (h9 = v9 - g10)) + (h9 - B7), P4[2] = x5 - ((F18 = x5 + g10) - (h9 = F18 - x5)) + (g10 - h9), P4[3] = F18; var O5 = (function(t50, e62) { for (var r90 = e62[0], n49 = 1; n49 < 4; n49++) r90 += e62[n49]; return r90; })(0, P4), U5 = I4 * o90; if (O5 >= U5 || -O5 >= U5) return O5; if (a48 = t49 - (C7 + (h9 = t49 - C7)) + (h9 - i28), u14 = r89 - (D6 + (h9 = r89 - D6)) + (h9 - i28), l23 = e61 - (R6 + (h9 = e61 - R6)) + (h9 - s20), c29 = n48 - (L4 + (h9 = n48 - L4)) + (h9 - s20), 0 === a48 && 0 === l23 && 0 === u14 && 0 === c29) return O5; if (U5 = S5 * o90 + w4 * Math.abs(O5), (O5 += C7 * c29 + L4 * a48 - (R6 * u14 + D6 * l23)) >= U5 || -O5 >= U5) return O5; T5[0] = (M6 = (f9 = a48 - (d35 = (p10 = b8 * a48) - (p10 - a48))) * (y5 = L4 - (m7 = (p10 = b8 * L4) - (p10 - L4))) - ((A5 = a48 * L4) - d35 * m7 - f9 * m7 - d35 * y5)) - ((g10 = M6 - (V5 = (f9 = l23 - (d35 = (p10 = b8 * l23) - (p10 - l23))) * (y5 = D6 - (m7 = (p10 = b8 * D6) - (p10 - D6))) - ((B7 = l23 * D6) - d35 * m7 - f9 * m7 - d35 * y5))) + (h9 = M6 - g10)) + (h9 - V5), T5[1] = (v9 = A5 - ((x5 = A5 + g10) - (h9 = x5 - A5)) + (g10 - h9)) - ((g10 = v9 - B7) + (h9 = v9 - g10)) + (h9 - B7), T5[2] = x5 - ((F18 = x5 + g10) - (h9 = F18 - x5)) + (g10 - h9), T5[3] = F18; var N6 = _4(4, P4, 4, T5, k7); T5[0] = (M6 = (f9 = C7 - (d35 = (p10 = b8 * C7) - (p10 - C7))) * (y5 = c29 - (m7 = (p10 = b8 * c29) - (p10 - c29))) - ((A5 = C7 * c29) - d35 * m7 - f9 * m7 - d35 * y5)) - ((g10 = M6 - (V5 = (f9 = R6 - (d35 = (p10 = b8 * R6) - (p10 - R6))) * (y5 = u14 - (m7 = (p10 = b8 * u14) - (p10 - u14))) - ((B7 = R6 * u14) - d35 * m7 - f9 * m7 - d35 * y5))) + (h9 = M6 - g10)) + (h9 - V5), T5[1] = (v9 = A5 - ((x5 = A5 + g10) - (h9 = x5 - A5)) + (g10 - h9)) - ((g10 = v9 - B7) + (h9 = v9 - g10)) + (h9 - B7), T5[2] = x5 - ((F18 = x5 + g10) - (h9 = F18 - x5)) + (g10 - h9), T5[3] = F18; var j5 = _4(N6, k7, 4, T5, z4); T5[0] = (M6 = (f9 = a48 - (d35 = (p10 = b8 * a48) - (p10 - a48))) * (y5 = c29 - (m7 = (p10 = b8 * c29) - (p10 - c29))) - ((A5 = a48 * c29) - d35 * m7 - f9 * m7 - d35 * y5)) - ((g10 = M6 - (V5 = (f9 = l23 - (d35 = (p10 = b8 * l23) - (p10 - l23))) * (y5 = u14 - (m7 = (p10 = b8 * u14) - (p10 - u14))) - ((B7 = l23 * u14) - d35 * m7 - f9 * m7 - d35 * y5))) + (h9 = M6 - g10)) + (h9 - V5), T5[1] = (v9 = A5 - ((x5 = A5 + g10) - (h9 = x5 - A5)) + (g10 - h9)) - ((g10 = v9 - B7) + (h9 = v9 - g10)) + (h9 - B7), T5[2] = x5 - ((F18 = x5 + g10) - (h9 = F18 - x5)) + (g10 - h9), T5[3] = F18; var $6 = _4(j5, z4, 4, T5, E5); return E5[$6 - 1]; })(t48, e60, r88, n47, i27, s19, u13); })(t47[0], t47[1], e59[0], e59[1], r87[0], r87[1]); return n46 > 0 ? -1 : n46 < 0 ? 1 : 0; } function V4(t47, e59) { var r87 = t47.point, n46 = e59.point; return r87[0] > n46[0] ? 1 : r87[0] < n46[0] ? -1 : r87[1] !== n46[1] ? r87[1] > n46[1] ? 1 : -1 : (function(t48, e60, r88, n47) { return t48.left !== e60.left ? t48.left ? 1 : -1 : 0 !== B6(r88, t48.otherEvent.point, e60.otherEvent.point) ? t48.isBelow(e60.otherEvent.point) ? -1 : 1 : !t48.isSubject && e60.isSubject ? 1 : -1; })(t47, e59, r87); } function F17(t47, e59, r87) { var n46 = new y4(e59, false, t47, t47.isSubject), i27 = new y4(e59, true, t47.otherEvent, t47.isSubject); return x4(t47.point, t47.otherEvent.point) && console.warn("what is that, a collapsed segment?", t47), n46.contourId = i27.contourId = t47.contourId, V4(i27, t47.otherEvent) > 0 && (t47.otherEvent.left = true, i27.left = false), t47.otherEvent.otherEvent = i27, t47.otherEvent = n46, r87.push(i27), r87.push(n46), r87; } function C6(t47, e59) { return t47[0] * e59[1] - t47[1] * e59[0]; } function D5(t47, e59) { return t47[0] * e59[0] + t47[1] * e59[1]; } function R5(t47, e59, r87) { var n46 = (function(t48, e60, r88, n47, i28) { var s20 = [e60[0] - t48[0], e60[1] - t48[1]], o90 = [n47[0] - r88[0], n47[1] - r88[1]]; function a47(t49, e61, r89) { return [t49[0] + e61 * r89[0], t49[1] + e61 * r89[1]]; } var l22 = [r88[0] - t48[0], r88[1] - t48[1]], u13 = C6(s20, o90), c30 = u13 * u13, h9 = D5(s20, s20); if (c30 > 0) { var p10 = C6(l22, o90) / u13; if (p10 < 0 || p10 > 1) return null; var d35 = C6(l22, s20) / u13; return d35 < 0 || d35 > 1 ? null : 0 === p10 || 1 === p10 ? [a47(t48, p10, s20)] : 0 === d35 || 1 === d35 ? [a47(r88, d35, o90)] : [a47(t48, p10, s20)]; } if ((c30 = (u13 = C6(l22, s20)) * u13) > 0) return null; var f9 = D5(s20, l22) / h9, m7 = f9 + D5(s20, o90) / h9, y5 = Math.min(f9, m7), g10 = Math.max(f9, m7); return y5 <= 1 && g10 >= 0 ? 1 === y5 ? [a47(t48, y5 > 0 ? y5 : 0, s20)] : 0 === g10 ? [a47(t48, g10 < 1 ? g10 : 1, s20)] : [a47(t48, y5 > 0 ? y5 : 0, s20), a47(t48, g10 < 1 ? g10 : 1, s20)] : null; })(t47.point, t47.otherEvent.point, e59.point, e59.otherEvent.point), i27 = n46 ? n46.length : 0; if (0 === i27) return 0; if (1 === i27 && (x4(t47.point, e59.point) || x4(t47.otherEvent.point, e59.otherEvent.point))) return 0; if (2 === i27 && t47.isSubject === e59.isSubject) return 0; if (1 === i27) return x4(t47.point, n46[0]) || x4(t47.otherEvent.point, n46[0]) || F17(t47, n46[0], r87), x4(e59.point, n46[0]) || x4(e59.otherEvent.point, n46[0]) || F17(e59, n46[0], r87), 1; var s19 = [], o89 = false, c29 = false; return x4(t47.point, e59.point) ? o89 = true : 1 === V4(t47, e59) ? s19.push(e59, t47) : s19.push(t47, e59), x4(t47.otherEvent.point, e59.otherEvent.point) ? c29 = true : 1 === V4(t47.otherEvent, e59.otherEvent) ? s19.push(e59.otherEvent, t47.otherEvent) : s19.push(t47.otherEvent, e59.otherEvent), o89 && c29 || o89 ? (e59.type = a46, t47.type = e59.inOut === t47.inOut ? l21 : u12, o89 && !c29 && F17(s19[1].otherEvent, s19[0].point, r87), 2) : c29 ? (F17(s19[0], s19[1].point, r87), 3) : s19[0] !== s19[3].otherEvent ? (F17(s19[0], s19[1].point, r87), F17(s19[1], s19[2].point, r87), 3) : (F17(s19[0], s19[1].point, r87), F17(s19[3].otherEvent, s19[2].point, r87), 3); } function L3(t47, e59) { if (t47 === e59) return 0; if (0 !== B6(t47.point, t47.otherEvent.point, e59.point) || 0 !== B6(t47.point, t47.otherEvent.point, e59.otherEvent.point)) return x4(t47.point, e59.point) ? t47.isBelow(e59.otherEvent.point) ? -1 : 1 : t47.point[0] === e59.point[0] ? t47.point[1] < e59.point[1] ? -1 : 1 : 1 === V4(t47, e59) ? e59.isAbove(t47.point) ? -1 : 1 : t47.isBelow(e59.point) ? -1 : 1; if (t47.isSubject !== e59.isSubject) return t47.isSubject ? -1 : 1; var r87 = t47.point, n46 = e59.point; return r87[0] === n46[0] && r87[1] === n46[1] ? (r87 = t47.otherEvent.point)[0] === (n46 = e59.otherEvent.point)[0] && r87[1] === n46[1] ? 0 : t47.contourId > e59.contourId ? 1 : -1 : 1 === V4(t47, e59) ? 1 : -1; } var O4 = function() { this.points = [], this.holeIds = [], this.holeOf = null, this.depth = null; }; function U4(t47, e59, r87, n46) { var i27, s19 = t47 + 1, o89 = e59[t47].point, a47 = e59.length; for (s19 < a47 && (i27 = e59[s19].point); s19 < a47 && i27[0] === o89[0] && i27[1] === o89[1]; ) { if (!r87[s19]) return s19; ++s19 < a47 && (i27 = e59[s19].point); } for (s19 = t47 - 1; r87[s19] && s19 > n46; ) s19--; return s19; } O4.prototype.isExterior = function() { return null == this.holeOf; }; var N5 = $5, j4 = $5; function $5(t47, e59) { if (!(this instanceof $5)) return new $5(t47, e59); if (this.data = t47 || [], this.length = this.data.length, this.compare = e59 || G5, this.length > 0) for (var r87 = (this.length >> 1) - 1; r87 >= 0; r87--) this._down(r87); } function G5(t47, e59) { return t47 < e59 ? -1 : t47 > e59 ? 1 : 0; } $5.prototype = { push: function(t47) { this.data.push(t47), this.length++, this._up(this.length - 1); }, pop: function() { if (0 !== this.length) { var t47 = this.data[0]; return this.length--, this.length > 0 && (this.data[0] = this.data[this.length], this._down(0)), this.data.pop(), t47; } }, peek: function() { return this.data[0]; }, _up: function(t47) { for (var e59 = this.data, r87 = this.compare, n46 = e59[t47]; t47 > 0; ) { var i27 = t47 - 1 >> 1, s19 = e59[i27]; if (r87(n46, s19) >= 0) break; e59[t47] = s19, t47 = i27; } e59[t47] = n46; }, _down: function(t47) { for (var e59 = this.data, r87 = this.compare, n46 = this.length >> 1, i27 = e59[t47]; t47 < n46; ) { var s19 = 1 + (t47 << 1), o89 = s19 + 1, a47 = e59[s19]; if (o89 < this.length && r87(e59[o89], a47) < 0 && (s19 = o89, a47 = e59[o89]), r87(a47, i27) >= 0) break; e59[t47] = a47, t47 = s19; } e59[t47] = i27; } }, N5.default = j4; var H4 = Math.max, q3 = Math.min, X3 = 0; function Z3(t47, e59, r87, n46, i27, s19) { var o89, a47, l22, u13, c29, h9; for (o89 = 0, a47 = t47.length - 1; o89 < a47; o89++) if (u13 = t47[o89 + 1], c29 = new y4(l22 = t47[o89], false, void 0, e59), h9 = new y4(u13, false, c29, e59), c29.otherEvent = h9, l22[0] !== u13[0] || l22[1] !== u13[1]) { c29.contourId = h9.contourId = r87, s19 || (c29.isExteriorRing = false, h9.isExteriorRing = false), V4(c29, h9) > 0 ? h9.left = true : c29.left = true; var p10 = l22[0], d35 = l22[1]; i27[0] = q3(i27[0], p10), i27[1] = q3(i27[1], d35), i27[2] = H4(i27[2], p10), i27[3] = H4(i27[3], d35), n46.push(c29), n46.push(h9); } } var W4 = []; function Y6(t47, e59, n46) { "number" == typeof t47[0][0][0] && (t47 = [t47]), "number" == typeof e59[0][0][0] && (e59 = [e59]); var i27 = (function(t48, e60, r87) { var n47 = null; return t48.length * e60.length == 0 && (r87 === c28 ? n47 = W4 : r87 === p9 ? n47 = t48 : r87 !== h8 && r87 !== d34 || (n47 = 0 === t48.length ? e60 : t48)), n47; })(t47, e59, n46); if (i27) return i27 === W4 ? null : i27; var s19 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], o89 = [1 / 0, 1 / 0, -1 / 0, -1 / 0], a47 = (function(t48, e60, r87, n47, i28) { var s20, o90, a48, l23, u14, c29, h9 = new N5(null, V4); for (a48 = 0, l23 = t48.length; a48 < l23; a48++) for (u14 = 0, c29 = (s20 = t48[a48]).length; u14 < c29; u14++) (o90 = 0 === u14) && X3++, Z3(s20[u14], true, X3, h9, r87, o90); for (a48 = 0, l23 = e60.length; a48 < l23; a48++) for (u14 = 0, c29 = (s20 = e60[a48]).length; u14 < c29; u14++) o90 = 0 === u14, i28 === p9 && (o90 = false), o90 && X3++, Z3(s20[u14], false, X3, h9, n47, o90); return h9; })(t47, e59, s19, o89, n46); if (i27 = (function(t48, e60, r87, n47, i28) { var s20 = null; return (r87[0] > n47[2] || n47[0] > r87[2] || r87[1] > n47[3] || n47[1] > r87[3]) && (i28 === c28 ? s20 = W4 : i28 === p9 ? s20 = t48 : i28 !== h8 && i28 !== d34 || (s20 = t48.concat(e60))), s20; })(t47, e59, s19, o89, n46)) return i27 === W4 ? null : i27; for (var l22 = (function(t48) { var e60, r87, n47 = (function(t49) { var e61, r88, n48, i29, s21 = []; for (r88 = 0, n48 = t49.length; r88 < n48; r88++) ((e61 = t49[r88]).left && e61.inResult || !e61.left && e61.otherEvent.inResult) && s21.push(e61); for (var o91 = false; !o91; ) for (o91 = true, r88 = 0, n48 = s21.length; r88 < n48; r88++) r88 + 1 < n48 && 1 === V4(s21[r88], s21[r88 + 1]) && (i29 = s21[r88], s21[r88] = s21[r88 + 1], s21[r88 + 1] = i29, o91 = false); for (r88 = 0, n48 = s21.length; r88 < n48; r88++) (e61 = s21[r88]).otherPos = r88; for (r88 = 0, n48 = s21.length; r88 < n48; r88++) (e61 = s21[r88]).left || (i29 = e61.otherPos, e61.otherPos = e61.otherEvent.otherPos, e61.otherEvent.otherPos = i29); return s21; })(t48), i28 = {}, s20 = [], o90 = function() { if (!i28[e60]) { var t49 = s20.length, r88 = (function(t50, e61, r89) { var n48 = new O4(); if (null != t50.prevInResult) { var i29 = t50.prevInResult, s21 = i29.outputContourId; if (i29.resultTransition > 0) { var o92 = e61[s21]; if (null != o92.holeOf) { var a49 = o92.holeOf; e61[a49].holeIds.push(r89), n48.holeOf = a49, n48.depth = e61[s21].depth; } else e61[s21].holeIds.push(r89), n48.holeOf = s21, n48.depth = e61[s21].depth + 1; } else n48.holeOf = null, n48.depth = e61[s21].depth; } else n48.holeOf = null, n48.depth = 0; return n48; })(n47[e60], s20, t49), o91 = function(e61) { i28[e61] = true, e61 < n47.length && n47[e61] && (n47[e61].outputContourId = t49); }, a48 = e60, l23 = e60; for (r88.points.push(n47[e60].point); o91(a48), o91(a48 = n47[a48].otherPos), r88.points.push(n47[a48].point), !((a48 = U4(a48, n47, i28, l23)) == l23 || a48 >= n47.length) && n47[a48]; ) ; s20.push(r88); } }; for (e60 = 0, r87 = n47.length; e60 < r87; e60++) o90(); return s20; })((function(t48, e60, n47, i28, s20, o90) { for (var a48, l23, u14, h9 = new r86(L3), d35 = [], m8 = Math.min(i28[2], s20[2]); 0 !== t48.length; ) { var y6 = t48.pop(); if (d35.push(y6), o90 === c28 && y6.point[0] > m8 || o90 === p9 && y6.point[0] > i28[2]) break; if (y6.left) { l23 = a48 = h9.insert(y6), a48 = a48 !== (u14 = h9.minNode()) ? h9.prev(a48) : null, l23 = h9.next(l23); var g11 = a48 ? a48.key : null; if (f8(y6, g11, o90), l23 && 2 === R5(y6, l23.key, t48) && (f8(y6, g11, o90), f8(l23.key, y6, o90)), a48 && 2 === R5(a48.key, y6, t48)) { var x6 = a48; f8(g11, (x6 = x6 !== u14 ? h9.prev(x6) : null) ? x6.key : null, o90), f8(y6, g11, o90); } } else l23 = a48 = h9.find(y6 = y6.otherEvent), a48 && l23 && (a48 = a48 !== u14 ? h9.prev(a48) : null, l23 = h9.next(l23), h9.remove(y6), l23 && a48 && R5(a48.key, l23.key, t48)); } return d35; })(a47, 0, 0, s19, o89, n46)), u13 = [], m7 = 0; m7 < l22.length; m7++) { var y5 = l22[m7]; if (y5.isExterior()) { for (var g10 = [y5.points], x5 = 0; x5 < y5.holeIds.length; x5++) g10.push(l22[y5.holeIds[x5]].points); u13.push(g10); } } return u13; } var K5 = { UNION: h8, DIFFERENCE: p9, INTERSECTION: c28, XOR: d34 }; t46.diff = function(t47, e59) { return Y6(t47, e59, p9); }, t46.intersection = function(t47, e59) { return Y6(t47, e59, c28); }, t46.operations = K5, t46.union = function(t47, e59) { return Y6(t47, e59, h8); }, t46.xor = function(t47, e59) { return Y6(t47, e59, d34); }, Object.defineProperty(t46, "__esModule", { value: true }); })(e57); })(0, ap.exports)), ap.exports); function up(t45, e57, r86, n45) { const i26 = [], s18 = 0 === n45 ? (t46, e58, r87, n46, i27, s19) => { t46.push(new wt(s19, r87 + (s19 - e58) / (n46 - e58) * (i27 - r87))); } : (t46, e58, r87, n46, i27, s19) => { t46.push(new wt(e58 + (s19 - r87) / (i27 - r87) * (n46 - e58), s19)); }; for (const o88 of t45) { const t46 = []; for (const i27 of o88) { if (i27.length <= 2) continue; const o89 = []; for (let t47 = 0; t47 < i27.length - 1; t47++) { const a47 = i27[t47].x, l22 = i27[t47].y, u12 = i27[t47 + 1].x, c28 = i27[t47 + 1].y, h8 = 0 === n45 ? a47 : l22, p9 = 0 === n45 ? u12 : c28; h8 < e57 ? p9 > e57 && s18(o89, a47, l22, u12, c28, e57) : h8 > r86 ? p9 < r86 && s18(o89, a47, l22, u12, c28, r86) : o89.push(i27[t47]), p9 < e57 && h8 >= e57 && s18(o89, a47, l22, u12, c28, e57), p9 > r86 && h8 <= r86 && s18(o89, a47, l22, u12, c28, r86); } let a46 = i27[i27.length - 1]; const l21 = 0 === n45 ? a46.x : a46.y; l21 >= e57 && l21 <= r86 && o89.push(a46), o89.length && (a46 = o89[o89.length - 1], o89[0].x === a46.x && o89[0].y === a46.y || o89.push(o89[0]), t46.push(o89)); } t46.length && i26.push(t46); } return i26; } function cp(t45, e57) { const r86 = pp(t45), n45 = pp([e57]), i26 = lp.intersection(r86, n45); return null == i26 ? [] : dp(i26); } function hp(t45, e57) { const r86 = 65536; let n45 = pp(t45, r86); const i26 = []; for (; e57.valid(); e57.next()) { const [t46, n46] = e57.get(), s18 = t46.x * r86, o88 = t46.y * r86, a46 = n46.x * r86, l21 = n46.y * r86, u12 = a46 - s18, c28 = l21 - o88, h8 = Math.hypot(u12, c28); if (0 === h8) continue; const p9 = Math.trunc(c28 / h8 * 3), d34 = -Math.trunc(u12 / h8 * 3); i26.push([[[s18, o88], [a46, l21], [a46 + p9, l21 + d34], [s18 + p9, o88 + d34], [s18, o88]]]); } return i26.length > 0 && (n45 = lp.diff(n45, i26)), dp(n45, 1 / r86); } function pp(t45, e57 = 1) { return [t45.map(((t46) => t46.map(((t47) => [t47.x * e57, t47.y * e57]))))]; } function dp(t45, e57 = 1) { return t45.map(((t46) => t46.map(((t47, r86) => { const n45 = t47.map(((t48) => new wt(t48[0] * e57, t48[1] * e57).round())); return r86 > 0 && n45.reverse(), n45; })))); } class fp { constructor(t45, e57) { this.layoutVertexArray = new ua(), this.indexArray = new Ea(), this.lineIndexArray = new Ia(), this.triangleSegments = new al(), this.lineSegments = new al(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }), this.uploaded = false, e57 && (this.elevatedLayoutVertexArray = new pa()); } update(t45, e57, r86, n45, i26, s18, o88, a46) { this.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, a46); } isEmpty() { return 0 === this.layoutVertexArray.length; } needsUpload() { return this.programConfigurations.needsUpload; } upload(t45) { this.uploaded || (this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, wh.members), this.indexBuffer = t45.createIndexBuffer(this.indexArray), this.lineIndexBuffer = t45.createIndexBuffer(this.lineIndexArray), this.elevatedLayoutVertexArray && this.elevatedLayoutVertexArray.length > 0 && (this.elevatedLayoutVertexBuffer = t45.createVertexBuffer(this.elevatedLayoutVertexArray, _h.members))), this.programConfigurations.upload(t45), this.uploaded = true; } destroy() { this.layoutVertexBuffer && (this.elevatedLayoutVertexBuffer && this.elevatedLayoutVertexBuffer.destroy(), this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.lineIndexBuffer.destroy(), this.programConfigurations.destroy(), this.triangleSegments.destroy(), this.lineSegments.destroy()); } populatePaintArrays(t45, e57, r86, n45, i26, s18, o88) { this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t45, e57, r86, n45, i26, s18, void 0, o88); } } class mp { constructor(t45) { this.zoom = t45.zoom, this.pixelRatio = t45.pixelRatio, this.overscaling = t45.overscaling, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.hasPattern = false, this.patternFeatures = [], this.lut = t45.lut, this.bufferData = new fp(t45, false), this.elevationBufferData = new fp(t45, true), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.projection = t45.projection, this.elevationMode = this.layers[0].layout.get("fill-elevation-reference"), this.sourceLayerIndex = t45.sourceLayerIndex, this.worldview = t45.worldview; } updateFootprints(t45, e57) { } populate(t45, e57, r86, n45) { this.hasPattern = tp("fill", this.layers, this.pixelRatio, e57); const i26 = this.layers[0].layout.get("fill-sort-key"), s18 = []; for (const { feature: o88, id: a46, index: l21, sourceLayerIndex: u12 } of t45) { const t46 = this.layers[0]._featureFilter.needGeometry, c28 = Mu(o88, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), c28, r86)) continue; const h8 = i26 ? i26.evaluate(c28, {}, r86, e57.availableImages) : void 0, p9 = { id: a46, properties: o88.properties, type: o88.type, sourceLayerIndex: u12, index: l21, geometry: t46 ? c28.geometry : Au(o88, r86, n45), patterns: {}, sortKey: h8 }; s18.push(p9); } i26 && s18.sort(((t46, e58) => t46.sortKey - e58.sortKey)); for (const n46 of s18) { const { geometry: i27, index: s19, sourceLayerIndex: o88 } = n46; if (this.hasPattern) { const t46 = ep("fill", this.layers, n46, this.zoom, this.pixelRatio, e57); this.patternFeatures.push(t46); } else this.addFeature(n46, i27, s19, r86, {}, e57.availableImages, e57.brightness, e57.elevationFeatures); e57.featureIndex.insert(t45[s19].feature, i27, s19, o88, this.index); } } update(t45, e57, r86, n45, i26, s18, o88) { this.bufferData.update(t45, e57, r86, n45, i26, s18, o88, this.worldview), this.elevationBufferData.update(t45, e57, r86, n45, i26, s18, o88, this.worldview), this.elevatedStructures && this.elevatedStructures.update(t45, e57, r86, n45, i26, s18, o88, this.worldview); } addFeatures(t45, e57, r86, n45, i26, s18) { for (const i27 of this.patternFeatures) this.addFeature(i27, i27.geometry, i27.index, e57, r86, n45, s18, t45.elevationFeatures); } isEmpty() { return this.bufferData.isEmpty() && this.elevationBufferData.isEmpty(); } uploadPending() { return !this.uploaded || this.bufferData.needsUpload() || this.elevationBufferData.needsUpload(); } upload(t45) { this.bufferData.upload(t45), this.elevationBufferData.upload(t45), this.elevatedStructures && this.elevatedStructures.upload(t45); } destroy() { this.bufferData.destroy(), this.elevationBufferData.destroy(), this.elevatedStructures && this.elevatedStructures.destroy(); } addFeature(t45, e57, r86, n45, i26, s18 = [], o88, a46) { const l21 = Kh(e57, 500); "none" !== this.elevationMode ? this.addElevatedRoadFeature(t45, l21, n45, r86, a46) : this.addGeometry(l21, this.bufferData), this.bufferData.populatePaintArrays(t45, r86, i26, s18, n45, o88, this.worldview), this.elevationBufferData.populatePaintArrays(t45, r86, i26, s18, n45, o88, this.worldview); } getUnevaluatedPortalGraph() { return this.elevatedStructures ? this.elevatedStructures.unevaluatedPortals : void 0; } getElevationPolygons() { return this.elevatedStructures ? this.elevatedStructures.portalPolygons : void 0; } setEvaluatedPortalGraph(t45, e57, r86, n45, i26) { this.elevatedStructures && (this.elevatedStructures.construct(t45), this.elevatedStructures.populatePaintArrays(e57, r86, n45, i26, this.worldview)); } addElevatedRoadFeature(t45, e57, r86, n45, i26) { const s18 = new Array(), o88 = Yu.getElevationFeature(t45, i26); if (!o88) return void this.addGeometry(e57, this.bufferData); { const t46 = this.clipPolygonsToTile(e57, 1); t46.length > 0 && s18.push({ polygons: t46, elevationFeature: o88, elevationTileID: r86 }); } const a46 = { guardRailEnabled: this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(t45, {}, r86), featureIndex: n45 }; for (const e58 of s18) if (e58.elevationFeature) { if ("hd-road-base" === this.elevationMode) { this.elevatedStructures || (this.elevatedStructures = new sp(e58.elevationTileID, this.layers, this.zoom, this.lut)); const r87 = e58.elevationFeature.isTunnel(); let n46 = 0; t45.properties.hasOwnProperty(Vu) && (n46 = +t45.properties[Vu]); for (const t46 of e58.polygons) this.elevatedStructures.addPortalCandidates(e58.elevationFeature.id, t46, r87, e58.elevationFeature, n46); } null == e58.elevationFeature.constantHeight && (e58.polygons = this.prepareElevatedPolygons(e58.polygons, e58.elevationFeature, e58.elevationTileID)); const i27 = new Ku(r86, e58.elevationTileID); this.addElevatedGeometry(e58.polygons, i27, e58.elevationFeature, "hd-road-base" === this.elevationMode ? 0 : 0.05, n45, a46); } } addElevatedGeometry(t45, e57, r86, n45, i26, s18) { const o88 = { elevation: r86, elevationSampler: e57, bias: n45, index: i26, featureInfo: s18 }, [a46, l21] = this.addGeometry(t45, this.elevationBufferData, o88); null == this.elevationBufferData.heightRange ? this.elevationBufferData.heightRange = { min: a46, max: l21 } : (this.elevationBufferData.heightRange.min = Math.min(this.elevationBufferData.heightRange.min, a46), this.elevationBufferData.heightRange.max = Math.max(this.elevationBufferData.heightRange.max, l21)); } addGeometry(t45, e57, r86) { let n45 = Number.POSITIVE_INFINITY, i26 = Number.NEGATIVE_INFINITY, s18 = null; r86 && (s18 = r86.elevationSampler.constantElevation(r86.elevation, r86.bias), null != s18 && (n45 = s18, i26 = s18)); const o88 = (t46, o89, a46) => { if (null != r86) if (o89.push(t46), null != s18) e57.elevatedLayoutVertexArray.emplaceBack(s18), a46.push(s18); else { const s19 = r86.elevationSampler.pointElevation(t46, r86.elevation, r86.bias); e57.elevatedLayoutVertexArray.emplaceBack(s19), a46.push(s19), n45 = Math.min(n45, s19), i26 = Math.max(i26, s19); } }; for (const n46 of t45) { let t46 = 0; for (const e58 of n46) t46 += e58.length; const i27 = e57.triangleSegments.prepareSegment(t46, e57.layoutVertexArray, e57.indexArray), s19 = i27.vertexLength, a46 = [], l21 = [], u12 = [], c28 = [], h8 = [], p9 = e57.layoutVertexArray.length; for (const t47 of n46) { if (0 === t47.length) continue; t47 !== n46[0] && l21.push(a46.length / 2); const i28 = e57.lineSegments.prepareSegment(t47.length, e57.layoutVertexArray, e57.lineIndexArray), s20 = i28.vertexLength; r86 && h8.push(e57.layoutVertexArray.length - p9), o88(t47[0], u12, c28), e57.layoutVertexArray.emplaceBack(t47[0].x, t47[0].y), e57.lineIndexArray.emplaceBack(s20 + t47.length - 1, s20), a46.push(t47[0].x), a46.push(t47[0].y); for (let r87 = 1; r87 < t47.length; r87++) o88(t47[r87], u12, c28), e57.layoutVertexArray.emplaceBack(t47[r87].x, t47[r87].y), e57.lineIndexArray.emplaceBack(s20 + r87 - 1, s20 + r87), a46.push(t47[r87].x), a46.push(t47[r87].y); i28.vertexLength += t47.length, i28.primitiveLength += t47.length; } const d34 = Ih(a46, l21); for (let t47 = 0; t47 < d34.length; t47 += 3) e57.indexArray.emplaceBack(s19 + d34[t47], s19 + d34[t47 + 1], s19 + d34[t47 + 2]); if (d34.length > 0 && r86 && "hd-road-base" === this.elevationMode) { const t47 = r86.elevation.isTunnel(), e58 = r86.elevation.safeArea, n47 = this.elevatedStructures.addVertices(u12, c28); this.elevatedStructures.addTriangles(d34, n47, t47); const i28 = h8.length; if (i28 > 0) { for (let s20 = 0; s20 < i28 - 1; s20++) this.elevatedStructures.addRenderableRing(r86.index, h8[s20] + n47, h8[s20 + 1] - h8[s20], t47, e58, r86.featureInfo); this.elevatedStructures.addRenderableRing(r86.index, h8[i28 - 1] + n47, u12.length - h8[i28 - 1], t47, e58, r86.featureInfo); } } i27.vertexLength += t46, i27.primitiveLength += d34.length / 3; } return [n45, i26]; } prepareElevatedPolygons(t45, e57, r86) { const n45 = 1 / fu(r86), i26 = []; for (const r87 of t45) { const t46 = hp(r87, new Zu(e57, n45)); i26.push(...t46); } return i26; } clipPolygonsToTile(t45, e57) { const r86 = -e57, n45 = -e57, i26 = Rn + e57, s18 = Rn + e57; let o88 = 0; const a46 = [], l21 = []; for (; o88 < t45.length; o88++) { const e58 = t45[o88], u13 = mn(e58); (u13.min.x >= r86 && u13.max.x <= i26 && u13.min.y >= n45 && u13.max.y <= s18 ? a46 : l21).push(e58); } if (a46.length === t45.length) return t45; const u12 = [new wt(r86, n45), new wt(i26, n45), new wt(i26, s18), new wt(r86, s18), new wt(r86, n45)], c28 = a46; for (const t46 of l21) c28.push(...cp(t46, u12)); return c28; } } let yp, gp, xp, vp; Ws(mp, "FillBucket", { omit: ["layers", "patternFeatures"] }), Ws(fp, "FillBufferData"), Ws(sp, "ElevatedStructures"); class bp { constructor(t45, e57, r86, n45) { if (this.triangleCount = e57.length / 3, this.min = new wt(0, 0), this.max = new wt(0, 0), this.xScale = 0, this.yScale = 0, this.cellsX = 0, this.cellsY = 0, this.cells = [], this.payload = [], 0 === this.triangleCount || 0 === t45.length) return; const [i26, s18] = [t45[0].clone(), t45[0].clone()]; for (let e58 = 1; e58 < t45.length; ++e58) { const r87 = t45[e58]; i26.x = Math.min(i26.x, r87.x), i26.y = Math.min(i26.y, r87.y), s18.x = Math.max(s18.x, r87.x), s18.y = Math.max(s18.y, r87.y); } if (n45) { const t46 = Math.ceil(Math.max(s18.x - i26.x, s18.y - i26.y) / n45); r86 = Math.max(r86, t46); } if (0 === r86) return; this.min = i26, this.max = s18; const o88 = this.max.sub(this.min); o88.x = Math.max(o88.x, 1), o88.y = Math.max(o88.y, 1); const a46 = Math.max(o88.x, o88.y) / r86; this.cellsX = Math.max(1, Math.ceil(o88.x / a46)), this.cellsY = Math.max(1, Math.ceil(o88.y / a46)), this.xScale = 1 / a46, this.yScale = 1 / a46; const l21 = []; for (let r87 = 0; r87 < this.triangleCount; r87++) { const n46 = t45[e57[3 * r87 + 0]].sub(this.min), i27 = t45[e57[3 * r87 + 1]].sub(this.min), s19 = t45[e57[3 * r87 + 2]].sub(this.min), o89 = wp(Math.floor(Math.min(n46.x, i27.x, s19.x)), this.xScale, this.cellsX), u13 = wp(Math.floor(Math.max(n46.x, i27.x, s19.x)), this.xScale, this.cellsX), c28 = wp(Math.floor(Math.min(n46.y, i27.y, s19.y)), this.yScale, this.cellsY), h8 = wp(Math.floor(Math.max(n46.y, i27.y, s19.y)), this.yScale, this.cellsY), p9 = new wt(0, 0), d34 = new wt(0, 0), f8 = new wt(0, 0), m6 = new wt(0, 0); for (let t46 = c28; t46 <= h8; ++t46) { p9.y = d34.y = t46 * a46, f8.y = m6.y = (t46 + 1) * a46; for (let e58 = o89; e58 <= u13; ++e58) p9.x = f8.x = e58 * a46, d34.x = m6.x = (e58 + 1) * a46, (fc(n46, i27, s19, p9, d34, m6) || fc(n46, i27, s19, p9, m6, f8)) && l21.push({ cellIdx: t46 * this.cellsX + e58, triIdx: r87 }); } } if (0 === l21.length) return; l21.sort(((t46, e58) => t46.cellIdx - e58.cellIdx || t46.triIdx - e58.triIdx)); let u12 = 0; for (; u12 < l21.length; ) { const t46 = l21[u12].cellIdx, e58 = { start: this.payload.length, len: 0 }; for (; u12 < l21.length && l21[u12].cellIdx === t46; ) ++e58.len, this.payload.push(l21[u12++].triIdx); this.cells[t46] = e58; } } _lazyInitLookup() { this.lookup || (this.lookup = new Uint8Array(Math.ceil(this.triangleCount / 8))), this.lookup.fill(0); } queryPoint(t45, e57) { if (0 === this.triangleCount || 0 === this.cells.length) return; if (t45.x > this.max.x || this.min.x > t45.x || t45.y > this.max.y || this.min.y > t45.y) return; const r86 = wp(t45.x - this.min.x, this.xScale, this.cellsX), n45 = wp(t45.y - this.min.y, this.yScale, this.cellsY), i26 = this.cells[n45 * this.cellsX + r86]; if (i26) { this._lazyInitLookup(); for (let t46 = 0; t46 < i26.len; t46++) { const r87 = this.payload[i26.start + t46], n46 = Math.floor(r87 / 8), s18 = 1 << r87 % 8; if (!(this.lookup[n46] & s18) && (this.lookup[n46] |= s18, e57.push(r87), e57.length === this.triangleCount)) return; } } } query(t45, e57, r86) { if (0 === this.triangleCount || 0 === this.cells.length) return; if (t45.x > this.max.x || this.min.x > e57.x) return; if (t45.y > this.max.y || this.min.y > e57.y) return; this._lazyInitLookup(); const n45 = wp(t45.x - this.min.x, this.xScale, this.cellsX), i26 = wp(e57.x - this.min.x, this.xScale, this.cellsX), s18 = wp(t45.y - this.min.y, this.yScale, this.cellsY), o88 = wp(e57.y - this.min.y, this.yScale, this.cellsY); for (let t46 = s18; t46 <= o88; t46++) for (let e58 = n45; e58 <= i26; e58++) { const n46 = this.cells[t46 * this.cellsX + e58]; if (n46) for (let t47 = 0; t47 < n46.len; t47++) { const e59 = this.payload[n46.start + t47], i27 = Math.floor(e59 / 8), s19 = 1 << e59 % 8; if (!(this.lookup[i27] & s19) && (this.lookup[i27] |= s19, r86.push(e59), r86.length === this.triangleCount)) return; } } } } function wp(t45, e57, r86) { return Math.max(0, Math.min(r86 - 1, Math.floor(t45 * e57))); } Ws(bp, "TriangleGridIndex"); class _p { constructor(t45) { this.zoom = t45.zoom, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.hasPattern = false, this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.footprints = [], this.worldview = t45.worldview; } updateFootprints(t45, e57) { for (const r86 of this.footprints) e57.push({ footprint: r86, id: t45 }); } populate(t45, e57, r86, n45) { const i26 = []; for (const { feature: e58, id: s18, index: o88, sourceLayerIndex: a46 } of t45) { const t46 = this.layers[0]._featureFilter.needGeometry, l21 = Mu(e58, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), l21, r86)) continue; const u12 = { id: s18, properties: e58.properties, type: e58.type, sourceLayerIndex: a46, index: o88, geometry: t46 ? l21.geometry : Au(e58, r86, n45), patterns: {} }; i26.push(u12); } for (const n46 of i26) { const { geometry: i27, index: s18, sourceLayerIndex: o88 } = n46; this.addFeature(n46, i27, s18, r86, {}, e57.availableImages, e57.brightness), e57.featureIndex.insert(t45[s18].feature, i27, s18, o88, this.index); } } isEmpty() { return 0 === this.footprints.length; } uploadPending() { return false; } upload(t45) { } update(t45, e57, r86, n45, i26, s18, o88) { } destroy() { } addFeature(t45, e57, r86, n45, i26, s18 = [], o88) { for (const t46 of Kh(e57, 2)) { const e58 = [], r87 = [], n46 = [], i27 = new wt(1 / 0, 1 / 0), s19 = new wt(-1 / 0, -1 / 0); for (const o90 of t46) if (0 !== o90.length) { o90 !== t46[0] && n46.push(r87.length / 2); for (let t47 = 0; t47 < o90.length; t47++) r87.push(o90[t47].x), r87.push(o90[t47].y), e58.push(o90[t47]), i27.x = Math.min(i27.x, o90[t47].x), i27.y = Math.min(i27.y, o90[t47].y), s19.x = Math.max(s19.x, o90[t47].x), s19.y = Math.max(s19.y, o90[t47].y); } const o89 = Ih(r87, n46), a46 = new bp(e58, o89, 8, 256); this.footprints.push({ vertices: e58, indices: o89, grid: a46, min: i27, max: s19 }); } } } Ws(_p, "ClipBucket", { omit: ["layers"] }); const Ap = aa2([{ name: "a_pos_normal_ed", components: 4, type: "Int16" }]), Mp = aa2([{ name: "a_pos_end", components: 4, type: "Int16" }, { name: "a_angular_offset_factor", components: 1, type: "Int16" }]), Ip = aa2([{ name: "a_centroid_pos", components: 2, type: "Uint16" }]), Sp = aa2([{ name: "a_join_normal_inside", components: 3, type: "Int16" }]), Pp = aa2([{ name: "a_hidden_by_landmark", components: 1, type: "Uint8" }]), kp = aa2([{ name: "a_pos_3", components: 3, type: "Int16" }, { name: "a_pos_normal_3", components: 3, type: "Int16" }]), { members: zp } = Ap, Ep = Number.MAX_SAFE_INTEGER, Tp = Ep - 1; function Bp(t45, e57, r86, n45) { return t45.order < e57 || t45.order === Ep || !(t45.clipMask & r86) || (function(t46, e58) { return 0 !== e58.length && void 0 === e58.find(((e59) => e59 === t46)); })(n45, t45.clipScope); } function Vp(t45, e57) { return t45.x - e57.x || t45.y - e57.y; } function Fp(t45, e57) { return 0 === Vp(t45.min, e57.min) && 0 === Vp(t45.max, e57.max); } function Cp(t45, e57) { return !(t45.min.x > e57.max.x || t45.max.x < e57.min.x || t45.min.y > e57.max.y || t45.max.y < e57.min.y); } function Dp(t45, e57) { if (t45.length !== e57.length) return false; for (let r86 = 0; r86 < t45.length; r86++) if (t45[r86].sourceId !== e57[r86].sourceId || !Fp(t45[r86], e57[r86]) || t45[r86].order !== e57[r86].order || t45[r86].clipMask !== e57[r86].clipMask || !_t(t45[r86].clipScope, e57[r86].clipScope)) return false; return true; } function Rp(t45, e57, r86) { const n45 = 1 / Rn, i26 = 1 / (1 << r86.canonical.z), s18 = (e57.x * n45 + r86.canonical.x) * i26 + r86.wrap, o88 = (e57.y * n45 + r86.canonical.y) * i26; return { min: new wt((t45.x * n45 + r86.canonical.x) * i26 + r86.wrap, (t45.y * n45 + r86.canonical.y) * i26), max: new wt(s18, o88) }; } function Lp(t45, e57, r86) { const n45 = 1 << r86.canonical.z, i26 = ((e57.x - r86.wrap) * n45 - r86.canonical.x) * Rn, s18 = (e57.y * n45 - r86.canonical.y) * Rn; return { min: new wt(((t45.x - r86.wrap) * n45 - r86.canonical.x) * Rn, (t45.y * n45 - r86.canonical.y) * Rn), max: new wt(i26, s18) }; } function Op(t45, e57, r86, n45, i26, s18, o88) { const a46 = t45.indices, l21 = t45.vertices, u12 = []; for (let c28 = n45; c28 < n45 + i26; c28 += 3) { const n46 = e57[r86[c28 + 0] + s18], i27 = e57[r86[c28 + 1] + s18], h8 = e57[r86[c28 + 2] + s18], p9 = Math.min(n46.x, i27.x, h8.x), d34 = Math.max(n46.x, i27.x, h8.x), f8 = Math.min(n46.y, i27.y, h8.y), m6 = Math.max(n46.y, i27.y, h8.y); u12.length = 0, t45.grid.query(new wt(p9, f8), new wt(d34, m6), u12); for (let t46 = 0; t46 < u12.length; t46++) { const e58 = u12[t46]; if (fc(l21[a46[3 * e58 + 0]], l21[a46[3 * e58 + 1]], l21[a46[3 * e58 + 2]], n46, i27, h8, o88)) return true; } } return false; } function Up(t45, e57, r86, n45) { if (!t45 || !r86) return false; let i26 = t45.vertices; if (!e57.canonical.equals(n45.canonical) || e57.wrap !== n45.wrap) { if (r86.vertices.length < t45.vertices.length) return Up(r86, n45, t45, e57); const s18 = e57.canonical, o88 = n45.canonical, a46 = Math.pow(2, o88.z - s18.z); i26 = t45.vertices.map(((t46) => new wt((t46.x + s18.x * Rn) * a46 - o88.x * Rn, (t46.y + s18.y * Rn) * a46 - o88.y * Rn))); } return Op(r86, i26, t45.indices, 0, t45.indices.length, 0, 0); } function Np(t45, e57, r86, n45) { const i26 = Math.pow(2, n45.z - r86.z); return new wt((t45 + r86.x * Rn) * i26 - n45.x * Rn, (e57 + r86.y * Rn) * i26 - n45.y * Rn); } function jp(t45, e57) { const r86 = []; e57.grid.queryPoint(t45, r86); const n45 = e57.indices, i26 = e57.vertices; for (let e58 = 0; e58 < r86.length; e58++) { const s18 = r86[e58]; if (cc2([i26[n45[3 * s18 + 0]], i26[n45[3 * s18 + 1]], i26[n45[3 * s18 + 2]]], t45)) return true; } return false; } const $p = [new wt(0, 0), new wt(Rn, 0), new wt(Rn, Rn), new wt(0, Rn)]; function Gp(t45, e57) { const r86 = []; let n45 = []; if (!e57 || t45.length < 2) return [t45]; if (2 === t45.length) return pc(t45[0], t45[1], $p) ? [t45] : []; for (let e58 = 0; e58 < t45.length + 2; e58++) { const i26 = t45[e58 % t45.length], s18 = t45[(e58 + 1) % t45.length], o88 = pc(0 === e58 ? t45[t45.length - 1] : t45[(e58 - 1) % t45.length], i26, $p), a46 = pc(i26, s18, $p), l21 = o88 || a46; l21 && n45.push(i26), l21 && a46 || n45.length > 0 && (n45.length > 1 && r86.push(n45), n45 = []); } return n45.length > 1 && r86.push(n45), r86; } const Hp = Iu.types, qp = ["fill-extrusion-base", "fill-extrusion-height", "fill-extrusion-color", "fill-extrusion-pattern", "fill-extrusion-flood-light-wall-radius", "fill-extrusion-line-width", "fill-extrusion-emissive-strength"], Xp = ["fill-extrusion-flood-light-ground-radius"], Zp = Math.pow(2, 13), Wp = Math.pow(2, 15) - 1, Yp = new wt(0, 1), Kp = 2147483648; function Jp(t45, e57, r86, n45, i26, s18, o88, a46) { t45.emplaceBack((e57 << 1) + o88, (r86 << 1) + s18, (Math.floor(n45 * Zp) << 1) + i26, Math.round(a46)); } function Qp(t45, e57, r86) { t45.emplaceBack(e57.x * Rn, e57.y * Rn, r86 ? 1 : 0); } function td(t45, e57, r86, n45, i26, s18) { t45.emplaceBack(e57.x, e57.y, (r86.x << 1) + n45, (r86.y << 1) + i26, s18); } function ed(t45, e57, r86) { const n45 = 16384; t45.emplaceBack(e57.x, e57.y, e57.z, r86[0] * n45, r86[1] * n45, r86[2] * n45); } class rd { constructor() { this.vertexOffset = 0, this.vertexCount = 0, this.indexOffset = 0, this.indexCount = 0; } } class nd { constructor() { this.centroidXY = new wt(0, 0), this.vertexArrayOffset = 0, this.vertexCount = 0, this.groundVertexArrayOffset = 0, this.groundVertexCount = 0, this.flags = 0, this.footprintSegIdx = -1, this.footprintSegLen = 0, this.polygonSegIdx = -1, this.polygonSegLen = 0, this.min = new wt(Number.MAX_VALUE, Number.MAX_VALUE), this.max = new wt(-Number.MAX_VALUE, -Number.MAX_VALUE), this.height = 0, this.buildingId = 0; } span() { return new wt(this.max.x - this.min.x, this.max.y - this.min.y); } } class id { constructor() { this.acc = new wt(0, 0), this.accCount = 0, this.centroidDataIndex = 0; } startRing(t45, e57) { t45.min.x === Number.MAX_VALUE && (t45.min.x = t45.max.x = e57.x, t45.min.y = t45.max.y = e57.y); } appendEdge(t45, e57, r86) { this.accCount++, this.acc._add(e57); let n45 = !!this.borders; e57.x < t45.min.x ? (t45.min.x = e57.x, n45 = true) : e57.x > t45.max.x && (t45.max.x = e57.x, n45 = true), e57.y < t45.min.y ? (t45.min.y = e57.y, n45 = true) : e57.y > t45.max.y && (t45.max.y = e57.y, n45 = true), ((0 === e57.x || e57.x === Rn) && e57.x === r86.x) != ((0 === e57.y || e57.y === Rn) && e57.y === r86.y) && this.processBorderOverlap(e57, r86), n45 && this.checkBorderIntersection(e57, r86); } checkBorderIntersection(t45, e57) { e57.x < 0 != t45.x < 0 && this.addBorderIntersection(0, ur(e57.y, t45.y, (0 - e57.x) / (t45.x - e57.x))), e57.x > Rn != t45.x > Rn && this.addBorderIntersection(1, ur(e57.y, t45.y, (Rn - e57.x) / (t45.x - e57.x))), e57.y < 0 != t45.y < 0 && this.addBorderIntersection(2, ur(e57.x, t45.x, (0 - e57.y) / (t45.y - e57.y))), e57.y > Rn != t45.y > Rn && this.addBorderIntersection(3, ur(e57.x, t45.x, (Rn - e57.y) / (t45.y - e57.y))); } addBorderIntersection(t45, e57) { 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 r86 = this.borders[t45]; e57 < r86[0] && (r86[0] = e57), e57 > r86[1] && (r86[1] = e57); } processBorderOverlap(t45, e57) { if (t45.x === e57.x) { if (t45.y === e57.y) return; const r86 = 0 === t45.x ? 0 : 1; this.addBorderIntersection(r86, e57.y), this.addBorderIntersection(r86, t45.y); } else { const r86 = 0 === t45.y ? 2 : 3; this.addBorderIntersection(r86, e57.x), this.addBorderIntersection(r86, t45.x); } } centroid() { return 0 === this.accCount ? new wt(0, 0) : new wt(Math.floor(Math.max(0, this.acc.x) / this.accCount), Math.floor(Math.max(0, this.acc.y) / this.accCount)); } intersectsCount() { return this.borders ? this.borders.reduce(((t45, e57) => t45 + +(e57[0] !== Number.MAX_VALUE)), 0) : 0; } } function sd(t45, e57) { const r86 = t45.add(e57)._unit(), n45 = Tt2(t45.x * r86.x + t45.y * r86.y, -1, 1); var i26, s18, o88; return i26 = Math.acos(n45), Math.min(4, Math.max(-4, Math.tan(i26))) / 4 * Wp * ((s18 = t45).x * (o88 = e57).y - s18.y * o88.x < 0 ? -1 : 1); } const od = [(t45) => t45.x < 0, (t45) => t45.x > Rn, (t45) => t45.y < 0, (t45) => t45.y > Rn]; function ad(t45, e57, r86, n45) { const i26 = [4]; if (0 === n45) return i26; r86._mult(n45); const s18 = t45.sub(r86), o88 = e57.sub(r86), a46 = [t45, e57, s18, o88]; for (let t46 = 0; t46 < 4; t46++) for (const e58 of a46) if (od[t46](e58)) { i26.push(t46); break; } return i26; } class ld { constructor(t45) { this.vertexArray = new ma(), this.indexArray = new Ea(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }, ((t46) => Xp.includes(t46))), this._segments = new al(), this.hiddenByLandmarkVertexArray = new Ga(), this._segmentToGroundQuads = {}, this._segmentToGroundQuads[0] = [], this._segmentToRegionTriCounts = {}, this._segmentToRegionTriCounts[0] = [0, 0, 0, 0, 0], this.regionSegments = {}, this.regionSegments[4] = new al(); } getDefaultSegment() { return this.regionSegments[4]; } hasData() { return 0 !== this.vertexArray.length; } addData(t45, e57, r86, n45 = false) { const i26 = t45.length; if (i26 > 2) { let s18 = Math.max(0, this._segments.get().length - 1); const o88 = this._segments._prepareSegment(4 * i26, this.vertexArray.length, 2 * this._segmentToGroundQuads[s18].length); let a46; s18 !== this._segments.get().length - 1 && (s18++, this._segmentToGroundQuads[s18] = [], this._segmentToRegionTriCounts[s18] = [0, 0, 0, 0, 0]); { const e58 = t45[0], r87 = t45[1]; a46 = sd(e58.sub(t45[i26 - 1])._perp()._unit(), r87.sub(e58)._perp()._unit()); } for (let l21 = 0; l21 < i26; l21++) { const u12 = l21 === i26 - 1 ? 0 : l21 + 1, c28 = t45[l21], h8 = t45[u12], p9 = t45[u12 === i26 - 1 ? 0 : u12 + 1], d34 = h8.sub(c28)._perp()._unit(), f8 = sd(d34, p9.sub(h8)._perp()._unit()), m6 = a46, y4 = f8; if (dd(c28, h8, e57) || n45 && fd(c28, e57) && fd(h8, e57)) { a46 = f8; continue; } const g9 = o88.vertexLength; td(this.vertexArray, c28, h8, 1, 1, m6), td(this.vertexArray, c28, h8, 1, 0, m6), td(this.vertexArray, c28, h8, 0, 1, y4), td(this.vertexArray, c28, h8, 0, 0, y4), o88.vertexLength += 4; const x4 = ad(c28, h8, d34, r86); for (const t46 of x4) this._segmentToGroundQuads[s18].push({ id: g9, region: t46 }), this._segmentToRegionTriCounts[s18][t46] += 2, o88.primitiveLength += 2; a46 = f8; } } } prepareBorderSegments() { if (!this.hasData()) return; const t45 = this._segments.get(), e57 = t45.length; for (let t46 = 0; t46 < e57; t46++) this._segmentToGroundQuads[t46].sort(((t47, e58) => t47.region - e58.region)); for (let r86 = 0; r86 < e57; r86++) { const e58 = this._segmentToGroundQuads[r86], n45 = t45[r86], i26 = this._segmentToRegionTriCounts[r86]; i26.reduce(((t46, e59) => t46 + e59), 0); let s18 = 0; for (let t46 = 0; t46 <= 4; t46++) { const e59 = i26[t46]; if (0 !== e59) { let r87 = this.regionSegments[t46]; r87 || (r87 = this.regionSegments[t46] = new al()); const i27 = { vertexOffset: n45.vertexOffset, primitiveOffset: n45.primitiveOffset + s18, vertexLength: n45.vertexLength, primitiveLength: e59 }; r87.get().push(i27); } s18 += e59; } for (let t46 = 0; t46 < e58.length; t46++) { const r87 = e58[t46].id; this.indexArray.emplaceBack(r87, r87 + 1, r87 + 3), this.indexArray.emplaceBack(r87, r87 + 3, r87 + 2); } } this._segmentToGroundQuads = null, this._segmentToRegionTriCounts = null, this._segments.destroy(), this._segments = null; } addPaintPropertiesData(t45, e57, r86, n45, i26, s18, o88) { this.hasData() && this.programConfigurations.populatePaintArrays(this.vertexArray.length, t45, e57, r86, n45, i26, s18, void 0, o88); } upload(t45) { this.hasData() && (this.vertexBuffer = t45.createVertexBuffer(this.vertexArray, Mp.members), this.indexBuffer = t45.createIndexBuffer(this.indexArray)); } uploadPaintProperties(t45) { this.hasData() && this.programConfigurations.upload(t45); } update(t45, e57, r86, n45, i26, s18, o88, a46) { this.hasData() && this.programConfigurations.updatePaintArrays(t45, e57, r86, n45, i26, s18, o88, a46); } updateHiddenByLandmark(t45) { this.updateHiddenByLandmarkRange(t45.groundVertexArrayOffset, t45.groundVertexCount, !!(t45.flags & Kp)); } updateHiddenByLandmarkRange(t45, e57, r86) { if (!this.hasData()) return; const n45 = e57 + t45; if (0 !== e57) { for (let e58 = t45; e58 < n45; ++e58) this.hiddenByLandmarkVertexArray.emplace(e58, r86 ? 1 : 0); this._needsHiddenByLandmarkUpdate = true; } } uploadHiddenByLandmark(t45) { this.hasData() && this._needsHiddenByLandmarkUpdate && (!this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexArray.length > 0 ? this.hiddenByLandmarkVertexBuffer = t45.createVertexBuffer(this.hiddenByLandmarkVertexArray, Pp.members, true) : this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray), this._needsHiddenByLandmarkUpdate = false); } destroy() { if (this.vertexBuffer) { this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.destroy(), this._segments && this._segments.destroy(), this.programConfigurations.destroy(); for (let t45 = 0; t45 <= 4; t45++) { const e57 = this.regionSegments[t45]; e57 && e57.destroy(); } } } } class ud { constructor(t45) { this.zoom = t45.zoom, this.canonical = t45.canonical, this.overscaling = t45.overscaling, this.layers = t45.layers, this.pixelRatio = t45.pixelRatio, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.hasPattern = false, this.edgeRadius = 0, this.projection = t45.projection, this.activeReplacements = [], this.replacementUpdateTime = 0, this.centroidData = [], this.footprintIndices = new Ea(), this.footprintVertices = new ua(), this.footprintSegments = [], this.layoutVertexArray = new ha(), this.centroidVertexArray = new el(), this.wallVertexArray = new nl(), this.indexArray = new Ea(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }, ((t46) => qp.includes(t46))), this.segments = new al(), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.groundEffect = new ld(t45), this.maxHeight = 0, this.partLookup = {}, this.triangleSubSegments = [], this.polygonSegments = [], this.worldview = t45.worldview; } updateFootprints(t45, e57) { } populate(t45, e57, r86, n45) { this.features = [], this.hasPattern = tp("fill-extrusion", this.layers, this.pixelRatio, e57), this.featuresOnBorder = [], this.borderFeatureIndices = [[], [], [], []], this.borderDoneWithNeighborZ = [-1, -1, -1, -1], this.selfDEMTileTimestamp = Number.MAX_VALUE, this.borderDEMTileTimestamp = [Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE], this.tileToMeter = fu(r86), this.edgeRadius = this.layers[0].layout.get("fill-extrusion-edge-radius") / this.tileToMeter, this.wallMode = 0 !== this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1); for (const { feature: i26, id: s18, index: o88, sourceLayerIndex: a46 } of t45) { const t46 = this.layers[0]._featureFilter.needGeometry, l21 = Mu(i26, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), l21, r86)) continue; const u12 = { id: s18, sourceLayerIndex: a46, index: o88, geometry: t46 ? l21.geometry : Au(i26, r86, n45), properties: i26.properties, type: i26.type, patterns: {} }, c28 = this.layoutVertexArray.length, h8 = "Polygon" === Hp[u12.type]; if (this.hasPattern) this.features.push({ featureId: i26.id, feature: ep("fill-extrusion", this.layers, u12, this.zoom, this.pixelRatio, e57) }); else if (this.wallMode) for (const t47 of u12.geometry) for (const s19 of Gp(t47, h8)) this.addFeature(i26.id, u12, [s19], o88, r86, {}, e57.availableImages, n45, e57.brightness); else this.addFeature(i26.id, u12, u12.geometry, o88, r86, {}, e57.availableImages, n45, e57.brightness); e57.featureIndex.insert(i26, u12.geometry, o88, a46, this.index, c28); } this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(), this.groundEffect.prepareBorderSegments(), this.polygonSegments.length = 0; } addFeatures(t45, e57, r86, n45, i26, s18) { for (const { featureId: t46, feature: o88 } of this.features) { const a46 = "Polygon" === Hp[o88.type], { geometry: l21 } = o88; if (this.wallMode) for (const u12 of l21) for (const l22 of Gp(u12, a46)) this.addFeature(t46, o88, [l22], o88.index, e57, r86, n45, i26, s18); else this.addFeature(t46, o88, l21, o88.index, e57, r86, n45, i26, s18); } this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(); } update(t45, e57, r86, n45, i26, s18, o88) { this.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, this.worldview), this.groundEffect.update(t45, e57, i26, r86, n45, s18, o88, this.worldview); } isEmpty() { return 0 === this.layoutVertexArray.length; } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload || this.groundEffect.programConfigurations.needsUpload; } upload(t45) { this.uploaded || (this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, zp), this.indexBuffer = t45.createIndexBuffer(this.indexArray), this.wallVertexBuffer = t45.createVertexBuffer(this.wallVertexArray, Sp.members), this.layoutVertexExtArray && (this.layoutVertexExtBuffer = t45.createVertexBuffer(this.layoutVertexExtArray, kp.members, true)), this.groundEffect.upload(t45)), this.groundEffect.uploadPaintProperties(t45), this.programConfigurations.upload(t45), this.uploaded = true; } uploadCentroid(t45) { this.groundEffect.uploadHiddenByLandmark(t45), this.needsCentroidUpdate && (!this.centroidVertexBuffer && this.centroidVertexArray.length > 0 ? this.centroidVertexBuffer = t45.createVertexBuffer(this.centroidVertexArray, Ip.members, true) : this.centroidVertexBuffer && this.centroidVertexBuffer.updateData(this.centroidVertexArray), this.needsCentroidUpdate = false); } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.centroidVertexBuffer && this.centroidVertexBuffer.destroy(), this.layoutVertexExtBuffer && this.layoutVertexExtBuffer.destroy(), this.groundEffect.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); } addFeature(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e57, {}) / this.tileToMeter, c28 = [new wt(0, 0), new wt(Rn, Rn)], h8 = a46.projection, p9 = "globe" === h8.name, d34 = this.wallMode || "Polygon" === Hp[e57.type], f8 = new id(); f8.centroidDataIndex = this.centroidData.length; const m6 = new nd(); m6.buildingId = t45, e57.properties && e57.properties.hasOwnProperty("building_id") && (m6.buildingId = e57.properties.building_id); const y4 = this.layers[0].paint.get("fill-extrusion-base").evaluate(e57, {}, i26) <= 0, g9 = this.layers[0].paint.get("fill-extrusion-height").evaluate(e57, {}, i26); let x4; if (m6.height = g9, m6.vertexArrayOffset = this.layoutVertexArray.length, m6.groundVertexArrayOffset = this.groundEffect.vertexArray.length, p9 && !this.layoutVertexExtArray && (this.layoutVertexExtArray = new ba()), this.wallMode) { if (p9) return void Gt("Non zero fill-extrusion-line-width is not yet supported on globe."); if (1 !== r86.length) return; x4 = (function(t46) { const e58 = t46[0].x === t46[t46.length - 1].x && t46[0].y === t46[t46.length - 1].y, r87 = (function(t47) { let e59 = 0; const r88 = t47.length; for (let n47 = 0; n47 < r88; n47++) e59 += (t47[(n47 + 1) % r88].x - t47[n47].x) * (t47[(n47 + 1) % r88].y + t47[n47].y); return e59 >= 0; })(t46); r87 || (t46 = t46.reverse()); const n46 = { geometry: [], joinNormals: [], indices: [] }, i27 = [], s19 = [], o89 = []; let a47 = t46.length; for (; a47 >= 2 && t46[a47 - 1].equals(t46[a47 - 2]); ) a47--; if (a47 < (e58 ? 3 : 2)) return n46; let l22, u13, c29, h9, p10, d35 = 0; for (; d35 < a47 - 1 && t46[d35].equals(t46[d35 + 1]); ) d35++; e58 && (l22 = t46[a47 - 2], p10 = t46[d35].sub(l22)._unit()._perp()); for (let r88 = d35; r88 < a47; r88++) { if (c29 = r88 === a47 - 1 ? e58 ? t46[d35 + 1] : void 0 : t46[r88 + 1], c29 && t46[r88].equals(c29)) continue; p10 && (h9 = p10), l22 && (u13 = l22), l22 = t46[r88], p10 = c29 ? c29.sub(l22)._unit()._perp() : h9, h9 = h9 || p10; let n47 = h9.add(p10); 0 === n47.x && 0 === n47.y || n47._unit(); const f10 = n47.x * p10.x + n47.y * p10.y, m7 = 0 !== f10 ? 1 / f10 : 1 / 0, y5 = h9.x * p10.y - h9.y * p10.x > 0; let g10 = "miter"; const x5 = 2; "miter" === g10 && m7 > x5 && (g10 = "bevel"), "bevel" === g10 && (m7 > 100 && (g10 = "flipbevel"), m7 < x5 && (g10 = "miter")); const v9 = (t47, e59, r89, n48) => { const a48 = new wt(t47.x, t47.y), l23 = new wt(t47.x, t47.y); a48.x += e59.x * n48, a48.y += e59.y * n48, l23.x -= e59.x * Math.max(r89, 1), l23.y -= e59.y * Math.max(r89, 1), o89.push(e59), i27.push(a48), s19.push(l23); }; if ("miter" === g10) n47._mult(m7), v9(l22, n47, 0, 0); else if ("flipbevel" === g10) n47 = p10.mult(-1), v9(l22, n47, 0, 0), v9(l22, n47.mult(-1), 0, 0); else { const t47 = -Math.sqrt(m7 * m7 - 1), e59 = y5 ? t47 : 0, r89 = y5 ? 0 : t47; u13 && v9(l22, h9, e59, r89), c29 && v9(l22, p10, e59, r89); } } n46.geometry = [...i27, ...s19.reverse(), i27[0]], n46.joinNormals = [...o89, ...o89.reverse(), o89[o89.length - 1]]; const f9 = n46.geometry.length - 1; for (let t47 = 0; t47 < f9 / 2; t47++) if (t47 + 1 < f9 / 2) { let e59 = t47, r88 = t47 + 1, i28 = f9 - 1 - t47, s20 = f9 - 2 - t47; e59 = 0 === e59 ? f9 - 1 : e59 - 1, r88 = 0 === r88 ? f9 - 1 : r88 - 1, i28 = 0 === i28 ? f9 - 1 : i28 - 1, s20 = 0 === s20 ? f9 - 1 : s20 - 1, n46.indices.push(i28), n46.indices.push(r88), n46.indices.push(e59), n46.indices.push(i28), n46.indices.push(s20), n46.indices.push(r88); } return n46; })(r86[0]), r86 = [x4.geometry]; } const v8 = (t46, e58) => t46 < (e58.length - 1) / 2 || t46 === e58.length - 1, b8 = this.wallMode ? [r86] : Kh(r86, 500); for (let t46 = b8.length - 1; t46 >= 0; t46--) { const e58 = b8[t46]; (0 === e58.length || (w4 = e58[0]).every(((t47) => t47.x <= 0)) || w4.every(((t47) => t47.x >= Rn)) || w4.every(((t47) => t47.y <= 0)) || w4.every(((t47) => t47.y >= Rn))) && b8.splice(t46, 1); } var w4; let _4; if (p9) _4 = xd(b8, c28, i26); else { _4 = []; for (const t46 of b8) _4.push({ polygon: t46, bounds: c28 }); } const A4 = d34 ? this.edgeRadius : 0, M5 = A4 > 0 && this.zoom < 17, I4 = (t46, e58) => { if (0 === t46.length) return false; const r87 = t46[t46.length - 1]; return e58.x === r87.x && e58.y === r87.y; }; for (const { polygon: t46, bounds: e58 } of _4) { let r87 = 0, n46 = 0; for (const e59 of t46) d34 && !e59[0].equals(e59[e59.length - 1]) && e59.push(e59[0]), n46 += d34 ? e59.length - 1 : e59.length; const s19 = this.segments.prepareSegment((d34 ? 5 : 4) * n46, this.layoutVertexArray, this.indexArray); m6.footprintSegIdx < 0 && (m6.footprintSegIdx = this.footprintSegments.length), m6.polygonSegIdx < 0 && (m6.polygonSegIdx = this.polygonSegments.length); const o89 = { triangleArrayOffset: this.indexArray.length, triangleCount: 0, triangleSegIdx: this.segments.segments.length - 1 }, a47 = new rd(); if (a47.vertexOffset = this.footprintVertices.length, a47.indexOffset = 3 * this.footprintIndices.length, a47.ringIndices = [], d34) { const n47 = [], o90 = []; r87 = s19.vertexLength; for (let r88 = 0; r88 < t46.length; r88++) { const l23 = t46[r88]; l23.length && 0 !== r88 && o90.push(n47.length / 2); const c29 = []; let d35, f9; d35 = l23[1].sub(l23[0])._perp()._unit(), a47.ringIndices.push(l23.length - 1); for (let t47 = 1; t47 < l23.length; t47++) { const e59 = l23[t47], r89 = l23[t47 === l23.length - 1 ? 1 : t47 + 1], o91 = e59.clone(); if (A4) { f9 = r89.sub(e59)._perp()._unit(); const t48 = d35.add(f9)._unit(), n48 = A4 * Math.min(4, 1 / (d35.x * t48.x + d35.y * t48.y)); o91.x += n48 * t48.x, o91.y += n48 * t48.y, o91.x = Math.round(o91.x), o91.y = Math.round(o91.y), d35 = f9; } if (!y4 || 0 !== A4 && !M5 || I4(c29, o91) || c29.push(o91), Jp(this.layoutVertexArray, o91.x, o91.y, 0, 0, 1, 1, 0), this.wallMode) { const e60 = v8(t47, l23); Qp(this.wallVertexArray, x4.joinNormals[t47], !e60); } s19.vertexLength++, this.footprintVertices.emplaceBack(e59.x, e59.y), n47.push(e59.x, e59.y), p9 && ed(this.layoutVertexExtArray, h8.projectTilePoint(o91.x, o91.y, i26), h8.upVector(i26, o91.x, o91.y)); } y4 && (0 === A4 || M5) && (0 !== c29.length && I4(c29, c29[0]) && c29.pop(), this.groundEffect.addData(c29, e58, u12)); } const l22 = this.wallMode ? x4.indices : Ih(n47, o90); for (let t47 = 0; t47 < l22.length; t47 += 3) this.footprintIndices.emplaceBack(a47.vertexOffset + l22[t47 + 0], a47.vertexOffset + l22[t47 + 1], a47.vertexOffset + l22[t47 + 2]), this.indexArray.emplaceBack(r87 + l22[t47], r87 + l22[t47 + 2], r87 + l22[t47 + 1]), s19.primitiveLength++; a47.indexCount += l22.length, a47.vertexCount += this.footprintVertices.length - a47.vertexOffset; } for (let n47 = 0; n47 < t46.length; n47++) { const o90 = t46[n47]; f8.startRing(m6, o90[0]); let a48 = o90.length > 4 && md(o90[o90.length - 2], o90[0], o90[1]), l22 = A4 ? hd(o90[o90.length - 2], o90[0], o90[1], A4) : 0; const c29 = []; let g10, b9, w5; b9 = o90[1].sub(o90[0])._perp()._unit(); let _5 = true; for (let t47 = 1, n48 = 0; t47 < o90.length; t47++) { let u13 = o90[t47 - 1], d35 = o90[t47]; const M6 = o90[t47 === o90.length - 1 ? 1 : t47 + 1]; if (f8.appendEdge(m6, d35, u13), dd(d35, u13, e58)) { A4 && (b9 = M6.sub(d35)._perp()._unit(), _5 = !_5); continue; } const S5 = d35.sub(u13)._perp(), P4 = S5.x / (Math.abs(S5.x) + Math.abs(S5.y)), k7 = S5.y > 0 ? 1 : 0, z4 = u13.dist(d35); if (n48 + z4 > 32768 && (n48 = 0), A4) { w5 = M6.sub(d35)._perp()._unit(); let t48 = pd(u13, d35, M6, cd2(b9, w5), A4); isNaN(t48) && (t48 = 0); const e59 = d35.sub(u13)._unit(); u13 = u13.add(e59.mult(l22))._round(), d35 = d35.add(e59.mult(-t48))._round(), l22 = t48, b9 = w5, y4 && this.zoom >= 17 && (I4(c29, u13) || c29.push(u13), I4(c29, d35) || c29.push(d35)); } const E5 = s19.vertexLength, T5 = o90.length > 4 && md(u13, d35, M6); let B6 = yd(n48, a48, _5); if (Jp(this.layoutVertexArray, u13.x, u13.y, P4, k7, 0, 0, B6), Jp(this.layoutVertexArray, u13.x, u13.y, P4, k7, 0, 1, B6), this.wallMode) { const e59 = v8(t47 - 1, o90), r88 = x4.joinNormals[t47 - 1]; Qp(this.wallVertexArray, r88, e59), Qp(this.wallVertexArray, r88, e59); } if (n48 += z4, B6 = yd(n48, T5, !_5), a48 = T5, Jp(this.layoutVertexArray, d35.x, d35.y, P4, k7, 0, 0, B6), Jp(this.layoutVertexArray, d35.x, d35.y, P4, k7, 0, 1, B6), this.wallMode) { const e59 = v8(t47, o90), r88 = x4.joinNormals[t47]; Qp(this.wallVertexArray, r88, e59), Qp(this.wallVertexArray, r88, e59); } if (s19.vertexLength += 4, this.indexArray.emplaceBack(E5 + 0, E5 + 1, E5 + 2), this.indexArray.emplaceBack(E5 + 1, E5 + 3, E5 + 2), s19.primitiveLength += 2, A4) { const n49 = r87 + (1 === t47 ? o90.length - 2 : t47 - 2), i27 = 1 === t47 ? r87 : n49 + 1; if (this.indexArray.emplaceBack(E5 + 1, n49, E5 + 3), this.indexArray.emplaceBack(n49, i27, E5 + 3), s19.primitiveLength += 2, void 0 === g10 && (g10 = E5), !dd(M6, o90[t47], e58)) { const e59 = t47 === o90.length - 1 ? g10 : s19.vertexLength; this.indexArray.emplaceBack(E5 + 2, E5 + 3, e59), this.indexArray.emplaceBack(E5 + 3, e59 + 1, e59), this.indexArray.emplaceBack(E5 + 3, i27, e59 + 1), s19.primitiveLength += 3; } _5 = !_5; } if (p9) { const t48 = this.layoutVertexExtArray, e59 = h8.projectTilePoint(u13.x, u13.y, i26), r88 = h8.projectTilePoint(d35.x, d35.y, i26), n49 = h8.upVector(i26, u13.x, u13.y), s20 = h8.upVector(i26, d35.x, d35.y); ed(t48, e59, n49), ed(t48, e59, n49), ed(t48, r88, s20), ed(t48, r88, s20); } } d34 && (r87 += o90.length - 1), y4 && A4 && this.zoom >= 17 && (0 !== c29.length && I4(c29, c29[0]) && c29.pop(), this.groundEffect.addData(c29, e58, u12, A4 > 0)); } this.footprintSegments.push(a47), o89.triangleCount = this.indexArray.length - o89.triangleArrayOffset, this.polygonSegments.push(o89), ++m6.footprintSegLen, ++m6.polygonSegLen; } if (m6.vertexCount = this.layoutVertexArray.length - m6.vertexArrayOffset, m6.groundVertexCount = this.groundEffect.vertexArray.length - m6.groundVertexArrayOffset, 0 !== m6.vertexCount) { if (m6.centroidXY = f8.borders ? Yp : this.encodeCentroid(f8, m6), this.centroidData.push(m6), f8.borders) { this.featuresOnBorder.push(f8); const t46 = this.featuresOnBorder.length - 1; for (let e58 = 0; e58 < f8.borders.length; e58++) f8.borders[e58][0] !== Number.MAX_VALUE && this.borderFeatureIndices[e58].push(t46); } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e57, n45, s18, o88, i26, l21, void 0, this.worldview), this.groundEffect.addPaintPropertiesData(e57, n45, s18, o88, i26, l21, this.worldview), this.maxHeight = Math.max(this.maxHeight, g9); } } sortBorders() { for (let t45 = 0; t45 < this.borderFeatureIndices.length; t45++) this.borderFeatureIndices[t45].sort(((e57, r86) => this.featuresOnBorder[e57].borders[t45][0] - this.featuresOnBorder[r86].borders[t45][0])); } splitToSubtiles() { const t45 = []; for (let e58 = 0; e58 < this.centroidData.length; e58++) { const r87 = this.centroidData[e58], n46 = +(r87.min.y + r87.max.y > Rn), i27 = 2 * n46 + (+(r87.min.x + r87.max.x > Rn) ^ n46); for (let n47 = 0; n47 < r87.polygonSegLen; n47++) { const s19 = r87.polygonSegIdx + n47; t45.push({ centroidIdx: e58, subtile: i27, polygonSegmentIdx: s19, triangleSegmentIdx: this.polygonSegments[s19].triangleSegIdx }); } } const e57 = new Ea(); t45.sort(((t46, e58) => t46.triangleSegmentIdx === e58.triangleSegmentIdx ? t46.subtile - e58.subtile : t46.triangleSegmentIdx - e58.triangleSegmentIdx)); let r86 = 0, n45 = 0, i26 = 0; for (const e58 of t45) { if (e58.triangleSegmentIdx !== r86) break; i26++; } const s18 = t45.length; for (; n45 !== t45.length; ) { r86 = t45[n45].triangleSegmentIdx; let o88 = 0, a46 = n45, l21 = n45; for (let e58 = a46; e58 < i26 && t45[e58].subtile === o88; e58++) l21++; for (; a46 !== i26; ) { const n46 = t45[a46]; o88 = n46.subtile; const s19 = this.centroidData[n46.centroidIdx].min.clone(), u12 = this.centroidData[n46.centroidIdx].max.clone(), c28 = { vertexOffset: this.segments.segments[r86].vertexOffset, primitiveOffset: e57.length, vertexLength: this.segments.segments[r86].vertexLength, primitiveLength: 0, sortKey: void 0, vaos: {} }; for (let r87 = a46; r87 < l21; r87++) { const n47 = t45[r87], i27 = this.polygonSegments[n47.polygonSegmentIdx], o89 = this.centroidData[n47.centroidIdx].min, a47 = this.centroidData[n47.centroidIdx].max, l22 = this.indexArray.uint16; for (let t46 = i27.triangleArrayOffset; t46 < i27.triangleArrayOffset + i27.triangleCount; t46++) e57.emplaceBack(l22[3 * t46], l22[3 * t46 + 1], l22[3 * t46 + 2]); c28.primitiveLength += i27.triangleCount, s19.x = Math.min(s19.x, o89.x), s19.y = Math.min(s19.y, o89.y), u12.x = Math.max(u12.x, a47.x), u12.y = Math.max(u12.y, a47.y); } c28.primitiveLength > 0 && this.triangleSubSegments.push({ segment: c28, min: s19, max: u12 }), a46 = l21; for (let e58 = a46; e58 < i26 && t45[e58].subtile === t45[a46].subtile; e58++) l21++; } n45 = i26; for (let e58 = n45; e58 < s18 && t45[e58].triangleSegmentIdx === t45[n45].triangleSegmentIdx; e58++) i26++; } e57._trim(), this.indexArray = e57; } getVisibleSegments(t45, e57, r86) { const n45 = new al(); if (this.wallMode) { for (const t46 of this.triangleSubSegments) n45.segments.push(t46.segment); return n45; } let i26 = 0, s18 = 0; const o88 = 1 << t45.canonical.z; if (e57) { const r87 = e57.getMinMaxForTile(t45); r87 && (i26 = r87.min, s18 = r87.max); } s18 += this.maxHeight; const a46 = t45.toUnwrapped(); let l21; const u12 = [a46.canonical.x / o88 + a46.wrap, a46.canonical.y / o88], c28 = [(a46.canonical.x + 1) / o88 + a46.wrap, (a46.canonical.y + 1) / o88], h8 = (t46, e58, r87) => [t46[0] * (1 - r87[0]) + e58[0] * r87[0], t46[1] * (1 - r87[1]) + e58[1] * r87[1]], p9 = [], d34 = []; for (const t46 of this.triangleSubSegments) { p9[0] = t46.min.x / Rn, p9[1] = t46.min.y / Rn, d34[0] = t46.max.x / Rn, d34[1] = t46.max.y / Rn; const e58 = h8(u12, c28, p9), o89 = h8(u12, c28, d34); if (0 === new Xu([e58[0], e58[1], i26], [o89[0], o89[1], s18]).intersectsPrecise(r86)) { l21 && (n45.segments.push(l21), l21 = void 0); continue; } const a47 = t46.segment; l21 && l21.vertexOffset !== a47.vertexOffset && (n45.segments.push(l21), l21 = void 0), l21 ? (l21.vertexLength += a47.vertexLength, l21.primitiveLength += a47.primitiveLength) : l21 = { vertexOffset: a47.vertexOffset, primitiveLength: a47.primitiveLength, vertexLength: a47.vertexLength, primitiveOffset: a47.primitiveOffset, sortKey: void 0, vaos: {} }; } return l21 && n45.segments.push(l21), n45; } encodeCentroid(t45, e57) { const r86 = t45.centroid(), n45 = e57.span(), i26 = Math.min(7, Math.round(n45.x * this.tileToMeter / 10)), s18 = Math.min(7, Math.round(n45.y * this.tileToMeter / 10)); return new wt(Tt2(r86.x, 1, Rn - 1) << 3 | i26, Tt2(r86.y, 1, Rn - 1) << 3 | s18); } encodeBorderCentroid(t45) { if (!t45.borders) return new wt(0, 0); const e57 = t45.borders, r86 = Number.MAX_VALUE; if (e57[0][0] !== r86 || e57[1][0] !== r86) { const t46 = e57[0][0] !== r86 ? 0 : 1; return new wt(6 | (e57[0][0] !== r86 ? 0 : 65528), (e57[t46][0] + e57[t46][1]) / 2 << 3 | 6); } { const t46 = e57[2][0] !== r86 ? 2 : 3; return new wt((e57[t46][0] + e57[t46][1]) / 2 << 3 | 6, 6 | (e57[2][0] !== r86 ? 0 : 65528)); } } showCentroid(t45) { const e57 = this.centroidData[t45.centroidDataIndex]; e57.flags &= 2147483647, e57.centroidXY.x = 0, e57.centroidXY.y = 0, this.writeCentroidToBuffer(e57); } writeCentroidToBuffer(t45) { this.groundEffect.updateHiddenByLandmark(t45); const e57 = t45.vertexArrayOffset, r86 = t45.vertexCount + t45.vertexArrayOffset, n45 = t45.flags & Kp ? Yp : t45.centroidXY, i26 = this.centroidVertexArray.geta_centroid_pos0(e57); if (this.centroidVertexArray.geta_centroid_pos1(e57) !== n45.y || i26 !== n45.x) { for (let t46 = e57; t46 < r86; ++t46) this.centroidVertexArray.emplace(t46, n45.x, n45.y); this.needsCentroidUpdate = true; } } createCentroidsBuffer() { this.centroidVertexArray.resize(this.layoutVertexArray.length), this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); for (const t45 of this.centroidData) this.writeCentroidToBuffer(t45); } updateReplacement(t45, e57, r86) { if (e57.updateTime === this.replacementUpdateTime) return; this.replacementUpdateTime = e57.updateTime; const n45 = e57.getReplacementRegionsForTile(t45.toUnwrapped()); if (Dp(this.activeReplacements, n45)) return; if (this.activeReplacements = n45, 0 === this.centroidVertexArray.length) this.createCentroidsBuffer(); else for (const t46 of this.centroidData) t46.flags &= 2147483647; const i26 = []; for (const e58 of this.activeReplacements) { if (e58.order < r86) continue; const n46 = Math.max(1, Math.pow(2, e58.footprintTileId.canonical.z - t45.canonical.z)); if (e58.footprint.buildingId) { const t46 = e58.footprint.buildingId; for (const e59 of this.centroidData) e59.buildingId === t46 && (e59.flags |= Kp); } else for (const r87 of this.centroidData) if (!(r87.flags & Kp || e58.min.x > r87.max.x || r87.min.x > e58.max.x || e58.min.y > r87.max.y || r87.min.y > e58.max.y)) for (let s18 = 0; s18 < r87.footprintSegLen; s18++) { const o88 = this.footprintSegments[r87.footprintSegIdx + s18]; if (i26.length = 0, vd(this.footprintVertices, o88.vertexOffset, o88.vertexCount, e58.footprintTileId.canonical, t45.canonical, i26), Op(e58.footprint, i26, this.footprintIndices.uint16, o88.indexOffset, o88.indexCount, -o88.vertexOffset, -n46)) { r87.flags |= Kp; break; } } } for (const t46 of this.centroidData) this.writeCentroidToBuffer(t46); this.borderDoneWithNeighborZ = [-1, -1, -1, -1]; } footprintContainsPoint(t45, e57, r86) { let n45 = false; for (let i26 = 0; i26 < r86.footprintSegLen; i26++) { const s18 = this.footprintSegments[r86.footprintSegIdx + i26]; let o88 = 0; for (const r87 of s18.ringIndices) { for (let i27 = o88, a46 = r87 + o88 - 1; i27 < r87 + o88; a46 = i27++) { const r88 = this.footprintVertices.int16[2 * (i27 + s18.vertexOffset) + 0], o89 = this.footprintVertices.int16[2 * (i27 + s18.vertexOffset) + 1], l21 = this.footprintVertices.int16[2 * (a46 + s18.vertexOffset) + 1]; o89 > e57 != l21 > e57 && t45 < (this.footprintVertices.int16[2 * (a46 + s18.vertexOffset) + 0] - r88) * (e57 - o89) / (l21 - o89) + r88 && (n45 = !n45); } o88 = r87; } } return n45; } getHeightAtTileCoord(t45, e57) { let r86 = Number.NEGATIVE_INFINITY, n45 = true; const i26 = 4 * (t45 + Rn) * Rn + (e57 + Rn); if (this.partLookup.hasOwnProperty(i26)) { const t46 = this.partLookup[i26]; return t46 ? { height: t46.height, hidden: !!(t46.flags & Kp) } : void 0; } for (const s18 of this.centroidData) t45 > s18.max.x || s18.min.x > t45 || e57 > s18.max.y || s18.min.y > e57 || s18.height <= r86 || this.footprintContainsPoint(t45, e57, s18) && (r86 = s18.height, this.partLookup[i26] = s18, n45 = !!(s18.flags & Kp)); if (r86 !== Number.NEGATIVE_INFINITY) return { height: r86, hidden: n45 }; this.partLookup[i26] = void 0; } } function cd2(t45, e57) { const r86 = t45.add(e57)._unit(); return t45.x * r86.x + t45.y * r86.y; } function hd(t45, e57, r86, n45) { const i26 = e57.sub(t45)._perp()._unit(), s18 = r86.sub(e57)._perp()._unit(); return pd(t45, e57, r86, cd2(i26, s18), n45); } function pd(t45, e57, r86, n45, i26) { const s18 = Math.sqrt(1 - n45 * n45); return Math.min(t45.dist(e57) / 3, e57.dist(r86) / 3, i26 * s18 / n45); } function dd(t45, e57, r86) { return t45.x < r86[0].x && e57.x < r86[0].x || t45.x > r86[1].x && e57.x > r86[1].x || t45.y < r86[0].y && e57.y < r86[0].y || t45.y > r86[1].y && e57.y > r86[1].y; } function fd(t45, e57) { return t45.x < e57[0].x || t45.x > e57[1].x || t45.y < e57[0].y || t45.y > e57[1].y; } function md(t45, e57, r86) { if (t45.x < 0 || t45.x >= Rn || e57.x < 0 || e57.x >= Rn || r86.x < 0 || r86.x >= Rn) return false; const n45 = r86.sub(e57), i26 = n45.perp(), s18 = t45.sub(e57); return (n45.x * s18.x + n45.y * s18.y) / Math.sqrt((n45.x * n45.x + n45.y * n45.y) * (s18.x * s18.x + s18.y * s18.y)) > -0.866 && i26.x * s18.x + i26.y * s18.y < 0; } function yd(t45, e57, r86) { const n45 = e57 ? 2 | t45 : -3 & t45; return r86 ? 1 | n45 : -2 & n45; } function gd() { const t45 = Math.PI / 32, e57 = Math.tan(t45), r86 = Kl; return r86 * Math.sqrt(1 + 2 * e57 * e57) - r86; } function xd(t45, e57, r86) { const n45 = 1 << r86.z, i26 = au(r86.x / n45), s18 = au((r86.x + 1) / n45), o88 = lu(r86.y / n45), a46 = lu((r86.y + 1) / n45); return (function(t46, e58, r87, n46, i27 = 0, s19) { const o89 = []; if (!t46.length || !r87 || !n46) return o89; const a47 = (t47, e59) => { for (const r88 of t47) o89.push({ polygon: r88, bounds: e59 }); }, l21 = Math.ceil(Math.log2(r87)), u12 = Math.ceil(Math.log2(n46)), c28 = l21 - u12, h8 = []; for (let t47 = 0; t47 < Math.abs(c28); t47++) h8.push(c28 > 0 ? 0 : 1); for (let t47 = 0; t47 < Math.min(l21, u12); t47++) h8.push(0), h8.push(1); let p9 = t46; if (p9 = up(p9, e58[0].y - i27, e58[1].y + i27, 1), p9 = up(p9, e58[0].x - i27, e58[1].x + i27, 0), !p9.length) return o89; const d34 = []; for (h8.length ? d34.push({ polygons: p9, bounds: e58, depth: 0 }) : a47(p9, e58); d34.length; ) { const t47 = d34.pop(), e59 = t47.depth, r88 = h8[e59], n47 = t47.bounds[0], o90 = t47.bounds[1], l22 = 0 === r88 ? n47.x : n47.y, u13 = 0 === r88 ? o90.x : o90.y, c29 = s19 ? s19(r88, l22, u13) : 0.5 * (l22 + u13), p10 = up(t47.polygons, l22 - i27, c29 + i27, r88), f8 = up(t47.polygons, c29 - i27, u13 + i27, r88); if (p10.length) { const t48 = [n47, new wt(0 === r88 ? c29 : o90.x, 1 === r88 ? c29 : o90.y)]; h8.length > e59 + 1 ? d34.push({ polygons: p10, bounds: t48, depth: e59 + 1 }) : a47(p10, t48); } if (f8.length) { const t48 = [new wt(0 === r88 ? c29 : n47.x, 1 === r88 ? c29 : n47.y), o90]; h8.length > e59 + 1 ? d34.push({ polygons: f8, bounds: t48, depth: e59 + 1 }) : a47(f8, t48); } } return o89; })(t45, e57, Math.ceil((s18 - i26) / 11.25), Math.ceil((o88 - a46) / 11.25), 1, ((t46, e58, i27) => { if (0 === t46) return 0.5 * (e58 + i27); { const t47 = lu((r86.y + e58 / Rn) / n45); return (su(0.5 * (lu((r86.y + i27 / Rn) / n45) + t47)) * n45 - r86.y) * Rn; } })); } function vd(t45, e57, r86, n45, i26, s18) { const o88 = Math.pow(2, n45.z - i26.z); for (let a46 = 0; a46 < r86; a46++) { let r87 = t45.int16[2 * (a46 + e57) + 0], l21 = t45.int16[2 * (a46 + e57) + 1]; r87 = (r87 + i26.x * Rn) * o88 - n45.x * Rn, l21 = (l21 + i26.y * Rn) * o88 - n45.y * Rn, s18.push(new wt(r87, l21)); } } let bd2, wd; Ws(ud, "FillExtrusionBucket", { omit: ["layers", "features"] }), Ws(nd, "PartData"), Ws(rd, "FootprintSegment"), Ws(id, "BorderCentroidData"), Ws(ld, "GroundEffect"); class _d2 extends wt { constructor(t45, e57, r86) { super(t45, e57), this.z = r86; } } class Ad extends _d2 { constructor(t45, e57, r86, n45) { super(t45, e57, r86), this.w = n45; } } function Md(t45, e57, r86, n45) { const i26 = "x" === r86 ? "y" : "x", s18 = (n45 - t45[r86]) / (e57[r86] - t45[r86]); t45[i26] = Math.round(t45[i26] + (e57[i26] - t45[i26]) * s18), t45[r86] = n45, t45.hasOwnProperty("z") && (t45.z = ur(t45.z, e57.z, s18)), t45.hasOwnProperty("w") && (t45.w = ur(t45.w, e57.w, s18)); } function Id(t45, e57, r86, n45) { const i26 = r86, s18 = n45; for (const r87 of ["x", "y"]) { let n46 = t45, o88 = e57; n46[r87] >= o88[r87] && (n46 = e57, o88 = t45), n46[r87] < i26 && o88[r87] > i26 && Md(n46, o88, r87, i26), n46[r87] < s18 && o88[r87] > s18 && Md(o88, n46, r87, s18); } } function Sd(t45, e57, r86, n45, i26, s18) { const o88 = []; for (let a46 = 0; a46 < t45.length; a46++) { const l21 = t45[a46]; let u12; const c28 = o88.length; let h8 = 0; for (let t46 = 0; t46 < l21.length - 1; t46++) { let c29 = l21[t46], p9 = l21[t46 + 1], d34 = 0; const f8 = h8; let m6, y4; s18 && (d34 = Math.hypot(p9.x - c29.x, p9.y - c29.y), h8 += d34, m6 = c29, y4 = p9), c29.x < e57 && p9.x < e57 || (c29.x < e57 ? c29 = new wt(e57, c29.y + (e57 - c29.x) / (p9.x - c29.x) * (p9.y - c29.y))._round() : p9.x < e57 && (p9 = new wt(e57, c29.y + (e57 - c29.x) / (p9.x - c29.x) * (p9.y - c29.y))._round()), c29.y < r86 && p9.y < r86 || (c29.y < r86 ? c29 = new wt(c29.x + (r86 - c29.y) / (p9.y - c29.y) * (p9.x - c29.x), r86)._round() : p9.y < r86 && (p9 = new wt(c29.x + (r86 - c29.y) / (p9.y - c29.y) * (p9.x - c29.x), r86)._round()), c29.x >= n45 && p9.x >= n45 || (c29.x >= n45 ? c29 = new wt(n45, c29.y + (n45 - c29.x) / (p9.x - c29.x) * (p9.y - c29.y))._round() : p9.x >= n45 && (p9 = new wt(n45, c29.y + (n45 - c29.x) / (p9.x - c29.x) * (p9.y - c29.y))._round()), c29.y >= i26 && p9.y >= i26 || (c29.y >= i26 ? c29 = new wt(c29.x + (i26 - c29.y) / (p9.y - c29.y) * (p9.x - c29.x), i26)._round() : p9.y >= i26 && (p9 = new wt(c29.x + (i26 - c29.y) / (p9.y - c29.y) * (p9.x - c29.x), i26)._round()), u12 && c29.equals(u12[u12.length - 1]) || (u12 = [c29], o88.push(u12), s18 && s18.push({ progress: { min: f8 + kd(m6, y4, c29) * d34, max: 1 }, parentIndex: a46, prevPoint: m6, nextPoint: y4 })), u12.push(p9), s18 && (s18[s18.length - 1].progress.max = f8 + kd(m6, y4, p9) * d34, s18[s18.length - 1].nextPoint = y4))))); } if (s18 && h8 > 0) for (let t46 = c28; t46 < o88.length; t46++) s18[t46].progress.min /= h8, s18[t46].progress.max /= h8; } return o88; } function Pd(t45, e57, r86, n45, i26) { if (t45.length < 2) return void n45.push(t45); const s18 = []; for (; e57.valid(); ) { const [r87, n46] = e57.get(); for (let e58 = 0; e58 < t45.length - 1; e58++) { const i27 = t45[e58], o89 = t45[e58 + 1], a47 = oc(i27, o89, r87, n46); if (a47) { const [t46] = a47, r88 = new wt(ur(i27.x, o89.x, t46), ur(i27.y, o89.y, t46)); s18.push({ t: e58 + t46, distance: 0, point: r88 }); } } e57.next(); } if (0 === s18.length) return void n45.push(t45); s18.sort(((t46, e58) => t46.t - e58.t)); let o88 = 0, a46 = 0, l21 = []; for (n45.push(l21); o88 !== t45.length; ) { if (a46 === s18.length) { for (; o88 !== t45.length; ) 0 !== l21.length && l21[l21.length - 1].equals(t45[o88]) || l21.push(t45[o88]), o88++; break; } s18[a46].t <= o88 ? (0 !== l21.length && l21[l21.length - 1].equals(s18[a46].point) || l21.push(s18[a46].point), Math.trunc(s18[a46].t), a46++) : (0 !== l21.length && l21[l21.length - 1].equals(t45[o88]) || l21.push(t45[o88]), o88++); } } function kd(t45, e57, r86) { return t45.x !== e57.x ? (r86.x - t45.x) / (e57.x - t45.x) : t45.y !== e57.y ? (r86.y - t45.y) / (e57.y - t45.y) : 0; } function zd(t45, e57) { return t45.x * e57.x + t45.y * e57.y; } function Ed(t45, e57) { if (1 === t45.length) { let r86 = 0; const n45 = e57[r86++]; let i26; for (; !i26 || n45.equals(i26); ) if (i26 = e57[r86++], !i26) return 1 / 0; for (; r86 < e57.length; r86++) { const s18 = e57[r86], o88 = t45[0], a46 = i26.sub(n45), l21 = s18.sub(n45), u12 = o88.sub(n45), c28 = zd(a46, a46), h8 = zd(a46, l21), p9 = zd(l21, l21), d34 = zd(u12, a46), f8 = zd(u12, l21), m6 = c28 * p9 - h8 * h8, y4 = (p9 * d34 - h8 * f8) / m6, g9 = (c28 * f8 - h8 * d34) / m6, x4 = n45.z * (1 - y4 - g9) + i26.z * y4 + s18.z * g9; if (isFinite(x4)) return x4; } return 1 / 0; } { let t46 = 1 / 0; for (const r86 of e57) t46 = Math.min(t46, r86.z); return t46; } } function Td(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = o88 * i26.getElevationAt(t45, e57, true, true), u12 = 0 !== s18[0], c28 = u12 ? 0 === s18[1] ? o88 * (s18[0] / 7 - 450) : o88 * (function(t46, e58, r87) { const n46 = Math.floor(e58[0] / 8), i27 = Math.floor(e58[1] / 8), s19 = 10 * (e58[0] - 8 * n46), o89 = 10 * (e58[1] - 8 * i27), a47 = t46.getElevationAt(n46, i27, true, true), l22 = t46.getMeterToDEM(r87), u13 = Math.floor(0.5 * (s19 * l22 - 1)), c29 = Math.floor(0.5 * (o89 * l22 - 1)), h8 = t46.tileCoordToPixel(n46, i27), p9 = 2 * u13 + 1, d34 = 2 * c29 + 1, f8 = (function(t47, e59, r88, n47, i28) { return [t47.getElevationAtPixel(e59, r88, true), t47.getElevationAtPixel(e59 + i28, r88, true), t47.getElevationAtPixel(e59, r88 + i28, true), t47.getElevationAtPixel(e59 + n47, r88 + i28, true)]; })(t46, h8.x - u13, h8.y - c29, p9, d34), m6 = Math.abs(f8[0] - f8[1]), y4 = Math.abs(f8[2] - f8[3]), g9 = Math.abs(f8[0] - f8[2]) + Math.abs(f8[1] - f8[3]), x4 = Math.min(0.25, 0.5 * l22 * (m6 + y4) / p9), v8 = Math.min(0.25, 0.5 * l22 * g9 / d34); return a47 + Math.max(x4 * s19, v8 * o89); })(i26, s18, a46) : l21; return { base: l21 + (0 === r86 ? -1 : r86), top: u12 ? Math.max(c28 + n45, l21 + r86 + 2) : l21 + n45 }; } class Bd { constructor(t45) { this._callback = t45, this._triggered = false, "undefined" != typeof MessageChannel && (this._channel = new MessageChannel(), this._channel.port2.onmessage = () => { this._triggered = false, this._callback(); }); } trigger() { this._triggered || (this._triggered = true, this._channel ? this._channel.port1.postMessage(true) : setTimeout((() => { this._triggered = false, this._callback(); }), 0)); } remove() { this._channel = void 0, this._callback = () => { }; } } class Vd { constructor() { this.tasks = {}, this.taskQueue = [], Lt2(["process"], this), this.invoker = new Bd(this.process), this.nextId = 0; } add(t45, e57) { const r86 = this.nextId++, n45 = (function({ type: t46, isSymbolTile: e58, zoom: r87 }) { return r87 = r87 || 0, "message" === t46 ? 0 : "maybePrepare" !== t46 || e58 ? "parseTile" !== t46 || e58 ? "parseTile" === t46 && e58 ? 300 - r87 : "maybePrepare" === t46 && e58 ? 400 - r87 : 500 : 200 - r87 : 100 - r87; })(e57); if (0 === n45) { try { t45(); } finally { } return null; } return this.tasks[r86] = { fn: t45, metadata: e57, priority: n45, id: r86 }, this.taskQueue.push(r86), this.invoker.trigger(), { cancel: () => { delete this.tasks[r86]; } }; } process() { try { if (this.taskQueue = this.taskQueue.filter(((t46) => !!this.tasks[t46])), !this.taskQueue.length) return; const t45 = this.pick(); if (null === t45) return; const e57 = this.tasks[t45]; if (delete this.tasks[t45], this.taskQueue.length && this.invoker.trigger(), !e57) return; e57.fn(); } finally { } } pick() { let t45 = null, e57 = 1 / 0; for (let r87 = 0; r87 < this.taskQueue.length; r87++) { const n45 = this.tasks[this.taskQueue[r87]]; n45.priority < e57 && (e57 = n45.priority, t45 = r87); } if (null === t45) return null; const r86 = this.taskQueue[t45]; return this.taskQueue.splice(t45, 1), r86; } remove() { this.invoker.remove(); } } class Fd { constructor(t45, e57, r86) { this.target = t45, this.parent = e57, this.mapId = r86, this.callbacks = {}, this.cancelCallbacks = {}, Lt2(["receive"], this), this.target.addEventListener("message", this.receive, false), this.scheduler = new Vd(); } send(t45, e57, r86, n45, i26 = false, s18) { const o88 = Math.round(1e18 * Math.random()).toString(36).substring(0, 10); r86 && (r86.metadata = s18, this.callbacks[o88] = r86); const a46 = /* @__PURE__ */ new Set(); return this.target.postMessage({ id: o88, type: t45, hasCallback: !!r86, targetMapId: n45, mustQueue: i26, sourceMapId: this.mapId, data: Js(e57, a46) }, a46), { cancel: () => { r86 && delete this.callbacks[o88], this.target.postMessage({ id: o88, type: "", targetMapId: n45, sourceMapId: this.mapId }); } }; } receive(t45) { const e57 = t45.data; if (!e57) return; const r86 = e57.id; if (r86 && (!e57.targetMapId || this.mapId === e57.targetMapId)) if ("" === e57.type) { const t46 = this.cancelCallbacks[r86]; delete this.cancelCallbacks[r86], t46 && t46.cancel(); } else if (e57.mustQueue || Zt2(self)) { const t46 = this.callbacks[r86], n45 = this.scheduler.add((() => this.processTask(r86, e57)), t46 && t46.metadata || { type: "message" }); n45 && (this.cancelCallbacks[r86] = n45); } else this.processTask(r86, e57); } processTask(t45, e57) { if (delete this.cancelCallbacks[t45], "" === e57.type) { const r86 = this.callbacks[t45]; delete this.callbacks[t45], r86 && (e57.error ? r86(Qs(e57.error)) : r86(null, Qs(e57.data))); } else { const r86 = /* @__PURE__ */ new Set(), n45 = e57.hasCallback ? (e58, n46) => { this.target.postMessage({ id: t45, type: "", sourceMapId: this.mapId, error: e58 ? Js(e58) : null, data: Js(n46, r86) }, r86); } : () => { }, i26 = Qs(e57.data); if (this.parent[e57.type]) this.parent[e57.type](e57.sourceMapId, i26, n45); else if (this.parent.getWorkerSource) { const t46 = e57.type.split("."), { source: r87, scope: s18 } = i26; this.parent.getWorkerSource(e57.sourceMapId, t46[0], r87, s18)[t46[1]](i26, n45); } else n45(new Error(`Could not find function ${e57.type}`)); } } remove() { this.scheduler.remove(), this.target.removeEventListener("message", this.receive, false); } } var Cd = { workerUrl: "", workerClass: null, workerParams: void 0 }; const Dd = "mapboxgl_preloaded_worker_pool"; class Rd { constructor() { this.active = {}; } acquire(t45, e57 = Rd.workerCount) { if (!this.workers) for (this.workers = []; this.workers.length < e57; ) this.workers.push(null != Cd.workerClass ? new Cd.workerClass() : new self.Worker(Cd.workerUrl, Cd.workerParams)); return this.active[t45] = true, this.workers.slice(); } release(t45) { delete this.active[t45], this.workers && 0 === this.numActive() && (this.workers.forEach(((t46) => { t46.terminate(); })), this.workers = null); } isPreloaded() { return !!this.active[Dd]; } numActive() { return Object.keys(this.active).length; } } Rd.workerCount = 2; class Ld { constructor(t45, e57, r86 = "Worker", n45 = Rd.workerCount) { this.workerPool = t45, this.actors = [], this.currentActor = 0, this.id = Dt(); const i26 = this.workerPool.acquire(this.id, n45); for (let t46 = 0; t46 < i26.length; t46++) { const n46 = new Ld.Actor(i26[t46], e57, this.id); n46.name = `${r86} ${t46}`, this.actors.push(n46); } this.ready = false, this.broadcast("checkIfReady", null, (() => { this.ready = true; })); } broadcast(t45, e57, r86) { Ft(this.actors, ((r87, n45) => { r87.send(t45, e57, n45); }), r86 = r86 || function() { }); } getActor() { return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor]; } remove() { this.actors.forEach(((t45) => { t45.remove(); })), this.actors = [], this.workerPool.release(this.id); } } let Od, Ud; function Nd() { return Od || (Od = new Rd()), Od; } Ld.Actor = Fd; class jd { constructor(t45) { this.module = t45; } createIntArray(t45) { const e57 = new Int32Array(t45), r86 = this.module.malloc(e57.length * e57.BYTES_PER_ELEMENT); return this.module.heap32.set(e57, r86 / e57.BYTES_PER_ELEMENT), r86; } createFloatArray(t45) { const e57 = new Float32Array(t45), r86 = this.module.malloc(e57.length * e57.BYTES_PER_ELEMENT); return this.module.heapF32.set(e57, r86 / e57.BYTES_PER_ELEMENT), r86; } createStringBuffer(t45) { const e57 = this.module.malloc(t45.length + 1); for (let r86 = 0; r86 < t45.length; ++r86) this.module.heapU8[e57 + r86] = t45.charCodeAt(r86); return this.module.heapU8[e57 + t45.length] = 0, e57; } readStringBuffer(t45) { let e57 = ""; for (; 0 !== this.module.heapU8[t45]; ) e57 += String.fromCharCode(this.module.heapU8[t45]), ++t45; return e57; } setStyle(t45) { const e57 = t45.entranceColorRgb, r86 = t45.facadeGlazingColorRgb, n45 = t45.roofColorRgb, i26 = t45.wallColorRgb, s18 = t45.normalScale; this.module.setStyle(e57[0], e57[1], e57[2], r86[0], r86[1], r86[2], n45[0], n45[1], n45[2], i26[0], i26[1], i26[2], s18[0], s18[1], s18[2], t45.tileToMeters); } setAOOptions(t45, e57) { this.module.setAOOptions(t45 ? 1 : 0, e57); } setMetricOptions(t45, e57) { this.module.setMetricOptions(t45 ? 1 : 0, e57); } setStructuralOptions(t45) { this.module.setStructuralOptions(t45 ? 1 : 0); } setFacadeOptions(t45, e57) { this.module.setFacadeOptions(t45, e57 ? 1 : 0); } setFauxFacadeOptions(t45, e57, r86) { this.module.setFauxFacadeOptions(t45 ? 1 : 0, e57 ? 1 : 0, r86); } setFacadeClassifierOptions(t45) { this.module.setFacadeClassifierOptions(t45); } generateMesh(t45, e57) { for (const e58 of t45) { const t46 = this.createStringBuffer(e58.roofType), r87 = [0], n46 = []; for (const t47 of e58.coordinates) if (Array.isArray(t47)) { for (const e59 of t47) n46.push(e59.x), n46.push(e59.y); r87.push(n46.length); } const i27 = this.createIntArray(r87), s19 = this.createFloatArray(n46); this.module.addFeature(e58.id, e58.sourceId, e58.minHeight, e58.height, t46, e58.roofType.length, s19, i27, r87.length - 1), this.module.free(t46), this.module.free(i27), this.module.free(s19); } for (const t46 of e57) { let e58; e58 = t46.entrances ? JSON.parse(t46.entrances) : []; const r87 = this.createFloatArray(e58), n46 = []; for (const e59 of t46.coordinates) n46.push(e59.x), n46.push(e59.y); const i27 = this.createFloatArray(n46); this.module.addFacade(t46.sourceId, t46.crossPerc, t46.distanceToRoad, r87, e58.length, i27, n46.length), this.module.free(r87), this.module.free(i27); } if (!this.module.generateMesh()) { const t46 = this.module.getLastError(); return this.readStringBuffer(t46); } const r86 = this.module.getMeshCount(), n45 = new Array(r86); for (let t46 = 0; t46 < r86; t46++) { const e58 = this.module.getPositionsPtr(t46), r87 = this.module.getPositionsLength(t46), i27 = new Float32Array(this.module.heapF32.buffer, e58, r87), s19 = this.module.getNormalsPtr(t46), o88 = this.module.getNormalsLength(t46), a46 = new Float32Array(this.module.heapF32.buffer, s19, o88), l21 = this.module.getColorsPtr(t46), u12 = this.module.getColorsLength(t46), c28 = new Uint8Array(this.module.heapU8.buffer, l21, u12), h8 = this.module.getAOPtr(t46), p9 = this.module.getAOLength(t46), d34 = new Float32Array(this.module.heapF32.buffer, h8, p9), f8 = this.module.getUVPtr(t46), m6 = this.module.getUVLength(t46), y4 = new Float32Array(this.module.heapF32.buffer, f8, m6), g9 = this.module.getFauxFacadePtr(t46), x4 = this.module.getFauxFacadeLength(t46), v8 = new Uint8Array(this.module.heapU8.buffer, g9, x4), b8 = this.module.getIndicesPtr(t46), w4 = this.module.getIndicesLength(t46), _4 = new Int32Array(this.module.heap32.buffer, b8, w4), A4 = this.module.getBuildingPart(t46), M5 = this.readStringBuffer(A4); n45[t46] = { positions: i27, normals: a46, colors: c28, ao: d34, uv: y4, isFauxFacade: v8, indices: _4, buildingPart: M5 }; } const i26 = this.module.getRingCount(), s18 = []; for (let t46 = 0; t46 < i26; t46++) { const e58 = this.module.getRingPtr(t46), r87 = this.module.getRingLength(t46), n46 = new Float32Array(this.module.heapF32.buffer, e58, r87); s18.push(n46); } return { meshes: n45, outerRingLength: this.module.getOuterRingLength(), modifiedPolygonRings: s18 }; } } let $d, Gd, Hd, qd, Xd, Zd = null, Wd = null, Yd = null, Kd = null; function Jd() { return Zt2(self) && self.worker.dracoUrl ? self.worker.dracoUrl : Gd || ne2.DRACO_URL; } function Qd() { if (Zt2(self) && self.worker.meshoptUrl) return self.worker.meshoptUrl; if (qd) return qd; const t45 = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]); if ("object" != typeof WebAssembly) throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer"); return qd = WebAssembly.validate(t45) ? ne2.MESHOPT_SIMD_URL : ne2.MESHOPT_URL, qd; } function tf() { return Kd; } const ef = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, 5123: Uint16Array, 5125: Uint32Array, 5126: Float32Array }, rf = { 5120: "DT_INT8", 5121: "DT_UINT8", 5122: "DT_INT16", 5123: "DT_UINT16", 5125: "DT_UINT32", 5126: "DT_FLOAT32" }, nf = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 }; function sf(t45, e57, r86) { const n45 = r86.json.bufferViews.length, i26 = r86.buffers.length; e57.bufferView = n45, r86.json.bufferViews[n45] = { buffer: i26, byteLength: t45.byteLength }, r86.buffers[i26] = t45; } const of2 = "KHR_draco_mesh_compression"; function af(t45, e57) { const r86 = t45.extensions && t45.extensions[of2]; if (!r86) return; const n45 = new Hd.Decoder(), i26 = ff(e57, r86.bufferView), s18 = new Hd.Mesh(); if (!n45.DecodeArrayToMesh(i26, i26.byteLength, s18)) throw new Error("Failed to decode Draco mesh"); const o88 = e57.json.accessors[t45.indices], a46 = ef[o88.componentType], l21 = o88.count * a46.BYTES_PER_ELEMENT, u12 = Hd._malloc(l21); a46 === Uint16Array ? n45.GetTrianglesUInt16Array(s18, l21, u12) : n45.GetTrianglesUInt32Array(s18, l21, u12), sf(Hd.memory.buffer.slice(u12, u12 + l21), o88, e57), Hd._free(u12); for (const i27 of Object.keys(r86.attributes)) { const o89 = n45.GetAttributeByUniqueId(s18, r86.attributes[i27]), a47 = e57.json.accessors[t45.attributes[i27]], l22 = rf[a47.componentType], u13 = a47.count * nf[a47.type] * ef[a47.componentType].BYTES_PER_ELEMENT, c28 = Hd._malloc(u13); n45.GetAttributeDataArrayForAllPoints(s18, o89, Hd[l22], u13, c28), sf(Hd.memory.buffer.slice(c28, c28 + u13), a47, e57), Hd._free(c28); } n45.destroy(), s18.destroy(), delete t45.extensions[of2]; } const lf = "EXT_meshopt_compression"; function uf(t45, e57) { if (!t45.extensions || !t45.extensions[lf]) return; const r86 = t45.extensions[lf], n45 = new Uint8Array(e57.buffers[r86.buffer], r86.byteOffset || 0, r86.byteLength || 0), i26 = new Uint8Array(r86.count * r86.byteStride); Xd.decodeGltfBuffer(i26, r86.count, r86.byteStride, n45, r86.mode, r86.filter), t45.buffer = e57.buffers.length, t45.byteOffset = 0, e57.buffers[t45.buffer] = i26.buffer, delete t45.extensions[lf]; } const cf = 1179937895, hf = new TextDecoder("utf8"); function pf(t45, e57) { return new URL(t45, e57).href; } function df(t45, e57, r86, n45) { return fetch(pf(t45.uri, n45)).then(((t46) => t46.arrayBuffer())).then(((t46) => { e57.buffers[r86] = t46; })); } function ff(t45, e57) { const r86 = t45.json.bufferViews[e57]; return new Uint8Array(t45.buffers[r86.buffer], r86.byteOffset || 0, r86.byteLength); } function mf(t45, e57, r86, n45) { if (t45.uri) { const i26 = pf(t45.uri, n45); return fetch(i26).then(((t46) => t46.blob())).then(((t46) => createImageBitmap(t46))).then(((t46) => { e57.images[r86] = t46; })); } if (void 0 !== t45.bufferView) { const n46 = ff(e57, t45.bufferView), i26 = new Blob([n46], { type: t45.mimeType }); return createImageBitmap(i26).then(((t46) => { e57.images[r86] = t46; })); } } function yf(t45, e57 = 0, r86) { const n45 = { json: null, images: [], buffers: [] }; if (new Uint32Array(t45, e57, 1)[0] === cf) { const r87 = new Uint32Array(t45, e57); let i27 = 2; const s19 = (r87[i27++] >> 2) - 3, o89 = r87[i27++] >> 2; if (i27++, n45.json = JSON.parse(hf.decode(r87.subarray(i27, i27 + o89))), i27 += o89, i27 < s19) { const s20 = r87[i27++]; i27++; const o90 = e57 + (i27 << 2); n45.buffers[0] = t45.slice(o90, o90 + s20); } } else n45.json = JSON.parse(hf.decode(new Uint8Array(t45, e57))); const { buffers: i26, images: s18, meshes: o88, extensionsUsed: a46, bufferViews: l21 } = n45.json; let u12 = Promise.resolve(); if (i26) { const t46 = []; for (let e58 = 0; e58 < i26.length; e58++) { const s19 = i26[e58]; s19.uri ? t46.push(df(s19, n45, e58, r86)) : n45.buffers[e58] || (n45.buffers[e58] = null); } u12 = Promise.all(t46); } return u12.then((() => { const t46 = [], e58 = a46 && a46.includes(of2), i27 = a46 && a46.includes(lf); if (e58 && t46.push((function() { if (!Hd) return null != $d ? $d : ($d = (function(t47) { let e59, r87 = null; function n46() { e59 = new Uint8Array(r87.buffer); } function i28() { throw new Error("Unexpected Draco error."); } const s19 = { a: { a: i28, d: function(t48, r88, n47) { return e59.copyWithin(t48, r88, r88 + n47); }, c: function(t48) { const i29 = e59.length, s20 = Math.max(t48 >>> 0, Math.ceil(1.2 * i29)), o89 = Math.ceil((s20 - i29) / 65536); try { return r87.grow(o89), n46(), true; } catch (t49) { return false; } }, b: i28 } }; return (WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(t47, s19) : t47.then(((t48) => t48.arrayBuffer())).then(((t48) => WebAssembly.instantiate(t48, s19)))).then(((t48) => { const { Rb: i29, Qb: s20, P: o89, T: a47, X: l22, Ja: u13, La: c28, Qa: h8, Va: p9, Wa: d34, eb: f8, jb: m6, f: y4, e: g9, yb: x4, zb: v8, Ab: b8, Bb: w4, Db: _4, Gb: A4 } = t48.instance.exports; r87 = g9; const M5 = /* @__PURE__ */ (() => { let t49 = 0, r88 = 0, n47 = 0, o90 = 0; return (a48) => { n47 && (i29(o90), i29(t49), r88 += n47, n47 = t49 = 0), t49 || (r88 += 128, t49 = s20(r88)); const l23 = a48.length + 7 & -8; let u14 = t49; l23 >= r88 && (n47 = l23, u14 = o90 = s20(l23)); for (let t50 = 0; t50 < a48.length; t50++) e59[u14 + t50] = a48[t50]; return u14; }; })(); return n46(), y4(), { memory: g9, _free: i29, _malloc: s20, Mesh: class { constructor() { this.ptr = o89(); } destroy() { a47(this.ptr); } }, Decoder: class { constructor() { this.ptr = u13(); } destroy() { m6(this.ptr); } DecodeArrayToMesh(t49, e60, r88) { const n47 = M5(t49), i30 = c28(this.ptr, n47, e60, r88.ptr); return !!l22(i30); } GetAttributeByUniqueId(t49, e60) { return { ptr: h8(this.ptr, t49.ptr, e60) }; } GetTrianglesUInt16Array(t49, e60, r88) { p9(this.ptr, t49.ptr, e60, r88); } GetTrianglesUInt32Array(t49, e60, r88) { d34(this.ptr, t49.ptr, e60, r88); } GetAttributeDataArrayForAllPoints(t49, e60, r88, n47, i30) { f8(this.ptr, t49.ptr, e60.ptr, r88, n47, i30); } }, DT_INT8: x4(), DT_UINT8: v8(), DT_INT16: b8(), DT_UINT16: w4(), DT_UINT32: _4(), DT_FLOAT32: A4() }; })); })(fetch(Jd())), $d.then(((t47) => { Hd = t47, $d = void 0; }))); })()), i27 && t46.push((function() { if (Xd) return; const t47 = (function(t48) { let e59; const r87 = WebAssembly.instantiateStreaming(t48, {}).then(((t49) => { e59 = t49.instance, e59.exports.__wasm_call_ctors(); })), n46 = { NONE: "", OCTAHEDRAL: "meshopt_decodeFilterOct", QUATERNION: "meshopt_decodeFilterQuat", EXPONENTIAL: "meshopt_decodeFilterExp" }, i28 = { ATTRIBUTES: "meshopt_decodeVertexBuffer", TRIANGLES: "meshopt_decodeIndexBuffer", INDICES: "meshopt_decodeIndexSequence" }; return { ready: r87, supported: true, decodeGltfBuffer(t49, r88, s19, o89, a47, l22) { !(function(t50, e60, r89, n47, i29, s20, o90) { const a48 = t50.exports.sbrk, l23 = n47 + 3 & -4, u13 = a48(l23 * i29), c28 = a48(s20.length), h8 = new Uint8Array(t50.exports.memory.buffer); h8.set(s20, c28); const p9 = e60(u13, n47, i29, c28, s20.length); if (0 === p9 && o90 && o90(u13, l23, i29), r89.set(h8.subarray(u13, u13 + n47 * i29)), a48(u13 - a48(0)), 0 !== p9) throw new Error(`Malformed buffer data: ${p9}`); })(e59, e59.exports[i28[a47]], t49, r88, s19, o89, e59.exports[n46[l22]]); } }; })(fetch(Qd())); return t47.ready.then((() => { Xd = t47; })); })()), s18) for (let e59 = 0; e59 < s18.length; e59++) t46.push(mf(s18[e59], n45, e59, r86)); return (t46.length ? Promise.all(t46) : Promise.resolve()).then((() => { if (e58 && o88) for (const { primitives: t47 } of o88) for (const e59 of t47) af(e59, n45); if (i27 && o88 && l21) for (const t47 of l21) uf(t47, n45); return n45; })); })); } function gf(t45) { switch (t45) { case WebGL2RenderingContext.RGBA8: return WebGL2RenderingContext.RGBA; case WebGL2RenderingContext.DEPTH_COMPONENT16: return WebGL2RenderingContext.DEPTH_COMPONENT; case WebGL2RenderingContext.DEPTH24_STENCIL8: return WebGL2RenderingContext.DEPTH_STENCIL; case WebGL2RenderingContext.R8: case WebGL2RenderingContext.R32F: return WebGL2RenderingContext.RED; } } function xf(t45) { switch (t45) { case WebGL2RenderingContext.RGBA8: return WebGL2RenderingContext.UNSIGNED_BYTE; case WebGL2RenderingContext.DEPTH_COMPONENT16: return WebGL2RenderingContext.UNSIGNED_SHORT; case WebGL2RenderingContext.DEPTH24_STENCIL8: return WebGL2RenderingContext.UNSIGNED_INT_24_8; case WebGL2RenderingContext.R8: return WebGL2RenderingContext.UNSIGNED_BYTE; case WebGL2RenderingContext.R32F: return WebGL2RenderingContext.FLOAT; } } class vf { constructor(t45, e57, r86, n45) { this.context = t45, this.format = r86, this.useMipmap = n45 && n45.useMipmap, this.texture = t45.gl.createTexture(), this.update(e57, { premultiply: n45 && n45.premultiply }); } update(t45, e57) { const r86 = t45 && t45 instanceof HTMLVideoElement && 0 === t45.width ? t45.videoWidth : t45.width, n45 = t45 && t45 instanceof HTMLVideoElement && 0 === t45.height ? t45.videoHeight : t45.height, { context: i26 } = this, { gl: s18 } = i26, { x: o88, y: a46 } = e57 && e57.position ? e57.position : { x: 0, y: 0 }, l21 = o88 + r86, u12 = a46 + n45; !this.size || this.size[0] === l21 && this.size[1] === u12 || (s18.bindTexture(s18.TEXTURE_2D, null), s18.deleteTexture(this.texture), this.texture = s18.createTexture(), this.size = null), s18.bindTexture(s18.TEXTURE_2D, this.texture), i26.pixelStoreUnpackFlipY.set(false), i26.pixelStoreUnpack.set(1), i26.pixelStoreUnpackPremultiplyAlpha.set(this.format === s18.RGBA8 && (!e57 || false !== e57.premultiply)); const c28 = t45 instanceof HTMLImageElement || t45 instanceof HTMLCanvasElement || t45 instanceof HTMLVideoElement || t45 instanceof ImageData || ImageBitmap && t45 instanceof ImageBitmap; if (!this.size && l21 > 0 && u12 > 0) { const t46 = this.useMipmap ? Math.floor(Math.log2(Math.max(l21, u12))) + 1 : 1; s18.texStorage2D(s18.TEXTURE_2D, t46, this.format, l21, u12), this.size = [l21, u12]; } this.size && (c28 ? s18.texSubImage2D(s18.TEXTURE_2D, 0, o88, a46, gf(this.format), xf(this.format), t45) : "data" in t45 && t45.data && s18.texSubImage2D(s18.TEXTURE_2D, 0, o88, a46, r86, n45, gf(this.format), xf(this.format), t45.data)), this.useMipmap && s18.generateMipmap(s18.TEXTURE_2D); } bind(t45, e57, r86 = false) { const { context: n45 } = this, { gl: i26 } = n45; i26.bindTexture(i26.TEXTURE_2D, this.texture), t45 !== this.minFilter && (i26.texParameteri(i26.TEXTURE_2D, i26.TEXTURE_MAG_FILTER, t45), i26.texParameteri(i26.TEXTURE_2D, i26.TEXTURE_MIN_FILTER, this.useMipmap && !r86 ? t45 === i26.NEAREST ? i26.NEAREST_MIPMAP_NEAREST : i26.LINEAR_MIPMAP_LINEAR : t45), this.minFilter = t45), e57 !== this.wrapS && (i26.texParameteri(i26.TEXTURE_2D, i26.TEXTURE_WRAP_S, e57), i26.texParameteri(i26.TEXTURE_2D, i26.TEXTURE_WRAP_T, e57), this.wrapS = e57); } bindExtraParam(t45, e57, r86, n45, i26) { const { context: s18 } = this, { gl: o88 } = s18; o88.bindTexture(o88.TEXTURE_2D, this.texture), e57 !== this.magFilter && (o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_MAG_FILTER, e57), this.magFilter = e57), t45 !== this.minFilter && (o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_MIN_FILTER, this.useMipmap ? t45 === o88.NEAREST ? o88.NEAREST_MIPMAP_NEAREST : o88.LINEAR_MIPMAP_LINEAR : t45), this.minFilter = t45), r86 !== this.wrapS && (o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_WRAP_S, r86), this.wrapS = r86), n45 !== this.wrapT && (o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_WRAP_T, n45), this.wrapT = n45), i26 !== this.compareMode && (i26 ? (o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_COMPARE_MODE, o88.COMPARE_REF_TO_TEXTURE), o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_COMPARE_FUNC, i26)) : o88.texParameteri(o88.TEXTURE_2D, o88.TEXTURE_COMPARE_MODE, o88.NONE), this.compareMode = i26); } destroy() { const { gl: t45 } = this.context; t45.deleteTexture(this.texture), this.texture = null; } } class bf { constructor(t45, e57) { this.context = t45, this.texture = e57; } bind(t45, e57) { const { context: r86 } = this, { gl: n45 } = r86; n45.bindTexture(n45.TEXTURE_2D, this.texture), t45 !== this.minFilter && (n45.texParameteri(n45.TEXTURE_2D, n45.TEXTURE_MAG_FILTER, t45), n45.texParameteri(n45.TEXTURE_2D, n45.TEXTURE_MIN_FILTER, t45), this.minFilter = t45), e57 !== this.wrapS && (n45.texParameteri(n45.TEXTURE_2D, n45.TEXTURE_WRAP_S, e57), n45.texParameteri(n45.TEXTURE_2D, n45.TEXTURE_WRAP_T, e57), this.wrapS = e57); } } const wf = aa2([{ name: "a_pos_3f", components: 3, type: "Float32" }]), _f = aa2([{ name: "a_color_3f", components: 3, type: "Float32" }]), Af = aa2([{ name: "a_color_4f", components: 4, type: "Float32" }]), Mf = aa2([{ name: "a_uv_2f", components: 2, type: "Float32" }]), If = aa2([{ name: "a_normal_3f", components: 3, type: "Float32" }]), Sf = aa2([{ name: "a_normal_matrix0", components: 4, type: "Float32" }, { name: "a_normal_matrix1", components: 4, type: "Float32" }, { name: "a_normal_matrix2", components: 4, type: "Float32" }, { name: "a_normal_matrix3", components: 4, type: "Float32" }]), Pf = aa2([{ name: "a_pbr", components: 4, type: "Uint16" }, { name: "a_heightBasedEmissiveStrength", components: 3, type: "Float32" }]); function kf(t45, e57) { const r86 = Ef(t45.projection, t45.zoom, t45.width, t45.height), n45 = (function(t46, e58, r87, n46, i27) { const s18 = new Ql(r87.lng - 180 * Tf, r87.lat), o88 = new Ql(r87.lng + 180 * Tf, r87.lat), a46 = t46.project(s18.lng, s18.lat), u12 = t46.project(o88.lng, o88.lat), h8 = -Math.atan2(u12.y - a46.y, u12.x - a46.x), d34 = mu.fromLngLat(r87); d34.y = Tt2(d34.y, -1 + Tf, 1 - Tf); const f8 = d34.toLngLat(), y4 = t46.project(f8.lng, f8.lat), g9 = mu.fromLngLat(f8); g9.x += Tf; const x4 = g9.toLngLat(), v8 = t46.project(x4.lng, x4.lat), b8 = Vf(v8.x - y4.x, v8.y - y4.y, h8), w4 = mu.fromLngLat(f8); w4.y += Tf; const _4 = w4.toLngLat(), A4 = t46.project(_4.lng, _4.lat), M5 = Vf(A4.x - y4.x, A4.y - y4.y, h8), I4 = Math.abs(b8.x) / Math.abs(M5.y), S5 = l20([]); m5(S5, S5, -h8 * (1 - (i27 ? 0 : n46))); const P4 = l20([]); return p8(P4, P4, [1, 1 - (1 - I4) * n46, 1]), P4[4] = -M5.x / M5.y * n46, m5(P4, P4, h8), c27(P4, S5, P4), P4; })(t45.projection, 0, t45.center, r86, e57), i26 = zf(t45); return p8(n45, n45, [i26, i26, 1]), n45; } function zf(t45) { const e57 = t45.projection, r86 = Ef(t45.projection, t45.zoom, t45.width, t45.height), n45 = Bf(e57, t45.center), i26 = Bf(e57, Ql.convert(e57.center)); return Math.pow(2, n45 * r86 + (1 - r86) * i26); } function Ef(t45, e57, r86, n45, i26 = 1 / 0) { const s18 = t45.range; if (!s18) return 0; const o88 = Math.min(i26, Math.max(r86, n45)), a46 = Math.log2(o88 / 1024); return Bt(s18[0] + a46, s18[1] + a46, e57); } const Tf = 1 / 4e4; function Bf(t45, e57) { const r86 = Tt2(e57.lat, -cu, cu), n45 = new Ql(e57.lng - 180 * Tf, r86), i26 = new Ql(e57.lng + 180 * Tf, r86), s18 = t45.project(n45.lng, r86), o88 = t45.project(i26.lng, r86), a46 = mu.fromLngLat(n45), l21 = mu.fromLngLat(i26), u12 = o88.x - s18.x, c28 = o88.y - s18.y, h8 = l21.x - a46.x, p9 = l21.y - a46.y, d34 = Math.sqrt((h8 * h8 + p9 * p9) / (u12 * u12 + c28 * c28)); return Math.log2(d34); } function Vf(t45, e57, r86) { const n45 = Math.cos(r86), i26 = Math.sin(r86); return { x: t45 * n45 - e57 * i26, y: t45 * i26 + e57 * n45 }; } function Ff(t45, e57, r86) { l20(t45), m5(t45, t45, It(e57[2])), d33(t45, t45, It(e57[0])), f7(t45, t45, It(e57[1])), p8(t45, t45, r86), c27(t45, t45, [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1]); } function Cf(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = [r86[0] - e57[0], r86[1] - e57[1], 0], u12 = [n45[0] - e57[0], n45[1] - e57[1], 0]; if (_3(l21) < 1e-12 || _3(u12) < 1e-12) return J3(t45); const c28 = R4([], l21, u12); C5(c28, c28), S4(u12, n45, e57), l21[2] = (s18 - i26) * a46, u12[2] = (o88 - i26) * a46; const h8 = l21; return R4(h8, l21, u12), C5(h8, h8), st3(t45, c28, h8); } function Df(t45, e57, r86 = false) { const n45 = Yc(e57.zoom), i26 = (function(t46, e58, r87) { const n46 = e58.worldSize, i27 = [t46[12], t46[13], t46[14]], s18 = lu(i27[1] / n46), o88 = au(i27[0] / n46), a46 = l20([]), u12 = ou(1, s18) * n46, d34 = ou(1, 0) * n46 * pu(s18, e58.zoom), f8 = 1 / Xc(n46); let m6 = d34 * f8; if (r87) { const t47 = Ef(e58.projection, e58.zoom, e58.width, e58.height, 1024); m6 = f8 * e58.projection.pixelSpaceConversion(e58.center.lat, n46, t47); } const y4 = Yl(s18, o88); I3(y4, y4, E4([], C5([], y4), u12 * m6 * i27[2])); const g9 = (function(t47) { const e59 = [t47[0], t47[1], t47[2]]; let r88 = [0, 1, 0]; const n47 = R4([], r88, e59); return R4(r88, e59, n47), 0 === V3(r88) && (r88 = [0, 1, 0], R4(n47, e59, r88)), C5(n47, n47), C5(r88, r88), C5(e59, e59), [n47[0], n47[1], n47[2], 0, r88[0], r88[1], r88[2], 0, e59[0], e59[1], e59[2], 0, t47[0], t47[1], t47[2], 1]; })(y4); p8(a46, a46, [m6, m6, m6 * u12]), h7(a46, a46, [-i27[0], -i27[1], -i27[2]]); const x4 = c27([], e58.globeMatrix, g9); return c27(x4, x4, a46), c27(x4, x4, t46), x4; })(t45, e57, r86); if (n45 > 0) { const r87 = (function(t46, e58) { const r88 = e58.worldSize, n46 = ou(1, 0) * r88 * pu(e58.center.lat, e58.zoom) / Xc(r88), i27 = ou(1, e58.center.lat) * r88, s18 = l20([]); f7(s18, s18, It(e58.center.lng)), d33(s18, s18, It(e58.center.lat)), h7(s18, s18, [0, 0, Nl]), p8(s18, s18, [n46, n46, n46 * i27]); const o88 = e58.point; return h7(s18, s18, [-o88.x, -o88.y, 0]), c27(s18, s18, t46), c27(s18, e58.globeMatrix, s18); })(t45, e57); return (function(t46, e58, r88) { const n46 = (t47, e59, r89) => { const n47 = _3(t47), i28 = _3(e59), s19 = Rc(t47, e59, r89); return E4(s19, s19, 1 / _3(s19) * ur(n47, i28, r89)); }, i27 = n46([t46[0], t46[1], t46[2]], [e58[0], e58[1], e58[2]], r88), s18 = n46([t46[4], t46[5], t46[6]], [e58[4], e58[5], e58[6]], r88), o88 = n46([t46[8], t46[9], t46[10]], [e58[8], e58[9], e58[10]], r88), a46 = Rc([t46[12], t46[13], t46[14]], [e58[12], e58[13], e58[14]], r88); return [i27[0], i27[1], i27[2], 0, s18[0], s18[1], s18[2], 0, o88[0], o88[1], o88[2], 0, a46[0], a46[1], a46[2], 1]; })(i26, r87, n45); } return i26; } function Rf(t45, e57, r86, n45) { const i26 = Xu.projectAabbCorners(n45, r86); let s18 = Number.MAX_VALUE, o88 = -1; for (let t46 = 0; t46 < i26.length; ++t46) { const r87 = i26[t46]; r87[0] = (0.5 * r87[0] + 0.5) * e57.width, r87[1] = (0.5 - 0.5 * r87[1]) * e57.height, r87[2] < s18 && (o88 = t46, s18 = r87[2]); } const a46 = (t46) => new wt(i26[t46][0], i26[t46][1]); let l21; switch (o88) { case 0: case 6: l21 = [a46(1), a46(5), a46(4), a46(7), a46(3), a46(2), a46(1)]; break; case 1: case 7: l21 = [a46(0), a46(4), a46(5), a46(6), a46(2), a46(3), a46(0)]; break; case 3: case 5: l21 = [a46(1), a46(0), a46(4), a46(7), a46(6), a46(2), a46(1)]; break; default: l21 = [a46(1), a46(5), a46(6), a46(7), a46(3), a46(0), a46(1)]; } if (Qu(t45, l21)) return s18; } const Lf = 64, Of = { CoordinateSpaceTile: 1, HasMapboxMeshFeatures: 4, HasMeshoptCompression: 8 }; function Uf(t45, e57, r86, n45, i26, s18, o88, a46, u12, d34 = false) { const f8 = r86.zoom, m6 = r86.project(n45), y4 = pu(n45.lat, f8), g9 = 1 / y4; l20(t45), h7(t45, t45, [m6.x + o88[0] * g9, m6.y + o88[1] * g9, o88[2]]); let v8 = 1, b8 = 1; const w4 = r86.worldSize; if (d34) { if ("mercator" === r86.projection.name) { let t46 = 0; r86.elevation && (t46 = r86.elevation.getAtPointOrZero(new mu(m6.x / w4, m6.y / w4), 0)); const e58 = Y5([], [m6.x, m6.y, t46, 1], r86.projMatrix)[3] / r86.cameraToCenterDistance; v8 = e58, b8 = e58 * pu(r86.center.lat, f8); } else if ("globe" === r86.projection.name) { const e58 = Df(t45, r86), i27 = [0, 0, 0, 1]; Y5(i27, i27, c27([], r86.projMatrix, e58)); const s19 = i27[3] / r86.cameraToCenterDistance, o89 = Yc(f8), a47 = r86.projection.pixelsPerMeter(n45.lat, w4) * pu(n45.lat, f8), l21 = r86.projection.pixelsPerMeter(r86.center.lat, w4) * pu(r86.center.lat, f8); v8 = s19 / ur(a47, hu(r86.center.lat), o89), b8 = s19 * y4 / a47, v8 *= l21, b8 *= l21; } } else v8 = g9; p8(t45, t45, [v8, v8, b8]); const _4 = [...t45], A4 = e57.orientation, M5 = []; if (Ff(M5, [A4[0] + i26[0], A4[1] + i26[1], A4[2] + i26[2]], s18), c27(t45, _4, M5), a46 && r86.elevation) { let i27 = 0; const s19 = []; if (u12 && r86.elevation) { i27 = (function(t46, e58, r87, n46, i28) { const s20 = e58.elevation; if (!s20) return 0; const o90 = Xu.projectAabbCorners(r87, n46), a47 = ou(1, i28.lat) * e58.worldSize, l21 = (function(t47, e59) { const r88 = [0, 0, 1], n47 = [{ corners: [0, 1, 3, 2], dotProductWithUp: 0 }, { corners: [1, 5, 2, 6], dotProductWithUp: 0 }, { corners: [0, 4, 1, 5], dotProductWithUp: 0 }, { corners: [2, 6, 3, 7], dotProductWithUp: 0 }, { corners: [4, 7, 5, 6], dotProductWithUp: 0 }, { corners: [0, 3, 4, 7], dotProductWithUp: 0 }]; for (const i29 of n47) { const n48 = t47[i29.corners[0]], s21 = t47[i29.corners[1]], o91 = t47[i29.corners[2]], a48 = [s21[0] - n48[0], s21[1] - n48[1], e59 * (s21[2] - n48[2])], l22 = R4(a48, a48, [o91[0] - n48[0], o91[1] - n48[1], e59 * (o91[2] - n48[2])]); C5(l22, l22), i29.dotProductWithUp = D4(l22, r88); } return n47.sort(((t48, e60) => t48.dotProductWithUp - e60.dotProductWithUp)), n47[0].corners; })(o90, a47), u13 = o90[l21[0]], c28 = o90[l21[1]], h8 = o90[l21[2]], p9 = o90[l21[3]], d35 = s20.getAtPointOrZero(new mu(u13[0] / e58.worldSize, u13[1] / e58.worldSize), 0), f9 = s20.getAtPointOrZero(new mu(c28[0] / e58.worldSize, c28[1] / e58.worldSize), 0), m7 = s20.getAtPointOrZero(new mu(h8[0] / e58.worldSize, h8[1] / e58.worldSize), 0), y5 = s20.getAtPointOrZero(new mu(p9[0] / e58.worldSize, p9[1] / e58.worldSize), 0), g10 = (d35 + y5) / 2, x4 = (f9 + m7) / 2; return g10 > x4 ? f9 < m7 ? Cf(t46, c28, p9, u13, f9, y5, d35, a47) : Cf(t46, h8, u13, p9, m7, d35, y5, a47) : d35 < y5 ? Cf(t46, u13, c28, h8, d35, f9, m7, a47) : Cf(t46, p9, h8, c28, y5, m7, f9, a47), Math.max(g10, x4); })(s19, r86, e57.aabb, t45, n45); const o89 = c27([], x3([], s19), M5); c27(t45, _4, o89); } else i27 = r86.elevation.getAtPointOrZero(new mu(m6.x / w4, m6.y / w4), 0); 0 !== i27 && (t45[14] += i27); } } function Nf(t45, e57, r86 = false) { t45.uploaded || (t45.gfxTexture = new vf(e57, t45.image, r86 ? e57.gl.R8 : e57.gl.RGBA8, { useMipmap: t45.sampler.minFilter >= e57.gl.NEAREST_MIPMAP_NEAREST }), t45.uploaded = true, t45.image = null); } function jf(t45, e57, r86) { t45.indexBuffer = e57.createIndexBuffer(t45.indexArray, false, true), t45.vertexBuffer = e57.createVertexBuffer(t45.vertexArray, wf.members, false, true), t45.normalArray && (t45.normalBuffer = e57.createVertexBuffer(t45.normalArray, If.members, false, true)), t45.texcoordArray && (t45.texcoordBuffer = e57.createVertexBuffer(t45.texcoordArray, Mf.members, false, true)), t45.colorArray && (t45.colorBuffer = e57.createVertexBuffer(t45.colorArray, (12 === t45.colorArray.bytesPerElement ? _f : Af).members, false, true)), t45.featureArray && (t45.pbrBuffer = e57.createVertexBuffer(t45.featureArray, Pf.members, true)), t45.segments = al.simpleSegment(0, 0, t45.vertexArray.length, t45.indexArray.length); const n45 = t45.material; n45.pbrMetallicRoughness.baseColorTexture && Nf(n45.pbrMetallicRoughness.baseColorTexture, e57), n45.pbrMetallicRoughness.metallicRoughnessTexture && Nf(n45.pbrMetallicRoughness.metallicRoughnessTexture, e57), n45.normalTexture && Nf(n45.normalTexture, e57), n45.occlusionTexture && Nf(n45.occlusionTexture, e57, r86), n45.emissionTexture && Nf(n45.emissionTexture, e57); } function $f(t45, e57, r86) { if (t45.meshes) for (const n45 of t45.meshes) jf(n45, e57, r86); if (t45.children) for (const n45 of t45.children) $f(n45, e57, r86); } function Gf(t45) { if (t45.meshes) for (const e57 of t45.meshes) e57.indexArray.destroy(), e57.vertexArray.destroy(), e57.colorArray && e57.colorArray.destroy(), e57.normalArray && e57.normalArray.destroy(), e57.texcoordArray && e57.texcoordArray.destroy(), e57.featureArray && e57.featureArray.destroy(); if (t45.children) for (const e57 of t45.children) Gf(e57); } function Hf(t45) { if (t45.meshes) for (const r86 of t45.meshes) r86.vertexBuffer && (r86.vertexBuffer.destroy(), r86.indexBuffer.destroy(), r86.normalBuffer && r86.normalBuffer.destroy(), r86.texcoordBuffer && r86.texcoordBuffer.destroy(), r86.colorBuffer && r86.colorBuffer.destroy(), r86.pbrBuffer && r86.pbrBuffer.destroy(), r86.segments.destroy(), r86.material && ((e57 = r86.material).pbrMetallicRoughness.baseColorTexture && e57.pbrMetallicRoughness.baseColorTexture.gfxTexture && e57.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(), e57.pbrMetallicRoughness.metallicRoughnessTexture && e57.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture && e57.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(), e57.normalTexture && e57.normalTexture.gfxTexture && e57.normalTexture.gfxTexture.destroy(), e57.emissionTexture && e57.emissionTexture.gfxTexture && e57.emissionTexture.gfxTexture.destroy(), e57.occlusionTexture && e57.occlusionTexture.gfxTexture && e57.occlusionTexture.gfxTexture.destroy())); var e57; if (t45.children) for (const e58 of t45.children) Hf(e58); } function qf(t45, e57) { const r86 = t45.json.bufferViews[e57.bufferView], n45 = ef[e57.componentType]; return new n45(t45.buffers[r86.buffer], (e57.byteOffset || 0) + (r86.byteOffset || 0), e57.count * (r86.byteStride && r86.byteStride !== nf[e57.type] * n45.BYTES_PER_ELEMENT ? r86.byteStride / n45.BYTES_PER_ELEMENT : nf[e57.type])); } function Xf(t45, e57, r86, n45) { const i26 = ef[e57.componentType], s18 = (function(t46) { switch (t46) { case Int8Array: return 1 / 127; case Uint8Array: return 1 / 255; case Int16Array: return 1 / 32767; case Uint16Array: return 1 / 65535; default: return 1; } })(i26), o88 = t45.json.bufferViews[e57.bufferView], a46 = o88.byteStride ? o88.byteStride / i26.BYTES_PER_ELEMENT : nf[e57.type], l21 = r86.float32, u12 = l21.length / r86.capacity; for (let t46 = 0, r87 = 0; t46 < e57.count * a46; t46 += a46, r87 += u12) for (let e58 = 0; e58 < u12; e58++) l21[r87 + e58] = n45[t46 + e58] * s18; r86._trim(); } function Zf(t45, e57, r86) { const n45 = t45.indices, i26 = t45.attributes, s18 = {}; s18.indexArray = new Ea(); const o88 = e57.json.accessors[n45], a46 = o88.count / 3; s18.indexArray.reserve(a46); const l21 = qf(e57, o88); for (let t46 = 0; t46 < a46; t46++) s18.indexArray.emplaceBack(l21[3 * t46], l21[3 * t46 + 1], l21[3 * t46 + 2]); s18.indexArray._trim(), s18.vertexArray = new ga(); const u12 = e57.json.accessors[i26.POSITION]; s18.vertexArray.reserve(u12.count); const c28 = qf(e57, u12); for (let t46 = 0; t46 < u12.count; t46++) s18.vertexArray.emplaceBack(c28[3 * t46], c28[3 * t46 + 1], c28[3 * t46 + 2]); if (s18.vertexArray._trim(), s18.aabb = new Xu(u12.min, u12.max), s18.centroid = (function(t46, e58) { const r87 = [0, 0, 0], n46 = t46.length; if (n46 > 0) { for (let i27 = 0; i27 < n46; i27++) { const n47 = 3 * t46[i27]; r87[0] += e58[n47], r87[1] += e58[n47 + 1], r87[2] += e58[n47 + 2]; } r87[0] /= n46, r87[1] /= n46, r87[2] /= n46; } return r87; })(l21, c28), void 0 !== i26.COLOR_0) { const t46 = e57.json.accessors[i26.COLOR_0], r87 = nf[t46.type], n46 = qf(e57, t46); s18.colorArray = 3 === r87 ? new ga() : new Aa(), s18.colorArray.resize(t46.count), Xf(e57, t46, s18.colorArray, n46); } if (void 0 !== i26.NORMAL) { s18.normalArray = new ga(); const t46 = e57.json.accessors[i26.NORMAL]; s18.normalArray.resize(t46.count); const r87 = qf(e57, t46); Xf(e57, t46, s18.normalArray, r87); } if (void 0 !== i26.TEXCOORD_0 && r86.length > 0) { s18.texcoordArray = new La(); const t46 = e57.json.accessors[i26.TEXCOORD_0]; s18.texcoordArray.resize(t46.count); const r87 = qf(e57, t46); Xf(e57, t46, s18.texcoordArray, r87); } if (void 0 !== i26._FEATURE_ID_RGBA4444) { const t46 = e57.json.accessors[i26._FEATURE_ID_RGBA4444]; e57.json.extensionsUsed && e57.json.extensionsUsed.includes("EXT_meshopt_compression") && (s18.featureData = qf(e57, t46)); } void 0 !== i26._FEATURE_RGBA4444 && (s18.featureData = new Uint32Array(qf(e57, e57.json.accessors[i26._FEATURE_RGBA4444]).buffer)); const h8 = t45.material; return s18.material = (function(t46, e58) { const { emissiveFactor: r87 = [0, 0, 0], alphaMode: n46 = "OPAQUE", alphaCutoff: i27 = 0.5, normalTexture: s19, occlusionTexture: o89, emissiveTexture: a47, doubleSided: l22 } = t46, { baseColorFactor: u13 = [1, 1, 1, 1], metallicFactor: c29 = 1, roughnessFactor: h9 = 1, baseColorTexture: p9, metallicRoughnessTexture: d34 } = t46.pbrMetallicRoughness || {}, f8 = o89 ? e58[o89.index] : void 0; if (o89 && o89.extensions && o89.extensions.KHR_texture_transform && f8) { const t47 = o89.extensions.KHR_texture_transform; f8.offsetScale = [t47.offset[0], t47.offset[1], t47.scale[0], t47.scale[1]]; } return { pbrMetallicRoughness: { baseColorFactor: new sr(...u13), metallicFactor: c29, roughnessFactor: h9, baseColorTexture: p9 ? e58[p9.index] : void 0, metallicRoughnessTexture: d34 ? e58[d34.index] : void 0 }, doubleSided: l22, emissiveFactor: new sr(...r87), alphaMode: n46, alphaCutoff: i27, normalTexture: s19 ? e58[s19.index] : void 0, occlusionTexture: f8, emissionTexture: a47 ? e58[a47.index] : void 0, defined: void 0 === t46.defined }; })(void 0 !== h8 ? e57.json.materials[h8] : { defined: false }, r86), s18; } function Wf(t45, e57, r86) { const { matrix: n45, rotation: i26, translation: s18, scale: o88, mesh: a46, extras: l21, children: u12 } = t45, c28 = {}; if (c28.matrix = n45 || (function(t46, e58, r87, n46) { var i27 = e58[0], s19 = e58[1], o89 = e58[2], a47 = e58[3], l22 = i27 + i27, u13 = s19 + s19, c29 = o89 + o89, h8 = i27 * l22, p9 = i27 * u13, d34 = i27 * c29, f8 = s19 * u13, m6 = s19 * c29, y4 = o89 * c29, g9 = a47 * l22, x4 = a47 * u13, v8 = a47 * c29, b8 = n46[0], w4 = n46[1], _4 = n46[2]; return t46[0] = (1 - (f8 + y4)) * b8, t46[1] = (p9 + v8) * b8, t46[2] = (d34 - x4) * b8, t46[3] = 0, t46[4] = (p9 - v8) * w4, t46[5] = (1 - (h8 + y4)) * w4, t46[6] = (m6 + g9) * w4, t46[7] = 0, t46[8] = (d34 + x4) * _4, t46[9] = (m6 - g9) * _4, t46[10] = (1 - (h8 + f8)) * _4, t46[11] = 0, t46[12] = r87[0], t46[13] = r87[1], t46[14] = r87[2], t46[15] = 1, t46; })([], i26 || [0, 0, 0, 1], s18 || [0, 0, 0], o88 || [1, 1, 1]), void 0 !== a46) { c28.meshes = r86[a46]; const t46 = c28.anchor = [0, 0]; for (const e58 of c28.meshes) { const { min: r87, max: n46 } = e58.aabb; t46[0] += r87[0] + n46[0], t46[1] += r87[1] + n46[1]; } t46[0] = Math.floor(t46[0] / c28.meshes.length / 2), t46[1] = Math.floor(t46[1] / c28.meshes.length / 2); } if (l21 && (l21.id && (c28.id = l21.id), l21.lights && (c28.lights = (function(t46) { if (!t46.length) return []; const e58 = (function(t47) { const e59 = atob(t47), r88 = new Uint8Array(e59.length); for (let t48 = 0; t48 < e59.length; t48++) r88[t48] = e59.codePointAt(t48); return r88; })(t46), r87 = [], n46 = e58.length / 24, i27 = new Uint16Array(e58.buffer), s19 = new Float32Array(e58.buffer); for (let t47 = 0; t47 < n46; t47++) { const e59 = i27[2 * t47 * 6] / 30, n47 = i27[2 * t47 * 6 + 1] / 30, o89 = i27[2 * t47 * 6 + 10] / 100, a47 = s19[6 * t47 + 1], l22 = s19[6 * t47 + 2], u13 = s19[6 * t47 + 3], c29 = s19[6 * t47 + 4], h8 = u13 - a47, p9 = c29 - l22, d34 = Math.hypot(h8, p9); r87.push({ pos: [a47 + 0.5 * h8, l22 + 0.5 * p9, n47], normal: [p9 / d34, -h8 / d34, 0], width: d34, height: e59, depth: o89, points: [a47, l22, u13, c29] }); } return r87; })(l21.lights))), u12) { const t46 = []; for (const n46 of u12) t46.push(Wf(e57.json.nodes[n46], e57, r86)); c28.children = t46; } return c28; } function Yf(t45) { if (0 === t45.vertices.length || 0 === t45.indices.length) return null; const e57 = new bp(t45.vertices, t45.indices, 8, 256), [r86, n45] = [e57.min.clone(), e57.max.clone()]; return { vertices: t45.vertices, indices: t45.indices, grid: e57, min: r86, max: n45 }; } function Kf(t45) { if (!t45.extras || !t45.extras.ground) return null; const e57 = t45.extras.ground; if (!e57 || !Array.isArray(e57) || 0 === e57.length) return null; const r86 = e57[0]; if (!r86 || !Array.isArray(r86) || 0 === r86.length) return null; const n45 = []; for (const t46 of r86) { if (!Array.isArray(t46) || 2 !== t46.length) continue; const e58 = t46[0], r87 = t46[1]; "number" == typeof e58 && "number" == typeof r87 && n45.push(new wt(e58, r87)); } if (n45.length < 3) return null; n45.length > 1 && n45[n45.length - 1].equals(n45[0]) && n45.pop(); let i26 = 0; for (let t46 = 0; t46 < n45.length; t46++) { const e58 = n45[t46], r87 = n45[(t46 + 1) % n45.length], s19 = n45[(t46 + 2) % n45.length]; i26 += (e58.x - r87.x) * (s19.y - r87.y) - (s19.x - r87.x) * (e58.y - r87.y); } i26 > 0 && n45.reverse(); const s18 = Ih(n45.flatMap(((t46) => [t46.x, t46.y])), []); return 0 === s18.length ? null : { vertices: n45, indices: s18 }; } function Jf(t45, e57) { const r86 = [], n45 = []; let i26 = 0; const s18 = []; for (const o88 of t45) { i26 = r86.length; const t46 = o88.vertexArray.float32, a46 = o88.indexArray.uint16; for (let n46 = 0; n46 < o88.vertexArray.length; n46++) s18[0] = t46[3 * n46 + 0], s18[1] = t46[3 * n46 + 1], s18[2] = t46[3 * n46 + 2], O3(s18, s18, e57), r86.push(new wt(s18[0], s18[1])); for (let t47 = 0; t47 < 3 * o88.indexArray.length; t47++) n45.push(a46[t47] + i26); } if (n45.length % 3 != 0) return null; for (let t46 = 0; t46 < n45.length; t46 += 3) { const e58 = r86[n45[t46 + 0]], i27 = r86[n45[t46 + 1]], s19 = r86[n45[t46 + 2]]; (e58.x - i27.x) * (s19.y - i27.y) - (s19.x - i27.x) * (e58.y - i27.y) > 0 && ([n45[t46 + 1], n45[t46 + 2]] = [n45[t46 + 2], n45[t46 + 1]]); } return { vertices: r86, indices: n45 }; } function Qf(t45) { const e57 = (function(t46, e58) { const r87 = [], n46 = WebGL2RenderingContext; if (t46.json.textures) for (const i27 of t46.json.textures) { const s19 = { magFilter: n46.LINEAR, minFilter: n46.NEAREST, wrapS: n46.REPEAT, wrapT: n46.REPEAT }; void 0 !== i27.sampler && Object.assign(s19, t46.json.samplers[i27.sampler]), r87.push({ image: e58[i27.source], sampler: s19, uploaded: false }); } return r87; })(t45, t45.images), r86 = (function(t46, e58) { const r87 = []; for (const n46 of t46.json.meshes) { const i27 = []; for (const r88 of n46.primitives) i27.push(Zf(r88, t46, e58)); r87.push(i27); } return r87; })(t45, e57), { scenes: n45, scene: i26, nodes: s18 } = t45.json, o88 = n45 ? n45[i26 || 0].nodes : [...s18.keys()], a46 = []; for (const e58 of o88) a46.push(Wf(s18[e58], t45, r86)); return (function(t46, e58, r87) { const n46 = {}, i27 = /* @__PURE__ */ new Set(); for (let s19 = 0; s19 < t46.length; s19++) { const t47 = r87[e58[s19]]; if (!t47.extras) continue; const o89 = t47.extras["mapbox:footprint:version"], a47 = t47.extras["mapbox:footprint:id"]; (o89 || a47) && i27.add(s19), "1.0.0" === o89 && a47 && (n46[a47] = s19); } for (let s19 = 0; s19 < t46.length; s19++) { if (i27.has(s19)) continue; const o89 = t46[s19], a47 = r87[e58[s19]]; if (!a47.extras) continue; let l21 = null; o89.id in n46 && (l21 = Jf(t46[n46[o89.id]].meshes, o89.matrix)), l21 || (l21 = Kf(a47)), l21 && (o89.footprint = Yf(l21)); } if (i27.size > 0) { const e59 = Array.from(i27.values()).sort(((t47, e60) => t47 - e60)); for (let r88 = e59.length - 1; r88 >= 0; r88--) t46.splice(e59[r88], 1); } })(a46, o88, t45.json.nodes), a46; } function tm(t45) { t45.heightmap = new Float32Array(4096), t45.heightmap.fill(-1); const e57 = t45.vertexArray.float32, r86 = t45.aabb.min[0] - 1, n45 = t45.aabb.min[1] - 1, i26 = Lf / (t45.aabb.max[0] - r86 + 2), s18 = Lf / (t45.aabb.max[1] - n45 + 2); for (let o88 = 0; o88 < e57.length; o88 += 3) { const a46 = e57[o88 + 2], l21 = (e57[o88 + 0] - r86) * i26 | 0, u12 = (e57[o88 + 1] - n45) * s18 | 0; a46 > t45.heightmap[u12 * Lf + l21] && (t45.heightmap[u12 * Lf + l21] = a46); } } function em(t45, e57, r86, n45, i26) { r86.reserve(r86.length + 4 * t45.length), n45.reserve(n45.length + 10 * t45.length), i26.reserve(i26.length + 10 * t45.length); let s18 = n45.length; for (const o88 of t45) { const t46 = Math.min(10, Math.max(4, 1.3 * o88.height)) * e57, a46 = [-o88.normal[1], o88.normal[0], 0], l21 = Math.min(0.29, 0.1 * o88.width / o88.depth), u12 = o88.width - 2 * o88.depth * e57 * (l21 + 0.01), c28 = T4([], o88.pos, a46, u12 / 2), h8 = T4([], o88.pos, a46, -u12 / 2), p9 = [c28[0], c28[1], c28[2] + o88.height], d34 = [h8[0], h8[1], h8[2] + o88.height], f8 = T4([], o88.normal, a46, l21); E4(f8, f8, t46); const m6 = T4([], o88.normal, a46, -l21); E4(m6, m6, t46), I3(f8, c28, f8), I3(m6, h8, m6), c28[2] += 0.1, h8[2] += 0.1, n45.emplaceBack(f8[0], f8[1], f8[2]), n45.emplaceBack(m6[0], m6[1], m6[2]), n45.emplaceBack(c28[0], c28[1], c28[2]), n45.emplaceBack(h8[0], h8[1], h8[2]), n45.emplaceBack(p9[0], p9[1], p9[2]), n45.emplaceBack(d34[0], d34[1], d34[2]), n45.emplaceBack(c28[0], c28[1], c28[2]), n45.emplaceBack(h8[0], h8[1], h8[2]), n45.emplaceBack(f8[0], f8[1], f8[2]), n45.emplaceBack(m6[0], m6[1], m6[2]); const y4 = u12 / t46 / 2; i26.emplaceBack(-y4 - l21, -1, y4, 0.8), i26.emplaceBack(y4 + l21, -1, y4, 0.8), i26.emplaceBack(-y4, 0, y4, 1.3), i26.emplaceBack(y4, 0, y4, 1.3), i26.emplaceBack(y4 + l21, -0.8, y4, 0.7), i26.emplaceBack(y4 + l21, -0.8, y4, 0.7), i26.emplaceBack(0, 0, y4, 1.3), i26.emplaceBack(0, 0, y4, 1.3), i26.emplaceBack(y4 + l21, -1.2, y4, 0.8), i26.emplaceBack(y4 + l21, -1.2, y4, 0.8), r86.emplaceBack(6 + s18, 4 + s18, 8 + s18), r86.emplaceBack(7 + s18, 9 + s18, 5 + s18), r86.emplaceBack(0 + s18, 1 + s18, 2 + s18), r86.emplaceBack(1 + s18, 3 + s18, 2 + s18), s18 += 10; } } function rm(t45, e57) { const r86 = {}; r86.indexArray = new Ea(), r86.vertexArray = new ga(), r86.colorArray = new Aa(), em(t45, e57, r86.indexArray, r86.vertexArray, r86.colorArray); const n45 = { defined: true }; n45.emissiveFactor = sr.black; const i26 = {}; return i26.baseColorFactor = sr.white, n45.pbrMetallicRoughness = i26, r86.material = n45, r86.aabb = new Xu([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]), r86; } const nm = aa2([{ name: "a_pos_3f", components: 3, type: "Float32" }]), im = aa2([{ name: "a_normal_3", components: 3, type: "Int16" }]), sm = aa2([{ name: "a_centroid_3", components: 3, type: "Int16" }]), om = aa2([{ name: "a_part_color_emissive", components: 2, type: "Uint16" }]), am = aa2([{ name: "a_faux_facade_color_emissive", components: 2, type: "Uint16" }]), lm = aa2([{ name: "a_faux_facade_data", components: 4, type: "Uint16" }]), um = aa2([{ name: "a_faux_facade_vertical_range", components: 2, type: "Uint16" }]), cm = aa2([{ name: "a_bloom_attenuation", components: 4, type: "Float32" }]), hm = Iu.types, pm = 32767; function dm(t45, e57) { const r86 = Rn + e57; for (const n45 of t45) for (const t46 of n45) if (t46.x < -e57 || t46.x > r86 || t46.y < -e57 || t46.y > r86) return false; return true; } class fm { constructor() { this.layoutVertexArray = new ga(), this.layoutAttenuationArray = new Aa(), this.layoutColorArray = new Ia(), this.indexArray = new Ea(), this.indexArrayForConflation = new Ea(), this.segmentsBucket = new al(); } } class mm { constructor() { this.layoutVertexArray = new ga(), this.layoutNormalArray = new ca3(), this.layoutCentroidArray = new ca3(), this.layoutColorArray = new Ia(), this.layoutFacadePaintArray = null, this.layoutFacadeDataArray = null, this.layoutFacadeVerticalRangeArray = null, this.layoutAOArray = [], this.indexArray = new Ea(), this.indexArrayForConflation = new Ea(), this.segmentsBucket = new al(), this.entranceBloom = new fm(); } } class ym { constructor(t45) { this.colorBufferUploaded = false, this.maxHeight = 0, this.replacementUpdateTime = 0, this.activeReplacements = [], this.footprints = [], this.featuresOnBorder = [], this.buildingFeatures = [], this.buildingWithoutFacade = new mm(), this.buildingWithFacade = new mm(), this.indexArrayForConflationUploaded = false, this.footprintLookup = {}, this.zoom = t45.zoom, this.canonical = t45.canonical, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.hasPattern = false, this.worldview = t45.worldview, this.lut = t45.lut, this.buildingWithFacade.layoutFacadePaintArray = new Ia(), this.buildingWithFacade.layoutFacadeDataArray = new va(), this.buildingWithFacade.layoutFacadeVerticalRangeArray = new Ia(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.projection = t45.projection, this.groundEffect = new ld(t45); } updateFootprints(t45, e57) { for (const r86 of this.footprints) e57.push({ footprint: r86, id: t45 }); } prepare() { return (function() { if (null != Kd || null != Yd) return null; if (null != Wd) return Wd; const t45 = fetch(ne2.BUILDING_GEN_URL); return Wd = (function(t46) { let e57, r86, n45, i26; function s18() { e57 = new Uint8Array(i26.buffer), r86 = new Int32Array(i26.buffer), n45 = new Float32Array(i26.buffer); } function o88() { throw new Error("Unexpected BuildingGen error."); } const a46 = () => { }, l21 = { a: { a: o88, f: function(t47) { const r87 = e57.length, n46 = Math.max(t47 >>> 0, Math.ceil(1.2 * r87)), o89 = Math.ceil((n46 - r87) / 65536); try { return i26.grow(o89), s18(), true; } catch (t48) { return false; } }, g: o88, b: a46, c: a46, d: a46, e: a46 } }; return (WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(t46, l21) : t46.then(((t47) => t47.arrayBuffer())).then(((t47) => WebAssembly.instantiate(t47, l21)))).then(((t47) => { const o89 = t47.instance.exports; return (0, o89.g)(), i26 = o89.f, s18(), new jd({ setStyle: o89.h, setAOOptions: o89.i, setMetricOptions: o89.j, setStructuralOptions: o89.k, setFacadeOptions: o89.l, setFauxFacadeOptions: o89.m, setFacadeClassifierOptions: o89.n, addFeature: o89.o, addFacade: o89.p, generateMesh: o89.q, getLastError: o89.r, getOuterRingLength: o89.s, getMeshCount: o89.t, getPositionsPtr: o89.u, getPositionsLength: o89.v, getNormalsPtr: o89.w, getNormalsLength: o89.x, getColorsPtr: o89.y, getColorsLength: o89.z, getAOPtr: o89.A, getAOLength: o89.B, getUVPtr: o89.C, getUVLength: o89.D, getFauxFacadePtr: o89.E, getFauxFacadeLength: o89.F, getIndicesPtr: o89.G, getIndicesLength: o89.H, getBuildingPart: o89.I, getRingCount: o89.J, getRingPtr: o89.K, getRingLength: o89.L, free: o89.M, malloc: o89.N, heapU8: e57, heap32: r86, heapF32: n45 }); })); })(t45).then(((t46) => (Wd = null, Kd = t46, Kd))).catch(((t46) => { Gt("Could not load building-gen"), Wd = null, Yd = t46; })), Wd; })(); } populate(t45, e57, r86, n45) { const i26 = tf(); if (!i26) return; const s18 = fu(r86); this.tileToMeter = s18, this.brightness = e57.brightness, i26.setStyle({ convertToMeters: false, entranceColorRgb: [1, 1, 1], facadeGlazingColorRgb: [0.5607843137254902, 0.6745098039215687, 0.7215686274509804], normalScale: [1, -1, s18], ridgeHeight: 3, roofColorRgb: [0.886274516, 0.784313738, 0.713725507], tileToMeters: s18, tileZoom: 16, wallColorRgb: [0.988235294, 0.933333337, 0.811764717] }), i26.setAOOptions(false, 0.3), i26.setMetricOptions(false, 16), i26.setStructuralOptions(true), i26.setFacadeClassifierOptions(3); const o88 = /* @__PURE__ */ new Map(); for (const { feature: e58 } of t45) { if ("LineString" !== hm[e58.type]) continue; const t46 = this.layers[0]._featureFilter.needGeometry, i27 = Mu(e58, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom), i27, r86)) continue; const s19 = t46 ? i27.geometry : Au(e58, r86, n45), a46 = []; for (const t47 of s19) for (const e59 of t47) a46.push({ x: e59.x, y: e59.y }); const l21 = { coordinates: a46, crossPerc: e58.properties.cross_perc, distanceToRoad: e58.properties.distance_to_road, entrances: e58.properties.entrances, sourceId: 0 }, u12 = e58.properties.source_id; let c28 = o88.get(u12); c28 || (c28 = [], o88.set(u12, c28)), c28.push(l21); } this.maxHeight = 0; for (const { feature: a46, index: l21 } of t45) { if ("LineString" === hm[a46.type]) continue; const t46 = this.layers[0]._featureFilter.needGeometry, u12 = Mu(a46, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom), u12, r86)) continue; const c28 = t46 ? u12.geometry : Au(a46, r86, n45), h8 = Kh(c28, 500); if (!dm(c28, 163)) continue; const p9 = this.layers[0], d34 = p9.layout.get("building-base").evaluate(a46, {}, r86), f8 = p9.layout.get("building-height").evaluate(a46, {}, r86), m6 = p9.layout.get("building-roof-shape").evaluate(a46, {}, r86), y4 = p9.paint.get("building-ambient-occlusion-intensity"), g9 = p9.paint.get("building-ambient-occlusion-ground-radius") / this.tileToMeter; if ("flat" === m6) continue; const x4 = p9.layout.get("building-facade").evaluate(a46, {}, r86); i26.setFacadeOptions(4, true), i26.setFauxFacadeOptions(x4, false, 1); const v8 = a46.properties.source_id; let b8; b8 = o88.has(v8) ? o88.get(v8) : []; let w4 = 0, _4 = 0, A4 = 0, M5 = 0, I4 = 0, S5 = 0; if (x4) { let t47 = Math.round(p9.layout.get("building-facade-floors").evaluate(a46, {}, r86)); if (0 === d34) { t47 = Math.max(1, t47 - (b8.length > 0 ? 1 : 0)); let e59 = 4; if (f8 > 100) { const t48 = [10, 13, 15]; e59 = t48[a46.id ? a46.id % t48.length : 0], i26.setFacadeOptions(e59, true); } I4 = 1.6803 * e59 / s18; } else I4 = d34 / s18; S5 = f8 / s18, I4 = Math.min(I4, S5), A4 = p9.layout.get("building-facade-unit-width").evaluate(a46, {}, r86) / s18, M5 = (S5 - I4) / t47, i26.setFauxFacadeOptions(true, true, A4); const e58 = p9.layout.get("building-facade-window").evaluate(a46, {}, r86); w4 = e58[0], _4 = e58[1]; } const P4 = [], k7 = new wt(1 / 0, 1 / 0), z4 = new wt(-1 / 0, -1 / 0), E5 = new wt(0, 0); let T5 = 0; for (const t47 of h8) if (t47.length > 0) { const e58 = []; for (const r87 of t47) { const t48 = []; for (let e59 = r87.length - 1; e59 >= 0; e59--) { const n46 = r87[e59]; t48.push({ x: n46.x, y: n46.y }), k7.x = Math.min(k7.x, n46.x), k7.y = Math.min(k7.y, n46.y), z4.x = Math.max(z4.x, n46.x), z4.y = Math.max(z4.y, n46.y), E5.x += n46.x, E5.y += n46.y, T5++; } e58.push(t48); } P4.push({ id: a46.id ? a46.id : 0, height: f8, minHeight: d34, sourceId: 0, roofType: m6, coordinates: e58 }); } E5.x /= T5 || 1, E5.y /= T5 || 1; const B6 = i26.generateMesh(P4, b8); if ("string" == typeof B6) { Gt(`Unable to generate building ${a46.id}: ${B6}`); continue; } if (0 === B6.meshes.length || 0 === B6.modifiedPolygonRings.length) continue; let V4 = 0; for (const t47 of B6.meshes) V4 += t47.positions.length / 3; const F17 = x4 ? this.buildingWithFacade : this.buildingWithoutFacade, C6 = F17.segmentsBucket.prepareSegment(V4, F17.layoutVertexArray, F17.indexArray), D5 = []; let R5 = null, L3 = 0, O4 = -1; const U4 = F17.indexArray.length; let N5 = 0; for (const t47 of B6.meshes) { const e58 = F17.layoutVertexArray.length; if ("entrance" === t47.buildingPart) { const e59 = new Array(); for (let r89 = 0; r89 < t47.indices.length; r89 += 12) { const n48 = t47.positions[r89 + 0], i29 = t47.positions[r89 + 1], s20 = t47.positions[r89 + 3], o89 = t47.positions[r89 + 4], a47 = t47.positions[r89 + 2], l22 = t47.positions[r89 + 8] - a47, u13 = 1, c29 = s20 - n48, h9 = o89 - i29, p10 = Math.hypot(c29, h9); e59.push({ pos: [n48 + 0.5 * c29, i29 + 0.5 * h9, a47], normal: [h9 / p10, -c29 / p10, 0], width: p10, height: l22, depth: u13, points: [n48, i29, s20, o89] }); } const r88 = F17.entranceBloom.segmentsBucket.prepareSegment(10 * e59.length, F17.entranceBloom.layoutVertexArray, F17.entranceBloom.indexArray), n47 = F17.entranceBloom.layoutVertexArray.length; L3 = F17.entranceBloom.indexArray.length, em(e59, 0.5 / this.tileToMeter, F17.entranceBloom.indexArray, F17.entranceBloom.layoutVertexArray, F17.entranceBloom.layoutAttenuationArray); const i28 = F17.entranceBloom.layoutVertexArray.length - n47; O4 = F17.entranceBloom.indexArray.length - L3; for (let t48 = 0; t48 < i28; t48++) { const t49 = 65535; F17.entranceBloom.layoutColorArray.emplaceBack(t49, t49); } r88.vertexLength += i28, r88.primitiveLength += O4, R5 = { part: t47.buildingPart, vertexOffset: n47, vertexLength: i28 }; } for (let e59 = 0; e59 < t47.positions.length; e59 += 3) N5 = Math.max(N5, t47.positions[e59 + 2]), F17.layoutVertexArray.emplaceBack(t47.positions[e59], t47.positions[e59 + 1], t47.positions[e59 + 2]); const r87 = Math.floor(E5.x), n46 = Math.floor(E5.y), i27 = Math.floor(N5); for (let e59 = 0; e59 < t47.positions.length; e59 += 3) F17.layoutCentroidArray.emplaceBack(r87, n46, i27); for (let e59 = 0; e59 < t47.normals.length; e59 += 3) F17.layoutNormalArray.emplaceBack(t47.normals[e59 + 0] * pm, t47.normals[e59 + 1] * pm, t47.normals[e59 + 2] * pm); for (let e59 = 0; e59 < t47.ao.length; e59++) F17.layoutAOArray.push(t47.ao[e59]); for (let e59 = 0; e59 < t47.colors.length; e59 += 3) { const r88 = 1 + (t47.ao[e59 / 3] - 1) * y4; F17.layoutColorArray.emplaceBack(t47.colors[e59] * r88 << 8 | t47.colors[e59 + 1] * r88, t47.colors[e59 + 2] * r88 << 8); } if (x4) { for (let e59 = 0; e59 < t47.positions.length; e59 += 3) F17.layoutFacadePaintArray.emplaceBack(65535, 255); for (let e59 = 0; e59 < t47.isFauxFacade.length; e59++) if (t47.isFauxFacade[e59]) { const r88 = 1 | Math.min(65535, Math.floor(t47.uv[2 * e59] * B6.outerRingLength)), n47 = Math.floor(255 * w4) << 8 | Math.floor(255 * _4), i28 = Math.floor(65535 * Math.min(1, A4 / Rn)), s20 = Math.floor(65535 * Math.min(1, M5 / Rn)); F17.layoutFacadeDataArray.emplaceBack(r88, n47, i28, s20); const o89 = Math.floor(65535 * Math.min(1, I4 / Rn)), a47 = Math.floor(65535 * Math.min(1, S5 / Rn)); F17.layoutFacadeVerticalRangeArray.emplaceBack(o89, a47); } else F17.layoutFacadeDataArray.emplaceBack(0, 0, 0, 0), F17.layoutFacadeVerticalRangeArray.emplaceBack(0, 0); } const s19 = C6.vertexLength; for (let e59 = 0; e59 < t47.indices.length; e59 += 3) F17.indexArray.emplaceBack(s19 + t47.indices[e59], s19 + t47.indices[e59 + 1], s19 + t47.indices[e59 + 2]); C6.vertexLength += t47.positions.length / 3, C6.primitiveLength += t47.indices.length / 3, ("roof" === t47.buildingPart || "wall" === t47.buildingPart || "facade_glazing" === t47.buildingPart || "entrance" === t47.buildingPart) && D5.push({ part: t47.buildingPart, vertexOffset: e58, vertexLength: t47.positions.length / 3 }); } this.maxHeight = Math.max(this.maxHeight, N5), this.buildingFeatures.push({ feature: u12, hasFauxFacade: x4, segment: C6, parts: D5, buildingBloom: R5 }); const j4 = F17.indexArray.length - U4, $5 = [], G5 = [], H4 = new wt(1 / 0, 1 / 0), q3 = new wt(-1 / 0, -1 / 0), X3 = this.groundEffect.vertexArray.length; for (const t47 of B6.modifiedPolygonRings) { const e58 = [], r87 = new wt(1 / 0, 1 / 0), n46 = new wt(-1 / 0, -1 / 0); for (let i27 = 0; i27 < t47.length; i27 += 2) { const s19 = t47.length - i27 - 2; r87.x = Math.min(r87.x, t47[s19]), r87.y = Math.min(r87.y, t47[s19 + 1]), n46.x = Math.max(n46.x, t47[s19]), n46.y = Math.max(n46.y, t47[s19 + 1]); const o89 = new wt(t47[s19], t47[s19 + 1]); e58.push(o89), $5.push(o89.x, o89.y), G5.push(o89.clone()); } H4.x = Math.min(H4.x, r87.x), H4.y = Math.min(H4.y, r87.y), q3.x = Math.max(q3.x, n46.x), q3.y = Math.max(q3.y, n46.y), this.groundEffect.addData(e58, [r87, n46], g9); } const Z3 = this.groundEffect.vertexArray.length - X3; (k7.x < 0 || z4.x > Rn || k7.y < 0 || z4.y > Rn) && this.featuresOnBorder.push({ featureId: a46.id, footprintIndex: this.footprints.length }); { const t47 = Ih($5, null, 2), e58 = new bp(G5, t47, 8, 256); let r87 = a46.id; a46.properties && a46.properties.hasOwnProperty("building_id") && (r87 = a46.properties.building_id), this.footprints.push({ vertices: G5, indices: t47, grid: e58, min: H4, max: q3, buildingId: r87, hiddenFlags: 0, indicesOffset: U4, indicesLength: j4, bloomIndicesOffset: L3, bloomIndicesLength: O4, groundEffectVertexOffset: X3, groundEffectVertexLength: Z3, hasFauxFacade: x4, segment: C6, height: N5 }); } this.programConfigurations.populatePaintArrays(F17.layoutVertexArray.length, a46, l21, {}, e57.availableImages, r86, e57.brightness), this.groundEffect.addPaintPropertiesData(a46, l21, {}, e57.availableImages, r86, e57.brightness); } this.groundEffect.prepareBorderSegments(), this.evaluate(this.layers[0], {}); } update(t45, e57, r86, n45, i26, s18, o88) { this.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88), this.groundEffect.update(t45, e57, i26, r86, n45, s18, o88), this.evaluate(this.layers[0], t45), this.colorBufferUploaded = false; } isEmpty() { return 0 === this.buildingWithoutFacade.layoutVertexArray.length && 0 === this.buildingWithFacade.layoutVertexArray.length; } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload || this.groundEffect.programConfigurations.needsUpload; } upload(t45) { const e57 = (e58) => { e58.layoutVertexBuffer = t45.createVertexBuffer(e58.layoutVertexArray, nm.members), e58.layoutNormalBuffer = t45.createVertexBuffer(e58.layoutNormalArray, im.members), e58.layoutCentroidBuffer = t45.createVertexBuffer(e58.layoutCentroidArray, sm.members), e58.layoutFacadeDataArray && e58.layoutFacadeDataArray.length && (e58.layoutFacadeDataBuffer = t45.createVertexBuffer(e58.layoutFacadeDataArray, lm.members)), e58.layoutFacadeVerticalRangeArray && e58.layoutFacadeVerticalRangeArray.length && (e58.layoutFacadeVerticalRangeBuffer = t45.createVertexBuffer(e58.layoutFacadeVerticalRangeArray, um.members)), e58.entranceBloom.layoutVertexArray.length && (e58.entranceBloom.layoutVertexBuffer = t45.createVertexBuffer(e58.entranceBloom.layoutVertexArray, nm.members), e58.entranceBloom.layoutAttenuationBuffer = t45.createVertexBuffer(e58.entranceBloom.layoutAttenuationArray, cm.members)), this.uploadUpdatedColorBuffer(t45), this.uploadUpdatedIndexBuffer(t45); }; this.uploaded || (e57(this.buildingWithoutFacade), e57(this.buildingWithFacade), this.groundEffect.upload(t45)), this.groundEffect.uploadPaintProperties(t45), this.programConfigurations.upload(t45), this.uploaded = true; } destroy() { const t45 = (t46) => { t46.layoutVertexBuffer && (t46.layoutVertexBuffer.destroy(), t46.layoutNormalBuffer.destroy(), t46.layoutColorBuffer.destroy(), t46.segmentsBucket.destroy(), t46.indexBuffer && t46.indexBuffer.destroy(), t46.entranceBloom.layoutVertexBuffer && (t46.entranceBloom.layoutVertexBuffer.destroy(), t46.entranceBloom.layoutColorBuffer.destroy(), t46.entranceBloom.layoutAttenuationBuffer.destroy(), t46.entranceBloom.indexBuffer.destroy(), t46.entranceBloom.segmentsBucket.destroy())); }; t45(this.buildingWithoutFacade), t45(this.buildingWithFacade), this.groundEffect.destroy(), this.programConfigurations.destroy(); } updateFootprintHiddenFlags(t45, e57, r86 = true) { let n45 = false; const i26 = r86 ? e57 : 0, s18 = 0 | (r86 ? -1 : ~e57); 0 === this.groundEffect.hiddenByLandmarkVertexArray.length && this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); for (const e58 of t45) { const t46 = this.footprints[e58], r87 = t46.hiddenFlags & s18 | i26; t46.hiddenFlags !== r87 && (t46.hiddenFlags = r87, n45 = true, this.groundEffect.updateHiddenByLandmarkRange(t46.groundEffectVertexOffset, t46.groundEffectVertexLength, 0 !== t46.hiddenFlags)); } return n45 && (this.indexArrayForConflationUploaded = false), n45; } uploadUpdatedIndexBuffer(t45) { if (this.groundEffect.uploadHiddenByLandmark(t45), this.indexArrayForConflationUploaded) return; const e57 = (t46) => { 0 !== t46.indexArray.length && (t46.indexArrayForConflation.resize(t46.indexArray.length), t46.indexArrayForConflation.uint16.set(t46.indexArray.uint16), t46.entranceBloom.indexArrayForConflation.resize(t46.entranceBloom.indexArray.length), t46.entranceBloom.indexArrayForConflation.uint16.set(t46.entranceBloom.indexArray.uint16)); }; e57(this.buildingWithoutFacade), e57(this.buildingWithFacade); for (const t46 of this.footprints) { const e58 = t46.hasFauxFacade ? this.buildingWithFacade : this.buildingWithoutFacade, r87 = t46.indicesOffset + t46.indicesLength; if (0 !== t46.hiddenFlags) { for (let n46 = t46.indicesOffset; n46 < r87; n46++) e58.indexArrayForConflation.uint16[3 * n46 + 0] = 0, e58.indexArrayForConflation.uint16[3 * n46 + 1] = 0, e58.indexArrayForConflation.uint16[3 * n46 + 2] = 0; const n45 = t46.bloomIndicesOffset + t46.bloomIndicesLength; for (let r88 = t46.bloomIndicesOffset; r88 < n45; r88++) e58.entranceBloom.indexArrayForConflation.uint16[3 * r88 + 0] = 0, e58.entranceBloom.indexArrayForConflation.uint16[3 * r88 + 1] = 0, e58.entranceBloom.indexArrayForConflation.uint16[3 * r88 + 2] = 0; } } const r86 = (e58) => { 0 !== e58.indexArray.length && (e58.indexBuffer ? e58.indexBuffer.updateData(e58.indexArrayForConflation) : e58.indexBuffer = t45.createIndexBuffer(e58.indexArrayForConflation, true), e58.entranceBloom.indexBuffer ? e58.entranceBloom.indexBuffer.updateData(e58.entranceBloom.indexArrayForConflation) : e58.entranceBloom.indexBuffer = t45.createIndexBuffer(e58.entranceBloom.indexArrayForConflation, true)); }; r86(this.buildingWithoutFacade), r86(this.buildingWithFacade), this.indexArrayForConflationUploaded = true; } uploadUpdatedColorBuffer(t45) { const e57 = (e58) => { e58.layoutColorBuffer ? e58.layoutColorBuffer.updateData(e58.layoutColorArray) : e58.layoutColorBuffer = t45.createVertexBuffer(e58.layoutColorArray, om.members, true), e58.layoutFacadePaintArray && (e58.layoutFacadePaintBuffer ? e58.layoutFacadePaintBuffer.updateData(e58.layoutFacadePaintArray) : e58.layoutFacadePaintBuffer = t45.createVertexBuffer(e58.layoutFacadePaintArray, am.members, true)), e58.entranceBloom.layoutColorBuffer ? e58.entranceBloom.layoutColorBuffer.updateData(e58.entranceBloom.layoutColorArray) : e58.entranceBloom.layoutColorBuffer = t45.createVertexBuffer(e58.entranceBloom.layoutColorArray, om.members, true); }; e57(this.buildingWithoutFacade), e57(this.buildingWithFacade), this.colorBufferUploaded = true; } evaluate(t45, e57) { const r86 = t45.paint.get("building-ambient-occlusion-intensity"); for (const n45 of this.buildingFeatures) { const i26 = e57[n45.feature.id], s18 = n45.feature; s18.properties["building-part"] = "roof"; const o88 = t45.paint.get("building-color").evaluate(s18, i26, this.canonical).toPremultipliedRenderColor(this.lut), a46 = t45.paint.get("building-emissive-strength").evaluate(s18, i26, this.canonical); s18.properties["building-part"] = "wall"; const l21 = t45.paint.get("building-color").evaluate(s18, i26, this.canonical).toPremultipliedRenderColor(this.lut), u12 = t45.paint.get("building-emissive-strength").evaluate(s18, i26, this.canonical); s18.properties["building-part"] = "window"; const c28 = t45.paint.get("building-color").evaluate(s18, i26, this.canonical).toPremultipliedRenderColor(this.lut), h8 = t45.paint.get("building-emissive-strength").evaluate(s18, i26, this.canonical); s18.properties["building-part"] = "door"; const p9 = t45.paint.get("building-color").evaluate(s18, i26, this.canonical).toPremultipliedRenderColor(this.lut), d34 = t45.paint.get("building-emissive-strength").evaluate(s18, i26, this.canonical), f8 = n45.hasFauxFacade ? this.buildingWithFacade : this.buildingWithoutFacade; for (const t46 of n45.parts) { let e58, i27 = o88; "roof" === t46.part ? (i27 = o88, e58 = a46) : "wall" === t46.part ? (i27 = l21, e58 = u12) : "facade_glazing" === t46.part ? (i27 = c28, e58 = h8) : "entrance" === t46.part && (i27 = p9, e58 = d34), e58 = Tt2(e58, 0, 1); for (let s19 = 0; s19 < t46.vertexLength; s19++) { const o89 = t46.vertexOffset + s19, a47 = 1 + (f8.layoutAOArray[o89] - 1) * r86; f8.layoutColorArray.emplace(o89, i27.r * a47 * 255 << 8 | i27.g * a47 * 255, i27.b * a47 * 255 << 8 | 255 * e58), n45.hasFauxFacade && f8.layoutFacadePaintArray.emplace(o89, 255 * c28.r << 8 | 255 * c28.g, 255 * c28.b << 8 | 255 * h8); } } const m6 = n45.buildingBloom; if (m6) for (let t46 = 0; t46 < m6.vertexLength; t46++) f8.entranceBloom.layoutColorArray.emplace(m6.vertexOffset + t46, 255 * p9.r << 8 | 255 * p9.g, 255 * p9.b << 8 | 51 * d34); } } needsEvaluation() { return !this.colorBufferUploaded; } updateReplacement(t45, e57, r86) { if (e57.updateTime === this.replacementUpdateTime) return; this.replacementUpdateTime = e57.updateTime; const n45 = e57.getReplacementRegionsForTile(t45.toUnwrapped()); if (Dp(this.activeReplacements, n45)) return; this.activeReplacements = n45; for (const t46 of this.footprints) t46.hiddenFlags &= -2; const i26 = []; for (const e58 of this.activeReplacements) { if (e58.order <= Tp) continue; const r87 = Math.max(1, Math.pow(2, e58.footprintTileId.canonical.z - t45.canonical.z)); for (const n46 of this.footprints) n46.min.x > e58.max.x || n46.max.x < e58.min.x || n46.min.y > e58.max.y || n46.max.y < e58.min.y || (i26.length = 0, gm(n46.vertices, 0, n46.vertices.length, e58.footprintTileId.canonical, t45.canonical, i26), Op(e58.footprint, i26, n46.indices, 0, n46.indices.length, 0, -r87) && (n46.hiddenFlags |= 1)); } 0 === this.groundEffect.hiddenByLandmarkVertexArray.length && this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); for (const t46 of this.footprints) this.groundEffect.updateHiddenByLandmarkRange(t46.groundEffectVertexOffset, t46.groundEffectVertexLength, 0 !== t46.hiddenFlags); this.indexArrayForConflationUploaded = false; } getHeightAtTileCoord(t45, e57) { let r86 = Number.NEGATIVE_INFINITY, n45 = true; const i26 = 4 * (t45 + Rn) * Rn + (e57 + Rn); if (this.footprintLookup.hasOwnProperty(i26)) { const t46 = this.footprintLookup[i26]; return t46 ? { height: t46.height, hidden: 0 !== t46.hiddenFlags } : void 0; } const s18 = new wt(t45, e57); for (const o88 of this.footprints) t45 > o88.max.x || o88.min.x > t45 || e57 > o88.max.y || o88.min.y > e57 || o88.height <= r86 || jp(s18, o88) && (r86 = o88.height, this.footprintLookup[i26] = o88, n45 = 0 !== o88.hiddenFlags); if (r86 !== Number.NEGATIVE_INFINITY) return { height: r86, hidden: n45 }; this.footprintLookup[i26] = void 0; } } function gm(t45, e57, r86, n45, i26, s18) { const o88 = Math.pow(2, n45.z - i26.z); for (let a46 = 0; a46 < r86; a46++) { let r87 = t45[a46 + e57].x, l21 = t45[a46 + e57].y; r87 = (r87 + i26.x * Rn) * o88 - n45.x * Rn, l21 = (l21 + i26.y * Rn) * o88 - n45.y * Rn, s18.push(new wt(r87, l21)); } } let xm, vm; Ws(ym, "BuildingBucket", { omit: ["layers"] }), Ws(mm, "BuildingGeometry"), Ws(fm, "BuildingBloomGeometry"); const bm = aa2([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }, { name: "a_linesofar", components: 1, type: "Float32" }], 4), wm = aa2([{ name: "a_z_offset_width", components: 3, type: "Float32" }], 4), { members: _m } = bm, Am = aa2([{ name: "a_packed", components: 3, type: "Float32" }]), { members: Mm } = Am, Im = aa2([{ name: "a_pattern_data", components: 3, type: "Float32" }]), { members: Sm } = Im; class Pm { constructor(t45, e57) { this.width = t45, this.height = e57, this.nextRow = 0, this.image = new gh({ width: t45, height: e57 }), this.positions = {}, this.uploaded = false; } getDash(t45, e57) { const r86 = this.getKey(t45, e57); return this.positions[r86]; } trim() { const t45 = this.width, e57 = this.height = Rt2(this.nextRow); this.image.resize({ width: t45, height: e57 }); } getKey(t45, e57) { return t45.join(",") + e57; } getDashRanges(t45, e57, r86) { const n45 = []; let i26 = t45.length % 2 == 1 ? -t45[t45.length - 1] * r86 : 0, s18 = t45[0] * r86, o88 = true; n45.push({ left: i26, right: s18, isDash: o88, zeroLength: 0 === t45[0] }); let a46 = t45[0]; for (let e58 = 1; e58 < t45.length; e58++) { o88 = !o88; const l21 = t45[e58]; i26 = a46 * r86, a46 += l21, s18 = a46 * r86, n45.push({ left: i26, right: s18, isDash: o88, zeroLength: 0 === l21 }); } return n45; } addRoundDash(t45, e57, r86) { const n45 = e57 / 2; for (let e58 = -r86; e58 <= r86; e58++) { const i26 = this.width * (this.nextRow + r86 + e58); let s18 = 0, o88 = t45[s18]; for (let a46 = 0; a46 < this.width; a46++) { a46 / o88.right > 1 && (o88 = t45[++s18]); const l21 = Math.abs(a46 - o88.left), u12 = Math.abs(a46 - o88.right), c28 = Math.min(l21, u12); let h8; const p9 = e58 / r86 * (n45 + 1); if (o88.isDash) { const t46 = n45 - Math.abs(p9); h8 = Math.sqrt(c28 * c28 + t46 * t46); } else h8 = n45 - Math.sqrt(c28 * c28 + p9 * p9); this.image.data[i26 + a46] = Math.max(0, Math.min(255, h8 + 128)); } } } addRegularDash(t45, e57) { for (let e58 = t45.length - 1; e58 >= 0; --e58) { const r87 = t45[e58], n46 = t45[e58 + 1]; r87.zeroLength ? t45.splice(e58, 1) : n46 && n46.isDash === r87.isDash && (n46.left = r87.left, t45.splice(e58, 1)); } const r86 = t45[0], n45 = t45[t45.length - 1]; r86.isDash === n45.isDash && (r86.left = n45.left - this.width, n45.right = r86.right + this.width); const i26 = this.width * this.nextRow; let s18 = 0, o88 = t45[s18]; for (let r87 = 0; r87 < this.width; r87++) { r87 / o88.right > 1 && (o88 = t45[++s18]); const n46 = Math.abs(r87 - o88.left), a46 = Math.abs(r87 - o88.right), l21 = Math.min(n46, a46); this.image.data[i26 + r87] = Math.max(0, Math.min(255, (o88.isDash ? l21 : -l21) + e57 + 128)); } } addDash(t45, e57) { const r86 = this.getKey(t45, e57); if (this.positions[r86]) return this.positions[r86]; const n45 = "round" === e57, i26 = n45 ? 7 : 0, s18 = 2 * i26 + 1; if (this.nextRow + s18 > this.height) return Gt("LineAtlas out of space"), null; 0 === t45.length && t45.push(1); let o88 = 0; for (let e58 = 0; e58 < t45.length; e58++) t45[e58] < 0 && (Gt("Negative value is found in line dasharray, replacing values with 0"), t45[e58] = 0), o88 += t45[e58]; if (0 !== o88) { const r87 = this.width / o88, s19 = this.getDashRanges(t45, this.width, r87); n45 ? this.addRoundDash(s19, r87, i26) : this.addRegularDash(s19, "square" === e57 ? 0.5 * r87 : 0); } const a46 = this.nextRow + i26; this.nextRow += s18; const l21 = { tl: [a46, i26], br: [o88, 0] }; return this.positions[r86] = l21, l21; } } Ws(Pm, "LineAtlas"); const km2 = Iu.types, zm = Math.cos(Math.PI / 180 * 37.5), Em = Math.cos(Math.PI / 180 * 5); class Tm { constructor(t45) { this.evaluationGlobals = { zoom: 0, lineProgress: void 0 }, this.elevationType = "none", this.zoom = t45.zoom, this.evaluationGlobals.zoom = this.zoom, this.overscaling = t45.overscaling, this.pixelRatio = t45.pixelRatio, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.projection = t45.projection, this.hasPattern = false, this.hasCrossSlope = false, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.layers.forEach(((t46) => { this.gradients[t46.id] = {}; })), this.layoutVertexArray = new ya(), this.layoutVertexArray2 = new ga(), this.patternVertexArray = new ga(), this.indexArray = new Ea(), this.programConfigurations = new Cl(t45.layers, { zoom: t45.zoom, lut: t45.lut }), this.segments = new al(), this.maxLineLength = 0, this.zOffsetVertexArray = new ga(), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.tessellationStep = t45.tessellationStep ? t45.tessellationStep : Rn / 64, this.worldview = t45.worldview; } updateFootprints(t45, e57) { } populate(t45, e57, r86, n45) { this.hasPattern = tp("line", this.layers, this.pixelRatio, e57); const i26 = this.layers[0].layout.get("line-sort-key"); this.tileToMeter = fu(r86); const s18 = this.layers[0].layout.get("line-elevation-reference"); if ("hd-road-markup" === s18) this.elevationType = "road"; else { const t46 = this.layers[0].layout.get("line-z-offset"), e58 = t46.isConstant() && !t46.constantOr(0); this.elevationType = "sea" !== s18 && "ground" !== s18 && e58 ? "none" : "offset", "offset" === this.elevationType && "none" === s18 && Gt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`); } const o88 = this.layers[0].layout.get("line-cross-slope"); this.hasCrossSlope = "offset" === this.elevationType && void 0 !== o88; const a46 = []; for (const { feature: e58, id: s19, index: o89, sourceLayerIndex: l22 } of t45) { const t46 = this.layers[0]._featureFilter.needGeometry, u13 = Mu(e58, t46); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), u13, r86)) continue; const c29 = i26 ? i26.evaluate(u13, {}, r86) : void 0, h8 = { id: s19, properties: e58.properties, type: e58.type, sourceLayerIndex: l22, index: o89, geometry: t46 ? u13.geometry : Au(e58, r86, n45), patterns: {}, sortKey: c29 }; a46.push(h8); } i26 && a46.sort(((t46, e58) => t46.sortKey - e58.sortKey)); const { lineAtlas: l21, featureIndex: u12 } = e57, c28 = this.addConstantDashes(l21); for (const n46 of a46) { const { geometry: i27, index: s19, sourceLayerIndex: o89 } = n46; if (c28 && this.addFeatureDashes(n46, l21), this.hasPattern) { const t46 = ep("line", this.layers, n46, this.zoom, this.pixelRatio, e57); this.patternFeatures.push(t46); } else this.addFeature(n46, i27, s19, r86, l21.positions, e57.availableImages, e57.brightness, e57.elevationFeatures); u12.insert(t45[s19].feature, i27, s19, o89, this.index); } } addConstantDashes(t45) { let e57 = false; for (const r86 of this.layers) { const n45 = r86.paint.get("line-dasharray").value, i26 = r86.layout.get("line-cap").value; if ("constant" !== n45.kind || "constant" !== i26.kind) e57 = true; else { const e58 = i26.value, r87 = n45.value; if (!r87) continue; t45.addDash(r87, e58); } } return e57; } addFeatureDashes(t45, e57) { const r86 = this.zoom; for (const n45 of this.layers) { const i26 = n45.paint.get("line-dasharray").value, s18 = n45.layout.get("line-cap").value; if ("constant" === i26.kind && "constant" === s18.kind) continue; let o88, a46; if ("constant" === i26.kind) { if (o88 = i26.value, !o88) continue; } else o88 = i26.evaluate({ zoom: r86 }, t45); a46 = "constant" === s18.kind ? s18.value : s18.evaluate({ zoom: r86 }, t45), e57.addDash(o88, a46), t45.patterns[n45.id] = [e57.getKey(o88, a46)]; } } update(t45, e57, r86, n45, i26, s18, o88, a46) { this.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, a46); } addFeatures(t45, e57, r86, n45, i26, s18) { for (const t46 of this.patternFeatures) this.addFeature(t46, t46.geometry, t46.index, e57, r86, n45, s18); } isEmpty() { return 0 === this.layoutVertexArray.length; } uploadPending() { return !this.uploaded || this.programConfigurations.needsUpload; } upload(t45) { this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = t45.createVertexBuffer(this.layoutVertexArray2, Mm)), 0 !== this.patternVertexArray.length && (this.patternVertexBuffer = t45.createVertexBuffer(this.patternVertexArray, Sm)), !this.zOffsetVertexBuffer && this.zOffsetVertexArray.length > 0 && (this.zOffsetVertexBuffer = t45.createVertexBuffer(this.zOffsetVertexArray, wm.members, true)), this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, _m), this.indexBuffer = t45.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t45), this.uploaded = true; } destroy() { this.layoutVertexBuffer && (this.zOffsetVertexBuffer && this.zOffsetVertexBuffer.destroy(), this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); } lineFeatureClips(t45, e57) { let r86, n45; if (e57 && e57 > 0 ? (r86 = `mapbox_clip_start_${e57}`, n45 = `mapbox_clip_end_${e57}`) : (r86 = "mapbox_clip_start", n45 = "mapbox_clip_end"), t45.properties && t45.properties.hasOwnProperty(r86) && t45.properties.hasOwnProperty(n45)) return { start: +t45.properties[r86], end: +t45.properties[n45] }; } addFeature(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = this.layers[0].layout, u12 = l21.get("line-join").evaluate(t45, {}), c28 = l21.get("line-cap").evaluate(t45, {}), h8 = l21.get("line-miter-limit"), p9 = l21.get("line-round-limit"); this.lineClips = this.lineFeatureClips(t45), this.lineFeature = t45; const d34 = !(!t45.properties || !t45.properties.hasOwnProperty("mapbox_line_metrics")) && t45.properties.mapbox_line_metrics; this.zOffsetValue = l21.get("line-z-offset").value; const f8 = this.layers[0].paint.get("line-width").value; if ("constant" !== f8.kind && false === f8.isLineProgressConstant && (this.variableWidthValue = f8), "road" === this.elevationType) { const r87 = this.layoutVertexArray.length; if (!this.addElevatedRoadFeature(t45, e57, n45, a46, u12, c28, h8, p9)) { const [i27, s19] = this.clipRuntimeLinesToTile(e57, 1); for (let e58 = 0; e58 < i27.length; e58++) { const r88 = i27[e58], o89 = s19[e58], a47 = { progress: { min: o89.progress.min, max: o89.progress.max }, nextDir: this.computeSegNextDir(o89, r88), prevDir: this.computeSegPrevDir(o89, r88) }; this.addLine(r88, t45, n45, u12, c28, h8, p9, a47, d34 && o89.parentIndex > 0 ? o89.parentIndex : null); } this.fillNonElevatedRoadSegment(r87); } } else for (let r87 = 0; r87 < e57.length; r87++) this.addLine(e57[r87], t45, n45, u12, c28, h8, p9, void 0, d34 && r87 > 0 ? r87 : null); this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t45, r86, i26, s18, n45, o88, void 0, this.worldview); } computeSegNextDir(t45, e57) { return t45.nextPoint.sub(e57.at(-2)).unit(); } computeSegPrevDir(t45, e57) { return e57[1].sub(t45.prevPoint).unit(); } clipLinesToTile(t45, e57) { return Sd(t45, -e57, -e57, Rn + e57, Rn + e57); } clipRuntimeLinesToTile(t45, e57) { const r86 = []; return [Sd(t45, -e57, -e57, Rn + e57, Rn + e57, r86), r86]; } addElevatedRoadFeature(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = [], u12 = Yu.getElevationFeature(t45, n45); if (u12) { const t46 = this.clipLinesToTile(e57, 1), n46 = this.prepareElevatedLines(t46, u12, r86); for (const t47 of n46) l21.push({ geometry: t47, elevation: u12, elevationTileID: r86, segment: { progress: { min: 0, max: 1 }, nextDir: void 0, prevDir: void 0 } }); } if (0 === l21.length) return false; for (const e58 of l21) { const n46 = this.layoutVertexArray.length; this.addLine(e58.geometry, t45, r86, i26, s18, o88, a46); const l22 = new Ku(r86, e58.elevationTileID); if (e58.elevation) for (let t46 = n46; t46 < this.layoutVertexArray.length; t46++) { const r87 = new wt(this.layoutVertexArray.int16[6 * t46] >> 1, this.layoutVertexArray.int16[6 * t46 + 1] >> 1), n47 = l22.pointElevation(r87, e58.elevation, 0.05); this.updateHeightRange(n47), this.zOffsetVertexArray.emplaceBack(n47, 0, 0); } else this.fillNonElevatedRoadSegment(n46); } return true; } prepareElevatedLines(t45, e57, r86) { if (null != e57.constantHeight) return t45; const n45 = [], i26 = 1 / fu(r86); for (const r87 of t45) Pd(r87, new Zu(e57, i26), 0, n45); return n45; } fillNonElevatedRoadSegment(t45) { for (let e57 = t45; e57 < this.layoutVertexArray.length; e57++) this.zOffsetVertexArray.emplaceBack(0, 0, 0); } updateHeightRange(t45) { this.heightRange ? (this.heightRange.min = Math.min(this.heightRange.min, t45), this.heightRange.max = Math.max(this.heightRange.max, t45)) : this.heightRange = { min: t45, max: t45 }; } addLine(t45, e57, r86, n45, i26, s18, o88, a46, l21) { this.distance = 0, this.prevDistance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.totalFeatureLength = 0, this.lineSoFar = 0, this.currentVertex = void 0, this.lineClips = l21 ? this.lineFeatureClips(e57, l21) : this.lineClips; const u12 = "none" === n45; this.patternJoinNone = this.hasPattern && u12, this.segmentStart = 0, this.segmentStartf32 = 0, this.segmentPoints = []; const c28 = a46 && a46.progress.min > 0, h8 = a46 && a46.progress.max < 1; if (this.lineClips) { let r87 = { min: this.lineClips.start, max: this.lineClips.end }, n46 = 1; if (a46) { const t46 = this.lineClips.end - this.lineClips.start; r87 = (function(t47, e58, r88) { return { min: re2(t47.min, e58, r88), max: re2(t47.max, e58, r88) }; })(a46.progress, { min: 0, max: 1 }, r87), t46 > 0 && (n46 = (r87.max - r87.min) / t46); } const i27 = +e57.properties.mapbox_clip_feature_len, s19 = +e57.properties.mapbox_clip_seg_len; if (Number.isNaN(i27) || Number.isNaN(s19)) { for (let e59 = 0; e59 < t45.length - 1; e59++) this.totalDistance += t45[e59].dist(t45[e59 + 1]); const e58 = this.totalDistance / (r87.max - r87.min); this.totalFeatureLength = Number.isFinite(e58) ? e58 : 0, this.lineClips.start = r87.min, this.lineClips.end = r87.max, this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance); } else this.totalFeatureLength = i27, this.distance = s19 * n46, this.lineClips.start = r87.min, this.lineClips.end = r87.max, this.maxLineLength = Math.max(this.maxLineLength, this.distance); this.lineClipsArray.push(this.lineClips), this.updateScaledDistance(); } const p9 = "Polygon" === km2[e57.type]; let d34 = t45.length; for (; d34 >= 2 && t45[d34 - 1].equals(t45[d34 - 2]); ) d34--; let f8 = 0; for (; f8 < d34 - 1 && t45[f8].equals(t45[f8 + 1]); ) f8++; if (d34 < (p9 ? 3 : 2)) return; "bevel" === n45 && (s18 = 1.05); const m6 = this.segments.prepareSegment(10 * d34, this.layoutVertexArray, this.indexArray); let y4, g9, x4, v8, b8, w4, _4, A4; a46 && a46.prevDir && (w4 = a46.prevDir.perp()), a46 && a46.nextDir && (_4 = a46.nextDir.perp()), this.e1 = this.e2 = -1, p9 && (y4 = t45[d34 - 2], b8 = t45[f8].sub(y4)._unit()._perp()); for (let e58 = f8; e58 < d34; e58++) { if (x4 = e58 === d34 - 1 ? p9 ? t45[f8 + 1] : void 0 : t45[e58 + 1], x4 && t45[e58].equals(x4)) continue; b8 && (v8 = b8), y4 && (g9 = y4), y4 = t45[e58], A4 = this.evaluateLineProgressFeatures(g9 ? g9.dist(y4) : 0), b8 = x4 ? x4.sub(y4)._unit()._perp() : v8, v8 = v8 || b8; const r87 = g9 && x4; let a47 = r87 ? n45 : p9 || u12 ? "butt" : i26; const l22 = v8.x * b8.x + v8.y * b8.y; if (u12) { const t46 = function(t47) { if (t47.patternJoinNone) { const e59 = t47.segmentPoints.length / 2, r88 = t47.lineSoFar - t47.segmentStart; for (let n46 = 0; n46 < e59; ++n46) { const e60 = t47.segmentPoints[2 * n46 + 1], i27 = Math.round(t47.segmentPoints[2 * n46]) + 0.5 + 0.25 * e60; t47.patternVertexArray.emplaceBack(i27, r88, t47.segmentStart), t47.patternVertexArray.emplaceBack(i27, r88, t47.segmentStart); } t47.segmentPoints.length = 0; } t47.e1 = t47.e2 = -1; }; if (r87 && l22 < Em) { this.updateDistance(g9, y4), this.addCurrentVertex(y4, v8, 1, 1, m6, A4), t46(this), this.addCurrentVertex(y4, b8, -1, -1, m6, A4); continue; } if (g9) { if (!x4) { this.updateDistance(g9, y4), this.addCurrentVertex(y4, v8, 1, 1, m6, A4), t46(this); continue; } a47 = "miter"; } } let M5 = v8.add(b8); 0 === M5.x && 0 === M5.y || M5._unit(); const I4 = M5.x * b8.x + M5.y * b8.y, S5 = 0 !== I4 ? 1 / I4 : 1 / 0, P4 = 2 * Math.sqrt(2 - 2 * I4), k7 = I4 < zm && g9 && x4, z4 = v8.x * b8.y - v8.y * b8.x > 0, E5 = this.overscaling <= 16 ? 15 * Rn / (512 * this.overscaling) : 0; if (r87 && "round" === a47) { if (S5 < o88) a47 = "miter"; else if (S5 <= 2) { const t46 = Bm(y4, -10, Rn + 10); a47 = "offset" === this.elevationType && (t46 || this.hasCrossSlope) ? "miter" : "fakeround"; } } if ("miter" === a47 && S5 > s18 && (a47 = "bevel"), "bevel" === a47 && (S5 > 2 && (a47 = "flipbevel"), S5 < s18 && (a47 = "miter")), g9 && !("miter" === a47 && k7) && this.updateDistance(g9, y4), "miter" === a47) if (k7) { const t46 = y4.dist(g9); if (t46 > 2 * E5) { const e60 = y4.sub(y4.sub(g9)._mult(E5 / t46)._round()); this.updateDistance(g9, e60), this.addCurrentVertex(e60, v8, 0, 0, m6, A4), g9 = e60; } this.updateDistance(g9, y4), M5._mult(S5), this.addCurrentVertex(y4, M5, 0, 0, m6, A4); const e59 = y4.dist(x4); if (e59 > 2 * E5) { const t47 = y4.add(x4.sub(y4)._mult(E5 / e59)._round()); this.updateDistance(y4, t47), this.addCurrentVertex(t47, b8, 0, 0, m6, A4), y4 = t47; } } else M5._mult(S5), this.addCurrentVertex(y4, M5, 0, 0, m6, A4); else if ("flipbevel" === a47) { if (S5 > 100) M5 = b8.mult(-1); else { const t46 = S5 * v8.add(b8).mag() / v8.sub(b8).mag(); M5._perp()._mult(t46 * (z4 ? -1 : 1)); } this.addCurrentVertex(y4, M5, 0, 0, m6, A4), this.addCurrentVertex(y4, M5.mult(-1), 0, 0, m6, A4); } else if ("bevel" === a47 || "fakeround" === a47) { null != A4 && g9 && this.addCurrentVertex(y4, _4 || v8, -1, -1, m6, A4); const t46 = y4.dist(g9) <= 2 * E5 && "bevel" !== a47, e59 = M5.mult(z4 ? 1 : -1); e59._mult(S5); const r88 = b8.mult(z4 ? -1 : 1), n46 = v8.mult(z4 ? -1 : 1), i27 = this.evaluateLineProgressFeatures(this.distance); if (null == A4 && (this.addHalfVertex(y4, e59.x, e59.y, false, !z4, 0, m6, i27), t46 || this.addHalfVertex(y4, e59.x + 2 * n46.x, e59.y + 2 * n46.y, false, z4, 0, m6, i27)), "fakeround" === a47) { const t47 = Math.round(180 * P4 / Math.PI / 20); this.addHalfVertex(y4, n46.x, n46.y, false, z4, 0, m6, i27); for (let e60 = 0; e60 < t47; e60++) { let s19 = e60 / t47; if (0.5 !== s19) { const t48 = s19 - 0.5; s19 += s19 * t48 * (s19 - 1) * ((1.0904 + l22 * (l22 * (3.55645 - 1.43519 * l22) - 3.2452)) * t48 * t48 + (0.848013 + l22 * (0.215638 * l22 - 1.06021))); } const o89 = r88.sub(n46)._mult(s19)._add(n46)._unit(); this.addHalfVertex(y4, o89.x, o89.y, false, z4, 0, m6, i27); } this.addHalfVertex(y4, r88.x, r88.y, false, z4, 0, m6, i27); } t46 || null != A4 || this.addHalfVertex(y4, e59.x + 2 * r88.x, e59.y + 2 * r88.y, false, z4, 0, m6, i27), null != A4 && x4 && this.addCurrentVertex(y4, w4 || b8, 1, 1, m6, A4); } else if ("butt" === a47) this.addCurrentVertex(y4, M5, 0, 0, m6, A4); else if ("square" === a47) { if (!g9) { const t46 = c28 ? 0 : -1; this.addCurrentVertex(y4, M5, t46, t46, m6, A4); } if (this.addCurrentVertex(y4, M5, 0, 0, m6, A4), g9) { const t46 = h8 ? 0 : 1; this.addCurrentVertex(y4, M5, t46, t46, m6, A4); } } else if ("round" === a47) { if (g9) { const t46 = !r87 && _4 ? _4 : v8; this.addCurrentVertex(y4, t46, 0, 0, m6, A4), !r87 && h8 || this.addCurrentVertex(y4, t46, 1, 1, m6, A4, true); } if (x4) { const t46 = !r87 && w4 ? w4 : b8; !r87 && c28 || this.addCurrentVertex(y4, t46, -1, -1, m6, A4, true), this.addCurrentVertex(y4, t46, 0, 0, m6, A4); } } } } addVerticesTo(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) { const c28 = (e57.w - t45.w) / this.tessellationStep | 0; let h8 = 0; const p9 = this.scaledDistance; if (c28 > 1) { this.lineSoFar = t45.w; const p10 = (e57.x - t45.x) / c28, d35 = (e57.y - t45.y) / c28, f8 = (e57.z - t45.z) / c28, m6 = (e57.w - t45.w) / c28; for (let e58 = 1; e58 < c28; ++e58) { t45.x += p10, t45.y += d35, t45.z += f8, this.lineSoFar += m6, h8 += m6; const e59 = this.evaluateLineProgressFeatures(this.prevDistance + h8); this.scaledDistance = (this.prevDistance + h8) / this.totalDistance, this.addHalfVertex(t45, r86, n45, u12, false, o88, l21, e59), this.addHalfVertex(t45, i26, s18, u12, true, -a46, l21, e59); } } this.lineSoFar = e57.w, this.scaledDistance = p9; const d34 = this.evaluateLineProgressFeatures(this.distance); this.addHalfVertex(e57, r86, n45, u12, false, o88, l21, d34), this.addHalfVertex(e57, i26, s18, u12, true, -a46, l21, d34); } evaluateLineProgressFeatures(t45) { if (!this.variableWidthValue && "offset" !== this.elevationType) return null; this.evaluationGlobals.lineProgress = 0, this.lineClips ? this.evaluationGlobals.lineProgress = Math.min(1, (this.totalFeatureLength * this.lineClips.start + t45) / this.totalFeatureLength) : Gt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`); let e57 = 0; return this.variableWidthValue && "constant" !== this.variableWidthValue.kind && (e57 = this.variableWidthValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0), "offset" !== this.elevationType ? { zOffset: 0, variableWidth: e57 } : "constant" === this.zOffsetValue.kind ? { zOffset: this.zOffsetValue.value, variableWidth: e57 } : { zOffset: this.zOffsetValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0, variableWidth: e57 }; } addCurrentVertex(t45, e57, r86, n45, i26, s18, o88 = false) { const a46 = e57.x + e57.y * r86, l21 = e57.y - e57.x * r86, u12 = e57.y * n45 - e57.x, c28 = -e57.y - e57.x * n45; if (null != s18) { const e58 = "offset" === this.elevationType, h8 = -10, p9 = Rn + 10, d34 = s18.zOffset, f8 = new Ad(t45.x, t45.y, d34, this.lineSoFar), m6 = !!e58 && Bm(t45, h8, p9), y4 = this.lineSoFar, g9 = this.distance; if (this.currentVertex) if (m6) { const e59 = this.currentVertexIsOutside, s19 = this.currentVertex, m7 = new Ad(t45.x, t45.y, d34, this.lineSoFar); if (Id(s19, m7, h8, p9), !Bm(m7, h8, p9)) { if (e59) { this.e1 = this.e2 = -1, this.distance -= s19.dist(f8), this.lineSoFar = s19.w; const t46 = this.evaluateLineProgressFeatures(s19.w - this.totalFeatureLength * (this.lineClips ? this.lineClips.start : 0)); this.addHalfVertex(s19, a46, l21, o88, false, r86, i26, t46), this.addHalfVertex(s19, u12, c28, o88, true, -n45, i26, t46), this.prevDistance = this.distance; } this.distance = this.prevDistance + s19.dist(m7), this.scaledDistance = this.distance / this.totalDistance, this.addVerticesTo(s19, m7, a46, l21, u12, c28, r86, n45, i26, o88), this.distance = g9, this.scaledDistance = this.distance / this.totalDistance; } } else { const t46 = this.currentVertex; if (this.currentVertexIsOutside) { Id(t46, f8, h8, p9), this.e1 = this.e2 = -1, this.distance -= t46.dist(f8), this.scaledDistance = this.distance / this.totalDistance, this.lineSoFar = t46.w; const e59 = this.evaluateLineProgressFeatures(t46.w - this.totalFeatureLength * (this.lineClips ? this.lineClips.start : 0)); this.addHalfVertex(t46, a46, l21, o88, false, r86, i26, e59), this.addHalfVertex(t46, u12, c28, o88, true, -n45, i26, e59), this.prevDistance = this.distance, this.distance = g9, this.scaledDistance = this.distance / this.totalDistance; } this.addVerticesTo(t46, f8, a46, l21, u12, c28, r86, n45, i26, o88); } else m6 || (this.addHalfVertex(t45, a46, l21, o88, false, r86, i26, s18), this.addHalfVertex(t45, u12, c28, o88, true, -n45, i26, s18)); this.currentVertex = f8, this.currentVertexIsOutside = m6, this.lineSoFar = y4; } else this.addHalfVertex(t45, a46, l21, o88, false, r86, i26, s18), this.addHalfVertex(t45, u12, c28, o88, true, -n45, i26, s18); } addHalfVertex({ x: t45, y: e57 }, r86, n45, i26, s18, o88, a46, l21) { if (this.patternJoinNone && (0 === this.segmentPoints.length && (this.segmentStart = this.lineSoFar, this.segmentStartf32 = Math.fround(this.lineSoFar)), s18 || this.segmentPoints.push(this.lineSoFar - this.segmentStart, o88)), this.layoutVertexArray.emplaceBack((t45 << 1) + (i26 ? 1 : 0), (e57 << 1) + (s18 ? 1 : 0), Math.round(63 * r86) + 128, Math.round(63 * n45) + 128, 1 + (0 === o88 ? 0 : o88 < 0 ? -1 : 1), 0, this.lineSoFar - this.segmentStartf32), this.lineClips) { const t46 = ur(this.lineClips.start, this.lineClips.end, this.scaledDistance); this.layoutVertexArray2.emplaceBack(this.scaledDistance, this.lineClipsArray.length, t46); } const u12 = a46.vertexLength++; this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, u12), a46.primitiveLength++), s18 ? this.e2 = u12 : this.e1 = u12, null != l21 && this.zOffsetVertexArray.emplaceBack(l21.zOffset, l21.variableWidth, l21.variableWidth); } updateScaledDistance() { this.lineClips ? (this.scaledDistance = this.distance / this.totalDistance, this.lineSoFar = this.totalFeatureLength * this.lineClips.start + this.distance) : this.lineSoFar = this.distance; } updateDistance(t45, e57) { this.prevDistance = this.distance, this.distance += t45.dist(e57), this.updateScaledDistance(); } } function Bm(t45, e57, r86) { return t45.x < e57 || t45.x > r86 || t45.y < e57 || t45.y > r86; } let Vm, Fm; function Cm(t45, e57, r86) { return e57 * (Rn / (t45.tileSize * Math.pow(2, r86 - t45.tileID.overscaledZ))); } Ws(Tm, "LineBucket", { omit: ["layers", "patternFeatures", "currentVertex", "currentVertexIsOutside"] }); const Dm = (t45, e57, r86) => (1 - r86) * t45 + r86 * e57; function Rm(t45, e57) { return 1 / Cm(t45, 1, e57.tileZoom); } function Lm(t45, e57, r86, n45) { return t45.translatePosMatrix(n45 || e57.tileID.projMatrix, e57, r86.paint.get("line-translate"), r86.paint.get("line-translate-anchor")); } const Om = (t45) => { const e57 = []; Um(t45) && e57.push("RENDER_LINE_DASH"), t45.paint.get("line-gradient") && e57.push("RENDER_LINE_GRADIENT"); const r86 = t45.paint.get("line-trim-offset"); 0 === r86[0] && 0 === r86[1] || e57.push("RENDER_LINE_TRIM_OFFSET"), 0 !== t45.paint.get("line-border-width").constantOr(1) && e57.push("RENDER_LINE_BORDER"); const n45 = "none" === t45.layout.get("line-join").constantOr("miter"), i26 = !!t45.paint.get("line-pattern").constantOr(1); return n45 && i26 && e57.push("LINE_JOIN_NONE"), e57; }; function Um(t45) { const e57 = t45.paint.get("line-dasharray").value; return "constant" !== e57.kind || e57.value; } let Nm; const jm = () => Nm || (Nm = { layout: Vm || (Vm = new Vo({ "line-cap": new To(Fo.layout_line["line-cap"]), "line-join": new To(Fo.layout_line["line-join"]), "line-miter-limit": new Eo(Fo.layout_line["line-miter-limit"]), "line-round-limit": new Eo(Fo.layout_line["line-round-limit"]), "line-sort-key": new To(Fo.layout_line["line-sort-key"]), "line-z-offset": new To(Fo.layout_line["line-z-offset"]), "line-elevation-reference": new Eo(Fo.layout_line["line-elevation-reference"]), "line-cross-slope": new Eo(Fo.layout_line["line-cross-slope"]), visibility: new Eo(Fo.layout_line.visibility), "line-width-unit": new Eo(Fo.layout_line["line-width-unit"]) })), paint: Fm || (Fm = new Vo({ "line-opacity": new To(Fo.paint_line["line-opacity"]), "line-color": new To(Fo.paint_line["line-color"]), "line-translate": new Eo(Fo.paint_line["line-translate"]), "line-translate-anchor": new Eo(Fo.paint_line["line-translate-anchor"]), "line-width": new To(Fo.paint_line["line-width"]), "line-gap-width": new To(Fo.paint_line["line-gap-width"]), "line-offset": new To(Fo.paint_line["line-offset"]), "line-blur": new To(Fo.paint_line["line-blur"]), "line-dasharray": new To(Fo.paint_line["line-dasharray"]), "line-pattern": new To(Fo.paint_line["line-pattern"]), "line-pattern-cross-fade": new Eo(Fo.paint_line["line-pattern-cross-fade"]), "line-gradient": new Bo(Fo.paint_line["line-gradient"]), "line-trim-offset": new Eo(Fo.paint_line["line-trim-offset"]), "line-trim-fade-range": new Eo(Fo.paint_line["line-trim-fade-range"]), "line-trim-color": new Eo(Fo.paint_line["line-trim-color"]), "line-emissive-strength": new Eo(Fo.paint_line["line-emissive-strength"]), "line-border-width": new To(Fo.paint_line["line-border-width"]), "line-border-color": new To(Fo.paint_line["line-border-color"]), "line-occlusion-opacity": new Eo(Fo.paint_line["line-occlusion-opacity"]), "line-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "line-gradient-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "line-trim-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "line-border-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, Nm); class $m extends To { possiblyEvaluate(t45, e57) { return e57 = new wo(Math.floor(e57.zoom), { now: e57.now, fadeDuration: e57.fadeDuration, transition: e57.transition, worldview: e57.worldview }), super.possiblyEvaluate(t45, e57); } evaluate(t45, e57, r86, n45) { return e57 = Object.assign({}, e57, { zoom: Math.floor(e57.zoom) }), super.evaluate(t45, e57, r86, n45); } } let Gm; function Hm(t45, e57) { return e57 > 0 ? e57 + 2 * t45 : t45; } const qm = aa2([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_tex_size", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), Xm = aa2([{ name: "a_globe_anchor", components: 3, type: "Int16" }, { name: "a_globe_normal", components: 3, type: "Float32" }], 4), Zm = aa2([{ name: "a_projected_pos", components: 4, type: "Float32" }], 4); aa2([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4); const Wm = aa2([{ name: "a_auto_z_offset", components: 1, type: "Float32" }], 4), Ym = aa2([{ name: "a_x_axis", components: 3, type: "Float32" }, { name: "a_y_axis", components: 3, type: "Float32" }]), Km = aa2([{ name: "a_texb", components: 2, type: "Uint16" }]), Jm = aa2([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }, { name: "a_elevation_from_sea", components: 2, type: "Float32" }]), Qm = aa2([{ name: "a_size_scale", components: 1, type: "Float32" }, { name: "a_padding", components: 2, type: "Float32" }, { name: "a_auto_z_offset", components: 1, type: "Float32" }]); aa2([{ 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 ty = aa2([{ name: "a_pos", components: 3, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4), ey = aa2([{ name: "a_pos_2f", components: 2, type: "Float32" }, { name: "a_radius", components: 1, type: "Float32" }, { name: "a_flags", components: 2, type: "Int16" }], 4); aa2([{ name: "triangle", components: 3, type: "Uint16" }]), aa2([{ type: "Int16", name: "projectedAnchorX" }, { type: "Int16", name: "projectedAnchorY" }, { type: "Int16", name: "projectedAnchorZ" }, { type: "Float32", name: "tileAnchorX" }, { type: "Float32", name: "tileAnchorY" }, { type: "Uint16", name: "glyphStartIndex" }, { type: "Uint16", name: "numGlyphs" }, { type: "Uint32", name: "vertexStartIndex" }, { type: "Uint32", name: "lineStartIndex" }, { type: "Uint32", name: "lineLength" }, { type: "Uint16", name: "segment" }, { type: "Uint16", name: "lowerSize" }, { type: "Uint16", name: "upperSize" }, { type: "Float32", name: "lineOffsetX" }, { type: "Float32", name: "lineOffsetY" }, { type: "Uint8", name: "writingMode" }, { type: "Uint8", name: "placedOrientation" }, { type: "Uint8", name: "hidden" }, { type: "Uint32", name: "crossTileID" }, { type: "Int16", name: "associatedIconIndex" }, { type: "Uint8", name: "flipState" }]), aa2([{ type: "Float32", name: "tileAnchorX" }, { type: "Float32", name: "tileAnchorY" }, { type: "Int16", name: "projectedAnchorX" }, { type: "Int16", name: "projectedAnchorY" }, { type: "Int16", name: "projectedAnchorZ" }, { type: "Int16", name: "rightJustifiedTextSymbolIndex" }, { type: "Int16", name: "centerJustifiedTextSymbolIndex" }, { type: "Int16", name: "leftJustifiedTextSymbolIndex" }, { type: "Int16", name: "verticalPlacedTextSymbolIndex" }, { type: "Int16", name: "placedIconSymbolIndex" }, { type: "Int16", name: "verticalPlacedIconSymbolIndex" }, { type: "Uint16", name: "key" }, { type: "Uint16", name: "textBoxStartIndex" }, { type: "Uint16", name: "textBoxEndIndex" }, { type: "Uint16", name: "verticalTextBoxStartIndex" }, { type: "Uint16", name: "verticalTextBoxEndIndex" }, { type: "Uint16", name: "iconBoxStartIndex" }, { type: "Uint16", name: "iconBoxEndIndex" }, { type: "Uint16", name: "verticalIconBoxStartIndex" }, { type: "Uint16", name: "verticalIconBoxEndIndex" }, { type: "Uint16", name: "featureIndex" }, { type: "Uint16", name: "numHorizontalGlyphVertices" }, { type: "Uint16", name: "numVerticalGlyphVertices" }, { type: "Uint16", name: "numIconVertices" }, { type: "Uint16", name: "numVerticalIconVertices" }, { type: "Uint16", name: "useRuntimeCollisionCircles" }, { type: "Uint32", name: "crossTileID" }, { type: "Float32", components: 2, name: "textOffset" }, { type: "Float32", name: "collisionCircleDiameter" }, { type: "Float32", name: "zOffset" }, { type: "Uint8", name: "hasIconTextFit" }, { type: "Uint16", name: "elevationFeatureIndex" }]), aa2([{ type: "Float32", name: "offsetX" }]), aa2([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }]); var ry = 24; function ny(t45, e57, r86) { return t45.sections.forEach(((t46) => { t46.text = (function(t47, e58, r87) { const n45 = e58.layout.get("text-transform").evaluate(r87, {}); return "uppercase" === n45 ? t47 = t47.toLocaleUpperCase() : "lowercase" === n45 && (t47 = t47.toLocaleLowerCase()), bo.applyArabicShaping && (t47 = bo.applyArabicShaping(t47)), t47; })(t46.text, e57, r86); })), t45; } const iy = { "!": "\uFE15", "#": "\uFF03", $: "\uFF04", "%": "\uFF05", "&": "\uFF06", "(": "\uFE35", ")": "\uFE36", "*": "\uFF0A", "+": "\uFF0B", ",": "\uFE10", "-": "\uFE32", ".": "\u30FB", "/": "\uFF0F", ":": "\uFE13", ";": "\uFE14", "<": "\uFE3F", "=": "\uFF1D", ">": "\uFE40", "?": "\uFE16", "@": "\uFF20", "[": "\uFE47", "\\": "\uFF3C", "]": "\uFE48", "^": "\uFF3E", _: "\uFE33", "`": "\uFF40", "{": "\uFE37", "|": "\u2015", "}": "\uFE38", "~": "\uFF5E", "\xA2": "\uFFE0", "\xA3": "\uFFE1", "\xA5": "\uFFE5", "\xA6": "\uFFE4", "\xAC": "\uFFE2", "\xAF": "\uFFE3", "\u2013": "\uFE32", "\u2014": "\uFE31", "\u2018": "\uFE43", "\u2019": "\uFE44", "\u201C": "\uFE41", "\u201D": "\uFE42", "\u2026": "\uFE19", "\u2027": "\u30FB", "\u20A9": "\uFFE6", "\u3001": "\uFE11", "\u3002": "\uFE12", "\u3008": "\uFE3F", "\u3009": "\uFE40", "\u300A": "\uFE3D", "\u300B": "\uFE3E", "\u300C": "\uFE41", "\u300D": "\uFE42", "\u300E": "\uFE43", "\u300F": "\uFE44", "\u3010": "\uFE3B", "\u3011": "\uFE3C", "\u3014": "\uFE39", "\u3015": "\uFE3A", "\u3016": "\uFE17", "\u3017": "\uFE18", "\uFF01": "\uFE15", "\uFF08": "\uFE35", "\uFF09": "\uFE36", "\uFF0C": "\uFE10", "\uFF0D": "\uFE32", "\uFF0E": "\u30FB", "\uFF1A": "\uFE13", "\uFF1B": "\uFE14", "\uFF1C": "\uFE3F", "\uFF1E": "\uFE40", "\uFF1F": "\uFE16", "\uFF3B": "\uFE47", "\uFF3D": "\uFE48", "\uFF3F": "\uFE33", "\uFF5B": "\uFE37", "\uFF5C": "\u2015", "\uFF5D": "\uFE38", "\uFF5F": "\uFE35", "\uFF60": "\uFE36", "\uFF61": "\uFE12", "\uFF62": "\uFE41", "\uFF63": "\uFE42", "\u2190": "\u2191", "\u2192": "\u2193" }; function sy(t45) { return "\uFE36" === t45 || "\uFE48" === t45 || "\uFE38" === t45 || "\uFE44" === t45 || "\uFE42" === t45 || "\uFE3E" === t45 || "\uFE3C" === t45 || "\uFE3A" === t45 || "\uFE18" === t45 || "\uFE40" === t45 || "\uFE10" === t45 || "\uFE13" === t45 || "\uFE14" === t45 || "\uFF40" === t45 || "\uFFE3" === t45 || "\uFE11" === t45 || "\uFE12" === t45; } function oy(t45) { return "\uFE35" === t45 || "\uFE47" === t45 || "\uFE37" === t45 || "\uFE43" === t45 || "\uFE41" === t45 || "\uFE3D" === t45 || "\uFE3B" === t45 || "\uFE39" === t45 || "\uFE17" === t45 || "\uFE3F" === t45; } const ay = 4294967296, ly = 1 / ay, uy = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf-8"); let cy = class { constructor(t45 = new Uint8Array(16)) { this.buf = ArrayBuffer.isView(t45) ? t45 : new Uint8Array(t45), this.dataView = new DataView(this.buf.buffer), this.pos = 0, this.type = 0, this.length = this.buf.length; } readFields(t45, e57, r86 = this.length) { for (; this.pos < r86; ) { const r87 = this.readVarint(), n45 = r87 >> 3, i26 = this.pos; this.type = 7 & r87, t45(n45, e57, this), this.pos === i26 && this.skip(r87); } return e57; } readMessage(t45, e57) { return this.readFields(t45, e57, this.readVarint() + this.pos); } readFixed32() { const t45 = this.dataView.getUint32(this.pos, true); return this.pos += 4, t45; } readSFixed32() { const t45 = this.dataView.getInt32(this.pos, true); return this.pos += 4, t45; } readFixed64() { const t45 = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * ay; return this.pos += 8, t45; } readSFixed64() { const t45 = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * ay; return this.pos += 8, t45; } readFloat() { const t45 = this.dataView.getFloat32(this.pos, true); return this.pos += 4, t45; } readDouble() { const t45 = this.dataView.getFloat64(this.pos, true); return this.pos += 8, t45; } readVarint(t45) { const e57 = this.buf; let r86, n45; return n45 = e57[this.pos++], r86 = 127 & n45, n45 < 128 ? r86 : (n45 = e57[this.pos++], r86 |= (127 & n45) << 7, n45 < 128 ? r86 : (n45 = e57[this.pos++], r86 |= (127 & n45) << 14, n45 < 128 ? r86 : (n45 = e57[this.pos++], r86 |= (127 & n45) << 21, n45 < 128 ? r86 : (n45 = e57[this.pos], r86 |= (15 & n45) << 28, (function(t46, e58, r87) { const n46 = r87.buf; let i26, s18; if (s18 = n46[r87.pos++], i26 = (112 & s18) >> 4, s18 < 128) return hy(t46, i26, e58); if (s18 = n46[r87.pos++], i26 |= (127 & s18) << 3, s18 < 128) return hy(t46, i26, e58); if (s18 = n46[r87.pos++], i26 |= (127 & s18) << 10, s18 < 128) return hy(t46, i26, e58); if (s18 = n46[r87.pos++], i26 |= (127 & s18) << 17, s18 < 128) return hy(t46, i26, e58); if (s18 = n46[r87.pos++], i26 |= (127 & s18) << 24, s18 < 128) return hy(t46, i26, e58); if (s18 = n46[r87.pos++], i26 |= (1 & s18) << 31, s18 < 128) return hy(t46, i26, e58); throw new Error("Expected varint not more than 10 bytes"); })(r86, t45, this))))); } readVarint64() { return this.readVarint(true); } readSVarint() { const t45 = this.readVarint(); return t45 % 2 == 1 ? (t45 + 1) / -2 : t45 / 2; } readBoolean() { return Boolean(this.readVarint()); } readString() { const t45 = this.readVarint() + this.pos, e57 = this.pos; return this.pos = t45, t45 - e57 >= 12 && uy ? uy.decode(this.buf.subarray(e57, t45)) : (function(t46, e58, r86) { let n45 = "", i26 = e58; for (; i26 < r86; ) { const e59 = t46[i26]; let s18, o88, a46, l21 = null, u12 = e59 > 239 ? 4 : e59 > 223 ? 3 : e59 > 191 ? 2 : 1; if (i26 + u12 > r86) break; 1 === u12 ? e59 < 128 && (l21 = e59) : 2 === u12 ? (s18 = t46[i26 + 1], 128 == (192 & s18) && (l21 = (31 & e59) << 6 | 63 & s18, l21 <= 127 && (l21 = null))) : 3 === u12 ? (s18 = t46[i26 + 1], o88 = t46[i26 + 2], 128 == (192 & s18) && 128 == (192 & o88) && (l21 = (15 & e59) << 12 | (63 & s18) << 6 | 63 & o88, (l21 <= 2047 || l21 >= 55296 && l21 <= 57343) && (l21 = null))) : 4 === u12 && (s18 = t46[i26 + 1], o88 = t46[i26 + 2], a46 = t46[i26 + 3], 128 == (192 & s18) && 128 == (192 & o88) && 128 == (192 & a46) && (l21 = (15 & e59) << 18 | (63 & s18) << 12 | (63 & o88) << 6 | 63 & a46, (l21 <= 65535 || l21 >= 1114112) && (l21 = null))), null === l21 ? (l21 = 65533, u12 = 1) : l21 > 65535 && (l21 -= 65536, n45 += String.fromCharCode(l21 >>> 10 & 1023 | 55296), l21 = 56320 | 1023 & l21), n45 += String.fromCharCode(l21), i26 += u12; } return n45; })(this.buf, e57, t45); } readBytes() { const t45 = this.readVarint() + this.pos, e57 = this.buf.subarray(this.pos, t45); return this.pos = t45, e57; } readPackedVarint(t45 = [], e57) { const r86 = this.readPackedEnd(); for (; this.pos < r86; ) t45.push(this.readVarint(e57)); return t45; } readPackedSVarint(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readSVarint()); return t45; } readPackedBoolean(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readBoolean()); return t45; } readPackedFloat(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readFloat()); return t45; } readPackedDouble(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readDouble()); return t45; } readPackedFixed32(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readFixed32()); return t45; } readPackedSFixed32(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readSFixed32()); return t45; } readPackedFixed64(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readFixed64()); return t45; } readPackedSFixed64(t45 = []) { const e57 = this.readPackedEnd(); for (; this.pos < e57; ) t45.push(this.readSFixed64()); return t45; } readPackedEnd() { return 2 === this.type ? this.readVarint() + this.pos : this.pos + 1; } skip(t45) { const e57 = 7 & t45; if (0 === e57) for (; this.buf[this.pos++] > 127; ) ; else if (2 === e57) this.pos = this.readVarint() + this.pos; else if (5 === e57) this.pos += 4; else { if (1 !== e57) throw new Error(`Unimplemented type: ${e57}`); this.pos += 8; } } writeTag(t45, e57) { this.writeVarint(t45 << 3 | e57); } realloc(t45) { let e57 = this.length || 16; for (; e57 < this.pos + t45; ) e57 *= 2; if (e57 !== this.length) { const t46 = new Uint8Array(e57); t46.set(this.buf), this.buf = t46, this.dataView = new DataView(t46.buffer), this.length = e57; } } finish() { return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length); } writeFixed32(t45) { this.realloc(4), this.dataView.setInt32(this.pos, t45, true), this.pos += 4; } writeSFixed32(t45) { this.realloc(4), this.dataView.setInt32(this.pos, t45, true), this.pos += 4; } writeFixed64(t45) { this.realloc(8), this.dataView.setInt32(this.pos, -1 & t45, true), this.dataView.setInt32(this.pos + 4, Math.floor(t45 * ly), true), this.pos += 8; } writeSFixed64(t45) { this.realloc(8), this.dataView.setInt32(this.pos, -1 & t45, true), this.dataView.setInt32(this.pos + 4, Math.floor(t45 * ly), true), this.pos += 8; } writeVarint(t45) { (t45 = +t45 || 0) > 268435455 || t45 < 0 ? (function(t46, e57) { let r86, n45; if (t46 >= 0 ? (r86 = t46 % 4294967296 | 0, n45 = t46 / 4294967296 | 0) : (r86 = ~(-t46 % 4294967296), n45 = ~(-t46 / 4294967296), 4294967295 ^ r86 ? r86 = r86 + 1 | 0 : (r86 = 0, n45 = n45 + 1 | 0)), t46 >= 18446744073709552e3 || t46 < -18446744073709552e3) throw new Error("Given varint doesn't fit into 10 bytes"); e57.realloc(10), (function(t47, e58, r87) { r87.buf[r87.pos++] = 127 & t47 | 128, t47 >>>= 7, r87.buf[r87.pos++] = 127 & t47 | 128, t47 >>>= 7, r87.buf[r87.pos++] = 127 & t47 | 128, t47 >>>= 7, r87.buf[r87.pos++] = 127 & t47 | 128, r87.buf[r87.pos] = 127 & (t47 >>>= 7); })(r86, 0, e57), (function(t47, e58) { const r87 = (7 & t47) << 4; e58.buf[e58.pos++] |= r87 | ((t47 >>>= 3) ? 128 : 0), t47 && (e58.buf[e58.pos++] = 127 & t47 | ((t47 >>>= 7) ? 128 : 0), t47 && (e58.buf[e58.pos++] = 127 & t47 | ((t47 >>>= 7) ? 128 : 0), t47 && (e58.buf[e58.pos++] = 127 & t47 | ((t47 >>>= 7) ? 128 : 0), t47 && (e58.buf[e58.pos++] = 127 & t47 | ((t47 >>>= 7) ? 128 : 0), t47 && (e58.buf[e58.pos++] = 127 & t47))))); })(n45, e57); })(t45, this) : (this.realloc(4), this.buf[this.pos++] = 127 & t45 | (t45 > 127 ? 128 : 0), t45 <= 127 || (this.buf[this.pos++] = 127 & (t45 >>>= 7) | (t45 > 127 ? 128 : 0), t45 <= 127 || (this.buf[this.pos++] = 127 & (t45 >>>= 7) | (t45 > 127 ? 128 : 0), t45 <= 127 || (this.buf[this.pos++] = t45 >>> 7 & 127)))); } writeSVarint(t45) { this.writeVarint(t45 < 0 ? 2 * -t45 - 1 : 2 * t45); } writeBoolean(t45) { this.writeVarint(+t45); } writeString(t45) { t45 = String(t45), this.realloc(4 * t45.length), this.pos++; const e57 = this.pos; this.pos = (function(t46, e58, r87) { for (let n45, i26, s18 = 0; s18 < e58.length; s18++) { if (n45 = e58.charCodeAt(s18), n45 > 55295 && n45 < 57344) { if (!i26) { n45 > 56319 || s18 + 1 === e58.length ? (t46[r87++] = 239, t46[r87++] = 191, t46[r87++] = 189) : i26 = n45; continue; } if (n45 < 56320) { t46[r87++] = 239, t46[r87++] = 191, t46[r87++] = 189, i26 = n45; continue; } n45 = i26 - 55296 << 10 | n45 - 56320 | 65536, i26 = null; } else i26 && (t46[r87++] = 239, t46[r87++] = 191, t46[r87++] = 189, i26 = null); n45 < 128 ? t46[r87++] = n45 : (n45 < 2048 ? t46[r87++] = n45 >> 6 | 192 : (n45 < 65536 ? t46[r87++] = n45 >> 12 | 224 : (t46[r87++] = n45 >> 18 | 240, t46[r87++] = n45 >> 12 & 63 | 128), t46[r87++] = n45 >> 6 & 63 | 128), t46[r87++] = 63 & n45 | 128); } return r87; })(this.buf, t45, this.pos); const r86 = this.pos - e57; r86 >= 128 && py(e57, r86, this), this.pos = e57 - 1, this.writeVarint(r86), this.pos += r86; } writeFloat(t45) { this.realloc(4), this.dataView.setFloat32(this.pos, t45, true), this.pos += 4; } writeDouble(t45) { this.realloc(8), this.dataView.setFloat64(this.pos, t45, true), this.pos += 8; } writeBytes(t45) { const e57 = t45.length; this.writeVarint(e57), this.realloc(e57); for (let r86 = 0; r86 < e57; r86++) this.buf[this.pos++] = t45[r86]; } writeRawMessage(t45, e57) { this.pos++; const r86 = this.pos; t45(e57, this); const n45 = this.pos - r86; n45 >= 128 && py(r86, n45, this), this.pos = r86 - 1, this.writeVarint(n45), this.pos += n45; } writeMessage(t45, e57, r86) { this.writeTag(t45, 2), this.writeRawMessage(e57, r86); } writePackedVarint(t45, e57) { e57.length && this.writeMessage(t45, dy, e57); } writePackedSVarint(t45, e57) { e57.length && this.writeMessage(t45, fy, e57); } writePackedBoolean(t45, e57) { e57.length && this.writeMessage(t45, gy, e57); } writePackedFloat(t45, e57) { e57.length && this.writeMessage(t45, my, e57); } writePackedDouble(t45, e57) { e57.length && this.writeMessage(t45, yy, e57); } writePackedFixed32(t45, e57) { e57.length && this.writeMessage(t45, xy, e57); } writePackedSFixed32(t45, e57) { e57.length && this.writeMessage(t45, vy, e57); } writePackedFixed64(t45, e57) { e57.length && this.writeMessage(t45, by, e57); } writePackedSFixed64(t45, e57) { e57.length && this.writeMessage(t45, wy, e57); } writeBytesField(t45, e57) { this.writeTag(t45, 2), this.writeBytes(e57); } writeFixed32Field(t45, e57) { this.writeTag(t45, 5), this.writeFixed32(e57); } writeSFixed32Field(t45, e57) { this.writeTag(t45, 5), this.writeSFixed32(e57); } writeFixed64Field(t45, e57) { this.writeTag(t45, 1), this.writeFixed64(e57); } writeSFixed64Field(t45, e57) { this.writeTag(t45, 1), this.writeSFixed64(e57); } writeVarintField(t45, e57) { this.writeTag(t45, 0), this.writeVarint(e57); } writeSVarintField(t45, e57) { this.writeTag(t45, 0), this.writeSVarint(e57); } writeStringField(t45, e57) { this.writeTag(t45, 2), this.writeString(e57); } writeFloatField(t45, e57) { this.writeTag(t45, 5), this.writeFloat(e57); } writeDoubleField(t45, e57) { this.writeTag(t45, 1), this.writeDouble(e57); } writeBooleanField(t45, e57) { this.writeVarintField(t45, +e57); } }; function hy(t45, e57, r86) { return r86 ? 4294967296 * e57 + (t45 >>> 0) : 4294967296 * (e57 >>> 0) + (t45 >>> 0); } function py(t45, e57, r86) { const n45 = e57 <= 16383 ? 1 : e57 <= 2097151 ? 2 : e57 <= 268435455 ? 3 : Math.floor(Math.log(e57) / (7 * Math.LN2)); r86.realloc(n45); for (let e58 = r86.pos - 1; e58 >= t45; e58--) r86.buf[e58 + n45] = r86.buf[e58]; } function dy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeVarint(t45[r86]); } function fy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeSVarint(t45[r86]); } function my(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeFloat(t45[r86]); } function yy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeDouble(t45[r86]); } function gy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeBoolean(t45[r86]); } function xy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeFixed32(t45[r86]); } function vy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeSFixed32(t45[r86]); } function by(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeFixed64(t45[r86]); } function wy(t45, e57) { for (let r86 = 0; r86 < t45.length; r86++) e57.writeSFixed64(t45[r86]); } const _y = 3; function Ay(t45, e57, r86) { e57.glyphs = [], 1 === t45 && r86.readMessage(My, e57); } function My(t45, e57, r86) { if (3 === t45) { const { id: t46, bitmap: n45, width: i26, height: s18, left: o88, top: a46, advance: l21 } = r86.readMessage(Iy, {}); e57.glyphs.push({ id: t46, bitmap: new gh({ width: i26 + 2 * _y, height: s18 + 2 * _y }, n45), metrics: { width: i26, height: s18, left: o88, top: a46, advance: l21 } }); } else 4 === t45 ? e57.ascender = r86.readSVarint() : 5 === t45 && (e57.descender = r86.readSVarint()); } function Iy(t45, e57, r86) { 1 === t45 ? e57.id = r86.readVarint() : 2 === t45 ? e57.bitmap = r86.readBytes() : 3 === t45 ? e57.width = r86.readVarint() : 4 === t45 ? e57.height = r86.readVarint() : 5 === t45 ? e57.left = r86.readSVarint() : 6 === t45 ? e57.top = r86.readSVarint() : 7 === t45 && (e57.advance = r86.readVarint()); } const Sy = _y, Py = { horizontal: 1, vertical: 2, horizontalOnly: 3 }; class ky { constructor() { this.scale = 1, this.fontStack = "", this.image = null; } static forText(t45, e57) { const r86 = new ky(); return r86.scale = t45 || 1, r86.fontStack = e57, r86; } static forImage(t45) { const e57 = new ky(); return e57.image = t45, e57; } } class zy { constructor() { this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null; } static fromFeature(t45, e57, r86) { const n45 = new zy(); for (let i26 = 0; i26 < t45.sections.length; i26++) { const s18 = t45.sections[i26]; s18.image ? n45.addImageSection(s18, r86) : n45.addTextSection(s18, e57); } return n45; } length() { return this.text.length; } getSection(t45) { return this.sections[this.sectionIndex[t45]]; } getSections() { return this.sections; } getSectionIndex(t45) { return this.sectionIndex[t45]; } getCodePoint(t45) { return this.text.codePointAt(t45); } verticalizePunctuation(t45) { this.text = (function(t46, e57) { let r86 = ""; for (let n45 = 0; n45 < t46.length; n45++) { const i26 = t46.charCodeAt(n45 + 1) || null, s18 = t46.charCodeAt(n45 - 1) || null; r86 += !e57 && (i26 && so(i26) && !iy[t46[n45 + 1]] || s18 && so(s18) && !iy[t46[n45 - 1]]) || !iy[t46[n45]] ? t46[n45] : iy[t46[n45]]; } return r86; })(this.text, t45); } trim() { let t45 = 0; for (let e58 = 0; e58 < this.text.length && Ty[this.text.charCodeAt(e58)]; e58++) t45++; let e57 = this.text.length; for (let r86 = this.text.length - 1; r86 >= 0 && r86 >= t45 && Ty[this.text.charCodeAt(r86)]; r86--) e57--; this.text = this.text.substring(t45, e57), this.sectionIndex = this.sectionIndex.slice(t45, e57); } substring(t45, e57) { const r86 = new zy(); return r86.text = this.text.substring(t45, e57), r86.sectionIndex = this.sectionIndex.slice(t45, e57), r86.sections = this.sections, r86; } toString() { return this.text; } getMaxScale() { return this.sectionIndex.reduce(((t45, e57) => Math.max(t45, this.sections[e57].scale)), 0); } addTextSection(t45, e57) { this.text += t45.text, this.sections.push(ky.forText(t45.scale, t45.fontStack || e57)); const r86 = this.sections.length - 1; for (let e58 = 0; e58 < t45.text.length; ++e58) this.sectionIndex.push(r86); } addImageSection(t45, e57) { const r86 = t45.image ? t45.image.getPrimary() : null; if (!r86) return void Gt("Can't add FormattedSection with an empty image."); r86.scaleSelf(e57); const n45 = this.getNextImageSectionCharCode(); n45 ? (this.text += String.fromCodePoint(n45), this.sections.push(ky.forImage(r86)), this.sectionIndex.push(this.sections.length - 1)) : Gt("Reached maximum number of images 6401"); } getNextImageSectionCharCode() { return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID); } } function Ey(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6 = 1) { const y4 = zy.fromFeature(t45, i26, m6); h8 === Py.vertical && y4.verticalizePunctuation(p9); let g9 = []; const x4 = (function(t46, e58, r87, n46, i27, s19) { if (!t46) return []; const o89 = [], a47 = (function(t47, e59, r88, n47, i28, s20) { let o90 = 0; for (let r89 = 0; r89 < t47.length(); r89++) { const a48 = t47.getSection(r89); o90 += Vy(t47.getCodePoint(r89), a48, n47, i28, e59, s20); } return o90 / Math.max(1, Math.ceil(o90 / r88)); })(t46, e58, r87, n46, i27, s19), l22 = t46.text.indexOf("\u200B") >= 0; let u13 = 0; for (let r88 = 0; r88 < t46.length(); r88++) { const h9 = t46.getSection(r88), p10 = t46.getCodePoint(r88); if (Ty[p10] || (u13 += Vy(p10, h9, n46, i27, e58, s19)), r88 < t46.length() - 1) { const e59 = !((c29 = p10) < 11904 || !(to3["Bopomofo Extended"](c29) || to3.Bopomofo(c29) || to3["CJK Compatibility Forms"](c29) || to3["CJK Compatibility Ideographs"](c29) || to3["CJK Compatibility"](c29) || to3["CJK Radicals Supplement"](c29) || to3["CJK Strokes"](c29) || to3["CJK Symbols and Punctuation"](c29) || to3["CJK Unified Ideographs Extension A"](c29) || to3["CJK Unified Ideographs"](c29) || to3["Enclosed CJK Letters and Months"](c29) || to3["Halfwidth and Fullwidth Forms"](c29) || to3.Hiragana(c29) || to3["Ideographic Description Characters"](c29) || to3["Kangxi Radicals"](c29) || to3["Katakana Phonetic Extensions"](c29) || to3.Katakana(c29) || to3["Vertical Forms"](c29) || to3["Yi Radicals"](c29) || to3["Yi Syllables"](c29))); (By[p10] || e59 || h9.image) && o89.push(Dy(r88 + 1, u13, a47, o89, Cy(p10, t46.getCodePoint(r88 + 1), e59 && l22), false)); } } var c29; return Ry(Dy(t46.length(), u13, a47, o89, 0, true)); })(y4, u12, s18, e57, n45, d34), { processBidirectionalText: v8, processStyledBidirectionalText: b8 } = bo; if (v8 && 1 === y4.sections.length) { const t46 = v8(y4.toString(), x4); for (const e58 of t46) { const t47 = new zy(); t47.text = e58, t47.sections = y4.sections; for (let r87 = 0; r87 < e58.length; r87++) t47.sectionIndex.push(0); g9.push(t47); } } else if (b8) { const t46 = b8(y4.text, y4.sectionIndex, x4); for (const e58 of t46) { const t47 = new zy(); t47.text = e58[0], t47.sectionIndex = e58[1], t47.sections = y4.sections, g9.push(t47); } } else g9 = (function(t46, e58) { const r87 = [], n46 = t46.text; let i27 = 0; for (const n47 of e58) r87.push(t46.substring(i27, n47)), i27 = n47; return i27 < n46.length && r87.push(t46.substring(i27, n46.length)), r87; })(y4, x4); const w4 = [], _4 = { positionedLines: w4, text: y4.toString(), top: c28[1], bottom: c28[1], left: c28[0], right: c28[0], writingMode: h8, iconsInText: false, verticalizable: false, hasBaseline: false }; if ((function(t46, e58, r87, n46, i27, s19, o89, a47, l22, u13, c29, h9) { let p10 = 0, d35 = 0, f9 = 0; const m7 = "right" === a47 ? 1 : "left" === a47 ? 0 : 0.5; let y5 = false; for (const t47 of i27) { const r88 = t47.getSections(); for (const t48 of r88) { if (t48.image) continue; const r89 = e58[t48.fontStack]; if (r89 && (y5 = void 0 !== r89.ascender && void 0 !== r89.descender, !y5)) break; } if (!y5) break; } let g10 = 0; for (const o90 of i27) { o90.trim(); const i28 = o90.getMaxScale(), a48 = (i28 - 1) * ry, v10 = { positionedGlyphs: [], lineOffset: 0 }; t46.positionedLines[g10] = v10; const b10 = v10.positionedGlyphs; let w6 = 0; if (!o90.length()) { d35 += s19, ++g10; continue; } let _5 = 0, A4 = 0; for (let s20 = 0; s20 < o90.length(); s20++) { const a49 = o90.getSection(s20), f10 = o90.getSectionIndex(s20), m8 = o90.getCodePoint(s20); let g11 = a49.scale, v11 = null, M6 = null, I4 = null, S5 = ry, P4 = 0, k7 = l22; k7 === Py.vertical && (12312 === (x5 = m8) || 12313 === x5 || 12316 === x5 || 12540 === x5 || 12448 === x5) && (k7 = Py.horizontal); const z4 = !(k7 === Py.horizontal || !c29 && !io(m8) || c29 && (Ty[m8] || oo(m8))); if (a49.image) { const e59 = n46.get(a49.image.toString()); if (!e59) continue; I4 = a49.image, t46.iconsInText = t46.iconsInText || true, M6 = e59.paddedRect; const r88 = e59.displaySize; g11 = g11 * ry / h9, v11 = { width: r88[0], height: r88[1], left: 0, top: -Sy, advance: z4 ? r88[1] : r88[0], localGlyph: false }, P4 = y5 ? -v11.height * g11 : i28 * ry - 17 - r88[1] * g11, S5 = v11.advance; const s21 = (z4 ? r88[0] : r88[1]) * g11 - ry * i28; s21 > 0 && s21 > w6 && (w6 = s21); } else { const t47 = r87[a49.fontStack]; if (!t47) continue; t47[m8] && (M6 = t47[m8]); const n47 = e58[a49.fontStack]; if (!n47) continue; const s21 = n47.glyphs[m8]; if (!s21) continue; if (v11 = s21.metrics, S5 = 8203 !== m8 ? ry : 0, y5) { const t48 = void 0 !== n47.ascender ? Math.abs(n47.ascender) : 0, e59 = void 0 !== n47.descender ? Math.abs(n47.descender) : 0, r88 = (t48 + e59) * g11; _5 < r88 && (_5 = r88, A4 = (t48 - e59) / 2 * g11), P4 = -t48 * g11; } else P4 = (i28 - g11) * ry - 17; } z4 ? (t46.verticalizable = true, b10.push({ glyph: m8, image: I4, x: p10, y: d35 + P4, vertical: z4, scale: g11, localGlyph: v11.localGlyph, fontStack: a49.fontStack, sectionIndex: f10, metrics: v11, rect: M6 }), p10 += S5 * g11 + u13) : (b10.push({ glyph: m8, image: I4, x: p10, y: d35 + P4, vertical: z4, scale: g11, localGlyph: v11.localGlyph, fontStack: a49.fontStack, sectionIndex: f10, metrics: v11, rect: M6 }), p10 += v11.advance * g11 + u13); } 0 !== b10.length && (f9 = Math.max(p10 - u13, f9), y5 ? Oy(b10, m7, w6, A4, s19 * i28 / 2) : Oy(b10, m7, w6, 0, s19 / 2)), p10 = 0; const M5 = s19 * i28 + w6; v10.lineOffset = Math.max(w6, a48), d35 += M5, ++g10; } var x5; const v9 = d35, { horizontalAlign: b9, verticalAlign: w5 } = Ly(o89); (function(t47, e59, r88, n47, i28, s20) { const o90 = (e59 - r88) * i28, a48 = -s20 * n47; for (const e60 of t47) for (const t48 of e60.positionedGlyphs) t48.x += o90, t48.y += a48; })(t46.positionedLines, m7, b9, w5, f9, v9), t46.top += -w5 * v9, t46.bottom = t46.top + v9, t46.left += -b9 * f9, t46.right = t46.left + f9, t46.hasBaseline = y5; })(_4, e57, r86, n45, g9, o88, a46, l21, h8, u12, p9, f8), !(function(t46) { for (const e58 of t46) if (0 !== e58.positionedGlyphs.length) return false; return true; })(w4)) return _4; } const Ty = { 9: true, 10: true, 11: true, 12: true, 13: true, 32: true }, By = { 10: true, 32: true, 38: true, 40: true, 41: true, 43: true, 45: true, 47: true, 173: true, 183: true, 8203: true, 8208: true, 8211: true, 8231: true }; function Vy(t45, e57, r86, n45, i26, s18) { if (e57.image) { const t46 = n45.get(e57.image.toString()); return t46 ? t46.displaySize[0] * e57.scale * ry / s18 + i26 : 0; } { const n46 = r86[e57.fontStack], s19 = n46 && n46.glyphs[t45]; return s19 ? s19.metrics.advance * e57.scale + i26 : 0; } } function Fy(t45, e57, r86, n45) { const i26 = Math.pow(t45 - e57, 2); return n45 ? t45 < e57 ? i26 / 2 : 2 * i26 : i26 + Math.abs(r86) * r86; } function Cy(t45, e57, r86) { let n45 = 0; return 10 === t45 && (n45 -= 1e4), r86 && (n45 += 150), 40 !== t45 && 65288 !== t45 || (n45 += 50), 41 !== e57 && 65289 !== e57 || (n45 += 50), n45; } function Dy(t45, e57, r86, n45, i26, s18) { let o88 = null, a46 = Fy(e57, r86, i26, s18); for (const t46 of n45) { const n46 = Fy(e57 - t46.x, r86, i26, s18) + t46.badness; n46 <= a46 && (o88 = t46, a46 = n46); } return { index: t45, x: e57, priorBreak: o88, badness: a46 }; } function Ry(t45) { return t45 ? Ry(t45.priorBreak).concat(t45.index) : []; } function Ly(t45) { let e57 = 0.5, r86 = 0.5; switch (t45) { case "right": case "top-right": case "bottom-right": e57 = 1; break; case "left": case "top-left": case "bottom-left": e57 = 0; } switch (t45) { case "bottom": case "bottom-right": case "bottom-left": r86 = 1; break; case "top": case "top-right": case "top-left": r86 = 0; } return { horizontalAlign: e57, verticalAlign: r86 }; } function Oy(t45, e57, r86, n45, i26) { if (!(e57 || r86 || n45 || i26)) return; const s18 = t45.length - 1, o88 = t45[s18], a46 = (o88.x + o88.metrics.advance * o88.scale) * e57; for (let e58 = 0; e58 <= s18; e58++) t45[e58].x -= a46, t45[e58].y += r86 + n45 + i26; } function Uy(t45) { return void 0 !== t45.imagePrimary && void 0 !== t45.top && void 0 !== t45.bottom && void 0 !== t45.left && void 0 !== t45.right; } function Ny(t45, e57, r86, n45) { const { horizontalAlign: i26, verticalAlign: s18 } = Ly(n45), o88 = r86[0] - t45.displaySize[0] * i26, a46 = r86[1] - t45.displaySize[1] * s18; return { imagePrimary: t45, imageSecondary: e57, top: a46, bottom: a46 + t45.displaySize[1], left: o88, right: o88 + t45.displaySize[0] }; } function jy(t45, e57, r86, n45, i26, s18) { const o88 = t45.imagePrimary; let a46; if (o88.content) { const t46 = o88.content, e58 = o88.pixelRatio || 1; a46 = [t46[0] / e58, t46[1] / e58, o88.displaySize[0] - t46[2] / e58, o88.displaySize[1] - t46[3] / e58]; } const l21 = e57.left * s18, u12 = e57.right * s18; let c28, h8, p9, d34; "width" === r86 || "both" === r86 ? (d34 = i26[0] + l21 - n45[3], h8 = i26[0] + u12 + n45[1]) : (d34 = i26[0] + (l21 + u12 - o88.displaySize[0]) / 2, h8 = d34 + o88.displaySize[0]); const f8 = e57.top * s18, m6 = e57.bottom * s18; return "height" === r86 || "both" === r86 ? (c28 = i26[1] + f8 - n45[0], p9 = i26[1] + m6 + n45[2]) : (c28 = i26[1] + (f8 + m6 - o88.displaySize[1]) / 2, p9 = c28 + o88.displaySize[1]), { imagePrimary: o88, imageSecondary: void 0, top: c28, right: h8, bottom: p9, left: d34, collisionPadding: a46 }; } function $y(t45) { return !t45.imagePrimary.stretchX; } function Gy(t45) { return !t45.imagePrimary.stretchY; } function Hy(t45) { return { width: t45.right - t45.left, height: t45.bottom - t45.top }; } const qy = 128; function Xy(t45, e57, r86) { const { expression: n45 } = e57; if ("constant" === n45.kind) return { kind: "constant", layoutSize: n45.evaluate(new wo(t45 + 1, { worldview: r86 })) }; if ("source" === n45.kind) return { kind: "source" }; { const { zoomStops: e58, interpolationType: i26 } = n45; let s18 = 0; for (; s18 < e58.length && e58[s18] <= t45; ) s18++; s18 = Math.max(0, s18 - 1); let o88 = s18; for (; o88 < e58.length && e58[o88] < t45 + 1; ) o88++; o88 = Math.min(e58.length - 1, o88); const a46 = e58[s18], l21 = e58[o88]; return "composite" === n45.kind ? { kind: "composite", minZoom: a46, maxZoom: l21, interpolationType: i26 } : { kind: "camera", minZoom: a46, maxZoom: l21, minSize: n45.evaluate(new wo(a46, { worldview: r86 })), maxSize: n45.evaluate(new wo(l21, { worldview: r86 })), interpolationType: i26 }; } } function Zy(t45, { uSize: e57, uSizeT: r86 }, { lowerSize: n45, upperSize: i26 }) { return "source" === t45.kind ? n45 / qy : "composite" === t45.kind ? ur(n45 / qy, i26 / qy, r86) : e57; } function Wy(t45, e57, r86 = 1) { let n45 = 0, i26 = 0; if ("constant" === t45.kind) i26 = t45.layoutSize * r86; else if ("source" !== t45.kind) { const { interpolationType: s18, minZoom: o88, maxZoom: a46 } = t45, l21 = s18 ? Tt2(Hi.interpolationFactor(s18, e57, o88, a46), 0, 1) : 0; "camera" === t45.kind ? i26 = ur(t45.minSize, t45.maxSize, l21) * r86 : n45 = l21 * r86; } return { uSizeT: n45, uSize: i26 }; } class Yy extends wt { constructor(t45, e57, r86, n45, i26) { super(t45, e57), this.angle = n45, this.z = r86, void 0 !== i26 && (this.segment = i26); } clone() { return new Yy(this.x, this.y, this.z, this.angle, this.segment); } } function Ky(t45, e57, r86, n45, i26) { if (void 0 === e57.segment) return true; let s18 = e57, o88 = e57.segment + 1, a46 = 0; for (; a46 > -r86 / 2; ) { if (o88--, o88 < 0) return false; a46 -= t45[o88].dist(s18), s18 = t45[o88]; } a46 += t45[o88].dist(t45[o88 + 1]), o88++; const l21 = []; let u12 = 0; for (; a46 < r86 / 2; ) { const e58 = t45[o88], r87 = t45[o88 + 1]; if (!r87) return false; let s19 = t45[o88 - 1].angleTo(e58) - e58.angleTo(r87); for (s19 = Math.abs((s19 + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l21.push({ distance: a46, angleDelta: s19 }), u12 += s19; a46 - l21[0].distance > n45; ) u12 -= l21.shift().angleDelta; if (u12 > i26) return false; o88++, a46 += e58.dist(r87); } return true; } function Jy(t45) { let e57 = 0; for (let r86 = 0; r86 < t45.length - 1; r86++) e57 += t45[r86].dist(t45[r86 + 1]); return e57; } function Qy(t45, e57, r86) { return t45 ? 0.6 * e57 * r86 : 0; } function tg(t45, e57) { return Math.max(t45 ? t45.right - t45.left : 0, e57 ? e57.right - e57.left : 0); } function eg(t45, e57, r86, n45, i26, s18) { const o88 = Qy(r86, i26, s18), a46 = tg(r86, n45) * s18; let l21 = 0; const u12 = Jy(t45) / 2; for (let r87 = 0; r87 < t45.length - 1; r87++) { const n46 = t45[r87], i27 = t45[r87 + 1], s19 = n46.dist(i27); if (l21 + s19 > u12) { const c28 = (u12 - l21) / s19, h8 = ur(n46.x, i27.x, c28), p9 = ur(n46.y, i27.y, c28), d34 = new Yy(h8, p9, 0, i27.angleTo(n46), r87); return !o88 || Ky(t45, d34, a46, o88, e57) ? d34 : void 0; } l21 += s19; } } function rg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = Qy(n45, s18, o88), c28 = tg(n45, i26), h8 = c28 * o88, p9 = 0 === t45[0].x || t45[0].x === l21 || 0 === t45[0].y || t45[0].y === l21; return e57 - h8 < e57 / 4 && (e57 = h8 + e57 / 4), ng(t45, p9 ? e57 / 2 * a46 % e57 : (c28 / 2 + 2 * s18) * o88 * a46 % e57, e57, u12, r86, h8, p9, false, l21); } function ng(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = s18 / 2, c28 = Jy(t45); let h8 = 0, p9 = e57 - r86, d34 = []; for (let e58 = 0; e58 < t45.length - 1; e58++) { const o89 = t45[e58], a47 = t45[e58 + 1], f8 = o89.dist(a47), m6 = a47.angleTo(o89); for (; p9 + r86 < h8 + f8; ) { p9 += r86; const y4 = (p9 - h8) / f8, g9 = ur(o89.x, a47.x, y4), x4 = ur(o89.y, a47.y, y4); if (g9 >= 0 && g9 < l21 && x4 >= 0 && x4 < l21 && p9 - u12 >= 0 && p9 + u12 <= c28) { const r87 = new Yy(g9, x4, 0, m6, e58); n45 && !Ky(t45, r87, s18, n45, i26) || d34.push(r87); } } h8 += f8; } return a46 || d34.length || o88 || (d34 = ng(t45, h8 / 2, r86, n45, i26, s18, o88, true, l21)), d34; } function ig(t45) { let e57 = 0, r86 = 0; for (const n46 of t45) e57 += n46.w * n46.h, r86 = Math.max(r86, n46.w); t45.sort(((t46, e58) => e58.h - t46.h)); const n45 = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e57 / 0.95)), r86), h: 1 / 0 }]; let i26 = 0, s18 = 0; for (const e58 of t45) for (let t46 = n45.length - 1; t46 >= 0; t46--) { const r87 = n45[t46]; if (!(e58.w > r87.w || e58.h > r87.h)) { if (e58.x = r87.x, e58.y = r87.y, s18 = Math.max(s18, e58.y + e58.h), i26 = Math.max(i26, e58.x + e58.w), e58.w === r87.w && e58.h === r87.h) { const e59 = n45.pop(); e59 && t46 < n45.length && (n45[t46] = e59); } else e58.h === r87.h ? (r87.x += e58.w, r87.w -= e58.w) : e58.w === r87.w ? (r87.y += e58.h, r87.h -= e58.h) : (n45.push({ x: r87.x + e58.w, y: r87.y, w: r87.w - e58.w, h: e58.h }), r87.y += e58.h, r87.h -= e58.h); break; } } return { w: i26, h: s18, fill: e57 / (i26 * s18) || 0 }; } Ws(Yy, "Anchor"); const sg = 1; class og { static getImagePositionScale(t45, e57, r86) { if (e57 && t45 && t45.options && t45.options.transform) { const e58 = t45.options.transform; return { x: e58.a, y: e58.d }; } return { x: r86, y: r86 }; } constructor(t45, e57, r86, n45) { this.paddedRect = t45; const { pixelRatio: i26, version: s18, stretchX: o88, stretchY: a46, content: l21, sdf: u12, usvg: c28 } = e57; this.pixelRatio = i26, this.stretchX = o88, this.stretchY = a46, this.content = l21, this.version = s18, this.padding = r86, this.sdf = u12, this.usvg = c28, this.scale = og.getImagePositionScale(n45, c28, i26); } get tl() { return [this.paddedRect.x + this.padding, this.paddedRect.y + this.padding]; } get br() { return [this.paddedRect.x + this.paddedRect.w - this.padding, this.paddedRect.y + this.paddedRect.h - this.padding]; } get displaySize() { return [(this.paddedRect.w - 2 * this.padding) / this.scale.x, (this.paddedRect.h - 2 * this.padding) / this.scale.y]; } } function ag(t45, e57, r86) { const n45 = Fr.parse(t45), i26 = (function(t46, e58, r87 = [1, 1]) { return { x: 0, y: 0, w: (t46.data ? t46.data.width : t46.width * r87[0]) + 2 * e58, h: (t46.data ? t46.data.height : t46.height * r87[1]) + 2 * e58 }; })(e57, r86, [n45.options.transform.a, n45.options.transform.d]); return { bin: i26, imagePosition: new og(i26, e57, r86, n45), imageVariant: n45 }; } class lg { constructor(t45, e57, r86) { const n45 = /* @__PURE__ */ new Map(), i26 = /* @__PURE__ */ new Map(); this.haveRenderCallbacks = []; const s18 = []; this.addImages(t45, n45, sg, s18), this.addImages(e57, i26, 2, s18); const { w: o88, h: a46 } = ig(s18), l21 = new xh({ width: o88 || 1, height: a46 || 1 }); for (const [e58, r87] of t45.entries()) { const t46 = n45.get(e58).paddedRect; xh.copy(r87.data, l21, { x: 0, y: 0 }, { x: t46.x + sg, y: t46.y + sg }, r87.data, null, r87.sdf); } for (const [t46, n46] of e57.entries()) { const e58 = i26.get(t46), s19 = e58.paddedRect; let o89 = e58.padding; const a47 = s19.x + o89, u12 = s19.y + o89, c28 = n46.data.width, h8 = n46.data.height; o89 = o89 > 1 ? o89 - 1 : o89, xh.copy(n46.data, l21, { x: 0, y: 0 }, { x: a47, y: u12 }, n46.data, r86), xh.copy(n46.data, l21, { x: 0, y: h8 - o89 }, { x: a47, y: u12 - o89 }, { width: c28, height: o89 }, r86), xh.copy(n46.data, l21, { x: 0, y: 0 }, { x: a47, y: u12 + h8 }, { width: c28, height: o89 }, r86), xh.copy(n46.data, l21, { x: c28 - o89, y: 0 }, { x: a47 - o89, y: u12 }, { width: o89, height: h8 }, r86), xh.copy(n46.data, l21, { x: 0, y: 0 }, { x: a47 + c28, y: u12 }, { width: o89, height: h8 }, r86), xh.copy(n46.data, l21, { x: c28 - o89, y: h8 - o89 }, { x: a47 - o89, y: u12 - o89 }, { width: o89, height: o89 }, r86), xh.copy(n46.data, l21, { x: 0, y: h8 - o89 }, { x: a47 + c28, y: u12 - o89 }, { width: o89, height: o89 }, r86), xh.copy(n46.data, l21, { x: 0, y: 0 }, { x: a47 + c28, y: u12 + h8 }, { width: o89, height: o89 }, r86), xh.copy(n46.data, l21, { x: c28 - o89, y: 0 }, { x: a47 - o89, y: u12 + h8 }, { width: o89, height: o89 }, r86); } this.lut = r86, this.image = l21, this.iconPositions = n45, this.patternPositions = i26; } addImages(t45, e57, r86, n45) { for (const [i26, s18] of t45.entries()) { const { bin: t46, imagePosition: o88, imageVariant: a46 } = ag(i26, s18, r86); e57.set(i26, o88), n45.push(t46), s18.hasRenderCallback && this.haveRenderCallbacks.push(a46.id); } } patchUpdatedImages(t45, e57, r86) { this.haveRenderCallbacks = this.haveRenderCallbacks.filter(((e58) => t45.hasImage(e58, r86))), t45.dispatchRenderCallbacks(this.haveRenderCallbacks, r86); for (const n45 of t45.getUpdatedImages(r86)) { for (const i26 of this.iconPositions.keys()) { const s18 = Fr.parse(i26); if (er.isEqual(s18.id, n45)) { const s19 = t45.getImage(n45, r86); this.patchUpdatedImage(this.iconPositions.get(i26), s19, e57, null); } } for (const i26 of this.patternPositions.keys()) { const s18 = Fr.parse(i26); if (er.isEqual(s18.id, n45)) { const s19 = t45.getImage(n45, r86); this.patchUpdatedImage(this.patternPositions.get(i26), s19, e57, this.lut); } } } } patchUpdatedImage(t45, e57, r86, n45 = null) { if (!t45 || !e57) return; if (t45.version === e57.version) return; t45.version = e57.version; const [i26, s18] = t45.tl, o88 = t45.sdf; if (this.lut || o88) { const t46 = { width: e57.data.width, height: e57.data.height }, a46 = new xh(t46); xh.copy(e57.data, a46, { x: 0, y: 0 }, { x: 0, y: 0 }, t46, n45, o88), r86.update(a46, { position: { x: i26, y: s18 } }); } else r86.update(e57.data, { position: { x: i26, y: s18 } }); } } Ws(og, "ImagePosition"), Ws(lg, "ImageAtlas"); const ug = 1e20; function cg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { for (let u12 = e57; u12 < e57 + n45; u12++) hg(t45, r86 * s18 + u12, s18, i26, o88, a46, l21); for (let u12 = r86; u12 < r86 + i26; u12++) hg(t45, u12 * s18 + e57, 1, n45, o88, a46, l21); } function hg(t45, e57, r86, n45, i26, s18, o88) { s18[0] = 0, o88[0] = -ug, o88[1] = ug, i26[0] = t45[e57]; for (let a46 = 1, l21 = 0, u12 = 0; a46 < n45; a46++) { i26[a46] = t45[e57 + a46 * r86]; const n46 = a46 * a46; do { const t46 = s18[l21]; u12 = (i26[a46] - i26[t46] + n46 - t46 * t46) / (a46 - t46) / 2; } while (u12 <= o88[l21] && --l21 > -1); l21++, s18[l21] = a46, o88[l21] = u12, o88[l21 + 1] = ug; } for (let a46 = 0, l21 = 0; a46 < n45; a46++) { for (; o88[l21 + 1] < a46; ) l21++; const n46 = s18[l21], u12 = a46 - n46; t45[e57 + a46 * r86] = i26[n46] + u12 * u12; } } const pg = 2, dg = { none: 0, ideographs: 1, all: 2 }; class fg { constructor(t45, e57, r86) { this.requestManager = t45, this.localGlyphMode = e57, this.localFontFamily = r86, this.url = "", this.entries = {}, this.localGlyphs = { 200: {}, 400: {}, 500: {}, 900: {} }; } setURL(t45) { this.url = t45; } getGlyphs(t45, e57) { const r86 = [], n45 = this.url || ne2.GLYPHS_URL; for (const e58 in t45) for (const n46 of t45[e58]) r86.push({ stack: e58, id: n46 }); Ft(r86, (({ stack: t46, id: e58 }, r87) => { let i26 = this.entries[t46]; i26 || (i26 = this.entries[t46] = { glyphs: {}, requests: {}, ranges: {}, ascender: void 0, descender: void 0 }); let s18 = i26.glyphs[e58]; if (void 0 !== s18) return void r87(null, { stack: t46, id: e58, glyph: s18 }); if (s18 = this._tinySDF(i26, t46, e58), s18) return i26.glyphs[e58] = s18, void r87(null, { stack: t46, id: e58, glyph: s18 }); const o88 = Math.floor(e58 / 256); if (256 * o88 > 65535) return Gt("glyphs > 65535 not supported"), void r87(null, { stack: t46, id: e58, glyph: s18 }); if (i26.ranges[o88]) return void r87(null, { stack: t46, id: e58, glyph: s18 }); let a46 = i26.requests[o88]; a46 || (a46 = i26.requests[o88] = [], fg.loadGlyphRange(t46, o88, n45, this.requestManager, ((t47, e59) => { if (e59) { i26.ascender = e59.ascender, i26.descender = e59.descender; for (const t48 in e59.glyphs) this._doesCharSupportLocalGlyph(+t48) || (i26.glyphs[+t48] = e59.glyphs[+t48]); i26.ranges[o88] = true; } for (const r88 of a46) r88(t47, e59); delete i26.requests[o88]; }))), a46.push(((n46, i27) => { n46 ? r87(n46) : i27 && r87(null, { stack: t46, id: e58, glyph: i27.glyphs[e58] || null }); })); }), ((t46, r87) => { if (t46) e57(t46); else if (r87) { const t47 = {}; for (const { stack: e58, id: n46, glyph: i26 } of r87) void 0 === t47[e58] && (t47[e58] = {}), void 0 === t47[e58].glyphs && (t47[e58].glyphs = {}), t47[e58].glyphs[n46] = i26 && { id: i26.id, bitmap: i26.bitmap.clone(), metrics: i26.metrics }, t47[e58].ascender = this.entries[e58].ascender, t47[e58].descender = this.entries[e58].descender; e57(null, t47); } })); } _doesCharSupportLocalGlyph(t45) { return this.localGlyphMode !== dg.none && (this.localGlyphMode === dg.all ? !!this.localFontFamily : !!this.localFontFamily && (to3["CJK Unified Ideographs"](t45) || to3["Hangul Syllables"](t45) || to3.Hiragana(t45) || to3.Katakana(t45) || to3["CJK Symbols and Punctuation"](t45) || to3["CJK Unified Ideographs Extension A"](t45) || to3["CJK Unified Ideographs Extension B"](t45) || to3.Osage(t45))); } _tinySDF(t45, e57, r86) { const n45 = this.localFontFamily; if (!n45 || !this._doesCharSupportLocalGlyph(r86)) return; let i26 = t45.tinySDF; if (!i26) { let r87 = "400"; /bold/i.test(e57) ? r87 = "900" : /medium/i.test(e57) ? r87 = "500" : /light/i.test(e57) && (r87 = "200"), i26 = t45.tinySDF = new fg.TinySDF({ fontFamily: n45, fontWeight: r87, fontSize: 24 * pg, buffer: 3 * pg, radius: 8 * pg }), i26.fontWeight = r87; } if (this.localGlyphs[i26.fontWeight][r86]) return this.localGlyphs[i26.fontWeight][r86]; const s18 = String.fromCodePoint(r86), { data: o88, width: a46, height: l21, glyphWidth: u12, glyphHeight: c28, glyphLeft: h8, glyphTop: p9, glyphAdvance: d34 } = i26.draw(s18); return this.localGlyphs[i26.fontWeight][r86] = { id: r86, bitmap: new gh({ width: a46, height: l21 }, o88), metrics: { width: u12 / pg, height: c28 / pg, left: h8 / pg, top: p9 / pg - 27, advance: d34 / pg, localGlyph: true } }; } } fg.loadGlyphRange = function(t45, e57, r86, n45, i26) { const s18 = 256 * e57, o88 = s18 + 255, a46 = n45.transformRequest(n45.normalizeGlyphsURL(r86).replace("{fontstack}", t45).replace("{range}", `${s18}-${o88}`), Be.Glyphs); De(a46, ((t46, e58) => { if (t46) i26(t46); else if (e58) { const t47 = {}, r87 = (function(t48) { return new cy(t48).readFields(Ay, {}); })(e58); for (const e59 of r87.glyphs) t47[e59.id] = e59; i26(null, { glyphs: t47, ascender: r87.ascender, descender: r87.descender }); } })); }, fg.TinySDF = class { constructor({ fontSize: t45 = 24, buffer: e57 = 3, radius: r86 = 8, cutoff: n45 = 0.25, fontFamily: i26 = "sans-serif", fontWeight: s18 = "normal", fontStyle: o88 = "normal", lang: a46 = null } = {}) { this.buffer = e57, this.cutoff = n45, this.radius = r86, this.lang = a46; const l21 = this.size = t45 + 4 * e57, u12 = this._createCanvas(l21), c28 = this.ctx = u12.getContext("2d", { willReadFrequently: true }); c28.font = `${o88} ${s18} ${t45}px ${i26}`, c28.textBaseline = "alphabetic", c28.textAlign = "left", c28.fillStyle = "black", this.gridOuter = new Float64Array(l21 * l21), this.gridInner = new Float64Array(l21 * l21), this.f = new Float64Array(l21), this.z = new Float64Array(l21 + 1), this.v = new Uint16Array(l21); } _createCanvas(t45) { const e57 = document.createElement("canvas"); return e57.width = e57.height = t45, e57; } draw(t45) { const { width: e57, actualBoundingBoxAscent: r86, actualBoundingBoxDescent: n45, actualBoundingBoxLeft: i26, actualBoundingBoxRight: s18 } = this.ctx.measureText(t45), o88 = Math.ceil(r86), a46 = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(s18 - i26))), l21 = Math.min(this.size - this.buffer, o88 + Math.ceil(n45)), u12 = a46 + 2 * this.buffer, c28 = l21 + 2 * this.buffer, h8 = Math.max(u12 * c28, 0), p9 = new Uint8ClampedArray(h8), d34 = { data: p9, width: u12, height: c28, glyphWidth: a46, glyphHeight: l21, glyphTop: o88, glyphLeft: 0, glyphAdvance: e57 }; if (0 === a46 || 0 === l21) return d34; const { ctx: f8, buffer: m6, gridInner: y4, gridOuter: g9 } = this; this.lang && (f8.lang = this.lang), f8.clearRect(m6, m6, a46, l21), f8.fillText(t45, m6, m6 + o88); const x4 = f8.getImageData(m6, m6, a46, l21); g9.fill(ug, 0, h8), y4.fill(0, 0, h8); for (let t46 = 0; t46 < l21; t46++) for (let e58 = 0; e58 < a46; e58++) { const r87 = x4.data[4 * (t46 * a46 + e58) + 3] / 255; if (0 === r87) continue; const n46 = (t46 + m6) * u12 + e58 + m6; if (1 === r87) g9[n46] = 0, y4[n46] = ug; else { const t47 = 0.5 - r87; g9[n46] = t47 > 0 ? t47 * t47 : 0, y4[n46] = t47 < 0 ? t47 * t47 : 0; } } cg(g9, 0, 0, u12, c28, u12, this.f, this.v, this.z), cg(y4, m6, m6, a46, l21, u12, this.f, this.v, this.z); for (let t46 = 0; t46 < h8; t46++) { const e58 = Math.sqrt(g9[t46]) - Math.sqrt(y4[t46]); p9[t46] = Math.round(255 - 255 * (e58 / this.radius + this.cutoff)); } return d34; } }; const mg = sg; function yg(t45, e57) { return t45 + e57[1] - e57[0]; } function gg(t45, e57, r86, n45, i26 = 1) { const s18 = [], o88 = t45.imagePrimary, a46 = o88.pixelRatio, l21 = o88.paddedRect.w - 2 * mg, u12 = o88.paddedRect.h - 2 * mg, c28 = (t45.right - t45.left) * i26, h8 = (t45.bottom - t45.top) * i26, p9 = o88.stretchX || [[0, l21]], d34 = o88.stretchY || [[0, u12]], f8 = p9.reduce(yg, 0), m6 = d34.reduce(yg, 0), y4 = l21 - f8, g9 = u12 - m6; let x4 = 0, v8 = f8, b8 = 0, w4 = m6, _4 = 0, A4 = y4, M5 = 0, I4 = g9; if (o88.content && n45) { const t46 = o88.content; x4 = xg(p9, 0, t46[0]), b8 = xg(d34, 0, t46[1]), v8 = xg(p9, t46[0], t46[2]), w4 = xg(d34, t46[1], t46[3]), _4 = t46[0] - x4, M5 = t46[1] - b8, A4 = t46[2] - t46[0] - v8, I4 = t46[3] - t46[1] - w4; } const S5 = (n46, s19, l22, u13) => { const p10 = bg(n46.stretch - x4, v8, c28, t45.left * i26), d35 = wg(n46.fixed - _4, A4, n46.stretch, f8), y5 = bg(s19.stretch - b8, w4, h8, t45.top * i26), g10 = wg(s19.fixed - M5, I4, s19.stretch, m6), S6 = bg(l22.stretch - x4, v8, c28, t45.left * i26), P4 = wg(l22.fixed - _4, A4, l22.stretch, f8), k7 = bg(u13.stretch - b8, w4, h8, t45.top * i26), z4 = wg(u13.fixed - M5, I4, u13.stretch, m6), E5 = new wt(p10, y5), T5 = new wt(S6, y5), B6 = new wt(S6, k7), V4 = new wt(p10, k7), F17 = new wt(d35 / a46, g10 / a46), C6 = new wt(P4 / a46, z4 / a46), D5 = e57 * Math.PI / 180; if (D5) { const t46 = Math.sin(D5), e58 = Math.cos(D5), r87 = [e58, -t46, t46, e58]; E5._matMult(r87), T5._matMult(r87), V4._matMult(r87), B6._matMult(r87); } const R5 = n46.stretch + n46.fixed, L3 = l22.stretch + l22.fixed, O4 = s19.stretch + s19.fixed, U4 = u13.stretch + u13.fixed, N5 = t45.imageSecondary; return { tl: E5, tr: T5, bl: V4, br: B6, texPrimary: { x: o88.paddedRect.x + mg + R5, y: o88.paddedRect.y + mg + O4, w: L3 - R5, h: U4 - O4 }, texSecondary: N5 ? { x: N5.paddedRect.x + mg + R5, y: N5.paddedRect.y + mg + O4, w: L3 - R5, h: U4 - O4 } : void 0, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: F17, pixelOffsetBR: C6, minFontScaleX: A4 / a46 / c28, minFontScaleY: I4 / a46 / h8, isSDF: r86 }; }; if (n45 && (o88.stretchX || o88.stretchY)) { const t46 = vg(p9, y4, f8), e58 = vg(d34, g9, m6); for (let r87 = 0; r87 < t46.length - 1; r87++) { const n46 = t46[r87], i27 = t46[r87 + 1]; for (let t47 = 0; t47 < e58.length - 1; t47++) s18.push(S5(n46, e58[t47], i27, e58[t47 + 1])); } } else s18.push(S5({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: l21 + 1 }, { fixed: 0, stretch: u12 + 1 })); return s18; } function xg(t45, e57, r86) { let n45 = 0; for (const i26 of t45) n45 += Math.max(e57, Math.min(r86, i26[1])) - Math.max(e57, Math.min(r86, i26[0])); return n45; } function vg(t45, e57, r86) { const n45 = [{ fixed: -mg, stretch: 0 }]; for (const [e58, r87] of t45) { const t46 = n45[n45.length - 1]; n45.push({ fixed: e58 - t46.stretch, stretch: t46.stretch }), n45.push({ fixed: e58 - t46.stretch, stretch: t46.stretch + (r87 - e58) }); } return n45.push({ fixed: e57 + mg, stretch: r86 }), n45; } function bg(t45, e57, r86, n45) { return t45 / e57 * r86 + n45; } function wg(t45, e57, r86, n45) { return t45 - e57 * r86 / n45; } function _g(t45, e57, r86, n45) { const i26 = e57 + t45.positionedLines[n45].lineOffset; return 0 === n45 ? r86 + i26 / 2 : r86 + (i26 + (e57 + t45.positionedLines[n45 - 1].lineOffset)) / 2; } function Ag(t45, e57 = 1, r86 = false) { let n45 = 1 / 0, i26 = 1 / 0, s18 = -1 / 0, o88 = -1 / 0; const a46 = t45[0]; for (let t46 = 0; t46 < a46.length; t46++) { const e58 = a46[t46]; (!t46 || e58.x < n45) && (n45 = e58.x), (!t46 || e58.y < i26) && (i26 = e58.y), (!t46 || e58.x > s18) && (s18 = e58.x), (!t46 || e58.y > o88) && (o88 = e58.y); } const l21 = Math.min(s18 - n45, o88 - i26); let u12 = l21 / 2; const c28 = new Dn([], Mg); if (0 === l21) return new wt(n45, i26); for (let e58 = n45; e58 < s18; e58 += l21) for (let r87 = i26; r87 < o88; r87 += l21) c28.push(new Ig(e58 + u12, r87 + u12, u12, t45)); let h8 = (function(t46) { let e58 = 0, r87 = 0, n46 = 0; const i27 = t46[0]; for (let t47 = 0, s19 = i27.length, o89 = s19 - 1; t47 < s19; o89 = t47++) { const s20 = i27[t47], a47 = i27[o89], l22 = s20.x * a47.y - a47.x * s20.y; r87 += (s20.x + a47.x) * l22, n46 += (s20.y + a47.y) * l22, e58 += 3 * l22; } return new Ig(r87 / e58, n46 / e58, 0, t46); })(t45), p9 = c28.length; for (; c28.length; ) { const n46 = c28.pop(); (n46.d > h8.d || !h8.d) && (h8 = n46, r86 && console.log("found best %d after %d probes", Math.round(1e4 * n46.d) / 1e4, p9)), n46.max - h8.d <= e57 || (u12 = n46.h / 2, c28.push(new Ig(n46.p.x - u12, n46.p.y - u12, u12, t45)), c28.push(new Ig(n46.p.x + u12, n46.p.y - u12, u12, t45)), c28.push(new Ig(n46.p.x - u12, n46.p.y + u12, u12, t45)), c28.push(new Ig(n46.p.x + u12, n46.p.y + u12, u12, t45)), p9 += 4); } return r86 && (console.log(`num probes: ${p9}`), console.log(`best distance: ${h8.d}`)), h8.p; } function Mg(t45, e57) { return e57.max - t45.max; } class Ig { constructor(t45, e57, r86, n45) { this.p = new wt(t45, e57), this.h = r86, this.d = (function(t46, e58) { let r87 = false, n46 = 1 / 0; for (let i26 = 0; i26 < e58.length; i26++) { const s18 = e58[i26]; for (let e59 = 0, i27 = s18.length, o88 = i27 - 1; e59 < i27; o88 = e59++) { const i28 = s18[e59], a46 = s18[o88]; i28.y > t46.y != a46.y > t46.y && t46.x < (a46.x - i28.x) * (t46.y - i28.y) / (a46.y - i28.y) + i28.x && (r87 = !r87), n46 = Math.min(n46, lc(t46, i28, a46)); } } return (r87 ? 1 : -1) * Math.sqrt(n46); })(this.p, n45), this.max = this.d + this.h * Math.SQRT2; } } const Sg = Object.keys, Pg = Number.POSITIVE_INFINITY, kg = Math.sqrt(2); function zg(t45, [e57, r86]) { let n45 = 0, i26 = 0; if (r86 === Pg) { e57 < 0 && (e57 = 0); const r87 = e57 / kg; switch (t45) { case "top-right": case "top-left": i26 = r87 - 7; break; case "bottom-right": case "bottom-left": i26 = 7 - r87; break; case "bottom": i26 = 7 - e57; break; case "top": i26 = e57 - 7; } switch (t45) { case "top-right": case "bottom-right": n45 = -r87; break; case "top-left": case "bottom-left": n45 = r87; break; case "left": n45 = e57; break; case "right": n45 = -e57; } } else { switch (e57 = Math.abs(e57), r86 = Math.abs(r86), t45) { case "top-right": case "top-left": case "top": i26 = r86 - 7; break; case "bottom-right": case "bottom-left": case "bottom": i26 = 7 - r86; } switch (t45) { case "top-right": case "bottom-right": case "right": n45 = -e57; break; case "top-left": case "bottom-left": case "left": n45 = e57; } } return [n45, i26]; } function Eg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { if (!e57 || !e57.usvg) return; const u12 = Hy(n45), c28 = Hy(i26), h8 = "both" !== s18 && "width" !== s18 || !$y(n45) ? 1 : c28.width / u12.width, p9 = "both" !== s18 && "height" !== s18 || !Gy(n45) ? 1 : c28.height / u12.height; r86.scaleSelf(h8, p9); const d34 = r86.toString(); o88.set(d34, r86), a46.set(d34, e57); const { imagePosition: f8 } = ag(d34, e57, sg); l21.set(d34, f8); } function Tg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { if (!t45) return; const u12 = (function(t46, e58, r87, n46, i27, s19) { if ("camera" === t46.kind) return t46.maxSize; if ("composite" === t46.kind) { const n47 = e58.possiblyEvaluate(new wo(t46.maxZoom, { worldview: s19 }), r87).evaluate(i27, {}, r87), o89 = e58.possiblyEvaluate(new wo(t46.minZoom, { worldview: s19 }), r87).evaluate(i27, {}, r87); return Math.max(n47, o89); } return e58.possiblyEvaluate(new wo(n46, { worldview: s19 })).evaluate(i27, {}, r87); })(e57, r86, n45, i26, s18, l21); return t45.scaleSelf(u12 * a46 * o88); } function Bg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { return { iconPrimary: Tg(t45.getPrimary(), e57, r86, n45, i26, s18, o88, a46, l21), iconSecondary: Tg(t45.getSecondary(), e57, r86, n45, i26, s18, o88, a46, l21) }; } function Vg(t45, e57, r86) { if (!e57) return; const n45 = r86.get(t45.toString()), i26 = r86.get(e57.toString()); n45 && i26 && (n45.paddedRect.w === i26.paddedRect.w && n45.paddedRect.h === i26.paddedRect.h || Gt(`Mismatch in icon variant sizes: ${t45.toString()} and ${e57.toString()}`), n45.usvg !== i26.usvg && Gt(`Mismatch in icon variant image types: ${t45.id} and ${e57.id}`)); } function Fg(t45, e57, r86, n45) { if (!t45) return; const i26 = e57.get(r86.toString()); if (t45.imagePrimary = i26, n45) { const r87 = e57.get(n45.toString()); t45.imageSecondary = r87; } } function Cg(t45, e57) { for (const r86 in t45.horizontal) Dg(t45.horizontal[r86], e57); Dg(t45.vertical, e57); } function Dg(t45, e57) { if (t45) { for (const r86 of t45.positionedLines) for (const t46 of r86.positionedGlyphs) if (null !== t46.image) { const r87 = t46.image.toString(); t46.rect = e57.get(r87).paddedRect; } } } function Rg(t45) { switch (t45) { case "right": case "top-right": case "bottom-right": return "right"; case "left": case "top-left": case "bottom-left": return "left"; } return "center"; } function Lg(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = $g(s18.horizontal) || s18.vertical, c28 = r86.get("icon-text-fit-padding").evaluate(n45, {}, i26); let h8, p9 = e57; return e57 && "none" !== l21 && (t45.allowVerticalPlacement && s18.vertical && (h8 = jy(e57, s18.vertical, l21, c28, a46, o88)), u12 && (p9 = jy(e57, u12, l21, c28, a46, o88))), { defaultShapedIcon: p9, verticallyShapedIcon: h8 }; } function Og(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9, x4, v8) { let b8 = o88.textMaxSize.evaluate(e57, {}, p9); void 0 === b8 ? b8 = a46 * o88.textScaleFactor : b8 *= o88.textScaleFactor; const w4 = t45.layers[0].layout, _4 = $g(r86.horizontal) || r86.vertical, A4 = "globe" === d34.name, M5 = ry, I4 = t45.tilePixelRatio * b8 / M5, S5 = (B6 = t45.overscaling, t45.zoom > 18 && B6 > 2 && (B6 >>= 1), Math.max(Rn / (512 * B6), 1) * w4.get("symbol-spacing")), P4 = w4.get("text-padding") * t45.tilePixelRatio, k7 = w4.get("icon-padding") * t45.tilePixelRatio, z4 = It(w4.get("text-max-angle")), E5 = "map" === w4.get("icon-rotation-alignment") && "point" !== v8, T5 = S5 / 2; var B6; false === t45.hasAnyIconTextFit && "none" !== y4 && (t45.hasAnyIconTextFit = true); const V4 = e57.properties ? +e57.properties[Bu] : null, F17 = V4 && t45.elevationFeatureIdToIndex ? t45.elevationFeatureIdToIndex.get(V4) : 65535, C6 = (a47, l22, v9) => { if (l22.x < 0 || l22.x >= Rn || l22.y < 0 || l22.y >= Rn) return; let b9 = null; if (A4) { const { x: t46, y: e58, z: r87 } = d34.projectTilePoint(l22.x, l22.y, v9); b9 = { anchor: new Yy(t46, e58, r87, 0, void 0), up: d34.upVector(v9, l22.x, l22.y) }; } !(function(t46, e58, r87, n46, i27, s19, o89, a48, l23, u13, c29, h9, p10, d35, f9, m7, y5, g10, x5, v10, b10, w5, _5, A5, M6, I5, S6, P5, k8) { const z5 = t46.addToLineVertexArray(e58, n46); let E6, T6, B7, V5, F18, C7, D5, R5 = 0, L3 = 0, O4 = 0, U4 = 0, N5 = -1, j4 = -1; const $5 = {}; let G5 = We(""); const H4 = r87 ? r87.anchor : e58, q3 = "none" !== P5; let X3 = 0, Z3 = 0; if (void 0 === l23._unevaluatedLayout.getValue("text-radial-offset")) { const t47 = l23.layout.get("text-offset").evaluate(b10, {}, M6); X3 = t47[0] * ry, Z3 = t47[1] * ry; } else X3 = l23.layout.get("text-radial-offset").evaluate(b10, {}, M6) * ry, Z3 = Pg; if (t46.allowVerticalPlacement && i27.vertical) { const t47 = i27.vertical; if (f9) C7 = Hg(t47), a48 && (D5 = Hg(a48)); else { const r88 = l23.layout.get("text-rotate").evaluate(b10, {}, M6) + 90; B7 = Gg(u13, H4, e58, c29, h9, p10, t47, d35, r88, m7), a48 && (V5 = Gg(u13, H4, e58, c29, h9, p10, a48, g10, r88)); } } if (s19) { const n47 = t46.iconSizeData, i28 = l23.layout.get("icon-rotate").evaluate(b10, {}, M6), o90 = gg(s19, i28, _5, q3, w5.iconScaleFactor), d36 = a48 ? gg(a48, i28, _5, q3, w5.iconScaleFactor) : void 0; T6 = Gg(u13, H4, e58, c29, h9, p10, s19, g10, i28, null), R5 = 4 * o90.length; let f10 = null; "source" === n47.kind ? (f10 = [qy * l23.layout.get("icon-size").evaluate(b10, {}, M6) * w5.iconScaleFactor], f10[0] > Ng && Gt(`${t46.layerIds[0]}: Value for "icon-size" is >= ${Ug}. Reduce your "icon-size".`)) : "composite" === n47.kind && (f10 = [qy * w5.compositeIconSizes[0].evaluate(b10, {}, M6) * w5.iconScaleFactor, qy * w5.compositeIconSizes[1].evaluate(b10, {}, M6) * w5.iconScaleFactor], (f10[0] > Ng || f10[1] > Ng) && Gt(`${t46.layerIds[0]}: Value for "icon-size" is >= ${Ug}. Reduce your "icon-size".`)), t46.addSymbols(t46.icon, o90, f10, v10, x5, b10, void 0, r87, e58, z5.lineStartIndex, z5.lineLength, -1, A5, M6, I5, S6), N5 = t46.icon.placedSymbolArray.length - 1, d36 && (L3 = 4 * d36.length, t46.addSymbols(t46.icon, d36, f10, v10, x5, b10, Py.vertical, r87, e58, z5.lineStartIndex, z5.lineLength, -1, A5, M6, I5, S6), j4 = t46.icon.placedSymbolArray.length - 1); } for (const n47 in i27.horizontal) { const s20 = n47, a49 = i27.horizontal[s20]; E6 || (G5 = We(a49.text), f9 ? F18 = Hg(a49) : E6 = Gg(u13, H4, e58, c29, h9, p10, a49, d35, l23.layout.get("text-rotate").evaluate(b10, {}, M6), m7)); const y6 = 1 === a49.positionedLines.length; if (O4 += jg(t46, r87, e58, a49, o89, l23, f9, b10, m7, z5, i27.vertical ? Py.horizontal : Py.horizontalOnly, y6 ? Sg(i27.horizontal) : [s20], $5, N5, w5, A5, M6, I5), y6) break; } i27.vertical && (U4 += jg(t46, r87, e58, i27.vertical, o89, l23, f9, b10, m7, z5, Py.vertical, ["vertical"], $5, j4, w5, A5, M6, I5)); let W4 = -1; const Y6 = (t47, e59) => t47 ? Math.max(t47, e59) : e59; W4 = Y6(F18, W4), W4 = Y6(C7, W4), W4 = Y6(D5, W4); const K5 = W4 > -1 ? 1 : 0; t46.glyphOffsetArray.length >= 65535 && Gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), void 0 !== b10.sortKey && t46.addToSortKeyRanges(t46.symbolInstances.length, b10.sortKey), t46.symbolInstances.emplaceBack(e58.x, e58.y, H4.x, H4.y, H4.z, $5.right >= 0 ? $5.right : -1, $5.center >= 0 ? $5.center : -1, $5.left >= 0 ? $5.left : -1, $5.vertical >= 0 ? $5.vertical : -1, N5, j4, G5, void 0 !== E6 ? E6 : t46.collisionBoxArray.length, void 0 !== E6 ? E6 + 1 : t46.collisionBoxArray.length, void 0 !== B7 ? B7 : t46.collisionBoxArray.length, void 0 !== B7 ? B7 + 1 : t46.collisionBoxArray.length, void 0 !== T6 ? T6 : t46.collisionBoxArray.length, void 0 !== T6 ? T6 + 1 : t46.collisionBoxArray.length, V5 || t46.collisionBoxArray.length, V5 ? V5 + 1 : t46.collisionBoxArray.length, c29, O4, U4, R5, L3, K5, 0, X3, Z3, W4, 0, q3 ? 1 : 0, k8); })(t45, l22, b9, a47, r86, n45, s18, i26, t45.layers[0], t45.collisionBoxArray, e57.index, e57.sourceLayerIndex, t45.index, P4, x4, u12, 0, k7, E5, g9, e57, o88, c28, h8, p9, f8, m6, y4, F17); }; if ("line" === v8) for (const i27 of Sd(e57.geometry, 0, 0, Rn, Rn)) { const e58 = rg(i27, S5, z4, r86.vertical || _4, n45, M5, I4, t45.overscaling, Rn); for (const r87 of e58) _4 && qg(t45, _4.text, T5, r87) || C6(i27, r87, p9); } else if ("line-center" === v8) { for (const t46 of e57.geometry) if (t46.length > 1) { const e58 = eg(t46, z4, r86.vertical || _4, n45, M5, I4); e58 && C6(t46, e58, p9); } } else if ("Polygon" === e57.type) for (const t46 of Kh(e57.geometry, 0)) { const e58 = Ag(t46, 16); C6(t46[0], new Yy(e58.x, e58.y, 0, 0, void 0), p9); } else if ("LineString" === e57.type) for (const t46 of e57.geometry) C6(t46, new Yy(t46[0].x, t46[0].y, 0, 0, void 0), p9); else if ("Point" === e57.type) for (const t46 of e57.geometry) for (const e58 of t46) C6([e58], new Yy(e58.x, e58.y, 0, 0, void 0), p9); } const Ug = 255, Ng = Ug * qy; function jg(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4, g9) { const x4 = (function(t46, e58, r87, n46, i27, s19, o89, a47) { const l22 = []; if (0 === e58.positionedLines.length) return l22; const u13 = n46.layout.get("text-rotate").evaluate(s19, {}) * Math.PI / 180, c29 = (function(t47) { const e59 = t47[0], r88 = t47[1], n47 = e59 * r88; return n47 > 0 ? [e59, -r88] : n47 < 0 ? [-e59, r88] : 0 === e59 ? [r88, e59] : [r88, -e59]; })(r87); let h9 = Math.abs(e58.top - e58.bottom); for (const t47 of e58.positionedLines) h9 -= t47.lineOffset; const p10 = e58.positionedLines.length, d35 = h9 / p10; let f9 = e58.top - r87[1]; for (let t47 = 0; t47 < p10; ++t47) { const n47 = e58.positionedLines[t47]; f9 = _g(e58, d35, f9, t47); for (const t48 of n47.positionedGlyphs) { if (!t48.rect) continue; const n48 = t48.rect || {}; let s20 = Sy + 1, h10 = true, p11 = 1, d36 = 0; if (t48.image) { const e59 = o89.get(t48.image.toString()); if (!e59) continue; if (e59.sdf) { Gt("SDF images are not supported in formatted text and will be ignored."); continue; } h10 = false, p11 = e59.pixelRatio, s20 = sg / p11; } const m7 = (i27 || a47) && t48.vertical, y5 = t48.metrics.advance * t48.scale / 2, g10 = t48.metrics, x5 = t48.rect; if (null === x5) continue; a47 && e58.verticalizable && (d36 = t48.image ? y5 - t48.metrics.width * t48.scale / 2 : 0); const v9 = i27 ? [t48.x + y5, t48.y] : [0, 0]; let b9 = [0, 0], w4 = [0, 0], _4 = false; i27 || (m7 ? (w4 = [t48.x + y5 + c29[0], t48.y + c29[1] - d36], _4 = true) : b9 = [t48.x + y5 + r87[0], t48.y + r87[1] - d36]); const A4 = x5.w * t48.scale / (p11 * (t48.localGlyph ? pg : 1)), M5 = x5.h * t48.scale / (p11 * (t48.localGlyph ? pg : 1)); let I4, S5, P4, k7; if (m7) { const e59 = t48.y - f9, r88 = new wt(-y5, y5 - e59), n49 = -Math.PI / 2, i28 = new wt(...w4); I4 = new wt(-y5 + b9[0], b9[1]), I4._rotateAround(n49, r88)._add(i28), I4.x += -e59 + y5, I4.y -= (g10.left - s20) * t48.scale; const o90 = t48.image ? g10.advance * t48.scale : ry * t48.scale, a48 = String.fromCodePoint(t48.glyph); sy(a48) ? I4.x += (1 - s20) * t48.scale : oy(a48) ? I4.x += o90 - g10.height * t48.scale + (-s20 - 1) * t48.scale : I4.x += t48.image || g10.width + 2 * s20 === x5.w && g10.height + 2 * s20 === x5.h ? (o90 - M5) / 2 : (o90 - (g10.height + 2 * s20) * t48.scale) / 2, S5 = new wt(I4.x, I4.y - A4), P4 = new wt(I4.x + M5, I4.y), k7 = new wt(I4.x + M5, I4.y - A4); } else { const e59 = (g10.left - s20) * t48.scale - y5 + b9[0], r88 = (-g10.top - s20) * t48.scale + b9[1], n49 = e59 + A4, i28 = r88 + M5; I4 = new wt(e59, r88), S5 = new wt(n49, r88), P4 = new wt(e59, i28), k7 = new wt(n49, i28); } if (u13) { let t49; t49 = i27 ? new wt(0, 0) : _4 ? new wt(c29[0], c29[1]) : new wt(r87[0], r87[1]), I4._rotateAround(u13, t49), S5._rotateAround(u13, t49), P4._rotateAround(u13, t49), k7._rotateAround(u13, t49); } const z4 = new wt(0, 0), E5 = new wt(0, 0); l22.push({ tl: I4, tr: S5, bl: P4, br: k7, texPrimary: n48, texSecondary: void 0, writingMode: e58.writingMode, glyphOffset: v9, sectionIndex: t48.sectionIndex, isSDF: h10, pixelOffsetTL: z4, pixelOffsetBR: E5, minFontScaleX: 0, minFontScaleY: 0 }); } } return l22; })(0, n45, l21, s18, o88, a46, i26, t45.allowVerticalPlacement), v8 = t45.textSizeData; let b8 = null; "source" === v8.kind ? (b8 = [qy * s18.layout.get("text-size").evaluate(a46, {}, y4) * f8.textScaleFactor], b8[0] > Ng && Gt(`${t45.layerIds[0]}: Value for "text-size" is >= ${Ug}. Reduce your "text-size".`)) : "composite" === v8.kind && (b8 = [qy * f8.compositeTextSizes[0].evaluate(a46, {}, y4) * f8.textScaleFactor, qy * f8.compositeTextSizes[1].evaluate(a46, {}, y4) * f8.textScaleFactor], (b8[0] > Ng || b8[1] > Ng) && Gt(`${t45.layerIds[0]}: Value for "text-size" is >= ${Ug}. Reduce your "text-size".`)), t45.addSymbols(t45.text, x4, b8, l21, o88, a46, c28, e57, r86, u12.lineStartIndex, u12.lineLength, d34, m6, y4, g9, false); for (const e58 of h8) p9[e58] = t45.text.placedSymbolArray.length - 1; return 4 * x4.length; } function $g(t45) { for (const e57 in t45) return t45[e57]; return null; } function Gg(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) { let c28 = o88.top, h8 = o88.bottom, p9 = o88.left, d34 = o88.right; if (Uy(o88) && o88.collisionPadding) { const t46 = o88.collisionPadding; p9 -= t46[0], c28 -= t46[1], d34 += t46[2], h8 += t46[3]; } if (l21) { const t46 = new wt(p9, c28), e58 = new wt(d34, c28), r87 = new wt(p9, h8), n46 = new wt(d34, h8), i27 = It(l21); let s19 = new wt(0, 0); u12 && (s19 = new wt(u12[0], u12[1])), t46._rotateAround(i27, s19), e58._rotateAround(i27, s19), r87._rotateAround(i27, s19), n46._rotateAround(i27, s19), p9 = Math.min(t46.x, e58.x, r87.x, n46.x), d34 = Math.max(t46.x, e58.x, r87.x, n46.x), c28 = Math.min(t46.y, e58.y, r87.y, n46.y), h8 = Math.max(t46.y, e58.y, r87.y, n46.y); } return t45.emplaceBack(e57.x, e57.y, e57.z, r86.x, r86.y, p9, c28, d34, h8, a46, n45, i26, s18), t45.length - 1; } function Hg(t45) { Uy(t45) && t45.collisionPadding && (t45.top -= t45.collisionPadding[1], t45.bottom += t45.collisionPadding[3]); const e57 = t45.bottom - t45.top; return e57 > 0 ? Math.max(10, e57) : null; } function qg(t45, e57, r86, n45) { const i26 = t45.compareText; if (e57 in i26) { const t46 = i26[e57]; for (let e58 = t46.length - 1; e58 >= 0; e58--) if (n45.dist(t46[e58]) < r86) return true; } else i26[e57] = []; return i26[e57].push(n45), false; } function Xg(t45, e57) { const r86 = t45.fovAboveCenter, n45 = t45.elevation ? t45.elevation.getMinElevationBelowMSL() * e57 : 0, i26 = (t45._camera.position[2] * t45.worldSize - n45) / Math.cos(t45._pitch), s18 = Math.sin(r86) * i26 / Math.sin(Math.max(Math.PI / 2 - t45._pitch - r86, 0.01)); let o88 = Math.sin(t45._pitch) * s18 + i26; const a46 = i26 * (1 / t45._horizonShift); if (!t45.elevation || 0 === t45.elevation.exaggeration()) { let e58 = Math.max(t45.zoom - 17, 0); t45.isOrthographic && (e58 /= 10), o88 *= 1 + e58; } return Math.min(1.01 * o88, a46); } function Zg(t45, e57) { if (!e57.isReprojectedInTileSpace) return { scale: 1 << t45.z, x: t45.x, y: t45.y, x2: t45.x + 1, y2: t45.y + 1, projection: e57 }; const r86 = Math.pow(2, -t45.z), n45 = t45.x * r86, i26 = (t45.x + 1) * r86, s18 = t45.y * r86, o88 = (t45.y + 1) * r86, a46 = au(n45), l21 = au(i26), u12 = lu(s18), c28 = lu(o88), h8 = e57.project(a46, u12), p9 = e57.project(l21, u12), d34 = e57.project(l21, c28), f8 = e57.project(a46, c28); let m6 = Math.min(h8.x, p9.x, d34.x, f8.x), y4 = Math.min(h8.y, p9.y, d34.y, f8.y), g9 = Math.max(h8.x, p9.x, d34.x, f8.x), x4 = Math.max(h8.y, p9.y, d34.y, f8.y); const v8 = r86 / 16; function b8(t46, r87, n46, i27, s19, o89) { const a47 = (n46 + s19) / 2, l22 = (i27 + o89) / 2, u13 = e57.project(au(a47), lu(l22)), c29 = Math.max(0, m6 - u13.x, y4 - u13.y, u13.x - g9, u13.y - x4); m6 = Math.min(m6, u13.x), g9 = Math.max(g9, u13.x), y4 = Math.min(y4, u13.y), x4 = Math.max(x4, u13.y), c29 > v8 && (b8(t46, u13, n46, i27, a47, l22), b8(u13, r87, a47, l22, s19, o89)); } b8(h8, p9, n45, s18, i26, s18), b8(p9, d34, i26, s18, i26, o88), b8(d34, f8, i26, o88, n45, o88), b8(f8, h8, n45, o88, n45, s18), m6 -= v8, y4 -= v8, g9 += v8, x4 += v8; const w4 = 1 / Math.max(g9 - m6, x4 - y4); return { scale: w4, x: m6 * w4, y: y4 * w4, x2: g9 * w4, y2: x4 * w4, projection: e57 }; } function Wg(t45, { x: e57, y: r86 }, n45 = 0) { return new wt(((e57 - n45) * t45.scale - t45.x) * Rn, (r86 * t45.scale - t45.y) * Rn); } const Yg = l20(new Float32Array(16)); class Kg { constructor(t45) { this.spec = t45, this.name = t45.name, this.wrap = false, this.requiresDraping = false, this.supportsWorldCopies = false, this.supportsTerrain = false, this.supportsFog = false, this.supportsFreeCamera = false, this.zAxisUnit = "meters", this.isReprojectedInTileSpace = true, this.unsupportedLayers = ["custom"], this.center = [0, 0], this.range = [3.5, 7]; } project(t45, e57) { return { x: 0, y: 0, z: 0 }; } unproject(t45, e57) { return new Ql(0, 0); } projectTilePoint(t45, e57, r86) { return { x: t45, y: e57, z: 0 }; } locationPoint(t45, e57, r86, n45 = true) { return t45._coordinatePoint(t45.locationCoordinate(e57, r86), n45); } pixelsPerMeter(t45, e57) { return ou(1, t45) * e57; } pixelSpaceConversion(t45, e57, r86) { return 1; } farthestPixelDistance(t45) { return Xg(t45, t45.pixelsPerMeter); } pointCoordinate(t45, e57, r86, n45) { const i26 = t45.horizonLineFromTop(false), s18 = new wt(e57, Math.max(i26, r86)); return t45.rayIntersectionCoordinate(t45.pointRayIntersection(s18, n45)); } pointCoordinate3D(t45, e57, r86) { const n45 = new wt(e57, r86); if (t45.elevation) return t45.elevation.pointCoordinate(n45); { const e58 = this.pointCoordinate(t45, n45.x, n45.y, 0); return [e58.x, e58.y, e58.z]; } } isPointAboveHorizon(t45, e57) { if (t45.elevation && t45.elevation.visibleDemTiles.length) return !this.pointCoordinate3D(t45, e57.x, e57.y); const r86 = t45.horizonLineFromTop(); return e57.y < r86; } createInversionMatrix(t45, e57) { return Yg; } createTileMatrix(t45, e57, r86) { let n45, i26, s18; const o88 = r86.canonical, a46 = l20(new Float64Array(16)); if (this.isReprojectedInTileSpace) { const l21 = Zg(o88, this); n45 = 1, i26 = l21.x + r86.wrap * l21.scale, s18 = l21.y, p8(a46, a46, [n45 / l21.scale, n45 / l21.scale, t45.pixelsPerMeter / e57]); } else n45 = e57 / t45.zoomScale(o88.z), i26 = (o88.x + Math.pow(2, o88.z) * r86.wrap) * n45, s18 = o88.y * n45; return h7(a46, a46, [i26, s18, 0]), p8(a46, a46, [n45 / Rn, n45 / Rn, 1]), a46; } upVector(t45, e57, r86) { return [0, 0, 1]; } upVectorScale(t45, e57, r86) { return { metersToTile: 1 }; } } class Jg extends Kg { constructor(t45) { super(t45), this.range = [4, 7], this.center = t45.center || [-96, 37.5]; const [e57, r86] = this.parallels = t45.parallels || [29.5, 45.5], n45 = Math.sin(It(e57)); this.n = (n45 + Math.sin(It(r86))) / 2, this.c = 1 + n45 * (2 * this.n - n45), this.r0 = Math.sqrt(this.c) / this.n; } project(t45, e57) { const { n: r86, c: n45, r0: i26 } = this, s18 = It(t45 - this.center[0]), o88 = It(e57), a46 = Math.sqrt(n45 - 2 * r86 * Math.sin(o88)) / r86; return { x: a46 * Math.sin(s18 * r86), y: a46 * Math.cos(s18 * r86) - i26, z: 0 }; } unproject(t45, e57) { const { n: r86, c: n45, r0: i26 } = this, s18 = i26 + e57; let o88 = Math.atan2(t45, Math.abs(s18)) * Math.sign(s18); s18 * r86 < 0 && (o88 -= Math.PI * Math.sign(t45) * Math.sign(s18)); const a46 = It(this.center[0]) * r86; o88 = Vt(o88, -Math.PI - a46, Math.PI - a46); const l21 = Tt2(St(o88 / r86) + this.center[0], -180, 180), u12 = Math.asin(Tt2((n45 - (t45 * t45 + s18 * s18) * r86 * r86) / (2 * r86), -1, 1)), c28 = Tt2(St(u12), -cu, cu); return new Ql(l21, c28); } } const Qg = 1.340264, tx = -0.081106, ex = 893e-6, rx = 3796e-6, nx = Math.sqrt(3) / 2; class ix extends Kg { project(t45, e57) { e57 = e57 / 180 * Math.PI, t45 = t45 / 180 * Math.PI; const r86 = Math.asin(nx * Math.sin(e57)), n45 = r86 * r86, i26 = n45 * n45 * n45; return { x: 0.5 * (t45 * Math.cos(r86) / (nx * (Qg + 3 * tx * n45 + i26 * (7 * ex + 9 * rx * n45))) / Math.PI + 0.5), y: 1 - 0.5 * (r86 * (Qg + tx * n45 + i26 * (ex + rx * n45)) / Math.PI + 1), z: 0 }; } unproject(t45, e57) { t45 = (2 * t45 - 0.5) * Math.PI; let r86 = e57 = (2 * (1 - e57) - 1) * Math.PI, n45 = r86 * r86, i26 = n45 * n45 * n45; for (let t46, s19, o89, a47 = 0; a47 < 12 && (s19 = r86 * (Qg + tx * n45 + i26 * (ex + rx * n45)) - e57, o89 = Qg + 3 * tx * n45 + i26 * (7 * ex + 9 * rx * n45), t46 = s19 / o89, r86 = Tt2(r86 - t46, -Math.PI / 3, Math.PI / 3), n45 = r86 * r86, i26 = n45 * n45 * n45, !(Math.abs(t46) < 1e-12)); ++a47) ; const s18 = nx * t45 * (Qg + 3 * tx * n45 + i26 * (7 * ex + 9 * rx * n45)) / Math.cos(r86), o88 = Math.asin(Math.sin(r86) / nx), a46 = Tt2(180 * s18 / Math.PI, -180, 180), l21 = Tt2(180 * o88 / Math.PI, -cu, cu); return new Ql(a46, l21); } } class sx extends Kg { constructor(t45) { super(t45), this.wrap = true, this.supportsWorldCopies = true; } project(t45, e57) { return { x: 0.5 + t45 / 360, y: 0.5 - e57 / 360, z: 0 }; } unproject(t45, e57) { const r86 = 360 * (t45 - 0.5), n45 = Tt2(360 * (0.5 - e57), -cu, cu); return new Ql(r86, n45); } } const ox = Math.PI / 2; function ax(t45) { return Math.tan((ox + t45) / 2); } class lx extends Kg { constructor(t45) { super(t45), this.center = t45.center || [0, 30]; const [e57, r86] = this.parallels = t45.parallels || [30, 30]; let n45 = It(e57), i26 = It(r86); this.southernCenter = n45 + i26 < 0, this.southernCenter && (n45 = -n45, i26 = -i26); const s18 = Math.cos(n45), o88 = ax(n45); this.n = n45 === i26 ? Math.sin(n45) : Math.log(s18 / Math.cos(i26)) / Math.log(ax(i26) / o88), this.f = s18 * Math.pow(ax(n45), this.n) / this.n; } project(t45, e57) { e57 = It(e57), this.southernCenter && (e57 = -e57), t45 = It(t45 - this.center[0]); const r86 = 1e-6, { n: n45, f: i26 } = this; i26 > 0 ? e57 < -ox + r86 && (e57 = -ox + r86) : e57 > ox - r86 && (e57 = ox - r86); const s18 = i26 / Math.pow(ax(e57), n45); let o88 = s18 * Math.sin(n45 * t45), a46 = i26 - s18 * Math.cos(n45 * t45); return o88 = 0.5 * (o88 / Math.PI + 0.5), a46 = 0.5 * (a46 / Math.PI + 0.5), { x: o88, y: this.southernCenter ? a46 : 1 - a46, z: 0 }; } unproject(t45, e57) { t45 = (2 * t45 - 0.5) * Math.PI, this.southernCenter && (e57 = 1 - e57), e57 = (2 * (1 - e57) - 0.5) * Math.PI; const { n: r86, f: n45 } = this, i26 = n45 - e57, s18 = Math.sign(i26), o88 = Math.sign(r86) * Math.sqrt(t45 * t45 + i26 * i26); let a46 = Math.atan2(t45, Math.abs(i26)) * s18; i26 * r86 < 0 && (a46 -= Math.PI * Math.sign(t45) * s18); const l21 = Tt2(St(a46 / r86) + this.center[0], -180, 180), u12 = Tt2(St(2 * Math.atan(Math.pow(n45 / o88, 1 / r86)) - ox), -cu, cu); return new Ql(l21, this.southernCenter ? -u12 : u12); } } class ux extends Kg { constructor(t45) { super(t45), this.wrap = true, this.supportsWorldCopies = true, this.supportsTerrain = true, this.supportsFog = true, this.supportsFreeCamera = true, this.isReprojectedInTileSpace = false, this.unsupportedLayers = [], this.range = null; } project(t45, e57) { return { x: iu(t45), y: su(e57), z: 0 }; } unproject(t45, e57) { const r86 = au(t45), n45 = lu(e57); return new Ql(r86, n45); } } const cx = It(cu); class hx extends Kg { project(t45, e57) { const r86 = (e57 = It(e57)) * e57, n45 = r86 * r86; return { x: 0.5 * ((t45 = It(t45)) * (0.8707 - 0.131979 * r86 + n45 * (n45 * (3971e-6 * r86 - 1529e-6 * n45) - 0.013791)) / Math.PI + 0.5), y: 1 - 0.5 * (e57 * (1.007226 + r86 * (0.015085 + n45 * (0.028874 * r86 - 0.044475 - 5916e-6 * n45))) / Math.PI + 1), z: 0 }; } unproject(t45, e57) { t45 = (2 * t45 - 0.5) * Math.PI; let r86 = e57 = (2 * (1 - e57) - 1) * Math.PI, n45 = 25, i26 = 0, s18 = r86 * r86; do { s18 = r86 * r86; const t46 = s18 * s18; i26 = (r86 * (1.007226 + s18 * (0.015085 + t46 * (0.028874 * s18 - 0.044475 - 5916e-6 * t46))) - e57) / (1.007226 + s18 * (0.045255 + t46 * (0.259866 * s18 - 0.311325 - 5916e-6 * 11 * t46))), r86 = Tt2(r86 - i26, -cx, cx); } while (Math.abs(i26) > 1e-6 && --n45 > 0); s18 = r86 * r86; const o88 = Tt2(St(t45 / (0.8707 + s18 * (s18 * (s18 * s18 * s18 * (3971e-6 - 1529e-6 * s18) - 0.013791) - 0.131979))), -180, 180), a46 = St(r86); return new Ql(o88, a46); } } const px2 = It(cu); class dx extends Kg { project(t45, e57) { e57 = It(e57), t45 = It(t45); const r86 = Math.cos(e57), n45 = 2 / Math.PI, i26 = Math.acos(r86 * Math.cos(t45 / 2)), s18 = Math.sin(i26) / i26, o88 = 0.5 * (t45 * n45 + 2 * r86 * Math.sin(t45 / 2) / s18) || 0, a46 = 0.5 * (e57 + Math.sin(e57) / s18) || 0; return { x: 0.5 * (o88 / Math.PI + 0.5), y: 1 - 0.5 * (a46 / Math.PI + 1), z: 0 }; } unproject(t45, e57) { let r86 = t45 = (2 * t45 - 0.5) * Math.PI, n45 = e57 = (2 * (1 - e57) - 1) * Math.PI, i26 = 25; const s18 = 1e-6; let o88 = 0, a46 = 0; do { const i27 = Math.cos(n45), s19 = Math.sin(n45), l21 = 2 * s19 * i27, u12 = s19 * s19, c28 = i27 * i27, h8 = Math.cos(r86 / 2), p9 = Math.sin(r86 / 2), d34 = 2 * h8 * p9, f8 = p9 * p9, m6 = 1 - c28 * h8 * h8, y4 = m6 ? 1 / m6 : 0, g9 = m6 ? Math.acos(i27 * h8) * Math.sqrt(1 / m6) : 0, x4 = 0.5 * (2 * g9 * i27 * p9 + 2 * r86 / Math.PI) - t45, v8 = 0.5 * (g9 * s19 + n45) - e57, b8 = 0.5 * y4 * (c28 * f8 + g9 * i27 * h8 * u12) + 1 / Math.PI, w4 = y4 * (d34 * l21 / 4 - g9 * s19 * p9), _4 = 0.125 * y4 * (l21 * p9 - g9 * s19 * c28 * d34), A4 = 0.5 * y4 * (u12 * h8 + g9 * f8 * i27) + 0.5, M5 = w4 * _4 - A4 * b8; o88 = (v8 * w4 - x4 * A4) / M5, a46 = (x4 * _4 - v8 * b8) / M5, r86 = Tt2(r86 - o88, -Math.PI, Math.PI), n45 = Tt2(n45 - a46, -px2, px2); } while ((Math.abs(o88) > s18 || Math.abs(a46) > s18) && --i26 > 0); return new Ql(St(r86), St(n45)); } } class fx extends Kg { constructor(t45) { super(t45), this.center = t45.center || [0, 0], this.parallels = t45.parallels || [0, 0], this.cosPhi = Math.max(0.01, Math.cos(It(this.parallels[0]))), this.scale = 1 / (2 * Math.max(Math.PI * this.cosPhi, 1 / this.cosPhi)), this.wrap = true, this.supportsWorldCopies = true; } project(t45, e57) { const { scale: r86, cosPhi: n45 } = this; return { x: It(t45) * n45 * r86 + 0.5, y: -Math.sin(It(e57)) / n45 * r86 + 0.5, z: 0 }; } unproject(t45, e57) { const { scale: r86, cosPhi: n45 } = this, i26 = -(e57 - 0.5) / r86, s18 = Tt2(St((t45 - 0.5) / r86) / n45, -180, 180), o88 = Math.asin(Tt2(i26 * n45, -1, 1)), a46 = Tt2(St(o88), -cu, cu); return new Ql(s18, a46); } } class mx extends ux { constructor(t45) { super(t45), this.requiresDraping = true, this.supportsWorldCopies = false, this.supportsFog = true, this.zAxisUnit = "pixels", this.unsupportedLayers = ["debug"], this.range = [3, 5]; } projectTilePoint(t45, e57, r86) { const n45 = jc(t45, e57, r86); return O3(n45, n45, Hc(Dc(r86))), { x: n45[0], y: n45[1], z: n45[2] }; } locationPoint(t45, e57, r86) { const n45 = Yl(e57.lat, e57.lng), i26 = C5([], n45), s18 = r86 ? t45._centerAltitude + r86 : t45.elevation ? t45.elevation.getAtPointOrZero(t45.locationCoordinate(e57), t45._centerAltitude) : t45._centerAltitude; T4(n45, n45, i26, ou(1, 0) * Rn * s18); const o88 = l20(new Float64Array(16)); return c27(o88, t45.pixelMatrix, t45.globeMatrix), O3(n45, n45, o88), new wt(n45[0], n45[1]); } pixelsPerMeter(t45, e57) { return ou(1, 0) * e57; } pixelSpaceConversion(t45, e57, r86) { const n45 = ou(1, t45) * e57, i26 = ur(ou(1, 45) * e57, n45, r86); return this.pixelsPerMeter(t45, e57) / i26; } createTileMatrix(t45, e57, r86) { const n45 = qc(Dc(r86.canonical)); return c27(new Float64Array(16), t45.globeMatrix, n45); } createInversionMatrix(t45, e57) { const { center: r86 } = t45, n45 = Hc(Dc(e57)); return f7(n45, n45, It(r86.lng)), d33(n45, n45, It(r86.lat)), p8(n45, n45, [t45._pixelsPerMercatorPixel, t45._pixelsPerMercatorPixel, 1]), Float32Array.from(n45); } pointCoordinate(t45, e57, r86, n45) { return Vc(t45, e57, r86, true) || new mu(0, 0); } pointCoordinate3D(t45, e57, r86) { const n45 = this.pointCoordinate(t45, e57, r86, 0); return [n45.x, n45.y, n45.z]; } isPointAboveHorizon(t45, e57) { return !Vc(t45, e57.x, e57.y, false); } farthestPixelDistance(t45) { const e57 = (function(t46, e58) { const r87 = t46.cameraToCenterDistance, n45 = t46._centerAltitude * e58, i26 = t46._camera, s18 = t46._camera.forward(), o88 = I3([], E4([], s18, -r87), [0, 0, n45]), a46 = t46.worldSize / (2 * Math.PI), l21 = [0, 0, -a46], u12 = t46.width / t46.height, c28 = Math.tan(t46.fovAboveCenter), h8 = E4([], i26.up(), c28), p9 = E4([], i26.right(), c28 * u12), d34 = C5([], I3([], I3([], s18, h8), p9)), f8 = []; let m6; if (new Uu(o88, d34).closestPointOnSphere(l21, a46, f8)) { const e59 = I3([], f8, l21), r88 = G4([], e59, o88); m6 = Math.cos(t46.fovAboveCenter) * _3(r88); } else { const t47 = G4([], o88, l21), e59 = G4([], l21, o88); C5(e59, e59); const r88 = _3(t47) - a46; m6 = Math.sqrt(r88 * (r88 + 2 * a46)); const n46 = Math.acos(m6 / (a46 + r88)) - Math.acos(D4(s18, e59)); m6 *= Math.cos(n46); } return 1.01 * m6; })(t45, this.pixelsPerMeter(t45.center.lat, t45.worldSize)), r86 = Yc(t45.zoom); if (r86 > 0) { const n45 = Xg(t45, ou(1, t45.center.lat) * t45.worldSize), i26 = t45.worldSize / (2 * Math.PI), s18 = Math.max(t45.width, t45.height) / t45.worldSize * Math.PI; return ur(e57, n45 + i26 * (1 - Math.cos(s18)), Math.pow(r86, 10)); } return e57; } upVector(t45, e57, r86) { return jc(e57, r86, t45, 1); } upVectorScale(t45) { return { metersToTile: Tc($c(Dc(t45))) }; } } function yx(t45) { const e57 = t45.parallels, r86 = !!e57 && Math.abs(e57[0] + e57[1]) < 0.01; switch (t45.name) { case "mercator": return new ux(t45); case "equirectangular": return new sx(t45); case "naturalEarth": return new hx(t45); case "equalEarth": return new ix(t45); case "winkelTripel": return new dx(t45); case "albers": return r86 ? new fx(t45) : new Jg(t45); case "lambertConformalConic": return r86 ? new fx(t45) : new lx(t45); case "globe": return new mx(t45); } throw new Error(`Invalid projection name: ${t45.name}`); } const gx = Iu.types, xx = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }]; function vx(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9) { const d34 = a46 ? Math.min(Ng, Math.round(a46[0])) : 0, f8 = a46 ? Math.min(Ng, Math.round(a46[1])) : 0; t45.emplaceBack(e57, r86, Math.round(32 * n45), Math.round(32 * i26), s18, o88, (d34 << 1) + (l21 ? 1 : 0), f8, 16 * u12, 16 * c28, 256 * h8, 256 * p9); } function bx(t45, e57, r86) { t45.emplaceBack(e57, r86); } function wx(t45, e57, r86, n45, i26, s18, o88) { t45.emplaceBack(e57, r86, n45, i26, s18, o88); } const _x = (t45, e57, r86, n45) => { for (let i26 = 0; i26 < e57; i26++) t45.emplaceBack(r86[0], r86[1], r86[2], n45[0], n45[1], n45[2]); }; function Ax(t45, e57, r86, n45, i26) { t45.emplaceBack(e57, r86, n45, i26), t45.emplaceBack(e57, r86, n45, i26), t45.emplaceBack(e57, r86, n45, i26), t45.emplaceBack(e57, r86, n45, i26); } function Mx(t45) { for (const e57 of t45.sections) if (uo(e57.text)) return true; return false; } class Ix { constructor(t45) { this.layoutVertexArray = new wa(), this.indexArray = new Ea(), this.programConfigurations = t45, this.segments = new al(), this.dynamicLayoutVertexArray = new Aa(), this.opacityVertexArray = new Ma(), this.placedSymbolArray = new Za(), this.iconTransitioningVertexArray = new Ia(), this.globeExtVertexArray = new _a12(), this.zOffsetVertexArray = new pa(), this.orientationVertexArray = new Va(); } isEmpty() { return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length && 0 === this.iconTransitioningVertexArray.length; } upload(t45, e57, r86, n45, i26) { this.isEmpty() || (r86 && (this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, qm.members), this.indexBuffer = t45.createIndexBuffer(this.indexArray, e57), this.dynamicLayoutVertexBuffer = t45.createVertexBuffer(this.dynamicLayoutVertexArray, Zm.members, true), this.opacityVertexBuffer = t45.createVertexBuffer(this.opacityVertexArray, xx, true), this.iconTransitioningVertexArray.length > 0 && (this.iconTransitioningVertexBuffer = t45.createVertexBuffer(this.iconTransitioningVertexArray, Km.members, true)), this.globeExtVertexArray.length > 0 && (this.globeExtVertexBuffer = t45.createVertexBuffer(this.globeExtVertexArray, Xm.members, true)), !this.zOffsetVertexBuffer && (this.zOffsetVertexArray.length > 0 || i26) && (this.zOffsetVertexBuffer = t45.createVertexBuffer(this.zOffsetVertexArray, Wm.members, true)), !this.orientationVertexBuffer && this.orientationVertexArray && this.orientationVertexArray.length > 0 && (this.orientationVertexBuffer = t45.createVertexBuffer(this.orientationVertexArray, Ym.members, true)), this.opacityVertexBuffer.itemSize = 1), (r86 || n45) && this.programConfigurations.upload(t45)); } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy(), this.iconTransitioningVertexBuffer && this.iconTransitioningVertexBuffer.destroy(), this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy(), this.zOffsetVertexBuffer && this.zOffsetVertexBuffer.destroy(), this.orientationVertexBuffer && this.orientationVertexBuffer.destroy()); } } Ws(Ix, "SymbolBuffers"); class Sx { constructor(t45, e57, r86) { this.layoutVertexArray = new t45(), this.layoutAttributes = e57, this.indexArray = new r86(), this.segments = new al(), this.collisionVertexArray = new za(), this.collisionVertexArrayExt = new Aa(); } upload(t45) { this.layoutVertexBuffer = t45.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t45.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t45.createVertexBuffer(this.collisionVertexArray, Jm.members, true), this.collisionVertexBufferExt = t45.createVertexBuffer(this.collisionVertexArrayExt, Qm.members, true); } destroy() { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy(), this.collisionVertexBufferExt.destroy()); } } Ws(Sx, "CollisionBuffers"); class Px { constructor(t45) { this.collisionBoxArray = t45.collisionBoxArray, this.zoom = t45.zoom, this.overscaling = t45.overscaling, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.index = t45.index, this.pixelRatio = t45.pixelRatio, this.sourceLayerIndex = t45.sourceLayerIndex, this.hasPattern = false, this.hasRTLText = false, this.fullyClipped = false, this.hasAnyIconTextFit = false, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = l20([]), this.placementViewportMatrix = l20([]); const e57 = this.layers[0]._unevaluatedLayout._values; this.worldview = t45.worldview, this.textSizeData = Xy(this.zoom, e57["text-size"], this.worldview), this.iconSizeData = Xy(this.zoom, e57["icon-size"], this.worldview); const r86 = this.layers[0].layout, n45 = r86.get("symbol-sort-key"), i26 = r86.get("symbol-z-order"); this.lut = t45.lut, this.canOverlap = r86.get("text-allow-overlap") || r86.get("icon-allow-overlap") || r86.get("text-ignore-placement") || r86.get("icon-ignore-placement"), this.sortFeaturesByKey = "viewport-y" !== i26 && void 0 !== n45.constantOr(1), this.sortFeaturesByY = ("viewport-y" === i26 || "auto" === i26 && !this.sortFeaturesByKey) && this.canOverlap, this.writingModes = r86.get("text-writing-mode").map(((t46) => Py[t46])), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.sourceID = t45.sourceID, this.projection = t45.projection, this.hasAnyZOffset = false, this.zOffsetSortDirty = false, this.zOffsetBuffersNeedUpload = false, this.elevationType = "none", this.elevationStateComplete = false, this.activeReplacements = [], this.replacementUpdateTime = 0, this.hasAnySecondaryIcon = false; } createArrays() { this.text = new Ix(new Cl(this.layers, { zoom: this.zoom, lut: this.lut }, ((t45) => t45.startsWith("text") || t45.startsWith("symbol")))), this.icon = new Ix(new Cl(this.layers, { zoom: this.zoom, lut: this.lut }, ((t45) => t45.startsWith("icon") || t45.startsWith("symbol")))), this.glyphOffsetArray = new Ka(), this.lineVertexArray = new Ja(), this.symbolInstances = new Ya(); } calculateGlyphDependencies(t45, e57, r86, n45, i26) { for (const r87 of t45) { const t46 = r87.codePointAt(0); if (void 0 === t46) break; if (e57[t46] = true, n45 && i26 && t46 <= 65535) { const t47 = iy[r87]; t47 && (e57[t47.charCodeAt(0)] = true); } } } updateFootprints(t45, e57) { } updateReplacement(t45, e57) { if (e57.updateTime === this.replacementUpdateTime) return false; this.replacementUpdateTime = e57.updateTime; const r86 = e57.getReplacementRegionsForTile(t45.toUnwrapped(), true); return !Dp(this.activeReplacements, r86) && (this.activeReplacements = r86, true); } populate(t45, e57, r86, n45) { const i26 = this.layers[0], s18 = i26.layout, o88 = "globe" === this.projection.name, a46 = s18.get("text-font"), l21 = s18.get("text-field"), u12 = s18.get("icon-image"), [c28, h8] = s18.get("icon-size-scale-range"), p9 = Tt2(e57.scaleFactor || 1, c28, h8), d34 = ("constant" !== l21.value.kind || l21.value.value instanceof Vr && !l21.value.value.isEmpty() || l21.value.value.toString().length > 0) && ("constant" !== a46.value.kind || a46.value.value.length > 0), f8 = "constant" !== u12.value.kind || !!u12.value.value || Object.keys(u12.parameters).length > 0, m6 = s18.get("symbol-sort-key"); if (this.features = [], !d34 && !f8) return; const y4 = e57.iconDependencies, g9 = e57.glyphDependencies, x4 = e57.availableImages, v8 = new wo(this.zoom, { worldview: this.worldview }); for (const { feature: e58, id: l22, index: u13, sourceLayerIndex: c29 } of t45) { const t46 = i26._featureFilter.needGeometry, h9 = Mu(e58, t46); if (!i26._featureFilter.filter(v8, h9, r86)) continue; if (t46 || (h9.geometry = Au(e58, r86, n45)), o88 && 1 !== e58.type && r86.z <= 5) { const t47 = h9.geometry, e59 = 0.98078528056, n46 = (t48, n47) => D4(jc(t48.x, t48.y, r86, 1), jc(n47.x, n47.y, r86, 1)) < e59; for (let e60 = 0; e60 < t47.length; e60++) t47[e60] = vu(t47[e60], n46); } let b8, w4; if (d34) { const t47 = i26.getValueAndResolveTokens("text-field", h9, r86, x4), e59 = Vr.factory(t47); Mx(e59) && (this.hasRTLText = true), (!this.hasRTLText || "unavailable" === xo() || this.hasRTLText && bo.isParsed()) && (b8 = ny(e59, i26, h9)); } if (f8) { const t47 = i26.getValueAndResolveTokens("icon-image", h9, r86, x4); w4 = "string" == typeof t47 ? Cr.build(t47) : t47; } if (!b8 && !w4) continue; const _4 = this.sortFeaturesByKey ? m6.evaluate(h9, {}, r86) : void 0, A4 = { id: l22, text: b8, icon: w4, index: u13, sourceLayerIndex: c29, geometry: h9.geometry, properties: e58.properties, type: gx[e58.type], sortKey: _4 }; if (this.features.push(A4), w4) { const t47 = this.layers[0]._unevaluatedLayout._values, { iconPrimary: e59, iconSecondary: n46 } = Bg(w4, this.iconSizeData, t47["icon-size"], r86, this.zoom, A4, this.pixelRatio, p9, this.worldview), i27 = e59.id.toString(); if (y4.has(i27) ? y4.get(i27).push(e59) : y4.set(i27, [e59]), n46) { this.hasAnySecondaryIcon = true; const t48 = n46.id.toString(); y4.has(t48) ? y4.get(t48).push(n46) : y4.set(t48, [n46]); } } if (b8) { const t47 = a46.evaluate(h9, {}, r86).join(","), e59 = "map" === s18.get("text-rotation-alignment") && "point" !== s18.get("symbol-placement"); this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(Py.vertical) >= 0; for (const r87 of b8.sections) if (r87.image) { const t48 = r87.image.getPrimary().scaleSelf(this.pixelRatio), e60 = t48.id.toString(), n46 = y4.get(e60) || []; n46.push(t48), y4.set(e60, n46); } else { const n46 = eo(b8.toString()), i27 = r87.fontStack || t47, s19 = g9[i27] = g9[i27] || {}; this.calculateGlyphDependencies(r87.text, s19, e59, this.allowVerticalPlacement, n46); } } } if ("line" === s18.get("symbol-placement") && (this.features = (function(t46) { const e58 = {}, r87 = {}, n46 = []; let i27 = 0; function s19(e59) { n46.push(t46[e59]), i27++; } function o89(t47, e59, i28) { const s20 = r87[t47]; return delete r87[t47], r87[e59] = s20, n46[s20].geometry[0].pop(), n46[s20].geometry[0] = n46[s20].geometry[0].concat(i28[0]), s20; } function a47(t47, r88, i28) { const s20 = e58[r88]; return delete e58[r88], e58[t47] = s20, n46[s20].geometry[0].shift(), n46[s20].geometry[0] = i28[0].concat(n46[s20].geometry[0]), s20; } function l22(t47, e59, r88) { const n47 = r88 ? e59[0][e59[0].length - 1] : e59[0][0]; return `${t47}:${n47.x}:${n47.y}`; } for (let u13 = 0; u13 < t46.length; u13++) { const c29 = t46[u13], h9 = c29.geometry, p10 = c29.text ? c29.text.toString() : null; if (!p10) { s19(u13); continue; } const d35 = l22(p10, h9), f9 = l22(p10, h9, true); if (d35 in r87 && f9 in e58 && r87[d35] !== e58[f9]) { const t47 = a47(d35, f9, h9), i28 = o89(d35, f9, n46[t47].geometry); delete e58[d35], delete r87[f9], r87[l22(p10, n46[i28].geometry, true)] = i28, n46[t47].geometry = null; } else d35 in r87 ? o89(d35, f9, h9) : f9 in e58 ? a47(d35, f9, h9) : (s19(u13), e58[d35] = i27 - 1, r87[f9] = i27 - 1); } return n46.filter(((t47) => t47.geometry)); })(this.features)), "hd-road-markup" === s18.get("symbol-elevation-reference")) { if (this.elevationType = "road", e57.elevationFeatures) { !this.elevationFeatures && e57.elevationFeatures.length > 0 && (this.elevationFeatures = [], this.elevationFeatureIdToIndex = /* @__PURE__ */ new Map()); for (const t46 of e57.elevationFeatures) this.elevationFeatureIdToIndex.set(t46.id, this.elevationFeatures.length), this.elevationFeatures.push(t46); } } else s18.get("symbol-z-elevate") && (this.elevationType = "offset"); "none" !== this.elevationType && (this.zOffsetBuffersNeedUpload = true), this.sortFeaturesByKey && this.features.sort(((t46, e58) => t46.sortKey - e58.sortKey)); } update(t45, e57, r86, n45, i26, s18, o88) { this.text.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, this.worldview), this.icon.programConfigurations.updatePaintArrays(t45, e57, i26, r86, n45, s18, o88, this.worldview); } updateRoadElevation(t45) { if ("road" !== this.elevationType || !this.elevationFeatures) return; if (this.elevationStateComplete) return; this.elevationStateComplete = true, this.hasAnyZOffset = false; let e57 = false; const r86 = fu(t45), n45 = 1 / r86; let i26 = false, s18 = false; for (let t46 = 0; t46 < this.symbolInstances.length; t46++) { const o88 = this.symbolInstances.get(t46), a46 = A3(1, 0, 0), l21 = A3(0, 1, 0), { numHorizontalGlyphVertices: u12, numVerticalGlyphVertices: c28, numIconVertices: h8, numVerticalIconVertices: p9 } = o88, d34 = u12 > 0 || c28 > 0, f8 = h8 > 0, m6 = this.elevationFeatures[o88.elevationFeatureIndex]; if (m6) { const t47 = new wt(o88.tileAnchorX, o88.tileAnchorY), u13 = 0.075 + m6.pointElevation(t47); o88.zOffset !== u13 && (e57 = true, o88.zOffset = u13); const c29 = m6.computeSlopeNormal(t47, n45), h9 = st3(K4(), A3(0, 0, 1), c29); N4(a46, a46, h9), N4(l21, l21, h9), a46[2] *= r86, l21[2] *= r86, 1 === a46[0] && 0 === a46[1] && 0 === a46[2] && 0 === l21[0] && 1 === l21[1] && 0 === l21[2] || (i26 = i26 || d34, s18 = s18 || f8); } if (d34 && (_x(this.text.orientationVertexArray, u12, a46, l21), _x(this.text.orientationVertexArray, c28, a46, l21)), f8) { const { placedIconSymbolIndex: t47, verticalPlacedIconSymbolIndex: e58 } = o88; t47 >= 0 && _x(this.icon.orientationVertexArray, h8, a46, l21), e58 >= 0 && _x(this.icon.orientationVertexArray, p9, a46, l21); } } i26 || (this.text.orientationVertexArray = void 0), s18 || (this.icon.orientationVertexArray = void 0), e57 && (this.zOffsetBuffersNeedUpload = true, this.zOffsetSortDirty = true); } updateZOffset() { const t45 = (t46, e58, n46) => { r86 += e58, r86 > t46.length && t46.resize(r86); for (let i26 = -e58; i26 < 0; i26++) t46.emplace(i26 + r86, n46); }, e57 = (t46, e58, r87) => { n45 += e58, n45 > t46.length && t46.resize(n45); for (let i26 = -e58; i26 < 0; i26++) t46.emplace(i26 + n45, r87); }; if (!this.zOffsetBuffersNeedUpload) return; this.zOffsetBuffersNeedUpload = false; let r86 = 0, n45 = 0; for (let r87 = 0; r87 < this.symbolInstances.length; r87++) { const n46 = this.symbolInstances.get(r87), { numHorizontalGlyphVertices: i26, numVerticalGlyphVertices: s18, numIconVertices: o88 } = n46, a46 = n46.zOffset, l21 = o88 > 0; if ((i26 > 0 || s18 > 0) && (t45(this.text.zOffsetVertexArray, i26, a46), t45(this.text.zOffsetVertexArray, s18, a46)), l21) { const { placedIconSymbolIndex: t46, verticalPlacedIconSymbolIndex: r88 } = n46; t46 >= 0 && e57(this.icon.zOffsetVertexArray, o88, a46), r88 >= 0 && e57(this.icon.zOffsetVertexArray, n46.numVerticalIconVertices, a46); } } this.text.zOffsetVertexBuffer && this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray), this.icon.zOffsetVertexBuffer && this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray); } isEmpty() { return 0 === this.symbolInstances.length && !this.hasRTLText; } uploadPending() { return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload; } upload(t45) { !this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(t45), this.iconCollisionBox.upload(t45)), this.text.upload(t45, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload, this.zOffsetBuffersNeedUpload), this.icon.upload(t45, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload, this.zOffsetBuffersNeedUpload), this.uploaded = true; } destroyDebugData() { this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(); } getProjection() { return this.projectionInstance || (this.projectionInstance = yx(this.projection)), this.projectionInstance; } destroy() { this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData(); } addToLineVertexArray(t45, e57) { const r86 = this.lineVertexArray.length; if (void 0 !== t45.segment) for (const { x: t46, y: r87 } of e57) this.lineVertexArray.emplaceBack(t46, r87); return { lineStartIndex: r86, lineLength: this.lineVertexArray.length - r86 }; } addSymbols(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6) { const y4 = t45.indexArray, g9 = t45.layoutVertexArray, x4 = t45.globeExtVertexArray, v8 = t45.segments.prepareSegment(4 * e57.length, g9, y4, this.canOverlap ? s18.sortKey : void 0), b8 = this.glyphOffsetArray.length, w4 = v8.vertexLength, _4 = this.allowVerticalPlacement && o88 === Py.vertical ? Math.PI / 2 : 0, A4 = s18.text && s18.text.sections; for (let n46 = 0; n46 < e57.length; n46++) { const { tl: i27, tr: o89, bl: u13, br: c29, texPrimary: h9, texSecondary: b9, pixelOffsetTL: w5, pixelOffsetBR: M6, minFontScaleX: I4, minFontScaleY: S5, glyphOffset: P4, isSDF: k7, sectionIndex: z4 } = e57[n46], E5 = v8.vertexLength, T5 = P4[1]; if (vx(g9, l21.x, l21.y, i27.x, T5 + i27.y, h9.x, h9.y, r86, k7, w5.x, w5.y, I4, S5), vx(g9, l21.x, l21.y, o89.x, T5 + o89.y, h9.x + h9.w, h9.y, r86, k7, M6.x, w5.y, I4, S5), vx(g9, l21.x, l21.y, u13.x, T5 + u13.y, h9.x, h9.y + h9.h, r86, k7, w5.x, M6.y, I4, S5), vx(g9, l21.x, l21.y, c29.x, T5 + c29.y, h9.x + h9.w, h9.y + h9.h, r86, k7, M6.x, M6.y, I4, S5), a46) { const { x: e58, y: r87, z: n47 } = a46.anchor, [i28, s19, o90] = a46.up; wx(x4, e58, r87, n47, i28, s19, o90), wx(x4, e58, r87, n47, i28, s19, o90), wx(x4, e58, r87, n47, i28, s19, o90), wx(x4, e58, r87, n47, i28, s19, o90), Ax(t45.dynamicLayoutVertexArray, e58, r87, n47, _4); } else Ax(t45.dynamicLayoutVertexArray, l21.x, l21.y, l21.z, _4); if (m6) { const e58 = b9 || h9; bx(t45.iconTransitioningVertexArray, e58.x, e58.y), bx(t45.iconTransitioningVertexArray, e58.x + e58.w, e58.y), bx(t45.iconTransitioningVertexArray, e58.x, e58.y + e58.h), bx(t45.iconTransitioningVertexArray, e58.x + e58.w, e58.y + e58.h); } y4.emplaceBack(E5, E5 + 1, E5 + 2), y4.emplaceBack(E5 + 1, E5 + 2, E5 + 3), v8.vertexLength += 4, v8.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(P4[0]), n46 !== e57.length - 1 && z4 === e57[n46 + 1].sectionIndex || t45.programConfigurations.populatePaintArrays(g9.length, s18, s18.index, {}, p9, d34, f8, A4 && A4[z4], this.worldview); } const M5 = a46 ? a46.anchor : l21; t45.placedSymbolArray.emplaceBack(M5.x, M5.y, M5.z, l21.x, l21.y, b8, this.glyphOffsetArray.length - b8, w4, u12, c28, l21.segment, r86 ? r86[0] : 0, r86 ? r86[1] : 0, n45[0], n45[1], o88, 0, 0, 0, h8, 0); } _commitLayoutVertex(t45, e57, r86, n45, i26, s18, o88) { t45.emplaceBack(e57, r86, n45, i26, s18, Math.round(o88.x), Math.round(o88.y)); } _addCollisionDebugVertices(t45, e57, r86, n45, i26, s18, o88) { const a46 = r86.segments.prepareSegment(4, r86.layoutVertexArray, r86.indexArray), l21 = a46.vertexLength, u12 = o88.tileAnchorX, c28 = o88.tileAnchorY; for (let t46 = 0; t46 < 4; t46++) r86.collisionVertexArray.emplaceBack(0, 0, 0, 0, 0, 0); this._commitDebugCollisionVertexUpdate(r86.collisionVertexArrayExt, e57, t45.padding, o88.zOffset), this._commitLayoutVertex(r86.layoutVertexArray, n45, i26, s18, u12, c28, new wt(t45.x1, t45.y1)), this._commitLayoutVertex(r86.layoutVertexArray, n45, i26, s18, u12, c28, new wt(t45.x2, t45.y1)), this._commitLayoutVertex(r86.layoutVertexArray, n45, i26, s18, u12, c28, new wt(t45.x2, t45.y2)), this._commitLayoutVertex(r86.layoutVertexArray, n45, i26, s18, u12, c28, new wt(t45.x1, t45.y2)), a46.vertexLength += 4; const h8 = r86.indexArray; h8.emplaceBack(l21, l21 + 1), h8.emplaceBack(l21 + 1, l21 + 2), h8.emplaceBack(l21 + 2, l21 + 3), h8.emplaceBack(l21 + 3, l21), a46.primitiveLength += 4; } _addTextDebugCollisionBoxes(t45, e57, r86, n45, i26, s18) { for (let o88 = n45; o88 < i26; o88++) { const n46 = r86.get(o88), i27 = this.getSymbolInstanceTextSize(t45, s18, e57, o88); this._addCollisionDebugVertices(n46, i27, this.textCollisionBox, n46.projectedAnchorX, n46.projectedAnchorY, n46.projectedAnchorZ, s18); } } _addIconDebugCollisionBoxes(t45, e57, r86, n45, i26, s18) { for (let o88 = n45; o88 < i26; o88++) { const n46 = r86.get(o88), i27 = this.getSymbolInstanceIconSize(t45, e57, s18.placedIconSymbolIndex); this._addCollisionDebugVertices(n46, i27, this.iconCollisionBox, n46.projectedAnchorX, n46.projectedAnchorY, n46.projectedAnchorZ, s18); } } generateCollisionDebugBuffers(t45, e57, r86) { this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new Sx(Pa, ty.members, Ia), this.iconCollisionBox = new Sx(Pa, ty.members, Ia); const n45 = Wy(this.iconSizeData, t45), i26 = Wy(this.textSizeData, t45, r86); for (let r87 = 0; r87 < this.symbolInstances.length; r87++) { const s18 = this.symbolInstances.get(r87); this._addTextDebugCollisionBoxes(i26, t45, e57, s18.textBoxStartIndex, s18.textBoxEndIndex, s18), this._addTextDebugCollisionBoxes(i26, t45, e57, s18.verticalTextBoxStartIndex, s18.verticalTextBoxEndIndex, s18), this._addIconDebugCollisionBoxes(n45, t45, e57, s18.iconBoxStartIndex, s18.iconBoxEndIndex, s18), this._addIconDebugCollisionBoxes(n45, t45, e57, s18.verticalIconBoxStartIndex, s18.verticalIconBoxEndIndex, s18); } } getSymbolInstanceTextSize(t45, e57, r86, n45) { const i26 = this.text.placedSymbolArray.get(e57.rightJustifiedTextSymbolIndex >= 0 ? e57.rightJustifiedTextSymbolIndex : e57.centerJustifiedTextSymbolIndex >= 0 ? e57.centerJustifiedTextSymbolIndex : e57.leftJustifiedTextSymbolIndex >= 0 ? e57.leftJustifiedTextSymbolIndex : e57.verticalPlacedTextSymbolIndex >= 0 ? e57.verticalPlacedTextSymbolIndex : n45), s18 = Zy(this.textSizeData, t45, i26) / ry; return this.tilePixelRatio * s18; } getSymbolInstanceIconSize(t45, e57, r86) { const n45 = this.icon.placedSymbolArray.get(r86), i26 = Zy(this.iconSizeData, t45, n45); return this.tilePixelRatio * i26; } _commitDebugCollisionVertexUpdate(t45, e57, r86, n45) { t45.emplaceBack(e57, -r86, -r86, n45), t45.emplaceBack(e57, r86, -r86, n45), t45.emplaceBack(e57, r86, r86, n45), t45.emplaceBack(e57, -r86, r86, n45); } _updateTextDebugCollisionBoxes(t45, e57, r86, n45, i26, s18, o88) { for (let o89 = n45; o89 < i26; o89++) { const n46 = r86.get(o89), i27 = this.getSymbolInstanceTextSize(t45, s18, e57, o89); this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt, i27, n46.padding, s18.zOffset); } } _updateIconDebugCollisionBoxes(t45, e57, r86, n45, i26, s18, o88) { for (let o89 = n45; o89 < i26; o89++) { const n46 = r86.get(o89), i27 = this.getSymbolInstanceIconSize(t45, e57, s18.placedIconSymbolIndex); this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt, i27, n46.padding, s18.zOffset); } } updateCollisionDebugBuffers(t45, e57, r86, n45) { if (!this.hasDebugData()) return; this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexArrayExt.clear(), this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexArrayExt.clear(); const i26 = Wy(this.iconSizeData, t45, n45), s18 = Wy(this.textSizeData, t45, r86); for (let o88 = 0; o88 < this.symbolInstances.length; o88++) { const a46 = this.symbolInstances.get(o88); this._updateTextDebugCollisionBoxes(s18, t45, e57, a46.textBoxStartIndex, a46.textBoxEndIndex, a46, r86), this._updateTextDebugCollisionBoxes(s18, t45, e57, a46.verticalTextBoxStartIndex, a46.verticalTextBoxEndIndex, a46, r86), this._updateIconDebugCollisionBoxes(i26, t45, e57, a46.iconBoxStartIndex, a46.iconBoxEndIndex, a46, n45), this._updateIconDebugCollisionBoxes(i26, t45, e57, a46.verticalIconBoxStartIndex, a46.verticalIconBoxEndIndex, a46, n45); } this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexBufferExt && this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt), this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexBufferExt && this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt); } _deserializeCollisionBoxesForSymbol(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = {}; if (e57 < r86) { const { x1: r87, y1: n46, x2: i27, y2: s19, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9, featureIndex: d34 } = t45.get(e57); u12.textBox = { x1: r87, y1: n46, x2: i27, y2: s19, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9 }, u12.textFeatureIndex = d34; } if (n45 < i26) { const { x1: e58, y1: r87, x2: i27, y2: s19, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9, featureIndex: d34 } = t45.get(n45); u12.verticalTextBox = { x1: e58, y1: r87, x2: i27, y2: s19, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9 }, u12.verticalTextFeatureIndex = d34; } if (s18 < o88) { const { x1: e58, y1: r87, x2: n46, y2: i27, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9, featureIndex: d34 } = t45.get(s18); u12.iconBox = { x1: e58, y1: r87, x2: n46, y2: i27, padding: o89, projectedAnchorX: a47, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9 }, u12.iconFeatureIndex = d34; } if (a46 < l21) { const { x1: e58, y1: r87, x2: n46, y2: i27, padding: s19, projectedAnchorX: o89, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9, featureIndex: d34 } = t45.get(a46); u12.verticalIconBox = { x1: e58, y1: r87, x2: n46, y2: i27, padding: s19, projectedAnchorX: o89, projectedAnchorY: l22, projectedAnchorZ: c28, tileAnchorX: h8, tileAnchorY: p9 }, u12.verticalIconFeatureIndex = d34; } return u12; } deserializeCollisionBoxes(t45) { this.collisionArrays = []; for (let e57 = 0; e57 < this.symbolInstances.length; e57++) { const r86 = this.symbolInstances.get(e57); this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t45, r86.textBoxStartIndex, r86.textBoxEndIndex, r86.verticalTextBoxStartIndex, r86.verticalTextBoxEndIndex, r86.iconBoxStartIndex, r86.iconBoxEndIndex, r86.verticalIconBoxStartIndex, r86.verticalIconBoxEndIndex)); } } hasTextData() { return this.text.segments.get().length > 0; } hasIconData() { return this.icon.segments.get().length > 0; } hasDebugData() { return this.textCollisionBox && this.iconCollisionBox; } hasTextCollisionBoxData() { return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0; } hasIconCollisionBoxData() { return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0; } hasIconTextFit() { return this.hasAnyIconTextFit; } addIndicesForPlacedSymbol(t45, e57) { const r86 = t45.placedSymbolArray.get(e57), n45 = r86.vertexStartIndex + 4 * r86.numGlyphs; for (let e58 = r86.vertexStartIndex; e58 < n45; e58 += 4) t45.indexArray.emplaceBack(e58, e58 + 1, e58 + 2), t45.indexArray.emplaceBack(e58 + 1, e58 + 2, e58 + 3); } getSortedSymbolIndexes(t45) { if (this.sortedAngle === t45 && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes; const e57 = Math.sin(t45), r86 = Math.cos(t45), n45 = [], i26 = [], s18 = []; for (let t46 = 0; t46 < this.symbolInstances.length; ++t46) { s18.push(t46); const o88 = this.symbolInstances.get(t46); n45.push(0 | Math.round(e57 * o88.tileAnchorX + r86 * o88.tileAnchorY)), i26.push(o88.featureIndex); } return s18.sort(((t46, e58) => n45[t46] - n45[e58] || i26[e58] - i26[t46])), s18; } getSortedIndexesByZOffset() { if (!this.zOffsetSortDirty) return this.symbolInstanceIndexesSortedZOffset; if (!this.symbolInstanceIndexesSortedZOffset) { this.symbolInstanceIndexesSortedZOffset = []; for (let t45 = 0; t45 < this.symbolInstances.length; ++t45) this.symbolInstanceIndexesSortedZOffset.push(t45); } return this.zOffsetSortDirty = false, this.symbolInstanceIndexesSortedZOffset.sort(((t45, e57) => this.symbolInstances.get(e57).zOffset - this.symbolInstances.get(t45).zOffset)); } addToSortKeyRanges(t45, e57) { const r86 = this.sortKeyRanges[this.sortKeyRanges.length - 1]; r86 && r86.sortKey === e57 ? r86.symbolInstanceEnd = t45 + 1 : this.sortKeyRanges.push({ sortKey: e57, symbolInstanceStart: t45, symbolInstanceEnd: t45 + 1 }); } sortFeatures(t45) { if (this.sortFeaturesByY && this.sortedAngle !== t45 && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) { this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t45), this.sortedAngle = t45, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = []; for (const t46 of this.symbolInstanceIndexes) { const e57 = this.symbolInstances.get(t46); this.featureSortOrder.push(e57.featureIndex); const { rightJustifiedTextSymbolIndex: r86, centerJustifiedTextSymbolIndex: n45, leftJustifiedTextSymbolIndex: i26, verticalPlacedTextSymbolIndex: s18, placedIconSymbolIndex: o88, verticalPlacedIconSymbolIndex: a46 } = e57; r86 >= 0 && this.addIndicesForPlacedSymbol(this.text, r86), n45 >= 0 && n45 !== r86 && this.addIndicesForPlacedSymbol(this.text, n45), i26 >= 0 && i26 !== n45 && i26 !== r86 && this.addIndicesForPlacedSymbol(this.text, i26), s18 >= 0 && this.addIndicesForPlacedSymbol(this.text, s18), o88 >= 0 && this.addIndicesForPlacedSymbol(this.icon, o88), a46 >= 0 && this.addIndicesForPlacedSymbol(this.icon, a46); } this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray); } } } let kx, zx, Ex; Ws(Px, "SymbolBucket", { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), Px.addDynamicAttributes = Ax; class Tx { constructor(t45) { this.type = t45.property.overrides ? t45.property.overrides.runtimeType : fr, this.defaultValue = t45; } evaluate(t45) { if (t45.formattedSection) { const e57 = this.defaultValue.property.overrides; if (e57 && e57.hasOverride(t45.formattedSection)) return e57.getOverride(t45.formattedSection); } return t45.feature && t45.featureState ? this.defaultValue.evaluate(t45.feature, t45.featureState) : this.defaultValue.property.specification.default; } eachChild(t45) { this.defaultValue.isConstant() || t45(this.defaultValue.value._styleExpression.expression); } outputDefined() { return false; } serialize() { return null; } } Ws(Tx, "FormatSectionOverride", { omit: ["defaultValue"] }); const Bx = () => Ex || (Ex = { layout: kx || (kx = new Vo({ "symbol-placement": new Eo(Fo.layout_symbol["symbol-placement"]), "symbol-spacing": new Eo(Fo.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new Eo(Fo.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new To(Fo.layout_symbol["symbol-sort-key"]), "symbol-z-order": new Eo(Fo.layout_symbol["symbol-z-order"]), "symbol-z-elevate": new Eo(Fo.layout_symbol["symbol-z-elevate"]), "symbol-elevation-reference": new Eo(Fo.layout_symbol["symbol-elevation-reference"]), "icon-allow-overlap": new Eo(Fo.layout_symbol["icon-allow-overlap"]), "icon-ignore-placement": new Eo(Fo.layout_symbol["icon-ignore-placement"]), "icon-optional": new Eo(Fo.layout_symbol["icon-optional"]), "icon-rotation-alignment": new Eo(Fo.layout_symbol["icon-rotation-alignment"]), "icon-size": new To(Fo.layout_symbol["icon-size"]), "icon-size-scale-range": new Eo(Fo.layout_symbol["icon-size-scale-range"]), "icon-text-fit": new To(Fo.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new To(Fo.layout_symbol["icon-text-fit-padding"]), "icon-image": new To(Fo.layout_symbol["icon-image"]), "icon-image-use-theme": new Eo({ type: "string", default: "default", "property-type": "data-constant" }), "icon-rotate": new To(Fo.layout_symbol["icon-rotate"]), "icon-padding": new Eo(Fo.layout_symbol["icon-padding"]), "icon-keep-upright": new Eo(Fo.layout_symbol["icon-keep-upright"]), "icon-offset": new To(Fo.layout_symbol["icon-offset"]), "icon-anchor": new To(Fo.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new Eo(Fo.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new Eo(Fo.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new Eo(Fo.layout_symbol["text-rotation-alignment"]), "text-field": new To(Fo.layout_symbol["text-field"]), "text-font": new To(Fo.layout_symbol["text-font"]), "text-size": new To(Fo.layout_symbol["text-size"]), "text-size-scale-range": new Eo(Fo.layout_symbol["text-size-scale-range"]), "text-max-width": new To(Fo.layout_symbol["text-max-width"]), "text-line-height": new To(Fo.layout_symbol["text-line-height"]), "text-letter-spacing": new To(Fo.layout_symbol["text-letter-spacing"]), "text-justify": new To(Fo.layout_symbol["text-justify"]), "text-radial-offset": new To(Fo.layout_symbol["text-radial-offset"]), "text-variable-anchor": new Eo(Fo.layout_symbol["text-variable-anchor"]), "text-anchor": new To(Fo.layout_symbol["text-anchor"]), "text-max-angle": new Eo(Fo.layout_symbol["text-max-angle"]), "text-writing-mode": new Eo(Fo.layout_symbol["text-writing-mode"]), "text-rotate": new To(Fo.layout_symbol["text-rotate"]), "text-padding": new Eo(Fo.layout_symbol["text-padding"]), "text-keep-upright": new Eo(Fo.layout_symbol["text-keep-upright"]), "text-transform": new To(Fo.layout_symbol["text-transform"]), "text-offset": new To(Fo.layout_symbol["text-offset"]), "text-allow-overlap": new Eo(Fo.layout_symbol["text-allow-overlap"]), "text-ignore-placement": new Eo(Fo.layout_symbol["text-ignore-placement"]), "text-optional": new Eo(Fo.layout_symbol["text-optional"]), visibility: new Eo(Fo.layout_symbol.visibility) })), paint: zx || (zx = new Vo({ "icon-opacity": new To(Fo.paint_symbol["icon-opacity"]), "icon-occlusion-opacity": new To(Fo.paint_symbol["icon-occlusion-opacity"]), "icon-emissive-strength": new To(Fo.paint_symbol["icon-emissive-strength"]), "text-emissive-strength": new To(Fo.paint_symbol["text-emissive-strength"]), "icon-color": new To(Fo.paint_symbol["icon-color"]), "icon-halo-color": new To(Fo.paint_symbol["icon-halo-color"]), "icon-halo-width": new To(Fo.paint_symbol["icon-halo-width"]), "icon-halo-blur": new To(Fo.paint_symbol["icon-halo-blur"]), "icon-translate": new Eo(Fo.paint_symbol["icon-translate"]), "icon-translate-anchor": new Eo(Fo.paint_symbol["icon-translate-anchor"]), "icon-image-cross-fade": new Eo(Fo.paint_symbol["icon-image-cross-fade"]), "text-opacity": new To(Fo.paint_symbol["text-opacity"]), "text-occlusion-opacity": new To(Fo.paint_symbol["text-occlusion-opacity"]), "text-color": new To(Fo.paint_symbol["text-color"], { runtimeType: xr, getOverride: (t45) => t45.textColor, hasOverride: (t45) => !!t45.textColor }), "text-halo-color": new To(Fo.paint_symbol["text-halo-color"]), "text-halo-width": new To(Fo.paint_symbol["text-halo-width"]), "text-halo-blur": new To(Fo.paint_symbol["text-halo-blur"]), "text-translate": new Eo(Fo.paint_symbol["text-translate"]), "text-translate-anchor": new Eo(Fo.paint_symbol["text-translate-anchor"]), "icon-color-saturation": new Eo(Fo.paint_symbol["icon-color-saturation"]), "icon-color-contrast": new Eo(Fo.paint_symbol["icon-color-contrast"]), "icon-color-brightness-min": new Eo(Fo.paint_symbol["icon-color-brightness-min"]), "icon-color-brightness-max": new Eo(Fo.paint_symbol["icon-color-brightness-max"]), "symbol-z-offset": new To(Fo.paint_symbol["symbol-z-offset"]), "icon-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "icon-halo-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "text-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "text-halo-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, Ex); class Vx extends na { constructor(t45, e57, r86, n45) { super(t45, Bx(), e57, r86, n45, t45.layout ? t45.layout["icon-image-use-theme"] : null), this._colorAdjustmentMatrix = l20([]), this.hasOcclusionOpacityProperties = void 0 !== t45.paint && ("icon-occlusion-opacity" in t45.paint || "text-occlusion-opacity" in t45.paint); } _handleSpecialPaintPropertyUpdate(t45) { "icon-occlusion-opacity" !== t45 && "text-occlusion-opacity" !== t45 || (this.hasOcclusionOpacityProperties = true); } recalculate(t45, e57) { super.recalculate(t45, e57), "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 r86 = this.layout.get("text-writing-mode"); if (r86) { const t46 = []; for (const e58 of r86) t46.indexOf(e58) < 0 && t46.push(e58); this.layout._values["text-writing-mode"] = t46; } else this.layout._values["text-writing-mode"] = "point" === this.layout.get("symbol-placement") ? ["horizontal"] : ["horizontal", "vertical"]; this._setPaintOverrides(); } getColorAdjustmentMatrix(t45, e57, r86, n45) { return this._saturation === t45 && this._contrast === e57 && this._brightnessMin === r86 && this._brightnessMax === n45 || (this._colorAdjustmentMatrix = (function(t46, e58, r87, n46) { t46 = ee2(t46), e58 = te(e58); const i26 = a45(), s18 = t46 / 3, o88 = 1 - 2 * s18, l21 = [o88, s18, s18, 0, s18, o88, s18, 0, s18, s18, o88, 0, 0, 0, 0, 1], u12 = 0.5 - 0.5 * e58, h8 = n46 - r87; return c27(i26, [h8, 0, 0, 0, 0, h8, 0, 0, 0, 0, h8, 0, r87, r87, r87, 1], [e58, 0, 0, 0, 0, e58, 0, 0, 0, 0, e58, 0, u12, u12, u12, 1]), c27(i26, i26, l21), i26; })(t45, e57, r86, n45), this._saturation = t45, this._contrast = e57, this._brightnessMin = r86, this._brightnessMax = n45), this._colorAdjustmentMatrix; } getValueAndResolveTokens(t45, e57, r86, n45) { const i26 = this.layout.get(t45).evaluate(e57, {}, r86, n45), s18 = this._unevaluatedLayout._values[t45]; return s18.isDataDriven() || Rs(s18.value) || !i26 ? i26 : (function(t46, e58) { return e58.replace(/{([^{}]+)}/g, ((e59, r87) => r87 in t46 ? String(t46[r87]) : "")); })(e57.properties, i26); } createBucket(t45) { return new Px(t45); } queryRadius() { return 0; } queryIntersectsFeature() { return false; } _setPaintOverrides() { for (const t45 of Bx().paint.overridableProperties) { if (!Vx.hasPaintOverride(this.layout, t45)) continue; const e57 = this.paint.get(t45), r86 = new Tx(e57), n45 = new Ds(r86, e57.property.specification, this.scope, this.options, this.layout.get("icon-image-use-theme")); let i26 = null; i26 = "constant" === e57.value.kind || "source" === e57.value.kind ? new Os("source", n45) : new Us("composite", n45, e57.value.zoomStops, e57.value.interpolationType), this.paint._values[t45] = new ko(e57.property, i26, e57.parameters); } } _handleOverridablePaintPropertyUpdate(t45, e57, r86) { return !(!this.layout || e57.isDataDriven() || r86.isDataDriven()) && Vx.hasPaintOverride(this.layout, t45); } static hasPaintOverride(t45, e57) { const r86 = t45.get("text-field"), n45 = Bx().paint.properties[e57]; let i26 = false; const s18 = (t46) => { for (const e58 of t46) if (n45.overrides && n45.overrides.hasOverride(e58)) return void (i26 = true); }; if ("constant" === r86.value.kind && r86.value.value instanceof Vr) s18(r86.value.value.sections); else if ("source" === r86.value.kind) { const t46 = (e59) => { i26 || (e59 instanceof Ur && Lr(e59.value) === _r ? s18(e59.value.sections) : e59 instanceof Gr ? s18(e59.sections) : e59.eachChild(t46)); }, e58 = r86.value; e58._styleExpression && t46(e58._styleExpression.expression); } return i26; } getProgramIds() { return ["symbol"]; } getDefaultProgramParams(t45, e57, r86) { return { config: new Fl(this, { zoom: e57, lut: r86 }), overrideFog: false }; } hasElevation() { return this.layout && "hd-road-markup" === this.layout.get("symbol-elevation-reference"); } } let Fx, Cx, Dx, Rx; var Lx = aa2([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]); function Ox(t45, e57, r86, n45, i26, a46, l21, u12) { const c28 = [t45, e57, 1, r86, n45, 1, i26, a46, 1], h8 = [l21, u12, 1], p9 = s17([], c28), [d34, f8, m6] = U3(h8, h8, p9); return o87(c28, c28, [d34, 0, 0, 0, f8, 0, 0, 0, m6]); } function Ux(t45, e57, r86, n45, i26, a46, l21, u12) { const c28 = (function(t46, e58, r87, n46, i27, a47, l22, u13) { const c29 = Ox(0, 0, 1, 0, 1, 1, 0, 1), h8 = Ox(t46, e58, r87, n46, i27, a47, l22, u13); return o87(h8, h8, s17([], c29)); })(t45, e57, r86, n45, i26, a46, l21, u12); return [c28[2] / c28[8] / Rn, c28[5] / c28[8] / Rn]; } function Nx(t45) { return [t45[0], Math.min(Math.max(t45[1], -cu), cu)]; } class jx extends tr { constructor(t45, e57, r86, n45) { super(), this.id = t45, this.dispatcher = r86, this.coordinates = e57.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = false, this.onNorthPole = false, this.onSouthPole = false, this.setEventedParent(n45), this.options = e57, this._dirty = false; } load(t45, e57) { if (this._loaded = e57 || false, this.fire(new Ye("dataloading", { dataType: "source" })), this.url = this.options.url, !this.url) return t45 && (this.coordinates = t45), this._loaded = true, void this._finishLoading(); this._imageRequest = Ne(this.map._requestManager.transformRequest(this.url, Be.Image), ((e58, r86) => { this._imageRequest = null, this._loaded = true, e58 ? this.fire(new Ke(e58)) : r86 && (this.image = r86 instanceof HTMLImageElement ? de3.getImageData(r86) : r86, this._dirty = true, this.width = this.image.width, this.height = this.image.height, t45 && (this.coordinates = t45), this._finishLoading()); })); } loaded() { return this._loaded; } updateImage(t45) { return t45.url ? (this._imageRequest && t45.url !== this.options.url && (this._imageRequest.cancel(), this._imageRequest = null), this.options.url = t45.url, this.load(t45.coordinates, this._loaded), this) : this; } setTexture(t45) { if (!(t45.handle instanceof WebGLTexture)) throw new Error("The provided handle is not a WebGLTexture instance"); return this.texture = new bf(this.map.painter.context, t45.handle), this.width = t45.dimensions[0], this.height = t45.dimensions[1], this._dirty = false, this._loaded = true, this._finishLoading(), this; } _finishLoading() { this.map && (this.setCoordinates(this.coordinates), this.fire(new Ye("data", { dataType: "source", sourceDataType: "metadata" }))); } onAdd(t45) { this.map = t45, this.load(); } onRemove(t45) { this._imageRequest && (this._imageRequest.cancel(), this._imageRequest = null), !this.texture || this.texture instanceof bf || this.texture.destroy(), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()); } setCoordinates(t45) { if (this.coordinates = t45, this._boundsArray = void 0, this._unsupportedCoords = false, !t45.length) return this; this.onNorthPole = false, this.onSouthPole = false; let e57 = t45[0][1], r86 = t45[0][1]; for (const n46 of t45) n46[1] > r86 && (r86 = n46[1]), n46[1] < e57 && (e57 = n46[1]); const n45 = (r86 + e57) / 2; if (n45 > cu ? this.onNorthPole = true : n45 < -cu && (this.onSouthPole = true), !this.onNorthPole && !this.onSouthPole) { const e58 = t45.map(mu.fromLngLat); this.tileID = (function(t46) { let e59 = 1 / 0, r87 = 1 / 0, n46 = -1 / 0, i26 = -1 / 0; for (const s19 of t46) e59 = Math.min(e59, s19.x), r87 = Math.min(r87, s19.y), n46 = Math.max(n46, s19.x), i26 = Math.max(i26, s19.y); const s18 = Math.max(n46 - e59, i26 - r87), o88 = Math.max(0, Math.floor(-Math.log2(s18))), a46 = Math.pow(2, o88); let l21 = Math.floor((e59 + n46) / 2 * a46); return l21 > 1 && (l21 -= 1), new _c61(o88, l21, Math.floor((r87 + i26) / 2 * a46)); })(e58), this.minzoom = this.maxzoom = this.tileID.z; } return this.fire(new Ye("data", { dataType: "source", sourceDataType: "content" })), this; } _clear() { !this.texture || this.texture instanceof bf || (this.texture.destroy(), this._dirty = true), this.texture = null, this._boundsArray = void 0, this._unsupportedCoords = false; } _prepareData(t45) { for (const t46 in this.tiles) { const e58 = this.tiles[t46]; "loaded" !== e58.state && (e58.state = "loaded", e58.texture = this.texture); } if (this._boundsArray || this.onNorthPole || this.onSouthPole || this._unsupportedCoords) return; const e57 = Zg(new _c61(0, 0, 0), this.map.transform.projection), r86 = [e57.projection.project(this.coordinates[0][0], this.coordinates[0][1]), e57.projection.project(this.coordinates[1][0], this.coordinates[1][1]), e57.projection.project(this.coordinates[2][0], this.coordinates[2][1]), e57.projection.project(this.coordinates[3][0], this.coordinates[3][1])]; if (!(function(t46) { const e58 = t46[1].x - t46[0].x, r87 = t46[1].y - t46[0].y, n46 = t46[2].x - t46[1].x, i27 = t46[2].y - t46[1].y, s18 = t46[3].x - t46[2].x, o88 = t46[3].y - t46[2].y, a47 = t46[0].x - t46[3].x, l22 = t46[0].y - t46[3].y, u13 = e58 * i27 - n46 * r87, c29 = n46 * o88 - s18 * i27, h9 = s18 * l22 - a47 * o88, p10 = a47 * r87 - e58 * l22; return u13 > 0 && c29 > 0 && h9 > 0 && p10 > 0 || u13 < 0 && c29 < 0 && h9 < 0 && p10 < 0; })(r86)) return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"), void (this._unsupportedCoords = true); const n45 = Zg(this.tileID, this.map.transform.projection), [i26, a46, l21, u12] = this.coordinates.map(((t46) => { const e58 = n45.projection.project(t46[0], t46[1]); return Wg(n45, e58)._round(); })); this.perspectiveTransform = Ux(i26.x, i26.y, a46.x, a46.y, l21.x, l21.y, u12.x, u12.y); const c28 = this._boundsArray = new ha(); c28.emplaceBack(i26.x, i26.y, 0, 0), c28.emplaceBack(a46.x, a46.y, Rn, 0), c28.emplaceBack(u12.x, u12.y, 0, Rn), c28.emplaceBack(l21.x, l21.y, Rn, Rn), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()), this.boundsBuffer = t45.createVertexBuffer(c28, Lx.members), this.boundsSegments = al.simpleSegment(0, 0, 4, 2); const h8 = [], p9 = [Nx((d34 = this.coordinates)[0]), Nx(d34[1]), Nx(d34[2]), Nx(d34[3])]; var d34; const [f8, m6, y4, g9] = (function(t46) { let e58 = t46[0][0], r87 = e58, n46 = t46[0][1], i27 = n46; for (let s18 = 1; s18 < t46.length; s18++) t46[s18][0] < e58 ? e58 = t46[s18][0] : t46[s18][0] > r87 && (r87 = t46[s18][0]), t46[s18][1] < n46 ? n46 = t46[s18][1] : t46[s18][1] > i27 && (i27 = t46[s18][1]); return [e58, n46, r87 - e58, i27 - n46]; })(p9); { const n46 = new ha(), [i27, a47, l22, u13] = (function(t46) { let e58 = t46[0].x, r87 = e58, n47 = t46[0].y, i28 = n47; for (let s18 = 1; s18 < t46.length; s18++) t46[s18].x < e58 ? e58 = t46[s18].x : t46[s18].x > r87 && (r87 = t46[s18].x), t46[s18].y < n47 ? n47 = t46[s18].y : t46[s18].y > i28 && (i28 = t46[s18].y); return [e58, n47, r87 - e58, i28 - n47]; })(r86), c29 = (t46) => [(t46.x - i27) / l22, (t46.y - a47) / u13], [p10, d35, x4, v8] = r86.map(c29), b8 = (function(t46, e58, r87, n47, i28, a48, l23, u14) { const c30 = Ox(0, 0, 1, 0, 1, 1, 0, 1); return o87(c30, c30, s17([], Ox(t46, e58, r87, n47, i28, a48, l23, u14))); })(p10[0], p10[1], d35[0], d35[1], x4[0], x4[1], v8[0], v8[1]); this.elevatedGlobePerspectiveTransform = Ux(p10[0], p10[1], d35[0], d35[1], x4[0], x4[1], v8[0], v8[1]); const w4 = (t46, e58) => { h8.push(t46.lng); const r87 = Math.round((t46.lng - f8) / y4 * Rn), i28 = Math.round((t46.lat - m6) / g9 * Rn), s18 = c29(e58), o88 = U3([], [s18[0], s18[1], 1], b8), a48 = Math.round(o88[0] / o88[2] * Rn), l23 = Math.round(o88[1] / o88[2] * Rn); n46.emplaceBack(r87, i28, a48, l23); }, _4 = r86[3].x - r86[0].x, A4 = r86[3].y - r86[0].y, M5 = r86[2].x - r86[1].x, I4 = r86[2].y - r86[1].y; for (let t46 = 0; t46 < 65; t46++) { const n47 = t46 / 64, i28 = [r86[0].x + n47 * _4, r86[0].y + n47 * A4], s18 = [r86[1].x + n47 * M5, r86[1].y + n47 * I4], o88 = s18[0] - i28[0], a48 = s18[1] - i28[1]; for (let t47 = 0; t47 < 65; t47++) { const r87 = t47 / 64, n48 = { x: i28[0] + o88 * r87, y: i28[1] + a48 * r87 }; w4(e57.projection.unproject(n48.x, n48.y), n48); } } this.elevatedGlobeVertexBuffer = t45.createVertexBuffer(n46, Lx.members); } { this.maxLongitudeTriangleSize = 0; let e58 = [], r87 = new Ea(); const n46 = (t46, n47, i27) => { r87.emplaceBack(t46, n47, i27); const s18 = h8[t46], o88 = h8[n47], a47 = h8[i27], l22 = Math.min(Math.min(s18, o88), a47), u13 = Math.max(Math.max(s18, o88), a47) - l22; u13 > this.maxLongitudeTriangleSize && (this.maxLongitudeTriangleSize = u13), e58.push(l22 + u13 / 2); }; for (let t46 = 0; t46 < 64; t46++) for (let e59 = 0; e59 < 64; e59++) { const r88 = 65 * t46 + e59, i27 = r88 + 1, s18 = r88 + 65, o88 = s18 + 1; n46(r88, s18, i27), n46(i27, s18, o88); } [e58, r87] = (function(t46, e59) { const r88 = Array.from({ length: t46.length }, ((t47, e60) => e60)); r88.sort(((e60, r89) => t46[e60] - t46[r89])); const n47 = [], i27 = new Ea(); for (let s18 = 0; s18 < r88.length; s18++) { const o88 = r88[s18]; n47.push(t46[o88]); const a47 = 3 * o88, l22 = a47 + 1; i27.emplaceBack(e59.uint16[a47], e59.uint16[l22], e59.uint16[l22 + 1]); } return [n47, i27]; })(e58, r87), this.elevatedGlobeTrianglesCenterLongitudes = e58, this.elevatedGlobeIndexBuffer = t45.createIndexBuffer(r87); } this.elevatedGlobeSegments = al.simpleSegment(0, 0, 4225, 8192), this.elevatedGlobeGridMatrix = new Float32Array([0, y4 / Rn, 0, g9 / Rn, 0, 0, m6, f8, 0]); } prepare() { const t45 = 0 !== Object.keys(this.tiles).length; if (this.tileID && !t45) return; const e57 = this.map.painter.context, r86 = e57.gl; !this._dirty || this.texture instanceof bf || (this.texture ? this.texture.update(this.image) : (this.texture = new vf(e57, this.image, r86.RGBA8), this.texture.bind(r86.LINEAR, r86.CLAMP_TO_EDGE)), this._dirty = false), t45 && this._prepareData(e57); } loadTile(t45, e57) { this.tileID && this.tileID.equals(t45.tileID.canonical) ? (this.tiles[String(t45.tileID.wrap)] = t45, t45.buckets = {}, e57(null)) : (t45.state = "errored", e57(null)); } serialize() { return { type: "image", url: this.options.url, coordinates: this.coordinates }; } hasTransition() { return false; } getSegmentsForLongitude(t45) { const e57 = this.elevatedGlobeSegments; if (!this.elevatedGlobeTrianglesCenterLongitudes || !e57) return null; const r86 = this.elevatedGlobeTrianglesCenterLongitudes; let n45 = (i26 = t45 + 180) + 360 * Math.round((r86[0] - i26) / 360); var i26; const s18 = new al(), o88 = (t46, r87) => { s18.segments.push({ vertexOffset: 0, primitiveOffset: t46, vertexLength: e57.segments[0].vertexLength, primitiveLength: r87, sortKey: void 0, vaos: {} }); }, a46 = 0.51 * this.maxLongitudeTriangleSize; if (Math.abs(r86[0] - n45) <= a46) { const t46 = Qt2(r86, 0, r86.length, n45 + a46); return t46 === r86.length || o88(t46, Jt2(r86, t46 + 1, r86.length, n45 + 360 - a46) - t46), s18; } n45 < r86[0] && (n45 += 360); const l21 = Jt2(r86, 0, r86.length, n45 - a46); if (l21 === r86.length) return o88(0, r86.length), s18; o88(0, l21 - 0); const u12 = Qt2(r86, l21 + 1, r86.length, n45 + a46); return u12 !== r86.length && o88(u12, r86.length - u12), s18; } } const $x = (Math.pow(256, 2) - 1) / 16907520; class Gx extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: Dx || (Dx = new Vo({ visibility: new Eo(Fo.layout_raster.visibility) })), paint: Rx || (Rx = new Vo({ "raster-opacity": new Eo(Fo.paint_raster["raster-opacity"]), "raster-color": new Bo(Fo.paint_raster["raster-color"]), "raster-color-mix": new Eo(Fo.paint_raster["raster-color-mix"]), "raster-color-range": new Eo(Fo.paint_raster["raster-color-range"]), "raster-hue-rotate": new Eo(Fo.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new Eo(Fo.paint_raster["raster-brightness-min"]), "raster-brightness-max": new Eo(Fo.paint_raster["raster-brightness-max"]), "raster-saturation": new Eo(Fo.paint_raster["raster-saturation"]), "raster-contrast": new Eo(Fo.paint_raster["raster-contrast"]), "raster-resampling": new Eo(Fo.paint_raster["raster-resampling"]), "raster-fade-duration": new Eo(Fo.paint_raster["raster-fade-duration"]), "raster-emissive-strength": new Eo(Fo.paint_raster["raster-emissive-strength"]), "raster-array-band": new Eo(Fo.paint_raster["raster-array-band"]), "raster-elevation": new Eo(Fo.paint_raster["raster-elevation"]), "raster-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this.updateColorRamp(), this._curRampRange = [NaN, NaN]; } getProgramIds() { return ["raster"]; } hasColorMap() { return !!this._transitionablePaint._values["raster-color"].value.value; } tileCoverLift() { return this.paint.get("raster-elevation"); } isDraped(t45) { return !(t45 && t45._source instanceof jx && (t45._source.onNorthPole || t45._source.onSouthPole)) && 0 === this.paint.get("raster-elevation"); } _handleSpecialPaintPropertyUpdate(t45) { "raster-color" !== t45 && "raster-color-range" !== t45 || (this._curRampRange = [NaN, NaN], this.updateColorRamp()); } _clear() { this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); } updateColorRamp(t45) { if (!this.hasColorMap()) return; if (!this._curRampRange) return; const e57 = this._transitionablePaint._values["raster-color"].value.expression, [r86, n45] = t45 || this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({ zoom: 0 }) || [NaN, NaN]; isNaN(r86) && isNaN(n45) || r86 === this._curRampRange[0] && n45 === this._curRampRange[1] || (this.colorRamp = bh({ expression: e57, evaluationKey: "rasterValue", image: this.colorRamp, clips: [{ start: r86, end: n45 }], resolution: 256 }), this.colorRampTexture = null, this._curRampRange = [r86, n45]); } } let Hx, qx, Xx, Zx, Wx; class Yx extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: Hx || (Hx = new Vo({ visibility: new Eo(Fo["layout_raster-particle"].visibility) })), paint: qx || (qx = new Vo({ "raster-particle-array-band": new Eo(Fo["paint_raster-particle"]["raster-particle-array-band"]), "raster-particle-count": new Eo(Fo["paint_raster-particle"]["raster-particle-count"]), "raster-particle-color": new Bo(Fo["paint_raster-particle"]["raster-particle-color"]), "raster-particle-max-speed": new Eo(Fo["paint_raster-particle"]["raster-particle-max-speed"]), "raster-particle-speed-factor": new Eo(Fo["paint_raster-particle"]["raster-particle-speed-factor"]), "raster-particle-fade-opacity-factor": new Eo(Fo["paint_raster-particle"]["raster-particle-fade-opacity-factor"]), "raster-particle-reset-rate-factor": new Eo(Fo["paint_raster-particle"]["raster-particle-reset-rate-factor"]), "raster-particle-elevation": new Eo(Fo["paint_raster-particle"]["raster-particle-elevation"]), "raster-particle-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._updateColorRamp(), this.lastInvalidatedAt = de3.now(); } _clear() { this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null), this.tileFramebuffer && (this.tileFramebuffer.destroy(), this.tileFramebuffer = null), this.particleFramebuffer && (this.particleFramebuffer.destroy(), this.particleFramebuffer = null); } onRemove(t45) { this.colorRampTexture && this.colorRampTexture.destroy(), this.tileFramebuffer && this.tileFramebuffer.destroy(), this.particleFramebuffer && this.particleFramebuffer.destroy(); } hasColorMap() { return !!this._transitionablePaint._values["raster-particle-color"].value.value; } getProgramIds() { return ["rasterParticle"]; } hasOffscreenPass() { return "none" !== this.visibility; } isDraped(t45) { return false; } _handleSpecialPaintPropertyUpdate(t45) { "raster-particle-color" !== t45 && "raster-particle-max-speed" !== t45 || (this._updateColorRamp(), this._invalidateAnimationState()), "raster-particle-count" === t45 && this._invalidateAnimationState(); } _updateColorRamp() { if (!this.hasColorMap()) return; const t45 = this._transitionablePaint._values["raster-particle-color"].value.expression, e57 = this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({ zoom: 0 }); this.colorRamp = bh({ expression: t45, evaluationKey: "rasterParticleSpeed", image: this.colorRamp, clips: [{ start: 0, end: e57 }], resolution: 256 }), this.colorRampTexture = null; } _invalidateAnimationState() { this.lastInvalidatedAt = de3.now(); } tileCoverLift() { return this.paint.get("raster-particle-elevation"); } } class Kx extends na { constructor(t45, e57) { super(t45, {}, e57, null), this.implementation = t45, t45.slot && (this.slot = t45.slot); } is3D(t45) { return "3d" === this.implementation.renderingMode; } hasOffscreenPass() { return void 0 !== this.implementation.prerender; } isDraped(t45) { return void 0 !== this.implementation.renderToTile; } shouldRedrape() { return !!this.implementation.shouldRerenderTiles && this.implementation.shouldRerenderTiles(); } recalculate() { } updateTransitions() { } hasTransition() { return false; } serialize() { } onAdd(t45) { this.implementation.onAdd && this.implementation.onAdd(t45, t45.painter.context.gl); } onRemove(t45) { this.implementation.onRemove && this.implementation.onRemove(t45, t45.painter.context.gl); } } function Jx(t45, e57, r86) { const n45 = [0, 0, 1], i26 = J3([]); return tt(i26, i26, r86 ? -It(t45) + Math.PI : It(t45)), Q4(i26, i26, -It(e57)), N4(n45, n45, i26), C5(n45, n45); } const Qx = { None: 0, Model: 1, Symbol: 2, FillExtrusion: 4 }; class tv { constructor(t45, e57, r86, n45) { this.message = (t45 ? `${t45}: ` : "") + r86, n45 && (this.identifier = n45), null != e57 && e57.__line__ && (this.line = e57.__line__); } } function ev(t45, e57) { const r86 = -1 === t45.indexOf("://"); try { return new URL(t45, r86 && e57 ? "http://example.com" : void 0), true; } catch (t46) { return false; } } class rv { constructor(t45, e57) { this.feature = t45, this.instancedDataOffset = e57, this.instancedDataCount = 0, this.rotation = [0, 0, 0], this.scale = [1, 1, 1], this.translation = [0, 0, 0]; } } class nv { constructor() { this.instancedDataArray = new Na(), this.instancesEvaluatedElevation = [], this.features = [], this.idToFeaturesIndex = {}; } } class iv { constructor(t45) { this.zoom = t45.zoom, this.canonical = t45.canonical, this.layers = t45.layers, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.projection = t45.projection, this.index = t45.index, this.worldview = t45.worldview, this.hasZoomDependentProperties = this.layers[0].isZoomDependent(), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.hasPattern = false, this.instancesPerModel = {}, this.validForExaggeration = 0, this.maxVerticalOffset = 0, this.maxScale = 0, this.maxHeight = 0, this.lookupDim = this.zoom > this.canonical.z + 1 ? 0 : this.zoom > this.canonical.z ? 256 : this.zoom > 15 ? 75 : 100, this.instanceCount = 0, this.terrainElevationMin = 0, this.terrainElevationMax = 0, this.validForDEMTile = { id: null, timestamp: 0 }, this.modelUris = [], this.modelsRequested = false, this.activeReplacements = [], this.replacementUpdateTime = 0, this.styleDefinedModelURLs = t45.styleDefinedModelURLs; } updateFootprints(t45, e57) { } populate(t45, e57, r86, n45) { this.tileToMeter = fu(r86); const i26 = this.layers[0]._featureFilter.needGeometry; this.lookup = new Uint8Array(this.lookupDim * this.lookupDim); for (const { feature: s18, id: o88, index: a46, sourceLayerIndex: l21 } of t45) { const t46 = null != o88 ? o88 : s18.properties && s18.properties.hasOwnProperty("id") ? s18.properties.id : void 0, u12 = Mu(s18, i26); if (!this.layers[0]._featureFilter.filter(new wo(this.zoom, { worldview: this.worldview }), u12, r86)) continue; const c28 = { id: t46, sourceLayerIndex: l21, index: a46, geometry: i26 ? u12.geometry : Au(s18, r86, n45), properties: s18.properties, type: s18.type, patterns: {} }, h8 = this.addFeature(c28, c28.geometry, u12); h8 && e57.featureIndex.insert(s18, c28.geometry, a46, l21, this.index, this.instancesPerModel[h8].instancedDataArray.length, Rn / 32); } this.lookup = null; } update(t45, e57, r86, n45) { for (const e58 in this.instancesPerModel) { const r87 = this.instancesPerModel[e58]; for (const e59 in t45) r87.idToFeaturesIndex.hasOwnProperty(e59) && (this.evaluate(r87.features[r87.idToFeaturesIndex[e59]], t45[e59], r87, true), this.uploaded = false); } this.maxHeight = 0; } updateZoomBasedPaintProperties() { if (!this.hasZoomDependentProperties) return false; let t45 = false; for (const e57 in this.instancesPerModel) { const r86 = this.instancesPerModel[e57]; for (const e58 of r86.features) { const n45 = this.layers[0], i26 = e58.feature, s18 = this.canonical, o88 = n45.paint.get("model-rotation").evaluate(i26, {}, s18), a46 = n45.paint.get("model-scale").evaluate(i26, {}, s18), l21 = n45.paint.get("model-translation").evaluate(i26, {}, s18); $4(e58.rotation, o88) && $4(e58.scale, a46) && $4(e58.translation, l21) || (this.evaluate(e58, e58.featureStates, r86, true), t45 = true); } } return t45; } updateReplacement(t45, e57, r86, n45) { if (e57.updateTime === this.replacementUpdateTime) return false; this.replacementUpdateTime = e57.updateTime; const i26 = e57.getReplacementRegionsForTile(t45.toUnwrapped(), true); if (Dp(this.activeReplacements, i26)) return false; this.activeReplacements = i26; let s18 = false; for (const e58 in this.instancesPerModel) { const i27 = this.instancesPerModel[e58], o88 = i27.instancedDataArray; for (const e59 of i27.features) { const i28 = e59.instancedDataOffset, a46 = e59.instancedDataCount; for (let e60 = 0; e60 < a46; e60++) { const a47 = 16 * (e60 + i28); let l21 = o88.float32[a47 + 0]; const u12 = l21 > Rn; l21 = u12 ? l21 - Rn : l21; const c28 = Math.floor(l21), h8 = o88.float32[a47 + 1]; let p9 = false; for (const e61 of this.activeReplacements) if (!Bp(e61, r86, Qx.Model, n45) && !(e61.min.x > c28 || c28 > e61.max.x || e61.min.y > h8 || h8 > e61.max.y) && (p9 = jp(Np(c28, h8, t45.canonical, e61.footprintTileId.canonical), e61.footprint), p9)) break; o88.float32[a47] = p9 ? l21 + Rn : l21, s18 = s18 || p9 !== u12; } } } return s18; } isEmpty() { for (const t45 in this.instancesPerModel) if (0 !== this.instancesPerModel[t45].instancedDataArray.length) return false; return true; } uploadPending() { return !this.uploaded; } upload(t45) { if (!this.uploaded) for (const e57 in this.instancesPerModel) { const r86 = this.instancesPerModel[e57]; r86.instancedDataArray.length < 0 || 0 === r86.instancedDataArray.length || (r86.instancedDataBuffer ? r86.instancedDataBuffer.updateData(r86.instancedDataArray) : r86.instancedDataBuffer = t45.createVertexBuffer(r86.instancedDataArray, Sf.members, true, void 0, this.instanceCount)); } this.uploaded = true; } destroy() { for (const t46 in this.instancesPerModel) { const e57 = this.instancesPerModel[t46]; 0 !== e57.instancedDataArray.length && e57.instancedDataBuffer && e57.instancedDataBuffer.destroy(); } const t45 = this.layers[0].modelManager; if (t45 && this.modelUris && this.modelsRequested) for (const e57 of this.modelUris) t45.removeModel(e57, "", true); } addFeature(t45, e57, r86) { const n45 = this.layers[0], i26 = n45.layout.get("model-id").evaluate(r86, {}, this.canonical); if (!i26) return Gt(`modelId is not evaluated for layer ${n45.id} and it is not going to get rendered.`), i26; (ev(i26, false) || void 0 !== this.styleDefinedModelURLs[i26]) && (this.modelUris.includes(i26) || this.modelUris.push(i26)), this.instancesPerModel[i26] || (this.instancesPerModel[i26] = new nv()); const s18 = this.instancesPerModel[i26], o88 = s18.instancedDataArray, a46 = new rv(r86, o88.length); for (const t46 of e57) for (const e58 of t46) { if (e58.x < 0 || e58.x >= Rn || e58.y < 0 || e58.y >= Rn) continue; if (0 !== this.lookupDim) { const t48 = (this.lookupDim - 1) / Rn, r87 = this.lookupDim * (e58.y * t48 | 0) + e58.x * t48 | 0; if (this.lookup) { if (0 !== this.lookup[r87]) continue; this.lookup[r87] = 1; } } this.instanceCount++; const t47 = o88.length; o88.resize(t47 + 1), s18.instancesEvaluatedElevation.push(0), o88.float32[16 * t47] = e58.x, o88.float32[16 * t47 + 1] = e58.y; } return a46.instancedDataCount = s18.instancedDataArray.length - a46.instancedDataOffset, a46.instancedDataCount > 0 && (t45.id && (s18.idToFeaturesIndex[t45.id] = s18.features.length), s18.features.push(a46), this.evaluate(a46, {}, s18, false)), i26; } getModelUris() { return this.modelUris; } evaluate(t45, e57, r86, n45) { const i26 = this.layers[0], s18 = t45.feature, o88 = this.canonical, a46 = t45.rotation = i26.paint.get("model-rotation").evaluate(s18, e57, o88), l21 = t45.scale = i26.paint.get("model-scale").evaluate(s18, e57, o88), u12 = t45.translation = i26.paint.get("model-translation").evaluate(s18, e57, o88), c28 = i26.paint.get("model-color").evaluate(s18, e57, o88); c28.a = i26.paint.get("model-color-mix-intensity").evaluate(s18, e57, o88); const h8 = []; this.maxVerticalOffset < u12[2] && (this.maxVerticalOffset = u12[2]), this.maxScale = Math.max(Math.max(this.maxScale, l21[0]), Math.max(l21[1], l21[2])), Ff(h8, a46, l21); const p9 = Math.round(100 * c28.a) + c28.b / 1.05; for (let e58 = 0; e58 < t45.instancedDataCount; ++e58) { const i27 = t45.instancedDataOffset + e58, s19 = 16 * i27, a47 = r86.instancedDataArray.float32; let l22 = 0; n45 && (l22 = a47[s19 + 6] - r86.instancesEvaluatedElevation[i27]); const d34 = 0 | a47[s19 + 1]; a47[s19] = (0 | a47[s19]) + c28.r / 1.05, a47[s19 + 1] = d34 + c28.g / 1.05, a47[s19 + 2] = p9, a47[s19 + 3] = 1 / (o88.z > 10 ? this.tileToMeter : fu(o88, d34)), a47[s19 + 4] = u12[0], a47[s19 + 5] = u12[1], a47[s19 + 6] = u12[2] + l22, a47[s19 + 7] = h8[0], a47[s19 + 8] = h8[1], a47[s19 + 9] = h8[2], a47[s19 + 10] = h8[4], a47[s19 + 11] = h8[5], a47[s19 + 12] = h8[6], a47[s19 + 13] = h8[8], a47[s19 + 14] = h8[9], a47[s19 + 15] = h8[10], r86.instancesEvaluatedElevation[i27] = u12[2]; } } } let sv, ov; Ws(iv, "ModelBucket", { omit: ["layers"] }), Ws(nv, "PerModelAttributes"), Ws(rv, "ModelFeature"); class av { constructor(t45, e57, r86) { this._demTile = t45, this._dem = this._demTile.dem, this._scale = e57, this._offset = r86; } static create(t45, e57, r86) { const n45 = r86 || t45.findDEMTileFor(e57); if (!n45 || !n45.dem) return; const i26 = n45.dem, s18 = n45.tileID, o88 = 1 << e57.canonical.z - s18.canonical.z; return new av(n45, i26.dim / Rn / o88, [(e57.canonical.x / o88 - s18.canonical.x) * i26.dim, (e57.canonical.y / o88 - s18.canonical.y) * i26.dim]); } tileCoordToPixel(t45, e57) { const r86 = e57 * this._scale + this._offset[1]; return new wt(Math.floor(t45 * this._scale + this._offset[0]), Math.floor(r86)); } getElevationAt(t45, e57, r86, n45) { const i26 = t45 * this._scale + this._offset[0], s18 = e57 * this._scale + this._offset[1], o88 = Math.floor(i26), a46 = Math.floor(s18), l21 = this._dem; return n45 = !!n45, r86 ? ur(ur(l21.get(o88, a46, n45), l21.get(o88, a46 + 1, n45), s18 - a46), ur(l21.get(o88 + 1, a46, n45), l21.get(o88 + 1, a46 + 1, n45), s18 - a46), i26 - o88) : l21.get(o88, a46, n45); } getElevationAtPixel(t45, e57, r86) { return this._dem.get(t45, e57, !!r86); } getMeterToDEM(t45) { return (1 << this._demTile.tileID.canonical.z) * ou(1, t45) * this._dem.stride; } } const lv = new Float32Array(262144), uv = new Uint8Array(262144); function cv(t45) { let e57 = 0; if (t45.meshes) for (const r86 of t45.meshes) e57 = Math.max(e57, r86.aabb.max[2]); if (t45.children) for (const r86 of t45.children) e57 = Math.max(e57, cv(r86)); return e57; } function hv(t45, e57, r86) { if (t45.meshes) for (const n45 of t45.meshes) { if (n45.aabb.min[0] === 1 / 0) continue; const i26 = Xu.applyTransform(n45.aabb, t45.matrix); r86.insert(e57, i26.min[0], i26.min[1], i26.max[0], i26.max[1]); } if (t45.children) for (const n45 of t45.children) hv(n45, e57, r86); } const pv = ["", "wall", "door", "roof", "window", "lamp", "logo"]; class dv { constructor(t45) { this.node = t45, this.evaluatedRMEA = [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [0.4, 1, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]], this.hiddenByReplacement = false, this.evaluatedTranslation = [0, 0, 0], this.evaluatedScale = [1, 1, 1], this.evaluatedColor = [], this.emissionHeightBasedParams = [], this.cameraCollisionOpacity = 1, this.feature = { type: "Point", id: t45.id, geometry: [], properties: { height: cv(t45) } }, this.aabb = this._getLocalBounds(), this.state = null; } _getLocalBounds() { if (!this.node.meshes) return new Xu([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]); if (!this.aabb) { let t45 = 0; const e57 = new Xu([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]); for (const r86 of this.node.meshes) this.node.lightMeshIndex !== t45 && (r86.transformedAabb = Xu.applyTransformFast(r86.aabb, this.node.matrix), e57.encapsulate(r86.transformedAabb)), t45++; this.aabb = e57; } return this.aabb; } } class fv { constructor(t45, e57, r86, n45, i26, s18, o88, a46) { this.id = r86, this.layers = t45, this.layerIds = this.layers.map(((t46) => t46.fqid)), this.stateDependentLayerIds = this.layers.filter(((t46) => t46.isStateDependent())).map(((t46) => t46.id)), this.modelTraits |= Of.CoordinateSpaceTile, this.uploaded = false, this.hasPattern = false, n45 && (this.modelTraits |= Of.HasMapboxMeshFeatures), i26 && (this.modelTraits |= Of.HasMeshoptCompression), this.zoom = -1, this.terrainExaggeration = 1, this.projection = { name: "mercator" }, this.replacementUpdateTime = 0, this.elevationReadFromZ = 255, this.brightness = s18, this.worldview = a46, this.dirty = true, this.needsUpload = false, this.filter = null, this.nodesInfo = []; for (const t46 of e57) this.nodesInfo.push(new dv(t46)), hv(t46, o88.featureIndexArray.length, o88.grid), o88.featureIndexArray.emplaceBack(this.nodesInfo.length - 1, 0, o88.bucketLayerIDs.length - 1, 0); this.states = {}; } updateFootprints(t45, e57) { for (const r86 of this.getNodesInfo()) { const n45 = r86.node; n45.footprint && e57.push({ footprint: n45.footprint, id: t45 }); } } update(t45) { const e57 = 0 !== Object.keys(t45).length; if (e57 && !this.stateDependentLayers.length) return; const r86 = e57 ? this.stateDependentLayers : this.layers; if (!_t(t45, this.states)) for (const e58 of r86) this.evaluate(e58, t45); this.states = structuredClone(t45); } populate() { console.log("populate 3D model bucket"); } uploadPending() { return !this.uploaded || this.needsUpload; } upload(t45) { if (!this.needsUpload) return; const e57 = this.getNodesInfo(); for (const r86 of e57) { const e58 = r86.node; this.uploaded ? this.updatePbrBuffer(e58) : $f(e58, t45, true); } for (const t46 of e57) Gf(t46.node); this.uploaded = true, this.needsUpload = false; } updatePbrBuffer(t45) { let e57 = false; if (!t45.meshes) return e57; for (const r86 of t45.meshes) r86.pbrBuffer && (r86.pbrBuffer.updateData(r86.featureArray), e57 = true); return e57; } needsReEvaluation(t45, e57, r86) { const n45 = t45.transform.projectionOptions, i26 = t45.style.getBrightness(), s18 = this.brightness !== i26; if (!this.uploaded || this.dirty || n45.name !== this.projection.name || mv(r86.paint.get("model-color").value, s18) || mv(r86.paint.get("model-color-mix-intensity").value, s18) || mv(r86.paint.get("model-roughness").value, s18) || mv(r86.paint.get("model-emissive-strength").value, s18) || mv(r86.paint.get("model-height-based-emissive-strength-multiplier").value, s18)) { this.projection = n45, this.brightness = i26; const t46 = this.getNodesInfo(); for (const e58 of t46) e58.state = null; return true; } return false; } evaluateTransform(t45, e57) { if (t45.transform.zoom === this.zoom) return; this.zoom = t45.transform.zoom; const r86 = this.getNodesInfo(), n45 = this.id.canonical; for (const t46 of r86) { const r87 = t46.feature; t46.evaluatedTranslation = e57.paint.get("model-translation").evaluate(r87, {}, n45), t46.evaluatedScale = e57.paint.get("model-scale").evaluate(r87, {}, n45); } } evaluate(t45, e57) { const r86 = this.getNodesInfo(); for (const n45 of r86) { if (!n45.node.meshes) continue; const r87 = n45.feature, i26 = e57 && e57[r87.id]; if (_t(i26, n45.state)) continue; n45.state = structuredClone(i26); const s18 = n45.node.meshes && n45.node.meshes[0].featureData, o88 = n45.evaluatedColor[2], a46 = n45.evaluatedRMEA[2], l21 = this.id.canonical; if (n45.hasTranslucentParts = false, s18) { for (let e58 = 0; e58 < pv.length; e58++) { const s19 = pv[e58]; s19.length && (r87.properties.part = s19); const o89 = t45.paint.get("model-color").evaluate(r87, i26, l21).toPremultipliedRenderColor(null), a47 = t45.paint.get("model-color-mix-intensity").evaluate(r87, i26, l21); n45.evaluatedColor[e58] = [o89.r, o89.g, o89.b, a47], n45.evaluatedRMEA[e58][0] = t45.paint.get("model-roughness").evaluate(r87, i26, l21), n45.evaluatedRMEA[e58][2] = t45.paint.get("model-emissive-strength").evaluate(r87, i26, l21), n45.evaluatedRMEA[e58][3] = o89.a, n45.emissionHeightBasedParams[e58] = t45.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r87, i26, l21), !n45.hasTranslucentParts && o89.a < 1 && (n45.hasTranslucentParts = true); } delete r87.properties.part, gv(n45, o88 !== n45.evaluatedColor[2] || a46 !== n45.evaluatedRMEA[2], this.modelTraits); } else n45.evaluatedRMEA[0][2] = t45.paint.get("model-emissive-strength").evaluate(r87, i26, l21); n45.evaluatedTranslation = t45.paint.get("model-translation").evaluate(r87, i26, l21), n45.evaluatedScale = t45.paint.get("model-scale").evaluate(r87, i26, l21), this.updatePbrBuffer(n45.node) || (this.needsUpload = true); } this.dirty = false; } elevationUpdate(t45, e57, r86, n45) { const i26 = t45.findDEMTileFor(r86); if (i26 && (i26.tileID.canonical !== this.terrainTile || e57 !== this.terrainExaggeration)) { if (i26.dem && i26.tileID.overscaledZ !== this.elevationReadFromZ) { this.elevationReadFromZ = i26.tileID.overscaledZ; const e58 = av.create(t45, r86, i26); if (!e58) return; this.modelTraits & Of.HasMapboxMeshFeatures && this.updateDEM(t45, e58, r86, n45); for (const t46 of this.getNodesInfo()) { const r87 = t46.node; if (!r87.footprint || !r87.footprint.vertices || !r87.footprint.vertices.length) continue; const n46 = r87.footprint.vertices; let i27 = e58.getElevationAt(n46[0].x, n46[0].y, true, true); for (let t47 = 1; t47 < n46.length; t47++) i27 = Math.min(i27, e58.getElevationAt(n46[t47].x, n46[t47].y, true, true)); r87.elevation = i27; } } this.terrainTile = i26.tileID.canonical, this.terrainExaggeration = e57; } } updateDEM(t45, e57, r86, n45) { let i26 = e57._dem._modifiedForSources[n45]; if (void 0 === i26 && (e57._dem._modifiedForSources[n45] = [], i26 = e57._dem._modifiedForSources[n45]), i26.includes(r86.canonical)) return; const s18 = e57._dem.dim; i26.push(r86.canonical); let o88 = false; for (const t46 of this.getNodesInfo()) { const r87 = t46.node; if (!r87.footprint || !r87.footprint.grid) continue; const n46 = r87.footprint.grid, i27 = e57.tileCoordToPixel(n46.min.x, n46.min.y), a46 = e57.tileCoordToPixel(n46.max.x, n46.max.y), l21 = Math.min(Math.min(s18 - a46.y, i27.x), Math.min(i27.y, s18 - a46.x)); if (l21 < 0) continue; const u12 = Tt2(l21, 2, 5); let c28 = Math.max(0, i27.x - u12), h8 = Math.max(0, i27.y - u12), p9 = Math.min(a46.x + u12, s18 - 1), d34 = Math.min(a46.y + u12, s18 - 1); for (let t47 = h8; t47 <= d34; ++t47) for (let e58 = c28; e58 <= p9; ++e58) uv[t47 * s18 + e58] = 255; let f8 = 0, m6 = 0; for (let t47 = 0; t47 < n46.cellsY; ++t47) for (let r88 = 0; r88 < n46.cellsX; ++r88) { if (!n46.cells[t47 * n46.cellsX + r88]) continue; const i28 = e57.tileCoordToPixel(n46.min.x + r88 / n46.xScale, n46.min.y + t47 / n46.yScale), o89 = e57.tileCoordToPixel(n46.min.x + (r88 + 1) / n46.xScale, n46.min.y + (t47 + 1) / n46.yScale); for (let t48 = i28.y; t48 <= Math.min(o89.y + 1, s18 - 1); ++t48) for (let r89 = i28.x; r89 <= Math.min(o89.x + 1, s18 - 1); ++r89) 255 === uv[t48 * s18 + r89] && (uv[t48 * s18 + r89] = 0, f8 += e57.getElevationAtPixel(r89, t48), m6++); } const y4 = f8 / m6; c28 = Math.max(1, i27.x - u12), h8 = Math.max(1, i27.y - u12), p9 = Math.min(a46.x + u12, s18 - 2), d34 = Math.min(a46.y + u12, s18 - 2), o88 = true; for (let t47 = h8; t47 <= d34; ++t47) for (let r88 = c28; r88 <= p9; ++r88) 0 === uv[t47 * s18 + r88] && (lv[t47 * s18 + r88] = e57._dem.set(r88, t47, y4)); for (let t47 = 1; t47 < u12; ++t47) { c28 = Math.max(1, i27.x - t47), h8 = Math.max(1, i27.y - t47), p9 = Math.min(a46.x + t47, s18 - 2), d34 = Math.min(a46.y + t47, s18 - 2); for (let r88 = h8; r88 <= d34; ++r88) for (let n47 = c28; n47 <= p9; ++n47) { const i28 = r88 * s18 + n47; if (255 === uv[i28]) { let o89 = 0, a47 = 0, l22 = -1, c29 = -1; for (let e58 = -1; e58 <= 1; ++e58) for (let i29 = -1; i29 <= 1; ++i29) { const u13 = (r88 + e58) * s18 + n47 + i29; if (uv[u13] >= t47) continue; const h9 = lv[u13], p10 = Math.abs(h9); p10 > a47 && (o89 = h9, a47 = p10, l22 = i29, c29 = e58); } if (a47 > 0.1) { const s19 = 1 - (t47 + 0.5 * Math.abs(l22 * c29)) / u12; let a48 = e57._dem.get(n47, r88) + o89 * s19; const h9 = e57._dem.get(n47 + l22, r88 + c29), p10 = e57._dem.get(n47 - l22, r88 - c29, true); (a48 - h9) * (a48 - p10) > 0 && (a48 = (h9 + p10) / 2), lv[i28] = e57._dem.set(n47, r88, a48), uv[i28] = t47; } } } } } o88 && (e57._demTile.needsDEMTextureUpload = true, e57._dem._timestamp = de3.now()); } setFilter(t45) { this.filter = t45 ? Lo(t45) : null; } getNodesInfo() { return this.filter ? this.nodesInfo.filter(((t45) => this.filter.filter(new wo(this.id.overscaledZ, { worldview: this.worldview }), t45.feature, this.id.canonical))) : this.nodesInfo; } destroy() { const t45 = this.getNodesInfo(); for (const e57 of t45) Gf(e57.node), Hf(e57.node); } isEmpty() { return !this.nodesInfo.length; } updateReplacement(t45, e57) { if (e57.updateTime === this.replacementUpdateTime) return; this.replacementUpdateTime = e57.updateTime; const r86 = e57.getReplacementRegionsForTile(t45.toUnwrapped()); for (const t46 of this.getNodesInfo()) { const e58 = t46.node.footprint; t46.hiddenByReplacement = !!e58 && !r86.find(((t47) => t47.footprint === e58)); } } getHeightAtTileCoord(t45, e57) { const r86 = [], n45 = [0, 0, 0], i26 = l20([]); for (const s18 of this.getNodesInfo()) { const o88 = s18.node.meshes[0], a46 = o88.transformedAabb; if (t45 < a46.min[0] || e57 < a46.min[1] || t45 > a46.max[0] || e57 > a46.max[1]) continue; if (true === s18.node.hidden) return { height: 1 / 0, maxHeight: s18.feature.properties.height, hidden: false, verticalScale: s18.evaluatedScale[2] }; u11(i26, s18.node.matrix), n45[0] = t45, n45[1] = e57, O3(n45, n45, i26); const l21 = (n45[0] - o88.aabb.min[0]) / (o88.aabb.max[0] - o88.aabb.min[0]) * Lf | 0, c28 = Math.min(63, (n45[1] - o88.aabb.min[1]) / (o88.aabb.max[1] - o88.aabb.min[1]) * Lf | 0) * Lf + Math.min(63, l21), h8 = o88.heightmap[c28]; if (!(h8 < 0 && s18.node.footprint)) { if (s18.hiddenByReplacement) return; return { height: h8, maxHeight: s18.feature.properties.height, hidden: false, verticalScale: s18.evaluatedScale[2] }; } if (s18.node.footprint.grid.query(new wt(t45, e57), new wt(t45, e57), r86), r86.length > 0) return { height: void 0, maxHeight: s18.feature.properties.height, hidden: s18.hiddenByReplacement, verticalScale: s18.evaluatedScale[2] }; } } } function mv(t45, e57) { return t45 instanceof Os && !t45.isLightConstant && e57; } function yv(t45, e57, r86, n45, i26, s18, o88, a46) { let l21 = (61440 & e57 | (61440 & e57) >> 4) >> 8, u12 = (3840 & e57 | (3840 & e57) >> 4) >> 4, c28 = 240 & e57 | (240 & e57) >> 4; r86[3] > 0 && (l21 = ur(l21, 255 * r86[0], r86[3]), u12 = ur(u12, 255 * r86[1], r86[3]), c28 = ur(c28, 255 * r86[2], r86[3])); const h8 = l21 << 8 | u12, p9 = c28 << 8 | Math.floor(255 * n45[3]), d34 = (function(t46) { const e58 = Tt2(t46, 0, 2); return Math.min(Math.round(0.5 * e58 * 255), 255); })(n45[2]) << 8 | 15 * n45[0] << 4 | 15 * n45[1], f8 = Tt2(i26[0], 0, 1), m6 = Tt2(i26[1], 0, 1), y4 = Tt2(i26[2], 0, 1), g9 = Tt2(i26[3], 0, 1); let x4, v8, b8, w4; if (f8 !== m6 && o88 !== s18 && m6 !== f8) { const t46 = o88 - s18; v8 = 1 / (t46 * (m6 - f8)), b8 = -(s18 + t46 * f8) / (t46 * (m6 - f8)); const e58 = Tt2(i26[4], -1, 1); w4 = Math.pow(10, e58), x4 = 255 * y4 << 8 | 255 * g9; } else x4 = 65535, v8 = 0, b8 = 1, w4 = 1; if (t45.emplaceBack(h8, p9, d34, x4, v8, b8, w4), a46) { const t46 = a46.length; a46.clear(); for (let e58 = 0; e58 < t46; e58++) a46.emplaceBack(h8, p9, d34, x4, v8, b8, w4); } } function gv(t45, e57, r86) { const n45 = t45.node; let i26 = 0; const s18 = r86 & Of.HasMeshoptCompression; for (const r87 of n45.meshes) { if (n45.lights && n45.lightMeshIndex === i26) continue; if (!r87.featureData) continue; r87.featureArray = new ja(), r87.featureArray.reserve(r87.featureData.length); let o88 = e57; for (const e58 of r87.featureData) { const i27 = s18 ? 65535 & e58 : e58 >> 16 & 65535, a46 = s18 ? e58 >> 16 & 65535 : 65535 & e58, l21 = (15 & a46) < 8 ? 15 & a46 : 0, u12 = t45.evaluatedRMEA[l21], c28 = t45.evaluatedColor[l21], h8 = t45.emissionHeightBasedParams[l21]; let p9; if (o88 && 2 === l21 && n45.lights && (p9 = new ja(), p9.resize(10 * n45.lights.length)), yv(r87.featureArray, i27, c28, u12, h8, r87.aabb.min[2], r87.aabb.max[2], p9), p9 && o88) { o88 = false; const t46 = n45.meshes[n45.lightMeshIndex]; t46.featureArray = p9, t46.featureArray._trim(); } } r87.featureArray._trim(), i26++; } } function xv(t45, e57, r86, n45) { const i26 = 1 << t45.z; e57.lat = lu((n45 / Rn + t45.y) / i26), e57.lng = au((r86 / Rn + t45.x) / i26); } function vv(t45, e57, r86, n45) { const i26 = t45.getNodesInfo()[e57]; if (!i26 || i26.hiddenByReplacement || !i26.node.meshes) return; let s18 = Number.MAX_VALUE; const o88 = i26.node, a46 = r86.tile, l21 = n45.calculatePosMatrix(a46.tileID.toUnwrapped(), n45.worldSize), u12 = i26.evaluatedScale; let d34 = 0; n45.elevation && o88.elevation && (d34 = o88.elevation * n45.elevation.exaggeration()), h7(l21, l21, [(o88.anchor ? o88.anchor[0] : 0) * (u12[0] - 1), (o88.anchor ? o88.anchor[1] : 0) * (u12[1] - 1), d34]), p8(l21, l21, u12); const f8 = r86.queryGeometry, m6 = f8.isPointQuery() ? f8.screenBounds : f8.screenGeometry, y4 = function(t46) { const e58 = c27([], l21, t46.matrix); c27(e58, n45.expandedFarZProjMatrix, e58); for (let r87 = 0; r87 < t46.meshes.length; ++r87) { const i27 = t46.meshes[r87]; if (r87 === t46.lightMeshIndex) continue; const o89 = Rf(m6, n45, e58, i27.aabb); null != o89 && (s18 = Math.min(o89, s18)); } if (t46.children) for (const e59 of t46.children) y4(e59); }; if (y4(o88), s18 === Number.MAX_VALUE) return; const g9 = new Ql(0, 0); return xv(a46.tileID.canonical, g9, i26.node.anchor[0], i26.node.anchor[1]), { intersectionZ: s18, position: g9, feature: i26.feature }; } Ws(fv, "Tiled3dModelBucket", { omit: ["layers"] }), Ws(dv, "Tiled3dModelFeature"); const bv = { circle: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: vc || (vc = new Vo({ "circle-sort-key": new To(Fo.layout_circle["circle-sort-key"]), "circle-elevation-reference": new Eo(Fo.layout_circle["circle-elevation-reference"]), visibility: new Eo(Fo.layout_circle.visibility) })), paint: bc4 || (bc4 = new Vo({ "circle-radius": new To(Fo.paint_circle["circle-radius"]), "circle-color": new To(Fo.paint_circle["circle-color"]), "circle-blur": new To(Fo.paint_circle["circle-blur"]), "circle-opacity": new To(Fo.paint_circle["circle-opacity"]), "circle-translate": new Eo(Fo.paint_circle["circle-translate"]), "circle-translate-anchor": new Eo(Fo.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new Eo(Fo.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new Eo(Fo.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new To(Fo.paint_circle["circle-stroke-width"]), "circle-stroke-color": new To(Fo.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new To(Fo.paint_circle["circle-stroke-opacity"]), "circle-emissive-strength": new Eo(Fo.paint_circle["circle-emissive-strength"]), "circle-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "circle-stroke-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45); } createBucket(t45) { return new Ju(t45); } queryRadius(t45) { const e57 = t45; return mc("circle-radius", this, e57) + mc("circle-stroke-width", this, e57) + yc(this.paint.get("circle-translate")); } queryIntersectsFeature(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = xc(this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), s18.angle, t45.pixelToTileUnitsFactor), u12 = this.paint.get("circle-radius").evaluate(e57, r86) + this.paint.get("circle-stroke-width").evaluate(e57, r86); return ih(t45, n45, s18, o88, a46, "map" === this.paint.get("circle-pitch-alignment"), "map" === this.paint.get("circle-pitch-scale"), l21, u12); } getProgramIds() { return ["circle"]; } getDefaultProgramParams(t45, e57, r86) { const n45 = nh(this); return { config: new Fl(this, { zoom: e57, lut: r86 }), defines: n45, overrideFog: false }; } is3D(t45) { return !t45 && !!this.layout && "none" !== this.layout.get("circle-elevation-reference"); } hasElevation() { return this.layout && "none" !== this.layout.get("circle-elevation-reference"); } }, heatmap: class extends na { createBucket(t45) { return new uh(t45); } constructor(t45, e57, r86, n45) { super(t45, { layout: ch || (ch = new Vo({ visibility: new Eo(Fo.layout_heatmap.visibility) })), paint: hh || (hh = new Vo({ "heatmap-radius": new To(Fo.paint_heatmap["heatmap-radius"]), "heatmap-weight": new To(Fo.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new Eo(Fo.paint_heatmap["heatmap-intensity"]), "heatmap-color": new Bo(Fo.paint_heatmap["heatmap-color"]), "heatmap-opacity": new Eo(Fo.paint_heatmap["heatmap-opacity"]), "heatmap-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._updateColorRamp(); } _handleSpecialPaintPropertyUpdate(t45) { "heatmap-color" === t45 && this._updateColorRamp(); } _updateColorRamp() { this.colorRamp = bh({ 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); } _clear() { this.heatmapFbo && (this.heatmapFbo.destroy(), this.heatmapFbo = null), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); } queryRadius(t45) { return mc("heatmap-radius", this, t45); } queryIntersectsFeature(t45, e57, r86, n45, i26, s18, o88, a46) { const l21 = this.paint.get("heatmap-radius").evaluate(e57, r86); return ih(t45, n45, s18, o88, a46, true, true, new wt(0, 0), l21); } hasOffscreenPass() { return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility; } getProgramIds() { return ["heatmap", "heatmapTexture"]; } getDefaultProgramParams(t45, e57, r86) { return "heatmap" === t45 ? { config: new Fl(this, { zoom: e57, lut: r86 }), overrideFog: false } : {}; } }, hillshade: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: ph || (ph = new Vo({ visibility: new Eo(Fo.layout_hillshade.visibility) })), paint: dh || (dh = new Vo({ "hillshade-illumination-direction": new Eo(Fo.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new Eo(Fo.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new Eo(Fo.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new Eo(Fo.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new Eo(Fo.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new Eo(Fo.paint_hillshade["hillshade-accent-color"]), "hillshade-emissive-strength": new Eo(Fo.paint_hillshade["hillshade-emissive-strength"]), "hillshade-shadow-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "hillshade-highlight-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "hillshade-accent-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45); } shouldRedrape() { return this.hasOffscreenPass() && "viewport" === this.paint.get("hillshade-illumination-anchor"); } hasOffscreenPass() { return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility; } getProgramIds() { return ["hillshade", "hillshadePrepare"]; } getDefaultProgramParams(t45, e57, r86) { return { overrideFog: false }; } }, fill: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: yp || (yp = new Vo({ "fill-sort-key": new To(Fo.layout_fill["fill-sort-key"]), visibility: new Eo(Fo.layout_fill.visibility), "fill-elevation-reference": new Eo(Fo.layout_fill["fill-elevation-reference"]), "fill-construct-bridge-guard-rail": new To(Fo.layout_fill["fill-construct-bridge-guard-rail"]) })), paint: gp || (gp = new Vo({ "fill-antialias": new Eo(Fo.paint_fill["fill-antialias"]), "fill-opacity": new To(Fo.paint_fill["fill-opacity"]), "fill-color": new To(Fo.paint_fill["fill-color"]), "fill-outline-color": new To(Fo.paint_fill["fill-outline-color"]), "fill-translate": new Eo(Fo.paint_fill["fill-translate"]), "fill-translate-anchor": new Eo(Fo.paint_fill["fill-translate-anchor"]), "fill-pattern": new To(Fo.paint_fill["fill-pattern"]), "fill-pattern-cross-fade": new Eo(Fo.paint_fill["fill-pattern-cross-fade"]), "fill-emissive-strength": new Eo(Fo.paint_fill["fill-emissive-strength"]), "fill-z-offset": new To(Fo.paint_fill["fill-z-offset"]), "fill-bridge-guard-rail-color": new To(Fo.paint_fill["fill-bridge-guard-rail-color"]), "fill-tunnel-structure-color": new To(Fo.paint_fill["fill-tunnel-structure-color"]), "fill-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "fill-outline-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "fill-bridge-guard-rail-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "fill-tunnel-structure-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45); } getProgramIds() { const t45 = this.paint.get("fill-pattern"), e57 = t45 && t45.constantOr(1), r86 = [e57 ? "fillPattern" : "fill"]; return this.paint.get("fill-antialias") && r86.push(e57 && !this.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline"), r86; } getDefaultProgramParams(t45, e57, r86) { return { config: new Fl(this, { zoom: e57, lut: r86 }), overrideFog: false }; } recalculate(t45, e57) { super.recalculate(t45, e57); const r86 = this.paint._values["fill-outline-color"]; "constant" === r86.value.kind && void 0 === r86.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]); } createBucket(t45) { return new mp(t45); } queryRadius() { return yc(this.paint.get("fill-translate")); } queryIntersectsFeature(t45, e57, r86, n45, i26, s18) { return !t45.queryGeometry.isAboveHorizon && ec(gc(t45.tilespaceGeometry, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), s18.angle, t45.pixelToTileUnitsFactor), n45); } isTileClipped() { return 0 === this.paint.get("fill-z-offset").constantOr(1); } is3D(t45) { if (0 !== this.paint.get("fill-z-offset").constantOr(1)) return true; const e57 = this.layout && "none" !== this.layout.get("fill-elevation-reference"); return null != t45 ? e57 && !t45 : e57; } hasElevation() { return this.layout && "none" !== this.layout.get("fill-elevation-reference"); } hasShadowPass() { return this.layout && "none" !== this.layout.get("fill-elevation-reference"); } }, "fill-extrusion": class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: bd2 || (bd2 = new Vo({ visibility: new Eo(Fo["layout_fill-extrusion"].visibility), "fill-extrusion-edge-radius": new Eo(Fo["layout_fill-extrusion"]["fill-extrusion-edge-radius"]) })), paint: wd || (wd = new Vo({ "fill-extrusion-opacity": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new To(Fo["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new To(Fo["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-pattern-cross-fade": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]), "fill-extrusion-height": new To(Fo["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new To(Fo["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-height-alignment": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-height-alignment"]), "fill-extrusion-base-alignment": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-base-alignment"]), "fill-extrusion-vertical-gradient": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]), "fill-extrusion-ambient-occlusion-intensity": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]), "fill-extrusion-ambient-occlusion-radius": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]), "fill-extrusion-ambient-occlusion-wall-radius": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]), "fill-extrusion-ambient-occlusion-ground-radius": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]), "fill-extrusion-ambient-occlusion-ground-attenuation": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]), "fill-extrusion-flood-light-color": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]), "fill-extrusion-flood-light-intensity": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]), "fill-extrusion-flood-light-wall-radius": new To(Fo["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]), "fill-extrusion-flood-light-ground-radius": new To(Fo["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]), "fill-extrusion-flood-light-ground-attenuation": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]), "fill-extrusion-vertical-scale": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]), "fill-extrusion-rounded-roof": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]), "fill-extrusion-cutoff-fade-range": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]), "fill-extrusion-emissive-strength": new To(Fo["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]), "fill-extrusion-line-width": new To(Fo["paint_fill-extrusion"]["fill-extrusion-line-width"]), "fill-extrusion-cast-shadows": new Eo(Fo["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]), "fill-extrusion-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "fill-extrusion-flood-light-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._stats = { numRenderedVerticesInShadowPass: 0, numRenderedVerticesInTransparentPass: 0 }; } createBucket(t45) { return new ud(t45); } queryRadius() { return yc(this.paint.get("fill-extrusion-translate")); } is3D(t45) { return true; } hasShadowPass() { return this.paint.get("fill-extrusion-cast-shadows"); } cutoffRange() { return this.paint.get("fill-extrusion-cutoff-fade-range"); } canCastShadows() { return true; } getProgramIds() { return [this.paint.get("fill-extrusion-pattern").constantOr(1) ? "fillExtrusionPattern" : "fillExtrusion"]; } queryIntersectsFeature(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = xc(this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), s18.angle, t45.pixelToTileUnitsFactor), c28 = this.paint.get("fill-extrusion-height").evaluate(e57, r86), h8 = this.paint.get("fill-extrusion-base").evaluate(e57, r86), p9 = [0, 0], d34 = a46 && s18.elevation, f8 = s18.elevation ? s18.elevation.exaggeration() : 1, m6 = t45.tile.getBucket(this); if (d34 && m6 instanceof ud) { const t46 = m6.centroidVertexArray, e58 = l21 + 1; e58 < t46.length && (p9[0] = t46.geta_centroid_pos0(e58), p9[1] = t46.geta_centroid_pos1(e58)); } if (0 === p9[0] && 1 === p9[1]) return false; "globe" === s18.projection.name && (n45 = xd([n45], [new wt(0, 0), new wt(Rn, Rn)], t45.tileID.canonical).map(((t46) => t46.polygon)).flat()); const y4 = d34 ? a46 : null, [g9, x4] = (function(t46, e58, r87, n46, i27, s19, o89, a47, l22, u13, c29) { return "globe" === t46.projection.name ? (function(t47, e59, r88, n47, i28, s20, o90, a48, l23, u14, c30) { const h9 = [], p10 = [], d35 = t47.projection.upVectorScale(c30, t47.center.lat, t47.worldSize).metersToTile, f9 = [0, 0, 0, 1], m7 = [0, 0, 0, 1], y5 = (t48, e60, r89, n48) => { t48[0] = e60, t48[1] = r89, t48[2] = n48, t48[3] = 1; }, g10 = gd(); r88 > 0 && (r88 += g10), n47 += g10; for (const g11 of e59) { const e60 = [], x5 = []; for (const h10 of g11) { const p11 = h10.x + i28.x, g12 = h10.y + i28.y, v9 = t47.projection.projectTilePoint(p11, g12, c30), b8 = t47.projection.upVector(c30, h10.x, h10.y); let w4 = r88, _4 = n47; if (o90) { const t48 = Td(p11, g12, r88, n47, o90, a48, l23, u14); w4 += t48.base, _4 += t48.top; } 0 !== r88 ? y5(f9, v9.x + b8[0] * d35 * w4, v9.y + b8[1] * d35 * w4, v9.z + b8[2] * d35 * w4) : y5(f9, v9.x, v9.y, v9.z), y5(m7, v9.x + b8[0] * d35 * _4, v9.y + b8[1] * d35 * _4, v9.z + b8[2] * d35 * _4), O3(f9, f9, s20), O3(m7, m7, s20), e60.push(new _d2(f9[0], f9[1], f9[2])), x5.push(new _d2(m7[0], m7[1], m7[2])); } h9.push(e60), p10.push(x5); } return [h9, p10]; })(t46, e58, r87, n46, i27, s19, o89, a47, l22, u13, c29) : o89 ? (function(t47, e59, r88, n47, i28, s20, o90, a48, l23) { const u14 = [], c30 = [], h9 = [0, 0, 0, 1]; for (const p10 of t47) { const t48 = [], d35 = []; for (const u15 of p10) { const c31 = u15.x + n47.x, p11 = u15.y + n47.y, f9 = Td(c31, p11, e59, r88, s20, o90, a48, l23); h9[0] = c31, h9[1] = p11, h9[2] = f9.base, h9[3] = 1, Y5(h9, h9, i28), h9[3] = Math.max(h9[3], 1e-5); const m7 = new _d2(h9[0] / h9[3], h9[1] / h9[3], h9[2] / h9[3]); h9[0] = c31, h9[1] = p11, h9[2] = f9.top, h9[3] = 1, Y5(h9, h9, i28), h9[3] = Math.max(h9[3], 1e-5); const y5 = new _d2(h9[0] / h9[3], h9[1] / h9[3], h9[2] / h9[3]); t48.push(m7), d35.push(y5); } u14.push(t48), c30.push(d35); } return [u14, c30]; })(e58, r87, n46, i27, s19, o89, a47, l22, u13) : (function(t47, e59, r88, n47, i28) { const s20 = [], o90 = [], a48 = i28[8] * e59, l23 = i28[9] * e59, u14 = i28[10] * e59, c30 = i28[11] * e59, h9 = i28[8] * r88, p10 = i28[9] * r88, d35 = i28[10] * r88, f9 = i28[11] * r88; for (const e60 of t47) { const t48 = [], r89 = []; for (const s21 of e60) { const e61 = s21.x + n47.x, o91 = s21.y + n47.y, m7 = i28[0] * e61 + i28[4] * o91 + i28[12], y5 = i28[1] * e61 + i28[5] * o91 + i28[13], g10 = i28[2] * e61 + i28[6] * o91 + i28[14], x5 = i28[3] * e61 + i28[7] * o91 + i28[15], v9 = m7 + a48, b8 = y5 + l23, w4 = g10 + u14, _4 = Math.max(x5 + c30, 1e-5), A4 = m7 + h9, M5 = y5 + p10, I4 = g10 + d35, S5 = Math.max(x5 + f9, 1e-5); t48.push(new _d2(v9 / _4, b8 / _4, w4 / _4)), r89.push(new _d2(A4 / S5, M5 / S5, I4 / S5)); } s20.push(t48), o90.push(r89); } return [s20, o90]; })(e58, r87, n46, i27, s19); })(s18, n45, h8, c28, u12, o88, y4, p9, f8, s18.center.lat, t45.tileID.canonical), v8 = t45.queryGeometry; return (function(t46, e58, r87) { let n46 = 1 / 0; ec(r87, e58) && (n46 = Ed(r87, e58[0])); for (let i27 = 0; i27 < e58.length; i27++) { const s19 = e58[i27], o89 = t46[i27]; for (let t47 = 0; t47 < s19.length - 1; t47++) { const e59 = s19[t47], i28 = [e59, s19[t47 + 1], o89[t47 + 1], o89[t47], e59]; Qu(r87, i28) && (n46 = Math.min(n46, Ed(r87, i28))); } } return n46 !== 1 / 0 && n46; })(g9, x4, v8.isPointQuery() ? v8.screenBounds : v8.screenGeometry); } }, building: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: xm || (xm = new Vo({ visibility: new Eo(Fo.layout_building.visibility), "building-facade": new To(Fo.layout_building["building-facade"]), "building-facade-floors": new To(Fo.layout_building["building-facade-floors"]), "building-facade-unit-width": new To(Fo.layout_building["building-facade-unit-width"]), "building-facade-window": new To(Fo.layout_building["building-facade-window"]), "building-roof-shape": new To(Fo.layout_building["building-roof-shape"]), "building-height": new To(Fo.layout_building["building-height"]), "building-base": new To(Fo.layout_building["building-base"]), "building-flood-light-wall-radius": new To(Fo.layout_building["building-flood-light-wall-radius"]), "building-flood-light-ground-radius": new To(Fo.layout_building["building-flood-light-ground-radius"]), "building-flip-roof-orientation": new To(Fo.layout_building["building-flip-roof-orientation"]) })), paint: vm || (vm = new Vo({ "building-opacity": new Eo(Fo.paint_building["building-opacity"]), "building-ambient-occlusion-intensity": new Eo(Fo.paint_building["building-ambient-occlusion-intensity"]), "building-ambient-occlusion-ground-intensity": new Eo(Fo.paint_building["building-ambient-occlusion-ground-intensity"]), "building-ambient-occlusion-ground-radius": new Eo(Fo.paint_building["building-ambient-occlusion-ground-radius"]), "building-ambient-occlusion-ground-attenuation": new Eo(Fo.paint_building["building-ambient-occlusion-ground-attenuation"]), "building-vertical-scale": new Eo(Fo.paint_building["building-vertical-scale"]), "building-cast-shadows": new Eo(Fo.paint_building["building-cast-shadows"]), "building-color": new To(Fo.paint_building["building-color"]), "building-emissive-strength": new To(Fo.paint_building["building-emissive-strength"]), "building-facade-emissive-chance": new Eo(Fo.paint_building["building-facade-emissive-chance"]), "building-cutoff-fade-range": new Eo(Fo.paint_building["building-cutoff-fade-range"]), "building-flood-light-color": new Eo(Fo.paint_building["building-flood-light-color"]), "building-flood-light-intensity": new Eo(Fo.paint_building["building-flood-light-intensity"]), "building-flood-light-ground-attenuation": new Eo(Fo.paint_building["building-flood-light-ground-attenuation"]), "building-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "building-flood-light-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._stats = { numRenderedVerticesInShadowPass: 0, numRenderedVerticesInTransparentPass: 0 }; } createBucket(t45) { return new ym(t45); } cutoffRange() { return this.paint.get("building-cutoff-fade-range"); } hasShadowPass() { return this.paint.get("building-cast-shadows"); } hasLightBeamPass() { return true; } canCastShadows() { return true; } is3D(t45) { return true; } }, line: class extends na { constructor(t45, e57, r86, n45) { const i26 = jm(); super(t45, i26, e57, r86, n45), i26.layout && (this.layout = new zo(i26.layout)), this.gradientVersion = 0, this.hasElevatedBuckets = false, this.hasNonElevatedBuckets = false; } _handleSpecialPaintPropertyUpdate(t45) { if ("line-gradient" === t45) { const t46 = this._transitionablePaint._values["line-gradient"].value.expression; this.stepInterpolant = t46._styleExpression && t46._styleExpression.expression instanceof Si, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER; } } gradientExpression() { return this._transitionablePaint._values["line-gradient"].value.expression; } widthExpression() { return this._transitionablePaint._values["line-width"].value.expression; } recalculate(t45, e57) { super.recalculate(t45, e57), this.paint._values["line-floorwidth"] = (() => { if (Gm) return Gm; const t46 = jm(); return Gm = new $m(t46.paint.properties["line-width"].specification), Gm.useIntegerZoom = true, Gm; })().possiblyEvaluate(this._transitioningPaint._values["line-width"].value, t45); } createBucket(t45) { return new Tm(t45); } getProgramIds() { return [this.paint.get("line-pattern").constantOr(1) ? "linePattern" : "line"]; } getDefaultProgramParams(t45, e57, r86) { const n45 = Om(this); return { config: new Fl(this, { zoom: e57, lut: r86 }), defines: n45, overrideFog: false }; } queryRadius(t45) { const e57 = t45, r86 = Hm(mc("line-width", this, e57), mc("line-gap-width", this, e57)), n45 = mc("line-offset", this, e57); return r86 / 2 + Math.abs(n45) + yc(this.paint.get("line-translate")); } queryIntersectsFeature(t45, e57, r86, n45, i26, s18) { if (t45.queryGeometry.isAboveHorizon) return false; const o88 = gc(t45.tilespaceGeometry, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), s18.angle, t45.pixelToTileUnitsFactor), a46 = t45.pixelToTileUnitsFactor / 2 * Hm(this.paint.get("line-width").evaluate(e57, r86), this.paint.get("line-gap-width").evaluate(e57, r86)), l21 = this.paint.get("line-offset").evaluate(e57, r86); return l21 && (n45 = (function(t46, e58) { const r87 = [], n46 = new wt(0, 0); for (let i27 = 0; i27 < t46.length; i27++) { const s19 = t46[i27], o89 = []; for (let t47 = 0; t47 < s19.length; t47++) { const r88 = s19[t47], i28 = s19[t47 + 1], a47 = 0 === t47 ? n46 : r88.sub(s19[t47 - 1])._unit()._perp(), l22 = t47 === s19.length - 1 ? n46 : i28.sub(r88)._unit()._perp(), u12 = a47._add(l22)._unit(); u12._mult(1 / (u12.x * l22.x + u12.y * l22.y)), o89.push(u12._mult(e58)._add(r88)); } r87.push(o89); } return r87; })(n45, l21 * t45.pixelToTileUnitsFactor)), (function(t46, e58, r87) { for (let n46 = 0; n46 < e58.length; n46++) { const i27 = e58[n46]; if (t46.length >= 3) { for (let e59 = 0; e59 < i27.length; e59++) if (cc2(t46, i27[e59])) return true; } if (rc(t46, i27, r87)) return true; } return false; })(o88, n45, a46); } isTileClipped() { return this.hasNonElevatedBuckets; } isDraped(t45) { return !this.hasElevatedBuckets || this.layout && "hd-road-markup" === this.layout.get("line-elevation-reference"); } hasElevation() { return this.layout && "none" !== this.layout.get("line-elevation-reference"); } }, symbol: Vx, background: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: Fx || (Fx = new Vo({ visibility: new Eo(Fo.layout_background.visibility) })), paint: Cx || (Cx = new Vo({ "background-pitch-alignment": new Eo(Fo.paint_background["background-pitch-alignment"]), "background-color": new Eo(Fo.paint_background["background-color"]), "background-pattern": new Eo(Fo.paint_background["background-pattern"]), "background-opacity": new Eo(Fo.paint_background["background-opacity"]), "background-emissive-strength": new Eo(Fo.paint_background["background-emissive-strength"]), "background-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45); } getProgramIds() { return [this.paint.get("background-pattern") ? "backgroundPattern" : "background"]; } getDefaultProgramParams(t45, e57, r86) { return { overrideFog: false }; } is3D(t45) { return "viewport" === this.paint.get("background-pitch-alignment"); } }, raster: Gx, "raster-particle": Yx, sky: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: Xx || (Xx = new Vo({ visibility: new Eo(Fo.layout_sky.visibility) })), paint: Zx || (Zx = new Vo({ "sky-type": new Eo(Fo.paint_sky["sky-type"]), "sky-atmosphere-sun": new Eo(Fo.paint_sky["sky-atmosphere-sun"]), "sky-atmosphere-sun-intensity": new Eo(Fo.paint_sky["sky-atmosphere-sun-intensity"]), "sky-gradient-center": new Eo(Fo.paint_sky["sky-gradient-center"]), "sky-gradient-radius": new Eo(Fo.paint_sky["sky-gradient-radius"]), "sky-gradient": new Bo(Fo.paint_sky["sky-gradient"]), "sky-atmosphere-halo-color": new Eo(Fo.paint_sky["sky-atmosphere-halo-color"]), "sky-atmosphere-color": new Eo(Fo.paint_sky["sky-atmosphere-color"]), "sky-opacity": new Eo(Fo.paint_sky["sky-opacity"]), "sky-gradient-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "sky-atmosphere-halo-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }), "sky-atmosphere-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._updateColorRamp(); } _clear() { this.skyboxFbo && (this.skyboxFbo.destroy(), this.skyboxFbo = null), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null), this._skyboxInvalidated = true; } _handleSpecialPaintPropertyUpdate(t45) { "sky-gradient" === t45 ? this._updateColorRamp() : "sky-atmosphere-sun" !== t45 && "sky-atmosphere-halo-color" !== t45 && "sky-atmosphere-color" !== t45 && "sky-atmosphere-sun-intensity" !== t45 || (this._skyboxInvalidated = true); } _updateColorRamp() { this.colorRamp = bh({ expression: this._transitionablePaint._values["sky-gradient"].value.expression, evaluationKey: "skyRadialProgress" }), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); } needsSkyboxCapture(t45) { if (this._skyboxInvalidated || !this.skyboxTexture || !this.skyboxGeometry) return true; if (!this.paint.get("sky-atmosphere-sun")) { const e57 = t45.style.light.properties.get("position"); return this._lightPosition.azimuthal !== e57.azimuthal || this._lightPosition.polar !== e57.polar; } return false; } getCenter(t45, e57) { if ("atmosphere" === this.paint.get("sky-type")) { const r87 = this.paint.get("sky-atmosphere-sun"), n45 = !r87, i26 = t45.style.light, s18 = i26.properties.get("position"); return n45 && "viewport" === i26.properties.get("anchor") && Gt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."), n45 ? Jx(s18.azimuthal, 90 - s18.polar, e57) : Jx(r87[0], 90 - r87[1], e57); } const r86 = this.paint.get("sky-gradient-center"); return Jx(r86[0], 90 - r86[1], e57); } isSky() { return true; } markSkyboxValid(t45) { this._skyboxInvalidated = false, this._lightPosition = t45.style.light.properties.get("position"); } hasOffscreenPass() { return true; } getProgramIds() { const t45 = this.paint.get("sky-type"); return "atmosphere" === t45 ? ["skyboxCapture", "skybox"] : "gradient" === t45 ? ["skyboxGradient"] : null; } }, slot: class extends na { constructor(t45, e57, r86, n45) { super(t45, { paint: Wx || (Wx = new Vo({})) }, e57, null); } }, model: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: sv || (sv = new Vo({ visibility: new Eo(Fo.layout_model.visibility), "model-id": new To(Fo.layout_model["model-id"]) })), paint: ov || (ov = new Vo({ "model-opacity": new To(Fo.paint_model["model-opacity"]), "model-rotation": new To(Fo.paint_model["model-rotation"]), "model-scale": new To(Fo.paint_model["model-scale"]), "model-translation": new To(Fo.paint_model["model-translation"]), "model-color": new To(Fo.paint_model["model-color"]), "model-color-mix-intensity": new To(Fo.paint_model["model-color-mix-intensity"]), "model-type": new Eo(Fo.paint_model["model-type"]), "model-cast-shadows": new Eo(Fo.paint_model["model-cast-shadows"]), "model-receive-shadows": new Eo(Fo.paint_model["model-receive-shadows"]), "model-ambient-occlusion-intensity": new Eo(Fo.paint_model["model-ambient-occlusion-intensity"]), "model-emissive-strength": new To(Fo.paint_model["model-emissive-strength"]), "model-roughness": new To(Fo.paint_model["model-roughness"]), "model-height-based-emissive-strength-multiplier": new To(Fo.paint_model["model-height-based-emissive-strength-multiplier"]), "model-cutoff-fade-range": new Eo(Fo.paint_model["model-cutoff-fade-range"]), "model-front-cutoff": new Eo(Fo.paint_model["model-front-cutoff"]), "model-elevation-reference": new Eo(Fo.paint_model["model-elevation-reference"]), "model-color-use-theme": new To({ type: "string", default: "default", "property-type": "data-driven" }) })) }, e57, r86, n45), this._stats = { numRenderedVerticesInShadowPass: 0, numRenderedVerticesInTransparentPass: 0 }; } createBucket(t45) { return new iv(t45); } getProgramIds() { return ["model"]; } is3D(t45) { return true; } hasShadowPass() { return true; } canCastShadows() { return true; } hasLightBeamPass() { return true; } cutoffRange() { return this.paint.get("model-cutoff-fade-range"); } queryRadius(t45) { return t45 instanceof fv ? Rn - 1 : 0; } queryIntersectsFeature(t45, e57, r86, n45, i26, s18) { if (!this.modelManager) return false; const o88 = this.modelManager, l21 = t45.tile.getBucket(this); if (!(l21 && l21 instanceof iv)) return false; for (const r87 in l21.instancesPerModel) { const n46 = l21.instancesPerModel[r87], i27 = void 0 !== e57.id ? e57.id : e57.properties && e57.properties.hasOwnProperty("id") ? e57.properties.id : void 0; if (n46.idToFeaturesIndex.hasOwnProperty(i27)) { const e58 = n46.features[n46.idToFeaturesIndex[i27]], u12 = o88.getModel(r87, this.scope); if (!u12) return false; let h8 = a45(); const p9 = new Ql(0, 0), d34 = l21.canonical; let f8 = Number.MAX_VALUE; for (let r88 = 0; r88 < e58.instancedDataCount; ++r88) { const i28 = 16 * (e58.instancedDataOffset + r88), o89 = n46.instancedDataArray.float32, a46 = [o89[i28 + 4], o89[i28 + 5], o89[i28 + 6]]; xv(d34, p9, o89[i28], 0 | o89[i28 + 1]), Uf(h8, u12, s18, p9, e58.rotation, e58.scale, a46, false, false, false), "globe" === s18.projection.name && (h8 = Df(h8, s18)); const l22 = c27([], s18.projMatrix, h8), m6 = t45.queryGeometry, y4 = Rf(m6.isPointQuery() ? m6.screenBounds : m6.screenGeometry, s18, l22, u12.aabb); null != y4 && (f8 = Math.min(y4, f8)); } return f8 !== Number.MAX_VALUE && f8; } } return false; } _handleOverridablePaintPropertyUpdate(t45, e57, r86) { return !(!this.layout || e57.isDataDriven() || r86.isDataDriven() || "model-color" !== t45 && "model-color-mix-intensity" !== t45 && "model-rotation" !== t45 && "model-scale" !== t45 && "model-translation" !== t45 && "model-emissive-strength" !== t45); } _isPropertyZoomDependent(t45) { const e57 = this._transitionablePaint._values[t45]; return null != e57 && null != e57.value && null != e57.value.expression && e57.value.expression instanceof Us; } isZoomDependent() { return this._isPropertyZoomDependent("model-scale") || this._isPropertyZoomDependent("model-rotation") || this._isPropertyZoomDependent("model-translation"); } }, clip: class extends na { constructor(t45, e57, r86, n45) { super(t45, { layout: xp || (xp = new Vo({ "clip-layer-types": new Eo(Fo.layout_clip["clip-layer-types"]), "clip-layer-scope": new Eo(Fo.layout_clip["clip-layer-scope"]) })), paint: vp || (vp = new Vo({})) }, e57, r86, n45); } recalculate(t45, e57) { super.recalculate(t45, e57); } createBucket(t45) { return new _p(t45); } is3D(t45) { return true; } } }, wv = new sr(0, 0, 0), _v = { PATH_RULE_NON_ZERO: 1, PATH_RULE_EVEN_ODD: 2 }, Av = { LINE_CAP_BUTT: 1, LINE_CAP_ROUND: 2, LINE_CAP_SQUARE: 3 }, Mv = { LINE_JOIN_MITER: 1, LINE_JOIN_MITER_CLIP: 2, LINE_JOIN_ROUND: 3, LINE_JOIN_BEVEL: 4 }, Iv = { PAINT_ORDER_FILL_AND_STROKE: 1 }, Sv = { PATH_COMMAND_MOVE: 1, PATH_COMMAND_LINE: 2, PATH_COMMAND_QUAD: 3, PATH_COMMAND_CUBIC: 4, PATH_COMMAND_CLOSE: 5 }, Pv = { MASK_TYPE_LUMINANCE: 1 }; function kv(t45, e57, r86) { 1 === t45 && e57.icons.push((function(t46, e58) { return (function(t47) { if (t47.usvg_tree.height || (t47.usvg_tree.height = t47.usvg_tree.width), !t47.metadata) return t47; const { metadata: e59 } = t47; if (e59.content_area) { const { content_area: r87 } = e59; null == r87.left && (r87.left = 0), null == r87.top && (r87.top = r87.left), null == r87.width && (r87.width = t47.usvg_tree.width), null == r87.height && (r87.height = r87.width); } if (e59.text_placeholder) { const { text_placeholder: t48 } = e59; null == t48.top && (t48.top = t48.left), null == t48.height && (t48.height = t48.width); } return e59.stretch_x && e59.stretch_x.length && zv(e59, "x"), e59.stretch_y && e59.stretch_y.length && zv(e59, "y"), t47; })(t46.readFields(Ev, { name: void 0 }, e58)); })(r86, r86.readVarint() + r86.pos)); } function zv(t45, e57) { const r86 = [], n45 = t45[`stretch_${e57}`]; let i26 = null; for (let t46 = 0; t46 < n45.length; t46++) null === i26 ? i26 = 0 === r86.length ? n45[0] : r86[r86.length - 1][1] + n45[t46] : (r86.push([i26, i26 + n45[t46]]), i26 = null); t45[`stretch_${e57}_areas`] = r86; } function Ev(t45, e57, r86) { 1 === t45 ? e57.name = r86.readString() : 2 === t45 ? e57.metadata = (function(t46, e58) { return t46.readFields(Tv, { stretch_x: null, stretch_y: null, stretch_x_areas: null, stretch_y_areas: null, variables: [] }, e58); })(r86, r86.readVarint() + r86.pos) : 3 === t45 && (e57.usvg_tree = (function(t46, e58) { return t46.readFields(Cv, { width: 20, children: [], linear_gradients: [], radial_gradients: [], clip_paths: [], masks: [] }, e58); })(r86, r86.readVarint() + r86.pos), e57.data = "usvg_tree"); } function Tv(t45, e57, r86) { 1 === t45 ? e57.stretch_x = r86.readPackedVarint() : 2 === t45 ? e57.stretch_y = r86.readPackedVarint() : 3 === t45 ? e57.content_area = Bv(r86, r86.readVarint() + r86.pos) : 4 === t45 ? e57.variables.push((function(t46, e58) { return t46.readFields(Fv, { name: void 0 }, e58); })(r86, r86.readVarint() + r86.pos)) : 5 === t45 && (e57.text_placeholder = Bv(r86, r86.readVarint() + r86.pos)); } function Bv(t45, e57) { return t45.readFields(Vv, {}, e57); } function Vv(t45, e57, r86) { 1 === t45 ? e57.left = r86.readVarint() : 2 === t45 ? e57.width = r86.readVarint() : 3 === t45 ? e57.top = r86.readVarint() : 4 === t45 && (e57.height = r86.readVarint()); } function Fv(t45, e57, r86) { 1 === t45 ? e57.name = r86.readString() : 2 === t45 && (e57.rgb_color = $v(r86.readVarint()), e57.value = "rgb_color"); } function Cv(t45, e57, r86) { 1 === t45 ? e57.width = e57.height = r86.readVarint() : 2 === t45 ? e57.height = r86.readVarint() : 3 === t45 ? e57.children.push(Dv(r86, r86.readVarint() + r86.pos)) : 4 === t45 ? e57.linear_gradients.push((function(t46, e58) { return t46.readFields(Hv, { spread_method: 1, stops: [], x1: 0, y1: 0, x2: 1, y2: 0 }, e58); })(r86, r86.readVarint() + r86.pos)) : 5 === t45 ? e57.radial_gradients.push((function(t46, e58) { return t46.readFields(Zv, { spread_method: 1, stops: [], cx: 0.5, cy: 0.5, r: 0.5, fx: 0.5, fy: 0.5, fr: 0 }, e58); })(r86, r86.readVarint() + r86.pos)) : 7 === t45 ? e57.clip_paths.push((function(t46, e58) { return t46.readFields(Wv, { children: [] }, e58); })(r86, r86.readVarint() + r86.pos)) : 8 === t45 && e57.masks.push((function(t46, e58) { const r87 = t46.readFields(Yv, { left: 0, width: 20, mask_type: Pv.MASK_TYPE_LUMINANCE, children: [] }, e58); return null == r87.height && (r87.height = r87.width), null == r87.top && (r87.top = r87.left), r87; })(r86, r86.readVarint() + r86.pos)); } function Dv(t45, e57) { return t45.readFields(Rv, {}, e57); } function Rv(t45, e57, r86) { 1 === t45 ? (e57.group = (function(t46, e58) { return t46.readFields(Lv, { opacity: 255, children: [] }, e58); })(r86, r86.readVarint() + r86.pos), e57.node = "group") : 2 === t45 && (e57.path = (function(t46, e58) { return t46.readFields(Nv, { paint_order: 1, commands: [], step: 1, diffs: [], rule: _v.PATH_RULE_NON_ZERO }, e58); })(r86, r86.readVarint() + r86.pos), e57.node = "path"); } function Lv(t45, e57, r86) { 1 === t45 ? e57.transform = Ov(r86, r86.readVarint() + r86.pos) : 2 === t45 ? e57.opacity = r86.readVarint() : 5 === t45 ? e57.clip_path_idx = r86.readVarint() : 6 === t45 ? e57.mask_idx = r86.readVarint() : 7 === t45 && e57.children.push(Dv(r86, r86.readVarint() + r86.pos)); } function Ov(t45, e57) { return t45.readFields(Uv, { sx: 1, ky: 0, kx: 0, sy: 1, tx: 0, ty: 0 }, e57); } function Uv(t45, e57, r86) { 1 === t45 ? e57.sx = r86.readFloat() : 2 === t45 ? e57.ky = r86.readFloat() : 3 === t45 ? e57.kx = r86.readFloat() : 4 === t45 ? e57.sy = r86.readFloat() : 5 === t45 ? e57.tx = r86.readFloat() : 6 === t45 && (e57.ty = r86.readFloat()); } function Nv(t45, e57, r86) { 1 === t45 ? e57.fill = (function(t46, e58) { return t46.readFields(jv, { rgb_color: wv, paint: "rgb_color", opacity: 255 }, e58); })(r86, r86.readVarint() + r86.pos) : 2 === t45 ? e57.stroke = (function(t46, e58) { return t46.readFields(Gv, { rgb_color: wv, paint: "rgb_color", dasharray: [], dashoffset: 0, miterlimit: 4, opacity: 255, width: 1, linecap: 1, linejoin: 1 }, e58); })(r86, r86.readVarint() + r86.pos) : 3 === t45 ? e57.paint_order = r86.readVarint() : 5 === t45 ? r86.readPackedVarint(e57.commands) : 6 === t45 ? e57.step = r86.readFloat() : 7 === t45 ? r86.readPackedSVarint(e57.diffs) : 8 === t45 && (e57.rule = r86.readVarint()); } function jv(t45, e57, r86) { 1 === t45 ? (e57.rgb_color = $v(r86.readVarint()), e57.paint = "rgb_color") : 2 === t45 ? (e57.linear_gradient_idx = r86.readVarint(), e57.paint = "linear_gradient_idx") : 3 === t45 ? (e57.radial_gradient_idx = r86.readVarint(), e57.paint = "radial_gradient_idx") : 5 === t45 && (e57.opacity = r86.readVarint()); } function $v(t45) { return new sr((t45 >> 16 & 255) / 255, (t45 >> 8 & 255) / 255, (255 & t45) / 255, 1); } function Gv(t45, e57, r86) { 1 === t45 ? (e57.rgb_color = $v(r86.readVarint()), e57.paint = "rgb_color") : 2 === t45 ? (e57.linear_gradient_idx = r86.readVarint(), e57.paint = "linear_gradient_idx") : 3 === t45 ? (e57.radial_gradient_idx = r86.readVarint(), e57.paint = "radial_gradient_idx") : 5 === t45 ? r86.readPackedFloat(e57.dasharray) : 6 === t45 ? e57.dashoffset = r86.readFloat() : 7 === t45 ? e57.miterlimit = r86.readFloat() : 8 === t45 ? e57.opacity = r86.readVarint() : 9 === t45 ? e57.width = r86.readFloat() : 10 === t45 ? e57.linecap = r86.readVarint() : 11 === t45 && (e57.linejoin = r86.readVarint()); } function Hv(t45, e57, r86) { 1 === t45 ? e57.transform = Ov(r86, r86.readVarint() + r86.pos) : 2 === t45 ? e57.spread_method = r86.readVarint() : 3 === t45 ? e57.stops.push(qv(r86, r86.readVarint() + r86.pos)) : 4 === t45 ? e57.x1 = r86.readFloat() : 5 === t45 ? e57.y1 = r86.readFloat() : 6 === t45 ? e57.x2 = r86.readFloat() : 7 === t45 && (e57.y2 = r86.readFloat()); } function qv(t45, e57) { return t45.readFields(Xv, { offset: 0, opacity: 255, rgb_color: wv }, e57); } function Xv(t45, e57, r86) { 1 === t45 ? e57.offset = r86.readFloat() : 2 === t45 ? e57.opacity = r86.readVarint() : 3 === t45 && (e57.rgb_color = $v(r86.readVarint())); } function Zv(t45, e57, r86) { 1 === t45 ? e57.transform = Ov(r86, r86.readVarint() + r86.pos) : 2 === t45 ? e57.spread_method = r86.readVarint() : 3 === t45 ? e57.stops.push(qv(r86, r86.readVarint() + r86.pos)) : 4 === t45 ? e57.cx = r86.readFloat() : 5 === t45 ? e57.cy = r86.readFloat() : 6 === t45 ? e57.r = r86.readFloat() : 7 === t45 ? e57.fx = r86.readFloat() : 8 === t45 ? e57.fy = r86.readFloat() : 9 === t45 && (e57.fr = r86.readFloat()); } function Wv(t45, e57, r86) { 1 === t45 ? e57.transform = Ov(r86, r86.readVarint() + r86.pos) : 2 === t45 ? e57.clip_path_idx = r86.readVarint() : 3 === t45 && e57.children.push(Dv(r86, r86.readVarint() + r86.pos)); } function Yv(t45, e57, r86) { 1 === t45 ? e57.left = e57.top = r86.readFloat() : 2 === t45 ? e57.width = e57.height = r86.readFloat() : 3 === t45 ? e57.top = r86.readFloat() : 4 === t45 ? e57.height = r86.readFloat() : 5 === t45 ? e57.mask_type = r86.readVarint() : 6 === t45 ? e57.mask_idx = r86.readVarint() : 7 === t45 && e57.children.push(Dv(r86, r86.readVarint() + r86.pos)); } class Kv { static calculate(t45 = {}, e57 = []) { const r86 = /* @__PURE__ */ new Map(), n45 = /* @__PURE__ */ new Map(); if (0 === Object.keys(t45).length) return r86; e57.forEach(((t46) => { n45.set(t46.name, t46.rgb_color || new sr(0, 0, 0)); })); for (const [e58, i26] of Object.entries(t45)) n45.has(e58) ? r86.set(n45.get(e58).toString(), i26) : console.warn(`Ignoring unknown image variable "${e58}"`); return r86; } } function Jv(t45, e57 = 255, r86) { const n45 = e57 / 255, i26 = t45.toString(), s18 = r86.has(i26) ? r86.get(i26).clone() : t45.clone(); return s18.a *= n45, s18.toString(); } function Qv(t45, e57) { if (!pe()) { const r86 = document.createElement("canvas"); return r86.width = t45, r86.height = e57, r86; } return new OffscreenCanvas(t45, e57); } function tb(t45, e57) { const r86 = Kv.calculate(e57.params, t45.metadata ? t45.metadata.variables : []), n45 = t45.usvg_tree, i26 = n45.width, s18 = n45.height, o88 = e57.transform ? e57.transform : new DOMMatrix(), a46 = Math.max(1, Math.round(i26 * o88.a)), l21 = Math.max(1, Math.round(s18 * o88.d)), u12 = new DOMMatrix([a46 / i26, 0, 0, l21 / s18, 0, 0]), c28 = Qv(a46, l21).getContext("2d"); return eb2(c28, u12, n45, n45, r86), c28.getImageData(0, 0, a46, l21); } function eb2(t45, e57, r86, n45, i26) { for (const s18 of n45.children) rb(t45, e57, r86, s18, i26); } function rb(t45, e57, r86, n45, i26) { n45.group ? (t45.save(), (function(t46, e58, r87, n46, i27) { const s18 = null != n46.mask_idx ? r87.masks[n46.mask_idx] : null, o88 = null != n46.clip_path_idx ? r87.clip_paths[n46.clip_path_idx] : null; if (n46.transform && (e58 = hb(n46.transform).preMultiplySelf(e58)), !(function(t47, e59, r88) { return 255 !== t47.opacity || e59 || r88; })(n46, null != o88, null != s18)) return void eb2(t46, e58, r87, n46, i27); const a46 = Qv(t46.canvas.width, t46.canvas.height), l21 = a46.getContext("2d"); eb2(l21, e58, r87, n46, i27), o88 && ub(l21, e58, r87, o88), s18 && cb(l21, e58, r87, s18, i27), t46.globalAlpha = n46.opacity / 255, t46.drawImage(a46, 0, 0); })(t45, e57, r86, n45.group, i26), t45.restore()) : n45.path && (t45.save(), (function(t46, e58, r87, n46, i27) { t46.setTransform(e58), n46.paint_order === Iv.PAINT_ORDER_FILL_AND_STROKE ? (nb(t46, r87, n46, i27), sb(t46, r87, n46, i27)) : (sb(t46, r87, n46, i27), nb(t46, r87, n46, i27)); })(t45, e57, r86, n45.path, i26), t45.restore()); } function nb(t45, e57, r86, n45) { const i26 = r86.fill; if (!i26) return; const s18 = i26.opacity / 255; switch (t45.save(), t45.beginPath(), pb(r86, t45), i26.paint) { case "rgb_color": t45.fillStyle = Jv(i26.rgb_color, i26.opacity, n45); break; case "linear_gradient_idx": { const r87 = e57.linear_gradients[i26.linear_gradient_idx]; r87.transform && t45.setTransform(hb(r87.transform).preMultiplySelf(t45.getTransform())), t45.fillStyle = ob(t45, r87, s18, n45); break; } case "radial_gradient_idx": { const r87 = e57.radial_gradients[i26.radial_gradient_idx]; r87.transform && t45.setTransform(hb(r87.transform).preMultiplySelf(t45.getTransform())), t45.fillStyle = ab4(t45, r87, s18, n45); } } t45.fill(ib(r86)), t45.restore(); } function ib(t45) { return t45.rule === _v.PATH_RULE_NON_ZERO ? "nonzero" : t45.rule === _v.PATH_RULE_EVEN_ODD ? "evenodd" : void 0; } function sb(t45, e57, r86, n45) { const i26 = r86.stroke; if (!i26) return; const s18 = db(r86); t45.lineWidth = i26.width, t45.miterLimit = i26.miterlimit, t45.setLineDash(i26.dasharray), t45.lineDashOffset = i26.dashoffset; const o88 = i26.opacity / 255; switch (i26.paint) { case "rgb_color": t45.strokeStyle = Jv(i26.rgb_color, i26.opacity, n45); break; case "linear_gradient_idx": t45.strokeStyle = ob(t45, e57.linear_gradients[i26.linear_gradient_idx], o88, n45, true); break; case "radial_gradient_idx": t45.strokeStyle = ab4(t45, e57.radial_gradients[i26.radial_gradient_idx], o88, n45, true); } switch (i26.linejoin) { case Mv.LINE_JOIN_MITER_CLIP: case Mv.LINE_JOIN_MITER: t45.lineJoin = "miter"; break; case Mv.LINE_JOIN_ROUND: t45.lineJoin = "round"; break; case Mv.LINE_JOIN_BEVEL: t45.lineJoin = "bevel"; } switch (i26.linecap) { case Av.LINE_CAP_BUTT: t45.lineCap = "butt"; break; case Av.LINE_CAP_ROUND: t45.lineCap = "round"; break; case Av.LINE_CAP_SQUARE: t45.lineCap = "square"; } t45.stroke(s18); } function ob(t45, e57, r86, n45, i26 = false) { if (1 === e57.stops.length) { const t46 = e57.stops[0]; return Jv(t46.rgb_color, t46.opacity * r86, n45); } const { x1: s18, y1: o88, x2: a46, y2: l21 } = e57; let u12 = new DOMPoint(s18, o88), c28 = new DOMPoint(a46, l21); if (i26) { const t46 = hb(e57.transform); u12 = t46.transformPoint(u12), c28 = t46.transformPoint(c28); } const h8 = t45.createLinearGradient(u12.x, u12.y, c28.x, c28.y); for (const t46 of e57.stops) h8.addColorStop(t46.offset, Jv(t46.rgb_color, t46.opacity * r86, n45)); return h8; } function ab4(t45, e57, r86, n45, i26 = false) { if (1 === e57.stops.length) { const t46 = e57.stops[0]; return Jv(t46.rgb_color, t46.opacity * r86, n45); } const s18 = hb(e57.transform), { fx: o88, fy: a46, fr: l21, cx: u12, cy: c28, r: h8 } = e57; let p9 = new DOMPoint(o88, a46), d34 = new DOMPoint(u12, c28), f8 = l21, m6 = h8; if (i26) { p9 = s18.transformPoint(p9), d34 = s18.transformPoint(d34); const t46 = (s18.a + s18.d) / 2; f8 = l21 * t46, m6 = e57.r * t46; } const y4 = t45.createRadialGradient(p9.x, p9.y, f8, d34.x, d34.y, m6); for (const t46 of e57.stops) y4.addColorStop(t46.offset, Jv(t46.rgb_color, t46.opacity * r86, n45)); return y4; } function lb(t45, e57, r86, n45) { const i26 = n45.transform ? hb(n45.transform).preMultiplySelf(e57) : e57, s18 = Qv(t45.canvas.width, t45.canvas.height), o88 = s18.getContext("2d"); for (const t46 of n45.children) if (t46.group) lb(o88, i26, r86, t46.group); else if (t46.path) { const e58 = t46.path, r87 = new Path2D(); r87.addPath(db(e58), i26), o88.fill(r87, ib(e58)); } const a46 = null != n45.clip_path_idx ? r86.clip_paths[n45.clip_path_idx] : null; a46 && ub(o88, i26, r86, a46), t45.globalCompositeOperation = "source-over", t45.drawImage(s18, 0, 0); } function ub(t45, e57, r86, n45) { const i26 = Qv(t45.canvas.width, t45.canvas.height); lb(i26.getContext("2d"), e57, r86, n45), t45.globalCompositeOperation = "destination-in", t45.drawImage(i26, 0, 0); } function cb(t45, e57, r86, n45, i26) { if (0 === n45.children.length) return; const s18 = null != n45.mask_idx ? r86.masks[n45.mask_idx] : null; s18 && cb(t45, e57, r86, s18, i26); const o88 = t45.canvas.width, a46 = t45.canvas.height, l21 = Qv(o88, a46), u12 = l21.getContext("2d"), c28 = n45.width, h8 = n45.height, p9 = n45.left, d34 = n45.top, f8 = new Path2D(), m6 = new Path2D(); m6.rect(p9, d34, c28, h8), f8.addPath(m6, e57), u12.clip(f8); for (const t46 of n45.children) rb(u12, e57, r86, t46, i26); const y4 = u12.getImageData(0, 0, o88, a46), g9 = y4.data; if (n45.mask_type === Pv.MASK_TYPE_LUMINANCE) for (let t46 = 0; t46 < g9.length; t46 += 4) g9[t46 + 3] = g9[t46 + 3] / 255 * (0.2126 * g9[t46] + 0.7152 * g9[t46 + 1] + 0.0722 * g9[t46 + 2]); u12.putImageData(y4, 0, 0), t45.globalCompositeOperation = "destination-in", t45.drawImage(l21, 0, 0); } function hb(t45) { return t45 ? new DOMMatrix([t45.sx, t45.ky, t45.kx, t45.sy, t45.tx, t45.ty]) : new DOMMatrix(); } function pb(t45, e57) { const r86 = t45.step; let n45 = t45.diffs[0] * r86, i26 = t45.diffs[1] * r86; e57.moveTo(n45, i26); for (let s18 = 0, o88 = 2; s18 < t45.commands.length; s18++) switch (t45.commands[s18]) { case Sv.PATH_COMMAND_MOVE: n45 += t45.diffs[o88++] * r86, i26 += t45.diffs[o88++] * r86, e57.moveTo(n45, i26); break; case Sv.PATH_COMMAND_LINE: n45 += t45.diffs[o88++] * r86, i26 += t45.diffs[o88++] * r86, e57.lineTo(n45, i26); break; case Sv.PATH_COMMAND_QUAD: { const s19 = n45 + t45.diffs[o88++] * r86, a46 = i26 + t45.diffs[o88++] * r86; n45 = s19 + t45.diffs[o88++] * r86, i26 = a46 + t45.diffs[o88++] * r86, e57.quadraticCurveTo(s19, a46, n45, i26); break; } case Sv.PATH_COMMAND_CUBIC: { const s19 = n45 + t45.diffs[o88++] * r86, a46 = i26 + t45.diffs[o88++] * r86, l21 = s19 + t45.diffs[o88++] * r86, u12 = a46 + t45.diffs[o88++] * r86; n45 = l21 + t45.diffs[o88++] * r86, i26 = u12 + t45.diffs[o88++] * r86, e57.bezierCurveTo(s19, a46, l21, u12, n45, i26); break; } case Sv.PATH_COMMAND_CLOSE: e57.closePath(); } return e57; } function db(t45) { return pb(t45, new Path2D()); } class fb { constructor(t45) { this.capacity = t45, this.cache = /* @__PURE__ */ new Map(); } get(t45) { if (!this.cache.has(t45)) return; const e57 = this.cache.get(t45); return this.cache.delete(t45), this.cache.set(t45, e57), e57; } put(t45, e57) { this.cache.has(t45) ? this.cache.delete(t45) : this.cache.size === this.capacity && this.cache.delete(this.cache.keys().next().value), this.cache.set(t45, e57); } delete(t45) { this.cache.delete(t45); } } Ws(fb, "LRUCache"); class mb { constructor() { this.cacheMap = /* @__PURE__ */ new Map(), this.cacheDependenciesMap = /* @__PURE__ */ new Map(); } static _getImage(t45) { return new xh(t45, t45.data); } getFromCache(t45, e57, r86) { return this.cacheMap.has(r86) || this.cacheMap.set(r86, new fb(150)), this.cacheMap.get(r86).get(Ko(t45.toString(), e57)); } setInCache(t45, e57, r86, n45) { this.cacheDependenciesMap.has(n45) || this.cacheDependenciesMap.set(n45, /* @__PURE__ */ new Map()), this.cacheMap.has(n45) || this.cacheMap.set(n45, new fb(150)); const i26 = this.cacheDependenciesMap.get(n45), s18 = Ko(t45.id.toString(), r86); i26.get(s18) || i26.set(s18, /* @__PURE__ */ new Set()); const o88 = this.cacheMap.get(n45), a46 = t45.toString(); i26.get(s18).add(a46), o88.put(Ko(t45.toString(), r86), e57); } removeImagesFromCacheByIds(t45, e57, r86 = 0) { if (!this.cacheMap.has(r86) || !this.cacheDependenciesMap.has(r86)) return; const n45 = this.cacheMap.get(r86), i26 = this.cacheDependenciesMap.get(r86); for (const r87 of t45) { const t46 = Ko(r87.toString(), e57); if (i26.has(t46)) { for (const e58 of i26.get(t46)) n45.delete(e58); i26.delete(t46); } } } rasterize(t45, e57, r86, n45, i26 = tb) { const s18 = this.getFromCache(t45, r86, n45); if (s18) return s18.clone(); const o88 = i26(e57.icon, t45.options), a46 = mb._getImage(o88); return this.setInCache(t45, a46, r86, n45), a46.clone(); } } class yb { constructor(t45) { this.size = t45, this.minimums = [], this.maximums = [], this.leaves = []; } getElevation(t45, e57) { const r86 = this.toIdx(t45, e57); return { min: this.minimums[r86], max: this.maximums[r86] }; } isLeaf(t45, e57) { return this.leaves[this.toIdx(t45, e57)]; } toIdx(t45, e57) { return e57 * this.size + t45; } } function gb(t45, e57, r86, n45) { let i26 = 0, s18 = Number.MAX_VALUE; for (let o88 = 0; o88 < 3; o88++) if (Math.abs(n45[o88]) < 1e-15) { if (r86[o88] < t45[o88] || r86[o88] > e57[o88]) return null; } else { const a46 = 1 / n45[o88]; let l21 = (t45[o88] - r86[o88]) * a46, u12 = (e57[o88] - r86[o88]) * a46; if (l21 > u12) { const t46 = l21; l21 = u12, u12 = t46; } if (l21 > i26 && (i26 = l21), u12 < s18 && (s18 = u12), i26 > s18) return null; } return i26; } function xb(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12, c28) { const h8 = n45 - t45, p9 = i26 - e57, d34 = s18 - r86, f8 = o88 - t45, m6 = a46 - e57, y4 = l21 - r86, g9 = c28[1] * y4 - c28[2] * m6, x4 = c28[2] * f8 - c28[0] * y4, v8 = c28[0] * m6 - c28[1] * f8, b8 = h8 * g9 + p9 * x4 + d34 * v8; if (Math.abs(b8) < 1e-15) return null; const w4 = 1 / b8, _4 = u12[0] - t45, A4 = u12[1] - e57, M5 = u12[2] - r86, I4 = (_4 * g9 + A4 * x4 + M5 * v8) * w4; if (I4 < 0 || I4 > 1) return null; const S5 = A4 * d34 - M5 * p9, P4 = M5 * h8 - _4 * d34, k7 = _4 * p9 - A4 * h8, z4 = (c28[0] * S5 + c28[1] * P4 + c28[2] * k7) * w4; return z4 < 0 || I4 + z4 > 1 ? null : (f8 * S5 + m6 * P4 + y4 * k7) * w4; } function vb(t45, e57, r86) { return (t45 - e57) / (r86 - e57); } function bb2(t45, e57, r86, n45, i26, s18, o88, a46, l21) { const u12 = 1 << r86, c28 = s18 - n45, h8 = o88 - i26, p9 = (t45 + 1) / u12 * c28 + n45, d34 = (e57 + 0) / u12 * h8 + i26, f8 = (e57 + 1) / u12 * h8 + i26; a46[0] = (t45 + 0) / u12 * c28 + n45, a46[1] = d34, l21[0] = p9, l21[1] = f8; } class wb { constructor(t45) { if (this.maximums = [], this.minimums = [], this.leaves = [], this.childOffsets = [], this.nodeCount = 0, this.dem = t45, this._siblingOffset = [[0, 0], [1, 0], [0, 1], [1, 1]], !this.dem) return; const e57 = (function(t46) { const e58 = Math.ceil(Math.log2(t46.dim / 8)), r87 = []; let n46 = Math.ceil(Math.pow(2, e58)); const i26 = 1 / n46, s18 = (t47, e59, r88, n47, i27) => { const s19 = n47 ? 1 : 0, o89 = (t47 + 1) * r88 - s19, a47 = e59 * r88, l21 = (e59 + 1) * r88 - s19; i27[0] = t47 * r88, i27[1] = a47, i27[2] = o89, i27[3] = l21; }; let o88 = new yb(n46); const a46 = []; for (let e59 = 0; e59 < n46 * n46; e59++) { s18(e59 % n46, Math.floor(e59 / n46), i26, false, a46); const r88 = Ab(a46[0], a46[1], t46), l21 = Ab(a46[2], a46[1], t46), u12 = Ab(a46[2], a46[3], t46), c28 = Ab(a46[0], a46[3], t46); o88.minimums.push(Math.min(r88, l21, u12, c28)), o88.maximums.push(Math.max(r88, l21, u12, c28)), o88.leaves.push(1); } for (r87.push(o88), n46 /= 2; n46 >= 1; n46 /= 2) { const t47 = r87[r87.length - 1]; o88 = new yb(n46); for (let e59 = 0; e59 < n46 * n46; e59++) { s18(e59 % n46, Math.floor(e59 / n46), 2, true, a46); const r88 = t47.getElevation(a46[0], a46[1]), i27 = t47.getElevation(a46[2], a46[1]), l21 = t47.getElevation(a46[2], a46[3]), u12 = t47.getElevation(a46[0], a46[3]), c28 = t47.isLeaf(a46[0], a46[1]), h8 = t47.isLeaf(a46[2], a46[1]), p9 = t47.isLeaf(a46[2], a46[3]), d34 = t47.isLeaf(a46[0], a46[3]), f8 = Math.min(r88.min, i27.min, l21.min, u12.min), m6 = Math.max(r88.max, i27.max, l21.max, u12.max), y4 = c28 && h8 && p9 && d34; o88.maximums.push(m6), o88.minimums.push(f8), o88.leaves.push(m6 - f8 <= 5 && y4 ? 1 : 0); } r87.push(o88); } return r87; })(this.dem), r86 = e57.length - 1, n45 = e57[r86]; this._addNode(n45.minimums[0], n45.maximums[0], n45.leaves[0]), this._construct(e57, 0, 0, r86, 0); } raycastRoot(t45, e57, r86, n45, i26, s18, o88 = 1) { return gb([t45, e57, -100], [r86, n45, this.maximums[0] * o88], i26, s18); } raycast(t45, e57, r86, n45, i26, s18, o88 = 1) { if (!this.nodeCount) return null; const a46 = this.raycastRoot(t45, e57, r86, n45, i26, s18, o88); if (null == a46) return null; const l21 = [], u12 = [], c28 = [], h8 = [], p9 = [{ idx: 0, t: a46, nodex: 0, nodey: 0, depth: 0 }]; for (; p9.length > 0; ) { const { idx: a47, t: d34, nodex: f8, nodey: m6, depth: y4 } = p9.pop(); if (this.leaves[a47]) { bb2(f8, m6, y4, t45, e57, r86, n45, c28, h8); const a48 = 1 << y4, l22 = (f8 + 0) / a48, u13 = (f8 + 1) / a48, p10 = (m6 + 0) / a48, g10 = (m6 + 1) / a48, x4 = Ab(l22, p10, this.dem) * o88, v8 = Ab(u13, p10, this.dem) * o88, b8 = Ab(u13, g10, this.dem) * o88, w4 = Ab(l22, g10, this.dem) * o88, _4 = xb(c28[0], c28[1], x4, h8[0], c28[1], v8, h8[0], h8[1], b8, i26, s18), A4 = xb(h8[0], h8[1], b8, c28[0], h8[1], w4, c28[0], c28[1], x4, i26, s18), M5 = Math.min(null !== _4 ? _4 : Number.MAX_VALUE, null !== A4 ? A4 : Number.MAX_VALUE); if (M5 !== Number.MAX_VALUE) return M5; { const t46 = T4([], i26, s18, d34); if (_b4(x4, v8, w4, b8, vb(t46[0], c28[0], h8[0]), vb(t46[1], c28[1], h8[1])) >= t46[2]) return d34; } continue; } let g9 = 0; for (let p10 = 0; p10 < this._siblingOffset.length; p10++) { bb2((f8 << 1) + this._siblingOffset[p10][0], (m6 << 1) + this._siblingOffset[p10][1], y4 + 1, t45, e57, r86, n45, c28, h8), c28[2] = -100, h8[2] = this.maximums[this.childOffsets[a47] + p10] * o88; const d35 = gb(c28, h8, i26, s18); if (null != d35) { const t46 = d35; l21[p10] = t46; let e58 = false; for (let r87 = 0; r87 < g9 && !e58; r87++) t46 >= l21[u12[r87]] && (u12.splice(r87, 0, p10), e58 = true); e58 || (u12[g9] = p10), g9++; } } for (let t46 = 0; t46 < g9; t46++) { const e58 = u12[t46]; p9.push({ idx: this.childOffsets[a47] + e58, t: l21[e58], nodex: (f8 << 1) + this._siblingOffset[e58][0], nodey: (m6 << 1) + this._siblingOffset[e58][1], depth: y4 + 1 }); } } return null; } _addNode(t45, e57, r86) { return this.minimums.push(t45), this.maximums.push(e57), this.leaves.push(r86), this.childOffsets.push(0), this.nodeCount++; } _construct(t45, e57, r86, n45, i26) { if (1 === t45[n45].isLeaf(e57, r86)) return; this.childOffsets[i26] || (this.childOffsets[i26] = this.nodeCount); const s18 = n45 - 1, o88 = t45[s18]; let a46 = 0, l21 = 0; for (let t46 = 0; t46 < this._siblingOffset.length; t46++) { const n46 = 2 * e57 + this._siblingOffset[t46][0], i27 = 2 * r86 + this._siblingOffset[t46][1], s19 = o88.getElevation(n46, i27), u12 = o88.isLeaf(n46, i27), c28 = this._addNode(s19.min, s19.max, u12); u12 && (a46 |= 1 << t46), l21 || (l21 = c28); } for (let n46 = 0; n46 < this._siblingOffset.length; n46++) a46 & 1 << n46 || this._construct(t45, 2 * e57 + this._siblingOffset[n46][0], 2 * r86 + this._siblingOffset[n46][1], s18, l21 + n46); } } function _b4(t45, e57, r86, n45, i26, s18) { return ur(ur(t45, r86, s18), ur(e57, n45, s18), i26); } function Ab(t45, e57, r86) { const n45 = r86.dim, i26 = Tt2(t45 * n45 - 0.5, 0, n45 - 1), s18 = Tt2(e57 * n45 - 0.5, 0, n45 - 1), o88 = Math.floor(i26), a46 = Math.floor(s18), l21 = Math.min(o88 + 1, n45 - 1), u12 = Math.min(a46 + 1, n45 - 1); return _b4(r86.get(o88, a46), r86.get(l21, a46), r86.get(o88, u12), r86.get(l21, u12), i26 - o88, s18 - a46); } const Mb = { mapbox: [6553.6, 25.6, 0.1, 1e4], terrarium: [256, 1, 1 / 256, 32768] }; function Ib(t45, e57, r86) { return (256 * t45 * 256 + 256 * e57 + r86) / 10 - 1e4; } function Sb(t45, e57, r86) { return 256 * t45 + e57 + r86 / 256 - 32768; } class Pb { get tree() { return this._tree || this._buildQuadTree(), this._tree; } constructor(t45, e57, r86, n45 = false) { if (this.uid = t45, e57.height !== e57.width) throw new RangeError("DEM tiles must be square"); if (r86 && "mapbox" !== r86 && "terrarium" !== r86) return void Gt(`"${r86}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`); this.stride = e57.height; const i26 = this.dim = e57.height - 2, s18 = new Uint32Array(e57.data.buffer); if (this.pixels = new Uint8Array(e57.data.buffer), this.floatView = new Float32Array(e57.data.buffer), this.borderReady = n45, this._modifiedForSources = {}, !n45) { for (let t46 = 0; t46 < i26; t46++) s18[this._idx(-1, t46)] = s18[this._idx(0, t46)], s18[this._idx(i26, t46)] = s18[this._idx(i26 - 1, t46)], s18[this._idx(t46, -1)] = s18[this._idx(t46, 0)], s18[this._idx(t46, i26)] = s18[this._idx(t46, i26 - 1)]; s18[this._idx(-1, -1)] = s18[this._idx(0, 0)], s18[this._idx(i26, -1)] = s18[this._idx(i26 - 1, 0)], s18[this._idx(-1, i26)] = s18[this._idx(0, i26 - 1)], s18[this._idx(i26, i26)] = s18[this._idx(i26 - 1, i26 - 1)]; } const o88 = "terrarium" === r86 ? Sb : Ib; for (let t46 = 0; t46 < s18.length; ++t46) { const e58 = 4 * t46; this.floatView[t46] = o88(this.pixels[e58], this.pixels[e58 + 1], this.pixels[e58 + 2]); } this._timestamp = de3.now(); } _buildQuadTree() { this._tree = new wb(this); } get(t45, e57, r86 = false) { r86 && (t45 = Tt2(t45, -1, this.dim), e57 = Tt2(e57, -1, this.dim)); const n45 = this._idx(t45, e57); return this.floatView[n45]; } set(t45, e57, r86) { const n45 = this._idx(t45, e57), i26 = this.floatView[n45]; return this.floatView[n45] = r86, r86 - i26; } static getUnpackVector(t45) { return Mb[t45]; } _idx(t45, e57) { if (t45 < -1 || t45 >= this.dim + 1 || e57 < -1 || e57 >= this.dim + 1) throw new RangeError("out of range source coordinates for DEM data"); return (e57 + 1) * this.stride + (t45 + 1); } static pack(t45, e57) { const r86 = [0, 0, 0, 0], n45 = Pb.getUnpackVector(e57); let i26 = Math.floor((t45 + n45[3]) / n45[2]); return r86[2] = i26 % 256, i26 = Math.floor(i26 / 256), r86[1] = i26 % 256, i26 = Math.floor(i26 / 256), r86[0] = i26, r86; } getPixels() { return new vh({ width: this.stride, height: this.stride }, this.pixels); } backfillBorder(t45, e57, r86) { if (this.dim !== t45.dim) throw new Error("dem dimension mismatch"); let n45 = e57 * this.dim, i26 = e57 * this.dim + this.dim, s18 = r86 * this.dim, o88 = r86 * this.dim + this.dim; switch (e57) { case -1: n45 = i26 - 1; break; case 1: i26 = n45 + 1; } switch (r86) { case -1: s18 = o88 - 1; break; case 1: o88 = s18 + 1; } const a46 = -e57 * this.dim, l21 = -r86 * this.dim; for (let e58 = s18; e58 < o88; e58++) for (let r87 = n45; r87 < i26; r87++) { const n46 = 4 * this._idx(r87, e58), i27 = 4 * this._idx(r87 + a46, e58 + l21); this.pixels[n46 + 0] = t45.pixels[i27 + 0], this.pixels[n46 + 1] = t45.pixels[i27 + 1], this.pixels[n46 + 2] = t45.pixels[i27 + 2], this.pixels[n46 + 3] = t45.pixels[i27 + 3]; } } onDeserialize() { this._tree && (this._tree.dem = this); } } function kb(t45, e57, r86) { 1 === t45 ? e57.headerLength = r86.readFixed32() : 2 === t45 ? e57.x = r86.readVarint() : 3 === t45 ? e57.y = r86.readVarint() : 4 === t45 ? e57.z = r86.readVarint() : 5 === t45 && e57.layers.push((function(t46, e58) { return t46.readFields(Vb, { version: 0, name: "", units: "", tileSize: 0, buffer: 0, pixelFormat: 0, dataIndex: [] }, e58); })(r86, r86.readVarint() + r86.pos)); } function zb(t45, e57, r86) { 1 === t45 ? (e57.delta_filter = (function(t46, e58) { return t46.readFields(Eb, { blockSize: 0 }, e58); })(r86, r86.readVarint() + r86.pos), e57.filter = "delta_filter") : 2 === t45 ? (r86.readVarint(), e57.filter = "zigzag_filter") : 3 === t45 ? (r86.readVarint(), e57.filter = "bitshuffle_filter") : 4 === t45 && (r86.readVarint(), e57.filter = "byteshuffle_filter"); } function Eb(t45, e57, r86) { 1 === t45 && (e57.blockSize = r86.readVarint()); } function Tb(t45, e57, r86) { 1 === t45 ? (r86.readVarint(), e57.codec = "gzip_data") : 2 === t45 ? (r86.readVarint(), e57.codec = "jpeg_image") : 3 === t45 ? (r86.readVarint(), e57.codec = "webp_image") : 4 === t45 && (r86.readVarint(), e57.codec = "png_image"); } function Bb(t45, e57, r86) { let n45 = 0, i26 = 0; 1 === t45 ? e57.firstByte = r86.readFixed64() : 2 === t45 ? e57.lastByte = r86.readFixed64() : 3 === t45 ? e57.filters.push((function(t46, e58) { return t46.readFields(zb, {}, e58); })(r86, r86.readVarint() + r86.pos)) : 4 === t45 ? e57.codec = (function(t46, e58) { return t46.readFields(Tb, {}, e58); })(r86, r86.readVarint() + r86.pos) : 5 === t45 ? i26 = r86.readFloat() : 6 === t45 ? n45 = r86.readFloat() : 7 === t45 ? e57.bands.push(r86.readString()) : 8 === t45 ? e57.offset = r86.readDouble() : 9 === t45 && (e57.scale = r86.readDouble()), 0 === e57.offset && (e57.offset = i26), 0 === e57.scale && (e57.scale = n45); } function Vb(t45, e57, r86) { 1 === t45 ? e57.version = r86.readVarint() : 2 === t45 ? e57.name = r86.readString() : 3 === t45 ? e57.units = r86.readString() : 4 === t45 ? e57.tileSize = r86.readVarint() : 5 === t45 ? e57.buffer = r86.readVarint() : 6 === t45 ? e57.pixelFormat = r86.readVarint() : 7 === t45 && e57.dataIndex.push((function(t46, e58) { return t46.readFields(Bb, { firstByte: 0, lastByte: 0, filters: [], codec: null, offset: 0, scale: 0, bands: [] }, e58); })(r86, r86.readVarint() + r86.pos)); } function Fb(t45, e57, r86) { if (2 === t45) !(function(t46, e58, r87) { t46.readFields(Cb, r87, e58); })(r86, r86.readVarint() + r86.pos, e57); else if (3 === t45) throw new Error("Not implemented"); } function Cb(t45, e57, r86) { if (1 === t45) { let t46 = 0; const n45 = r86.readVarint() + r86.pos; for (; r86.pos < n45; ) e57[t46++] = r86.readVarint(); } } function Db(t45, e57) { if (4 !== e57.length) throw new Error(`Expected data of dimension 4 but got ${e57.length}.`); let r86 = e57[3]; for (let n45 = 2; n45 >= 1; n45--) { const i26 = 1 === n45 ? 1 : 0, s18 = 2 === n45 ? 1 : 0; for (let n46 = 0; n46 < e57[0]; n46++) { const o88 = e57[1] * n46; for (let n47 = i26; n47 < e57[1]; n47++) { const i27 = e57[2] * (n47 + o88); for (let n48 = s18; n48 < e57[2]; n48++) { const s19 = e57[3] * (n48 + i27); for (let n49 = 0; n49 < e57[3]; n49++) { const e58 = s19 + n49; t45[e58] += t45[e58 - r86]; } } } } r86 *= e57[n45]; } return t45; } function Rb(t45) { for (let e57 = 0, r86 = t45.length; e57 < r86; e57++) t45[e57] = t45[e57] >>> 1 ^ -(1 & t45[e57]); return t45; } function Lb(t45, e57) { switch (e57) { case "uint32": return t45; case "uint16": for (let e58 = 0; e58 < t45.length; e58 += 2) { const r86 = t45[e58], n45 = t45[e58 + 1]; t45[e58] = (240 & r86) >> 4 | (61440 & r86) >> 8 | (240 & n45) << 4 | 61440 & n45, t45[e58 + 1] = 15 & r86 | (3840 & r86) >> 4 | (15 & n45) << 8 | (3840 & n45) << 4; } return t45; case "uint8": for (let e58 = 0; e58 < t45.length; e58 += 4) { const r86 = t45[e58], n45 = t45[e58 + 1], i26 = t45[e58 + 2], s18 = t45[e58 + 3]; t45[e58 + 0] = (192 & r86) >> 6 | (192 & n45) >> 4 | (192 & i26) >> 2 | 192 & s18, t45[e58 + 1] = (48 & r86) >> 4 | (48 & n45) >> 2 | 48 & i26 | (48 & s18) << 2, t45[e58 + 2] = (12 & r86) >> 2 | 12 & n45 | (12 & i26) << 2 | (12 & s18) << 4, t45[e58 + 3] = 3 & r86 | (3 & n45) << 2 | (3 & i26) << 4 | (3 & s18) << 6; } return t45; default: throw new Error(`Invalid pixel format, "${e57}"`); } } Ws(Pb, "DEMData"), Ws(wb, "DemMinMaxQuadTree", { omit: ["dem"] }); var Ob = Uint8Array, Ub = Uint16Array, Nb = Int32Array, jb = new Ob([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]), $b = new Ob([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]), Gb = new Ob([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Hb = function(t45, e57) { for (var r86 = new Ub(31), n45 = 0; n45 < 31; ++n45) r86[n45] = e57 += 1 << t45[n45 - 1]; var i26 = new Nb(r86[30]); for (n45 = 1; n45 < 30; ++n45) for (var s18 = r86[n45]; s18 < r86[n45 + 1]; ++s18) i26[s18] = s18 - r86[n45] << 5 | n45; return { b: r86, r: i26 }; }, qb = Hb(jb, 2), Xb = qb.b, Zb = qb.r; Xb[28] = 258, Zb[258] = 28; for (var Wb = Hb($b, 0).b, Yb = new Ub(32768), Kb = 0; Kb < 32768; ++Kb) { var Jb = (43690 & Kb) >> 1 | (21845 & Kb) << 1; Yb[Kb] = ((65280 & (Jb = (61680 & (Jb = (52428 & Jb) >> 2 | (13107 & Jb) << 2)) >> 4 | (3855 & Jb) << 4)) >> 8 | (255 & Jb) << 8) >> 1; } var Qb = function(t45, e57, r86) { for (var n45 = t45.length, i26 = 0, s18 = new Ub(e57); i26 < n45; ++i26) t45[i26] && ++s18[t45[i26] - 1]; var o88, a46 = new Ub(e57); for (i26 = 1; i26 < e57; ++i26) a46[i26] = a46[i26 - 1] + s18[i26 - 1] << 1; o88 = new Ub(1 << e57); var l21 = 15 - e57; for (i26 = 0; i26 < n45; ++i26) if (t45[i26]) for (var u12 = i26 << 4 | t45[i26], c28 = e57 - t45[i26], h8 = a46[t45[i26] - 1]++ << c28, p9 = h8 | (1 << c28) - 1; h8 <= p9; ++h8) o88[Yb[h8] >> l21] = u12; return o88; }, tw = new Ob(288); for (Kb = 0; Kb < 144; ++Kb) tw[Kb] = 8; for (Kb = 144; Kb < 256; ++Kb) tw[Kb] = 9; for (Kb = 256; Kb < 280; ++Kb) tw[Kb] = 7; for (Kb = 280; Kb < 288; ++Kb) tw[Kb] = 8; var ew = new Ob(32); for (Kb = 0; Kb < 32; ++Kb) ew[Kb] = 5; var rw = Qb(tw, 9), nw = Qb(ew, 5), iw = function(t45) { for (var e57 = t45[0], r86 = 1; r86 < t45.length; ++r86) t45[r86] > e57 && (e57 = t45[r86]); return e57; }, sw = function(t45, e57, r86) { var n45 = e57 / 8 | 0; return (t45[n45] | t45[n45 + 1] << 8) >> (7 & e57) & r86; }, ow = function(t45, e57) { var r86 = e57 / 8 | 0; return (t45[r86] | t45[r86 + 1] << 8 | t45[r86 + 2] << 16) >> (7 & e57); }, aw = ["unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler", , "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data"], lw = function(t45, e57, r86) { var n45 = new Error(e57 || aw[t45]); if (n45.code = t45, Error.captureStackTrace && Error.captureStackTrace(n45, lw), !r86) throw n45; return n45; }, uw = new Ob(0), cw = "undefined" != typeof TextDecoder && new TextDecoder(); try { cw.decode(uw, { stream: true }); } catch (t45) { } const hw = { gzip_data: "gzip" }; class pw extends Error { constructor(t45) { super(t45), this.name = "MRTError"; } } const dw = { 0: "uint32", 1: "uint32", 2: "uint16", 3: "uint8" }, fw = { uint32: 1, uint16: 2, uint8: 4 }, mw = { uint32: Uint32Array, uint16: Uint16Array, uint8: Uint8Array }; let yw; class gw { constructor(t45 = 5) { this.x = NaN, this.y = NaN, this.z = NaN, this.layers = {}, this._cacheSize = t45; } getLayer(t45) { const e57 = this.layers[t45]; if (!e57) throw new pw(`Layer '${t45}' not found`); return e57; } getHeaderLength(t45) { const e57 = new Uint8Array(t45), r86 = new DataView(t45); if (13 !== e57[0]) throw new pw("File is not a valid MRT."); return r86.getUint32(1, true); } parseHeader(t45) { const e57 = new Uint8Array(t45), r86 = this.getHeaderLength(t45); if (e57.length < r86) throw new pw(`Expected header with length >= ${r86} but got buffer of length ${e57.length}`); const n45 = new yw(e57.subarray(0, r86)).readFields(kb, { headerLength: 0, x: 0, y: 0, z: 0, layers: [] }, void 0); if (!isNaN(this.x) && (this.x !== n45.x || this.y !== n45.y || this.z !== n45.z)) throw new pw(`Invalid attempt to parse header ${n45.z}/${n45.x}/${n45.y} for tile ${this.z}/${this.x}/${this.y}`); this.x = n45.x, this.y = n45.y, this.z = n45.z; for (const t46 of n45.layers) this.layers[t46.name] = new xw(t46, { cacheSize: this._cacheSize }); return this; } createDecodingTask(t45) { const e57 = [], r86 = this.getLayer(t45.layerName); for (let n45 of t45.blockIndices) { const i26 = r86.dataIndex[n45], s18 = i26.firstByte - t45.firstByte, o88 = i26.lastByte - t45.firstByte; if (r86._blocksInProgress.has(n45)) continue; const a46 = { layerName: r86.name, firstByte: s18, lastByte: o88, pixelFormat: r86.pixelFormat, blockIndex: n45, blockShape: [i26.bands.length].concat(r86.bandShape), buffer: r86.buffer, codec: i26.codec.codec, filters: i26.filters.map(((t46) => t46.filter)) }; r86._blocksInProgress.add(n45), e57.push(a46); } return new vw(e57, (() => { e57.forEach(((t46) => r86._blocksInProgress.delete(t46.blockIndex))); }), ((t46, n45) => { if (e57.forEach(((t47) => r86._blocksInProgress.delete(t47.blockIndex))), t46) throw t46; n45.forEach(((t47) => { this.getLayer(t47.layerName).processDecodedData(t47); })); })); } } class xw { constructor({ version: t45, name: e57, units: r86, tileSize: n45, pixelFormat: i26, buffer: s18, dataIndex: o88 }, a46) { if (this.version = t45, 1 !== this.version) throw new pw(`Cannot parse raster layer encoded with MRT version ${t45}`); this.name = e57, this.units = r86, this.tileSize = n45, this.buffer = s18, this.pixelFormat = dw[i26], this.dataIndex = o88, this.bandShape = [n45 + 2 * s18, n45 + 2 * s18, fw[this.pixelFormat]], this._decodedBlocks = new fb(a46 ? a46.cacheSize : 5), this._blocksInProgress = /* @__PURE__ */ new Set(); } get dimension() { return fw[this.pixelFormat]; } get cacheSize() { return this._decodedBlocks.capacity; } getBandList() { return this.dataIndex.map((({ bands: t45 }) => t45)).flat(); } processDecodedData(t45) { const e57 = t45.blockIndex.toString(); this._decodedBlocks.get(e57) || this._decodedBlocks.put(e57, t45.data); } getBlockForBand(t45) { let e57 = 0; switch (typeof t45) { case "string": for (const [r86, n45] of this.dataIndex.entries()) { for (const [i26, s18] of n45.bands.entries()) if (s18 === t45) return { bandIndex: e57 + i26, blockIndex: r86, blockBandIndex: i26 }; e57 += n45.bands.length; } break; case "number": for (const [r86, n45] of this.dataIndex.entries()) { if (t45 >= e57 && t45 < e57 + n45.bands.length) return { bandIndex: t45, blockIndex: r86, blockBandIndex: t45 - e57 }; e57 += n45.bands.length; } break; default: throw new pw(`Invalid band \`${JSON.stringify(t45)}\`. Expected string or integer.`); } return { blockIndex: -1, blockBandIndex: -1 }; } getDataRange(t45) { let e57 = 1 / 0, r86 = -1 / 0; const n45 = [], i26 = /* @__PURE__ */ new Set(); for (const s18 of t45) { const { blockIndex: t46 } = this.getBlockForBand(s18); if (t46 < 0) throw new pw(`Invalid band: ${JSON.stringify(s18)}`); const o88 = this.dataIndex[t46]; n45.includes(t46) || n45.push(t46), i26.add(t46), e57 = Math.min(e57, o88.firstByte), r86 = Math.max(r86, o88.lastByte); } if (i26.size > this.cacheSize) throw new pw(`Number of blocks to decode (${i26.size}) exceeds cache size (${this.cacheSize}).`); return { layerName: this.name, firstByte: e57, lastByte: r86, blockIndices: n45 }; } hasBand(t45) { const { blockIndex: e57 } = this.getBlockForBand(t45); return e57 >= 0; } hasDataForBand(t45) { const { blockIndex: e57 } = this.getBlockForBand(t45); return e57 >= 0 && !!this._decodedBlocks.get(e57.toString()); } getBandView(t45) { const { blockIndex: e57, blockBandIndex: r86 } = this.getBlockForBand(t45); if (e57 < 0) throw new pw(`Band not found: ${JSON.stringify(t45)}`); const n45 = this._decodedBlocks.get(e57.toString()); if (!n45) throw new pw(`Data for band ${JSON.stringify(t45)} of layer "${this.name}" not decoded.`); const i26 = this.dataIndex[e57], s18 = this.bandShape.reduce(((t46, e58) => t46 * e58), 1), o88 = r86 * s18, a46 = n45.subarray(o88, o88 + s18); return { data: a46, bytes: new Uint8Array(a46.buffer).subarray(a46.byteOffset, a46.byteOffset + a46.byteLength), tileSize: this.tileSize, buffer: this.buffer, pixelFormat: this.pixelFormat, dimension: this.dimension, offset: i26.offset, scale: i26.scale }; } } gw.setPbf = function(t45) { yw = t45; }; class vw { constructor(t45, e57, r86) { this.tasks = t45, this._onCancel = e57, this._onComplete = r86, this._finalized = false; } cancel() { this._finalized || (this._onCancel(), this._finalized = true); } complete(t45, e57) { this._finalized || (this._onComplete(t45, e57), this._finalized = true); } } gw.performDecoding = function(t45, e57) { const r86 = new Uint8Array(t45); return Promise.all(e57.tasks.map(((t46) => { const { layerName: e58, firstByte: n45, lastByte: i26, pixelFormat: s18, blockShape: o88, blockIndex: a46, filters: l21, codec: u12 } = t46, c28 = r86.subarray(n45, i26 + 1), h8 = new Uint32Array(o88[0] * o88[1] * o88[2]); let p9; if ("gzip_data" !== u12) throw new pw(`Unhandled codec: ${u12}`); return p9 = (function(t47, e59) { if (!globalThis.DecompressionStream && "gzip_data" === e59) return Promise.resolve(((s19 = (function(t48) { 31 == t48[0] && 139 == t48[1] && 8 == t48[2] || lw(6, "invalid gzip data"); var e60 = t48[3], r88 = 10; 4 & e60 && (r88 += 2 + (t48[10] | t48[11] << 8)); for (var n47 = (e60 >> 3 & 1) + (e60 >> 4 & 1); n47 > 0; n47 -= !t48[r88++]) ; return r88 + (2 & e60); })(i27 = t47)) + 8 > i27.length && lw(6, "invalid gzip data"), (function(t48, e60, r88, n47) { var i28 = t48.length; if (!i28 || e60.f && !e60.l) return r88 || new Ob(0); var s20 = !r88, o90 = s20 || 2 != e60.i, a48 = e60.i; s20 && (r88 = new Ob(3 * i28)); var l22, u13, c29 = function(t49) { var e61 = r88.length; if (t49 > e61) { var n48 = new Ob(Math.max(2 * e61, t49)); n48.set(r88), r88 = n48; } }, h9 = e60.f || 0, p10 = e60.p || 0, d34 = e60.b || 0, f8 = e60.l, m6 = e60.d, y4 = e60.m, g9 = e60.n, x4 = 8 * i28; do { if (!f8) { h9 = sw(t48, p10, 1); var v8 = sw(t48, p10 + 1, 3); if (p10 += 3, !v8) { var b8 = t48[(T5 = 4 + ((p10 + 7) / 8 | 0)) - 4] | t48[T5 - 3] << 8, w4 = T5 + b8; if (w4 > i28) { a48 && lw(0); break; } o90 && c29(d34 + b8), r88.set(t48.subarray(T5, w4), d34), e60.b = d34 += b8, e60.p = p10 = 8 * w4, e60.f = h9; continue; } if (1 == v8) f8 = rw, m6 = nw, y4 = 9, g9 = 5; else if (2 == v8) { var _4 = sw(t48, p10, 31) + 257, A4 = sw(t48, p10 + 10, 15) + 4, M5 = _4 + sw(t48, p10 + 5, 31) + 1; p10 += 14; for (var I4 = new Ob(M5), S5 = new Ob(19), P4 = 0; P4 < A4; ++P4) S5[Gb[P4]] = sw(t48, p10 + 3 * P4, 7); p10 += 3 * A4; var k7 = iw(S5), z4 = (1 << k7) - 1, E5 = Qb(S5, k7); for (P4 = 0; P4 < M5; ) { var T5, B6 = E5[sw(t48, p10, z4)]; if (p10 += 15 & B6, (T5 = B6 >> 4) < 16) I4[P4++] = T5; else { var V4 = 0, F17 = 0; for (16 == T5 ? (F17 = 3 + sw(t48, p10, 3), p10 += 2, V4 = I4[P4 - 1]) : 17 == T5 ? (F17 = 3 + sw(t48, p10, 7), p10 += 3) : 18 == T5 && (F17 = 11 + sw(t48, p10, 127), p10 += 7); F17--; ) I4[P4++] = V4; } } var C6 = I4.subarray(0, _4), D5 = I4.subarray(_4); y4 = iw(C6), g9 = iw(D5), f8 = Qb(C6, y4), m6 = Qb(D5, g9); } else lw(1); if (p10 > x4) { a48 && lw(0); break; } } o90 && c29(d34 + 131072); for (var R5 = (1 << y4) - 1, L3 = (1 << g9) - 1, O4 = p10; ; O4 = p10) { var U4 = (V4 = f8[ow(t48, p10) & R5]) >> 4; if ((p10 += 15 & V4) > x4) { a48 && lw(0); break; } if (V4 || lw(2), U4 < 256) r88[d34++] = U4; else { if (256 == U4) { O4 = p10, f8 = null; break; } var N5 = U4 - 254; U4 > 264 && (N5 = sw(t48, p10, (1 << (G5 = jb[P4 = U4 - 257])) - 1) + Xb[P4], p10 += G5); var j4 = m6[ow(t48, p10) & L3], $5 = j4 >> 4; if (j4 || lw(3), p10 += 15 & j4, D5 = Wb[$5], $5 > 3) { var G5 = $b[$5]; D5 += ow(t48, p10) & (1 << G5) - 1, p10 += G5; } if (p10 > x4) { a48 && lw(0); break; } o90 && c29(d34 + 131072); var H4 = d34 + N5; if (d34 < D5) { var q3 = 0 - D5, X3 = Math.min(D5, H4); for (q3 + d34 < 0 && lw(3); d34 < X3; ++d34) r88[d34] = (void 0)[q3 + d34]; } for (; d34 < H4; ++d34) r88[d34] = r88[d34 - D5]; } } e60.l = f8, e60.p = O4, e60.b = d34, e60.f = h9, f8 && (h9 = 1, e60.m = y4, e60.d = m6, e60.n = g9); } while (!h9); return d34 != r88.length && s20 ? (l22 = r88, (null == (u13 = d34) || u13 > l22.length) && (u13 = l22.length), new Ob(l22.subarray(0, u13))) : r88.subarray(0, d34); })(i27.subarray(s19, -8), { i: 2 }, new Ob(((r87 = i27)[(n46 = r87.length) - 4] | r87[n46 - 3] << 8 | r87[n46 - 2] << 16 | r87[n46 - 1] << 24) >>> 0)))); var r87, n46, i27, s19; const o89 = hw[e59]; if (!o89) throw new Error(`Unhandled codec: ${e59}`); const a47 = new globalThis.DecompressionStream(o89); return new Response(new Blob([t47]).stream().pipeThrough(a47)).arrayBuffer().then(((t48) => new Uint8Array(t48))); })(c28, u12).then(((t47) => ((function(t48, e59) { t48.readFields(Fb, e59); })(new yw(t47), h8), new (0, mw[s18])(h8.buffer)))), p9.then(((t47) => { for (let e59 = l21.length - 1; e59 >= 0; e59--) switch (l21[e59]) { case "delta_filter": Db(t47, o88); break; case "zigzag_filter": Rb(t47); break; case "bitshuffle_filter": Lb(t47, s18); break; default: throw new pw(`Unhandled filter "${l21[e59]}"`); } return { layerName: e58, blockIndex: a46, data: t47 }; })).catch(((t47) => { throw t47; })); }))); }, Ws(vw, "MRTDecodingBatch", { omit: ["_onCancel", "_onComplete"] }), Ws(gw, "MapboxRasterTile"), Ws(xw, "MapboxRasterLayer", { omit: ["_blocksInProgress"] }); class bw { constructor(t45) { this._stringToNumber = {}, this._numberToString = []; for (let e57 = 0; e57 < t45.length; e57++) { const r86 = t45[e57]; this._stringToNumber[r86] = e57, this._numberToString[e57] = r86; } } encode(t45) { return this._stringToNumber[t45]; } decode(t45) { return this._numberToString[t45]; } } const ww = ["id", "tile", "layer", "source", "sourceLayer", "state"]; class _w { constructor(t45, e57, r86, n45, i26) { this.type = "Feature", this._vectorTileFeature = t45, this._z = e57, this._x = r86, this._y = n45, this.properties = t45.properties, this.id = i26; } clone() { const t45 = new _w(this._vectorTileFeature, this._z, this._x, this._y, this.id); return this.state && (t45.state = Object.assign({}, this.state)), this.layer && (t45.layer = Object.assign({}, this.layer)), this.source && (t45.source = this.source), this.sourceLayer && (t45.sourceLayer = this.sourceLayer), t45; } get geometry() { return void 0 === this._geometry && (this._geometry = this._vectorTileFeature.toGeoJSON(this._x, this._y, this._z).geometry), this._geometry; } set geometry(t45) { this._geometry = t45; } toJSON() { const t45 = { type: "Feature", state: void 0, geometry: this.geometry, properties: this.properties }; for (const e57 of ww) void 0 !== this[e57] && (t45[e57] = this[e57]); return t45; } } class Aw { constructor(t45, e57) { this.tileID = t45, this.x = t45.canonical.x, this.y = t45.canonical.y, this.z = t45.canonical.z, this.grid = new Xs(Rn, 16, 0), this.featureIndexArray = new tl(), this.promoteId = e57, this.is3DTile = false, this.serializedLayersCache = /* @__PURE__ */ new Map(); } insert(t45, e57, r86, n45, i26, s18 = 0, o88 = 0) { const a46 = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(r86, n45, i26, s18); const l21 = this.grid; for (let t46 = 0; t46 < e57.length; t46++) { const r87 = e57[t46], n46 = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; for (let t47 = 0; t47 < r87.length; t47++) { const e58 = r87[t47]; n46[0] = Math.min(n46[0], e58.x), n46[1] = Math.min(n46[1], e58.y), n46[2] = Math.max(n46[2], e58.x), n46[3] = Math.max(n46[3], e58.y); } 0 !== o88 && (n46[0] -= o88, n46[1] -= o88, n46[2] += o88, n46[3] += o88), n46[0] < Rn && n46[1] < Rn && n46[2] >= 0 && n46[3] >= 0 && l21.insert(a46, n46[0], n46[1], n46[2], n46[3]); } } loadVTLayers() { if (!this.vtLayers) { this.vtLayers = new Eu(new cy(this.rawTileData)).layers, this.sourceLayerCoder = new bw(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"]), this.vtFeatures = {}; for (const t45 in this.vtLayers) this.vtFeatures[t45] = []; } return this.vtLayers; } query(t45, e57) { const { tilespaceGeometry: r86, transform: n45, tileTransform: i26, pixelPosMatrix: s18, availableImages: o88, worldview: a46 } = e57; this.loadVTLayers(), this.serializedLayersCache.clear(); const l21 = r86.bufferedTilespaceBounds, u12 = this.grid.query(l21.min.x, l21.min.y, l21.max.x, l21.max.y, ((t46, e58, n46, i27) => hc(r86.bufferedTilespaceGeometry, t46, e58, n46, i27))); u12.sort(Iw); let c28 = null; n45.elevation && u12.length > 0 && (c28 = av.create(n45.elevation, this.tileID)); const h8 = {}; let p9; for (let e58 = 0; e58 < u12.length; e58++) { const l22 = u12[e58]; if (l22 === p9) continue; p9 = l22; const d34 = this.featureIndexArray.get(l22); let f8 = null; this.is3DTile ? this.loadMatchingModelFeature(h8, d34, t45, r86, n45, a46) : this.loadMatchingFeature(h8, d34, t45, o88, a46, ((t46, e59, o89, a47 = 0) => (f8 || (f8 = Au(t46, this.tileID.canonical, i26)), e59.queryIntersectsFeature(r86, t46, o89, f8, this.z, n45, s18, c28, a47)))); } return h8; } loadMatchingFeature(t45, e57, r86, n45, i26, s18) { const { featureIndex: o88, bucketIndex: a46, sourceLayerIndex: l21, layoutVertexArrayOffset: u12 } = e57, c28 = this.bucketLayerIDs[a46], h8 = r86.layers, p9 = Object.keys(h8); if (p9.length && !jt(p9, c28)) return; const d34 = r86.sourceCache, f8 = this.sourceLayerCoder.decode(l21), m6 = this.vtLayers[f8].feature(o88), y4 = this.getId(m6, f8); for (let e58 = 0; e58 < c28.length; e58++) { const r87 = c28[e58]; if (!h8[r87]) continue; const { styleLayer: a47, targets: l22 } = h8[r87]; let p10 = {}; void 0 !== y4 && (p10 = d34.getFeatureState(a47.sourceLayer, y4)); const f9 = !s18 || s18(m6, a47, p10, u12); if (!f9) continue; const g9 = new _w(m6, this.z, this.x, this.y, y4); g9.tile = this.tileID.canonical, g9.state = p10; let x4 = this.serializedLayersCache.get(r87); x4 || (x4 = a47.serialize(), x4.id = r87, this.serializedLayersCache.set(r87, x4)), g9.source = x4.source, g9.sourceLayer = x4["source-layer"], g9.layer = Object.assign({}, x4), g9.layer.paint = Mw(x4.paint, a47.paint, m6, p10, n45), g9.layer.layout = Mw(x4.layout, a47.layout, m6, p10, n45); let v8 = false; for (const t46 of l22) { this.updateFeatureProperties(g9, t46); const { filter: e59 } = t46; if (e59) { if (m6.properties = g9.properties, e59.needGeometry) { const t47 = Mu(m6, true); if (!e59.filter(new wo(this.tileID.overscaledZ, { worldview: i26 }), t47, this.tileID.canonical)) continue; } else if (!e59.filter(new wo(this.tileID.overscaledZ, { worldview: i26 }), m6)) continue; } v8 = true, t46.targetId && this.addFeatureVariant(g9, t46); } v8 && this.appendToResult(t45, r87, o88, g9, f9); } } loadMatchingModelFeature(t45, e57, r86, n45, i26, s18) { const { featureIndex: o88, bucketIndex: a46 } = e57, l21 = this.bucketLayerIDs[a46], u12 = r86.layers, c28 = Object.keys(u12); if (!c28.length || jt(c28, l21)) for (let e58 = 0; e58 < l21.length; e58++) { const a47 = l21[e58], { styleLayer: c29, targets: h8 } = u12[a47]; if ("model" !== c29.type) continue; const p9 = n45.tile, d34 = p9.getBucket(c29); if (!(d34 && d34 instanceof fv)) continue; const f8 = vv(d34, o88, n45, i26); if (!f8) continue; const { z: m6, x: y4, y: g9 } = p9.tileID.canonical, { feature: x4, intersectionZ: v8, position: b8 } = f8; let w4 = {}; void 0 !== x4.id && (w4 = r86.sourceCache.getFeatureState(c29.sourceLayer, x4.id)); const _4 = new _w({}, m6, y4, g9, x4.id); _4.tile = this.tileID.canonical, _4.state = w4, _4.properties = x4.properties, _4.geometry = { type: "Point", coordinates: [b8.lng, b8.lat] }; let A4 = this.serializedLayersCache.get(a47); A4 || (A4 = c29.serialize(), A4.id = a47, this.serializedLayersCache.set(a47, A4)), _4.source = A4.source, _4.sourceLayer = A4["source-layer"], _4.layer = Object.assign({}, A4); let M5 = false; for (const t46 of h8) { this.updateFeatureProperties(_4, t46); const { filter: e59 } = t46; if (e59) { if (x4.properties = _4.properties, e59.needGeometry) { if (!e59.filter(new wo(this.tileID.overscaledZ, { worldview: s18 }), x4, this.tileID.canonical)) continue; } else if (!e59.filter(new wo(this.tileID.overscaledZ, { worldview: s18 }), x4)) continue; } M5 = true, t46.targetId && this.addFeatureVariant(_4, t46); } M5 && this.appendToResult(t45, a47, o88, _4, v8); } } updateFeatureProperties(t45, e57, r86) { if (e57.properties) { const n45 = {}; for (const i26 in e57.properties) { const s18 = e57.properties[i26].evaluate({ zoom: this.z }, t45._vectorTileFeature, t45.state, t45.tile, r86); null != s18 && (n45[i26] = s18); } t45.properties = n45; } } addFeatureVariant(t45, e57, r86) { const n45 = { target: e57.target, namespace: e57.namespace, uniqueFeatureID: e57.uniqueFeatureID }; e57.properties && (n45.properties = t45.properties), t45.variants = t45.variants || {}, t45.variants[e57.targetId] = t45.variants[e57.targetId] || [], t45.variants[e57.targetId].push(n45); } appendToResult(t45, e57, r86, n45, i26) { let s18 = t45[e57]; void 0 === s18 && (s18 = t45[e57] = []), s18.push({ featureIndex: r86, feature: n45, intersectionZ: i26 }); } lookupSymbolFeatures(t45, e57, r86, n45, i26, s18) { const o88 = {}; this.loadVTLayers(); for (const a46 of t45) this.loadMatchingFeature(o88, { bucketIndex: e57, sourceLayerIndex: r86, featureIndex: a46, layoutVertexArrayOffset: 0 }, n45, i26, s18); return o88; } loadFeature(t45) { const { featureIndex: e57, sourceLayerIndex: r86 } = t45; this.loadVTLayers(); const n45 = this.sourceLayerCoder.decode(r86), i26 = this.vtFeatures[n45]; if (i26[e57]) return i26[e57]; const s18 = this.vtLayers[n45].feature(e57); return i26[e57] = s18, s18; } hasLayer(t45) { for (const e57 of this.bucketLayerIDs) for (const r86 of e57) if (t45 === r86) return true; return false; } getId(t45, e57) { let r86 = t45.id; if (this.promoteId) { const n45 = Array.isArray(this.promoteId) || "object" != typeof this.promoteId ? this.promoteId : this.promoteId[e57]; if (null != n45) if (Array.isArray(n45)) { if (!this.promoteIdExpression) { const t46 = Ls(n45); if ("success" !== t46.result) { const e58 = t46.value.map(((t47) => `${t47.key}: ${t47.message}`)).join(", "); return void Gt(`Failed to create expression for promoteId: ${e58}`); } this.promoteIdExpression = t46.value; } this.promoteIdExpression._evaluator || (this.promoteIdExpression._evaluator = new tn()), r86 = this.promoteIdExpression.evaluate({ zoom: 0 }, t45); } else r86 = t45.properties[n45]; "boolean" == typeof r86 && (r86 = Number(r86)); } return r86; } } function Mw(t45, e57, r86, n45, i26) { return Ot(t45, ((t46, s18) => { const o88 = e57 instanceof zo ? e57.get(s18) : null; return o88 && o88.evaluate ? o88.evaluate(r86, n45, void 0, i26) : o88; })); } function Iw(t45, e57) { return e57 - t45; } Ws(Aw, "FeatureIndex", { omit: ["rawTileData", "sourceLayerCoder"] }); const Sw = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]; class Pw { static from(t45) { if (!(t45 instanceof ArrayBuffer)) throw new Error("Data must be an instance of ArrayBuffer."); const [e57, r86] = new Uint8Array(t45, 0, 2); if (219 !== e57) throw new Error("Data does not appear to be in a KDBush format."); const n45 = r86 >> 4; if (1 !== n45) throw new Error(`Got v${n45} data when expected v1.`); const i26 = Sw[15 & r86]; if (!i26) throw new Error("Unrecognized array type."); const [s18] = new Uint16Array(t45, 2, 1), [o88] = new Uint32Array(t45, 4, 1); return new Pw(o88, s18, i26, t45); } constructor(t45, e57 = 64, r86 = Float64Array, n45) { if (isNaN(t45) || t45 < 0) throw new Error(`Unpexpected numItems value: ${t45}.`); this.numItems = +t45, this.nodeSize = Math.min(Math.max(+e57, 2), 65535), this.ArrayType = r86, this.IndexArrayType = t45 < 65536 ? Uint16Array : Uint32Array; const i26 = Sw.indexOf(this.ArrayType), s18 = 2 * t45 * this.ArrayType.BYTES_PER_ELEMENT, o88 = t45 * this.IndexArrayType.BYTES_PER_ELEMENT, a46 = (8 - o88 % 8) % 8; if (i26 < 0) throw new Error(`Unexpected typed array class: ${r86}.`); n45 && n45 instanceof ArrayBuffer ? (this.data = n45, this.ids = new this.IndexArrayType(this.data, 8, t45), this.coords = new this.ArrayType(this.data, 8 + o88 + a46, 2 * t45), this._pos = 2 * t45, this._finished = true) : (this.data = new ArrayBuffer(8 + s18 + o88 + a46), this.ids = new this.IndexArrayType(this.data, 8, t45), this.coords = new this.ArrayType(this.data, 8 + o88 + a46, 2 * t45), this._pos = 0, this._finished = false, new Uint8Array(this.data, 0, 2).set([219, 16 + i26]), new Uint16Array(this.data, 2, 1)[0] = e57, new Uint32Array(this.data, 4, 1)[0] = t45); } add(t45, e57) { const r86 = this._pos >> 1; return this.ids[r86] = r86, this.coords[this._pos++] = t45, this.coords[this._pos++] = e57, r86; } finish() { const t45 = this._pos >> 1; if (t45 !== this.numItems) throw new Error(`Added ${t45} items when expected ${this.numItems}.`); return kw(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = true, this; } range(t45, e57, r86, n45) { if (!this._finished) throw new Error("Data not yet indexed - call index.finish()."); const { ids: i26, coords: s18, nodeSize: o88 } = this, a46 = [0, i26.length - 1, 0], l21 = []; for (; a46.length; ) { const u12 = a46.pop() || 0, c28 = a46.pop() || 0, h8 = a46.pop() || 0; if (c28 - h8 <= o88) { for (let o89 = h8; o89 <= c28; o89++) { const a47 = s18[2 * o89], u13 = s18[2 * o89 + 1]; a47 >= t45 && a47 <= r86 && u13 >= e57 && u13 <= n45 && l21.push(i26[o89]); } continue; } const p9 = h8 + c28 >> 1, d34 = s18[2 * p9], f8 = s18[2 * p9 + 1]; d34 >= t45 && d34 <= r86 && f8 >= e57 && f8 <= n45 && l21.push(i26[p9]), (0 === u12 ? t45 <= d34 : e57 <= f8) && (a46.push(h8), a46.push(p9 - 1), a46.push(1 - u12)), (0 === u12 ? r86 >= d34 : n45 >= f8) && (a46.push(p9 + 1), a46.push(c28), a46.push(1 - u12)); } return l21; } within(t45, e57, r86) { if (!this._finished) throw new Error("Data not yet indexed - call index.finish()."); const { ids: n45, coords: i26, nodeSize: s18 } = this, o88 = [0, n45.length - 1, 0], a46 = [], l21 = r86 * r86; for (; o88.length; ) { const u12 = o88.pop() || 0, c28 = o88.pop() || 0, h8 = o88.pop() || 0; if (c28 - h8 <= s18) { for (let r87 = h8; r87 <= c28; r87++) Bw(i26[2 * r87], i26[2 * r87 + 1], t45, e57) <= l21 && a46.push(n45[r87]); continue; } const p9 = h8 + c28 >> 1, d34 = i26[2 * p9], f8 = i26[2 * p9 + 1]; Bw(d34, f8, t45, e57) <= l21 && a46.push(n45[p9]), (0 === u12 ? t45 - r86 <= d34 : e57 - r86 <= f8) && (o88.push(h8), o88.push(p9 - 1), o88.push(1 - u12)), (0 === u12 ? t45 + r86 >= d34 : e57 + r86 >= f8) && (o88.push(p9 + 1), o88.push(c28), o88.push(1 - u12)); } return a46; } } function kw(t45, e57, r86, n45, i26, s18) { if (i26 - n45 <= r86) return; const o88 = n45 + i26 >> 1; zw(t45, e57, o88, n45, i26, s18), kw(t45, e57, r86, n45, o88 - 1, 1 - s18), kw(t45, e57, r86, o88 + 1, i26, 1 - s18); } function zw(t45, e57, r86, n45, i26, s18) { for (; i26 > n45; ) { if (i26 - n45 > 600) { const o89 = i26 - n45 + 1, a47 = r86 - n45 + 1, l22 = Math.log(o89), u12 = 0.5 * Math.exp(2 * l22 / 3), c28 = 0.5 * Math.sqrt(l22 * u12 * (o89 - u12) / o89) * (a47 - o89 / 2 < 0 ? -1 : 1); zw(t45, e57, r86, Math.max(n45, Math.floor(r86 - a47 * u12 / o89 + c28)), Math.min(i26, Math.floor(r86 + (o89 - a47) * u12 / o89 + c28)), s18); } const o88 = e57[2 * r86 + s18]; let a46 = n45, l21 = i26; for (Ew(t45, e57, n45, r86), e57[2 * i26 + s18] > o88 && Ew(t45, e57, n45, i26); a46 < l21; ) { for (Ew(t45, e57, a46, l21), a46++, l21--; e57[2 * a46 + s18] < o88; ) a46++; for (; e57[2 * l21 + s18] > o88; ) l21--; } e57[2 * n45 + s18] === o88 ? Ew(t45, e57, n45, l21) : (l21++, Ew(t45, e57, l21, i26)), l21 <= r86 && (n45 = l21 + 1), r86 <= l21 && (i26 = l21 - 1); } } function Ew(t45, e57, r86, n45) { Tw(t45, r86, n45), Tw(e57, 2 * r86, 2 * n45), Tw(e57, 2 * r86 + 1, 2 * n45 + 1); } function Tw(t45, e57, r86) { const n45 = t45[e57]; t45[e57] = t45[r86], t45[r86] = n45; } function Bw(t45, e57, r86, n45) { const i26 = t45 - r86, s18 = e57 - n45; return i26 * i26 + s18 * s18; } t44.$ = Yr, t44.A = Fr, t44.B = Ko, t44.C = 2, t44.D = Ld, t44.E = tr, t44.F = og, t44.G = ig, t44.H = Xr, t44.I = er, t44.J = Co, t44.K = qr, t44.L = Wr, t44.M = Ps, t44.N = Ms, t44.O = Ss, t44.P = wt, t44.Q = Rs, t44.R = Be, t44.S = Do, t44.T = vf, t44.U = Ls, t44.V = tv, t44.W = Ns, t44.X = gi, t44.Y = fi, t44.Z = mi, t44._ = en, t44.a = function(t45) { return ne2.API_CDN_URL_REGEX.test(t45); }, t44.a$ = lu, t44.a0 = Zr, t44.a1 = ir, t44.a2 = Ro, t44.a3 = class extends tv { }, t44.a4 = ks, t44.a5 = Is, t44.a6 = Fo, t44.a7 = function(t45) { const e57 = t45.value; return e57 ? Zr(e57) ? ev(e57, true) ? [] : [new tv(t45.key, e57, `invalid url "${e57}"`)] : [new tv(t45.key, e57, `string expected, "${qr(e57)}" found`)] : []; }, t44.a8 = Mo, t44.a9 = Vo, t44.aA = Tt2, t44.aB = c27, t44.aC = Y5, t44.aD = Nl, t44.aE = cc2, t44.aF = iu, t44.aG = gu, t44.aH = function(t45, e57) { const r86 = {}; for (let n45 = 0; n45 < e57.length; n45++) { const i26 = e57[n45]; i26 in t45 && (r86[i26] = t45[i26]); } return r86; }, t44.aI = tu, t44.aJ = su, t44.aK = class { constructor(t45) { this.entries = {}, this.scheduler = t45; } request(t45, e57, r86, n45) { const i26 = this.entries[t45] = this.entries[t45] || { callbacks: [] }; if (i26.result) { const [t46, r87] = i26.result; return this.scheduler ? this.scheduler.add((() => { n45(t46, r87); }), e57) : n45(t46, r87), () => { }; } return i26.callbacks.push(n45), i26.cancel || (i26.cancel = r86(((r87, n46) => { i26.result = [r87, n46]; for (const t46 of i26.callbacks) this.scheduler ? this.scheduler.add((() => { t46(r87, n46); }), e57) : t46(r87, n46); setTimeout((() => delete this.entries[t45]), 3e3); }))), () => { i26.result || (i26.callbacks = i26.callbacks.filter(((t46) => t46 !== n45)), i26.callbacks.length || (i26.cancel(), delete this.entries[t45])); }; } }, t44.aL = function(t45, e57, r86) { const n45 = JSON.stringify(t45.request); return t45.data && (this.deduped.entries[n45] = { result: [null, t45.data] }), this.deduped.request(n45, { type: "parseTile", isSymbolTile: t45.isSymbolTile, zoom: t45.tileZoom }, ((e58) => { const n46 = De(t45.request, ((t46, n47, i26, s18) => { t46 ? e58(t46) : n47 && e58(null, { vectorTile: r86 ? void 0 : new Eu(new cy(n47)), rawData: n47, cacheControl: i26, expires: s18 }); })); return () => { n46.cancel(), e58(); }; }), e57); }, t44.aM = function(t45) { Me++, Me > xe2 && (t45.getActor().send("enforceCacheSizeLimit", ge), Me = 0); }, t44.aN = function(t45) { return t45 <= 1 ? 1 : Math.pow(2, Math.floor(Math.log2(t45))); }, t44.aO = Mc, t44.aP = Gx, t44.aQ = Yx, t44.aR = Ql, t44.aS = jx, t44.aT = function(t45, e57) { const r86 = document.createElement("video"); r86.muted = true, r86.onloadstart = function() { e57(null, r86); }; for (let e58 = 0; e58 < t45.length; e58++) { const n45 = document.createElement("source"); Re2(t45[e58]) || (r86.crossOrigin = "Anonymous"), n45.src = t45[e58], r86.appendChild(n45); } return { cancel: () => { } }; }, t44.aU = bf, t44.aV = function(t45) { return fetch(t45).then(((t46) => t46.arrayBuffer())).then(((e57) => yf(e57, 0, t45))); }, t44.aW = Qf, t44.aX = class { constructor(t45, e57, r86, n45) { this.id = t45, this.position = null != e57 ? new Ql(e57[0], e57[1]) : new Ql(0, 0), this.orientation = null != r86 ? r86 : [0, 0, 0], this.nodes = n45, this.uploaded = false, this.aabb = new Xu([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]), this.matrix = []; } _applyTransformations(t45, e57) { if (c27(t45.matrix, e57, t45.matrix), t45.meshes) for (const e58 of t45.meshes) { const r86 = Xu.applyTransformFast(e58.aabb, t45.matrix); this.aabb.encapsulate(r86); } if (t45.children) for (const e58 of t45.children) this._applyTransformations(e58, t45.matrix); } computeBoundsAndApplyParent() { const t45 = l20([]); for (const e57 of this.nodes) this._applyTransformations(e57, t45); } computeModelMatrix(t45, e57, r86, n45, i26, s18, o88 = false) { Uf(this.matrix, this, t45.transform, this.position, e57, r86, n45, i26, s18, o88); } upload(t45) { if (!this.uploaded) { for (const e57 of this.nodes) $f(e57, t45); for (const t46 of this.nodes) Gf(t46); this.uploaded = true; } } destroy() { for (const t45 of this.nodes) Hf(t45); } }, t44.aY = Lt2, t44.aZ = Zg, t44.a_ = au, t44.aa = Eo, t44.ab = class { constructor(t45) { this.specification = t45; } possiblyEvaluate(t45, e57) { return Xt(t45.expression.evaluate(e57)); } interpolate(t45, e57, r86) { return { x: ur(t45.x, e57.x, r86), y: ur(t45.y, e57.y, r86), z: ur(t45.z, e57.z, r86), azimuthal: ur(t45.azimuthal, e57.azimuthal, r86), polar: ur(t45.polar, e57.polar, r86) }; } }, t44.ac = wo, t44.ad = Us, t44.ae = mu, t44.af = O3, t44.ag = _3, t44.ah = Bt, t44.ai = zo, t44.aj = Yc, t44.ak = ur, t44.al = Rn, t44.am = cr, t44.an = It, t44.ao = sr, t44.ap = class { constructor(t45) { this.specification = t45; } possiblyEvaluate(t45, e57) { return (function([t46, e58]) { const r86 = Xt([1, t46, e58]); return { x: r86.x, y: r86.y, z: r86.z }; })(t45.expression.evaluate(e57)); } interpolate(t45, e57, r86) { return { x: ur(t45.x, e57.x, r86), y: ur(t45.y, e57.y, r86), z: ur(t45.z, e57.z, r86) }; } }, t44.aq = function(t45, e57, r86 = 0, n45 = true) { const i26 = new wt(r86, r86), s18 = t45.sub(i26), o88 = e57.add(i26), a46 = [s18, new wt(o88.x, s18.y), o88, new wt(s18.x, o88.y)]; return n45 && a46.push(s18.clone()), a46; }, t44.ar = function(t45, e57) { const r86 = []; for (let n45 = 0; n45 < t45.length; n45++) { const i26 = Vt(n45 - 1, -1, t45.length - 1), s18 = Vt(n45 + 1, -1, t45.length - 1), o88 = t45[n45], a46 = t45[s18], l21 = t45[i26].sub(o88).unit(), u12 = a46.sub(o88).unit(), c28 = u12.angleWithSep(l21.x, l21.y), h8 = l21.add(u12).unit().mult(-1 * e57 / Math.sin(c28 / 2)); r86.push(o88.add(h8)); } return r86; }, t44.as = Wg, t44.at = hc, t44.au = function(t45, e57, r86 = 0) { return A3(((e57.x - r86) * t45.scale - t45.x) * Rn, (e57.y * t45.scale - t45.y) * Rn, uu(e57.z, e57.y)); }, t44.av = G4, t44.aw = C5, t44.ax = Uu, t44.ay = Cm, t44.az = function(t45) { let e57 = 1 / 0, r86 = 1 / 0, n45 = -1 / 0, i26 = -1 / 0; for (const s18 of t45) e57 = Math.min(e57, s18.x), r86 = Math.min(r86, s18.y), n45 = Math.max(n45, s18.x), i26 = Math.max(i26, s18.y); return { min: new wt(e57, r86), max: new wt(n45, i26) }; }, t44.b = function(t45) { return ne2.API_FONTS_REGEX.test(t45); }, t44.b$ = jp, t44.b0 = ha, t44.b1 = Ea, t44.b2 = Dt, t44.b3 = qa, t44.b4 = Px, t44.b5 = function() { bo.isLoading() || bo.isLoaded() || "deferred" !== xo() || vo(); }, t44.b6 = Lo, t44.b7 = Mu, t44.b8 = _w, t44.b9 = Wt, t44.bA = l20, t44.bB = m5, t44.bC = a45, t44.bD = function(t45, e57) { const { x: r86, y: n45 } = t45.point, i26 = Wc(r86, n45, t45.worldSize / t45._pixelsPerMercatorPixel, 0, 0); return c27(i26, i26, qc(Dc(e57))); }, t44.bE = n44, t44.bF = j3, t44.bG = function(t45, e57) { var r86 = e57[0] - t45[0], n45 = e57[1] - t45[1], i26 = e57[2] - t45[2]; return Math.sqrt(r86 * r86 + n45 * n45 + i26 * i26); }, t44.bH = T4, t44.bI = R4, t44.bJ = D4, t44.bK = Wy, t44.bL = Py, t44.bM = Zy, t44.bN = function(t45, e57, r86, n45, i26) { const s18 = 5 * e57 + 2; t45.float32[s18 + 0] = r86, t45.float32[s18 + 1] = n45, t45.float32[s18 + 2] = i26; }, t44.bO = Ax, t44.bP = at2, t44.bQ = ht2, t44.bR = ut2, t44.bS = gt2, t44.bT = Vt, t44.bU = function(t45, e57, n45, i26) { var s18 = new r85(4); return s18[0] = t45, s18[1] = e57, s18[2] = n45, s18[3] = i26, s18; }, t44.bV = Sd, t44.bW = Qu, t44.bX = ry, t44.bY = Bp, t44.bZ = Qx, t44.b_ = Np, t44.ba = Tm, t44.bb = mp, t44.bc = Au, t44.bd = ua, t44.be = Ua, t44.bf = Ec, t44.bg = al, t44.bh = Ih, t44.bi = Lx, t44.bj = function(t45, e57) { const r86 = Yc(e57.zoom); if (0 === r86) return Dc(t45); const n45 = Uc(t45), i26 = Nc(n45), s18 = iu(n45.getWest()) * e57.worldSize, o88 = iu(n45.getEast()) * e57.worldSize, a46 = su(n45.getNorth()) * e57.worldSize, l21 = su(n45.getSouth()) * e57.worldSize, c28 = [s18, a46, 0], h8 = [o88, a46, 0], p9 = [s18, l21, 0], d34 = [o88, l21, 0], f8 = u11([], e57.globeMatrix); return O3(c28, c28, f8), O3(h8, h8, f8), O3(p9, p9, f8), O3(d34, d34, f8), i26[0] = Rc(i26[0], p9, r86), i26[1] = Rc(i26[1], d34, r86), i26[2] = Rc(i26[2], h8, r86), i26[3] = Rc(i26[3], c28, r86), Xu.fromPoints(i26); }, t44.bk = Hc, t44.bl = u11, t44.bm = jc, t44.bn = Rc, t44.bo = ca3, t44.bp = zc, t44.bq = y3, t44.br = h7, t44.bs = gw, t44.bt = cy, t44.bu = De, t44.bv = function(t45, e57) { const r86 = []; for (const n45 in t45) n45 in e57 || r86.push(n45); return r86; }, t44.bw = Ft, t44.bx = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"], t44.by = _t, t44.bz = function(t45) { var e57 = new r85(16); return e57[0] = t45[0], e57[1] = t45[1], e57[2] = t45[2], e57[3] = t45[3], e57[4] = t45[4], e57[5] = t45[5], e57[6] = t45[6], e57[7] = t45[7], e57[8] = t45[8], e57[9] = t45[9], e57[10] = t45[10], e57[11] = t45[11], e57[12] = t45[12], e57[13] = t45[13], e57[14] = t45[14], e57[15] = t45[15], e57; }, t44.c = se, t44.c$ = function(t45) { return t45 * t45 * t45 * t45 * t45; }, t44.c0 = Ly, t44.c1 = zg, t44.c2 = Rg, t44.c3 = Pw, t44.c4 = E4, t44.c5 = q2, t44.c6 = J3, t44.c7 = function(t45, e57, r86) { r86 *= 0.5; var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = Math.sin(r86), l21 = Math.cos(r86); return t45[0] = n45 * l21 + i26 * a46, t45[1] = i26 * l21 - n45 * a46, t45[2] = s18 * l21 + o88 * a46, t45[3] = o88 * l21 - s18 * a46, t45; }, t44.c8 = Q4, t44.c9 = Kt2, t44.cA = qu, t44.cB = zf, t44.cC = _c61, t44.cD = Oc, t44.cE = function(t45, e57, r86, n45, i26, s18, o88, a46, l21) { if ("globe" === l21.name) return Oc(t45, e57, new _c61(r86, n45, i26), false); const u12 = Zg({ z: r86, x: n45, y: i26 }, l21); return new Xu([(s18 + u12.x / u12.scale) * e57, e57 * (u12.y / u12.scale), o88], [(s18 + u12.x2 / u12.scale) * e57, e57 * (u12.y2 / u12.scale), a46]); }, t44.cF = function(t45, e57, r86) { return t45[0] = Math.min(e57[0], r86[0]), t45[1] = Math.min(e57[1], r86[1]), t45[2] = Math.min(e57[2], r86[2]), t45[3] = Math.min(e57[3], r86[3]), t45; }, t44.cG = function(t45, e57, r86) { return t45[0] = Math.max(e57[0], r86[0]), t45[1] = Math.max(e57[1], r86[1]), t45[2] = Math.max(e57[2], r86[2]), t45[3] = Math.max(e57[3], r86[3]), t45; }, t44.cH = function(t45) { const e57 = Math.round((t45 + 45 + 360) % 360 / 90) % 4; return Pt[e57]; }, t44.cI = cu, t44.cJ = Z2, t44.cK = $l, t44.cL = function(t45) { const e57 = l20(new Float64Array(16)); c27(e57, t45.pixelMatrix, t45.globeMatrix); const r86 = [0, Xl, 0], n45 = [0, Zl, 0]; return O3(r86, r86, e57), O3(n45, n45, e57), [r86[0] > 0 && r86[0] <= t45.width && r86[1] > 0 && r86[1] <= t45.height && !Jc(t45, new Ql(t45.center.lat, 90)), n45[0] > 0 && n45[0] <= t45.width && n45[1] > 0 && n45[1] <= t45.height && !Jc(t45, new Ql(t45.center.lat, -90))]; }, t44.cM = function(t45, e57) { const { scale: r86 } = t45.tileTransform, n45 = r86 * Rn / (t45.tileSize * Math.pow(2, e57.zoom - t45.tileID.overscaledZ + t45.tileID.canonical.z)); return (function(t46, e58, r87) { var n46 = e58[1], i26 = e58[2], s18 = e58[3], o88 = r87[0], a46 = r87[1]; return t46[0] = e58[0] * o88, t46[1] = n46 * o88, t46[2] = i26 * a46, t46[3] = s18 * a46, t46; })(new Float32Array(4), e57.inverseAdjustmentMatrix, [n45, n45]); }, t44.cN = Ef, t44.cO = v7, t44.cP = kf, t44.cQ = function(t45) { const e57 = kf(t45, true); return n44([], [e57[0], e57[1], e57[4], e57[5]]); }, t44.cR = p8, t44.cS = Nu, t44.cT = d33, t44.cU = function(t45) { const { x: e57, y: r86 } = t45.point, { lng: n45, lat: i26 } = t45._center; return Wc(e57, r86, t45.worldSize, n45, i26); }, t44.cV = P3, t44.cW = St, t44.cX = Ic, t44.cY = pc, t44.cZ = jl, t44.c_ = function(t45, e57, r86) { let n45 = 0; for (let r87 = 0; r87 < 2; ++r87) { const i26 = 0; t45[r87] > i26 && (n45 += (t45[r87] - i26) * (t45[r87] - i26)), e57[r87] < i26 && (n45 += (i26 - e57[r87]) * (i26 - e57[r87])); } return n45; }, t44.ca = function(t45, e57) { return t45[0] = -e57[0], t45[1] = -e57[1], t45[2] = -e57[2], t45[3] = e57[3], t45; }, t44.cb = x3, t44.cc = function(t45, e57, r86, n45, i26) { var s18 = 1 / Math.tan(e57 / 2); if (t45[0] = s18 / r86, t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[4] = 0, t45[5] = s18, t45[6] = 0, t45[7] = 0, t45[8] = 0, t45[9] = 0, t45[11] = -1, t45[12] = 0, t45[13] = 0, t45[15] = 0, null != i26 && i26 !== 1 / 0) { var o88 = 1 / (n45 - i26); t45[10] = (i26 + n45) * o88, t45[14] = 2 * i26 * n45 * o88; } else t45[10] = -1, t45[14] = -2 * n45; return t45; }, t44.cd = function(t45, e57, r86, n45, i26, s18, o88) { var a46 = 1 / (e57 - r86), l21 = 1 / (n45 - i26), u12 = 1 / (s18 - o88); return t45[0] = -2 * a46, t45[1] = 0, t45[2] = 0, t45[3] = 0, t45[4] = 0, t45[5] = -2 * l21, t45[6] = 0, t45[7] = 0, t45[8] = 0, t45[9] = 0, t45[10] = 2 * u12, t45[11] = 0, t45[12] = (e57 + r86) * a46, t45[13] = (i26 + n45) * l21, t45[14] = (o88 + s18) * u12, t45[15] = 1, t45; }, t44.ce = ou, t44.cf = function(t45, e57, r86) { t45[4 * e57 + 0] = r86[0], t45[4 * e57 + 1] = r86[1], t45[4 * e57 + 2] = r86[2], t45[4 * e57 + 3] = r86[3]; }, t44.cg = gl, t44.ch = bl, t44.ci = xl, t44.cj = vl, t44.ck = Ml, t44.cl = yx, t44.cm = function() { var t45 = new r85(4); return r85 != Float32Array && (t45[1] = 0, t45[2] = 0), t45[0] = 1, t45[3] = 1, t45; }, t44.cn = function(t45, e57, r86) { var n45 = e57[0], i26 = e57[1], s18 = e57[2], o88 = e57[3], a46 = Math.sin(r86), l21 = Math.cos(r86); return t45[0] = n45 * l21 + s18 * a46, t45[1] = i26 * l21 + o88 * a46, t45[2] = n45 * -a46 + s18 * l21, t45[3] = i26 * -a46 + o88 * l21, t45; }, t44.co = function(t45, e57) { return t45[0] === e57[0] && t45[1] === e57[1] && t45[2] === e57[2] && t45[3] === e57[3]; }, t44.cp = $4, t44.cq = function(t45) { var e57 = t45[0], r86 = t45[1], n45 = t45[2], i26 = t45[3]; return Math.sqrt(e57 * e57 + r86 * r86 + n45 * n45 + i26 * i26); }, t44.cr = it, t44.cs = N4, t44.ct = Ac, t44.cu = 3, t44.cv = 2, t44.cw = 7, t44.cx = 6, t44.cy = L2, t44.cz = b7, t44.d = function(t45) { return ne2.API_TILEJSON_REGEX.test(t45); }, t44.d$ = Om, t44.d0 = nu, t44.d1 = 45, t44.d2 = wl, t44.d3 = function(t45, e57, r86) { const n45 = Math.sqrt(t45 * t45 + e57 * e57 + r86 * r86), i26 = n45 > 0 ? Math.acos(r86 / n45) * Mt2 : 0; let s18 = 0 !== t45 || 0 !== e57 ? Math.atan2(-e57, -t45) * Mt2 + 90 : 0; return s18 < 0 && (s18 += 360), [n45, s18, i26]; }, t44.d4 = A3, t44.d5 = Xt, t44.d6 = fu, t44.d7 = I3, t44.d8 = Xu, t44.d9 = S4, t44.dA = function(t45, e57, r86) { const n45 = Yc(r86.zoom), i26 = t45.style.map._antialias, s18 = t45.terrain && t45.terrain.exaggeration() > 0; return 0 === n45 && !i26 && !s18; }, t44.dB = function(t45) { const e57 = t45.pixelsPerMeter, r86 = e57 / ou(1, t45.center.lat), n45 = l20(new Float64Array(16)); return h7(n45, n45, [t45.point.x, t45.point.y, 0]), p8(n45, n45, [r86, r86, e57]), Float32Array.from(n45); }, t44.dC = Uc, t44.dD = function(t45) { const e57 = cu - 5; t45 = Tt2(t45, -e57, e57) / e57 * 90; const r86 = Math.pow(Math.abs(Math.sin(It(t45))), 3); return Math.round(r86 * (ql.length - 1)); }, t44.dE = function(t45, e57, r86, n45) { const i26 = e57.getNorth(), s18 = e57.getSouth(), a46 = e57.getWest(), l21 = e57.getEast(), u12 = 1 << t45.z, c28 = l21 - a46, h8 = i26 - s18, p9 = c28 / Hl, d34 = -h8 / ql[r86], f8 = [0, p9, 0, d34, 0, 0, i26, a46, 0]; if (t45.z > 0) { const t46 = 180 / n45; o87(f8, f8, [t46 / c28 + 1, 0, 0, 0, t46 / h8 + 1, 0, -0.5 * t46 / p9, 0.5 * t46 / d34, 1]); } return f8[2] = u12, f8[5] = t45.x, f8[8] = t45.y, f8; }, t44.dF = Dc, t44.dG = function(t45, e57, r86) { const n45 = l20(new Float64Array(16)), i26 = (e57 / (1 << t45) - 0.5) * Math.PI * 2; return f7(n45, r86.globeMatrix, i26), Float32Array.from(n45); }, t44.dH = class { isDataAvailableAtPoint(t45) { const e57 = this._source(); if (this.isUsingMockSource() || !e57 || t45.y < 0 || t45.y > 1) return false; const r86 = e57.getSource().maxzoom, n45 = 1 << r86, i26 = Math.floor(t45.x), s18 = Math.floor((t45.x - i26) * n45), o88 = Math.floor(t45.y * n45), a46 = this.findDEMTileFor(new Mc(r86, i26, r86, s18, o88)); return !(!a46 || !a46.dem); } getAtPointOrZero(t45, e57 = 0) { return this.getAtPoint(t45, e57) || 0; } getAtPoint(t45, e57, r86 = true) { if (this.isUsingMockSource()) return null; null == e57 && (e57 = null); const n45 = this._source(); if (!n45) return e57; if (t45.y < 0 || t45.y > 1) return e57; const i26 = n45.getSource().maxzoom, s18 = 1 << i26, o88 = Math.floor(t45.x), a46 = t45.x - o88, l21 = new Mc(i26, o88, i26, Math.floor(a46 * s18), Math.floor(t45.y * s18)), u12 = this.findDEMTileFor(l21); if (!u12 || !u12.dem) return e57; const c28 = u12.dem, h8 = 1 << u12.tileID.canonical.z, p9 = (a46 * h8 - u12.tileID.canonical.x) * c28.dim, d34 = (t45.y * h8 - u12.tileID.canonical.y) * c28.dim, f8 = Math.floor(p9), m6 = Math.floor(d34); return (r86 ? this.exaggeration() : 1) * ur(ur(c28.get(f8, m6), c28.get(f8, m6 + 1), d34 - m6), ur(c28.get(f8 + 1, m6), c28.get(f8 + 1, m6 + 1), d34 - m6), p9 - f8); } getAtTileOffset(t45, e57, r86) { const n45 = 1 << t45.canonical.z; return this.getAtPointOrZero(new mu(t45.wrap + (t45.canonical.x + e57 / Rn) / n45, (t45.canonical.y + r86 / Rn) / n45)); } getAtTileOffsetFunc(t45, e57, r86, n45) { return (i26) => { const s18 = this.getAtTileOffset(t45, i26.x, i26.y), o88 = n45.upVector(t45.canonical, i26.x, i26.y); return E4(o88, o88, s18 * n45.upVectorScale(t45.canonical, e57, r86).metersToTile), o88; }; } getForTilePoints(t45, e57, r86, n45) { if (this.isUsingMockSource()) return false; const i26 = av.create(this, t45, n45); return !!i26 && (e57.forEach(((t46) => { t46[2] = this.exaggeration() * i26.getElevationAt(t46[0], t46[1], r86); })), true); } getMinMaxForTile(t45) { if (this.isUsingMockSource()) return null; const e57 = this.findDEMTileFor(t45); if (!e57 || !e57.dem) return null; const r86 = e57.dem.tree, n45 = e57.tileID, i26 = 1 << t45.canonical.z - n45.canonical.z; let s18 = t45.canonical.x / i26 - n45.canonical.x, o88 = t45.canonical.y / i26 - n45.canonical.y, a46 = 0; for (let e58 = 0; e58 < t45.canonical.z - n45.canonical.z && !r86.leaves[a46]; e58++) { s18 *= 2, o88 *= 2; const t46 = 2 * Math.floor(o88) + Math.floor(s18); a46 = r86.childOffsets[a46] + t46, s18 %= 1, o88 %= 1; } return { min: this.exaggeration() * r86.minimums[a46], max: this.exaggeration() * r86.maximums[a46] }; } getMinElevationBelowMSL() { throw new Error("Pure virtual method called."); } raycast(t45, e57, r86) { throw new Error("Pure virtual method called."); } pointCoordinate(t45) { throw new Error("Pure virtual method called."); } _source() { throw new Error("Pure virtual method called."); } isUsingMockSource() { throw new Error("Pure virtual method called."); } exaggeration() { throw new Error("Pure virtual method called."); } findDEMTileFor(t45) { throw new Error("Pure virtual method called."); } get visibleDemTiles() { throw new Error("Getter must be implemented in subclass."); } getMinMaxForVisibleTiles() { const t45 = this.visibleDemTiles; if (0 === t45.length) return null; let e57 = false, r86 = Number.MAX_VALUE, n45 = Number.MIN_VALUE; for (const i26 of t45) { const t46 = this.getMinMaxForTile(i26.tileID); t46 && (r86 = Math.min(r86, t46.min), n45 = Math.max(n45, t46.max), e57 = true); } return e57 ? { min: r86, max: n45 } : null; } }, t44.dI = vh, t44.dJ = Tc, t44.dK = function(t45, e57) { return [Math.pow(t45[0], 2.2) * e57, Math.pow(t45[1], 2.2) * e57, Math.pow(t45[2], 2.2) * e57]; }, t44.dL = i25, t44.dM = function(t45, e57) { var r86 = Math.sin(e57), n45 = Math.cos(e57); return t45[0] = n45, t45[1] = r86, t45[2] = 0, t45[3] = -r86, t45[4] = n45, t45[5] = 0, t45[6] = 0, t45[7] = 0, t45[8] = 1, t45; }, t44.dN = U3, t44.dO = Zc, t44.dP = te, t44.dQ = ee2, t44.dR = 256, t44.dS = function(t45, e57) { const r86 = [0, 0, 0]; return O3(r86, r86, Hc(Dc(e57.canonical))), O3(r86, r86, t45), r86; }, t44.dT = (t45) => ({ u_matrix: new Ml(t45), u_texsize: new vl(t45), u_pixels_to_tile_units: new Pl(t45), u_device_pixel_ratio: new xl(t45), u_width_scale: new xl(t45), u_floor_width_scale: new xl(t45), u_image: new gl(t45), u_units_to_pixels: new vl(t45), u_tile_units_to_pixels: new xl(t45), u_alpha_discard_threshold: new xl(t45), u_trim_offset: new vl(t45), u_trim_fade_range: new vl(t45), u_trim_color: new wl(t45), u_emissive_strength: new xl(t45), u_zbias_factor: new xl(t45), u_tile_to_meter: new xl(t45), u_ground_shadow_factor: new bl(t45), u_pattern_transition: new xl(t45) }), t44.dU = (t45) => ({ u_matrix: new Ml(t45), u_pixels_to_tile_units: new Pl(t45), u_device_pixel_ratio: new xl(t45), u_width_scale: new xl(t45), u_floor_width_scale: new xl(t45), u_units_to_pixels: new vl(t45), u_dash_image: new gl(t45), u_gradient_image: new gl(t45), u_image_height: new xl(t45), u_texsize: new vl(t45), u_tile_units_to_pixels: new xl(t45), u_alpha_discard_threshold: new xl(t45), u_trim_offset: new vl(t45), u_trim_fade_range: new vl(t45), u_trim_color: new wl(t45), u_emissive_strength: new xl(t45), u_zbias_factor: new xl(t45), u_tile_to_meter: new xl(t45), u_ground_shadow_factor: new bl(t45) }), t44.dV = (t45) => ({ u_camera_to_center_distance: new xl(t45), u_extrude_scale: new Pl(t45), u_device_pixel_ratio: new xl(t45), u_matrix: new Ml(t45), u_inv_rot_matrix: new Ml(t45), u_merc_center: new vl(t45), u_tile_id: new bl(t45), u_zoom_transition: new xl(t45), u_up_dir: new bl(t45), u_emissive_strength: new xl(t45) }), t44.dW = ka, t44.dX = ey, t44.dY = class { constructor(t45, e57, r86, n45) { this.context = t45, this.format = n45, this.size = r86, this.texture = t45.gl.createTexture(); const [i26, s18, o88] = this.size, { gl: a46 } = t45; a46.bindTexture(a46.TEXTURE_3D, this.texture), t45.pixelStoreUnpackFlipY.set(false), t45.pixelStoreUnpack.set(1), t45.pixelStoreUnpackPremultiplyAlpha.set(false), "data" in e57 && e57.data && a46.texImage3D(a46.TEXTURE_3D, 0, this.format, i26, s18, o88, 0, gf(this.format), xf(this.format), e57.data); } bind(t45, e57) { const { context: r86 } = this, { gl: n45 } = r86; n45.bindTexture(n45.TEXTURE_3D, this.texture), t45 !== this.minFilter && (n45.texParameteri(n45.TEXTURE_3D, n45.TEXTURE_MAG_FILTER, t45), n45.texParameteri(n45.TEXTURE_3D, n45.TEXTURE_MIN_FILTER, t45), this.minFilter = t45), e57 !== this.wrapS && (n45.texParameteri(n45.TEXTURE_3D, n45.TEXTURE_WRAP_S, e57), n45.texParameteri(n45.TEXTURE_3D, n45.TEXTURE_WRAP_T, e57), this.wrapS = e57); } destroy() { const { gl: t45 } = this.context; t45.deleteTexture(this.texture), this.texture = null; } }, t44.dZ = nh, t44.d_ = (t45, e57, r86, n45, i26, s18) => { const o88 = t45.transform, a46 = "globe" === o88.projection.name; let l21; if ("map" === s18.paint.get("circle-pitch-alignment")) if (a46) { const t46 = Zc(o88.zoom, e57.canonical) * o88._pixelsPerMercatorPixel; l21 = Float32Array.from([t46, 0, 0, t46]); } else l21 = o88.calculatePixelsToTileUnitsMatrix(r86); else l21 = new Float32Array([o88.pixelsToGLUnits[0], 0, 0, o88.pixelsToGLUnits[1]]); const u12 = { u_camera_to_center_distance: t45.transform.getCameraToCenterDistance(o88.projection), u_matrix: t45.translatePosMatrix(e57.projMatrix, r86, s18.paint.get("circle-translate"), s18.paint.get("circle-translate-anchor")), u_device_pixel_ratio: de3.devicePixelRatio, u_extrude_scale: l21, u_inv_rot_matrix: rh, u_merc_center: [0, 0], u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_up_dir: [0, 0, 0], u_emissive_strength: s18.paint.get("circle-emissive-strength") }; if (a46) { u12.u_inv_rot_matrix = n45, u12.u_merc_center = i26, u12.u_tile_id = [e57.canonical.x, e57.canonical.y, 1 << e57.canonical.z], u12.u_zoom_transition = Yc(o88.zoom); const t46 = i26[0] * Rn, r87 = i26[1] * Rn; u12.u_up_dir = o88.projection.upVector(new _c61(0, 0, 0), t46, r87); } return u12; }, t44.da = function(t45) { return [Math.pow(t45[0], 1 / 2.2), Math.pow(t45[1], 1 / 2.2), Math.pow(t45[2], 1 / 2.2)]; }, t44.db = ev, t44.dc = function(t45, e57) { return t45.readFields(kv, { icons: [] }, e57); }, t44.dd = Nd, t44.de = fg, t44.df = dg, t44.dg = Fe, t44.dh = mo, t44.di = me, t44.dj = We, t44.dk = Nt, t44.dl = function(t45) { const e57 = t45.indexOf(Yo); return e57 >= 0 ? t45.slice(0, e57) : t45; }, t44.dm = function(t45) { return t45.indexOf(Yo) >= 0; }, t44.dn = function(t45) { const e57 = t45.lastIndexOf(Yo); return e57 >= 0 ? t45.slice(e57 + 1) : ""; }, t44.dp = function(t45) { const e57 = [], r86 = t45.id; return void 0 === r86 && e57.push({ message: `layers.${r86}: missing required property "id"` }), void 0 === t45.render && e57.push({ message: `layers.${r86}: missing required method "render"` }), t45.renderingMode && "2d" !== t45.renderingMode && "3d" !== t45.renderingMode && e57.push({ message: `layers.${r86}: property "renderingMode" must be either "2d" or "3d"` }), e57; }, t44.dq = function(t45, e57, r86, n45) { return "custom" === t45.type ? new Kx(t45, e57) : new bv[t45.type](t45, e57, r86, n45); }, t44.dr = Ut2, t44.ds = function(t45) { const e57 = t45.indexOf(Yo); return e57 >= 0 ? t45.slice(e57 + 1) : ""; }, t44.dt = class extends _w { constructor(t45, e57) { super(t45._vectorTileFeature, t45._z, t45._x, t45._y, t45.id), t45.state && (this.state = Object.assign({}, t45.state)), this.target = e57.target, this.namespace = e57.namespace, e57.properties && (this.properties = e57.properties), this.target && ("featuresetId" in this.target && !this.target.importId || "layerId" in this.target) && (this.source = t45.source, this.sourceLayer = t45.sourceLayer, this.layer = t45.layer); } toJSON() { const t45 = super.toJSON(); return t45.target = this.target, t45.namespace = this.namespace, t45; } }, t44.du = go, t44.dv = Ce, t44.dw = function(t45) { return t45({ pluginStatus: po, pluginURL: fo }), go.on("pluginStateChange", t45), t45; }, t44.dx = _l, t44.dy = class extends yl { constructor(t45) { super(t45), this.current = Il; } set(t45, e57, r86) { if (this.fetchUniformLocation(t45, e57)) { for (let t46 = 0; t46 < 9; t46++) if (r86[t46] !== this.current[t46]) { this.current = r86, this.gl.uniformMatrix3fv(this.location, false, r86); break; } } } }, t44.dz = kt, t44.e = ne2, t44.e$ = function() { const t45 = Od; t45 && (t45.isPreloaded() && 1 === t45.numActive() ? (t45.release(Dd), Od = 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()")); }, t44.e0 = Cr, t44.e1 = (t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) => { const c28 = t45.transform, h8 = c28.pitch < 15 ? Dm(0.07, 0.7, Tt2((14 - c28.zoom) / 5, 0, 1)) : 0.07, p9 = "none" === r86.paint.get("line-trim-color-use-theme").constantOr("default"); return { u_matrix: Lm(t45, e57, r86, n45), u_texsize: e57.imageAtlasTexture ? e57.imageAtlasTexture.size : [0, 0], u_pixels_to_tile_units: c28.calculatePixelsToTileUnitsMatrix(e57), u_device_pixel_ratio: i26, u_width_scale: s18, u_floor_width_scale: o88, u_image: 0, u_tile_units_to_pixels: Rm(e57, c28), u_units_to_pixels: [1 / c28.pixelsToGLUnits[0], 1 / c28.pixelsToGLUnits[1]], u_alpha_discard_threshold: 0, u_trim_offset: a46, u_trim_fade_range: r86.paint.get("line-trim-fade-range"), u_trim_color: r86.paint.get("line-trim-color").toPremultipliedRenderColor(p9 ? null : r86.lut).toArray01(), u_emissive_strength: r86.paint.get("line-emissive-strength"), u_zbias_factor: h8, u_tile_to_meter: fu(e57.tileID.canonical, 0), u_ground_shadow_factor: l21, u_pattern_transition: u12 }; }, t44.e2 = (t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) => { const c28 = t45.transform, h8 = c28.calculatePixelsToTileUnitsMatrix(e57), p9 = "none" === r86.paint.get("line-trim-color-use-theme").constantOr("default"), d34 = c28.pitch < 15 ? Dm(0.07, 0.7, Tt2((14 - c28.zoom) / 5, 0, 1)) : 0.07; return { u_matrix: Lm(t45, e57, r86, n45), u_pixels_to_tile_units: h8, u_device_pixel_ratio: s18, u_width_scale: o88, u_floor_width_scale: a46, u_units_to_pixels: [1 / c28.pixelsToGLUnits[0], 1 / c28.pixelsToGLUnits[1]], u_dash_image: 0, u_gradient_image: 1, u_image_height: i26, u_texsize: Um(r86) && e57.lineAtlasTexture ? e57.lineAtlasTexture.size : [0, 0], u_tile_units_to_pixels: Rm(e57, t45.transform), u_alpha_discard_threshold: 0, u_trim_offset: l21, u_trim_fade_range: r86.paint.get("line-trim-fade-range"), u_trim_color: r86.paint.get("line-trim-color").toPremultipliedRenderColor(p9 ? null : r86.lut).toArray01(), u_emissive_strength: r86.paint.get("line-emissive-strength"), u_zbias_factor: d34, u_tile_to_meter: fu(e57.tileID.canonical, 0), u_ground_shadow_factor: u12 }; }, t44.e3 = Rt2, t44.e4 = bh, t44.e5 = uu, t44.e6 = Sc, t44.e7 = ud, t44.e8 = gd, t44.e9 = Kp, t44.eA = Ia, t44.eB = La, t44.eC = function(t45, e57, n45, i26, s18, o88, a46, l21, u12, c28, h8, p9, d34, f8, m6, y4) { var g9 = new r85(16); return g9[0] = t45, g9[1] = e57, g9[2] = n45, g9[3] = i26, g9[4] = s18, g9[5] = o88, g9[6] = a46, g9[7] = l21, g9[8] = u12, g9[9] = c28, g9[10] = h8, g9[11] = p9, g9[12] = d34, g9[13] = f8, g9[14] = m6, g9[15] = y4, g9; }, t44.eD = Kl, t44.eE = Ra, t44.eF = Da, t44.eG = class { constructor() { this._updateTime = 0, this._sourceIds = [], this._activeRegions = [], this._prevRegions = [], this._globalClipBounds = { min: new wt(1 / 0, 1 / 0), max: new wt(-1 / 0, -1 / 0) }; } clear() { this._activeRegions.length > 0 && ++this._updateTime, this._activeRegions = [], this._prevRegions = []; } get updateTime() { return this._updateTime; } getReplacementRegionsForTile(t45, e57 = false) { const r86 = Rp(new wt(0, 0), new wt(Rn, Rn), t45), n45 = []; if (e57 && !Cp(r86, this._globalClipBounds)) return n45; for (const e58 of this._activeRegions) { if (e58.hiddenByOverlap) continue; if (!Cp(r86, e58)) continue; const i26 = Lp(e58.min, e58.max, t45); n45.push({ min: i26.min, max: i26.max, sourceId: this._sourceIds[e58.priority], footprint: e58.footprint, footprintTileId: e58.tileId, order: e58.order, clipMask: e58.clipMask, clipScope: e58.clipScope }); } return n45; } setSources(t45) { this._setSources(t45.map(((t46) => ({ getSourceId: () => t46.cache.id, getFootprints: () => { const e57 = []; for (const r86 of t46.cache.getVisibleCoordinates()) { const n45 = t46.cache.getTile(r86).buckets[t46.layer]; n45 && n45.updateFootprints(r86.toUnwrapped(), e57); } return e57; }, getOrder: () => t46.order, getClipMask: () => t46.clipMask, getClipScope: () => t46.clipScope })))); } _addSource(t45) { const e57 = t45.getFootprints(); if (0 === e57.length) return; const r86 = t45.getOrder(), n45 = t45.getClipMask(), i26 = t45.getClipScope(); for (const t46 of e57) { if (!t46.footprint) continue; const e58 = Rp(t46.footprint.min, t46.footprint.max, t46.id); this._activeRegions.push({ min: e58.min, max: e58.max, hiddenByOverlap: false, priority: this._sourceIds.length, tileId: t46.id, footprint: t46.footprint, order: r86, clipMask: n45, clipScope: i26 }); } this._sourceIds.push(t45.getSourceId()); } _computeReplacement() { this._activeRegions.sort(((t46, e57) => t46.priority - e57.priority || Vp(t46.min, e57.min) || Vp(t46.max, e57.max) || t46.order - e57.order || t46.clipMask - e57.clipMask || (function(t47, e58) { const r86 = (t48, e59) => t48 + e59; return t47.length - e58.length || t47.reduce(r86, "").localeCompare(e58.reduce(r86, "")); })(t46.clipScope, e57.clipScope))); let t45 = this._activeRegions.length !== this._prevRegions.length; if (!t45) { let e57 = 0; for (; !t45 && e57 !== this._activeRegions.length; ) { const r86 = this._activeRegions[e57], n45 = this._prevRegions[e57]; t45 = r86.priority !== n45.priority || !Fp(r86, n45) || r86.order !== n45.order || r86.clipMask !== n45.clipMask || !_t(r86.clipScope, n45.clipScope), ++e57; } } if (t45) { ++this._updateTime; for (const t47 of this._activeRegions) t47.order !== Ep && (this._globalClipBounds.min.x = Math.min(this._globalClipBounds.min.x, t47.min.x), this._globalClipBounds.min.y = Math.min(this._globalClipBounds.min.y, t47.min.y), this._globalClipBounds.max.x = Math.max(this._globalClipBounds.max.x, t47.max.x), this._globalClipBounds.max.y = Math.max(this._globalClipBounds.max.y, t47.max.y)); const t46 = (t47) => { const e57 = this._activeRegions; if (t47 >= e57.length) return t47; const r86 = e57[t47].priority; for (; t47 < e57.length && e57[t47].priority === r86; ) ++t47; return t47; }; if (this._sourceIds.length > 1) { let e57 = 0, r86 = t46(e57); for (; e57 !== r86; ) { let n45 = e57; const i26 = e57; for (; n45 !== r86; ) { const t47 = this._activeRegions[n45]; t47.hiddenByOverlap = false; for (let e58 = 0; e58 < i26; e58++) { const r87 = this._activeRegions[e58]; if (!r87.hiddenByOverlap && t47.order === Ep && Cp(t47, r87) && (t47.hiddenByOverlap = Up(t47.footprint, t47.tileId, r87.footprint, r87.tileId), t47.hiddenByOverlap)) break; } ++n45; } e57 = r86, r86 = t46(e57); } } } } _setSources(t45) { [this._prevRegions, this._activeRegions] = [this._activeRegions, []], this._sourceIds = []; for (let e57 = t45.length - 1; e57 >= 0; e57--) this._addSource(t45[e57]); this._computeReplacement(); } }, t44.eH = Ep, t44.eI = class { constructor(t45) { this._createGrid(t45), this._createPoles(t45); } destroy() { this._poleIndexBuffer.destroy(), this._gridBuffer.destroy(), this._gridIndexBuffer.destroy(), this._poleNorthVertexBuffer.destroy(), this._poleSouthVertexBuffer.destroy(); for (const t45 of this._poleSegments) t45.destroy(); for (const t45 of this._gridSegments) t45.withSkirts.destroy(), t45.withoutSkirts.destroy(); } _fillGridMeshWithLods(t45, e57) { const r86 = new ua(), n45 = new Ea(), i26 = [], s18 = t45 + 1 + 2, o88 = e57[0] + 1, a46 = e57[0] + 1 + (1 + e57.length), l21 = (t46, e58, r87) => { let n46 = t46 === s18 - 1 ? t46 - 2 : 0 === t46 ? t46 : t46 - 1; return n46 += r87 ? 24575 : 0, [n46, e58]; }; for (let t46 = 0; t46 < s18; ++t46) r86.emplaceBack(...l21(t46, 0, true)); for (let t46 = 0; t46 < o88; ++t46) for (let e58 = 0; e58 < s18; ++e58) r86.emplaceBack(...l21(e58, t46, (0 === e58 || e58 === s18 - 1) && true)); for (let t46 = 0; t46 < e57.length; ++t46) { const n46 = e57[t46]; for (let t47 = 0; t47 < s18; ++t47) r86.emplaceBack(...l21(t47, n46, true)); } for (let t46 = 0; t46 < e57.length; ++t46) { const o89 = n45.length, l22 = e57[t46] + 1 + 2, u12 = new Ea(); for (let r87 = 0; r87 < l22 - 1; r87++) { const i27 = r87 === l22 - 2, o90 = i27 ? s18 * (a46 - e57.length + t46 - r87) : s18; for (let t47 = 0; t47 < s18 - 1; t47++) { const e58 = r87 * s18 + t47; 0 === r87 || i27 || 0 === t47 || t47 === s18 - 2 ? (u12.emplaceBack(e58 + 1, e58, e58 + o90), u12.emplaceBack(e58 + o90, e58 + o90 + 1, e58 + 1)) : (n45.emplaceBack(e58 + 1, e58, e58 + o90), n45.emplaceBack(e58 + o90, e58 + o90 + 1, e58 + 1)); } } const c28 = al.simpleSegment(0, o89, r86.length, n45.length - o89); for (let t47 = 0; t47 < u12.uint16.length; t47 += 3) n45.emplaceBack(u12.uint16[t47], u12.uint16[t47 + 1], u12.uint16[t47 + 2]); const h8 = al.simpleSegment(0, o89, r86.length, n45.length - o89); i26.push({ withoutSkirts: c28, withSkirts: h8 }); } return { vertices: r86, indices: n45, segments: i26 }; } _createGrid(t45) { const e57 = this._fillGridMeshWithLods(Hl, ql); this._gridSegments = e57.segments, this._gridBuffer = t45.createVertexBuffer(e57.vertices, Ec.members), this._gridIndexBuffer = t45.createIndexBuffer(e57.indices, true); } _createPoles(t45) { const e57 = new Ea(); for (let t46 = 0; t46 <= Hl; t46++) e57.emplaceBack(0, t46 + 1, t46 + 2); this._poleIndexBuffer = t45.createIndexBuffer(e57, true); const r86 = new Fa(), n45 = new Fa(), i26 = new Fa(), s18 = new Fa(); this._poleSegments = []; for (let t46 = 0, e58 = 0; t46 < jl; t46++) { const o88 = 360 / (1 << t46); r86.emplaceBack(0, -Nl, 0, 0.5, 0), n45.emplaceBack(0, -Nl, 0, 0.5, 1), i26.emplaceBack(0, -Nl, 0, 0.5, 0.5), s18.emplaceBack(0, -Nl, 0, 0.5, 0.5); for (let t47 = 0; t47 <= Hl; t47++) { let e59 = t47 / Hl, a46 = 0; const l21 = ur(0, o88, e59), [u12, c28, h8] = Wl(th, eh, l21, Nl); r86.emplaceBack(u12, c28, h8, e59, a46), n45.emplaceBack(u12, c28, h8, e59, 1 - a46); const p9 = It(l21); e59 = 0.5 + 0.5 * Math.sin(p9), a46 = 0.5 + 0.5 * Math.cos(p9), i26.emplaceBack(u12, c28, h8, e59, a46), s18.emplaceBack(u12, c28, h8, e59, 1 - a46); } this._poleSegments.push(al.simpleSegment(e58, 0, 66, 64)), e58 += 66; } this._poleNorthVertexBuffer = t45.createVertexBuffer(r86, kc, false), this._poleSouthVertexBuffer = t45.createVertexBuffer(n45, kc, false), this._texturedPoleNorthVertexBuffer = t45.createVertexBuffer(i26, kc, false), this._texturedPoleSouthVertexBuffer = t45.createVertexBuffer(s18, kc, false); } getGridBuffers(t45, e57) { return [this._gridBuffer, this._gridIndexBuffer, e57 ? this._gridSegments[t45].withSkirts : this._gridSegments[t45].withoutSkirts]; } getPoleBuffers(t45, e57) { return [e57 ? this._texturedPoleNorthVertexBuffer : this._poleNorthVertexBuffer, e57 ? this._texturedPoleSouthVertexBuffer : this._poleSouthVertexBuffer, this._poleIndexBuffer, this._poleSegments[t45]]; } }, t44.eJ = Tp, t44.eK = zt2, t44.eL = function() { return !!document.fullscreenElement || !!document.webkitFullscreenElement; }, t44.eM = Et, t44.eN = du, t44.eO = function(t45, e57, r86) { return t45[0] = e57[0] / r86[0], t45[1] = e57[1] / r86[1], t45[2] = e57[2] / r86[2], t45; }, t44.eP = H3, t44.eQ = Yl, t44.eR = V3, t44.eS = M4, t44.eT = function([t45, e57, r86]) { const n45 = Math.hypot(t45, e57, r86), i26 = Math.atan2(t45, r86), s18 = 0.5 * Math.PI - Math.acos(-e57 / n45); return new Ql(St(i26), St(s18)); }, t44.eU = W3, t44.eV = Bf, t44.eW = function(t45) { const e57 = t45.navigator ? t45.navigator.userAgent : null; return !!(function(t46) { if (null == Yt2) { const e58 = t46.navigator ? t46.navigator.userAgent : null; Yt2 = !!t46.safari || !(!e58 || !(/\b(iPad|iPhone|iPod)\b/.test(e58) || e58.match("Safari") && !e58.match("Chrome"))); } return Yt2; })(t45) && !(!e57 || !(e57.match("Version/15.4") || e57.match("Version/15.5") || e57.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))); }, t44.eX = function(t45, e57) { ge = t45, xe2 = e57; }, t44.eY = Jc, t44.eZ = Kc, t44.e_ = function(t45) { const e57 = [0, 0, 0], r86 = l20(new Float64Array(16)); return c27(r86, t45.pixelMatrix, t45.globeMatrix), O3(e57, e57, r86), new wt(e57[0], e57[1]); }, t44.ea = 450, t44.eb = 7, t44.ec = pu, t44.ed = function(t45, e57) { if (t45 === e57) { var r86 = e57[1], n45 = e57[2], i26 = e57[3], s18 = e57[6], o88 = e57[7], a46 = e57[11]; t45[1] = e57[4], t45[2] = e57[8], t45[3] = e57[12], t45[4] = r86, t45[6] = e57[9], t45[7] = e57[13], t45[8] = n45, t45[9] = s18, t45[11] = e57[14], t45[12] = i26, t45[13] = o88, t45[14] = a46; } else t45[0] = e57[0], t45[1] = e57[4], t45[2] = e57[8], t45[3] = e57[12], t45[4] = e57[1], t45[5] = e57[5], t45[6] = e57[9], t45[7] = e57[13], t45[8] = e57[2], t45[9] = e57[6], t45[10] = e57[10], t45[11] = e57[14], t45[12] = e57[3], t45[13] = e57[7], t45[14] = e57[11], t45[15] = e57[15]; return t45; }, t44.ee = $x, t44.ef = aa2, t44.eg = $a, t44.eh = 256, t44.ei = qc, t44.ej = ga, t44.ek = f7, t44.el = function(t45, e57) { return t45[0] = e57[0], t45[1] = e57[1], t45[2] = e57[2], t45[3] = e57[4], t45[4] = e57[5], t45[5] = e57[6], t45[6] = e57[8], t45[7] = e57[9], t45[8] = e57[10], t45; }, t44.em = Fa, t44.en = Ca, t44.eo = fs, t44.ep = function(t45, e57, r86, n45, i26) { return Tt2((t45 - e57) / (r86 - e57) * (i26 - n45) + n45, n45, i26); }, t44.eq = tt, t44.er = function(t45, e57) { var r86 = e57[0], n45 = e57[1], i26 = e57[2], s18 = e57[3], o88 = e57[4], a46 = e57[5], l21 = e57[6], u12 = e57[7], c28 = e57[8], h8 = c28 * o88 - a46 * u12, p9 = -c28 * s18 + a46 * l21, d34 = u12 * s18 - o88 * l21, f8 = r86 * h8 + n45 * p9 + i26 * d34; return f8 ? (t45[0] = h8 * (f8 = 1 / f8), t45[1] = (-c28 * n45 + i26 * u12) * f8, t45[2] = (a46 * n45 - i26 * o88) * f8, t45[3] = p9 * f8, t45[4] = (c28 * r86 - i26 * l21) * f8, t45[5] = (-a46 * r86 + i26 * s18) * f8, t45[6] = d34 * f8, t45[7] = (-u12 * r86 + n45 * l21) * f8, t45[8] = (o88 * r86 - n45 * s18) * f8, t45) : null; }, t44.es = 2, t44.et = F16, t44.eu = Df, t44.ev = [1, 1, 1], t44.ew = av, t44.ex = X2, t44.ey = function(t45, e57, r86, n45) { var i26 = e57[0], s18 = e57[1], o88 = e57[2], a46 = e57[3]; return t45[0] = i26 + n45 * (r86[0] - i26), t45[1] = s18 + n45 * (r86[1] - s18), t45[2] = o88 + n45 * (r86[2] - o88), t45[3] = a46 + n45 * (r86[3] - a46), t45; }, t44.ez = Of, t44.f = function(t45) { return btoa(encodeURIComponent(t45).replace(/%([0-9A-F]{2})/g, ((t46, e57) => String.fromCharCode(Number("0x" + e57))))); }, t44.f0 = function() { Nd().acquire(Dd); }, t44.f1 = xo, t44.f2 = function(t45, e57, r86 = false) { if (po === co.deferred || po === co.loading || po === co.loaded) throw new Error("setRTLTextPlugin cannot be called multiple times."); fo = de3.resolveURL(t45), po = co.deferred, ho = e57, yo(), r86 || vo(); }, t44.f3 = function(t45) { qd = de3.resolveURL(t45), Zd || (Zd = new Ld(Nd(), new tr())), Zd.broadcast("setMeshoptUrl", qd); }, t44.f4 = Qd, t44.f5 = function(t45) { Gd = de3.resolveURL(t45), Zd || (Zd = new Ld(Nd(), new tr())), Zd.broadcast("setDracoUrl", Gd); }, t44.f6 = Jd, t44.f7 = Cd, t44.f8 = function(t45) { const e57 = _e2(); if (!e57) return; const r86 = e57.delete(ye); t45 && r86.then((() => t45())).catch(t45); }, t44.f9 = Rd, t44.fA = function(t45) { Ae(), null != be2 && be2.then(((e57) => { e57.keys().then(((r86) => { for (let n45 = 0; n45 < r86.length - t45; n45++) e57.delete(r86[n45]).catch(((t46) => Gt(t46.message))); })).catch(((t46) => Gt(t46.message))); })).catch(((t46) => Gt(t46.message))); }, t44.fa = Ws, t44.fb = gh, t44.fc = pg, t44.fd = bw, t44.fe = Aw, t44.ff = Pm, t44.fg = Bu, t44.fh = "hd_road_elevation", t44.fi = Yu, t44.fj = Ot, t44.fk = np, t44.fl = ag, t44.fm = sg, t44.fn = function(t45, e57, r86, n45, i26, s18, o88, a46 = 1, l21, u12, c28) { t45.createArrays(), t45.tilePixelRatio = Rn / (512 * t45.overscaling), t45.compareText = {}, t45.iconsNeedLinear = false; const h8 = t45.layers[0].layout, p9 = t45.layers[0]._unevaluatedLayout._values, d34 = {}; d34.scaleFactor = a46, d34.textSizeScaleRange = h8.get("text-size-scale-range"), d34.iconSizeScaleRange = h8.get("icon-size-scale-range"); const [f8, m6] = d34.textSizeScaleRange, [y4, g9] = d34.iconSizeScaleRange; d34.textScaleFactor = Tt2(d34.scaleFactor, f8, m6), d34.iconScaleFactor = Tt2(d34.scaleFactor, y4, g9); const x4 = p9["text-size"], v8 = p9["icon-size"]; if ("composite" === t45.textSizeData.kind) { const { minZoom: e58, maxZoom: r87 } = t45.textSizeData; d34.compositeTextSizes = [x4.possiblyEvaluate(new wo(e58, { worldview: c28 }), s18), x4.possiblyEvaluate(new wo(r87, { worldview: c28 }), s18)]; } if ("composite" === t45.iconSizeData.kind) { const { minZoom: e58, maxZoom: r87 } = t45.iconSizeData; d34.compositeIconSizes = [v8.possiblyEvaluate(new wo(e58, { worldview: c28 }), s18), v8.possiblyEvaluate(new wo(r87, { worldview: c28 }), s18)]; } d34.layoutTextSize = x4.possiblyEvaluate(new wo(o88 + 1, { worldview: c28 }), s18), d34.layoutIconSize = v8.possiblyEvaluate(new wo(o88 + 1, { worldview: c28 }), s18), d34.textMaxSize = x4.possiblyEvaluate(new wo(18, { worldview: c28 }), s18); const b8 = h8.get("symbol-placement"), w4 = "map" === h8.get("text-rotation-alignment") && "point" !== b8, _4 = h8.get("text-size"); let A4 = false; const M5 = []; for (const o89 of t45.features) { const a47 = h8.get("text-font").evaluate(o89, {}, s18).join(","), f9 = _4.evaluate(o89, {}, s18) * d34.textScaleFactor, m7 = d34.layoutTextSize.evaluate(o89, {}, s18) * d34.textScaleFactor, y5 = d34.layoutIconSize.evaluate(o89, {}, s18) * d34.iconScaleFactor, g10 = { horizontal: {}, vertical: void 0 }, x5 = o89.text; let v9, I4 = [0, 0]; if (x5) { const n46 = x5.toString(), u13 = h8.get("text-letter-spacing").evaluate(o89, {}, s18) * ry, c29 = h8.get("text-line-height").evaluate(o89, {}, s18) * ry, p10 = ro(n46) ? u13 : 0, d35 = h8.get("text-anchor").evaluate(o89, {}, s18), y6 = h8.get("text-variable-anchor"); if (!y6) { const t46 = h8.get("text-radial-offset").evaluate(o89, {}, s18); if (t46) I4 = zg(d35, [t46 * ry, Pg]); else { const t47 = h8.get("text-offset").evaluate(o89, {}, s18); I4 = [t47[0] * ry, t47[1] * ry]; } } let v10 = w4 ? "center" : h8.get("text-justify").evaluate(o89, {}, s18); const _5 = "point" === b8, A5 = _5 ? h8.get("text-max-width").evaluate(o89, {}, s18) * ry : 1 / 0, M6 = (s19) => { t45.allowVerticalPlacement && eo(n46) && (g10.vertical = Ey(x5, e57, r86, i26, a47, A5, c29, d35, s19, p10, I4, Py.vertical, true, m7, f9, l21)); }; if (!w4 && y6) { const t46 = "auto" === v10 ? y6.map(((t47) => Rg(t47))) : [v10]; let n47 = false; for (let s19 = 0; s19 < t46.length; s19++) { const o90 = t46[s19]; if (!g10.horizontal[o90]) if (n47) g10.horizontal[o90] = g10.horizontal[0]; else { const t47 = Ey(x5, e57, r86, i26, a47, A5, c29, "center", o90, p10, I4, Py.horizontal, false, m7, f9, l21); t47 && (g10.horizontal[o90] = t47, n47 = 1 === t47.positionedLines.length); } } M6("left"); } else { if ("auto" === v10 && (v10 = Rg(d35)), _5 || h8.get("text-writing-mode").indexOf("horizontal") >= 0 || !eo(n46)) { const t46 = Ey(x5, e57, r86, i26, a47, A5, c29, d35, v10, p10, I4, Py.horizontal, false, m7, f9, l21); t46 && (g10.horizontal[v10] = t46); } M6(_5 ? "left" : v10); } } let S5, P4, k7, z4, E5, T5, B6 = false; const V4 = h8.get("icon-text-fit").evaluate(o89, {}, s18); if (o89.icon && o89.icon.hasPrimary()) { const e58 = Bg(o89.icon, t45.iconSizeData, p9["icon-size"], s18, t45.zoom, o89, l21, d34.iconScaleFactor, c28); S5 = e58.iconPrimary, k7 = e58.iconSecondary; const r87 = S5.toString(); if (P4 = n45.get(r87), P4 && (E5 = h8.get("icon-offset").evaluate(o89, {}, s18), T5 = h8.get("icon-anchor").evaluate(o89, {}, s18), v9 = Ny(i26.get(r87), k7 ? i26.get(k7.toString()) : void 0, E5, T5), B6 = P4.sdf, void 0 === t45.sdfIcons ? t45.sdfIcons = P4.sdf : t45.sdfIcons !== P4.sdf && Gt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (P4.pixelRatio !== t45.pixelRatio || 0 !== h8.get("icon-rotate").constantOr(1)) && (t45.iconsNeedLinear = true)), k7) { const t46 = k7.toString(); z4 = n45.get(t46); } } A4 = A4 || !(!o89.icon || !o89.icon.hasSecondary()); const F17 = $g(g10.horizontal) || g10.vertical; t45.iconsInText || (t45.iconsInText = !!F17 && F17.iconsInText); const C6 = m7 * d34.textScaleFactor / ry, { defaultShapedIcon: D5, verticallyShapedIcon: R5 } = Lg(t45, v9, h8, o89, s18, g10, C6, E5, V4); "none" !== V4 && v9 && ($y(v9) || Gy(v9)) && (Eg(0, P4, S5, v9, D5, V4, u12, n45, i26), Eg(0, z4, k7, v9, D5, V4, u12, n45, i26), R5 && (Eg(0, P4, S5, v9, R5, V4, u12, n45, i26), Eg(0, z4, k7, v9, R5, V4, u12, n45, i26))), v9 = D5, M5.push({ feature: o89, shapedTextOrientations: g10, shapedText: F17, shapedIcon: v9, iconPrimary: S5, iconSecondary: k7, iconOffset: E5, iconAnchor: T5, verticallyShapedIcon: R5, layoutTextSize: m7, layoutIconSize: y5, textOffset: I4, isSDFIcon: B6, iconTextFit: V4 }); } return { featureData: M5, sizes: d34, hasAnySecondaryIcon: A4, textAlongLine: w4, symbolPlacement: b8 }; }, t44.fo = lg, t44.fp = function(t45, e57, r86, n45, i26, s18, o88, a46, l21, u12) { const { featureData: c28, hasAnySecondaryIcon: h8, sizes: p9, textAlongLine: d34, symbolPlacement: f8 } = e57; for (const e58 of c28) { const { shapedIcon: r87, verticallyShapedIcon: s19, feature: c29, shapedTextOrientations: m6, shapedText: y4, layoutTextSize: g9, textOffset: x4, isSDFIcon: v8, iconPrimary: b8, iconSecondary: w4, iconTextFit: _4, iconOffset: A4 } = e58; Fg(r87, u12.iconPositions, b8, w4), Fg(s19, u12.iconPositions, b8, w4), Cg(m6, u12.iconPositions), Vg(b8, w4, u12.iconPositions), (y4 || r87) && Og(t45, c29, m6, r87, s19, l21, p9, g9, 0, x4, v8, n45, i26, o88, a46, h8, _4, A4, d34, f8); } r86 && t45.generateCollisionDebugBuffers(s18, t45.collisionBoxArray, p9.textScaleFactor); }, t44.fq = Eu, t44.fr = Pb, t44.fs = Iu, t44.ft = function(t45) { let e57 = 0; if (new Uint32Array(t45, 0, 1)[0] !== cf) { const r86 = new Uint32Array(t45, 0, 7), [, , n45, i26, s18, o88] = r86; e57 = r86.byteLength + i26 + s18 + o88 + s18, (n45 !== t45.byteLength || e57 >= t45.byteLength) && Gt("Invalid b3dm header information."); } return yf(t45, e57); }, t44.fu = function(t45, e57) { const r86 = Qf(t45); for (const t46 of r86) { for (const e58 of t46.meshes) tm(e58); t46.lights && (t46.lightMeshIndex = t46.meshes.length, t46.meshes.push(rm(t46.lights, e57))); } return r86; }, t44.fv = fv, t44.fw = Zt2, t44.fx = Fd, t44.fy = bo, t44.fz = co, t44.g = function(t45, e57) { return Ce(Object.assign(t45, { method: "GET" }), e57); }, t44.h = function(t45) { return 0 === t45.indexOf("mapbox:"); }, t44.i = function(t45) { return ne2.API_STYLE_REGEX.test(t45) && !se(t45); }, t44.j = ie2, t44.k = Ie, t44.l = function(t45) { return decodeURIComponent(atob(t45).split("").map(((t46) => "%" + ("00" + t46.charCodeAt(0).toString(16)).slice(-2))).join("")); }, t44.m = function(t45, e57) { return Ce(Object.assign(t45, { type: "json" }), e57); }, t44.n = Ne, t44.o = de3, t44.p = function(t45, e57) { return Ce(Object.assign(t45, { method: "POST" }), e57); }, t44.q = xh, t44.r = pe, t44.s = function(t45) { try { const e57 = self[t45]; return e57.setItem("_mapbox_test_", 1), e57.removeItem("_mapbox_test_"), true; } catch (t46) { return false; } }, t44.t = function() { return Ud || (Ud = new Rd()), Ud; }, t44.u = function() { return (function t45(e57) { return e57 ? (e57 ^ Math.random() * (16 >> e57 / 4)).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, t45); })(); }, t44.v = function(t45) { return !!t45 && /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t45); }, t44.w = Gt, t44.x = mb, t44.y = Ke, t44.z = Ye; })); define2(["./shared"], (function(e56) { function t44(e57) { const t45 = e57 ? e57.url.toString() : void 0; return t45 ? performance.getEntriesByName(t45) : []; } function s17(e57) { if ("number" == typeof e57 || "boolean" == typeof e57 || "string" == typeof e57 || null == e57) return JSON.stringify(e57); if (Array.isArray(e57)) { let t46 = "["; for (const i26 of e57) t46 += `${s17(i26)},`; return `${t46}]`; } let t45 = "{"; for (const i26 of Object.keys(e57).sort()) t45 += `${i26}:${s17(e57[i26])},`; return `${t45}}`; } function i25(t45) { let i26 = ""; for (const o88 of e56.bx) i26 += `/${s17(t45[o88])}`; return i26; } class o87 { constructor(e57) { this.keyCache = {}, this._layers = {}, this._layerConfigs = {}, e57 && this.replace(e57); } replace(e57, t45) { this._layerConfigs = {}, this._layers = {}, this.update(e57, [], t45); } update(t45, o88, n45) { this._options = n45; for (const s18 of t45) this._layerConfigs[s18.id] = s18, (this._layers[s18.id] = e56.dq(s18, this.scope, null, this._options)).compileFilter(n45), this.keyCache[s18.id] && delete this.keyCache[s18.id]; for (const e57 of o88) delete this.keyCache[e57], delete this._layerConfigs[e57], delete this._layers[e57]; this.familiesBySource = {}; const r86 = (function(e57, t46) { const o89 = {}; for (let n47 = 0; n47 < e57.length; n47++) { const r87 = e57[n47]; let a46 = t46 && t46[r87.id]; a46 || ("symbol" === r87.type ? a46 = r87.id : (a46 = i25(r87), "line" === r87.type && r87.paint && (function e58(t47) { return "string" == typeof t47 && "line-progress" === t47 || (Array.isArray(t47) ? t47.some(e58) : !(!t47 || "object" != typeof t47) && Object.values(t47).some(e58)); })(r87.paint["line-width"]) && (a46 += `/${s17(r87.paint["line-width"])}`))), t46 && (t46[r87.id] = a46); let l21 = o89[a46]; l21 || (l21 = o89[a46] = []), l21.push(r87); } const n46 = []; for (const e58 in o89) n46.push(o89[e58]); return n46; })(Object.values(this._layerConfigs), this.keyCache); for (const e57 of r86) { const t46 = e57.map(((e58) => this._layers[e58.id])), s18 = t46[0]; if ("none" === s18.visibility) continue; const i26 = s18.source || ""; let o89 = this.familiesBySource[i26]; o89 || (o89 = this.familiesBySource[i26] = {}); const n46 = s18.sourceLayer || "_geojsonTileLayer"; let r87 = o89[n46]; r87 || (r87 = o89[n46] = []), r87.push(t46); } } } const n44 = 1 * e56.fc; class r85 { constructor(t45) { const s18 = {}, i26 = []; for (const e57 in t45) { const o89 = t45[e57], r87 = s18[e57] = {}; for (const e58 in o89.glyphs) { const t46 = o89.glyphs[+e58]; if (!t46 || 0 === t46.bitmap.width || 0 === t46.bitmap.height) continue; const s19 = t46.metrics.localGlyph ? n44 : 1, a47 = { x: 0, y: 0, w: t46.bitmap.width + 2 * s19, h: t46.bitmap.height + 2 * s19 }; i26.push(a47), r87[e58] = a47; } } const { w: o88, h: r86 } = e56.G(i26), a46 = new e56.fb({ width: o88 || 1, height: r86 || 1 }); for (const i27 in t45) { const o89 = t45[i27]; for (const t46 in o89.glyphs) { const r87 = o89.glyphs[+t46]; if (!r87 || 0 === r87.bitmap.width || 0 === r87.bitmap.height) continue; const l21 = s18[i27][t46], c28 = r87.metrics.localGlyph ? n44 : 1; e56.fb.copy(r87.bitmap, a46, { x: 0, y: 0 }, { x: l21.x + c28, y: l21.y + c28 }, r87.bitmap); } } this.image = a46, this.positions = s18; } } e56.fa(r85, "GlyphAtlas"); class a45 { constructor(t45) { this.tileID = new e56.aO(t45.tileID.overscaledZ, t45.tileID.wrap, t45.tileID.canonical.z, t45.tileID.canonical.x, t45.tileID.canonical.y), this.tileZoom = t45.tileZoom, this.uid = t45.uid, this.zoom = t45.zoom, this.lut = t45.lut, this.canonical = t45.tileID.canonical, this.pixelRatio = t45.pixelRatio, this.tileSize = t45.tileSize, this.source = t45.source, this.scope = t45.scope, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t45.showCollisionBoxes, this.collectResourceTiming = !!t45.request && t45.request.collectResourceTiming, this.promoteId = t45.promoteId, this.isSymbolTile = t45.isSymbolTile, this.tileTransform = e56.aZ(t45.tileID.canonical, t45.projection), this.projection = t45.projection, this.worldview = t45.worldview, this.localizableLayerIds = t45.localizableLayerIds, this.brightness = t45.brightness, this.extraShadowCaster = !!t45.extraShadowCaster, this.tessellationStep = t45.tessellationStep, this.scaleFactor = t45.scaleFactor, this.worldview = t45.worldview; } parse(t45, s18, i26, o88, n45, a46) { this.status = "parsing", this.data = t45, this.collisionBoxArray = new e56.b3(); const c28 = new e56.fd(Object.keys(t45.layers).sort()), h8 = new e56.fe(this.tileID, this.promoteId); h8.bucketLayerIDs = []; const u12 = {}, d34 = new e56.ff(256, 256), f8 = { featureIndex: h8, iconDependencies: /* @__PURE__ */ new Map(), patternDependencies: /* @__PURE__ */ new Map(), glyphDependencies: {}, lineAtlas: d34, availableImages: i26, brightness: this.brightness, scaleFactor: this.scaleFactor, elevationFeatures: void 0 }, p9 = [], g9 = s18.familiesBySource[this.source]; for (const s19 in g9) { const n46 = t45.layers[s19]; if (!n46) continue; let r86 = false, a47 = false, d35 = false; for (const e57 of g9[s19]) "symbol" === e57[0].type ? r86 = true : a47 = true, e57[0].is3D() && "model" !== e57[0].type && (d35 = true); if (this.extraShadowCaster && !d35) continue; if (true === this.isSymbolTile && !r86) continue; if (false === this.isSymbolTile && !a47) continue; 1 === n46.version && e56.w(`Vector tile source "${this.source}" layer "${s19}" does not use vector tile spec v2 and therefore may have some rendering errors.`); const m7 = c28.encode(s19), y4 = []; let w4 = false; for (let t46 = 0, i27 = 0; t46 < n46.length; t46++) { const o89 = n46.feature(t46), r87 = h8.getId(o89, s19); if (this.localizableLayerIds && this.localizableLayerIds.has(s19)) { const e57 = o89.properties ? o89.properties.worldview : null; if (this.worldview && "string" == typeof e57) if ("all" === e57) o89.properties.$localized = true; else { if (!e57.split(",").includes(this.worldview)) continue; o89.properties.$localized = true, o89.properties.worldview = this.worldview; } } !w4 && o89.properties && o89.properties.hasOwnProperty(e56.fg) && (w4 = true), y4.push({ feature: o89, id: r87, index: i27, sourceLayerIndex: m7 }), i27++; } w4 && !f8.elevationFeatures && t45.layers.hasOwnProperty(e56.fh) && (f8.elevationFeatures = e56.fi.parseFrom(t45.layers[e56.fh], this.canonical)); for (const t46 of g9[s19]) { const s20 = t46[0]; if (this.extraShadowCaster && (!s20.is3D() || "model" === s20.type)) continue; if (void 0 !== this.isSymbolTile && "symbol" === s20.type !== this.isSymbolTile) continue; if (s20.minzoom && this.zoom < Math.floor(s20.minzoom)) continue; if (s20.maxzoom && this.zoom >= s20.maxzoom) continue; if ("none" === s20.visibility) continue; l20(t46, this.zoom, f8.brightness, i26, this.worldview); const n47 = u12[s20.id] = s20.createBucket({ index: h8.bucketLayerIDs.length, layers: t46, zoom: this.zoom, lut: this.lut, canonical: this.canonical, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: m7, sourceID: this.source, projection: this.projection.spec, tessellationStep: this.tessellationStep, styleDefinedModelURLs: o88, worldview: this.worldview }); h8.bucketLayerIDs.push(t46.map(((t47) => e56.B(t47.id, t47.scope)))); let r87 = n47.prepare ? n47.prepare() : null; null != r87 ? (r87 = r87.then((() => n47.populate(y4, f8, this.tileID.canonical, this.tileTransform))), p9.push(r87)) : n47.populate(y4, f8, this.tileID.canonical, this.tileTransform); } } const m6 = () => { let s19, o89, p10, g10, m7, y4; d34.trim(); const w4 = { type: "maybePrepare", isSymbolTile: this.isSymbolTile, zoom: this.zoom }, b8 = () => { if (s19) return this.status = "done", a46(s19); if (this.extraShadowCaster) this.status = "done", a46(null, { buckets: Object.values(u12).filter(((e57) => !e57.isEmpty())), featureIndex: h8, collisionBoxArray: null, glyphAtlasImage: null, lineAtlas: null, imageAtlas: null, brightness: f8.brightness, glyphMap: null, iconMap: null, glyphPositions: null }); else if (o89 && p10 && g10) { const t46 = new r85(o89), s20 = /* @__PURE__ */ new Map(); for (const [t47, i27] of p10.entries()) { const { imagePosition: o90 } = e56.fl(t47, i27, e56.fm); s20.set(t47, o90); } const a47 = {}; for (const n46 in u12) { const r86 = u12[n46]; r86 instanceof e56.b4 && (l20(r86.layers, this.zoom, f8.brightness, i26, this.worldview), a47[n46] = e56.fn(r86, o89, t46.positions, p10, s20, this.tileID.canonical, this.tileZoom, this.scaleFactor, this.pixelRatio, m7, this.worldview)); } const c29 = { iconsPending: true, patternsPending: true }; this.rasterizeIfNeeded(n45, p10, m7, (() => { c29.iconsPending = false, x4(a47, t46, c29); })), this.rasterizeIfNeeded(n45, g10, y4, (() => { c29.patternsPending = false, x4(a47, t46, c29); })); } }, x4 = (t46, s20, o90, n46) => { if (o90.iconsPending || o90.patternsPending) return; const r86 = new e56.fo(p10, g10, this.lut); for (const s21 in u12) { const o91 = u12[s21]; if (s21 in t46) e56.fp(o91, t46[s21], this.showCollisionBoxes, i26, this.tileID.canonical, this.tileZoom, this.projection, this.brightness, p10, r86); else if (o91.hasPattern && (o91 instanceof e56.ba || o91 instanceof e56.bb || o91 instanceof e56.e7)) { l20(o91.layers, this.zoom, f8.brightness, i26, this.worldview); const e57 = Object.fromEntries(r86.patternPositions); o91.addFeatures(f8, this.tileID.canonical, e57, i26, this.tileTransform, this.brightness); } } this.status = "done", a46(null, { buckets: Object.values(u12).filter(((e57) => !e57.isEmpty())), featureIndex: h8, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: s20.image, lineAtlas: d34, imageAtlas: r86, brightness: f8.brightness }); }; if (!this.extraShadowCaster) { const t46 = e56.fj(f8.glyphDependencies, ((e57) => Object.keys(e57).map(Number))); Object.keys(t46).length ? n45.send("getGlyphs", { uid: this.uid, stacks: t46 }, ((e57, t47) => { s19 || (s19 = e57, o89 = t47, b8()); }), void 0, false, w4) : o89 = {}; const i27 = Array.from(f8.iconDependencies.keys()).map(((t47) => e56.I.parse(t47))); i27.length ? n45.send("getImages", { images: i27, source: this.source, scope: this.scope, tileID: this.tileID, type: "icons" }, ((e57, t47) => { s19 || (s19 = e57, p10 = /* @__PURE__ */ new Map(), m7 = this.updateImageMapAndGetImageTaskQueue(p10, t47, f8.iconDependencies), b8()); }), void 0, false, w4) : (p10 = /* @__PURE__ */ new Map(), m7 = /* @__PURE__ */ new Map()); const r86 = Array.from(f8.patternDependencies.keys()).map(((t47) => e56.I.parse(t47))); r86.length ? n45.send("getImages", { images: r86, source: this.source, scope: this.scope, tileID: this.tileID, type: "patterns" }, ((e57, t47) => { s19 || (s19 = e57, g10 = /* @__PURE__ */ new Map(), y4 = this.updateImageMapAndGetImageTaskQueue(g10, t47, f8.patternDependencies), b8()); }), void 0, false, w4) : (g10 = /* @__PURE__ */ new Map(), y4 = /* @__PURE__ */ new Map()); } if (f8.elevationFeatures && f8.elevationFeatures.length > 0) { const s20 = []; for (const t46 of Object.values(u12)) if (t46 instanceof e56.bb) { const e57 = t46.getUnevaluatedPortalGraph(); e57 && s20.push(e57); } const i27 = e56.fk.evaluate(s20); for (const s21 of Object.values(u12)) if (s21 instanceof e56.bb) { const e57 = t45.layers[c28.decode(s21.sourceLayerIndex)]; s21.setEvaluatedPortalGraph(i27, e57, this.tileID.canonical, f8.availableImages, f8.brightness); } } b8(); }; p9.length > 0 ? Promise.allSettled(p9).then(m6).catch(a46) : m6(); } rasterizeIfNeeded(e57, t45, s18, i26) { Array.from(t45.values()).some(((e58) => e58.usvg)) ? this.rasterize(e57, t45, s18, i26) : i26(); } updateImageMapAndGetImageTaskQueue(e57, t45, s18) { const i26 = /* @__PURE__ */ new Map(); for (const o88 of t45.keys()) { const n45 = s18.get(o88) || []; for (const s19 of n45) { const o89 = s19.toString(), n46 = t45.get(s19.id.toString()); n46.usvg ? i26.has(o89) || (i26.set(o89, s19), e57.set(o89, Object.assign({}, n46))) : e57.set(o89, n46); } } return i26; } rasterize(e57, t45, s18, i26) { this.rasterizeTask = e57.send("rasterizeImages", { scope: this.scope, tasks: s18 }, ((e58, s19) => { if (!e58) for (const [e59, i27] of s19.entries()) { const s20 = Object.assign(t45.get(e59), { data: i27 }); t45.set(e59, s20); } i26(); })); } cancelRasterize() { this.rasterizeTask && this.rasterizeTask.cancel(); } } function l20(t45, s18, i26, o88, n45) { const r86 = new e56.ac(s18, { brightness: i26, worldview: n45 }); for (const e57 of t45) e57.recalculate(r86, o88); } class c27 extends e56.E { constructor(t45, s18, i26, o88, n45, r86, a46) { super(), this.actor = t45, this.layerIndex = s18, this.availableImages = i26, this.availableModels = o88, this.loadVectorData = r86 || e56.aL, this.loading = {}, this.loaded = {}, this.deduped = new e56.aK(t45.scheduler), this.isSpriteLoaded = n45, this.scheduler = t45.scheduler, this.brightness = a46; } loadTile(s18, i26) { const o88 = s18.uid, n45 = s18 && s18.request, r86 = n45 && n45.collectResourceTiming, l21 = this.loading[o88] = new a45(s18); l21.abort = this.loadVectorData(s18, ((a46, c28) => { const h8 = !this.loading[o88]; if (delete this.loading[o88], l21.cancelRasterize(), h8 || a46 || !c28) return l21.status = "done", h8 || (this.loaded[o88] = l21), i26(a46); const u12 = c28.rawData, d34 = {}; c28.expires && (d34.expires = c28.expires), c28.cacheControl && (d34.cacheControl = c28.cacheControl), l21.vectorTile = c28.vectorTile || new e56.fq(new e56.bt(u12)); const f8 = () => { l21.parse(l21.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, ((e57, s19) => { if (e57 || !s19) return i26(e57); const o89 = {}; if (r86) { const e58 = t44(n45); e58.length > 0 && (o89.resourceTiming = JSON.parse(JSON.stringify(e58))); } i26(null, Object.assign({ rawTileData: u12.slice(0) }, s19, d34, o89)); })); }; this.isSpriteLoaded ? f8() : this.once("isSpriteLoaded", (() => { this.scheduler ? this.scheduler.add(f8, { type: "parseTile", isSymbolTile: s18.isSymbolTile, zoom: s18.tileZoom }) : f8(); })), this.loaded = this.loaded || {}, this.loaded[o88] = l21; })); } reloadTile(t45, s18) { const i26 = this.loaded, o88 = t45.uid; if (i26 && i26[o88]) { const n45 = i26[o88]; n45.scaleFactor = t45.scaleFactor, n45.showCollisionBoxes = t45.showCollisionBoxes, n45.projection = t45.projection, n45.brightness = t45.brightness, n45.tileTransform = e56.aZ(t45.tileID.canonical, t45.projection), n45.extraShadowCaster = t45.extraShadowCaster, n45.lut = t45.lut, n45.worldview = t45.worldview; const r86 = (e57, t46) => { const i27 = n45.reloadCallback; i27 && (delete n45.reloadCallback, n45.parse(n45.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, i27)), s18(e57, t46); }; "parsing" === n45.status ? n45.reloadCallback = r86 : "done" === n45.status && (n45.vectorTile ? n45.parse(n45.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, r86) : r86()); } else s18(null, void 0); } abortTile(e57, t45) { const s18 = e57.uid, i26 = this.loading[s18]; i26 && (i26.abort && i26.abort(), delete this.loading[s18]), t45(); } removeTile(e57, t45) { const s18 = this.loaded, i26 = e57.uid; s18 && s18[i26] && delete s18[i26], t45(); } } class h7 { loadTile(t45, s18) { const { uid: i26, encoding: o88, rawImageData: n45, padding: r86 } = t45, a46 = ImageBitmap && n45 instanceof ImageBitmap ? this.getImageData(n45, r86) : n45; s18(null, new e56.fr(i26, a46, o88, r86 < 1)); } reloadTile(e57, t45) { t45(null, null); } abortTile(e57, t45) { t45(); } removeTile(e57, t45) { t45(); } getImageData(e57, t45) { this.offscreenCanvas && this.offscreenCanvasContext || (this.offscreenCanvas = new OffscreenCanvas(e57.width, e57.height), this.offscreenCanvasContext = this.offscreenCanvas.getContext("2d", { willReadFrequently: true })), this.offscreenCanvas.width = e57.width, this.offscreenCanvas.height = e57.height, this.offscreenCanvasContext.drawImage(e57, 0, 0, e57.width, e57.height); const s18 = this.offscreenCanvasContext.getImageData(-t45, -t45, e57.width + 2 * t45, e57.height + 2 * t45); return this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height), s18; } } e56.bs.setPbf(e56.bt); class u11 { constructor(t45) { this._mrt = new e56.bs(t45.partial ? 30 : 1 / 0), this._isHeaderLoaded = false, this.uid = t45.uid, this.tileID = t45.tileID, this.source = t45.source; } parse(t45, s18) { const i26 = this._mrt; this.status = "parsing", this._entireBuffer = t45; try { i26.parseHeader(t45), this._isHeaderLoaded = true; const o88 = []; for (const s19 in i26.layers) { const n45 = i26.getLayer(s19), r86 = n45.getDataRange(n45.getBandList()), a46 = i26.createDecodingTask(r86), l21 = t45.slice(r86.firstByte, r86.lastByte + 1), c28 = e56.bs.performDecoding(l21, a46).then(((e57) => a46.complete(null, e57))).catch(((e57) => a46.complete(e57, null))); o88.push(c28); } Promise.allSettled(o88).then((() => s18(null, i26))).catch(((e57) => s18(e57))); } catch (e57) { s18(e57); } } } class d33 { constructor(e57) { this.actor = e57, this.loading = {}, this.loaded = {}; } loadTile(t45, s18) { const i26 = t45.uid, o88 = t45.request, n45 = this.loading[i26] = new u11(t45), { cancel: r86 } = e56.bu(o88, ((e57, t46, o89, r87) => { const a46 = !this.loading[i26]; if (delete this.loading[i26], a46 || e57 || !t46) return n45.status = "done", a46 || (this.loaded[i26] = n45), s18(e57); n45.parse(t46, ((e58, t47) => { if (e58 || !t47) return s18(e58); s18(null, t47, o89, r87); })), this.loaded[i26] = n45; })); n45.abort = r86; } reloadTile(e57, t45) { t45(null, void 0); } abortTile(e57, t45) { const s18 = e57.uid, i26 = this.loading[s18]; i26 && (i26.abort && i26.abort(), delete this.loading[s18]), t45(); } removeTile(e57, t45) { const s18 = e57.uid; this.loaded[s18] && delete this.loaded[s18], t45(); } decodeRasterArray(t45, s18) { e56.bs.performDecoding(t45.buffer, t45.task).then(((e57) => s18(null, e57))).catch(((e57) => s18(e57))); } } const f7 = e56.fs.prototype.toGeoJSON; class p8 { constructor(t45) { this._feature = t45, this.extent = e56.al, this.type = t45.type, this.properties = t45.tags, "id" in t45 && !isNaN(t45.id) && (this.id = parseInt(t45.id, 10)); } loadGeometry() { if (1 === this._feature.type) { const t45 = []; for (const s18 of this._feature.geometry) t45.push([new e56.P(s18[0], s18[1])]); return t45; } { const t45 = []; for (const s18 of this._feature.geometry) { const i26 = []; for (const t46 of s18) i26.push(new e56.P(t46[0], t46[1])); t45.push(i26); } return t45; } } toGeoJSON(e57, t45, s18) { return f7.call(this, e57, t45, s18); } } class g8 { constructor(t45, s18) { this.name = t45, this.extent = e56.al, this.length = s18.length, this._jsonFeatures = s18; } feature(e57) { return new p8(this._jsonFeatures[e57]); } } class m5 { constructor(t45) { this.layers = {}, this.extent = e56.al; for (const e57 of Object.keys(t45)) this.layers[e57] = new g8(e57, t45[e57]); } } const y3 = 64 / 4096, w3 = 128; class b7 { constructor() { this.features = /* @__PURE__ */ new Map(); } clear() { this.features.clear(); } load(e57 = [], t45) { for (const s18 of e57) { const e58 = s18.id; if (null == e58) continue; let i26 = this.features.get(e58); i26 && this.updateCache(i26, t45), s18.geometry ? (i26 = v7(s18), this.updateCache(i26, t45), this.features.set(e58, i26)) : this.features.delete(e58), this.updateCache(i26, t45); } } updateCache(e57, t45) { for (const { canonical: s18, uid: i26 } of Object.values(t45)) { const { z: o88, x: n45, y: r86 } = s18; x3(e57, Math.pow(2, o88), n45, r86) && delete t45[i26]; } } getTile(e57, t45, s18) { const i26 = Math.pow(2, e57), o88 = []; for (const e58 of this.features.values()) x3(e58, i26, t45, s18) && o88.push(P3(e58, i26, t45, s18)); return { features: o88 }; } getFeatures() { return [...this.features.values()]; } } function x3({ minX: e57, minY: t45, maxX: s18, maxY: i26 }, o88, n45, r86) { return e57 < (n45 + 1 + y3) / o88 && t45 < (r86 + 1 + y3) / o88 && s18 > (n45 - y3) / o88 && i26 > (r86 - y3) / o88; } function v7(e57) { const { id: t45, geometry: s18, properties: i26 } = e57; if (!s18) return; if ("GeometryCollection" === s18.type) throw new Error("GeometryCollection not supported in dynamic mode."); const { type: o88, coordinates: n45 } = s18, r86 = { id: t45, type: 1, geometry: [], tags: i26, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }, a46 = r86.geometry; if ("Point" === o88) I3(n45, a46, r86); else if ("MultiPoint" === o88) for (const e58 of n45) I3(e58, a46, r86); else if ("LineString" === o88) r86.type = 2, S4(n45, a46, r86); else if ("MultiLineString" === o88) r86.type = 2, M4(n45, a46, r86); else if ("Polygon" === o88) r86.type = 3, M4(n45, a46, r86, true); else { if ("MultiPolygon" !== o88) throw new Error("Input data is not a valid GeoJSON object."); r86.type = 3; for (const e58 of n45) M4(e58, a46, r86, true); } return r86; } function I3([t45, s18], i26, o88) { const n45 = e56.aF(t45); let r86 = e56.aJ(s18); r86 = r86 < 0 ? 0 : r86 > 1 ? 1 : r86, i26.push(n45, r86), o88.minX = Math.min(o88.minX, n45), o88.minY = Math.min(o88.minY, r86), o88.maxX = Math.max(o88.maxX, n45), o88.maxY = Math.max(o88.maxY, r86); } function S4(e57, t45, s18, i26 = false, o88 = false) { const n45 = []; for (const t46 of e57) I3(t46, n45, s18); t45.push(n45), i26 && (function(e58, t46) { let s19 = 0; for (let t47 = 0, i27 = e58.length, o89 = i27 - 2; t47 < i27; o89 = t47, t47 += 2) s19 += (e58[t47] - e58[o89]) * (e58[t47 + 1] + e58[o89 + 1]); if (s19 > 0 === t46) for (let t47 = 0, s20 = e58.length; t47 < s20 / 2; t47 += 2) { const i27 = e58[t47], o89 = e58[t47 + 1]; e58[t47] = e58[s20 - 2 - t47], e58[t47 + 1] = e58[s20 - 1 - t47], e58[s20 - 2 - t47] = i27, e58[s20 - 1 - t47] = o89; } })(n45, o88); } function M4(e57, t45, s18, i26 = false) { for (let o88 = 0; o88 < e57.length; o88++) S4(e57[o88], t45, s18, i26, 0 === o88); } function P3(t45, s18, i26, o88) { const { id: n45, type: r86, geometry: a46, tags: l21 } = t45, c28 = []; if (1 === r86) !(function(t46, s19, i27, o89, n46) { for (let r87 = 0; r87 < t46.length; r87 += 2) { const a47 = Math.round(e56.al * (t46[r87 + 0] * s19 - i27)), l22 = Math.round(e56.al * (t46[r87 + 1] * s19 - o89)); n46.push([a47, l22]); } })(a46, s18, i26, o88, c28); else for (const e57 of a46) T4(e57, s18, i26, o88, c28); return { id: n45, type: r86, geometry: c28, tags: l21 }; } function T4(t45, s18, i26, o88, n45) { const r86 = -w3, a46 = e56.al + w3; let l21; for (let c28 = 0; c28 < t45.length - 2; c28 += 2) { let h8 = Math.round(e56.al * (t45[c28 + 0] * s18 - i26)), u12 = Math.round(e56.al * (t45[c28 + 1] * s18 - o88)), d34 = Math.round(e56.al * (t45[c28 + 2] * s18 - i26)), f8 = Math.round(e56.al * (t45[c28 + 3] * s18 - o88)); const p9 = d34 - h8, g9 = f8 - u12; h8 < r86 && d34 < r86 || (h8 < r86 ? (u12 += Math.round(g9 * ((r86 - h8) / p9)), h8 = r86) : d34 < r86 && (f8 = u12 + Math.round(g9 * ((r86 - h8) / p9)), d34 = r86), u12 < r86 && f8 < r86 || (u12 < r86 ? (h8 += Math.round(p9 * ((r86 - u12) / g9)), u12 = r86) : f8 < r86 && (d34 = h8 + Math.round(p9 * ((r86 - u12) / g9)), f8 = r86), h8 >= a46 && d34 >= a46 || (h8 >= a46 ? (u12 += Math.round(g9 * ((a46 - h8) / p9)), h8 = a46) : d34 >= a46 && (f8 = u12 + Math.round(g9 * ((a46 - h8) / p9)), d34 = a46), u12 >= a46 && f8 >= a46 || (u12 >= a46 ? (h8 += Math.round(p9 * ((a46 - u12) / g9)), u12 = a46) : f8 >= a46 && (d34 = h8 + Math.round(p9 * ((a46 - u12) / g9)), f8 = a46), l21 && h8 === l21[l21.length - 1][0] && u12 === l21[l21.length - 1][1] || (l21 = [[h8, u12]], n45.push(l21)), l21.push([d34, f8]))))); } } function k6({ name: t45, features: s18 }, i26) { i26.writeStringField(1, t45), i26.writeVarintField(5, e56.al); const o88 = /* @__PURE__ */ new Map(), n45 = /* @__PURE__ */ new Map(), r86 = { keys: o88, values: n45, feature: null }; for (const e57 of s18) r86.feature = e57, i26.writeMessage(2, L2, r86); for (const e57 of o88.keys()) i26.writeStringField(3, e57); for (const e57 of n45.keys()) i26.writeMessage(4, j3, e57); } function L2(e57, t45) { const s18 = e57.feature; void 0 !== s18.id && Number.isSafeInteger(+s18.id) && t45.writeVarintField(1, +s18.id), s18.tags && t45.writeMessage(2, _3, e57), t45.writeVarintField(3, s18.type), t45.writeMessage(4, D4, s18); } function _3({ keys: e57, values: t45, feature: s18 }, i26) { for (const o88 of Object.keys(s18.tags)) { let n45 = s18.tags[o88]; if (null === n45) continue; let r86 = e57.get(o88); void 0 === r86 && (r86 = e57.size, e57.set(o88, r86)), i26.writeVarint(r86); const a46 = typeof n45; "string" !== a46 && "boolean" !== a46 && "number" !== a46 && (n45 = JSON.stringify(n45)); let l21 = t45.get(n45); void 0 === l21 && (l21 = t45.size, t45.set(n45, l21)), i26.writeVarint(l21); } } function C5(e57, t45) { return (t45 << 3) + (7 & e57); } function z3(e57) { return e57 << 1 ^ e57 >> 31; } function D4(e57, t45) { const { geometry: s18, type: i26 } = e57; let o88 = 0, n45 = 0; if (1 === i26) { t45.writeVarint(C5(1, s18.length)); for (const e58 of s18) { const s19 = e58[0] - o88, i27 = e58[1] - n45; t45.writeVarint(z3(s19)), t45.writeVarint(z3(i27)), o88 += s19, n45 += i27; } } else for (const e58 of s18) { t45.writeVarint(C5(1, 1)); const s19 = e58.length - (3 === i26 ? 1 : 0); for (let i27 = 0; i27 < s19; i27++) { 1 === i27 && t45.writeVarint(C5(2, s19 - 1)); const r86 = e58[i27][0] - o88, a46 = e58[i27][1] - n45; t45.writeVarint(z3(r86)), t45.writeVarint(z3(a46)), o88 += r86, n45 += a46; } 3 === i26 && t45.writeVarint(C5(7, 1)); } } function j3(e57, t45) { const s18 = typeof e57; "string" === s18 ? t45.writeStringField(1, e57) : "boolean" === s18 ? t45.writeBooleanField(7, e57) : "number" === s18 && (e57 % 1 != 0 ? t45.writeDoubleField(3, e57) : e57 < 0 ? t45.writeSVarintField(6, e57) : t45.writeVarintField(5, e57)); } const O3 = { minZoom: 0, maxZoom: 16, minPoints: 2, radius: 40, extent: 512, nodeSize: 64, log: false, generateId: false, reduce: null, map: (e57) => e57 }, F16 = Math.fround || (A3 = new Float32Array(1), (e57) => (A3[0] = +e57, A3[0])); var A3; const Z2 = 3, B5 = 5, N4 = 6; class R4 { constructor(e57) { this.options = Object.assign(Object.create(O3), e57), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = []; } load(e57) { const { log: t45, minZoom: s18, maxZoom: i26 } = this.options; t45 && console.time("total time"); const o88 = `prepare ${e57.length} points`; t45 && console.time(o88), this.points = e57; const n45 = []; for (let t46 = 0; t46 < e57.length; t46++) { const s19 = e57[t46]; if (!s19.geometry) continue; const [i27, o89] = s19.geometry.coordinates, r87 = F16(X2(i27)), a46 = F16(J3(o89)); n45.push(r87, a46, 1 / 0, t46, -1, 1), this.options.reduce && n45.push(0); } let r86 = this.trees[i26 + 1] = this._createTree(n45); t45 && console.timeEnd(o88); for (let e58 = i26; e58 >= s18; e58--) { const s19 = +Date.now(); r86 = this.trees[e58] = this._createTree(this._cluster(r86, e58)), t45 && console.log("z%d: %d clusters in %dms", e58, r86.numItems, +Date.now() - s19); } return t45 && console.timeEnd("total time"), this; } getClusters(e57, t45) { let s18 = ((e57[0] + 180) % 360 + 360) % 360 - 180; const i26 = Math.max(-90, Math.min(90, e57[1])); let o88 = 180 === e57[2] ? 180 : ((e57[2] + 180) % 360 + 360) % 360 - 180; const n45 = Math.max(-90, Math.min(90, e57[3])); if (e57[2] - e57[0] >= 360) s18 = -180, o88 = 180; else if (s18 > o88) { const e58 = this.getClusters([s18, i26, 180, n45], t45), r87 = this.getClusters([-180, i26, o88, n45], t45); return e58.concat(r87); } const r86 = this.trees[this._limitZoom(t45)], a46 = r86.range(X2(s18), J3(n45), X2(o88), J3(i26)), l21 = r86.data, c28 = []; for (const e58 of a46) { const t46 = this.stride * e58; c28.push(l21[t46 + B5] > 1 ? E4(l21, t46, this.clusterProps) : this.points[l21[t46 + Z2]]); } return c28; } getChildren(e57) { const t45 = this._getOriginId(e57), s18 = this._getOriginZoom(e57), i26 = "No cluster with the specified id.", o88 = this.trees[s18]; if (!o88) throw new Error(i26); const n45 = o88.data; if (t45 * this.stride >= n45.length) throw new Error(i26); const r86 = this.options.radius / (this.options.extent * Math.pow(2, s18 - 1)), a46 = o88.within(n45[t45 * this.stride], n45[t45 * this.stride + 1], r86), l21 = []; for (const t46 of a46) { const s19 = t46 * this.stride; n45[s19 + 4] === e57 && l21.push(n45[s19 + B5] > 1 ? E4(n45, s19, this.clusterProps) : this.points[n45[s19 + Z2]]); } if (0 === l21.length) throw new Error(i26); return l21; } getLeaves(e57, t45, s18) { const i26 = []; return this._appendLeaves(i26, e57, t45 = t45 || 10, s18 = s18 || 0, 0), i26; } getTile(e57, t45, s18) { const i26 = this.trees[this._limitZoom(e57)], o88 = Math.pow(2, e57), { extent: n45, radius: r86 } = this.options, a46 = r86 / n45, l21 = (s18 - a46) / o88, c28 = (s18 + 1 + a46) / o88, h8 = { features: [] }; return this._addTileFeatures(i26.range((t45 - a46) / o88, l21, (t45 + 1 + a46) / o88, c28), i26.data, t45, s18, o88, h8), 0 === t45 && this._addTileFeatures(i26.range(1 - a46 / o88, l21, 1, c28), i26.data, o88, s18, o88, h8), t45 === o88 - 1 && this._addTileFeatures(i26.range(0, l21, a46 / o88, c28), i26.data, -1, s18, o88, h8), h8.features.length ? h8 : null; } getClusterExpansionZoom(e57) { let t45 = this._getOriginZoom(e57) - 1; for (; t45 <= this.options.maxZoom; ) { const s18 = this.getChildren(e57); if (t45++, 1 !== s18.length) break; e57 = s18[0].properties.cluster_id; } return t45; } _appendLeaves(e57, t45, s18, i26, o88) { const n45 = this.getChildren(t45); for (const t46 of n45) { const n46 = t46.properties; if (n46 && n46.cluster ? o88 + n46.point_count <= i26 ? o88 += n46.point_count : o88 = this._appendLeaves(e57, n46.cluster_id, s18, i26, o88) : o88 < i26 ? o88++ : e57.push(t46), e57.length === s18) break; } return o88; } _createTree(t45) { const s18 = new e56.c3(t45.length / this.stride | 0, this.options.nodeSize, Float32Array); for (let e57 = 0; e57 < t45.length; e57 += this.stride) s18.add(t45[e57], t45[e57 + 1]); return s18.finish(), s18.data = t45, s18; } _addTileFeatures(e57, t45, s18, i26, o88, n45) { for (const r86 of e57) { const e58 = r86 * this.stride, a46 = t45[e58 + B5] > 1; let l21, c28, h8; if (a46) l21 = Y5(t45, e58, this.clusterProps), c28 = t45[e58], h8 = t45[e58 + 1]; else { const s19 = this.points[t45[e58 + Z2]]; l21 = s19.properties; const [i27, o89] = s19.geometry.coordinates; c28 = X2(i27), h8 = J3(o89); } const u12 = { type: 1, geometry: [[Math.round(this.options.extent * (c28 * o88 - s18)), Math.round(this.options.extent * (h8 * o88 - i26))]], tags: l21 }; let d34; d34 = a46 || this.options.generateId ? t45[e58 + Z2] : this.points[t45[e58 + Z2]].id, void 0 !== d34 && (u12.id = d34), n45.features.push(u12); } } _limitZoom(e57) { return Math.max(this.options.minZoom, Math.min(Math.floor(+e57), this.options.maxZoom + 1)); } _cluster(e57, t45) { const { radius: s18, extent: i26, reduce: o88, minPoints: n45 } = this.options, r86 = s18 / (i26 * Math.pow(2, t45)), a46 = e57.data, l21 = [], c28 = this.stride; for (let s19 = 0; s19 < a46.length; s19 += c28) { if (a46[s19 + 2] <= t45) continue; a46[s19 + 2] = t45; const i27 = a46[s19], h8 = a46[s19 + 1], u12 = e57.within(a46[s19], a46[s19 + 1], r86), d34 = a46[s19 + B5]; let f8 = d34; for (const e58 of u12) { const s20 = e58 * c28; a46[s20 + 2] > t45 && (f8 += a46[s20 + B5]); } if (f8 > d34 && f8 >= n45) { let e58, n46 = i27 * d34, r87 = h8 * d34, p9 = -1; const g9 = (s19 / c28 << 5) + (t45 + 1) + this.points.length; for (const i28 of u12) { const l22 = i28 * c28; if (a46[l22 + 2] <= t45) continue; a46[l22 + 2] = t45; const h9 = a46[l22 + B5]; n46 += a46[l22] * h9, r87 += a46[l22 + 1] * h9, a46[l22 + 4] = g9, o88 && (e58 || (e58 = this._map(a46, s19, true), p9 = this.clusterProps.length, this.clusterProps.push(e58)), o88(e58, this._map(a46, l22))); } a46[s19 + 4] = g9, l21.push(n46 / f8, r87 / f8, 1 / 0, g9, -1, f8), o88 && l21.push(p9); } else { for (let e58 = 0; e58 < c28; e58++) l21.push(a46[s19 + e58]); if (f8 > 1) for (const e58 of u12) { const s20 = e58 * c28; if (!(a46[s20 + 2] <= t45)) { a46[s20 + 2] = t45; for (let e59 = 0; e59 < c28; e59++) l21.push(a46[s20 + e59]); } } } } return l21; } _getOriginId(e57) { return e57 - this.points.length >> 5; } _getOriginZoom(e57) { return (e57 - this.points.length) % 32; } _map(e57, t45, s18) { if (e57[t45 + B5] > 1) { const i27 = this.clusterProps[e57[t45 + N4]]; return s18 ? Object.assign({}, i27) : i27; } const i26 = this.points[e57[t45 + Z2]].properties, o88 = this.options.map(i26); return s18 && o88 === i26 ? Object.assign({}, o88) : o88; } } function E4(e57, t45, s18) { return { type: "Feature", id: e57[t45 + Z2], properties: Y5(e57, t45, s18), geometry: { type: "Point", coordinates: [(i26 = e57[t45], 360 * (i26 - 0.5)), G4(e57[t45 + 1])] } }; var i26; } function Y5(e57, t45, s18) { const i26 = e57[t45 + B5], o88 = i26 >= 1e4 ? `${Math.round(i26 / 1e3)}k` : i26 >= 1e3 ? Math.round(i26 / 100) / 10 + "k" : i26, n45 = e57[t45 + N4], r86 = -1 === n45 ? {} : Object.assign({}, s18[n45]); return Object.assign(r86, { cluster: true, cluster_id: e57[t45 + Z2], point_count: i26, point_count_abbreviated: o88 }); } function X2(e57) { return e57 / 360 + 0.5; } function J3(e57) { const t45 = Math.sin(e57 * Math.PI / 180), s18 = 0.5 - 0.25 * Math.log((1 + t45) / (1 - t45)) / Math.PI; return s18 < 0 ? 0 : s18 > 1 ? 1 : s18; } function G4(e57) { const t45 = (180 - 360 * e57) * Math.PI / 180; return 360 * Math.atan(Math.exp(t45)) / Math.PI - 90; } function V3(e57, t45, s18, i26) { let o88 = i26; const n45 = t45 + (s18 - t45 >> 1); let r86, a46 = s18 - t45; const l21 = e57[t45], c28 = e57[t45 + 1], h8 = e57[s18], u12 = e57[s18 + 1]; for (let i27 = t45 + 3; i27 < s18; i27 += 3) { const t46 = $4(e57[i27], e57[i27 + 1], l21, c28, h8, u12); if (t46 > o88) r86 = i27, o88 = t46; else if (t46 === o88) { const e58 = Math.abs(i27 - n45); e58 < a46 && (r86 = i27, a46 = e58); } } o88 > i26 && (r86 - t45 > 3 && V3(e57, t45, r86, i26), e57[r86 + 2] = o88, s18 - r86 > 3 && V3(e57, r86, s18, i26)); } function $4(e57, t45, s18, i26, o88, n45) { let r86 = o88 - s18, a46 = n45 - i26; if (0 !== r86 || 0 !== a46) { const l21 = ((e57 - s18) * r86 + (t45 - i26) * a46) / (r86 * r86 + a46 * a46); l21 > 1 ? (s18 = o88, i26 = n45) : l21 > 0 && (s18 += r86 * l21, i26 += a46 * l21); } return r86 = e57 - s18, a46 = t45 - i26, r86 * r86 + a46 * a46; } function U3(e57, t45, s18, i26) { const o88 = { id: e57 ?? null, type: t45, geometry: s18, tags: i26, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }; if ("Point" === t45 || "MultiPoint" === t45 || "LineString" === t45) q2(o88, s18); else if ("Polygon" === t45) q2(o88, s18[0]); else if ("MultiLineString" === t45) for (const e58 of s18) q2(o88, e58); else if ("MultiPolygon" === t45) for (const e58 of s18) q2(o88, e58[0]); return o88; } function q2(e57, t45) { for (let s18 = 0; s18 < t45.length; s18 += 3) e57.minX = Math.min(e57.minX, t45[s18]), e57.minY = Math.min(e57.minY, t45[s18 + 1]), e57.maxX = Math.max(e57.maxX, t45[s18]), e57.maxY = Math.max(e57.maxY, t45[s18 + 1]); } function W3(e57, t45, s18, i26) { if (!t45.geometry) return; const o88 = t45.geometry.coordinates; if (o88 && 0 === o88.length) return; const n45 = t45.geometry.type, r86 = Math.pow(s18.tolerance / ((1 << s18.maxZoom) * s18.extent), 2); let a46 = [], l21 = t45.id; if (s18.promoteId ? l21 = t45.properties[s18.promoteId] : s18.generateId && (l21 = i26 || 0), "Point" === n45) H3(o88, a46); else if ("MultiPoint" === n45) for (const e58 of o88) H3(e58, a46); else if ("LineString" === n45) Q4(o88, a46, r86, false); else if ("MultiLineString" === n45) { if (s18.lineMetrics) { for (const s19 of o88) a46 = [], Q4(s19, a46, r86, false), e57.push(U3(l21, "LineString", a46, t45.properties)); return; } K4(o88, a46, r86, false); } else if ("Polygon" === n45) K4(o88, a46, r86, true); else { if ("MultiPolygon" !== n45) { if ("GeometryCollection" === n45) { for (const o89 of t45.geometry.geometries) W3(e57, { id: l21, geometry: o89, properties: t45.properties }, s18, i26); return; } throw new Error("Input data is not a valid GeoJSON object."); } for (const e58 of o88) { const t46 = []; K4(e58, t46, r86, true), a46.push(t46); } } e57.push(U3(l21, n45, a46, t45.properties)); } function H3(e57, t45) { t45.push(ee2(e57[0]), te(e57[1]), 0); } function Q4(e57, t45, s18, i26) { let o88, n45, r86 = 0; for (let s19 = 0; s19 < e57.length; s19++) { const a47 = ee2(e57[s19][0]), l21 = te(e57[s19][1]); t45.push(a47, l21, 0), s19 > 0 && (r86 += i26 ? (o88 * l21 - a47 * n45) / 2 : Math.sqrt(Math.pow(a47 - o88, 2) + Math.pow(l21 - n45, 2))), o88 = a47, n45 = l21; } const a46 = t45.length - 3; t45[2] = 1, V3(t45, 0, a46, s18), t45[a46 + 2] = 1, t45.size = Math.abs(r86), t45.start = 0, t45.end = t45.size; } function K4(e57, t45, s18, i26) { for (let o88 = 0; o88 < e57.length; o88++) { const n45 = []; Q4(e57[o88], n45, s18, i26), t45.push(n45); } } function ee2(e57) { return e57 / 360 + 0.5; } function te(e57) { const t45 = Math.sin(e57 * Math.PI / 180), s18 = 0.5 - 0.25 * Math.log((1 + t45) / (1 - t45)) / Math.PI; return s18 < 0 ? 0 : s18 > 1 ? 1 : s18; } function se(e57, t45, s18, i26, o88, n45, r86, a46) { if (i26 /= t45, n45 >= (s18 /= t45) && r86 < i26) return e57; if (r86 < s18 || n45 >= i26) return null; const l21 = []; for (const t46 of e57) { const e58 = t46.geometry; let n46 = t46.type; const r87 = 0 === o88 ? t46.minX : t46.minY, c28 = 0 === o88 ? t46.maxX : t46.maxY; if (r87 >= s18 && c28 < i26) { l21.push(t46); continue; } if (c28 < s18 || r87 >= i26) continue; let h8 = []; if ("Point" === n46 || "MultiPoint" === n46) ie2(e58, h8, s18, i26, o88); else if ("LineString" === n46) oe3(e58, h8, s18, i26, o88, false, a46.lineMetrics); else if ("MultiLineString" === n46) re2(e58, h8, s18, i26, o88, false); else if ("Polygon" === n46) re2(e58, h8, s18, i26, o88, true); else if ("MultiPolygon" === n46) for (const t47 of e58) { const e59 = []; re2(t47, e59, s18, i26, o88, true), e59.length && h8.push(e59); } if (h8.length) { if (a46.lineMetrics && "LineString" === n46) { for (const e59 of h8) l21.push(U3(t46.id, n46, e59, t46.tags)); continue; } "LineString" !== n46 && "MultiLineString" !== n46 || (1 === h8.length ? (n46 = "LineString", h8 = h8[0]) : n46 = "MultiLineString"), "Point" !== n46 && "MultiPoint" !== n46 || (n46 = 3 === h8.length ? "Point" : "MultiPoint"), l21.push(U3(t46.id, n46, h8, t46.tags)); } } return l21.length ? l21 : null; } function ie2(e57, t45, s18, i26, o88) { for (let n45 = 0; n45 < e57.length; n45 += 3) { const r86 = e57[n45 + o88]; r86 >= s18 && r86 <= i26 && ae2(t45, e57[n45], e57[n45 + 1], e57[n45 + 2]); } } function oe3(e57, t45, s18, i26, o88, n45, r86) { let a46 = ne2(e57); const l21 = 0 === o88 ? le2 : ce2; let c28, h8, u12 = e57.start; for (let d35 = 0; d35 < e57.length - 3; d35 += 3) { const f9 = e57[d35], p10 = e57[d35 + 1], g10 = e57[d35 + 2], m6 = e57[d35 + 3], y4 = e57[d35 + 4], w4 = 0 === o88 ? f9 : p10, b8 = 0 === o88 ? m6 : y4; let x4 = false; r86 && (c28 = Math.sqrt(Math.pow(f9 - m6, 2) + Math.pow(p10 - y4, 2))), w4 < s18 ? b8 > s18 && (h8 = l21(a46, f9, p10, m6, y4, s18), r86 && (a46.start = u12 + c28 * h8)) : w4 > i26 ? b8 < i26 && (h8 = l21(a46, f9, p10, m6, y4, i26), r86 && (a46.start = u12 + c28 * h8)) : ae2(a46, f9, p10, g10), b8 < s18 && w4 >= s18 && (h8 = l21(a46, f9, p10, m6, y4, s18), x4 = true), b8 > i26 && w4 <= i26 && (h8 = l21(a46, f9, p10, m6, y4, i26), x4 = true), !n45 && x4 && (r86 && (a46.end = u12 + c28 * h8), t45.push(a46), a46 = ne2(e57)), r86 && (u12 += c28); } let d34 = e57.length - 3; const f8 = e57[d34], p9 = e57[d34 + 1], g9 = 0 === o88 ? f8 : p9; g9 >= s18 && g9 <= i26 && ae2(a46, f8, p9, e57[d34 + 2]), d34 = a46.length - 3, n45 && d34 >= 3 && (a46[d34] !== a46[0] || a46[d34 + 1] !== a46[1]) && ae2(a46, a46[0], a46[1], a46[2]), a46.length && t45.push(a46); } function ne2(e57) { const t45 = []; return t45.size = e57.size, t45.start = e57.start, t45.end = e57.end, t45; } function re2(e57, t45, s18, i26, o88, n45) { for (const r86 of e57) oe3(r86, t45, s18, i26, o88, n45, false); } function ae2(e57, t45, s18, i26) { e57.push(t45, s18, i26); } function le2(e57, t45, s18, i26, o88, n45) { const r86 = (n45 - t45) / (i26 - t45); return ae2(e57, n45, s18 + (o88 - s18) * r86, 1), r86; } function ce2(e57, t45, s18, i26, o88, n45) { const r86 = (n45 - s18) / (o88 - s18); return ae2(e57, t45 + (i26 - t45) * r86, n45, 1), r86; } function he(e57, t45) { const s18 = []; for (let i26 = 0; i26 < e57.length; i26++) { const o88 = e57[i26], n45 = o88.type; let r86; if ("Point" === n45 || "MultiPoint" === n45 || "LineString" === n45) r86 = ue3(o88.geometry, t45); else if ("MultiLineString" === n45 || "Polygon" === n45) { r86 = []; for (const e58 of o88.geometry) r86.push(ue3(e58, t45)); } else if ("MultiPolygon" === n45) { r86 = []; for (const e58 of o88.geometry) { const s19 = []; for (const i27 of e58) s19.push(ue3(i27, t45)); r86.push(s19); } } s18.push(U3(o88.id, n45, r86, o88.tags)); } return s18; } function ue3(e57, t45) { const s18 = []; s18.size = e57.size, void 0 !== e57.start && (s18.start = e57.start, s18.end = e57.end); for (let i26 = 0; i26 < e57.length; i26 += 3) s18.push(e57[i26] + t45, e57[i26 + 1], e57[i26 + 2]); return s18; } function de3(e57, t45) { if (e57.transformed) return e57; const s18 = 1 << e57.z, i26 = e57.x, o88 = e57.y; for (const n45 of e57.features) { const e58 = n45.geometry, r86 = n45.type; if (n45.geometry = [], 1 === r86) for (let r87 = 0; r87 < e58.length; r87 += 2) n45.geometry.push(fe2(e58[r87], e58[r87 + 1], t45, s18, i26, o88)); else for (let r87 = 0; r87 < e58.length; r87++) { const a46 = []; for (let n46 = 0; n46 < e58[r87].length; n46 += 2) a46.push(fe2(e58[r87][n46], e58[r87][n46 + 1], t45, s18, i26, o88)); n45.geometry.push(a46); } } return e57.transformed = true, e57; } function fe2(e57, t45, s18, i26, o88, n45) { return [Math.round(s18 * (e57 * i26 - o88)), Math.round(s18 * (t45 * i26 - n45))]; } function pe(e57, t45, s18, i26, o88) { const n45 = t45 === o88.maxZoom ? 0 : o88.tolerance / ((1 << t45) * o88.extent), r86 = { features: [], numPoints: 0, numSimplified: 0, numFeatures: e57.length, source: null, x: s18, y: i26, z: t45, transformed: false, minX: 2, minY: 1, maxX: -1, maxY: 0 }; for (const t46 of e57) ge(r86, t46, n45, o88); return r86; } function ge(e57, t45, s18, i26) { const o88 = t45.geometry, n45 = t45.type, r86 = []; if (e57.minX = Math.min(e57.minX, t45.minX), e57.minY = Math.min(e57.minY, t45.minY), e57.maxX = Math.max(e57.maxX, t45.maxX), e57.maxY = Math.max(e57.maxY, t45.maxY), "Point" === n45 || "MultiPoint" === n45) for (let t46 = 0; t46 < o88.length; t46 += 3) r86.push(o88[t46], o88[t46 + 1]), e57.numPoints++, e57.numSimplified++; else if ("LineString" === n45) me(r86, o88, e57, s18, false, false); else if ("MultiLineString" === n45 || "Polygon" === n45) for (let t46 = 0; t46 < o88.length; t46++) me(r86, o88[t46], e57, s18, "Polygon" === n45, 0 === t46); else if ("MultiPolygon" === n45) for (let t46 = 0; t46 < o88.length; t46++) { const i27 = o88[t46]; for (let t47 = 0; t47 < i27.length; t47++) me(r86, i27[t47], e57, s18, true, 0 === t47); } if (r86.length) { let s19 = t45.tags || null; if ("LineString" === n45 && i26.lineMetrics) { s19 = {}; for (const e58 in t45.tags) s19[e58] = t45.tags[e58]; s19.mapbox_clip_start = o88.start / o88.size, s19.mapbox_clip_end = o88.end / o88.size; } const a46 = { geometry: r86, type: "Polygon" === n45 || "MultiPolygon" === n45 ? 3 : "LineString" === n45 || "MultiLineString" === n45 ? 2 : 1, tags: s19 }; null !== t45.id && (a46.id = t45.id), e57.features.push(a46); } } function me(e57, t45, s18, i26, o88, n45) { const r86 = i26 * i26; if (i26 > 0 && t45.size < (o88 ? r86 : i26)) return void (s18.numPoints += t45.length / 3); const a46 = []; for (let e58 = 0; e58 < t45.length; e58 += 3) (0 === i26 || t45[e58 + 2] > r86) && (s18.numSimplified++, a46.push(t45[e58], t45[e58 + 1])), s18.numPoints++; o88 && (function(e58, t46) { let s19 = 0; for (let t47 = 0, i27 = e58.length, o89 = i27 - 2; t47 < i27; o89 = t47, t47 += 2) s19 += (e58[t47] - e58[o89]) * (e58[t47 + 1] + e58[o89 + 1]); if (s19 > 0 === t46) for (let t47 = 0, s20 = e58.length; t47 < s20 / 2; t47 += 2) { const i27 = e58[t47], o89 = e58[t47 + 1]; e58[t47] = e58[s20 - 2 - t47], e58[t47 + 1] = e58[s20 - 1 - t47], e58[s20 - 2 - t47] = i27, e58[s20 - 1 - t47] = o89; } })(a46, n45), e57.push(a46); } const ye = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: false, promoteId: null, generateId: false, debug: 0 }; class we { constructor(e57, t45) { const s18 = (t45 = this.options = (function(e58, t46) { for (const s19 in t46) e58[s19] = t46[s19]; return e58; })(Object.create(ye), t45)).debug; if (s18 && console.time("preprocess data"), t45.maxZoom < 0 || t45.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range"); if (t45.promoteId && t45.generateId) throw new Error("promoteId and generateId cannot be used together."); let i26 = (function(e58, t46) { const s19 = []; if ("FeatureCollection" === e58.type) for (let i27 = 0; i27 < e58.features.length; i27++) W3(s19, e58.features[i27], t46, i27); else W3(s19, "Feature" === e58.type ? e58 : { geometry: e58 }, t46); return s19; })(e57, t45); this.tiles = {}, this.tileCoords = [], s18 && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", t45.indexMaxZoom, t45.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), i26 = (function(e58, t46) { const s19 = t46.buffer / t46.extent; let i27 = e58; const o88 = se(e58, 1, -1 - s19, s19, 0, -1, 2, t46), n45 = se(e58, 1, 1 - s19, 2 + s19, 0, -1, 2, t46); return (o88 || n45) && (i27 = se(e58, 1, -s19, 1 + s19, 0, -1, 2, t46) || [], o88 && (i27 = he(o88, 1).concat(i27)), n45 && (i27 = i27.concat(he(n45, -1)))), i27; })(i26, t45), i26.length && this.splitTile(i26, 0, 0, 0), s18 && (i26.length && console.log("features: %d, points: %d", this.tiles[0].numFeatures, this.tiles[0].numPoints), console.timeEnd("generate tiles"), console.log("tiles generated:", this.total, JSON.stringify(this.stats))); } splitTile(e57, t45, s18, i26, o88, n45, r86) { const a46 = [e57, t45, s18, i26], l21 = this.options, c28 = l21.debug; for (; a46.length; ) { i26 = a46.pop(), s18 = a46.pop(), t45 = a46.pop(), e57 = a46.pop(); const h8 = 1 << t45, u12 = be2(t45, s18, i26); let d34 = this.tiles[u12]; if (!d34 && (c28 > 1 && console.time("creation"), d34 = this.tiles[u12] = pe(e57, t45, s18, i26, l21), this.tileCoords.push({ z: t45, x: s18, y: i26 }), c28)) { c28 > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t45, s18, i26, d34.numFeatures, d34.numPoints, d34.numSimplified), console.timeEnd("creation")); const e58 = `z${t45}`; this.stats[e58] = (this.stats[e58] || 0) + 1, this.total++; } if (d34.source = e57, null == o88) { if (t45 === l21.indexMaxZoom || d34.numPoints <= l21.indexMaxPoints) continue; } else { if (t45 === l21.maxZoom || t45 === o88) continue; if (null != o88) { const e58 = o88 - t45; if (s18 !== n45 >> e58 || i26 !== r86 >> e58) continue; } } if (d34.source = null, 0 === e57.length) continue; c28 > 1 && console.time("clipping"); const f8 = 0.5 * l21.buffer / l21.extent, p9 = 0.5 - f8, g9 = 0.5 + f8, m6 = 1 + f8; let y4 = null, w4 = null, b8 = null, x4 = null, v8 = se(e57, h8, s18 - f8, s18 + g9, 0, d34.minX, d34.maxX, l21), I4 = se(e57, h8, s18 + p9, s18 + m6, 0, d34.minX, d34.maxX, l21); e57 = null, v8 && (y4 = se(v8, h8, i26 - f8, i26 + g9, 1, d34.minY, d34.maxY, l21), w4 = se(v8, h8, i26 + p9, i26 + m6, 1, d34.minY, d34.maxY, l21), v8 = null), I4 && (b8 = se(I4, h8, i26 - f8, i26 + g9, 1, d34.minY, d34.maxY, l21), x4 = se(I4, h8, i26 + p9, i26 + m6, 1, d34.minY, d34.maxY, l21), I4 = null), c28 > 1 && console.timeEnd("clipping"), a46.push(y4 || [], t45 + 1, 2 * s18, 2 * i26), a46.push(w4 || [], t45 + 1, 2 * s18, 2 * i26 + 1), a46.push(b8 || [], t45 + 1, 2 * s18 + 1, 2 * i26), a46.push(x4 || [], t45 + 1, 2 * s18 + 1, 2 * i26 + 1); } } getTile(e57, t45, s18) { e57 = +e57, t45 = +t45, s18 = +s18; const i26 = this.options, { extent: o88, debug: n45 } = i26; if (e57 < 0 || e57 > 24) return null; const r86 = 1 << e57, a46 = be2(e57, t45 = t45 + r86 & r86 - 1, s18); if (this.tiles[a46]) return de3(this.tiles[a46], o88); n45 > 1 && console.log("drilling down to z%d-%d-%d", e57, t45, s18); let l21, c28 = e57, h8 = t45, u12 = s18; for (; !l21 && c28 > 0; ) c28--, h8 >>= 1, u12 >>= 1, l21 = this.tiles[be2(c28, h8, u12)]; return l21 && l21.source ? (n45 > 1 && (console.log("found parent tile z%d-%d-%d", c28, h8, u12), console.time("drilling down")), this.splitTile(l21.source, c28, h8, u12, e57, t45, s18), n45 > 1 && console.timeEnd("drilling down"), this.tiles[a46] ? de3(this.tiles[a46], o88) : null) : null; } } function be2(e57, t45, s18) { return 32 * ((1 << e57) * s18 + t45) + e57; } function xe2(t45, s18) { const i26 = t45.tileID.canonical; if (!this._geoJSONIndex) return void s18(null, null); const o88 = this._geoJSONIndex.getTile(i26.z, i26.x, i26.y); if (!o88) return void s18(null, null); const n45 = (e57) => e57.tags && "3d_elevation_id" in e57.tags && "source" in e57.tags && "elevation" === e57.tags.source, r86 = o88.features.filter(((e57) => n45(e57))); let a46 = { _geojsonTileLayer: o88.features }; r86.length > 0 && (a46 = { _geojsonTileLayer: o88.features.filter(((e57) => !n45(e57))), hd_road_elevation: r86 }); const l21 = new m5(a46), c28 = (function(t46) { const s19 = new e56.bt(); for (const e57 of Object.keys(t46)) s19.writeMessage(3, k6, { name: e57, features: t46[e57] }); return s19.finish(); })(a46).buffer; s18(null, { vectorTile: l21, rawData: c28 }); } class ve2 extends c27 { constructor(e57, t45, s18, i26, o88, n45, r86) { super(e57, t45, s18, i26, o88, xe2, r86), n45 && (this.loadGeoJSON = n45), this._dynamicIndex = new b7(); } loadData(s18, i26) { const o88 = s18 && s18.request, n45 = o88 && o88.collectResourceTiming; this._geoJSONIndex = null, this.loadGeoJSON(s18, ((r86, a46) => { if (r86 || !a46) return i26(r86); if ("object" != typeof a46) return i26(new Error(`Input data given to '${s18.source}' is not a valid GeoJSON object.`)); { try { if (s18.filter) { const t45 = e56.U(s18.filter, { type: "boolean", "property-type": "data-driven", overridable: false, transition: false }); if ("error" === t45.result) throw new Error(t45.value.map(((e57) => `${e57.key}: ${e57.message}`)).join(", ")); a46.features = a46.features.filter(((e57) => t45.value.evaluate({ zoom: 0 }, e57))); } s18.dynamic ? ("Feature" === a46.type && (a46 = { type: "FeatureCollection", features: [a46] }), s18.append || (this._dynamicIndex.clear(), this.loaded = {}), this._dynamicIndex.load(a46.features, this.loaded), s18.cluster && (a46.features = this._dynamicIndex.getFeatures())) : this.loaded = {}, this._geoJSONIndex = s18.cluster ? new R4((function({ superclusterOptions: t45, clusterProperties: s19 }) { if (!s19 || !t45) return t45; const i27 = {}, o89 = {}, n46 = { accumulated: null, zoom: 0 }, r88 = { properties: null }, a47 = Object.keys(s19); for (const t46 of a47) { const [n47, r89] = s19[t46], a48 = e56.U(r89), l21 = e56.U("string" == typeof n47 ? [n47, ["accumulated"], ["get", t46]] : n47); i27[t46] = a48.value, o89[t46] = l21.value; } return t45.map = (e57) => { r88.properties = e57; const t46 = {}; for (const e58 of a47) t46[e58] = i27[e58].evaluate(n46, r88); return t46; }, t45.reduce = (e57, t46) => { r88.properties = t46; for (const t47 of a47) n46.accumulated = e57[t47], e57[t47] = o89[t47].evaluate(n46, r88); }, t45; })(s18)).load(a46.features) : s18.dynamic ? this._dynamicIndex : (function(e57, t45) { return new we(e57, t45); })(a46, s18.geojsonVtOptions); } catch (e57) { return i26(e57); } const r87 = {}; if (n45) { const e57 = t44(o88); e57 && (r87.resourceTiming = {}, r87.resourceTiming[s18.source] = JSON.parse(JSON.stringify(e57))); } i26(null, r87); } })); } reloadTile(e57, t45) { const s18 = this.loaded; return s18 && s18[e57.uid] ? e57.partial ? t45(null, void 0) : super.reloadTile(e57, t45) : this.loadTile(e57, t45); } loadGeoJSON(t45, s18) { if (t45.request) e56.m(t45.request, s18); else { if ("string" != typeof t45.data) return s18(new Error(`Input data given to '${t45.source}' is not a valid GeoJSON object.`)); setTimeout((() => { try { return s18(null, JSON.parse(t45.data)); } catch (e57) { return s18(new Error(`Input data given to '${t45.source}' is not a valid GeoJSON object.`)); } }), 0); } } getClusterExpansionZoom(e57, t45) { try { t45(null, this._geoJSONIndex.getClusterExpansionZoom(e57.clusterId)); } catch (e58) { t45(e58); } } getClusterChildren(e57, t45) { try { t45(null, this._geoJSONIndex.getChildren(e57.clusterId)); } catch (e58) { t45(e58); } } getClusterLeaves(e57, t45) { try { t45(null, this._geoJSONIndex.getLeaves(e57.clusterId, e57.limit, e57.offset)); } catch (e58) { t45(e58); } } } class Ie { constructor(t45, s18, i26) { this.tileID = new e56.aO(t45.tileID.overscaledZ, t45.tileID.wrap, t45.tileID.canonical.z, t45.tileID.canonical.x, t45.tileID.canonical.y), this.tileZoom = t45.tileZoom, this.uid = t45.uid, this.zoom = t45.zoom, this.canonical = t45.tileID.canonical, this.pixelRatio = t45.pixelRatio, this.tileSize = t45.tileSize, this.source = t45.source, this.overscaling = this.tileID.overscaleFactor(), this.projection = t45.projection, this.brightness = s18, this.worldview = i26; } parse(t45, s18, i26, o88) { this.status = "parsing"; const n45 = new e56.aO(i26.tileID.overscaledZ, i26.tileID.wrap, i26.tileID.canonical.z, i26.tileID.canonical.x, i26.tileID.canonical.y), r86 = [], a46 = s18.familiesBySource[i26.source], l21 = new e56.fe(n45, i26.promoteId); l21.bucketLayerIDs = [], l21.is3DTile = true, e56.ft(t45).then(((t46) => { if (!t46) return o88(new Error("Could not parse tile")); const s19 = t46.json.extensionsUsed && t46.json.extensionsUsed.includes("MAPBOX_mesh_features") || t46.json.asset.extras && t46.json.asset.extras.MAPBOX_mesh_features, c28 = t46.json.extensionsUsed && t46.json.extensionsUsed.includes("EXT_meshopt_compression"), h8 = new e56.ac(this.zoom, { brightness: this.brightness, worldview: this.worldview }); for (const o89 in a46) for (const u12 of a46[o89]) { const o90 = u12[0]; l21.bucketLayerIDs.push(u12.map(((t47) => e56.B(t47.id, t47.scope)))), o90.recalculate(h8, []); const a47 = e56.fu(t46, 1 / e56.d6(i26.tileID.canonical)), d34 = new e56.fv(u12, a47, n45, s19, c28, this.brightness, l21, this.worldview); s19 || (d34.needsUpload = true), r86.push(d34), d34.evaluate(o90); } this.status = "done", o88(null, { buckets: r86, featureIndex: l21, collisionBoxArray: null, glyphAtlasImage: null, lineAtlas: null, imageAtlas: null, brightness: null }); })).catch(((e57) => o88(new Error(e57.message)))); } } class Se { constructor(e57, t45, s18, i26, o88, n45, r86, a46) { this.actor = e57, this.layerIndex = t45, this.availableImages = s18, this.availableModels = i26, this.brightness = r86, this.loading = {}, this.loaded = {}, this.worldview = a46; } loadTile(t45, s18) { const i26 = t45.uid, o88 = this.loading[i26] = new Ie(t45, this.brightness, this.worldview); e56.bu(t45.request, ((e57, n45) => { const r86 = !this.loading[i26]; return delete this.loading[i26], r86 || e57 ? (o88.status = "done", r86 || (this.loaded[i26] = o88), s18(e57)) : n45 && 0 !== n45.byteLength ? void o88.parse(n45, this.layerIndex, t45, ((e58, t46) => { o88.status = "done", this.loaded = this.loaded || {}, this.loaded[i26] = o88, e58 || !t46 ? s18(e58) : s18(null, t46); })) : (o88.status = "done", this.loaded[i26] = o88, s18()); })); } reloadTile(e57, t45) { const s18 = this.loaded, i26 = e57.uid; if (s18 && s18[i26]) { const o88 = s18[i26]; o88.projection = e57.projection, o88.brightness = e57.brightness; const n45 = (s19, i27) => { o88.reloadCallback && (delete o88.reloadCallback, this.loadTile(e57, t45)), t45(s19, i27); }; "parsing" === o88.status ? o88.reloadCallback = n45 : "done" === o88.status && this.loadTile(e57, t45); } } abortTile(e57, t45) { const s18 = e57.uid; this.loading[s18] && delete this.loading[s18], t45(); } removeTile(e57, t45) { const s18 = this.loaded, i26 = e57.uid; s18 && s18[i26] && delete s18[i26], t45(); } } class Me { constructor(t45) { this.self = t45, this.actor = new e56.fx(t45, this), this.layerIndexes = {}, this.availableImages = {}, this.availableModels = {}, this.isSpriteLoaded = {}, this.imageRasterizer = new e56.x(), this.rtlPluginParsingListeners = [], this.projections = {}, this.defaultProjection = e56.cl({ name: "mercator" }), this.workerSourceTypes = { vector: c27, geojson: ve2, "raster-dem": h7, "raster-array": d33, "batched-model": Se }, this.workerSources = {}, this.self.registerWorkerSource = (e57, t46) => { if (this.workerSourceTypes[e57]) throw new Error(`Worker source with name "${e57}" already registered.`); this.workerSourceTypes[e57] = t46; }, this.self.registerRTLTextPlugin = (t46) => { if (e56.fy.isParsed()) throw new Error("RTL text plugin already registered."); e56.fy.setState({ pluginStatus: e56.fz.parsed, pluginURL: e56.fy.getPluginURL() }), e56.fy.applyArabicShaping = t46.applyArabicShaping, e56.fy.processBidirectionalText = t46.processBidirectionalText, e56.fy.processStyledBidirectionalText = t46.processStyledBidirectionalText; for (const e57 of this.rtlPluginParsingListeners) e57(null, true); this.rtlPluginParsingListeners = []; }; } clearCaches(e57, t45, s18) { delete this.layerIndexes[e57], delete this.availableImages[e57], delete this.availableModels[e57], delete this.workerSources[e57], s18(); } checkIfReady(e57, t45, s18) { s18(); } setReferrer(e57, t45) { this.referrer = t45; } spriteLoaded(t45, s18) { this.isSpriteLoaded[t45] || (this.isSpriteLoaded[t45] = {}); const { scope: i26, isLoaded: o88 } = s18; if (this.isSpriteLoaded[t45][i26] = o88, this.workerSources[t45] && this.workerSources[t45][i26]) for (const s19 in this.workerSources[t45][i26]) { const n45 = this.workerSources[t45][i26][s19]; for (const t46 in n45) { const s20 = n45[t46]; s20 instanceof c27 && (s20.isSpriteLoaded = o88, s20.fire(new e56.z("isSpriteLoaded"))); } } } setImages(e57, t45, s18) { this.availableImages[e57] || (this.availableImages[e57] = {}); const { scope: i26, images: o88 } = t45; if (this.availableImages[e57][i26] = o88, this.workerSources[e57] && this.workerSources[e57][i26]) { for (const t46 in this.workerSources[e57][i26]) { const s19 = this.workerSources[e57][i26][t46]; for (const e58 in s19) s19[e58].availableImages = o88; } s18(); } else s18(); } setModels(e57, { scope: t45, models: s18 }, i26) { if (this.availableModels[e57] || (this.availableModels[e57] = {}), this.availableModels[e57][t45] = s18, this.workerSources[e57] && this.workerSources[e57][t45]) { for (const i27 in this.workerSources[e57][t45]) { const o88 = this.workerSources[e57][t45][i27]; for (const e58 in o88) o88[e58].availableModels = s18; } i26(); } else i26(); } setProjection(t45, s18) { this.projections[t45] = e56.cl(s18); } setBrightness(e57, t45, s18) { this.brightness = t45, s18(); } setWorldview(e57, t45, s18) { this.worldview = t45, s18(); } setLayers(e57, t45, s18) { this.getLayerIndex(e57, t45.scope).replace(t45.layers, t45.options), s18(); } updateLayers(e57, t45, s18) { this.getLayerIndex(e57, t45.scope).update(t45.layers, t45.removedIds, t45.options), s18(); } loadTile(e57, t45, s18) { t45.projection = this.projections[e57] || this.defaultProjection, this.getWorkerSource(e57, t45.type, t45.source, t45.scope).loadTile(t45, s18); } decodeRasterArray(e57, t45, s18) { this.getWorkerSource(e57, t45.type, t45.source, t45.scope).decodeRasterArray(t45, s18); } reloadTile(e57, t45, s18) { t45.projection = this.projections[e57] || this.defaultProjection, this.getWorkerSource(e57, t45.type, t45.source, t45.scope).reloadTile(t45, s18); } abortTile(e57, t45, s18) { this.getWorkerSource(e57, t45.type, t45.source, t45.scope).abortTile(t45, s18); } removeTile(e57, t45, s18) { this.getWorkerSource(e57, t45.type, t45.source, t45.scope).removeTile(t45, s18); } removeSource(e57, t45, s18) { if (!(this.workerSources[e57] && this.workerSources[e57][t45.scope] && this.workerSources[e57][t45.scope][t45.type] && this.workerSources[e57][t45.scope][t45.type][t45.source])) return; const i26 = this.workerSources[e57][t45.scope][t45.type][t45.source]; delete this.workerSources[e57][t45.scope][t45.type][t45.source], void 0 !== i26.removeSource ? i26.removeSource(t45, s18) : s18(); } loadWorkerSource(e57, t45, s18) { try { this.self.importScripts(t45.url), s18(); } catch (e58) { s18(e58.toString()); } } syncRTLPluginState(t45, s18, i26) { if (e56.fy.isParsed()) i26(null, true); else if (e56.fy.isParsing()) this.rtlPluginParsingListeners.push(i26); else try { e56.fy.setState(s18); const t46 = e56.fy.getPluginURL(); !e56.fy.isLoaded() || e56.fy.isParsed() || e56.fy.isParsing() || null == t46 || (e56.fy.setState({ pluginStatus: e56.fz.parsing, pluginURL: e56.fy.getPluginURL() }), this.self.importScripts(t46), e56.fy.isParsed() ? i26(null, true) : this.rtlPluginParsingListeners.push(i26)); } catch (e57) { i26(e57.toString()); } } setDracoUrl(e57, t45) { this.dracoUrl = t45; } getAvailableImages(e57, t45) { this.availableImages[e57] || (this.availableImages[e57] = {}); let s18 = this.availableImages[e57][t45]; return s18 || (s18 = []), s18; } getAvailableModels(e57, t45) { this.availableModels[e57] || (this.availableModels[e57] = {}); let s18 = this.availableModels[e57][t45]; return s18 || (s18 = {}), s18; } getLayerIndex(e57, t45) { this.layerIndexes[e57] || (this.layerIndexes[e57] = {}); let s18 = this.layerIndexes[e57][t45]; return s18 || (s18 = this.layerIndexes[e57][t45] = new o87(), s18.scope = t45), s18; } getWorkerSource(e57, t45, s18, i26) { const o88 = this.workerSources; return o88[e57] || (o88[e57] = {}), o88[e57][i26] || (o88[e57][i26] = {}), o88[e57][i26][t45] || (o88[e57][i26][t45] = {}), this.isSpriteLoaded[e57] || (this.isSpriteLoaded[e57] = {}), o88[e57][i26][t45][s18] || (o88[e57][i26][t45][s18] = new this.workerSourceTypes[t45]({ send: (t46, s19, i27, o89, n45, r86) => this.actor.send(t46, s19, i27, e57, n45, r86), scheduler: this.actor.scheduler }, this.getLayerIndex(e57, i26), this.getAvailableImages(e57, i26), this.getAvailableModels(e57, i26), this.isSpriteLoaded[e57][i26], void 0, this.brightness, this.worldview)), o88[e57][i26][t45][s18]; } rasterizeImagesWorker(e57, t45, s18) { const i26 = /* @__PURE__ */ new Map(); for (const [s19, { image: o88, imageVariant: n45 }] of t45.tasks.entries()) { const r86 = this.imageRasterizer.rasterize(n45, o88, t45.scope, e57); i26.set(s19, r86); } s18(void 0, i26); } removeRasterizedImages(e57, t45, s18) { this.imageRasterizer.removeImagesFromCacheByIds(t45.imageIds, t45.scope, e57), s18(); } enforceCacheSizeLimit(t45, s18) { e56.fA(s18); } getWorkerPerformanceMetrics(e57, t45, s18) { s18(void 0, void 0); } } return e56.fw(self) && (self.worker = new Me(self)), Me; })); define2(["./shared"], (function(e56) { var t44 = "3.15.0"; const i25 = { create: "create", load: "load", fullLoad: "fullLoad" }, o87 = { mark(e57) { performance.mark(e57); }, measure(e57, t45, i26) { performance.measure(e57, t45, i26); } }; function s17(t45) { const i26 = t45.name.split("?")[0]; return e56.a(i26) && i26.includes("mapbox-gl.js") ? "javascript" : e56.a(i26) && i26.includes("mapbox-gl.css") ? "css" : e56.b(i26) ? "fontRange" : e56.c(i26) ? "sprite" : e56.i(i26) ? "style" : e56.d(i26) ? "tilejson" : "other"; } var r85, n44 = {}, a45 = (function() { if (r85) return n44; function e57(e58) { return !t45(e58); } function t45(t46) { return "undefined" == typeof window || "undefined" == typeof document ? "not a browser" : (function() { if (!("Worker" in window && "Blob" in window && "URL" in window)) return false; var e58, t47, i27 = new Blob([""], { type: "text/javascript" }), o89 = URL.createObjectURL(i27); try { t47 = new Worker(o89), e58 = true; } catch (t48) { e58 = false; } return t47 && t47.terminate(), URL.revokeObjectURL(o89), e58; })() ? (function() { var e58 = document.createElement("canvas"); e58.width = e58.height = 1; var t47 = e58.getContext("2d"); if (!t47) return false; var i27 = t47.getImageData(0, 0, 1, 1); return i27 && i27.width === e58.width; })() ? (void 0 === i26[o88 = t46 && t46.failIfMajorPerformanceCaveat] && (i26[o88] = (function(t47) { var i27, o89 = (function(t48) { var i28 = document.createElement("canvas"), o90 = Object.create(e57.webGLContextAttributes); return o90.failIfMajorPerformanceCaveat = t48, i28.getContext("webgl2", o90); })(t47); if (!o89) return false; try { i27 = o89.createShader(o89.VERTEX_SHADER); } catch (e58) { return false; } return !(!i27 || o89.isContextLost()) && (o89.shaderSource(i27, "void main() {}"), o89.compileShader(i27), true === o89.getShaderParameter(i27, o89.COMPILE_STATUS)); })(o88)), i26[o88] ? document.documentMode ? "insufficient ECMAScript 6 support" : void 0 : "insufficient WebGL2 support") : "insufficient Canvas/getImageData support" : "insufficient worker support"; var o88; } r85 = 1, n44.supported = e57, n44.notSupportedReason = t45; var i26 = {}; return e57.webGLContextAttributes = { antialias: false, alpha: true, stencil: true, depth: true }, n44; })(); function l20(e57, t45, i26) { const o88 = document.createElement(e57); return null != t45 && (o88.className = t45), i26 && i26.appendChild(o88), o88; } function c27(e57, t45, i26) { const o88 = document.createElementNS("http://www.w3.org/2000/svg", e57); for (const e58 of Object.keys(t45)) o88.setAttributeNS(null, e58, String(t45[e58])); return i26 && i26.appendChild(o88), o88; } const h7 = "undefined" != typeof document ? document.documentElement && document.documentElement.style : null, d33 = h7 && void 0 !== h7.userSelect ? "userSelect" : "WebkitUserSelect"; let u11; function _3() { h7 && d33 && (u11 = h7[d33], h7[d33] = "none"); } function p8() { h7 && d33 && (h7[d33] = u11); } function f7(e57) { e57.preventDefault(), e57.stopPropagation(), window.removeEventListener("click", f7, true); } function m5() { window.addEventListener("click", f7, true), window.setTimeout((() => { window.removeEventListener("click", f7, true); }), 0); } function g8(e57, t45) { const i26 = e57.getBoundingClientRect(); return x3(e57, i26, t45); } function v7(e57, t45) { const i26 = e57.getBoundingClientRect(), o88 = []; for (let s18 = 0; s18 < t45.length; s18++) o88.push(x3(e57, i26, t45[s18])); return o88; } function y3(e57) { return /firefox/i.test(navigator.userAgent) && /macintosh/i.test(navigator.userAgent) && 2 === e57.button && e57.ctrlKey ? 0 : e57.button; } function x3(t45, i26, o88) { const s18 = t45.offsetWidth === i26.width ? 1 : t45.offsetWidth / i26.width; return new e56.P((o88.clientX - i26.left) * s18, (o88.clientY - i26.top) * s18); } const b7 = "01", w3 = "NO_ACCESS_TOKEN"; class T4 { constructor(e57, t45, i26) { this._transformRequestFn = e57, this._customAccessToken = t45, this._silenceAuthErrors = !!i26, this._createSkuToken(); } _createSkuToken() { const e57 = (function() { let e58 = ""; for (let t45 = 0; t45 < 10; t45++) e58 += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62 * Math.random())]; return { token: ["1", b7, e58].join(""), tokenExpiresAt: Date.now() + 432e5 }; })(); this._skuToken = e57.token, this._skuTokenExpiresAt = e57.tokenExpiresAt; } _isSkuTokenExpired() { return Date.now() > this._skuTokenExpiresAt; } transformRequest(e57, t45) { return this._transformRequestFn && this._transformRequestFn(e57, t45) || { url: e57 }; } normalizeStyleURL(i26, o88) { if (!e56.h(i26)) return i26; const s18 = S4(i26); return s18.params.push(`sdk=js-${t44}`), s18.path = `/styles/v1${s18.path}`, this._makeAPIURL(s18, this._customAccessToken || o88); } normalizeGlyphsURL(t45, i26) { if (!e56.h(t45)) return t45; const o88 = S4(t45); return o88.path = `/fonts/v1${o88.path}`, this._makeAPIURL(o88, this._customAccessToken || i26); } normalizeModelURL(t45, i26) { if (!e56.h(t45)) return t45; const o88 = S4(t45); return o88.path = `/models/v1${o88.path}`, this._makeAPIURL(o88, this._customAccessToken || i26); } normalizeSourceURL(t45, i26, o88, s18) { if (!e56.h(t45)) return t45; const r86 = S4(t45); return r86.path = `/v4/${r86.authority}.json`, r86.params.push("secure"), o88 && r86.params.push(`language=${o88}`), s18 && r86.params.push(`worldview=${s18}`), this._makeAPIURL(r86, this._customAccessToken || i26); } normalizeIconsetURL(t45, i26) { const o88 = S4(t45); return e56.h(t45) ? (o88.path = `/styles/v1${o88.path}/iconset.pbf`, this._makeAPIURL(o88, this._customAccessToken || i26)) : I3(o88); } normalizeSpriteURL(t45, i26, o88, s18) { const r86 = S4(t45); return e56.h(t45) ? (r86.path = `/styles/v1${r86.path}/sprite${i26}${o88}`, this._makeAPIURL(r86, this._customAccessToken || s18)) : (r86.path += `${i26}${o88}`, I3(r86)); } normalizeTileURL(t45, i26, o88) { if (this._isSkuTokenExpired() && this._createSkuToken(), t45 && !e56.h(t45)) return t45; const s18 = S4(t45); s18.path = s18.path.replace(/(\.(png|jpg)\d*)(?=$)/, `${i26 || o88 && "raster" !== s18.authority && 512 === o88 ? "@2x" : ""}${e56.k.supported ? ".webp" : "$1"}`), "raster" === s18.authority ? s18.path = `/${e56.e.RASTER_URL_PREFIX}${s18.path}` : "rasterarrays" === s18.authority ? s18.path = `/${e56.e.RASTERARRAYS_URL_PREFIX}${s18.path}` : "3dtiles" === s18.authority ? s18.path = `/${e56.e.TILES3D_URL_PREFIX}${s18.path}` : (s18.path = s18.path.replace(/^.+\/v4\//, "/"), s18.path = `/${e56.e.TILE_URL_VERSION}${s18.path}`); const r86 = this._customAccessToken || (function(e57) { for (const t46 of e57) { const e58 = t46.match(/^access_token=(.*)$/); if (e58) return e58[1]; } return null; })(s18.params) || e56.e.ACCESS_TOKEN; return e56.e.REQUIRE_ACCESS_TOKEN && r86 && this._skuToken && s18.params.push(`sku=${this._skuToken}`), this._makeAPIURL(s18, r86); } canonicalizeTileURL(t45, i26) { const o88 = S4(t45); if (!o88.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/) || !o88.path.match(/\.[\w]+$/)) return t45; let s18 = "mapbox://"; o88.path.match(/^\/raster\/v1\//) ? s18 += `raster/${o88.path.replace(`/${e56.e.RASTER_URL_PREFIX}/`, "")}` : o88.path.match(/^\/rasterarrays\/v1\//) ? s18 += `rasterarrays/${o88.path.replace(`/${e56.e.RASTERARRAYS_URL_PREFIX}/`, "")}` : s18 += `tiles/${o88.path.replace(`/${e56.e.TILE_URL_VERSION}/`, "")}`; let r86 = o88.params; return i26 && (r86 = r86.filter(((e57) => !e57.match(/^access_token=/)))), r86.length && (s18 += `?${r86.join("&")}`), s18; } canonicalizeTileset(t45, i26) { const o88 = !!i26 && e56.h(i26), s18 = []; for (const i27 of t45.tiles || []) e56.j(i27) ? s18.push(this.canonicalizeTileURL(i27, o88)) : s18.push(i27); return s18; } _makeAPIURL(t45, i26) { const o88 = "See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes", s18 = S4(e56.e.API_URL); if (t45.protocol = s18.protocol, t45.authority = s18.authority, "http" === t45.protocol) { const e57 = t45.params.indexOf("secure"); e57 >= 0 && t45.params.splice(e57, 1); } if ("/" !== s18.path && (t45.path = `${s18.path}${t45.path}`), !e56.e.REQUIRE_ACCESS_TOKEN) return I3(t45); if (i26 = i26 || e56.e.ACCESS_TOKEN, !this._silenceAuthErrors) { if (!i26) throw new Error(`An API access token is required to use Mapbox GL. ${o88}`); if ("s" === i26[0]) throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${o88}`); } return t45.params = t45.params.filter(((e57) => -1 === e57.indexOf("access_token"))), t45.params.push(`access_token=${i26 || ""}`), I3(t45); } } const E4 = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/; function S4(e57) { const t45 = e57.match(E4); if (!t45) throw new Error("Unable to parse URL object"); return { protocol: t45[1], authority: t45[2], path: t45[3] || "/", params: t45[4] ? t45[4].split("&") : [] }; } function I3(e57) { const t45 = e57.params.length ? `?${e57.params.join("&")}` : ""; return `${e57.protocol}://${e57.authority}${e57.path}${t45}`; } const C5 = "mapbox.eventData"; function R4(t45) { if (!t45) return null; const i26 = t45.split("."); if (!i26 || 3 !== i26.length) return null; try { return JSON.parse(e56.l(i26[1])); } catch (e57) { return null; } } class A3 { constructor(e57) { this.type = e57, this.anonId = null, this.eventData = {}, this.queue = [], this.pendingRequest = null; } getStorageKey(t45) { const i26 = R4(e56.e.ACCESS_TOKEN); let o88 = ""; return o88 = i26 && i26.u ? e56.f(i26.u) : e56.e.ACCESS_TOKEN || "", t45 ? `${C5}.${t45}:${o88}` : `${C5}:${o88}`; } fetchEventData() { const t45 = e56.s("localStorage"), i26 = this.getStorageKey(), o88 = this.getStorageKey("uuid"); if (t45) try { const e57 = localStorage.getItem(i26); e57 && (this.eventData = JSON.parse(e57)); const t46 = localStorage.getItem(o88); t46 && (this.anonId = t46); } catch (t46) { e56.w("Unable to read from LocalStorage"); } } saveEventData() { const t45 = e56.s("localStorage"), i26 = this.getStorageKey(), o88 = this.getStorageKey("uuid"), s18 = this.anonId; if (t45 && s18) try { localStorage.setItem(o88, s18), Object.keys(this.eventData).length >= 1 && localStorage.setItem(i26, JSON.stringify(this.eventData)); } catch (t46) { e56.w("Unable to write to LocalStorage"); } } processRequests(e57) { } postEvent(t45, i26, o88, s18) { if (!e56.e.EVENTS_URL) return; const r86 = S4(e56.e.EVENTS_URL); r86.params.push(`access_token=${s18 || e56.e.ACCESS_TOKEN || ""}`); const n45 = { event: this.type, created: new Date(t45).toISOString() }, a46 = i26 ? Object.assign(n45, i26) : n45, l21 = { url: I3(r86), headers: { "Content-Type": "text/plain" }, body: JSON.stringify([a46]) }; this.pendingRequest = e56.p(l21, ((e57) => { this.pendingRequest = null, o88(e57), this.saveEventData(), this.processRequests(s18); })); } queueRequest(e57, t45) { this.queue.push(e57), this.processRequests(t45); } } const D4 = new class extends A3 { constructor(e57) { super("appUserTurnstile"), this._customAccessToken = e57; } postTurnstileEvent(t45, i26) { e56.e.EVENTS_URL && e56.e.ACCESS_TOKEN && Array.isArray(t45) && t45.some(((t46) => e56.h(t46) || e56.j(t46))) && this.queueRequest(Date.now(), i26); } processRequests(i26) { if (this.pendingRequest || 0 === this.queue.length) return; this.anonId && this.eventData.lastSuccess && this.eventData.tokenU || this.fetchEventData(); const o88 = R4(e56.e.ACCESS_TOKEN), s18 = o88 ? o88.u : e56.e.ACCESS_TOKEN; let r86 = s18 !== this.eventData.tokenU; e56.v(this.anonId) || (this.anonId = e56.u(), r86 = true); const n45 = this.queue.shift(); if (this.eventData.lastSuccess) { const e57 = new Date(this.eventData.lastSuccess), t45 = new Date(n45), i27 = (n45 - this.eventData.lastSuccess) / 864e5; r86 = r86 || i27 >= 1 || i27 < -1 || e57.getDate() !== t45.getDate(); } else r86 = true; r86 ? this.postEvent(n45, { sdkIdentifier: "mapbox-gl-js", sdkVersion: t44, skuId: b7, "enabled.telemetry": false, userId: this.anonId }, ((e57) => { e57 || (this.eventData.lastSuccess = n45, this.eventData.tokenU = s18); }), i26) : this.processRequests(); } }(), L2 = D4.postTurnstileEvent.bind(D4), P3 = new class extends A3 { constructor() { super("map.load"), this.success = {}, this.skuToken = ""; } postMapLoadEvent(t45, i26, o88, s18) { this.skuToken = i26, this.errorCb = s18, e56.e.EVENTS_URL && (o88 || e56.e.ACCESS_TOKEN ? this.queueRequest({ id: t45, timestamp: Date.now() }, o88) : this.errorCb(new Error(w3))); } processRequests(i26) { if (this.pendingRequest || 0 === this.queue.length) return; const { id: o88, timestamp: s18 } = this.queue.shift(); o88 && this.success[o88] || (this.anonId || this.fetchEventData(), e56.v(this.anonId) || (this.anonId = e56.u()), this.postEvent(s18, { sdkIdentifier: "mapbox-gl-js", sdkVersion: t44, skuId: b7, skuToken: this.skuToken, userId: this.anonId }, ((e57) => { e57 ? this.errorCb(e57) : o88 && (this.success[o88] = true); }), i26)); } remove() { this.errorCb = null; } }(), z3 = P3.postMapLoadEvent.bind(P3), O3 = new class extends A3 { constructor() { super("style.load"), this.eventIdPerMapInstanceMap = /* @__PURE__ */ new Map(), this.mapInstanceIdMap = /* @__PURE__ */ new WeakMap(); } getMapInstanceId(t45) { let i26 = this.mapInstanceIdMap.get(t45); return i26 || (i26 = e56.u(), this.mapInstanceIdMap.set(t45, i26)), i26; } getEventId(e57) { const t45 = this.eventIdPerMapInstanceMap.get(e57) || 0; return this.eventIdPerMapInstanceMap.set(e57, t45 + 1), t45; } postStyleLoadEvent(t45, i26) { const { map: o88, style: s18, importedStyles: r86 } = i26; if (!e56.e.EVENTS_URL || !t45 && !e56.e.ACCESS_TOKEN) return; const n45 = this.getMapInstanceId(o88), a46 = { mapInstanceId: n45, eventId: this.getEventId(n45), style: s18 }; r86.length && (a46.importedStyles = r86), this.queueRequest({ timestamp: Date.now(), payload: a46 }, t45); } processRequests(e57) { if (this.pendingRequest || 0 === this.queue.length) return; const { timestamp: t45, payload: i26 } = this.queue.shift(); this.postEvent(t45, i26, (() => { }), e57); } }(), M4 = O3.postStyleLoadEvent.bind(O3), F16 = new class extends A3 { constructor() { super("gljs.performance"); } postPerformanceEvent(t45, i26) { e56.e.EVENTS_URL && (t45 || e56.e.ACCESS_TOKEN) && this.queueRequest({ timestamp: Date.now(), performanceData: i26 }, t45); } processRequests(o88) { if (this.pendingRequest || 0 === this.queue.length) return; const { timestamp: r86, performanceData: n45 } = this.queue.shift(), a46 = (function(o89) { const r87 = performance.getEntriesByType("resource"), n46 = performance.getEntriesByType("mark"), a47 = (function(e57) { const t45 = {}; if (e57) { for (const i26 in e57) if ("other" !== i26) for (const o90 of e57[i26]) { const e58 = `${i26}ResolveRangeMin`, s18 = `${i26}ResolveRangeMax`, r88 = `${i26}RequestCount`, n47 = `${i26}RequestCachedCount`; t45[e58] = Math.min(t45[e58] || 1 / 0, o90.startTime), t45[s18] = Math.max(t45[s18] || -1 / 0, o90.responseEnd); const a48 = (e59) => { void 0 === t45[e59] && (t45[e59] = 0), ++t45[e59]; }; void 0 !== o90.transferSize && 0 === o90.transferSize && a48(n47), a48(r88); } } return t45; })((function(e57, t45) { const i26 = {}; if (e57) for (const o90 of e57) { const e58 = t45(o90); void 0 === i26[e58] && (i26[e58] = []), i26[e58].push(o90); } return i26; })(r87, s17)), l21 = window.devicePixelRatio, c28 = navigator.connection || navigator.mozConnection || navigator.webkitConnection, h8 = c28 ? c28.effectiveType : void 0, d34 = { counters: [], metadata: [], attributes: [] }, u12 = (e57, t45, i26) => { null != i26 && e57.push({ name: t45, value: i26.toString() }); }; for (const e57 in a47) u12(d34.counters, e57, a47[e57]); if (o89.interactionRange[0] !== 1 / 0 && o89.interactionRange[1] !== -1 / 0 && (u12(d34.counters, "interactionRangeMin", o89.interactionRange[0]), u12(d34.counters, "interactionRangeMax", o89.interactionRange[1])), n46) for (const e57 of Object.keys(i25)) { const t45 = i25[e57], o90 = n46.find(((e58) => e58.name === t45)); o90 && u12(d34.counters, t45, o90.startTime); } return u12(d34.counters, "visibilityHidden", o89.visibilityHidden), u12(d34.attributes, "style", (function(t45) { if (t45) for (const i26 of t45) { const t46 = i26.name.split("?")[0]; if (e56.i(t46)) { const e57 = t46.split("/").slice(-2); if (2 === e57.length) return `mapbox://styles/${e57[0]}/${e57[1]}`; } } })(r87)), u12(d34.attributes, "terrainEnabled", o89.terrainEnabled ? "true" : "false"), u12(d34.attributes, "fogEnabled", o89.fogEnabled ? "true" : "false"), u12(d34.attributes, "projection", o89.projection), u12(d34.attributes, "zoom", o89.zoom), u12(d34.metadata, "devicePixelRatio", l21), u12(d34.metadata, "connectionEffectiveType", h8), u12(d34.metadata, "navigatorUserAgent", navigator.userAgent), u12(d34.metadata, "screenWidth", window.screen.width), u12(d34.metadata, "screenHeight", window.screen.height), u12(d34.metadata, "windowWidth", window.innerWidth), u12(d34.metadata, "windowHeight", window.innerHeight), u12(d34.metadata, "mapWidth", o89.width / l21), u12(d34.metadata, "mapHeight", o89.height / l21), u12(d34.metadata, "webglRenderer", o89.renderer), u12(d34.metadata, "webglVendor", o89.vendor), u12(d34.metadata, "sdkVersion", t44), u12(d34.metadata, "sdkIdentifier", "mapbox-gl-js"), d34; })(n45); for (const e57 of a46.metadata) ; for (const e57 of a46.counters) ; for (const e57 of a46.attributes) ; this.postEvent(r86, a46, (() => { }), o88); } }(), B5 = F16.postPerformanceEvent.bind(F16), k6 = new class extends A3 { constructor() { super("map.auth"), this.success = {}, this.skuToken = ""; } getSession(t45, i26, o88, s18) { if (!e56.e.API_URL || !e56.e.SESSION_PATH) return; const r86 = S4(e56.e.API_URL + e56.e.SESSION_PATH); r86.params.push(`sku=${i26 || ""}`), r86.params.push(`access_token=${s18 || e56.e.ACCESS_TOKEN || ""}`); const n45 = { url: I3(r86), headers: { "Content-Type": "text/plain" } }; this.pendingRequest = e56.g(n45, ((e57) => { this.pendingRequest = null, o88(e57), this.saveEventData(), this.processRequests(s18); })); } getSessionAPI(t45, i26, o88, s18) { this.skuToken = i26, this.errorCb = s18, e56.e.SESSION_PATH && e56.e.API_URL && (o88 || e56.e.ACCESS_TOKEN ? this.queueRequest({ id: t45, timestamp: Date.now() }, o88) : this.errorCb(new Error(w3))); } processRequests(e57) { if (this.pendingRequest || 0 === this.queue.length) return; const { id: t45, timestamp: i26 } = this.queue.shift(); t45 && this.success[t45] || this.getSession(i26, this.skuToken, ((e58) => { e58 ? this.errorCb(e58) : t45 && (this.success[t45] = true); }), e57); } remove() { this.errorCb = null; } }(), N4 = k6.getSessionAPI.bind(k6), U3 = /* @__PURE__ */ new Set(); function j3(e57, t45) { t45 ? U3.add(e57) : U3.delete(e57); } class V3 { constructor() { this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSourceCaches = {}, this._updatedPaintProps = /* @__PURE__ */ new Set(), this._updatedImages = {}; } isDirty() { return this._changed; } setDirty() { this._changed = true; } getUpdatedSourceCaches() { return this._updatedSourceCaches; } updateSourceCache(e57, t45) { this._updatedSourceCaches[e57] = t45, this.setDirty(); } discardSourceCacheUpdate(e57) { delete this._updatedSourceCaches[e57]; } updateLayer(e57) { const t45 = e57.scope; this._updatedLayers[t45] = this._updatedLayers[t45] || /* @__PURE__ */ new Set(), this._updatedLayers[t45].add(e57.id), this.setDirty(); } removeLayer(e57) { const t45 = e57.scope; this._removedLayers[t45] = this._removedLayers[t45] || {}, this._updatedLayers[t45] = this._updatedLayers[t45] || /* @__PURE__ */ new Set(), this._removedLayers[t45][e57.id] = e57, this._updatedLayers[t45].delete(e57.id), this._updatedPaintProps.delete(e57.fqid), this.setDirty(); } getRemovedLayer(e57) { return this._removedLayers[e57.scope] ? this._removedLayers[e57.scope][e57.id] : null; } discardLayerRemoval(e57) { this._removedLayers[e57.scope] && delete this._removedLayers[e57.scope][e57.id]; } getLayerUpdatesByScope() { const e57 = {}; for (const t45 in this._updatedLayers) e57[t45] = e57[t45] || {}, e57[t45].updatedIds = Array.from(this._updatedLayers[t45].values()); for (const t45 in this._removedLayers) e57[t45] = e57[t45] || {}, e57[t45].removedIds = Object.keys(this._removedLayers[t45]); return e57; } getUpdatedPaintProperties() { return this._updatedPaintProps; } updatePaintProperties(e57) { this._updatedPaintProps.add(e57.fqid), this.setDirty(); } getUpdatedImages(e57) { return this._updatedImages[e57] ? Array.from(this._updatedImages[e57].values()) : []; } updateImage(t45, i26) { this._updatedImages[i26] = this._updatedImages[i26] || /* @__PURE__ */ new Set(), this._updatedImages[i26].add(e56.I.toString(t45)), this.setDirty(); } resetUpdatedImages(e57) { this._updatedImages[e57] && this._updatedImages[e57].clear(); } reset() { this._changed = false, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSourceCaches = {}, this._updatedPaintProps.clear(), this._updatedImages = {}; } } function G4(e57) { const { userImage: t45 } = e57; return !!(t45 && t45.render && t45.render()) && (e57.data.replace(new Uint8Array(t45.data.buffer)), true); } class H3 extends e56.E { constructor(t45) { super(), this.imageProviders = /* @__PURE__ */ new Map(), this.images = /* @__PURE__ */ new Map(), this.updatedImages = /* @__PURE__ */ new Map(), this.callbackDispatchedThisFrame = /* @__PURE__ */ new Map(), this.loaded = /* @__PURE__ */ new Map(), this.requestors = [], this.patterns = /* @__PURE__ */ new Map(), this.patternsInFlight = /* @__PURE__ */ new Set(), this.atlasImage = /* @__PURE__ */ new Map(), this.atlasTexture = /* @__PURE__ */ new Map(), this.dirty = true, this.spriteFormat = t45, "raster" !== t45 && e56.r() && (this.imageRasterizerDispatcher = new e56.D(e56.t(), this, "Image Rasterizer Worker", 1)); } addScope(t45) { this.loaded.set(t45, false), this.imageProviders.set(t45, /* @__PURE__ */ new Map()), this.images.set(t45, /* @__PURE__ */ new Map()), this.updatedImages.set(t45, /* @__PURE__ */ new Set()), this.callbackDispatchedThisFrame.set(t45, /* @__PURE__ */ new Set()), this.patterns.set(t45, /* @__PURE__ */ new Map()), this.atlasImage.set(t45, new e56.q({ width: 1, height: 1 })); } removeScope(e57) { this.loaded.delete(e57), this.imageProviders.delete(e57), this.images.delete(e57), this.updatedImages.delete(e57), this.callbackDispatchedThisFrame.delete(e57), this.patterns.delete(e57), this.atlasImage.delete(e57); const t45 = this.atlasTexture.get(e57); t45 && (t45.destroy(), this.atlasTexture.delete(e57)); } addImageProvider(e57, t45) { this.imageProviders.has(t45) || this.imageProviders.set(t45, /* @__PURE__ */ new Map()), this.imageProviders.get(t45).set(e57.id, e57); } removeImageProvider(e57, t45) { this.imageProviders.has(t45) && this.imageProviders.get(t45).delete(e57); } getPendingImageProviders() { const e57 = []; for (const t45 of this.imageProviders.values()) for (const i26 of t45.values()) i26.hasPendingRequests() && e57.push(i26); return e57; } get imageRasterizer() { return this._imageRasterizer || (this._imageRasterizer = new e56.x()), this._imageRasterizer; } isLoaded() { for (const e57 of this.loaded.keys()) if (!this.loaded.get(e57)) return false; return true; } setLoaded(e57, t45) { if (this.loaded.get(t45) !== e57 && (this.loaded.set(t45, e57), e57)) { for (const { ids: e58, callback: i26 } of this.requestors) this._notify(e58, t45, i26); this.requestors = []; } } hasImage(e57, t45) { return !!this.getImage(e57, t45); } getImage(e57, t45) { return this.images.get(t45).get(e57.toString()); } addImage(e57, t45, i26) { this._validate(e57, i26) && this.images.get(t45).set(e57.toString(), i26); } _validate(t45, i26) { let o88 = true; return this._validateStretch(i26.stretchX, i26.data && i26.data.width) || (this.fire(new e56.y(new Error(`Image "${t45.name}" has invalid "stretchX" value`))), o88 = false), this._validateStretch(i26.stretchY, i26.data && i26.data.height) || (this.fire(new e56.y(new Error(`Image "${t45.name}" has invalid "stretchY" value`))), o88 = false), this._validateContent(i26.content, i26) || (this.fire(new e56.y(new Error(`Image "${t45.name}" has invalid "content" value`))), o88 = false), o88; } _validateStretch(e57, t45) { if (!e57) return true; let i26 = 0; for (const o88 of e57) { if (o88[0] < i26 || o88[1] < o88[0] || t45 < o88[1]) return false; i26 = o88[1]; } return true; } _validateContent(e57, t45) { if (!e57) return true; if (4 !== e57.length) return false; if (!t45.usvg) { if (e57[0] < 0 || t45.data.width < e57[0]) return false; if (e57[1] < 0 || t45.data.height < e57[1]) return false; if (e57[2] < 0 || t45.data.width < e57[2]) return false; if (e57[3] < 0 || t45.data.height < e57[3]) return false; } return !(e57[2] < e57[0] || e57[3] < e57[1]); } updateImage(e57, t45, i26) { const o88 = this.images.get(t45).get(e57.toString()); i26.version = o88.version + 1, this.images.get(t45).set(e57.toString(), i26), this.updatedImages.get(t45).add(e57), this.removeFromImageRasterizerCache(e57, t45); } clearUpdatedImages(e57) { this.updatedImages.get(e57).clear(); } removeFromImageRasterizerCache(t45, i26) { "raster" !== this.spriteFormat && (e56.r() ? this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages", { imageIds: [t45], scope: i26 }) : this.imageRasterizer.removeImagesFromCacheByIds([t45], i26)); } removeImage(e57, t45) { const i26 = this.images.get(t45), o88 = i26.get(e57.toString()); i26.delete(e57.toString()), this.patterns.get(t45).delete(e57.toString()), this.removeFromImageRasterizerCache(e57, t45), o88.userImage && o88.userImage.onRemove && o88.userImage.onRemove(); } listImages(t45) { return Array.from(this.images.get(t45).keys()).map(((t46) => e56.I.from(t46))); } getImages(e57, t45, i26) { const o88 = [], s18 = [], r86 = this.imageProviders.get(t45); for (const i27 of e57) { if (!i27.iconsetId) { o88.push(i27); continue; } const e58 = r86.get(i27.iconsetId); e58 && (this.getImage(i27, t45) ? s18.push(i27) : e58.addPendingRequest(i27)); } if (0 === o88.length) return void this._notify(s18, t45, i26); let n45 = true; const a46 = !!this.loaded.get(t45), l21 = this.images.get(t45); if (!a46) for (const e58 of o88) l21.has(e58.toString()) || (n45 = false); a46 || n45 ? this._notify(o88, t45, i26) : this.requestors.push({ ids: o88, scope: t45, callback: i26 }); } rasterizeImages(e57, t45) { const i26 = /* @__PURE__ */ new Map(), { tasks: o88, scope: s18 } = e57; for (const [e58, t46] of o88.entries()) { const o89 = this.getImage(t46.id, s18); o89 && i26.set(e58, { image: o89, imageVariant: t46 }); } this._rasterizeImages(s18, i26, t45); } _rasterizeImages(t45, i26, o88) { if (e56.r()) this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker", { tasks: i26, scope: t45 }, o88); else { const e57 = /* @__PURE__ */ new Map(); for (const [o89, { image: s18, imageVariant: r86 }] of i26.entries()) e57.set(o89, this.imageRasterizer.rasterize(r86, s18, t45, 0)); o88(void 0, e57); } } getUpdatedImages(e57) { return this.updatedImages.get(e57) || /* @__PURE__ */ new Set(); } _notify(t45, i26, o88) { const s18 = this.images.get(i26), r86 = /* @__PURE__ */ new Map(); for (const i27 of t45) { if (!s18.get(i27.toString())) { if (i27.iconsetId) continue; this.fire(new e56.z("styleimagemissing", { id: i27.name })); } const t46 = s18.get(i27.toString()); if (!t46) { e56.w(`Image "${i27.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`); continue; } const o89 = { data: t46.usvg ? null : t46.data.clone(), pixelRatio: t46.pixelRatio, sdf: t46.sdf, usvg: t46.usvg, version: t46.version, stretchX: t46.stretchX, stretchY: t46.stretchY, content: t46.content, hasRenderCallback: Boolean(t46.userImage && t46.userImage.render) }; t46.usvg && Object.assign(o89, { width: t46.icon.usvg_tree.width, height: t46.icon.usvg_tree.height }), r86.set(e56.I.toString(i27), o89); } o88(null, r86); } getPixelSize(e57) { const { width: t45, height: i26 } = this.atlasImage.get(e57); return { width: t45, height: i26 }; } getPattern(t45, i26, o88) { const s18 = t45.toString(), r86 = this.patterns.get(i26), n45 = r86.get(s18), a46 = this.getImage(t45, i26); if (!a46) return null; if (n45) { if (n45.position.version === a46.version) return n45.position; n45.position.version = a46.version; } else { if (a46.usvg && !a46.data) { const r87 = this.getPatternInFlightId(s18, i26); if (this.patternsInFlight.has(r87)) return null; this.patternsInFlight.add(r87); const n46 = new e56.A(t45).scaleSelf(e56.o.devicePixelRatio), l21 = /* @__PURE__ */ new Map([[n46.toString(), { image: a46, imageVariant: n46 }]]); return this._rasterizeImages(i26, l21, ((e57, t46) => this.storePatternImage(n46, i26, a46, o88, t46))), null; } this.storePattern(t45, i26, a46); } return this._updatePatternAtlas(i26, o88), r86.get(s18).position; } getPatternInFlightId(t45, i26) { return e56.B(t45, i26); } hasPatternsInFlight() { return 0 !== this.patternsInFlight.size; } storePatternImage(e57, t45, i26, o88, s18) { const r86 = e57.toString(), n45 = s18 ? s18.get(r86) : void 0; n45 && (i26.data = n45, this.storePattern(e57.id, t45, i26), this._updatePatternAtlas(t45, o88), this.patternsInFlight.delete(this.getPatternInFlightId(e57.id.toString(), t45))); } storePattern(t45, i26, o88) { const s18 = { w: o88.data.width + 2 * e56.C, h: o88.data.height + 2 * e56.C, x: 0, y: 0 }, r86 = new e56.F(s18, o88, e56.C); this.patterns.get(i26).set(t45.toString(), { bin: s18, position: r86 }); } destroyAtlasTextures() { for (const e57 of this.atlasTexture.values()) e57 && e57.destroy(); this.atlasTexture.clear(); } bind(t45, i26) { const o88 = t45.gl; let s18 = this.atlasTexture.get(i26); s18 ? this.dirty && (s18.update(this.atlasImage.get(i26)), this.dirty = false) : (s18 = new e56.T(t45, this.atlasImage.get(i26), o88.RGBA8), this.atlasTexture.set(i26, s18)), s18.bind(o88.LINEAR, o88.CLAMP_TO_EDGE); } _updatePatternAtlas(t45, i26) { const o88 = this.patterns.get(t45), s18 = Array.from(o88.values()).map((({ bin: e57 }) => e57)), { w: r86, h: n45 } = e56.G(s18), a46 = this.atlasImage.get(t45); a46.resize({ width: r86 || 1, height: n45 || 1 }); const l21 = this.images.get(t45); for (const [t46, { bin: s19, position: r87 }] of o88.entries()) { let o89 = r87.padding; const n46 = s19.x + o89, c28 = s19.y + o89, h8 = l21.get(t46).data, d34 = h8.width, u12 = h8.height; o89 = o89 > 1 ? o89 - 1 : o89, e56.q.copy(h8, a46, { x: 0, y: 0 }, { x: n46, y: c28 }, { width: d34, height: u12 }, i26), e56.q.copy(h8, a46, { x: 0, y: u12 - o89 }, { x: n46, y: c28 - o89 }, { width: d34, height: o89 }, i26), e56.q.copy(h8, a46, { x: 0, y: 0 }, { x: n46, y: c28 + u12 }, { width: d34, height: o89 }, i26), e56.q.copy(h8, a46, { x: d34 - o89, y: 0 }, { x: n46 - o89, y: c28 }, { width: o89, height: u12 }, i26), e56.q.copy(h8, a46, { x: 0, y: 0 }, { x: n46 + d34, y: c28 }, { width: o89, height: u12 }, i26), e56.q.copy(h8, a46, { x: d34 - o89, y: u12 - o89 }, { x: n46 - o89, y: c28 - o89 }, { width: o89, height: o89 }, i26), e56.q.copy(h8, a46, { x: 0, y: u12 - o89 }, { x: n46 + d34, y: c28 - o89 }, { width: o89, height: o89 }, i26), e56.q.copy(h8, a46, { x: 0, y: 0 }, { x: n46 + d34, y: c28 + u12 }, { width: o89, height: o89 }, i26), e56.q.copy(h8, a46, { x: d34 - o89, y: 0 }, { x: n46 - o89, y: c28 + u12 }, { width: o89, height: o89 }, i26); } this.dirty = true; } beginFrame() { for (const e57 of this.images.keys()) this.callbackDispatchedThisFrame.set(e57, /* @__PURE__ */ new Set()); } dispatchRenderCallbacks(e57, t45) { const i26 = this.images.get(t45); for (const o88 of e57) { if (this.callbackDispatchedThisFrame.get(t45).has(o88.toString())) continue; this.callbackDispatchedThisFrame.get(t45).add(o88.toString()); const e58 = i26.get(o88.toString()); G4(e58) && this.updateImage(o88, t45, e58); } } destroy() { this.imageRasterizerDispatcher && this.imageRasterizerDispatcher.remove(); } } function q2(t45) { const i26 = t45.value, o88 = t45.valueSpec, s18 = t45.style, r86 = t45.styleSpec, n45 = t45.key, a46 = t45.arrayElementValidator || _e2; if (!Array.isArray(i26)) return [new e56.V(n45, i26, `array expected, ${e56.K(i26)} found`)]; if (o88.length && i26.length !== o88.length) return [new e56.V(n45, i26, `array length ${o88.length} expected, length ${i26.length} found`)]; if (o88["min-length"] && i26.length < o88["min-length"]) return [new e56.V(n45, i26, `array length at least ${o88["min-length"]} expected, length ${i26.length} found`)]; let l21 = { type: o88.value, values: o88.values, minimum: o88.minimum, maximum: o88.maximum, function: void 0 }; r86.$version < 7 && (l21.function = o88.function), e56.H(o88.value) && (l21 = o88.value); let c28 = []; for (let e57 = 0; e57 < i26.length; e57++) c28 = c28.concat(a46({ array: i26, arrayIndex: e57, value: i26[e57], valueSpec: l21, style: s18, styleSpec: r86, key: `${n45}[${e57}]` }, true)); return c28; } function Z2(t45) { const i26 = t45.key, o88 = t45.value, s18 = t45.valueSpec; if (!e56.L(o88)) return [new e56.V(i26, o88, `number expected, ${e56.K(o88)} found`)]; if (o88 != o88) return [new e56.V(i26, o88, "number expected, NaN found")]; if ("minimum" in s18) { let r86 = s18.minimum; if (Array.isArray(s18.minimum) && (r86 = s18.minimum[t45.arrayIndex]), o88 < r86) return [new e56.V(i26, o88, `${o88} is less than the minimum value ${r86}`)]; } if ("maximum" in s18) { let r86 = s18.maximum; if (Array.isArray(s18.maximum) && (r86 = s18.maximum[t45.arrayIndex]), o88 > r86) return [new e56.V(i26, o88, `${o88} is greater than the maximum value ${r86}`)]; } return []; } function W3(t45) { const i26 = t45.key, o88 = t45.value; if (!e56.H(o88)) return [new e56.V(i26, o88, `object expected, ${e56.K(o88)} found`)]; const s18 = t45.valueSpec, r86 = e56.J(o88.type); let n45, a46, l21, c28 = {}; const h8 = "categorical" !== r86 && void 0 === o88.property, d34 = !h8, u12 = (function(t46) { const i27 = t46.stops; return Array.isArray(i27) && Array.isArray(i27[0]) && e56.H(i27[0][0]); })(o88), _4 = pe({ key: t45.key, value: t45.value, valueSpec: t45.styleSpec.function, style: t45.style, styleSpec: t45.styleSpec, objectElementValidators: { stops: function(t46) { if ("identity" === r86) return [new e56.V(t46.key, t46.value, 'identity function may not have a "stops" property')]; let i27 = []; const o89 = t46.value; return i27 = i27.concat(q2({ key: t46.key, value: o89, valueSpec: t46.valueSpec, style: t46.style, styleSpec: t46.styleSpec, arrayElementValidator: p9 })), Array.isArray(o89) && 0 === o89.length && i27.push(new e56.V(t46.key, o89, "array must have at least one stop")), i27; }, default: function(e57) { return _e2({ key: e57.key, value: e57.value, valueSpec: s18, style: e57.style, styleSpec: e57.styleSpec }); } } }); return "identity" === r86 && h8 && _4.push(new e56.V(t45.key, t45.value, 'missing required property "property"')), "identity" === r86 || o88.stops || _4.push(new e56.V(t45.key, t45.value, 'missing required property "stops"')), "exponential" === r86 && s18.expression && !e56.M(s18) && _4.push(new e56.V(t45.key, t45.value, "exponential functions not supported")), t45.styleSpec.$version >= 8 && (d34 && !e56.N(s18) ? _4.push(new e56.V(t45.key, t45.value, "property functions not supported")) : h8 && !e56.O(s18) && _4.push(new e56.V(t45.key, t45.value, "zoom functions not supported"))), "categorical" !== r86 && !u12 || void 0 !== o88.property || _4.push(new e56.V(t45.key, t45.value, '"property" property is required')), _4; function p9(t46) { let i27 = []; const o89 = t46.value, r87 = t46.key; if (!Array.isArray(o89)) return [new e56.V(r87, o89, `array expected, ${e56.K(o89)} found`)]; if (2 !== o89.length) return [new e56.V(r87, o89, `array length 2 expected, length ${o89.length} found`)]; if (u12) { if (!e56.H(o89[0])) return [new e56.V(r87, o89, `object expected, ${e56.K(o89[0])} found`)]; const s19 = o89[0]; if (void 0 === s19.zoom) return [new e56.V(r87, o89, "object stop key must have zoom")]; if (void 0 === s19.value) return [new e56.V(r87, o89, "object stop key must have value")]; const n46 = e56.J(s19.zoom); if ("number" != typeof n46) return [new e56.V(r87, s19.zoom, "stop zoom values must be numbers")]; if (l21 && l21 > n46) return [new e56.V(r87, s19.zoom, "stop zoom values must appear in ascending order")]; n46 !== l21 && (l21 = n46, a46 = void 0, c28 = {}), i27 = i27.concat(pe({ key: `${r87}[0]`, value: o89[0], valueSpec: { zoom: {} }, style: t46.style, styleSpec: t46.styleSpec, objectElementValidators: { zoom: Z2, value: f8 } })); } else i27 = i27.concat(f8({ key: `${r87}[0]`, value: o89[0], style: t46.style, styleSpec: t46.styleSpec }, o89)); return e56.Q(e56.S(o89[1])) ? i27.concat([new e56.V(`${r87}[1]`, o89[1], "expressions are not allowed in function stops.")]) : i27.concat(_e2({ key: `${r87}[1]`, value: o89[1], valueSpec: s18, style: t46.style, styleSpec: t46.styleSpec })); } function f8(t46, i27) { const o89 = e56.K(t46.value), l22 = e56.J(t46.value), h9 = null !== t46.value ? t46.value : i27; if (n45) { if (o89 !== n45) return [new e56.V(t46.key, h9, `${o89} stop domain type must match previous stop domain type ${n45}`)]; } else n45 = o89; if ("number" !== o89 && "string" !== o89 && "boolean" !== o89 && "number" != typeof l22 && "string" != typeof l22 && "boolean" != typeof l22) return [new e56.V(t46.key, h9, "stop domain value must be a number, string, or boolean")]; if ("number" !== o89 && "categorical" !== r86) { let i28 = `number expected, ${o89} found`; return e56.N(s18) && void 0 === r86 && (i28 += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new e56.V(t46.key, h9, i28)]; } return "categorical" !== r86 || "number" !== o89 || "number" == typeof l22 && isFinite(l22) && Math.floor(l22) === l22 ? "categorical" !== r86 && "number" === o89 && "number" == typeof l22 && "number" == typeof a46 && void 0 !== a46 && l22 < a46 ? [new e56.V(t46.key, h9, "stop domain values must appear in ascending order")] : (a46 = l22, "categorical" === r86 && l22 in c28 ? [new e56.V(t46.key, h9, "stop domain values must be unique")] : (c28[l22] = true, [])) : [new e56.V(t46.key, h9, `integer expected, found ${String(l22)}`)]; } } function $4(t45) { const i26 = ("property" === t45.expressionContext ? e56.W : e56.U)(e56.S(t45.value), t45.valueSpec); if ("error" === i26.result) return i26.value.map(((i27) => new e56.V(`${t45.key}${i27.key}`, t45.value, i27.message))); const o88 = i26.value.expression || i26.value._styleExpression.expression; if ("property" === t45.expressionContext && "text-font" === t45.propertyKey && !o88.outputDefined()) return [new e56.V(t45.key, t45.value, `Invalid data expression for "${t45.propertyKey}". Output values must be contained as literals within the expression.`)]; if ("property" === t45.expressionContext && "layout" === t45.propertyType && !e56.Z(o88)) return [new e56.V(t45.key, t45.value, '"feature-state" data expressions are not supported with layout properties.')]; if ("filter" === t45.expressionContext) return X2(o88, t45); if ("appearance" === t45.expressionContext) return Y5(o88, t45); if (t45.expressionContext && 0 === t45.expressionContext.indexOf("cluster")) { if (!e56.X(o88, ["zoom", "feature-state"])) return [new e56.V(t45.key, t45.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')]; if ("cluster-initial" === t45.expressionContext && !e56.Y(o88)) return [new e56.V(t45.key, t45.value, "Feature data expressions are not supported with initial expression part of cluster properties.")]; } return []; } function X2(t45, i26) { const o88 = /* @__PURE__ */ new Set(["zoom", "feature-state", "pitch", "distance-from-center"]); if (i26.valueSpec && i26.valueSpec.expression) for (const e57 of i26.valueSpec.expression.parameters) o88.delete(e57); if (0 === o88.size) return []; const s18 = []; return t45 instanceof e56._ && o88.has(t45.name) ? [new e56.V(i26.key, i26.value, `["${t45.name}"] expression is not supported in a filter for a ${i26.object.type} layer with id: ${i26.object.id}`)] : (t45.eachChild(((e57) => { s18.push(...X2(e57, i26)); })), s18); } function Y5(t45, i26) { const o88 = /* @__PURE__ */ new Set(); if (i26.valueSpec && i26.valueSpec.expression) for (const e57 of i26.valueSpec.expression.parameters) o88.add(e57); if (0 === o88.size) return []; const s18 = []; return t45 instanceof e56._ && !o88.has(t45.name) ? [new e56.V(i26.key, i26.value, `["${t45.name}"] is not an allowed parameter`)] : (t45.eachChild(((e57) => { s18.push(...Y5(e57, i26)); })), s18); } function K4(t45) { const i26 = t45.key, o88 = t45.value, s18 = t45.valueSpec, r86 = []; return Array.isArray(s18.values) ? -1 === s18.values.indexOf(e56.J(o88)) && r86.push(new e56.V(i26, o88, `expected one of [${s18.values.join(", ")}], ${JSON.stringify(o88)} found`)) : -1 === Object.keys(s18.values).indexOf(e56.J(o88)) && r86.push(new e56.V(i26, o88, `expected one of [${Object.keys(s18.values).join(", ")}], ${JSON.stringify(o88)} found`)), r86; } function J3(t45) { return e56.a2(e56.S(t45.value)) ? $4(Object.assign({}, t45, { expressionContext: "filter", valueSpec: t45.styleSpec[`filter_${t45.layerType || "fill"}`] })) : Q4(t45); } function Q4(t45) { const i26 = t45.value, o88 = t45.key; if (!Array.isArray(i26)) return [new e56.V(o88, i26, `array expected, ${e56.K(i26)} found`)]; if (i26.length < 1) return [new e56.V(o88, i26, "filter array must have at least 1 element")]; const s18 = t45.styleSpec; let r86 = K4({ key: `${o88}[0]`, value: i26[0], valueSpec: s18.filter_operator }); switch (e56.J(i26[0])) { case "<": case "<=": case ">": case ">=": i26.length >= 2 && "$type" === e56.J(i26[1]) && r86.push(new e56.V(o88, i26, `"$type" cannot be use with operator "${i26[0]}"`)); case "==": case "!=": 3 !== i26.length && r86.push(new e56.V(o88, i26, `filter array for operator "${i26[0]}" must have 3 elements`)); case "in": case "!in": i26.length >= 2 && (e56.a0(i26[1]) || r86.push(new e56.V(`${o88}[1]`, i26[1], `string expected, ${e56.K(i26[1])} found`))); for (let t46 = 2; t46 < i26.length; t46++) "$type" === e56.J(i26[1]) ? r86 = r86.concat(K4({ key: `${o88}[${t46}]`, value: i26[t46], valueSpec: s18.geometry_type })) : e56.a0(i26[t46]) || e56.L(i26[t46]) || e56.$(i26[t46]) || r86.push(new e56.V(`${o88}[${t46}]`, i26[t46], `string, number, or boolean expected, ${e56.K(i26[t46])} found.`)); break; case "any": case "all": case "none": for (let e57 = 1; e57 < i26.length; e57++) r86 = r86.concat(Q4({ key: `${o88}[${e57}]`, value: i26[e57], style: t45.style, styleSpec: t45.styleSpec })); break; case "has": case "!has": 2 !== i26.length ? r86.push(new e56.V(o88, i26, `filter array for "${i26[0]}" operator must have 2 elements`)) : e56.a0(i26[1]) || r86.push(new e56.V(`${o88}[1]`, i26[1], `string expected, ${e56.K(i26[1])} found`)); } return r86; } function ee2(t45, i26) { const o88 = t45.key, s18 = t45.style, r86 = t45.layer, n45 = t45.styleSpec, a46 = t45.value, l21 = t45.objectKey, c28 = n45[`${i26}_${t45.layerType}`]; if (!c28) return []; const h8 = l21.match(/^(.*)-use-theme$/); if (h8 && c28[h8[1]]) return e56.Q(a46) ? [].concat(_e2({ key: t45.key, value: a46, valueSpec: { type: "string", expression: { interpolated: false, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, style: s18, styleSpec: n45, expressionContext: "property", propertyType: i26, propertyKey: l21 })) : _e2({ key: o88, value: a46, valueSpec: { type: "string" }, style: s18, styleSpec: n45 }); const d34 = l21.match(/^(.*)-transition$/); if ("paint" === i26 && d34 && c28[d34[1]] && c28[d34[1]].transition) return _e2({ key: o88, value: a46, valueSpec: n45.transition, style: s18, styleSpec: n45 }); const u12 = t45.valueSpec || c28[l21]; if (!u12) return [new e56.a3(o88, a46, `unknown property "${l21}"`)]; let _4; if (e56.a0(a46) && e56.N(u12) && !u12.tokens && (_4 = /^{([^}]+)}$/.exec(a46))) { const t46 = `\`{ "type": "identity", "property": ${_4 ? JSON.stringify(_4[1]) : '"_"'} }\``; return [new e56.V(o88, a46, `"${l21}" does not support interpolation syntax Use an identity property function instead: ${t46}.`)]; } const p9 = []; if ("symbol" === t45.layerType) "text-field" !== l21 || !s18 || s18.glyphs || s18.imports || p9.push(new e56.V(o88, a46, 'use of "text-field" requires a style "glyphs" property')), "text-font" === l21 && e56.a4(e56.S(a46)) && "identity" === e56.J(a46.type) && p9.push(new e56.V(o88, a46, '"text-font" does not support identity functions')); else if ("model" === t45.layerType && "paint" === i26 && r86 && r86.layout && r86.layout.hasOwnProperty("model-id") && e56.N(u12) && (e56.a5(u12) || e56.O(u12))) { const t46 = e56.W(e56.S(a46), u12), i27 = t46.value.expression || t46.value._styleExpression.expression; i27 && !e56.X(i27, ["measure-light"]) && ("model-emissive-strength" === l21 && e56.Y(i27) && e56.Z(i27) || p9.push(new e56.V(o88, a46, `${l21} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`))); } return p9.concat(_e2({ key: t45.key, value: a46, valueSpec: u12, style: s18, styleSpec: n45, expressionContext: "property", propertyType: i26, propertyKey: l21 })); } function te(e57) { return ee2(e57, "paint"); } function ie2(e57) { return ee2(e57, "layout"); } function oe3(t45) { let i26 = []; const o88 = t45.value, s18 = t45.key, r86 = t45.style, n45 = t45.styleSpec; if (!e56.H(o88)) return [new e56.V(s18, o88, "object expected")]; o88.type || o88.ref || i26.push(new e56.V(s18, o88, 'either "type" or "ref" is required')); let a46 = e56.J(o88.type); const l21 = e56.J(o88.ref); if (o88.id) { const n46 = e56.J(o88.id); for (let a47 = 0; a47 < t45.arrayIndex; a47++) { const t46 = r86.layers[a47]; e56.J(t46.id) === n46 && i26.push(new e56.V(s18, o88.id, `duplicate layer id "${n46}", previously used at line ${t46.id.__line__}`)); } } if ("ref" in o88) { let t46; ["type", "source", "source-layer", "filter", "layout"].forEach(((t47) => { t47 in o88 && i26.push(new e56.V(s18, o88[t47], `"${t47}" is prohibited for ref layers`)); })), r86.layers.forEach(((i27) => { e56.J(i27.id) === l21 && (t46 = i27); })), t46 ? t46.ref ? i26.push(new e56.V(s18, o88.ref, "ref cannot reference another ref layer")) : a46 = e56.J(t46.type) : "string" == typeof l21 && i26.push(new e56.V(s18, o88.ref, `ref layer "${l21}" not found`)); } else if ("background" !== a46 && "sky" !== a46 && "slot" !== a46) if (o88.source) if (e56.a0(o88.source)) { const t46 = r86.sources && r86.sources[o88.source], n46 = t46 && e56.J(t46.type); t46 ? "vector" === n46 && "raster" === a46 ? i26.push(new e56.V(s18, o88.source, `layer "${o88.id}" requires a raster source`)) : "raster" === n46 && "raster" !== a46 ? i26.push(new e56.V(s18, o88.source, `layer "${o88.id}" requires a vector source`)) : "vector" !== n46 || o88["source-layer"] ? "raster-dem" === n46 && "hillshade" !== a46 ? i26.push(new e56.V(s18, o88.source, "raster-dem source can only be used with layer type 'hillshade'.")) : "raster-array" !== n46 || ["raster", "raster-particle"].includes(a46) ? "line" === a46 && o88.paint && (o88.paint["line-gradient"] || o88.paint["line-trim-offset"]) && "geojson" === n46 && !t46.lineMetrics ? i26.push(new e56.V(s18, o88, `layer "${o88.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)) : "raster-particle" === a46 && "raster-array" !== n46 && i26.push(new e56.V(s18, o88.source, `layer "${o88.id}" requires a 'raster-array' source.`)) : i26.push(new e56.V(s18, o88.source, "raster-array source can only be used with layer type 'raster'.")) : i26.push(new e56.V(s18, o88, `layer "${o88.id}" must specify a "source-layer"`)) : i26.push(new e56.V(s18, o88.source, `source "${o88.source}" not found`)); } else i26.push(new e56.V(`${s18}.source`, o88.source, '"source" must be a string')); else i26.push(new e56.V(s18, o88, 'missing required property "source"')); return i26 = i26.concat(pe({ key: s18, value: o88, valueSpec: n45.layer, style: t45.style, styleSpec: t45.styleSpec, objectElementValidators: { "*": () => [], type: () => _e2({ key: `${s18}.type`, value: o88.type, valueSpec: n45.layer.type, style: t45.style, styleSpec: t45.styleSpec, object: o88, objectKey: "type" }), filter: (e57) => J3(Object.assign({ layerType: a46 }, e57)), layout: (e57) => pe({ layer: o88, key: e57.key, value: e57.value, valueSpec: {}, style: e57.style, styleSpec: e57.styleSpec, objectElementValidators: { "*": (e58) => ie2(Object.assign({ layerType: a46 }, e58)) } }), paint: (e57) => pe({ layer: o88, key: e57.key, value: e57.value, valueSpec: {}, style: e57.style, styleSpec: e57.styleSpec, objectElementValidators: { "*": (e58) => te(Object.assign({ layerType: a46, layer: o88 }, e58)) } }), appearances(t46) { const i27 = q2({ key: t46.key, value: t46.value, valueSpec: t46.valueSpec, style: t46.style, styleSpec: t46.styleSpec, arrayElementValidator: (t47) => (function(t48) { const { key: i28, layer: o89, layerType: s20 } = t48, r88 = e56.J(t48.value), n46 = e56.J(r88.name), a47 = e56.J(r88.condition), l22 = pe({ key: i28, value: r88, valueSpec: t48.styleSpec.appearance, style: t48.style, styleSpec: t48.styleSpec, objectElementValidators: { condition: (t49) => (function(t50) { const i29 = []; return i29.push(...$4({ key: t50.key, value: t50.object.condition, valueSpec: e56.a6.appearance.condition, expressionContext: "appearance" })), i29; })(Object.assign({ layer: o89, layerType: s20 }, t49)), properties: (t49) => (function(t50) { const i29 = [], { styleSpec: o90, layer: s21, layerType: r89 } = t50, n47 = o90[`paint_${r89}`], a48 = o90[`layout_${r89}`], l23 = t50.object[t50.objectKey]; for (const o91 in l23) { const c28 = o91 in n47 ? "paint" : o91 in a48 ? "layout" : void 0; if (!c28) { i29.push(new e56.V(t50.key, o91, `unknown property "${o91}" for layer type "${r89}"`)); continue; } const h8 = Object.assign({}, t50, { key: `${t50.key}.${o91}`, object: l23, objectKey: o91, layer: s21, layerType: r89, value: l23[o91], valueSpec: "paint" === c28 ? n47[o91] : a48[o91] }); i29.push(...ee2(h8, c28)); } return i29; })(Object.assign({ layer: o89, layerType: s20 }, t49)) } }); return "hidden" === n46 || a47 || l22.push(new e56.V(t48.key, "name", 'Appearance with name different than "hidden" must have a condition')), l22; })(Object.assign({ layerType: a46, layer: o88 }, t47)) }), s19 = Array.isArray(t46.value) ? t46.value : [], r87 = /* @__PURE__ */ new Set(); return s19.forEach(((s20, n46) => { const a47 = e56.J(s20.name); if (a47) if (r87.has(a47)) { const s21 = e56.J(o88.id); i27.push(new e56.V(t46.key, a47, `Duplicated appearance name "${a47}" for layer "${s21}"`)); } else r87.add(a47); })), i27; } } })), i26; } function se({ key: t45, value: i26 }) { return e56.a0(i26) ? [] : [new e56.V(t45, i26, `string expected, ${e56.K(i26)} found`)]; } const re2 = { promoteId: function t45({ key: i26, value: o88 }) { if (e56.a0(o88)) return se({ key: i26, value: o88 }); if (Array.isArray(o88)) { const t46 = [], s19 = e56.S(o88), r86 = e56.U(s19); return "error" === r86.result && r86.value.forEach(((o89) => { t46.push(new e56.V(`${i26}${o89.key}`, null, `${o89.message}`)); })), e56.X(r86.value.expression, ["zoom", "heatmap-density", "line-progress", "raster-value", "sky-radial-progress", "accumulated", "is-supported-script", "pitch", "distance-from-center", "measure-light", "raster-particle-speed"]) || t46.push(new e56.V(`${i26}`, null, "promoteId expression should be only feature dependent")), t46; } if (!e56.H(o88)) return [new e56.V(i26, o88, `string, expression or object expected, "${e56.K(o88)}" found`)]; const s18 = []; for (const e57 in o88) s18.push(...t45({ key: `${i26}.${e57}`, value: o88[e57] })); return s18; } }; function ne2(t45) { const i26 = t45.value, o88 = t45.key, s18 = t45.styleSpec, r86 = t45.style; if (!e56.H(i26)) return [new e56.V(o88, i26, `object expected, ${e56.K(i26)} found`)]; if (!("type" in i26)) return [new e56.V(o88, i26, '"type" is required')]; const n45 = e56.J(i26.type); let a46 = []; switch (["vector", "raster", "raster-dem", "raster-array"].includes(n45) && ("url" in i26 || "tiles" in i26 || a46.push(new e56.a3(o88, i26, 'Either "url" or "tiles" is required.'))), n45) { case "vector": case "raster": case "raster-dem": case "raster-array": return a46 = a46.concat(pe({ key: o88, value: i26, valueSpec: s18[`source_${n45.replace("-", "_")}`], style: t45.style, styleSpec: s18, objectElementValidators: re2 })), a46; case "geojson": if (a46 = pe({ key: o88, value: i26, valueSpec: s18.source_geojson, style: r86, styleSpec: s18, objectElementValidators: re2 }), "cluster" in i26 && "clusterProperties" in i26) { if (!e56.H(i26.clusterProperties)) return [new e56.V(`${o88}.clusterProperties`, i26, `object expected, ${e56.K(i26)} found`)]; for (const t46 in i26.clusterProperties) { const s19 = i26.clusterProperties[t46]; if (!Array.isArray(s19)) return [new e56.V(`${o88}.clusterProperties.${t46}`, s19, "array expected")]; const [r87, n46] = s19, l21 = "string" == typeof r87 ? [r87, ["accumulated"], ["get", t46]] : r87; a46.push(...$4({ key: `${o88}.${t46}.map`, value: n46, expressionContext: "cluster-map" })), a46.push(...$4({ key: `${o88}.${t46}.reduce`, value: l21, expressionContext: "cluster-reduce" })); } } return a46; case "video": return pe({ key: o88, value: i26, valueSpec: s18.source_video, style: r86, styleSpec: s18 }); case "image": return pe({ key: o88, value: i26, valueSpec: s18.source_image, style: r86, styleSpec: s18 }); case "canvas": return [new e56.V(o88, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")]; default: return K4({ key: `${o88}.type`, value: i26.type, valueSpec: { values: ae2(s18) } }); } } function ae2(e57) { return e57.source.reduce(((t45, i26) => { const o88 = e57[i26]; return "enum" === o88.type.type && (t45 = t45.concat(Object.keys(o88.type.values))), t45; }), []); } function le2(t45) { const i26 = t45.value, o88 = t45.styleSpec, s18 = o88.light, r86 = t45.style; if (void 0 === i26) return []; if (!e56.H(i26)) return [new e56.V("light", i26, `object expected, ${e56.K(i26)} found`)]; let n45 = []; for (const t46 in i26) { const a46 = t46.match(/^(.*)-transition$/), l21 = t46.match(/^(.*)-use-theme$/); n45 = n45.concat(l21 && s18[l21[1]] ? _e2({ key: t46, value: i26[t46], valueSpec: { type: "string" }, style: r86, styleSpec: o88 }) : a46 && s18[a46[1]] && s18[a46[1]].transition ? _e2({ key: t46, value: i26[t46], valueSpec: o88.transition, style: r86, styleSpec: o88 }) : s18[t46] ? _e2({ key: t46, value: i26[t46], valueSpec: s18[t46], style: r86, styleSpec: o88 }) : [new e56.V(t46, i26[t46], `unknown property "${t46}"`)]); } return n45; } function ce2(t45) { const i26 = t45.value; if (!i26) return []; const o88 = t45.key; if (!e56.H(i26)) return [new e56.V(o88, i26, `object expected, ${e56.K(i26)} found`)]; let s18 = []; const r86 = t45.styleSpec, n45 = r86["light-3d"], a46 = t45.style, l21 = t45.style.lights; for (const t46 of ["type", "id"]) if (!(t46 in i26)) return s18 = s18.concat([new e56.V(o88, i26, `missing property "${t46}"`)]), s18; if (!e56.a0(i26.type)) return s18 = s18.concat([new e56.V(`${o88}.type`, i26.type, "string expected")]), s18; if (l21) for (let r87 = 0; r87 < t45.arrayIndex; r87++) { const t46 = e56.J(i26.type), n46 = l21[r87]; e56.J(n46.type) === t46 && s18.push(new e56.V(o88, i26.id, `duplicate light type "${i26.type}", previously defined at line ${n46.id.__line__}`)); } const c28 = `properties_light_${i26.type}`; if (!(c28 in r86)) return s18 = s18.concat([new e56.V(`${o88}.type`, i26, `Invalid light type ${i26.type}`)]), s18; const h8 = r86[c28]; for (const o89 in i26) if ("properties" === o89) { const n46 = i26[o89]; if (!e56.H(n46)) return s18 = s18.concat([new e56.V("properties", n46, `object expected, ${e56.K(n46)} found`)]), s18; for (const l22 in n46) { const c29 = l22.match(/^(.*)-transition$/), d34 = l22.match(/^(.*)-use-theme$/); s18 = s18.concat(d34 && h8[d34[1]] ? _e2({ key: o89, value: n46[l22], valueSpec: { type: "string" }, style: a46, styleSpec: r86 }) : c29 && h8[c29[1]] && h8[c29[1]].transition ? _e2({ key: o89, value: i26[o89], valueSpec: r86.transition, style: a46, styleSpec: r86 }) : h8[l22] ? _e2({ key: l22, value: n46[l22], valueSpec: h8[l22], style: a46, styleSpec: r86 }) : [new e56.a3(t45.key, n46[l22], `unknown property "${l22}"`)]); } } else s18 = s18.concat(n45[o89] ? _e2({ key: o89, value: i26[o89], valueSpec: n45[o89], style: a46, styleSpec: r86 }) : [new e56.a3(o89, i26[o89], `unknown property "${o89}"`)]); return s18; } function he(t45) { const i26 = t45.value, o88 = t45.key, s18 = t45.style, r86 = t45.styleSpec, n45 = r86.terrain; if (null == i26) return []; if (!e56.H(i26)) return [new e56.V("terrain", i26, `object expected, ${e56.K(i26)} found`)]; let a46 = []; for (const t46 in i26) { const o89 = t46.match(/^(.*)-transition$/), l21 = t46.match(/^(.*)-use-theme$/); a46 = a46.concat(l21 && n45[l21[1]] ? _e2({ key: t46, value: i26[t46], valueSpec: { type: "string" }, style: s18, styleSpec: r86 }) : o89 && n45[o89[1]] && n45[o89[1]].transition ? _e2({ key: t46, value: i26[t46], valueSpec: r86.transition, style: s18, styleSpec: r86 }) : n45[t46] ? _e2({ key: t46, value: i26[t46], valueSpec: n45[t46], style: s18, styleSpec: r86 }) : [new e56.a3(t46, i26[t46], `unknown property "${t46}"`)]); } if (i26.source) if (e56.a0(i26.source)) { const t46 = s18.sources && s18.sources[i26.source], r87 = t46 && e56.J(t46.type); t46 ? "raster-dem" !== r87 && a46.push(new e56.V(`${o88}.source`, i26.source, `terrain cannot be used with a source of type ${r87}, it only be used with a "raster-dem" source type`)) : a46.push(new e56.V(`${o88}.source`, i26.source, `source "${i26.source}" not found`)); } else a46.push(new e56.V(`${o88}.source`, i26.source, "source must be a string")); else a46.push(new e56.V(o88, i26, 'terrain is missing required property "source"')); return a46; } function de3(t45) { const i26 = t45.value, o88 = t45.style, s18 = t45.styleSpec, r86 = s18.fog; if (void 0 === i26) return []; if (!e56.H(i26)) return [new e56.V("fog", i26, `object expected, ${e56.K(i26)} found`)]; let n45 = []; for (const t46 in i26) { const a46 = t46.match(/^(.*)-transition$/), l21 = t46.match(/^(.*)-use-theme$/); n45 = n45.concat(l21 && r86[l21[1]] ? _e2({ key: t46, value: i26[t46], valueSpec: { type: "string" }, style: o88, styleSpec: s18 }) : a46 && r86[a46[1]] && r86[a46[1]].transition ? _e2({ key: t46, value: i26[t46], valueSpec: s18.transition, style: o88, styleSpec: s18 }) : r86[t46] ? _e2({ key: t46, value: i26[t46], valueSpec: r86[t46], style: o88, styleSpec: s18 }) : [new e56.a3(t46, i26[t46], `unknown property "${t46}"`)]); } return n45; } const ue3 = { "*": () => [], array: q2, boolean: function(t45) { const i26 = t45.value, o88 = t45.key; return e56.$(i26) ? [] : [new e56.V(o88, i26, `boolean expected, ${e56.K(i26)} found`)]; }, number: Z2, color: function({ key: t45, value: i26 }) { return e56.a0(i26) ? null === e56.a1.parseCSSColor(i26) ? [new e56.V(t45, i26, `color expected, "${i26}" found`)] : [] : [new e56.V(t45, i26, `color expected, ${e56.K(i26)} found`)]; }, enum: K4, filter: J3, function: W3, layer: oe3, object: pe, source: ne2, model: e56.a7, light: le2, "light-3d": ce2, terrain: he, fog: de3, string: se, formatted: function(e57) { return 0 === se(e57).length ? [] : $4(e57); }, resolvedImage: function(e57) { return 0 === se(e57).length ? [] : $4(e57); }, projection: function(t45) { const i26 = t45.value, o88 = t45.styleSpec, s18 = o88.projection, r86 = t45.style; if (e56.H(i26)) { let e57 = []; for (const t46 in i26) e57 = e57.concat(_e2({ key: t46, value: i26[t46], valueSpec: s18[t46], style: r86, styleSpec: o88 })); return e57; } return e56.a0(i26) ? [] : [new e56.V("projection", i26, `object or string expected, ${e56.K(i26)} found`)]; }, import: function(t45) { const i26 = t45.key, { value: o88, styleSpec: s18 } = t45; if (!e56.H(o88)) return [new e56.V(i26, o88, "import must be an object")]; const _a13 = o88, { data: r86 } = _a13, n45 = __objRest(_a13, ["data"]); Object.defineProperty(n45, "__line__", { value: o88.__line__, enumerable: false }); let a46 = pe(Object.assign({}, t45, { value: n45, valueSpec: s18.import })); return "" === e56.J(n45.id) && a46.push(new e56.V(`${t45.key}.id`, n45, "import id can't be an empty string")), r86 && (a46 = a46.concat(me(r86, s18, { key: `${t45.key}.data` }))), a46; }, iconset: function(t45) { const i26 = t45.value, o88 = t45.key, s18 = t45.styleSpec, r86 = t45.style; if (!e56.H(i26)) return [new e56.V(o88, i26, "object expected")]; if (!i26.type) return [new e56.V(o88, i26, '"type" is required')]; const n45 = e56.J(i26.type); let a46 = []; if (a46 = a46.concat(pe({ key: o88, value: i26, valueSpec: s18[`iconset_${n45}`], style: r86, styleSpec: s18 })), (function(e57, t46) { return !("source" !== e57 || !t46.source); })(n45, i26)) { const t46 = r86.sources && r86.sources[i26.source], s19 = t46 && e56.J(t46.type); t46 ? "raster-array" !== s19 && a46.push(new e56.V(o88, i26.source, `iconset cannot be used with a source of type ${String(s19)}, it only be used with a "raster-array" source type`)) : a46.push(new e56.V(o88, i26.source, `source "${i26.source}" not found`)); } return a46; } }; function _e2(t45, i26 = false) { const o88 = t45.value, s18 = t45.valueSpec, r86 = t45.styleSpec; if (s18.expression) { if (e56.a4(e56.J(o88))) return W3(t45); if (e56.Q(e56.S(o88))) return $4(t45); } if (s18.type && ue3[s18.type]) { const e57 = ue3[s18.type](t45); return true === i26 && e57.length > 0 && Array.isArray(t45.value) ? $4(t45) : e57; } return pe(Object.assign({}, t45, { valueSpec: s18.type ? r86[s18.type] : s18 })); } function pe(t45) { const i26 = t45.key, o88 = t45.value, s18 = t45.valueSpec || {}, r86 = t45.objectElementValidators || {}, n45 = t45.style, a46 = t45.styleSpec; if (!e56.H(o88)) return [new e56.V(i26, o88, `object expected, ${e56.K(o88)} found`)]; let l21 = []; for (const t46 in o88) { const c28 = t46.split(".")[0]; let h8; r86[c28] ? h8 = r86[c28] : s18[c28] ? h8 = _e2 : r86["*"] ? h8 = r86["*"] : s18["*"] && (h8 = _e2), h8 ? l21 = l21.concat(h8({ key: (i26 ? `${i26}.` : i26) + t46, value: o88[t46], valueSpec: s18[c28] || s18["*"], style: n45, styleSpec: a46, object: o88, objectKey: t46 }, o88)) : l21.push(new e56.a3(i26, o88[t46], `unknown property "${t46}"`)); } for (const t46 in s18) r86[t46] || s18[t46].required && void 0 === s18[t46].default && void 0 === o88[t46] && l21.push(new e56.V(i26, o88, `missing required property "${t46}"`)); return l21; } function fe2({ key: t45, value: i26 }) { const o88 = se({ key: t45, value: i26 }); if (o88.length) return o88; const s18 = i26; return -1 === s18.indexOf("{fontstack}") && o88.push(new e56.V(t45, i26, '"glyphs" url must include a "{fontstack}" token')), -1 === s18.indexOf("{range}") && o88.push(new e56.V(t45, i26, '"glyphs" url must include a "{range}" token')), o88; } function me(t45, i26 = e56.a6, o88 = {}) { return pe({ key: o88.key || "", value: t45, valueSpec: Object.assign(i26.$root, { "*": { type: "*" } }), styleSpec: i26, style: t45, objectElementValidators: { glyphs: fe2 } }); } function ge(t45, i26 = e56.a6) { return De(me(t45, i26)); } const ve2 = (e57) => De(ne2(e57)), ye = (e57) => De(le2(e57)), xe2 = (e57) => De(ce2(e57)), be2 = (e57) => De(he(e57)), we = (e57) => De(de3(e57)), Te = (t45) => De((function(t46) { const i26 = t46.value, o88 = t46.style, s18 = t46.styleSpec, r86 = s18.snow; if (void 0 === i26) return []; if (!e56.H(i26)) return [new e56.V("snow", i26, `object expected, ${e56.K(i26)} found`)]; let n45 = []; for (const t47 in i26) { const a46 = t47.match(/^(.*)-transition$/); n45 = n45.concat(a46 && r86[a46[1]] && r86[a46[1]].transition ? _e2({ key: t47, value: i26[t47], valueSpec: s18.transition, style: o88, styleSpec: s18 }) : r86[t47] ? _e2({ key: t47, value: i26[t47], valueSpec: r86[t47], style: o88, styleSpec: s18 }) : [new e56.a3(t47, i26[t47], `unknown property "${t47}"`)]); } return n45; })(t45)), Ee = (t45) => De((function(t46) { const i26 = t46.value, o88 = t46.style, s18 = t46.styleSpec, r86 = s18.rain; if (void 0 === i26) return []; if (!e56.H(i26)) return [new e56.V("rain", i26, `object expected, ${e56.K(i26)} found`)]; let n45 = []; for (const t47 in i26) { const a46 = t47.match(/^(.*)-transition$/); n45 = n45.concat(a46 && r86[a46[1]] && r86[a46[1]].transition ? _e2({ key: t47, value: i26[t47], valueSpec: s18.transition, style: o88, styleSpec: s18 }) : r86[t47] ? _e2({ key: t47, value: i26[t47], valueSpec: r86[t47], style: o88, styleSpec: s18 }) : [new e56.a3(t47, i26[t47], `unknown property "${t47}"`)]); } return n45; })(t45)), Se = (e57) => De(oe3(e57)), Ie = (e57) => De(J3(e57)), Ce = (e57) => De(te(e57)), Re2 = (e57) => De(ie2(e57)), Ae = (t45) => De(e56.a7(t45)); function De(e57) { return e57.slice().sort(((e58, t45) => e58.line && t45.line ? e58.line - t45.line : 0)); } function Le(t45, i26) { let o88 = false; if (i26 && i26.length) for (const s18 of i26) s18 instanceof e56.a3 ? e56.w(s18.message) : (t45.fire(new e56.y(new Error(s18.message))), o88 = true); return o88; } let Pe; class ze extends e56.E { constructor(t45, i26 = "flat") { super(), this._transitionable = new e56.a8(Pe || (Pe = new e56.a9({ anchor: new e56.aa(e56.a6.light.anchor), position: new e56.ab(e56.a6.light.position), color: new e56.aa(e56.a6.light.color), intensity: new e56.aa(e56.a6.light.intensity) }))), this.setLight(t45, i26), this._transitioning = this._transitionable.untransitioned(); } getLight() { return this._transitionable.serialize(); } setLight(e57, t45, i26 = {}) { this._validate(ye, e57, i26) || (this._transitionable.setTransitionOrValue(e57), this.id = t45); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } _validate(t45, i26, o88) { return (!o88 || false !== o88.validate) && Le(this, t45.call(ge, Object.assign({ value: i26, style: { glyphs: true, sprite: true }, styleSpec: e56.a6 }))); } } let Oe = class extends e56.E { constructor(t45, i26, o88, s18, r86) { super(), this.scope = o88, this._transitionable = new e56.a8(new e56.a9({ source: new e56.aa(e56.a6.terrain.source), exaggeration: new e56.aa(e56.a6.terrain.exaggeration) }), o88, s18), this._transitionable.setTransitionOrValue(t45, s18), this._transitioning = this._transitionable.untransitioned(), this.drapeRenderMode = i26, this.worldview = r86; } get() { return this._transitionable.serialize(); } set(e57, t45) { this._transitionable.setTransitionOrValue(e57, t45); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } getExaggeration(t45) { return this._transitioning.possiblyEvaluate(new e56.ac(t45, { worldview: this.worldview })).get("exaggeration"); } getAttenuationRange() { if (!this.isZoomDependent()) return null; const t45 = this._transitionable._values.exaggeration; if (!t45) return null; const i26 = t45.value.expression; if (!i26) return null; let o88 = -1, s18 = -1, r86 = 1; for (const t46 of i26.zoomStops) r86 = i26.evaluate(new e56.ac(t46, { worldview: this.worldview })), r86 > 0.01 ? (o88 = t46, s18 = -1) : s18 = t46; return r86 < 0.01 && o88 > 0 && s18 > o88 ? [o88, s18] : null; } isZoomDependent() { const t45 = this._transitionable._values.exaggeration; return null != t45 && null != t45.value && null != t45.value.expression && t45.value.expression instanceof e56.ad; } }; const Me = 45, Fe = 65, Be = 0.05; function ke2(t45, i26, o88, s18) { const r86 = e56.ah(Me, Fe, o88), [n45, a46] = Ne(t45, s18); let l21 = 1 - Math.min(1, Math.exp((i26 - n45) / (a46 - n45) * -6)); return l21 *= l21 * l21, l21 = Math.min(1, 1.00747 * l21), l21 * r86 * t45.alpha; } function Ne(e57, t45) { const i26 = 0.5 / Math.tan(0.5 * t45); return [e57.range[0] + i26, e57.range[1] + i26]; } function Ue(t45, i26, o88, s18, r86) { const n45 = e56.af([], [i26, o88, s18], r86.mercatorFogMatrix); return ke2(t45, e56.ag(n45), r86.pitch, r86._fov); } function je(t45, i26, o88, s18, r86, n45, a46) { const l21 = [[o88, s18, 0], [r86, s18, 0], [r86, n45, 0], [o88, n45, 0]]; let c28 = Number.MAX_VALUE, h8 = -Number.MAX_VALUE; for (const t46 of l21) { const o89 = e56.af([], t46, i26), s19 = e56.ag(o89); c28 = Math.min(c28, s19), h8 = Math.max(h8, s19); } return [ke2(t45, c28, a46.pitch, a46._fov), ke2(t45, h8, a46.pitch, a46._fov)]; } class Ve extends e56.E { constructor(t45, i26, o88, s18) { super(); const r86 = new e56.a9({ range: new e56.aa(e56.a6.fog.range), color: new e56.aa(e56.a6.fog.color), "color-use-theme": new e56.aa({ type: "string", "property-type": "data-constant", default: "default" }), "high-color": new e56.aa(e56.a6.fog["high-color"]), "high-color-use-theme": new e56.aa({ type: "string", "property-type": "data-constant", default: "default" }), "space-color": new e56.aa(e56.a6.fog["space-color"]), "space-color-use-theme": new e56.aa({ type: "string", "property-type": "data-constant", default: "default" }), "horizon-blend": new e56.aa(e56.a6.fog["horizon-blend"]), "star-intensity": new e56.aa(e56.a6.fog["star-intensity"]), "vertical-range": new e56.aa(e56.a6.fog["vertical-range"]) }); this._transitionable = new e56.a8(r86, o88, new Map(s18)), this.set(t45, s18), this._transitioning = this._transitionable.untransitioned(), this._transform = i26, this.properties = new e56.ai(r86), this.scope = o88; } get state() { const t45 = this._transform, i26 = "globe" === t45.projection.name, o88 = e56.aj(t45.zoom), s18 = this.properties.get("range"), r86 = [0.5, 3]; return { range: i26 ? [e56.ak(r86[0], s18[0], o88), e56.ak(r86[1], s18[1], o88)] : s18, horizonBlend: this.properties.get("horizon-blend"), alpha: this.properties.get("color").a }; } get() { return this._transitionable.serialize(); } set(t45, i26, o88 = {}) { if (this._validate(we, t45, o88)) return; const s18 = Object.assign({}, t45); for (const t46 of Object.keys(e56.a6.fog)) void 0 === s18[t46] && (s18[t46] = e56.a6.fog[t46].default); this._options = s18, this._transitionable.setTransitionOrValue(this._options, i26); } getOpacity(t45) { if (!this._transform.projection.supportsFog) return 0; const i26 = this.properties && this.properties.get("color") || 1; return ("globe" === this._transform.projection.name ? 1 : e56.ah(Me, Fe, t45)) * i26.a; } getOpacityAtLatLng(t45, i26) { return this._transform.projection.supportsFog ? (function(t46, i27, o88) { const s18 = e56.ae.fromLngLat(i27), r86 = o88.elevation ? o88.elevation.getAtPointOrZero(s18) : 0; return Ue(t46, s18.x, s18.y, r86, o88); })(this.state, t45, i26) : 0; } getOpacityForTile(t45) { if (!this._transform.projection.supportsFog) return [1, 1]; const i26 = this._transform.calculateFogTileMatrix(t45.toUnwrapped()); return je(this.state, i26, 0, 0, e56.al, e56.al, this._transform); } getOpacityForBounds(e57, t45, i26, o88, s18) { return this._transform.projection.supportsFog ? je(this.state, e57, t45, i26, o88, s18, this._transform) : [1, 1]; } getFovAdjustedRange(e57) { return this._transform.projection.supportsFog ? Ne(this.state, e57) : [0, 1]; } isVisibleOnFrustum(t45) { if (!this._transform.projection.supportsFog) return false; const i26 = [4, 5, 6, 7]; for (const o88 of i26) { const i27 = t45.points[o88]; let s18; if (i27[2] >= 0) s18 = i27; else { const r86 = t45.points[o88 - 4]; s18 = e56.am(r86, i27, r86[2] / (r86[2] - i27[2])); } if (Ue(this.state, s18[0], s18[1], 0, this._transform) >= Be) return true; } return false; } updateConfig(e57) { this._transitionable.setTransitionOrValue(this._options, new Map(e57)); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } _validate(t45, i26, o88) { return (!o88 || false !== o88.validate) && Le(this, t45.call(ge, Object.assign({ value: i26, style: { glyphs: true, sprite: true }, styleSpec: e56.a6 }))); } } let Ge, He, qe, Ze, We = class extends e56.E { constructor(t45, i26, o88, s18) { super(); const r86 = Ge || (Ge = new e56.a9({ density: new e56.aa(e56.a6.snow.density), intensity: new e56.aa(e56.a6.snow.intensity), color: new e56.aa(e56.a6.snow.color), opacity: new e56.aa(e56.a6.snow.opacity), vignette: new e56.aa(e56.a6.snow.vignette), "vignette-color": new e56.aa(e56.a6.snow["vignette-color"]), "center-thinning": new e56.aa(e56.a6.snow["center-thinning"]), direction: new e56.aa(e56.a6.snow.direction), "flake-size": new e56.aa(e56.a6.snow["flake-size"]) })); this._transitionable = new e56.a8(r86, o88, new Map(s18)), this.set(t45, s18), this._transitioning = this._transitionable.untransitioned(), this.properties = new e56.ai(r86), this.scope = o88; } get state() { const t45 = this.properties.get("opacity"), i26 = this.properties.get("color"), o88 = this.properties.get("direction"), s18 = e56.an(o88[0]), r86 = -Math.max(e56.an(o88[1]), 0.01), n45 = [Math.cos(s18) * Math.cos(r86), Math.sin(s18) * Math.cos(r86), Math.sin(r86)], a46 = this.properties.get("vignette"), l21 = this.properties.get("vignette-color"); return l21.a = a46, { density: this.properties.get("density"), intensity: this.properties.get("intensity"), color: new e56.ao(i26.r, i26.g, i26.b, i26.a * t45), direction: n45, centerThinning: this.properties.get("center-thinning"), flakeSize: this.properties.get("flake-size"), vignetteColor: l21 }; } get() { return this._transitionable.serialize(); } set(t45, i26, o88 = {}) { if (this._validate(Te, t45, o88)) return; const s18 = Object.assign({}, t45); for (const t46 of Object.keys(e56.a6.snow)) void 0 === s18[t46] && (s18[t46] = e56.a6.snow[t46].default); this._options = s18, this._transitionable.setTransitionOrValue(this._options, i26); } updateConfig(e57) { this._transitionable.setTransitionOrValue(this._options, new Map(e57)); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } _validate(t45, i26, o88) { return (!o88 || false !== o88.validate) && Le(this, t45.call(ge, Object.assign({ value: i26, style: { glyphs: true, sprite: true }, styleSpec: e56.a6 }))); } }, $e = class extends e56.E { constructor(t45, i26, o88, s18) { super(); const r86 = He || (He = new e56.a9({ density: new e56.aa(e56.a6.rain.density), intensity: new e56.aa(e56.a6.rain.intensity), color: new e56.aa(e56.a6.rain.color), opacity: new e56.aa(e56.a6.rain.opacity), vignette: new e56.aa(e56.a6.rain.vignette), "vignette-color": new e56.aa(e56.a6.rain["vignette-color"]), "center-thinning": new e56.aa(e56.a6.rain["center-thinning"]), direction: new e56.aa(e56.a6.rain.direction), "droplet-size": new e56.aa(e56.a6.rain["droplet-size"]), "distortion-strength": new e56.aa(e56.a6.rain["distortion-strength"]) })); this._transitionable = new e56.a8(r86, o88, new Map(s18)), this.set(t45, s18), this._transitioning = this._transitionable.untransitioned(), this.properties = new e56.ai(r86), this.scope = o88; } get state() { const t45 = this.properties.get("opacity"), i26 = this.properties.get("color"), o88 = this.properties.get("direction"), s18 = e56.an(o88[0]), r86 = -Math.max(e56.an(o88[1]), 0.01), n45 = [Math.cos(s18) * Math.cos(r86), Math.sin(s18) * Math.cos(r86), Math.sin(r86)], a46 = this.properties.get("vignette-color"); return a46.a = this.properties.get("vignette"), { density: this.properties.get("density"), intensity: this.properties.get("intensity"), color: new e56.ao(i26.r, i26.g, i26.b, i26.a * t45), direction: n45, centerThinning: this.properties.get("center-thinning"), dropletSize: this.properties.get("droplet-size"), distortionStrength: this.properties.get("distortion-strength"), vignetteColor: a46 }; } get() { return this._transitionable.serialize(); } set(t45, i26, o88 = {}) { if (this._validate(Ee, t45, o88)) return; const s18 = Object.assign({}, t45); for (const t46 of Object.keys(e56.a6.rain)) void 0 === s18[t46] && (s18[t46] = e56.a6.rain[t46].default); this._options = s18, this._transitionable.setTransitionOrValue(this._options, i26); } updateConfig(e57) { this._transitionable.setTransitionOrValue(this._options, new Map(e57)); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } _validate(t45, i26, o88) { return (!o88 || false !== o88.validate) && Le(this, t45.call(ge, Object.assign({ value: i26, style: { glyphs: true, sprite: true }, styleSpec: e56.a6 }))); } }; class Xe extends e56.E { constructor(t45, i26, o88, s18) { super(), this.scope = o88, this._options = t45, this.properties = new e56.ai(i26), this._transitionable = new e56.a8(i26, o88, new Map(s18)), this._transitionable.setTransitionOrValue(t45.properties), this._transitioning = this._transitionable.untransitioned(); } updateConfig(e57) { this._transitionable.setTransitionOrValue(this._options.properties, new Map(e57)); } updateTransitions(e57) { this._transitioning = this._transitionable.transitioned(e57, this._transitioning); } hasTransition() { return this._transitioning.hasTransition(); } recalculate(e57) { this.properties = this._transitioning.possiblyEvaluate(e57); } get() { return this._options.properties = this._transitionable.serialize(), this._options; } set(e57, t45) { this._options = e57, this._transitionable.setTransitionOrValue(e57.properties, t45); } shadowsEnabled() { return !!this.properties && true === this.properties.get("cast-shadows"); } } class Ye { constructor(e57, t45, i26) { this.screenBounds = e57, this.cameraPoint = i26.getCameraPoint(), this._screenRaycastCache = {}, this._cameraRaycastCache = {}, this.isAboveHorizon = t45, this.screenGeometry = this.bufferedScreenGeometry(0), this.screenGeometryMercator = this._bufferedScreenMercator(0, i26); } static createFromScreenPoints(t45, i26) { let o88, s18; if (t45 instanceof e56.P || "number" == typeof t45[0]) { const r86 = e56.P.convert(t45); o88 = [r86], s18 = i26.isPointAboveHorizon(r86); } else { const r86 = e56.P.convert(t45[0]), n45 = e56.P.convert(t45[1]), a46 = r86.add(n45)._div(2); o88 = [r86, n45], s18 = e56.aq(r86, n45).every(((e57) => i26.isPointAboveHorizon(e57))) && i26.isPointAboveHorizon(a46); } return new Ye(o88, s18, i26); } isPointQuery() { return 1 === this.screenBounds.length; } bufferedScreenGeometry(t45) { return e56.aq(this.screenBounds[0], 1 === this.screenBounds.length ? this.screenBounds[0] : this.screenBounds[1], t45); } bufferedCameraGeometry(t45) { const i26 = this.screenBounds[0], o88 = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e56.P(1, 1)) : this.screenBounds[1], s18 = e56.aq(i26, o88, 0, false); return this.cameraPoint.y > o88.y && (this.cameraPoint.x > i26.x && this.cameraPoint.x < o88.x ? s18.splice(3, 0, this.cameraPoint) : this.cameraPoint.x >= o88.x ? s18[2] = this.cameraPoint : this.cameraPoint.x <= i26.x && (s18[3] = this.cameraPoint)), e56.ar(s18, t45); } bufferedCameraGeometryGlobe(t45) { const i26 = this.screenBounds[0], o88 = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e56.P(1, 1)) : this.screenBounds[1], s18 = e56.aq(i26, o88, t45), r86 = this.cameraPoint.clone(); switch (3 * ((r86.y > i26.y) + (r86.y > o88.y)) + ((r86.x > i26.x) + (r86.x > o88.x))) { case 0: s18[0] = r86, s18[4] = r86.clone(); break; case 1: s18.splice(1, 0, r86); break; case 2: s18[1] = r86; break; case 3: s18.splice(4, 0, r86); break; case 5: s18.splice(2, 0, r86); break; case 6: s18[3] = r86; break; case 7: s18.splice(3, 0, r86); break; case 8: s18[2] = r86; } return s18; } containsTile(t45, i26, o88, s18 = 0) { const r86 = t45.queryPadding / i26._pixelsPerMercatorPixel + 1, n45 = o88 ? this._bufferedCameraMercator(r86, i26) : this._bufferedScreenMercator(r86, i26); let a46 = t45.tileID.wrap + (n45.unwrapped ? s18 : 0); const l21 = n45.polygon.map(((i27) => e56.as(t45.tileTransform, i27, a46))); if (!e56.at(l21, 0, 0, e56.al, e56.al)) return; a46 = t45.tileID.wrap + (this.screenGeometryMercator.unwrapped ? s18 : 0); const c28 = this.screenGeometryMercator.polygon.map(((i27) => e56.au(t45.tileTransform, i27, a46))), h8 = c28.map(((t46) => new e56.P(t46[0], t46[1]))), d34 = i26.getFreeCameraOptions().position || new e56.ae(0, 0, 0), u12 = e56.au(t45.tileTransform, d34, a46), _4 = c28.map(((t46) => { const i27 = e56.av(t46, t46, u12); return e56.aw(i27, i27), new e56.ax(u12, i27); })), p9 = e56.ay(t45, 1, i26.zoom) * i26._pixelsPerMercatorPixel; return { queryGeometry: this, tilespaceGeometry: h8, tilespaceRays: _4, bufferedTilespaceGeometry: l21, bufferedTilespaceBounds: (f8 = e56.az(l21), f8.min.x = e56.aA(f8.min.x, 0, e56.al), f8.min.y = e56.aA(f8.min.y, 0, e56.al), f8.max.x = e56.aA(f8.max.x, 0, e56.al), f8.max.y = e56.aA(f8.max.y, 0, e56.al), f8), tile: t45, tileID: t45.tileID, pixelToTileUnitsFactor: p9 }; var f8; } _bufferedScreenMercator(e57, t45) { const i26 = Qe(e57); if (this._screenRaycastCache[i26]) return this._screenRaycastCache[i26]; { let o88; return o88 = "globe" === t45.projection.name ? this._projectAndResample(this.bufferedScreenGeometry(e57), t45) : { polygon: this.bufferedScreenGeometry(e57).map(((e58) => t45.pointCoordinate3D(e58))), unwrapped: true }, this._screenRaycastCache[i26] = o88, o88; } } _bufferedCameraMercator(e57, t45) { const i26 = Qe(e57); if (this._cameraRaycastCache[i26]) return this._cameraRaycastCache[i26]; { let o88; return o88 = "globe" === t45.projection.name ? this._projectAndResample(this.bufferedCameraGeometryGlobe(e57), t45) : { polygon: this.bufferedCameraGeometry(e57).map(((e58) => t45.pointCoordinate3D(e58))), unwrapped: true }, this._cameraRaycastCache[i26] = o88, o88; } } _projectAndResample(t45, i26) { const o88 = (function(t46, i27) { const o89 = e56.aB([], i27.pixelMatrix, i27.globeMatrix), s19 = [0, -e56.aD, 0, 1], r86 = [0, e56.aD, 0, 1], n45 = [0, 0, 0, 1]; e56.aC(s19, s19, o89), e56.aC(r86, r86, o89), e56.aC(n45, n45, o89); const a46 = new e56.P(s19[0] / s19[3], s19[1] / s19[3]), l21 = new e56.P(r86[0] / r86[3], r86[1] / r86[3]), c28 = e56.aE(t46, a46) && s19[3] < n45[3], h8 = e56.aE(t46, l21) && r86[3] < n45[3]; if (!c28 && !h8) return null; const d34 = (function(e57, t47, i28) { for (let o90 = 1; o90 < e57.length; o90++) { const s20 = Je(t47.pointCoordinate3D(e57[o90 - 1]).x), r87 = Je(t47.pointCoordinate3D(e57[o90]).x); if (i28 < 0) { if (s20 < r87) return { idx: o90, t: -s20 / (r87 - 1 - s20) }; } else if (r87 < s20) return { idx: o90, t: (1 - s20) / (r87 + 1 - s20) }; } return null; })(t46, i27, c28 ? -1 : 1); if (!d34) return null; const { idx: u12, t: _4 } = d34; let p9 = u12 > 1 ? Ke(t46.slice(0, u12), i27) : [], f8 = u12 < t46.length ? Ke(t46.slice(u12), i27) : []; p9 = p9.map(((t47) => new e56.P(Je(t47.x), t47.y))), f8 = f8.map(((t47) => new e56.P(Je(t47.x), t47.y))); const m6 = [...p9]; 0 === m6.length && m6.push(f8[f8.length - 1]); const g9 = e56.ak(m6[m6.length - 1].y, (0 === f8.length ? p9[0] : f8[0]).y, _4); let v8; return v8 = c28 ? [new e56.P(0, g9), new e56.P(0, 0), new e56.P(1, 0), new e56.P(1, g9)] : [new e56.P(1, g9), new e56.P(1, 1), new e56.P(0, 1), new e56.P(0, g9)], m6.push(...v8), 0 === f8.length ? m6.push(p9[0]) : m6.push(...f8), { polygon: m6.map(((t47) => new e56.ae(t47.x, t47.y))), unwrapped: false }; })(t45, i26); if (o88) return o88; const s18 = (function(t46, i27) { let o89 = false, s19 = -1 / 0, r86 = 0; for (let e57 = 0; e57 < t46.length - 1; e57++) t46[e57].x > s19 && (s19 = t46[e57].x, r86 = e57); for (let e57 = 0; e57 < t46.length - 1; e57++) { const i28 = (r86 + e57) % (t46.length - 1), s20 = t46[i28], n46 = t46[i28 + 1]; Math.abs(s20.x - n46.x) > 0.5 && (s20.x < n46.x ? (s20.x += 1, 0 === i28 && (t46[t46.length - 1].x += 1)) : (n46.x += 1, i28 + 1 === t46.length - 1 && (t46[0].x += 1)), o89 = true); } const n45 = e56.aF(i27.center.lng); return o89 && n45 < Math.abs(n45 - 1) && t46.forEach(((e57) => { e57.x -= 1; })), { polygon: t46, unwrapped: o89 }; })(Ke(t45, i26).map(((t46) => new e56.P(Je(t46.x), t46.y))), i26); return { polygon: s18.polygon.map(((t46) => new e56.ae(t46.x, t46.y))), unwrapped: s18.unwrapped }; } } function Ke(t45, i26) { return e56.aG(t45, ((e57) => { const t46 = i26.pointCoordinate3D(e57); e57.x = t46.x, e57.y = t46.y; }), 1 / 256); } function Je(e57) { return e57 < 0 ? 1 + e57 % 1 : e57 % 1; } function Qe(e57) { return 100 * e57 | 0; } function et2(t45, i26, o88, s18, r86) { const n45 = function(o89, s19) { if (o89) return r86(o89); if (s19) { if (t45.url && s19.tiles && t45.tiles && delete t45.tiles, s19.variants) { if (!Array.isArray(s19.variants)) return r86(new Error("variants must be an array")); for (const e57 of s19.variants) { if (null == e57 || "object" != typeof e57 || e57.constructor !== Object) return r86(new Error("variant must be an object")); if (!Array.isArray(e57.capabilities)) return r86(new Error("capabilities must be an array")); if (1 === e57.capabilities.length && "meshopt" === e57.capabilities[0]) { s19 = Object.assign(s19, e57); break; } } } const o90 = e56.aH(Object.assign({}, s19, t45), ["tilejson", "tiles", "minzoom", "maxzoom", "attribution", "mapbox_logo", "bounds", "extra_bounds", "scheme", "tileSize", "encoding", "vector_layers", "raster_layers", "worldview_options", "worldview_default", "worldview"]); o90.tiles = i26.canonicalizeTileset(o90, t45.url), r86(null, o90); } }, a46 = (function(e57, t46, i27) { if (!e57) return null; if (!t46 && !i27) return e57; i27 = i27 || e57.worldview_default; const o89 = Object.values(e57.language || {}); if (0 === o89.length) return null; const s19 = Object.values(e57.worldview || {}); if (0 === s19.length) return null; const r87 = o89.every(((e58) => e58 === t46)), n46 = s19.every(((e58) => e58 === i27)); return r87 && n46 ? e57 : t46 in (e57.language_options || {}) || i27 in (e57.worldview_options || {}) ? null : e57.language_options && e57.worldview_options ? e57 : null; })(t45.data, o88, s18); return a46 ? e56.o.frame((() => n45(null, a46))) : t45.url ? e56.m(i26.transformRequest(i26.normalizeSourceURL(t45.url, null, o88, s18), e56.R.Source), n45) : e56.o.frame((() => { const _a13 = t45, { data: e57 } = _a13, i27 = __objRest(_a13, ["data"]); n45(null, i27); })); } function tt(t45, i26) { const o88 = Math.pow(2, i26.z), s18 = Math.floor(e56.aF(t45.getWest()) * o88), r86 = Math.floor(e56.aJ(t45.getNorth()) * o88), n45 = Math.ceil(e56.aF(t45.getEast()) * o88), a46 = Math.ceil(e56.aJ(t45.getSouth()) * o88); return i26.x >= s18 && i26.x < n45 && i26.y >= r86 && i26.y < a46; } class it { constructor(t45, i26, o88) { this.bounds = t45 ? e56.aI.convert(this.validateBounds(t45)) : null, this.minzoom = i26 || 0, this.maxzoom = o88 || 24; } validateBounds(e57) { return Array.isArray(e57) && 4 === e57.length ? [Math.max(-180, e57[0]), Math.max(-90, e57[1]), Math.min(180, e57[2]), Math.min(90, e57[3])] : [-180, -90, 180, 90]; } addExtraBounds(t45) { if (t45) { this.extraBounds || (this.extraBounds = []); for (const i26 of t45) this.extraBounds.push(e56.aI.convert(this.validateBounds(i26))); } } contains(e57) { if (e57.z > this.maxzoom || e57.z < this.minzoom) return false; if (this.bounds && !tt(this.bounds, e57)) return false; if (!this.extraBounds) return true; for (const t45 of this.extraBounds) if (tt(t45, e57)) return true; return false; } static fromTileJSON(e57) { if (!e57.bounds && !e57.extra_bounds) return null; const t45 = new it(e57.bounds, e57.minzoom, e57.maxzoom); return t45.addExtraBounds(e57.extra_bounds), t45; } } class ot extends e56.E { constructor(t45, i26, o88, s18) { if (super(), this.id = t45, this.dispatcher = o88, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = true, this.isTileClipped = true, this._loaded = false, Object.assign(this, e56.aH(i26, ["url", "scheme", "tileSize", "promoteId"])), this._options = Object.assign({ type: "vector" }, i26), this._collectResourceTiming = !!i26.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512"); this.setEventedParent(s18), this._tileWorkers = {}, this._deduped = new e56.aK(); } load(t45) { this._loaded = false, this.fire(new e56.z("dataloading", { dataType: "source" })); const i26 = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, o88 = this.map.getWorldview(); this._tileJSONRequest = et2(this._options, this.map._requestManager, i26, o88, ((s18, r86) => { if (this._tileJSONRequest = null, this._loaded = true, s18) i26 && console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i26}`), o88 && console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o88}`), this.fire(new e56.y(s18)); else if (r86) { if (Object.assign(this, r86), this.hasWorldviews = !!r86.worldview_options, r86.worldview_default && (this.worldviewDefault = r86.worldview_default), r86.vector_layers) { this.vectorLayers = r86.vector_layers, this.vectorLayerIds = [], this.localizableLayerIds = /* @__PURE__ */ new Set(); for (const e57 of r86.vector_layers) this.vectorLayerIds.push(e57.id), r86.worldview && r86.worldview[e57.source] && this.localizableLayerIds.add(e57.id); } this.tileBounds = it.fromTileJSON(r86), L2(r86.tiles, this.map._requestManager._customAccessToken), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "content" })); } t45 && t45(s18); })); } loaded() { return this._loaded; } hasTile(e57) { return !this.tileBounds || this.tileBounds.contains(e57.canonical); } onAdd(e57) { this.map = e57, this.load(); } reload() { this.cancelTileJSONRequest(); const t45 = e56.B(this.id, this.scope); this.load((() => this.map.style.clearSource(t45))); } setTiles(e57) { return this._options.tiles = e57, this.reload(), this; } setUrl(e57) { return this.url = e57, this._options.url = e57, this.reload(), this; } onRemove(e57) { this.cancelTileJSONRequest(); } serialize() { return Object.assign({}, this._options); } loadTile(t45, i26) { const o88 = t45.tileID.canonical.url(this.tiles, this.scheme), s18 = this.map._requestManager.normalizeTileURL(o88), r86 = this.map._requestManager.transformRequest(s18, e56.R.Tile), n45 = this.map.style ? this.map.style.getLut(this.scope) : null, a46 = n45 ? { image: n45.image.clone() } : null, l21 = { request: r86, data: void 0, uid: t45.uid, tileID: t45.tileID, tileZoom: t45.tileZoom, zoom: t45.tileID.overscaledZ, maxZoom: this.maxzoom, lut: a46, tileSize: this.tileSize * t45.tileID.overscaleFactor(), type: this.type, source: this.id, scope: this.scope, pixelRatio: e56.o.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId, isSymbolTile: t45.isSymbolTile, brightness: this.map.style && this.map.style.getBrightness() || 0, extraShadowCaster: t45.isExtraShadowCaster, tessellationStep: this.map._tessellationStep, scaleFactor: this.map.getScaleFactor(), worldview: this.map.getWorldview() || this.worldviewDefault }; if (this.hasWorldviews && e56.h(o88) && (l21.localizableLayerIds = this.localizableLayerIds), l21.request.collectResourceTiming = this._collectResourceTiming, t45.actor && "expired" !== t45.state) "loading" === t45.state ? t45.reloadCallback = i26 : t45.request = t45.actor.send("reloadTile", l21, c28.bind(this)); else if (t45.actor = this._tileWorkers[s18] = this._tileWorkers[s18] || this.dispatcher.getActor(), this.dispatcher.ready) t45.request = t45.actor.send("loadTile", l21, c28.bind(this), void 0, true); else { const i27 = e56.aL.call({ deduped: this._deduped }, l21, ((e57, i28) => { e57 || !i28 ? c28.call(this, e57) : (l21.data = { cacheControl: i28.cacheControl, expires: i28.expires, rawData: i28.rawData.slice(0) }, t45.actor && t45.actor.send("loadTile", l21, c28.bind(this), void 0, true)); }), true); t45.request = { cancel: i27 }; } function c28(o89, s19) { return delete t45.request, t45.aborted ? i26(null) : o89 && 404 !== o89.status ? i26(o89) : (s19 && s19.resourceTiming && (t45.resourceTiming = s19.resourceTiming), this.map._refreshExpiredTiles && s19 && t45.setExpiryData(s19), t45.loadVectorData(s19, this.map.painter), e56.aM(this.dispatcher), i26(null), void (t45.reloadCallback && (this.loadTile(t45, t45.reloadCallback), t45.reloadCallback = null))); } } abortTile(e57) { e57.request && (e57.request.cancel(), delete e57.request), e57.actor && e57.actor.send("abortTile", { uid: e57.uid, type: this.type, source: this.id, scope: this.scope }); } unloadTile(e57, t45) { e57.actor && e57.actor.send("removeTile", { uid: e57.uid, type: this.type, source: this.id, scope: this.scope }), e57.destroy(); } hasTransition() { return false; } afterUpdate() { this._tileWorkers = {}; } cancelTileJSONRequest() { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); } } class st3 extends e56.E { constructor(t45, i26, o88, s18) { super(), this.id = t45, this.dispatcher = o88, this.setEventedParent(s18), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = true, this.scheme = "xyz", this.tileSize = 512, this._loaded = false, this._options = Object.assign({ type: "raster" }, i26), Object.assign(this, e56.aH(i26, ["url", "scheme", "tileSize"])); } load(t45) { this._loaded = false, this.fire(new e56.z("dataloading", { dataType: "source" })); const i26 = this.map.getWorldview(); this._tileJSONRequest = et2(this._options, this.map._requestManager, null, i26, ((i27, o88) => { this._tileJSONRequest = null, this._loaded = true, i27 ? this.fire(new e56.y(i27)) : o88 && (Object.assign(this, o88), o88.raster_layers && (this.rasterLayers = o88.raster_layers, this.rasterLayerIds = this.rasterLayers.map(((e57) => e57.id))), this.tileBounds = it.fromTileJSON(o88), L2(o88.tiles), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "content" }))), t45 && t45(i27); })); } loaded() { return this._loaded; } onAdd(e57) { this.map = e57, this.load(); } reload() { this.cancelTileJSONRequest(); const t45 = e56.B(this.id, this.scope); this.load((() => this.map.style.clearSource(t45))); } setTiles(e57) { return this._options.tiles = e57, this.reload(), this; } setUrl(e57) { return this.url = e57, this._options.url = e57, this.reload(), this; } onRemove(e57) { this.cancelTileJSONRequest(); } serialize() { return Object.assign({}, this._options); } hasTile(e57) { return !this.tileBounds || this.tileBounds.contains(e57.canonical); } loadTile(t45, i26) { const o88 = e56.o.devicePixelRatio >= 2, s18 = this.map._requestManager.normalizeTileURL(t45.tileID.canonical.url(this.tiles, this.scheme), o88, this.tileSize); t45.request = e56.n(this.map._requestManager.transformRequest(s18, e56.R.Tile), ((o89, s19, r86, n45) => (delete t45.request, t45.aborted ? (t45.state = "unloaded", i26(null)) : o89 ? (t45.state = "errored", i26(o89)) : s19 ? (this.map._refreshExpiredTiles && t45.setExpiryData({ cacheControl: r86, expires: n45 }), t45.setTexture(s19, this.map.painter), t45.state = "loaded", e56.aM(this.dispatcher), void i26(null)) : i26(null)))); } abortTile(e57, t45) { e57.request && (e57.request.cancel(), delete e57.request), t45 && t45(); } unloadTile(t45, i26) { t45.texture && t45.texture instanceof e56.T ? (t45.destroy(true), t45.texture && t45.texture instanceof e56.T && this.map.painter.saveTileTexture(t45.texture)) : t45.destroy(), i26 && i26(); } hasTransition() { return false; } cancelTileJSONRequest() { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); } } function rt3([t45, i26], o88, s18, { scaled: r86 = true } = {}) { const { tileSize: n45, buffer: a46 } = s18, { x: l21, y: c28, z: h8 } = o88; if (!isFinite(l21) || !isFinite(c28) || !isFinite(h8)) throw new Error("Invalid MRT header"); const d34 = 2 ** h8, u12 = d34 * e56.aF(t45), _4 = d34 * e56.aJ(i26); return (function([e57, t46], i27, { scaled: o89 = true } = {}) { if (!i27) throw new Error("bandView is undefined"); const { data: s19, tileSize: r87, buffer: n46, offset: a47, scale: l22, dimension: c29 } = i27; if (e57 < -n46 || e57 > r87 + n46 || t46 < -n46 || t46 > r87 + n46) throw new Error(`Point (${e57}, ${t46}) out of bounds for tileSize=${r87}, buffer=${n46}`); const h9 = (t46 + n46) * (r87 + 2 * n46) + (e57 + n46); if (4294967295 === new Uint32Array(s19.buffer)[h9]) return null; let d35 = []; d35 = o89 ? [] : new (0, i27.data.constructor)(c29); for (let e58 = 0; e58 < c29; e58++) d35[e58] = Math.round(1e12 * (s19[c29 * h9 + e58] * l22 + a47)) / 1e12; return d35; })([Math.min(Math.max(-a46, Math.floor((u12 - l21) * n45)), n45 - 1 + a46), Math.min(Math.max(-a46, Math.floor((_4 - c28) * n45)), n45 - 1 + a46)], s18, { scaled: r86 }); } class nt2 extends st3 { constructor(e57, t45, i26, o88) { super(e57, t45, i26, o88), this.type = "raster-array", this.maxzoom = 22, this.partial = true, this._loadTilePending = {}, this._loadTileLoaded = {}, this._options = Object.assign({ type: "raster-array" }, t45); } triggerRepaint(e57) { const t45 = this.map.painter._terrain, i26 = this.map.style.getSourceCache(this.id); t45 && t45.enabled && i26 && t45._clearRenderCacheForTile(i26.id, e57.tileID), this.map.triggerRepaint(); } loadTile(t45, i26) { const o88 = this.map._requestManager.normalizeTileURL(t45.tileID.canonical.url(this.tiles, this.scheme), false, this.tileSize), s18 = this.map._requestManager.transformRequest(o88, e56.R.Tile), r86 = { request: s18, uid: t45.uid, tileID: t45.tileID, type: this.type, source: this.id, scope: this.scope, partial: this.partial }; t45.source = this.id, t45.scope = this.scope, t45.requestParams = s18, t45.actor || (t45.actor = this.dispatcher.getActor()); const n45 = (e57, o89, s19, r87) => { if (delete t45.request, t45.aborted) return t45.state = "unloaded", i26(null); if (e57) { if ("AbortError" === e57.name) return; return t45.state = "errored", i26(e57); } if (this.map._refreshExpiredTiles && o89 && t45.setExpiryData({ cacheControl: s19, expires: r87 }), this.partial && "expired" !== t45.state) t45.state = "empty"; else if (!this.partial) { if (!o89) return i26(null); t45.state = "loaded", t45._isHeaderLoaded = true, t45._mrt = o89; } i26(null); }; t45.request = this.partial ? t45.fetchHeader(void 0, n45.bind(this)) : t45.actor.send("loadTile", r86, n45.bind(this), void 0, true); } abortTile(e57) { e57.request && (e57.request.cancel(), delete e57.request), e57.actor && e57.actor.send("abortTile", { uid: e57.uid, type: this.type, source: this.id, scope: this.scope }); } unloadTile(e57, t45) { const i26 = e57.texturePerLayer; if (e57.flushAllQueues(), i26.size) { e57.destroy(true); for (const e58 of i26.values()) this.map.painter.saveTileTexture(e58); } else e57.destroy(); } prepareTile(t45, i26, o88, s18) { t45._isHeaderLoaded && ("empty" !== t45.state && (t45.state = "reloading"), t45.fetchBandForRender(i26, o88, s18, ((i27, s19) => { if (i27) return t45.state = "errored", this.fire(new e56.y(i27)), void this.triggerRepaint(t45); s19 && (t45._isHeaderLoaded = true, t45.setTexturePerLayer(o88, s19, this.map.painter), t45.state = "loaded", this.triggerRepaint(t45)); }))); } getInitialBand(e57) { if (!this.rasterLayers) return 0; const t45 = this.rasterLayers.find((({ id: t46 }) => t46 === e57)), i26 = t45 && t45.fields, o88 = i26 && i26.bands && i26.bands; return o88 ? o88[0] : 0; } getTextureDescriptor(t45, i26, o88) { if (!t45) return; const s18 = i26.sourceLayer || this.rasterLayerIds && this.rasterLayerIds[0]; if (!s18) return; let r86 = null; i26 instanceof e56.aP ? r86 = i26.paint.get("raster-array-band") : i26 instanceof e56.aQ && (r86 = i26.paint.get("raster-particle-array-band")); const n45 = r86 || this.getInitialBand(s18); if (null == n45) return; if (!t45.textureDescriptorPerLayer.get(i26.id)) return void this.prepareTile(t45, s18, i26.id, n45); if (t45.updateNeeded(i26.id, n45) && !o88) return; const a46 = t45.textureDescriptorPerLayer.get(i26.id); return Object.assign({}, a46, { texture: t45.texturePerLayer.get(i26.id) }); } getImages(t45, i26) { const o88 = /* @__PURE__ */ new Map(); for (const s18 of t45) for (const t46 of i26) { const [i27, r86] = t46.split("/"), n45 = s18.getLayer(i27); if (!n45) continue; if (!n45.hasBand(r86) || !n45.hasDataForBand(r86)) continue; const { bytes: a46, tileSize: l21, buffer: c28 } = n45.getBandView(r86), h8 = l21 + 2 * c28, d34 = { data: new e56.q({ width: h8, height: h8 }, a46), pixelRatio: 2, sdf: false, usvg: false, version: 0 }; o88.set(t46, d34); } return o88; } queryRasterArrayValueByBandId(t45, i26, o88) { const s18 = i26._mrt; return new Promise(((r86) => { const n45 = {}, a46 = /* @__PURE__ */ new Set(); for (const [l21, c28] of Object.entries(s18.layers)) { if (o88.layerName && l21 !== o88.layerName) continue; const h8 = {}; n45[l21] = h8; for (const { bands: d34 } of c28.dataIndex) for (const u12 of d34) o88.bands && !o88.bands.includes(u12) || (a46.add(e56.B(l21, u12)), i26.fetchBand(l21, null, u12, ((i27) => { e56.o.frame((() => { h8[u12] = i27 ? null : rt3([t45.lng, t45.lat], s18, c28.getBandView(u12)), a46.delete(e56.B(l21, u12)), 0 === a46.size && r86(n45); })); }), false)); } 0 === a46.size && r86(n45); })); } _loadTileForQuery(t45, i26) { if (this._loadTileLoaded[t45.uid]) return void i26(null, t45._mrt); if (this._loadTilePending[t45.uid]) return void this._loadTilePending[t45.uid].push(i26); this._loadTilePending[t45.uid] = [i26]; const o88 = this.map._requestManager.normalizeTileURL(t45.tileID.canonical.url(this.tiles, this.scheme), false, this.tileSize), s18 = this.map._requestManager.transformRequest(o88, e56.R.Tile); t45.actor.send("loadTile", { request: s18, uid: t45.uid, tileID: t45.tileID, type: this.type, source: this.id, scope: this.scope, partial: false }, ((e57, i27, o89, s19) => e57 ? (this._loadTilePending[t45.uid].forEach(((t46) => t46(e57, null))), void delete this._loadTilePending[t45.uid]) : i27 ? (this.map._refreshExpiredTiles && i27 && t45.setExpiryData({ cacheControl: o89, expires: s19 }), t45._mrt = i27, t45._isHeaderLoaded = true, t45.state = "loaded", this._loadTilePending[t45.uid].forEach(((e58) => e58(null, i27))), this._loadTileLoaded[t45.uid] = true, void delete this._loadTilePending[t45.uid]) : (this._loadTilePending[t45.uid].forEach(((e58) => e58(null, null))), void delete this._loadTilePending[t45.uid])), void 0, true); } queryRasterArrayValueByAllBands(e57, t45, i26) { return new Promise(((o88, s18) => { this._loadTileForQuery(t45, ((r86, n45) => { r86 ? s18(r86) : o88(n45 ? this.queryRasterArrayValueByBandId(e57, t45, i26) : null); })); })); } queryRasterArrayValue(t45, i26) { const o88 = e56.aR.convert(t45), s18 = this.findLoadedParent(o88); return s18 && s18._mrt ? i26.bands || !this.partial ? this.queryRasterArrayValueByBandId(o88, s18, i26) : this.queryRasterArrayValueByAllBands(o88, s18, i26) : Promise.resolve(null); } findLoadedParent(t45) { const i26 = e56.ae.fromLngLat(t45, this.map.transform.tileSize), o88 = this.maxzoom + 1, s18 = 1 << o88, r86 = Math.floor(i26.x), n45 = Math.floor((i26.x - r86) * s18), a46 = Math.floor(i26.y * s18), l21 = this.map.style.getSourceCache(this.id), c28 = new e56.aO(o88, r86, o88, n45, a46); return l21.findLoadedParent(c28, this.minzoom); } } const at2 = { vector: ot, raster: st3, "raster-dem": class extends st3 { constructor(e57, t45, i26, o88) { super(e57, t45, i26, o88), this.type = "raster-dem", this.maxzoom = 22, this._options = Object.assign({ type: "raster-dem" }, t45), this.encoding = t45.encoding || "mapbox"; } loadTile(t45, i26) { const o88 = this.map._requestManager.normalizeTileURL(t45.tileID.canonical.url(this.tiles, this.scheme), false, this.tileSize); function s18(e57, o89) { e57 && (t45.state = "errored", i26(e57)), o89 && (t45.dem = o89, t45.dem.onDeserialize(), t45.needsHillshadePrepare = true, t45.needsDEMTextureUpload = true, t45.state = "loaded", i26(null)); } t45.request = e56.n(this.map._requestManager.transformRequest(o88, e56.R.Tile), function(o89, r86, n45, a46) { if (delete t45.request, t45.aborted) t45.state = "unloaded", i26(null); else if (o89) t45.state = "errored", i26(o89); else if (r86) { this.map._refreshExpiredTiles && t45.setExpiryData({ cacheControl: n45, expires: a46 }); const i27 = ImageBitmap && r86 instanceof ImageBitmap && e56.r(), o90 = 1 - (r86.width - e56.aN(r86.width)) / 2; o90 < 1 || t45.neighboringTiles || (t45.neighboringTiles = this._getNeighboringTiles(t45.tileID)); const l21 = i27 ? r86 : e56.o.getImageData(r86, o90), c28 = { uid: t45.uid, tileID: t45.tileID, source: this.id, type: this.type, scope: this.scope, rawImageData: l21, encoding: this.encoding, padding: o90 }; t45.actor && "expired" !== t45.state || (t45.actor = this.dispatcher.getActor(), t45.actor.send("loadTile", c28, s18.bind(this), void 0, true)); } }.bind(this)); } _getNeighboringTiles(t45) { const i26 = t45.canonical, o88 = Math.pow(2, i26.z), s18 = (i26.x - 1 + o88) % o88, r86 = 0 === i26.x ? t45.wrap - 1 : t45.wrap, n45 = (i26.x + 1 + o88) % o88, a46 = i26.x + 1 === o88 ? t45.wrap + 1 : t45.wrap, l21 = {}; return l21[new e56.aO(t45.overscaledZ, r86, i26.z, s18, i26.y).key] = { backfilled: false }, l21[new e56.aO(t45.overscaledZ, a46, i26.z, n45, i26.y).key] = { backfilled: false }, i26.y > 0 && (l21[new e56.aO(t45.overscaledZ, r86, i26.z, s18, i26.y - 1).key] = { backfilled: false }, l21[new e56.aO(t45.overscaledZ, t45.wrap, i26.z, i26.x, i26.y - 1).key] = { backfilled: false }, l21[new e56.aO(t45.overscaledZ, a46, i26.z, n45, i26.y - 1).key] = { backfilled: false }), i26.y + 1 < o88 && (l21[new e56.aO(t45.overscaledZ, r86, i26.z, s18, i26.y + 1).key] = { backfilled: false }, l21[new e56.aO(t45.overscaledZ, t45.wrap, i26.z, i26.x, i26.y + 1).key] = { backfilled: false }, l21[new e56.aO(t45.overscaledZ, a46, i26.z, n45, i26.y + 1).key] = { backfilled: false }), l21; } }, "raster-array": nt2, geojson: class extends e56.E { constructor(t45, i26, o88, s18) { super(), this.id = t45, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = true, this.reparseOverscaled = true, this._loaded = false, this.actor = o88.getActor(), this.setEventedParent(s18), this._data = i26.data, this._options = Object.assign({}, i26), this._collectResourceTiming = i26.collectResourceTiming, void 0 !== i26.maxzoom && (this.maxzoom = i26.maxzoom), void 0 !== i26.minzoom && (this.minzoom = i26.minzoom), i26.type && (this.type = i26.type), i26.attribution && (this.attribution = i26.attribution), this.promoteId = i26.promoteId; const r86 = e56.al / this.tileSize; this.workerOptions = Object.assign({ source: this.id, scope: this.scope, cluster: i26.cluster || false, geojsonVtOptions: { buffer: (void 0 !== i26.buffer ? i26.buffer : 128) * r86, tolerance: (void 0 !== i26.tolerance ? i26.tolerance : 0.375) * r86, extent: e56.al, maxZoom: this.maxzoom, lineMetrics: i26.lineMetrics || false, generateId: i26.generateId || false }, superclusterOptions: { maxZoom: void 0 !== i26.clusterMaxZoom ? i26.clusterMaxZoom : this.maxzoom - 1, minPoints: Math.max(2, i26.clusterMinPoints || 2), extent: e56.al, radius: (void 0 !== i26.clusterRadius ? i26.clusterRadius : 50) * r86, log: false, generateId: i26.generateId || false }, clusterProperties: i26.clusterProperties, filter: i26.filter, dynamic: i26.dynamic }, i26.workerOptions); } onAdd(e57) { this.map = e57, this.setData(this._data); } setData(e57) { return this._data = e57, this._updateWorkerData(), this; } updateData(t45) { if (!this._options.dynamic) return this.fire(new e56.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false."))); if ("string" != typeof t45 && ("Feature" === t45.type && (t45 = { type: "FeatureCollection", features: [t45] }), "FeatureCollection" !== t45.type)) return this.fire(new e56.y(new Error("Data to update should be a feature or a feature collection."))); if (this._coalesce && "string" != typeof t45 && "string" != typeof this._data && "FeatureCollection" === this._data.type) { const e57 = /* @__PURE__ */ new Map(); for (const t46 of this._data.features) e57.set(t46.id, t46); for (const i26 of t45.features) e57.set(i26.id, i26); this._data.features = [...e57.values()]; } else this._data = t45; return this._updateWorkerData(true), this; } getClusterExpansionZoom(e57, t45) { return this.actor.send("geojson.getClusterExpansionZoom", { clusterId: e57, source: this.id, scope: this.scope }, t45), this; } getClusterChildren(e57, t45) { return this.actor.send("geojson.getClusterChildren", { clusterId: e57, source: this.id, scope: this.scope }, t45), this; } getClusterLeaves(e57, t45, i26, o88) { return this.actor.send("geojson.getClusterLeaves", { source: this.id, scope: this.scope, clusterId: e57, limit: t45, offset: i26 }, o88), this; } _updateWorkerData(t45 = false) { if (this._pendingLoad) return void (this._coalesce = true); this.fire(new e56.z("dataloading", { dataType: "source" })), this._loaded = false; const i26 = Object.assign({ append: t45 }, this.workerOptions); i26.scope = this.scope; const o88 = this._data; "string" == typeof o88 ? (i26.request = this.map._requestManager.transformRequest(e56.o.resolveURL(o88), e56.R.Source), i26.request.collectResourceTiming = this._collectResourceTiming) : i26.data = JSON.stringify(o88), this._pendingLoad = this.actor.send(`${this.type}.loadData`, i26, ((i27, o89) => { if (this._loaded = true, this._pendingLoad = null, i27) this.fire(new e56.y(i27)); else { const i28 = { dataType: "source", sourceDataType: this._metadataFired ? "content" : "metadata" }; this._collectResourceTiming && o89 && o89.resourceTiming && o89.resourceTiming[this.id] && (i28.resourceTiming = o89.resourceTiming[this.id]), t45 && (this._partialReload = true), this.fire(new e56.z("data", i28)), this._partialReload = false, this._metadataFired = true; } this._coalesce && (this._updateWorkerData(t45), this._coalesce = false); })); } loaded() { return this._loaded; } reload() { const t45 = e56.B(this.id, this.scope); this.map.style.clearSource(t45), this._updateWorkerData(); } loadTile(t45, i26) { const o88 = t45.actor ? "reloadTile" : "loadTile"; t45.actor = this.actor; const s18 = this.map.style ? this.map.style.getLut(this.scope) : null, r86 = s18 ? { image: s18.image.clone() } : null, n45 = this._partialReload, a46 = { type: this.type, uid: t45.uid, tileID: t45.tileID, tileZoom: t45.tileZoom, zoom: t45.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, lut: r86, scope: this.scope, pixelRatio: e56.o.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes, promoteId: this.promoteId, brightness: this.map.style && this.map.style.getBrightness() || 0, extraShadowCaster: t45.isExtraShadowCaster, scaleFactor: this.map.getScaleFactor(), partial: n45, worldview: this.map.getWorldview() }; t45.request = this.actor.send(o88, a46, ((e57, s19) => n45 && !s19 ? (t45.state = "loaded", i26(null)) : (delete t45.request, t45.destroy(), t45.aborted ? i26(null) : e57 ? i26(e57) : (t45.loadVectorData(s19, this.map.painter, "reloadTile" === o88), i26(null)))), void 0, "loadTile" === o88); } abortTile(e57) { e57.request && (e57.request.cancel(), delete e57.request), e57.aborted = true; } unloadTile(e57, t45) { this.actor.send("removeTile", { uid: e57.uid, type: this.type, source: this.id, scope: this.scope }), e57.destroy(); } onRemove(e57) { this._pendingLoad && this._pendingLoad.cancel(); } serialize() { return Object.assign({}, this._options, { type: this.type, data: this._data }); } hasTransition() { return false; } }, video: class extends e56.aS { constructor(e57, t45, i26, o88) { super(e57, t45, i26, o88), this.roundZoom = true, this.type = "video", this.options = t45; } load() { this._loaded = false; const t45 = this.options; this.urls = []; for (const i26 of t45.urls) this.urls.push(this.map._requestManager.transformRequest(i26, e56.R.Source).url); e56.aT(this.urls, ((t46, i26) => { this._loaded = true, t46 ? this.fire(new e56.y(t46)) : i26 && (this.video = i26, this.video.loop = true, 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(t45) { if (this.video) { const i26 = this.video.seekable; t45 < i26.start(0) || t45 > i26.end(0) ? this.fire(new e56.y(new e56.V(`sources.${this.id}`, null, `Playback for this video can be set only between the ${i26.start(0)} and ${i26.end(0)}-second mark.`))) : this.video.currentTime = t45; } } getVideo() { return this.video; } onAdd(e57) { this.map || (this.map = e57, 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 t45 = this.map.painter.context, i26 = t45.gl; this.texture ? this.video.paused || (this.texture.bind(i26.LINEAR, i26.CLAMP_TO_EDGE), i26.texSubImage2D(i26.TEXTURE_2D, 0, 0, 0, i26.RGBA, i26.UNSIGNED_BYTE, this.video)) : (this.texture = new e56.T(t45, this.video, i26.RGBA8), this.texture.bind(i26.LINEAR, i26.CLAMP_TO_EDGE), this.width = this.video.videoWidth, this.height = this.video.videoHeight), this._prepareData(t45); } serialize() { return { type: "video", urls: this.urls, coordinates: this.coordinates }; } hasTransition() { return this.video && !this.video.paused; } }, image: e56.aS, model: class extends e56.E { constructor(e57, t45, i26, o88) { super(), this.id = e57, this.type = "model", this.models = [], this._loaded = false, this._options = t45; } load() { const t45 = []; for (const i26 in this._options.models) { const o88 = this._options.models[i26], s18 = e56.aV(this.map._requestManager.transformRequest(o88.uri, e56.R.Model).url).then(((t46) => { if (!t46) return; const s19 = e56.aW(t46), r86 = new e56.aX(i26, o88.position, o88.orientation, s19); r86.computeBoundsAndApplyParent(), this.models.push(r86); })).catch(((t46) => { this.fire(new e56.y(new Error(`Could not load model ${i26} from ${o88.uri}: ${t46.message}`))); })); t45.push(s18); } Promise.allSettled(t45).then((() => { this._loaded = true, this.fire(new e56.z("data", { dataType: "source", sourceDataType: "metadata" })); })).catch(((t46) => { this._loaded = true, this.fire(new e56.y(new Error(`Could not load models: ${t46.message}`))); })); } onAdd(e57) { this.map = e57, this.load(); } hasTransition() { return false; } loaded() { return this._loaded; } getModels() { return this.models; } loadTile(e57, t45) { } serialize() { return this._options; } }, "batched-model": class extends e56.E { constructor(e57, t45, i26, o88) { super(), this.type = "batched-model", this.id = e57, this.tileSize = 512, this._options = t45, this.tiles = this._options.tiles, this.maxzoom = t45.maxzoom || 19, this.minzoom = t45.minzoom || 0, this.roundZoom = true, this.usedInConflation = true, this.dispatcher = i26, this.reparseOverscaled = false, this.scheme = "xyz", this._loaded = false, this.setEventedParent(o88); } onAdd(e57) { this.map = e57, this.load(); } reload() { this.cancelTileJSONRequest(); const t45 = e56.B(this.id, this.scope); this.load((() => this.map.style.clearSource(t45))); } cancelTileJSONRequest() { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); } load(t45) { this._loaded = false, this.fire(new e56.z("dataloading", { dataType: "source" })); const i26 = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, o88 = this.map.getWorldview(); this._tileJSONRequest = et2(this._options, this.map._requestManager, i26, o88, ((s18, r86) => { this._tileJSONRequest = null, this._loaded = true, s18 ? (i26 && console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i26}`), o88 && 2 !== o88.length && console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o88}`), this.fire(new e56.y(s18))) : r86 && (Object.assign(this, r86), r86.bounds && (this.tileBounds = new it(r86.bounds, this.minzoom, this.maxzoom)), L2(r86.tiles, this.map._requestManager._customAccessToken), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "content" }))), t45 && t45(s18); })); } hasTransition() { return false; } hasTile(e57) { return !this.tileBounds || this.tileBounds.contains(e57.canonical); } loaded() { return this._loaded; } loadTile(t45, i26) { const o88 = this.map._requestManager.normalizeTileURL(t45.tileID.canonical.url(this.tiles, this.scheme)), s18 = { request: this.map._requestManager.transformRequest(o88, e56.R.Tile), data: void 0, uid: t45.uid, tileID: t45.tileID, tileZoom: t45.tileZoom, zoom: t45.tileID.overscaledZ, tileSize: this.tileSize * t45.tileID.overscaleFactor(), type: this.type, source: this.id, scope: this.scope, showCollisionBoxes: this.map.showCollisionBoxes, isSymbolTile: t45.isSymbolTile, brightness: this.map.style && this.map.style.getBrightness() || 0, pixelRatio: e56.o.devicePixelRatio, promoteId: this.promoteId }; if (t45.actor && "expired" !== t45.state) if ("loading" === t45.state) t45.reloadCallback = i26; else { if (t45.buckets) { const e57 = Object.values(t45.buckets); for (const t46 of e57) t46.dirty = true; return void (t45.state = "loaded"); } t45.request = t45.actor.send("reloadTile", s18, r86.bind(this)); } else t45.actor = this.dispatcher.getActor(), t45.request = t45.actor.send("loadTile", s18, r86.bind(this), void 0, true); function r86(e57, o89) { return t45.aborted ? i26(null) : e57 && 404 !== e57.status ? i26(e57) : (this.map._refreshExpiredTiles && o89 && t45.setExpiryData(o89), t45.loadModelData(o89, this.map.painter), t45.state = "loaded", void i26(null)); } } serialize() { return Object.assign({}, this._options); } }, canvas: class extends e56.aS { constructor(t45, i26, o88, s18) { super(t45, i26, o88, s18), i26.coordinates ? Array.isArray(i26.coordinates) && 4 === i26.coordinates.length && !i26.coordinates.some(((e57) => !Array.isArray(e57) || 2 !== e57.length || e57.some(((e58) => "number" != typeof e58)))) || this.fire(new e56.y(new e56.V(`sources.${t45}`, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new e56.y(new e56.V(`sources.${t45}`, null, 'missing required property "coordinates"'))), i26.animate && "boolean" != typeof i26.animate && this.fire(new e56.y(new e56.V(`sources.${t45}`, null, 'optional "animate" property must be a boolean value'))), i26.canvas ? "string" == typeof i26.canvas || i26.canvas instanceof HTMLCanvasElement || this.fire(new e56.y(new e56.V(`sources.${t45}`, 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 e56.y(new e56.V(`sources.${t45}`, null, 'missing required property "canvas"'))), this.options = i26, this.animate = void 0 === i26.animate || i26.animate; } load() { this._loaded = true, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new e56.y(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() { this._playing = true, this.map.triggerRepaint(); }, this.pause = function() { this._playing && (this.prepare(), this._playing = false); }, this._finishLoading()); } getCanvas() { return this.canvas; } onAdd(e57) { this.map = e57, this.load(), this.canvas && this.animate && this.play(); } onRemove(e57) { this.pause(); } prepare() { let t45 = false; if (this.canvas.width !== this.width && (this.width = this.canvas.width, t45 = true), this.canvas.height !== this.height && (this.height = this.canvas.height, t45 = true), this._hasInvalidDimensions()) return; if (0 === Object.keys(this.tiles).length) return; const i26 = this.map.painter.context; this.texture ? !t45 && !this._playing || this.texture instanceof e56.aU || this.texture.update(this.canvas, { premultiply: true }) : this.texture = new e56.T(i26, this.canvas, i26.gl.RGBA8, { premultiply: true }), this._prepareData(i26); } serialize() { return { type: "canvas", coordinates: this.coordinates }; } hasTransition() { return this._playing; } _hasInvalidDimensions() { for (const e57 of [this.canvas.width, this.canvas.height]) if (isNaN(e57) || e57 <= 0) return true; return false; } }, custom: class extends e56.E { constructor(t45, i26, o88, s18) { super(), this.id = t45, this.type = "custom", this._dataType = "raster", this._dispatcher = o88, this._implementation = i26, this.setEventedParent(s18), this.scheme = "xyz", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this._loaded = false, this.roundZoom = true, this._implementation || this.fire(new e56.y(new Error(`Missing implementation for ${this.id} custom source`))), this._implementation.loadTile || this.fire(new e56.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))), this._implementation.bounds && (this.tileBounds = new it(this._implementation.bounds, this.minzoom, this.maxzoom)), i26.update = this._update.bind(this), i26.clearTiles = this._clearTiles.bind(this), i26.coveringTiles = this._coveringTiles.bind(this), Object.assign(this, e56.aH(i26, ["dataType", "scheme", "minzoom", "maxzoom", "tileSize", "attribution", "minTileCacheSize", "maxTileCacheSize"])); } serialize() { return e56.aH(this, ["type", "scheme", "minzoom", "maxzoom", "tileSize", "attribution"]); } load() { this._loaded = true, this.fire(new e56.z("data", { dataType: "source", sourceDataType: "metadata" })), this.fire(new e56.z("data", { dataType: "source", sourceDataType: "content" })); } loaded() { return this._loaded; } onAdd(t45) { this.map = t45, this._loaded = false, this.fire(new e56.z("dataloading", { dataType: "source" })), this._implementation.onAdd && this._implementation.onAdd(t45), this.load(); } onRemove(e57) { this._implementation.onRemove && this._implementation.onRemove(e57); } hasTile(e57) { if (this._implementation.hasTile) { const { x: t45, y: i26, z: o88 } = e57.canonical; return this._implementation.hasTile({ x: t45, y: i26, z: o88 }); } return !this.tileBounds || this.tileBounds.contains(e57.canonical); } loadTile(e57, t45) { const { x: i26, y: o88, z: s18 } = e57.tileID.canonical, r86 = new AbortController(); e57.request = Promise.resolve(this._implementation.loadTile({ x: i26, y: o88, z: s18 }, { signal: r86.signal })).then(function(i27) { return delete e57.request, e57.aborted ? (e57.state = "unloaded", t45(null)) : void 0 === i27 ? (e57.state = "errored", t45(null)) : null === i27 ? (this.loadTileData(e57, { width: this.tileSize, height: this.tileSize, data: null }), e57.state = "loaded", t45(null)) : (function(e58) { return e58 instanceof ImageData || e58 instanceof HTMLCanvasElement || e58 instanceof ImageBitmap || e58 instanceof HTMLImageElement; })(i27) ? (this.loadTileData(e57, i27), e57.state = "loaded", void t45(null)) : (e57.state = "errored", t45(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`))); }.bind(this)).catch(((i27) => { "AbortError" !== i27.name && (e57.state = "errored", t45(i27)); })), e57.request.cancel = () => r86.abort(); } loadTileData(e57, t45) { e57.setTexture(t45, this.map.painter); } unloadTile(t45, i26) { if (t45.texture && t45.texture instanceof e56.T ? (t45.destroy(true), t45.texture && t45.texture instanceof e56.T && this.map.painter.saveTileTexture(t45.texture)) : t45.destroy(), this._implementation.unloadTile) { const { x: e57, y: i27, z: o88 } = t45.tileID.canonical; this._implementation.unloadTile({ x: e57, y: i27, z: o88 }); } i26 && i26(); } abortTile(e57, t45) { e57.request && e57.request.cancel && (e57.request.cancel(), delete e57.request), t45 && t45(); } hasTransition() { return false; } _coveringTiles() { return this.map.transform.coveringTiles({ tileSize: this.tileSize, minzoom: this.minzoom, maxzoom: this.maxzoom, roundZoom: this.roundZoom }).map(((e57) => ({ x: e57.canonical.x, y: e57.canonical.y, z: e57.canonical.z }))); } _clearTiles() { const t45 = e56.B(this.id, this.scope); this.map.style.clearSource(t45); } _update() { this.fire(new e56.z("data", { dataType: "source", sourceDataType: "content" })); } } }, lt = function(t45, i26, o88, s18) { const r86 = new at2[i26.type](t45, i26, o88, s18); if (r86.id !== t45) throw new Error(`Expected Source id to be ${t45} instead of ${r86.id}`); return e56.aY(["load", "abort", "unload", "serialize", "prepare"], r86), r86; }; function ct(e57, t45, i26 = "") { return `${i26}:${t45.id || ""}:${t45.layer.id}:${(function(e58) { if ("layerId" in e58) return `layer:${e58.layerId}`; { const { featuresetId: t46, importId: i27 } = e58; return `featureset:${t46}${i27 ? `:import:${i27}` : ""}`; } })(e57.target)}`; } function ht2(e57, t45, i26, o88 = "") { if (e57.uniqueFeatureID) { const s18 = ct(e57, t45, o88); if (i26.has(s18)) return true; i26.add(s18); } return false; } function dt3(e57, t45, i26, o88, s18 = false) { const r86 = t45.sourceCache.transform, n45 = t45.sourceCache.tilesIn(e57, t45.has3DLayers, s18); n45.sort(pt); const a46 = []; for (const e58 of n45) { const n46 = e58.tile.queryRenderedFeatures(t45, e58, i26, o88, r86, s18); Object.keys(n46).length && a46.push({ wrappedTileID: e58.tile.tileID.wrapped().key, queryResults: n46 }); } return 0 === a46.length ? {} : (function(e58) { const t46 = {}, i27 = {}; for (const o89 of e58) { const e59 = o89.queryResults, s19 = o89.wrappedTileID, r87 = i27[s19] = i27[s19] || {}; for (const i28 in e59) { const o90 = e59[i28], s20 = r87[i28] = r87[i28] || {}, n46 = t46[i28] = t46[i28] || []; for (const e60 of o90) s20[e60.featureIndex] || (s20[e60.featureIndex] = true, n46.push(e60)); } } return t46; })(a46); } function ut2(e57, t45, i26, o88, s18, r86) { const n45 = {}, a46 = o88.queryRenderedSymbols(e57), l21 = []; for (const e58 of Object.keys(a46).map(Number)) l21.push(s18[e58]); l21.sort(pt); for (const e58 of l21) { const o89 = e58.featureIndex.lookupSymbolFeatures(a46[e58.bucketInstanceId], e58.bucketIndex, e58.sourceLayerIndex, t45, i26, r86); for (const t46 in o89) { const i27 = n45[t46] = n45[t46] || [], s19 = o89[t46]; s19.sort(((t47, i28) => { const o90 = e58.featureSortOrder; if (o90) { const e59 = o90.indexOf(t47.featureIndex); return o90.indexOf(i28.featureIndex) - e59; } return i28.featureIndex - t47.featureIndex; })); for (const e59 of s19) i27.push(e59); } } return n45; } function _t(e57, t45) { const i26 = e57.getRenderableIds().map(((t46) => e57.getTileByID(t46))), o88 = [], s18 = {}; for (let e58 = 0; e58 < i26.length; e58++) { const r86 = i26[e58], n45 = r86.tileID.canonical.key; s18[n45] || (s18[n45] = true, r86.querySourceFeatures(o88, t45)); } return o88; } function pt(e57, t45) { const i26 = e57.tileID, o88 = t45.tileID; return i26.overscaledZ - o88.overscaledZ || i26.canonical.y - o88.canonical.y || i26.wrap - o88.wrap || i26.canonical.x - o88.canonical.x; } function ft(e57, t45) { const i26 = {}; if (!t45) return i26; for (const o88 of e57) { const e58 = o88.layerIds.map(((e59) => t45.getLayer(e59))).filter(Boolean); if (0 !== e58.length) { o88.layers = e58, o88.stateDependentLayerIds && (o88.stateDependentLayers = o88.stateDependentLayerIds.map(((t46) => e58.filter(((e59) => e59.id === t46))[0]))); for (const t46 of e58) i26[t46.fqid] = o88; } } return i26; } const mt = 32, gt2 = 33, vt2 = new Uint16Array(8184); for (let e57 = 0; e57 < 2046; e57++) { let t45 = e57 + 2, i26 = 0, o88 = 0, s18 = 0, r86 = 0, n45 = 0, a46 = 0; for (1 & t45 ? s18 = r86 = n45 = mt : i26 = o88 = a46 = mt; (t45 >>= 1) > 1; ) { const e58 = i26 + s18 >> 1, l22 = o88 + r86 >> 1; 1 & t45 ? (s18 = i26, r86 = o88, i26 = n45, o88 = a46) : (i26 = s18, o88 = r86, s18 = n45, r86 = a46), n45 = e58, a46 = l22; } const l21 = 4 * e57; vt2[l21 + 0] = i26, vt2[l21 + 1] = o88, vt2[l21 + 2] = s18, vt2[l21 + 3] = r86; } const yt = new Uint16Array(2178), xt = new Uint8Array(1089), bt2 = new Uint16Array(1089); function wt(e57) { return 0 === e57 ? -0.03125 : 32 === e57 ? 0.03125 : 0; } const Tt2 = (() => ({ type: 2, extent: e56.al, loadGeometry: () => [[new e56.P(0, 0), new e56.P(e56.al + 1, 0), new e56.P(e56.al + 1, e56.al + 1), new e56.P(0, e56.al + 1), new e56.P(0, 0)]] }))(); class Et { constructor(t45, i26, o88, s18, r86, n45) { this.tileID = t45, this.uid = e56.b2(), this.uses = 0, this.tileSize = i26, this.tileZoom = o88, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = false, this.hasRTLText = false, this.dependencies = {}, this.isRaster = r86, s18 && s18.style && (this._lastUpdatedBrightness = s18.style.getBrightness()), this.expiredRequestCount = 0, this.state = "loading", s18 && s18.transform && (this.projection = s18.transform.projection), this.worldview = n45; } registerFadeDuration(t45) { const i26 = t45 + this.timeAdded; i26 < e56.o.now() || this.fadeEndTime && i26 < this.fadeEndTime || (this.fadeEndTime = i26); } wasRequested() { return "errored" === this.state || "loaded" === this.state || "reloading" === this.state; } get tileTransform() { return this._tileTransform || (this._tileTransform = e56.aZ(this.tileID.canonical, this.projection)), this._tileTransform; } loadVectorData(t45, i26, o88) { if (this.unloadVectorData(), this.state = "loaded", t45) { t45.featureIndex && (this.latestFeatureIndex = t45.featureIndex, t45.rawTileData ? (this.latestRawTileData = t45.rawTileData, this.latestFeatureIndex.rawTileData = t45.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = t45.collisionBoxArray, this.buckets = ft(t45.buckets, i26.style), this.hasSymbolBuckets = false; for (const t46 in this.buckets) { const i27 = this.buckets[t46]; if (i27 instanceof e56.b4) { if (this.hasSymbolBuckets = true, !o88) break; i27.justReloaded = true; } } if (this.hasRTLText = false, this.hasSymbolBuckets) for (const t46 in this.buckets) { const i27 = this.buckets[t46]; if (i27 instanceof e56.b4 && i27.hasRTLText) { this.hasRTLText = true, e56.b5(); break; } } this.queryPadding = 0; for (const e57 in this.buckets) { const t46 = this.buckets[e57], o89 = i26.style.getOwnLayer(e57); if (!o89) continue; const s18 = o89.queryRadius(t46); this.queryPadding = Math.max(this.queryPadding, s18); } t45.imageAtlas && (this.imageAtlas = t45.imageAtlas), t45.glyphAtlasImage && (this.glyphAtlasImage = t45.glyphAtlasImage), t45.lineAtlas && (this.lineAtlas = t45.lineAtlas), this._lastUpdatedBrightness = t45.brightness; } else this.collisionBoxArray = new e56.b3(); } unloadVectorData() { if (this.hasData()) { for (const e57 in this.buckets) this.buckets[e57].destroy(); this.buckets = {}, this.imageAtlas && (this.imageAtlas = null), this.lineAtlas && (this.lineAtlas = null), this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.lineAtlasTexture && this.lineAtlasTexture.destroy(), this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(), this._tileBoundsIndexBuffer.destroy(), this._tileBoundsSegments.destroy(), this._tileBoundsBuffer = null), this._tileDebugBuffer && (this._tileDebugBuffer.destroy(), this._tileDebugSegments.destroy(), this._tileDebugBuffer = null), this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(), this._tileDebugIndexBuffer = null), this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(), this._globeTileDebugBorderBuffer = null), this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(), this._tileDebugTextSegments.destroy(), this._tileDebugTextIndexBuffer.destroy(), this._tileDebugTextBuffer = null), this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(), this._globeTileDebugTextBuffer = null), this.latestFeatureIndex = null, this.state = "unloaded"; } } loadModelData(e57, t45, i26) { e57 && (e57.resourceTiming && (this.resourceTiming = e57.resourceTiming), this.buckets = Object.assign({}, this.buckets, ft(e57.buckets, t45.style)), e57.featureIndex && (this.latestFeatureIndex = e57.featureIndex)); } getBucket(e57) { return this.buckets[e57.fqid]; } upload(t45) { for (const e57 in this.buckets) { const i27 = this.buckets[e57]; i27.uploadPending() && i27.upload(t45); } const i26 = t45.gl, o88 = this.imageAtlas; o88 && !o88.uploaded && (this.imageAtlasTexture = new e56.T(t45, o88.image, i26.RGBA8, { useMipmap: !!o88.patternPositions.size }), this.imageAtlas.uploaded = true), this.glyphAtlasImage && (this.glyphAtlasTexture = new e56.T(t45, this.glyphAtlasImage, i26.R8), this.glyphAtlasImage = null), this.lineAtlas && !this.lineAtlas.uploaded && (this.lineAtlasTexture = new e56.T(t45, this.lineAtlas.image, i26.R8), this.lineAtlas.uploaded = true); } prepare(e57, t45, i26) { if (this.imageAtlas && this.imageAtlasTexture && this.imageAtlas.patchUpdatedImages(e57, this.imageAtlasTexture, i26), !t45 || !this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) return; const o88 = t45.style.getBrightness(); (this._lastUpdatedBrightness || o88) && (this._lastUpdatedBrightness && o88 && Math.abs(this._lastUpdatedBrightness - o88) < 1e-3 || (this.updateBuckets(t45, this._lastUpdatedBrightness !== o88), this._lastUpdatedBrightness = o88)); } queryRenderedFeatures(t45, i26, o88, s18, r86, n45) { if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData && !this.latestFeatureIndex.is3DTile) return {}; const a46 = (function(t46, i27) { const o89 = e56.bq([], [0.5 * t46.width, 0.5 * -t46.height, 1]); return e56.br(o89, o89, [1, -1, 0]), e56.aB(o89, o89, t46.calculateProjMatrix(i27.toUnwrapped())), Float32Array.from(o89); })(r86, this.tileID); return this.latestFeatureIndex.query(t45, { tilespaceGeometry: i26, pixelPosMatrix: a46, transform: s18, availableImages: o88, tileTransform: this.tileTransform, worldview: this.worldview }); } querySourceFeatures(t45, i26) { const o88 = this.latestFeatureIndex; if (!o88 || !o88.rawTileData) return; const s18 = o88.loadVTLayers(), r86 = i26 ? i26.sourceLayer : "", n45 = s18._geojsonTileLayer || s18[r86]; if (!n45) return; const a46 = e56.b6(i26 && i26.filter), { z: l21, x: c28, y: h8 } = this.tileID.canonical, d34 = { z: l21, x: c28, y: h8 }; for (let i27 = 0; i27 < n45.length; i27++) { const s19 = n45.feature(i27); if (a46.needGeometry) { const t46 = e56.b7(s19, true); if (!a46.filter(new e56.ac(this.tileID.overscaledZ, { worldview: this.worldview }), t46, this.tileID.canonical)) continue; } else if (!a46.filter(new e56.ac(this.tileID.overscaledZ, { worldview: this.worldview }), s19)) continue; const u12 = o88.getId(s19, r86), _4 = new e56.b8(s19, l21, c28, h8, u12); _4.tile = d34, t45.push(_4); } } loaded() { return "loaded" === this.state || "errored" === this.state; } hasData() { return "loaded" === this.state || "reloading" === this.state || "expired" === this.state; } patternsLoaded() { return !!this.imageAtlas && !!this.imageAtlas.patternPositions.size; } setExpiryData(t45) { const i26 = this.expirationTime; if (t45.cacheControl) { const i27 = e56.b9(t45.cacheControl); i27["max-age"] && (this.expirationTime = Date.now() + 1e3 * i27["max-age"]); } else t45.expires && (this.expirationTime = new Date(t45.expires).getTime()); if (this.expirationTime) { const e57 = Date.now(); let t46 = false; if (this.expirationTime > e57) t46 = false; else if (i26) if (this.expirationTime < i26) t46 = true; else { const o88 = this.expirationTime - i26; o88 ? this.expirationTime = e57 + Math.max(o88, 3e4) : t46 = true; } else t46 = true; t46 ? (this.expiredRequestCount++, this.state = "expired") : this.expiredRequestCount = 0; } } getExpiryTimeout() { if (this.expirationTime) return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - (/* @__PURE__ */ new Date()).getTime(), Math.pow(2, 31) - 1); } refreshFeatureState(e57) { this.latestFeatureIndex && (this.latestFeatureIndex.rawTileData || this.latestFeatureIndex.is3DTile) && e57 && this.updateBuckets(e57); } updateBuckets(t45, i26) { if (!this.latestFeatureIndex) return; if (!t45.style) return; const o88 = this.latestFeatureIndex.loadVTLayers(), s18 = t45.style.listImages(), r86 = t45.style.getBrightness(); for (const n45 in this.buckets) { if (!t45.style.hasLayer(n45)) continue; const a46 = this.buckets[n45], l21 = a46.layers[0], c28 = l21.sourceLayer || "_geojsonTileLayer", h8 = o88[c28], d34 = t45.style.getLayerSourceCache(l21); let u12 = {}; d34 && (u12 = d34._state.getState(c28, void 0)); const _4 = this.imageAtlas ? Object.fromEntries(this.imageAtlas.patternPositions) : {}, p9 = Object.keys(u12).length > 0 && !i26; (p9 && 0 !== a46.stateDependentLayers.length || i26) && a46.update(u12, h8, s18, _4, p9 ? a46.stateDependentLayers : a46.layers, i26, r86), (a46 instanceof e56.ba || a46 instanceof e56.bb) && t45._terrain && t45._terrain.enabled && d34 && a46.uploadPending() && t45._terrain._clearRenderCacheForTile(d34.id, this.tileID); const f8 = t45 && t45.style && t45.style.getOwnLayer(n45); f8 && (this.queryPadding = Math.max(this.queryPadding, f8.queryRadius(a46))); } } holdingForFade() { return void 0 !== this.symbolFadeHoldUntil; } symbolFadeFinished() { return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < e56.o.now(); } clearFadeHold() { this.symbolFadeHoldUntil = void 0; } setHoldDuration(t45) { this.symbolFadeHoldUntil = e56.o.now() + t45; } setTexture(t45, i26) { const o88 = i26.context, s18 = o88.gl; this.texture = this.texture || i26.getTileTexture(t45.width), this.texture && this.texture instanceof e56.T ? this.texture.update(t45) : (this.texture = new e56.T(o88, t45, s18.RGBA8, { useMipmap: true }), this.texture.bind(s18.LINEAR, s18.CLAMP_TO_EDGE)); } setDependencies(e57, t45) { const i26 = {}; for (const e58 of t45) i26[e58] = true; this.dependencies[e57] = i26; } hasDependency(e57, t45) { for (const i26 of e57) { const e58 = this.dependencies[i26]; if (e58) { for (const i27 of t45) if (e58[i27]) return true; } } return false; } clearQueryDebugViz() { } _makeDebugTileBoundsBuffers(t45, i26) { if (!i26 || "mercator" === i26.name || this._tileDebugBuffer) return; const o88 = e56.bc(Tt2, this.tileID.canonical, this.tileTransform)[0], s18 = new e56.bd(), r86 = new e56.be(); for (let e57 = 0; e57 < o88.length; e57++) { const { x: t46, y: i27 } = o88[e57]; s18.emplaceBack(t46, i27), r86.emplaceBack(e57); } r86.emplaceBack(0), this._tileDebugIndexBuffer = t45.createIndexBuffer(r86), this._tileDebugBuffer = t45.createVertexBuffer(s18, e56.bf.members), this._tileDebugSegments = e56.bg.simpleSegment(0, 0, s18.length, r86.length); } _makeTileBoundsBuffers(t45, i26) { if (this._tileBoundsBuffer || !i26 || "mercator" === i26.name) return; const o88 = e56.bc(Tt2, this.tileID.canonical, this.tileTransform)[0]; let s18, r86; if (this.isRaster) { const t46 = (function(t47, i27) { const o89 = e56.aZ(t47, i27), s19 = Math.pow(2, t47.z); for (let r88 = 0; r88 < gt2; r88++) for (let n46 = 0; n46 < gt2; n46++) { const a47 = e56.a_((t47.x + (n46 + wt(n46)) / mt) / s19), l22 = e56.a$((t47.y + (r88 + wt(r88)) / mt) / s19), c29 = i27.project(a47, l22), h8 = r88 * gt2 + n46; yt[2 * h8 + 0] = Math.round((c29.x * o89.scale - o89.x) * e56.al), yt[2 * h8 + 1] = Math.round((c29.y * o89.scale - o89.y) * e56.al); } xt.fill(0), bt2.fill(0); for (let e57 = 2045; e57 >= 0; e57--) { const t48 = 4 * e57, i28 = vt2[t48 + 0], o90 = vt2[t48 + 1], s20 = vt2[t48 + 2], r88 = vt2[t48 + 3], n46 = i28 + s20 >> 1, a47 = o90 + r88 >> 1, l22 = n46 + a47 - o90, c29 = a47 + i28 - n46, h8 = o90 * gt2 + i28, d34 = r88 * gt2 + s20, u12 = a47 * gt2 + n46, _4 = Math.hypot((yt[2 * h8 + 0] + yt[2 * d34 + 0]) / 2 - yt[2 * u12 + 0], (yt[2 * h8 + 1] + yt[2 * d34 + 1]) / 2 - yt[2 * u12 + 1]) >= 16; xt[u12] = xt[u12] || (_4 ? 1 : 0), e57 < 1022 && (xt[u12] = xt[u12] || xt[(o90 + c29 >> 1) * gt2 + (i28 + l22 >> 1)] || xt[(r88 + c29 >> 1) * gt2 + (s20 + l22 >> 1)]); } const r87 = new e56.b0(), n45 = new e56.b1(); let a46 = 0; function l21(t48, i28) { const o90 = i28 * gt2 + t48; return 0 === bt2[o90] && (r87.emplaceBack(yt[2 * o90 + 0], yt[2 * o90 + 1], t48 * e56.al / mt, i28 * e56.al / mt), bt2[o90] = ++a46), bt2[o90] - 1; } function c28(e57, t48, i28, o90, s20, r88) { const a47 = e57 + i28 >> 1, h8 = t48 + o90 >> 1; if (Math.abs(e57 - s20) + Math.abs(t48 - r88) > 1 && xt[h8 * gt2 + a47]) c28(s20, r88, e57, t48, a47, h8), c28(i28, o90, s20, r88, a47, h8); else { const a48 = l21(e57, t48), c29 = l21(i28, o90), h9 = l21(s20, r88); n45.emplaceBack(a48, c29, h9); } } return c28(0, 0, mt, mt, mt, 0), c28(mt, mt, 0, 0, 0, mt), { vertices: r87, indices: n45 }; })(this.tileID.canonical, i26); s18 = t46.vertices, r86 = t46.indices; } else { s18 = new e56.b0(), r86 = new e56.b1(); for (const { x: e57, y: t47 } of o88) s18.emplaceBack(e57, t47, 0, 0); const t46 = e56.bh(s18.int16.subarray(0, 4 * s18.length), void 0, 4); for (let e57 = 0; e57 < t46.length; e57 += 3) r86.emplaceBack(t46[e57], t46[e57 + 1], t46[e57 + 2]); } this._tileBoundsBuffer = t45.createVertexBuffer(s18, e56.bi.members), this._tileBoundsIndexBuffer = t45.createIndexBuffer(r86), this._tileBoundsSegments = e56.bg.simpleSegment(0, 0, s18.length, r86.length); } _makeGlobeTileDebugBuffers(t45, i26) { const o88 = i26.projection; if (!o88 || "globe" !== o88.name || i26.freezeTileCoverage) return; const s18 = this.tileID.canonical, r86 = e56.bj(s18, i26), n45 = e56.bk(r86), a46 = e56.aj(i26.zoom); let l21; a46 > 0 && (l21 = e56.bl(new Float64Array(16), i26.globeMatrix)), this._makeGlobeTileDebugBorderBuffer(t45, s18, i26, n45, l21, a46), this._makeGlobeTileDebugTextBuffer(t45, s18, i26, n45, l21, a46); } _globePoint(t45, i26, o88, s18, r86, n45, a46) { let l21 = e56.bm(t45, i26, o88); if (n45) { const r87 = 1 << o88.z, c28 = e56.aF(s18.center.lng), h8 = e56.aJ(s18.center.lat), d34 = (o88.x + 0.5) / r87 - c28; let u12 = 0; d34 > 0.5 ? u12 = -1 : d34 < -0.5 && (u12 = 1); let _4 = (t45 / e56.al + o88.x) / r87 + u12, p9 = (i26 / e56.al + o88.y) / r87; _4 = (_4 - c28) * s18._pixelsPerMercatorPixel + c28, p9 = (p9 - h8) * s18._pixelsPerMercatorPixel + h8; const f8 = [_4 * s18.worldSize, p9 * s18.worldSize, 0]; e56.af(f8, f8, n45), l21 = e56.bn(l21, f8, a46); } return e56.af(l21, l21, r86); } _makeGlobeTileDebugBorderBuffer(t45, i26, o88, s18, r86, n45) { const a46 = new e56.bd(), l21 = new e56.be(), c28 = new e56.bo(), h8 = (e57, t46, h9, d35, u12) => { const _4 = (h9 - e57) / (u12 - 1), p9 = (d35 - t46) / (u12 - 1), f8 = a46.length; for (let h10 = 0; h10 < u12; h10++) { const d36 = e57 + h10 * _4, u13 = t46 + h10 * p9; a46.emplaceBack(d36, u13); const m6 = this._globePoint(d36, u13, i26, o88, s18, r86, n45); c28.emplaceBack(m6[0], m6[1], m6[2]), l21.emplaceBack(f8 + h10); } }, d34 = e56.al; h8(0, 0, d34, 0, 16), h8(d34, 0, d34, d34, 16), h8(d34, d34, 0, d34, 16), h8(0, d34, 0, 0, 16), this._tileDebugIndexBuffer = t45.createIndexBuffer(l21), this._tileDebugBuffer = t45.createVertexBuffer(a46, e56.bf.members), this._globeTileDebugBorderBuffer = t45.createVertexBuffer(c28, e56.bp.members), this._tileDebugSegments = e56.bg.simpleSegment(0, 0, a46.length, l21.length); } _makeGlobeTileDebugTextBuffer(t45, i26, o88, s18, r86, n45) { const a46 = e56.al / 4, l21 = new e56.bd(), c28 = new e56.b1(), h8 = new e56.bo(), d34 = 25; c28.reserve(32), l21.reserve(d34), h8.reserve(d34); const u12 = (e57, t46) => d34 * e57 + t46; for (let e57 = 0; e57 < d34; e57++) { const t46 = e57 * a46; for (let e58 = 0; e58 < d34; e58++) { const c29 = e58 * a46; l21.emplaceBack(c29, t46); const d35 = this._globePoint(c29, t46, i26, o88, s18, r86, n45); h8.emplaceBack(d35[0], d35[1], d35[2]); } } for (let e57 = 0; e57 < 4; e57++) for (let t46 = 0; t46 < 4; t46++) { const i27 = u12(e57, t46), o89 = u12(e57, t46 + 1), s19 = u12(e57 + 1, t46), r87 = u12(e57 + 1, t46 + 1); c28.emplaceBack(i27, o89, s19), c28.emplaceBack(s19, o89, r87); } this._tileDebugTextIndexBuffer = t45.createIndexBuffer(c28), this._tileDebugTextBuffer = t45.createVertexBuffer(l21, e56.bf.members), this._globeTileDebugTextBuffer = t45.createVertexBuffer(h8, e56.bp.members), this._tileDebugTextSegments = e56.bg.simpleSegment(0, 0, d34, 32); } destroy(t45 = false) { for (const e57 in this.buckets) this.buckets[e57].destroy(); this.buckets = {}, this.imageAtlas && (this.imageAtlas = null), this.lineAtlas && (this.lineAtlas = null), this.imageAtlasTexture && (this.imageAtlasTexture.destroy(), delete this.imageAtlasTexture), this.glyphAtlasTexture && (this.glyphAtlasTexture.destroy(), delete this.glyphAtlasTexture), this.lineAtlasTexture && (this.lineAtlasTexture.destroy(), delete this.lineAtlasTexture), this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(), this._tileBoundsIndexBuffer.destroy(), this._tileBoundsSegments.destroy(), this._tileBoundsBuffer = null), this._tileDebugBuffer && (this._tileDebugBuffer.destroy(), this._tileDebugSegments.destroy(), this._tileDebugBuffer = null), this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(), this._tileDebugIndexBuffer = null), this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(), this._globeTileDebugBorderBuffer = null), this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(), this._tileDebugTextSegments.destroy(), this._tileDebugTextIndexBuffer.destroy(), this._tileDebugTextBuffer = null), this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(), this._globeTileDebugTextBuffer = null), !t45 && this.texture && this.texture instanceof e56.T && (this.texture.destroy(), delete this.texture), this.hillshadeFBO && (this.hillshadeFBO.destroy(), delete this.hillshadeFBO), this.dem && delete this.dem, this.neighboringTiles && delete this.neighboringTiles, this.demTexture && (this.demTexture.destroy(), delete this.demTexture), this.rasterParticleState && (this.rasterParticleState.destroy(), delete this.rasterParticleState), this.latestFeatureIndex = null, this.state = "unloaded"; } } e56.bs.setPbf(e56.bt); class St extends Et { constructor(e57, t45, i26, o88, s18) { super(e57, t45, i26, o88, s18), this._workQueuePerLayer = /* @__PURE__ */ new Map(), this._fetchQueuePerLayer = /* @__PURE__ */ new Map(), this._taskQueue = /* @__PURE__ */ new Map(), this._isHeaderLoaded = false, this.textureDescriptorPerLayer = /* @__PURE__ */ new Map(), this.texturePerLayer = /* @__PURE__ */ new Map(); } getLayers() { return this._mrt ? Object.values(this._mrt.layers) : []; } getLayer(e57) { return this._mrt && this._mrt.getLayer(e57); } setTexturePerLayer(t45, i26, o88) { const s18 = o88.context, r86 = s18.gl; let n45 = this.texturePerLayer.get(t45) || o88.getTileTexture(i26.width); n45 && n45 instanceof e56.T ? n45.update(i26, { premultiply: false }) : n45 = new e56.T(s18, i26, r86.RGBA8, { premultiply: false }), this.texturePerLayer.has(t45) || this.texturePerLayer.set(t45, n45); } flushQueues(e57) { const t45 = this._workQueuePerLayer.get(e57) || [], i26 = this._fetchQueuePerLayer.get(e57) || []; for (; t45.length; ) t45.pop()(); for (; i26.length; ) i26.pop()(); } flushAllQueues() { for (const e57 of this._workQueuePerLayer.keys()) { const t45 = this._workQueuePerLayer.get(e57) || []; for (; t45.length; ) t45.pop()(); } for (const e57 of this._fetchQueuePerLayer.keys()) { const t45 = this._fetchQueuePerLayer.get(e57) || []; for (; t45.length; ) t45.pop()(); } } fetchHeader(t45 = 16384, i26) { const o88 = this._mrt = new e56.bs(30), s18 = Object.assign({}, this.requestParams, { headers: { Range: "bytes=0-" + (t45 - 1) } }); return this.entireBuffer = null, this.request = e56.bu(s18, ((e57, s19, r86, n45) => { if (e57) i26(e57); else try { const e58 = o88.getHeaderLength(s19); if (e58 > t45) return void (this.request = this.fetchHeader(e58, i26)); o88.parseHeader(s19), this._isHeaderLoaded = true; let a46 = 0; for (const e59 of Object.values(o88.layers)) a46 = Math.max(a46, e59.dataIndex[e59.dataIndex.length - 1].lastByte); s19.byteLength >= a46 && (this.entireBuffer = s19), i26(null, this.entireBuffer || s19, r86, n45); } catch (e58) { i26(e58); } })), this.request; } fetchBandForRender(e57, t45, i26, o88) { this.fetchBand(e57, t45, i26, ((s18) => { if (s18) return void o88(s18); this.updateTextureDescriptor(e57, t45, i26); const r86 = this.textureDescriptorPerLayer.get(t45); o88(null, r86 ? r86.img : null); })); } fetchBand(t45, i26, o88, s18, r86 = true) { const n45 = this._mrt; if (!this._isHeaderLoaded || !n45) return void s18(new Error("Tile header is not ready")); const a46 = this.actor; if (!a46) return void s18(new Error("Can't fetch tile band without an actor")); let l21; const c28 = e56.B(String(o88), e56.B(this.tileID.key, t45)); let h8 = this._taskQueue.get(c28); h8 ? h8.add(s18) : (h8 = /* @__PURE__ */ new Set(), h8.add(s18), this._taskQueue.set(c28, h8)); const d34 = (e57, t46) => { l21.complete(e57, t46), e57 ? s18(e57) : (h8.values().forEach(((e58) => e58(null, t46))), this._taskQueue.delete(c28)); }, u12 = (e57, t46) => { if (e57) return s18(e57); const o89 = a46.send("decodeRasterArray", { type: "raster-array", source: this.source, scope: this.scope, tileID: this.tileID, uid: this.uid, buffer: t46, task: l21 }, d34, void 0, true); if (null !== i26) { const e58 = this._workQueuePerLayer.get(i26) || []; e58.push((() => { o89 && o89.cancel(), l21.cancel(); })), this._workQueuePerLayer.has(i26) || this._workQueuePerLayer.set(i26, e58); } }; let _4; try { _4 = n45.getLayer(t45); } catch (e57) { if ("reloading" === this.state) return; throw e57; } if (!_4) return void s18(new Error(`Unknown sourceLayer "${t45}"`)); if (_4.hasDataForBand(o88)) return h8.values().forEach(((e57) => e57(null, null))), void this._taskQueue.delete(c28); const p9 = _4.getDataRange([o88]); if (l21 = n45.createDecodingTask(p9), !l21 || l21.tasks.length) if (null !== i26 && this.flushQueues(i26), this.entireBuffer) u12(null, this.entireBuffer.slice(p9.firstByte, p9.lastByte + 1)); else { const t46 = Object.assign({}, this.requestParams, { headers: { Range: `bytes=${p9.firstByte}-${p9.lastByte}` } }), o89 = e56.bu(t46, u12); if (null !== i26) { const e57 = this._fetchQueuePerLayer.get(i26) || []; e57.push((() => { o89.cancel(), l21.cancel(); })), this._fetchQueuePerLayer.has(i26) || this._fetchQueuePerLayer.set(i26, e57); } } } updateNeeded(e57, t45) { return (!this.textureDescriptorPerLayer.get(e57) || this.textureDescriptorPerLayer.get(e57).band !== t45 || this.refreshedUponExpiration) && "errored" !== this.state; } updateTextureDescriptor(t45, i26, o88) { if (!this._mrt) return; const s18 = this._mrt.getLayer(t45); if (!s18 || !s18.hasBand(o88) || !s18.hasDataForBand(o88)) return; const { bytes: r86, tileSize: n45, buffer: a46, offset: l21, scale: c28 } = s18.getBandView(o88), h8 = n45 + 2 * a46, d34 = new e56.q({ width: h8, height: h8 }, r86), u12 = this.texturePerLayer.get(i26); u12 && u12 instanceof e56.T && u12.update(d34, { premultiply: false }), this.textureDescriptorPerLayer.set(i26, { layer: t45, band: o88, img: d34, buffer: a46, offset: l21, tileSize: n45, format: s18.pixelFormat, mix: [c28, 256 * c28, 65536 * c28, 16777216 * c28] }); } destroy(t45 = false) { if (super.destroy(t45), delete this._mrt, !t45) for (const t46 of this.texturePerLayer.values()) t46 && t46 instanceof e56.T && t46.destroy(); this.texturePerLayer.clear(), this.textureDescriptorPerLayer.clear(), this.fbo && (this.fbo.destroy(), delete this.fbo), delete this.request, delete this.requestParams, this._isHeaderLoaded = false; } } class It { constructor(e57, t45) { this.max = e57, this.onRemove = t45, this.reset(); } reset() { for (const e57 in this.data) for (const t45 of this.data[e57]) t45.timeout && clearTimeout(t45.timeout), this.onRemove(t45.value); return this.data = {}, this.order = [], this; } add(e57, t45, i26) { const o88 = e57.wrapped().key; void 0 === this.data[o88] && (this.data[o88] = []); const s18 = { value: t45, timeout: void 0 }; if (void 0 !== i26 && (s18.timeout = setTimeout((() => { this.remove(e57, s18); }), i26)), this.data[o88].push(s18), this.order.push(o88), this.order.length > this.max) { const e58 = this._getAndRemoveByKey(this.order[0]); e58 && this.onRemove(e58); } return this; } has(e57) { return e57.wrapped().key in this.data; } getAndRemove(e57) { return this.has(e57) ? this._getAndRemoveByKey(e57.wrapped().key) : null; } _getAndRemoveByKey(e57) { const t45 = this.data[e57].shift(); return t45.timeout && clearTimeout(t45.timeout), 0 === this.data[e57].length && delete this.data[e57], this.order.splice(this.order.indexOf(e57), 1), t45.value; } getByKey(e57) { const t45 = this.data[e57]; return t45 ? t45[0].value : null; } get(e57) { return this.has(e57) ? this.data[e57.wrapped().key][0].value : null; } remove(e57, t45) { if (!this.has(e57)) return this; const i26 = e57.wrapped().key, o88 = void 0 === t45 ? 0 : this.data[i26].indexOf(t45), s18 = this.data[i26][o88]; return this.data[i26].splice(o88, 1), s18.timeout && clearTimeout(s18.timeout), 0 === this.data[i26].length && delete this.data[i26], this.onRemove(s18.value), this.order.splice(this.order.indexOf(i26), 1), this; } setMaxSize(e57) { for (this.max = e57; this.order.length > this.max; ) { const e58 = this._getAndRemoveByKey(this.order[0]); e58 && this.onRemove(e58); } return this; } filter(e57) { const t45 = []; for (const i26 in this.data) for (const o88 of this.data[i26]) e57(o88.value) || t45.push(o88); for (const e58 of t45) this.remove(e58.value.tileID, e58); } } class Ct { constructor() { this.state = {}, this.stateChanges = {}, this.deletedStates = {}; } updateState(e57, t45, i26) { const o88 = String(t45); if (this.stateChanges[e57] = this.stateChanges[e57] || {}, this.stateChanges[e57][o88] = this.stateChanges[e57][o88] || {}, Object.assign(this.stateChanges[e57][o88], i26), null === this.deletedStates[e57]) { this.deletedStates[e57] = {}; for (const t46 in this.state[e57]) t46 !== o88 && (this.deletedStates[e57][t46] = null); } else if (this.deletedStates[e57] && null === this.deletedStates[e57][o88]) { this.deletedStates[e57][o88] = {}; for (const t46 in this.state[e57][o88]) i26[t46] || (this.deletedStates[e57][o88][t46] = null); } else for (const t46 in i26) this.deletedStates[e57] && this.deletedStates[e57][o88] && null === this.deletedStates[e57][o88][t46] && delete this.deletedStates[e57][o88][t46]; } removeFeatureState(e57, t45, i26) { if (null === this.deletedStates[e57]) return; const o88 = String(t45); if (this.deletedStates[e57] = this.deletedStates[e57] || {}, i26 && void 0 !== t45) null !== this.deletedStates[e57][o88] && (this.deletedStates[e57][o88] = this.deletedStates[e57][o88] || {}, this.deletedStates[e57][o88][i26] = null); else if (void 0 !== t45) if (this.stateChanges[e57] && this.stateChanges[e57][o88]) for (i26 in this.deletedStates[e57][o88] = {}, this.stateChanges[e57][o88]) this.deletedStates[e57][o88][i26] = null; else this.deletedStates[e57][o88] = null; else this.deletedStates[e57] = null; } getState(e57, t45) { const i26 = this.state[e57] || {}, o88 = this.stateChanges[e57] || {}, s18 = this.deletedStates[e57]; if (null === s18) return {}; if (void 0 !== t45) { const e58 = String(t45), r87 = Object.assign({}, i26[e58], o88[e58]); if (s18) { const e59 = s18[t45]; if (null === e59) return {}; for (const t46 in e59) delete r87[t46]; } return r87; } const r86 = Object.assign({}, i26, o88); if (s18) for (const e58 in s18) delete r86[e58]; return r86; } initializeTileState(e57, t45) { e57.refreshFeatureState(t45); } coalesceChanges(e57, t45) { const i26 = {}; for (const e58 in this.stateChanges) { this.state[e58] = this.state[e58] || {}; const t46 = {}; for (const i27 in this.stateChanges[e58]) this.state[e58][i27] || (this.state[e58][i27] = {}), Object.assign(this.state[e58][i27], this.stateChanges[e58][i27]), t46[i27] = this.state[e58][i27]; i26[e58] = t46; } for (const e58 in this.deletedStates) { this.state[e58] = this.state[e58] || {}; const t46 = {}; if (null === this.deletedStates[e58]) for (const i27 in this.state[e58]) t46[i27] = {}, this.state[e58][i27] = {}; else for (const i27 in this.deletedStates[e58]) { if (null === this.deletedStates[e58][i27]) this.state[e58][i27] = {}; else if (this.state[e58][i27]) for (const t47 of Object.keys(this.deletedStates[e58][i27])) delete this.state[e58][i27][t47]; t46[i27] = this.state[e58][i27]; } i26[e58] = i26[e58] || {}, Object.assign(i26[e58], t46); } if (this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(i26).length) for (const i27 in e57) e57[i27].refreshFeatureState(t45); } } class Rt2 extends e56.E { constructor(e57, t45, i26) { super(), this.id = e57, this._onlySymbols = i26, t45.on("data", ((e58) => { "source" === e58.dataType && "metadata" === e58.sourceDataType && (this._sourceLoaded = true), this._sourceLoaded && !this._paused && "source" === e58.dataType && "content" === e58.sourceDataType && (this.reload(), this.transform && this.update(this.transform)); })), t45.on("error", (() => { this._sourceErrored = true; })), this._source = t45, this._tiles = {}, this._cache = new It(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._minTileCacheSize = t45.minTileCacheSize, this._maxTileCacheSize = t45.maxTileCacheSize, this._loadedParentTiles = {}, this.castsShadows = false, this.tileCoverLift = 0, this._coveredTiles = {}, this._shadowCasterTiles = {}, this._state = new Ct(), this._isRaster = "raster" === this._source.type || "raster-dem" === this._source.type || "raster-array" === this._source.type || "custom" === this._source.type && "raster" === this._source._dataType; } onAdd(e57) { this.map = e57, this._minTileCacheSize = void 0 === this._minTileCacheSize && e57 ? e57._minTileCacheSize : this._minTileCacheSize, this._maxTileCacheSize = void 0 === this._maxTileCacheSize && e57 ? e57._maxTileCacheSize : this._maxTileCacheSize; } loaded() { if (this._sourceErrored) return true; if (!this._sourceLoaded) return false; if (!this._source.loaded()) return false; for (const e57 in this._tiles) if (!this._tiles[e57].loaded()) return false; return true; } getSource() { return this._source; } pause() { this._paused = true; } resume() { if (!this._paused) return; const e57 = this._shouldReloadOnResume; this._paused = false, this._shouldReloadOnResume = false, e57 && this.reload(), this.transform && this.update(this.transform); } _loadTile(e57, t45) { return e57.isSymbolTile = this._onlySymbols, e57.isExtraShadowCaster = this._shadowCasterTiles[e57.tileID.key], this._source.loadTile(e57, t45); } _unloadTile(e57) { if (this._source.unloadTile) return this._source.unloadTile(e57); } _abortTile(e57) { if (this._source.abortTile) return this._source.abortTile(e57); } serialize() { return this._source.serialize(); } prepare(e57) { this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null); for (const t45 in this._tiles) { const i26 = this._tiles[t45]; i26.upload(e57), i26.prepare(this.map.style.imageManager, this.map ? this.map.painter : null, this._source.scope); } } getIds() { return Object.values(this._tiles).map(((e57) => e57.tileID)).sort(At).map(((e57) => e57.key)); } getRenderableIds(t45, i26) { const o88 = []; for (const e57 in this._tiles) this._isIdRenderable(+e57, t45, i26) && o88.push(this._tiles[e57]); return t45 ? o88.sort(((t46, i27) => { const o89 = t46.tileID, s18 = i27.tileID, r86 = new e56.P(o89.canonical.x, o89.canonical.y)._rotate(this.transform.angle), n45 = new e56.P(s18.canonical.x, s18.canonical.y)._rotate(this.transform.angle); return o89.overscaledZ - s18.overscaledZ || n45.y - r86.y || n45.x - r86.x; })).map(((e57) => e57.tileID.key)) : o88.map(((e57) => e57.tileID)).sort(At).map(((e57) => e57.key)); } hasRenderableParent(e57) { const t45 = this.findLoadedParent(e57, 0); return !!t45 && this._isIdRenderable(t45.tileID.key); } _isIdRenderable(e57, t45, i26) { return this._tiles[e57] && this._tiles[e57].hasData() && !this._coveredTiles[e57] && (t45 || !this._tiles[e57].holdingForFade()) && (i26 || !this._shadowCasterTiles[e57]); } reload() { if (this._paused) this._shouldReloadOnResume = true; else { this._cache.reset(); for (const e57 in this._tiles) "errored" !== this._tiles[e57].state && this._reloadTile(+e57, "reloading"); } } _reloadTile(e57, t45) { const i26 = this._tiles[e57]; i26 && ("loading" !== i26.state && (i26.state = t45), this._loadTile(i26, this._tileLoaded.bind(this, i26, e57, t45))); } _tileLoaded(t45, i26, o88, s18) { if (s18) if (t45.state = "errored", 404 !== s18.status) this._source.fire(new e56.y(s18, { tile: t45 })); else { if (this._source.fire(new e56.z("data", { dataType: "source", sourceDataType: "error", sourceId: this._source.id, tile: t45 })), !(t45.tileID.key in this._loadedParentTiles)) return; if ("raster-dem" === this._source.type && this.usedForTerrain && this.map.painter.terrain) { const e57 = this.map.painter.terrain; this.update(this.transform, e57.getScaledDemTileSize(), true), e57.resetTileLookupCache(this.id); } else this.update(this.transform); } else t45.timeAdded = e56.o.now(), "expired" === o88 && (t45.refreshedUponExpiration = true), this._setTileReloadTimer(i26, t45), "raster-dem" === this._source.type && t45.dem && this._backfillDEM(t45), this._state.initializeTileState(t45, this.map ? this.map.painter : null), this._source.fire(new e56.z("data", { dataType: "source", tile: t45, coord: t45.tileID, sourceCacheId: this.id })); } _backfillDEM(e57) { const t45 = this.getRenderableIds(); for (let o88 = 0; o88 < t45.length; o88++) { const s18 = t45[o88]; if (e57.neighboringTiles && e57.neighboringTiles[s18]) { const t46 = this.getTileByID(s18); i26(e57, t46), i26(t46, e57); } } function i26(e58, t46) { if (!e58.dem || e58.dem.borderReady) return; e58.needsHillshadePrepare = true, e58.needsDEMTextureUpload = true; let i27 = t46.tileID.canonical.x - e58.tileID.canonical.x; const o88 = t46.tileID.canonical.y - e58.tileID.canonical.y, s18 = Math.pow(2, e58.tileID.canonical.z), r86 = t46.tileID.key; 0 === i27 && 0 === o88 || Math.abs(o88) > 1 || (Math.abs(i27) > 1 && (1 === Math.abs(i27 + s18) ? i27 += s18 : 1 === Math.abs(i27 - s18) && (i27 -= s18)), t46.dem && e58.dem && (e58.dem.backfillBorder(t46.dem, i27, o88), e58.neighboringTiles && e58.neighboringTiles[r86] && (e58.neighboringTiles[r86].backfilled = true))); } } getTile(e57) { return this.getTileByID(e57.key); } getTileByID(e57) { return this._tiles[e57]; } _retainLoadedChildren(e57, t45, i26, o88) { for (const s18 in this._tiles) { let r86 = this._tiles[s18]; if (o88[s18] || !r86.hasData() || r86.tileID.overscaledZ <= t45 || r86.tileID.overscaledZ > i26) continue; let n45 = r86.tileID; for (; r86 && r86.tileID.overscaledZ > t45 + 1; ) { const e58 = r86.tileID.scaledTo(r86.tileID.overscaledZ - 1); r86 = this._tiles[e58.key], r86 && r86.hasData() && (n45 = e58); } let a46 = n45; for (; a46.overscaledZ > t45; ) if (a46 = a46.scaledTo(a46.overscaledZ - 1), e57[a46.key]) { o88[n45.key] = n45; break; } } } findLoadedParent(e57, t45) { if (e57.key in this._loadedParentTiles) { const i26 = this._loadedParentTiles[e57.key]; return i26 && i26.tileID.overscaledZ >= t45 ? i26 : null; } for (let i26 = e57.overscaledZ - 1; i26 >= t45; i26--) { const t46 = e57.scaledTo(i26), o88 = this._getLoadedTile(t46); if (o88) return o88; } } _getLoadedTile(e57) { const t45 = this._tiles[e57.key]; return t45 && t45.hasData() ? t45 : this._cache.getByKey(this._source.reparseOverscaled ? e57.wrapped().key : e57.canonical.key); } updateCacheSize(e57, t45) { t45 = t45 || this._source.tileSize; const i26 = Math.ceil(e57.width / t45) + 1, o88 = Math.ceil(e57.height / t45) + 1, s18 = Math.floor(i26 * o88 * 5), r86 = "number" == typeof this._minTileCacheSize ? Math.max(this._minTileCacheSize, s18) : s18, n45 = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, r86) : r86; this._cache.setMaxSize(n45); } handleWrapJump(e57) { const t45 = Math.round((e57 - (void 0 === this._prevLng ? e57 : this._prevLng)) / 360); if (this._prevLng = e57, t45) { const e58 = {}; for (const i26 in this._tiles) { const o88 = this._tiles[i26]; o88.tileID = o88.tileID.unwrapTo(o88.tileID.wrap + t45), e58[o88.tileID.key] = o88; } this._tiles = e58; for (const e59 in this._timers) clearTimeout(this._timers[e59]), delete this._timers[e59]; for (const e59 in this._tiles) this._setTileReloadTimer(+e59, this._tiles[e59]); } } update(t45, i26, o88, s18, r86) { if (this.transform = t45, !this._sourceLoaded || this._paused || this.transform.freezeTileCoverage) return; if (this.usedForTerrain && !o88) return; this.updateCacheSize(t45, i26), "globe" !== this.transform.projection.name && this.handleWrapJump(this.transform.center.lng), this._shadowCasterTiles = {}, this._coveredTiles = {}; const n45 = "batched-model" === this._source.type; let a46, l21 = this._source.maxzoom; const c28 = this.map && this.map.painter ? this.map.painter._terrain : null; if (c28 && c28.sourceCache === this && c28.attenuationRange()) { const e57 = c28.attenuationRange()[0], t46 = Math.floor(e57) - Math.log2(c28.getDemUpscale()); l21 > t46 && (l21 = t46); } if (this.used || this.usedForTerrain) { if (this._source.tileID) a46 = t45.getVisibleUnwrappedCoordinates(this._source.tileID).map(((t46) => new e56.aO(t46.canonical.z, t46.wrap, t46.canonical.z, t46.canonical.x, t46.canonical.y))); else if (0 !== this.tileCoverLift) { const s19 = t45.clone(); s19.tileCoverLift = this.tileCoverLift, a46 = s19.coveringTiles({ tileSize: i26 || this._source.tileSize, minzoom: this._source.minzoom, maxzoom: l21, roundZoom: this._source.roundZoom && !o88, reparseOverscaled: this._source.reparseOverscaled, isTerrainDEM: this.usedForTerrain, calculateQuadrantVisibility: n45 }), this._source.minzoom <= 1 && "globe" === t45.projection.name && (a46.push(new e56.aO(1, 0, 1, 0, 0)), a46.push(new e56.aO(1, 0, 1, 1, 0)), a46.push(new e56.aO(1, 0, 1, 0, 1)), a46.push(new e56.aO(1, 0, 1, 1, 1))); } else if (a46 = t45.coveringTiles({ tileSize: i26 || this._source.tileSize, minzoom: this._source.minzoom, maxzoom: l21, roundZoom: this._source.roundZoom && !o88, reparseOverscaled: this._source.reparseOverscaled, isTerrainDEM: this.usedForTerrain, calculateQuadrantVisibility: n45 }), this._source.hasTile) { const e57 = this._source.hasTile.bind(this._source); a46 = a46.filter(((t46) => e57(t46))); } } else a46 = []; if (a46.length > 0 && "globe" !== this.transform.projection.name && !this.usedForTerrain && !Dt(this._source.type)) { const e57 = t45.coveringZoomLevel({ tileSize: i26 || this._source.tileSize, roundZoom: this._source.roundZoom && !o88 }), l22 = Math.min(e57, this._source.maxzoom); if (n45) { const e58 = t45.extendTileCover(a46, l22); for (const t46 of e58) a46.push(t46); } else if (r86) { const e58 = t45.extendTileCoverToNearPlane(a46, this.transform.getFrustum(l22), l22); for (const t46 of e58) a46.push(t46); } else if (this.castsShadows && s18) { const e58 = t45.extendTileCover(a46, l22, s18); for (const t46 of e58) this._shadowCasterTiles[t46.key] = true, a46.push(t46); } } const h8 = this._updateRetainedTiles(a46); if (Dt(this._source.type) && 0 !== a46.length) { const t46 = {}, i27 = {}, o89 = Object.keys(h8); for (const s20 of o89) { const o90 = h8[s20], r87 = this._tiles[s20]; if (!r87 || r87.fadeEndTime && r87.fadeEndTime <= e56.o.now()) continue; const n46 = this.findLoadedParent(o90, Math.max(o90.overscaledZ - Rt2.maxOverzooming, this._source.minzoom)); n46 && (this._addTile(n46.tileID), t46[n46.tileID.key] = n46.tileID), i27[s20] = o90; } const s19 = a46[a46.length - 1].overscaledZ; for (const e57 in this._tiles) { const t47 = this._tiles[e57]; if (h8[e57] || !t47.hasData()) continue; let o90 = t47.tileID; for (; o90.overscaledZ > s19; ) { o90 = o90.scaledTo(o90.overscaledZ - 1); const s20 = this._tiles[o90.key]; if (s20 && s20.hasData() && i27[o90.key]) { h8[e57] = t47.tileID; break; } } } for (const e57 in t46) h8[e57] || (this._coveredTiles[e57] = true, h8[e57] = t46[e57]); } for (const e57 in h8) this._tiles[e57].clearFadeHold(); const d34 = e56.bv(this._tiles, h8); for (const e57 of d34) { const t46 = this._tiles[e57]; t46.hasSymbolBuckets && !t46.holdingForFade() ? t46.setHoldDuration(this.map._fadeDuration) : t46.hasSymbolBuckets && !t46.symbolFadeFinished() || this._removeTile(+e57); } this._updateLoadedParentTileCache(), this._onlySymbols && this._source.afterUpdate && this._source.afterUpdate(); } releaseSymbolFadeTiles() { for (const e57 in this._tiles) this._tiles[e57].holdingForFade() && this._removeTile(+e57); } _updateRetainedTiles(e57) { const t45 = {}; if (0 === e57.length) return t45; const i26 = {}, o88 = e57.reduce(((e58, t46) => Math.min(e58, t46.overscaledZ)), 1 / 0), s18 = e57[0].overscaledZ, r86 = Math.max(s18 - Rt2.maxOverzooming, this._source.minzoom), n45 = Math.max(s18 + Rt2.maxUnderzooming, this._source.minzoom), a46 = {}; for (const i27 of e57) { const e58 = this._addTile(i27); t45[i27.key] = i27, e58.hasData() || o88 < this._source.maxzoom && (a46[i27.key] = i27); } this._retainLoadedChildren(a46, o88, n45, t45); for (const o89 of e57) { let e58 = this._tiles[o89.key]; if (e58.hasData()) continue; if (o89.canonical.z >= this._source.maxzoom) { const e59 = o89.children(this._source.maxzoom)[0], i27 = this.getTile(e59); if (i27 && i27.hasData()) { t45[e59.key] = e59; continue; } } else { const e59 = o89.children(this._source.maxzoom); if (t45[e59[0].key] && t45[e59[1].key] && t45[e59[2].key] && t45[e59[3].key]) continue; } let s19 = e58.wasRequested(); for (let n46 = o89.overscaledZ - 1; n46 >= r86; --n46) { const r87 = o89.scaledTo(n46); if (i26[r87.key]) break; if (i26[r87.key] = true, e58 = this.getTile(r87), !e58 && s19 && (e58 = this._addTile(r87)), e58 && (t45[r87.key] = r87, s19 = e58.wasRequested(), e58.hasData())) break; } } return t45; } _updateLoadedParentTileCache() { this._loadedParentTiles = {}; for (const e57 in this._tiles) { const t45 = []; let i26, o88 = this._tiles[e57].tileID; for (; o88.overscaledZ > 0; ) { if (o88.key in this._loadedParentTiles) { i26 = this._loadedParentTiles[o88.key]; break; } t45.push(o88.key); const e58 = o88.scaledTo(o88.overscaledZ - 1); if (i26 = this._getLoadedTile(e58), i26) break; o88 = e58; } for (const e58 of t45) this._loadedParentTiles[e58] = i26; } } _addTile(t45) { let i26 = this._tiles[t45.key]; if (i26) return true !== i26.isExtraShadowCaster || !!this._shadowCasterTiles[t45.key] || this._reloadTile(t45.key, "reloading"), i26; i26 = this._cache.getAndRemove(t45), i26 && (this._setTileReloadTimer(t45.key, i26), i26.tileID = t45, this._state.initializeTileState(i26, this.map ? this.map.painter : null), this._cacheTimers[t45.key] && (clearTimeout(this._cacheTimers[t45.key]), delete this._cacheTimers[t45.key], this._setTileReloadTimer(t45.key, i26))); const o88 = Boolean(i26); if (!o88) { const e57 = this.map ? this.map.painter : null, o89 = this._source.tileSize * t45.overscaleFactor(); i26 = "raster-array" === this._source.type ? new St(t45, o89, this.transform.tileZoom, e57, this._isRaster) : new Et(t45, o89, this.transform.tileZoom, e57, this._isRaster, this._source.worldview), this._loadTile(i26, this._tileLoaded.bind(this, i26, t45.key, i26.state)); } return i26.uses++, this._tiles[t45.key] = i26, o88 || this._source.fire(new e56.z("dataloading", { tile: i26, coord: i26.tileID, dataType: "source" })), i26; } _setTileReloadTimer(e57, t45) { e57 in this._timers && (clearTimeout(this._timers[e57]), delete this._timers[e57]); const i26 = t45.getExpiryTimeout(); i26 && (this._timers[e57] = setTimeout((() => { this._reloadTile(e57, "expired"), delete this._timers[e57]; }), i26)); } _removeTile(e57) { const t45 = this._tiles[e57]; t45 && (t45.uses--, delete this._tiles[e57], this._timers[e57] && (clearTimeout(this._timers[e57]), delete this._timers[e57]), t45.uses > 0 || (t45.hasData() && "reloading" !== t45.state || "empty" === t45.state ? this._cache.add(t45.tileID, t45, t45.getExpiryTimeout()) : (t45.aborted = true, this._abortTile(t45), this._unloadTile(t45)))); } clearTiles() { this._shouldReloadOnResume = false, this._paused = false; for (const e57 in this._tiles) this._removeTile(+e57); this._source._clear && this._source._clear(), this._cache.reset(), this.map && this.usedForTerrain && this.map.painter.terrain && this.map.painter.terrain.resetTileLookupCache(this.id); } tilesIn(t45, i26, o88) { const s18 = [], r86 = this.transform; if (!r86) return s18; const n45 = "globe" === r86.projection.name, a46 = e56.aF(r86.center.lng); for (const l21 in this._tiles) { const c28 = this._tiles[l21]; if (o88 && c28.clearQueryDebugViz(), c28.holdingForFade()) continue; let h8; if (n45) { const t46 = c28.tileID.canonical; if (0 === t46.z) { const i27 = [Math.abs(e56.aA(a46, ...Lt2(t46, -1)) - a46), Math.abs(e56.aA(a46, ...Lt2(t46, 1)) - a46)]; h8 = [0, 2 * i27.indexOf(Math.min(...i27)) - 1]; } else { const i27 = [Math.abs(e56.aA(a46, ...Lt2(t46, -1)) - a46), Math.abs(e56.aA(a46, ...Lt2(t46, 0)) - a46), Math.abs(e56.aA(a46, ...Lt2(t46, 1)) - a46)]; h8 = [i27.indexOf(Math.min(...i27)) - 1]; } } else h8 = [0]; for (const e57 of h8) { const o89 = t45.containsTile(c28, r86, i26, e57); o89 && s18.push(o89); } } return s18; } getShadowCasterCoordinates() { return this._getRenderableCoordinates(false, true); } getVisibleCoordinates(e57) { return this._getRenderableCoordinates(e57); } _getRenderableCoordinates(e57, t45) { const i26 = this.getRenderableIds(e57, t45).map(((e58) => this._tiles[e58].tileID)), o88 = "globe" === this.transform.projection.name; for (const e58 of i26) e58.projMatrix = this.transform.calculateProjMatrix(e58.toUnwrapped()), e58.expandedProjMatrix = o88 ? this.transform.calculateProjMatrix(e58.toUnwrapped(), false, true) : e58.projMatrix; return i26; } sortCoordinatesByDistance(e57) { const t45 = e57.slice(), i26 = this.transform._camera.position, o88 = this.transform._camera.forward(), s18 = {}; for (const e58 of t45) { const t46 = 1 / (1 << e58.canonical.z); s18[e58.key] = ((e58.canonical.x + 0.5) * t46 + e58.wrap - i26[0]) * o88[0] + ((e58.canonical.y + 0.5) * t46 - i26[1]) * o88[1] - i26[2] * o88[2]; } return t45.sort(((e58, t46) => s18[e58.key] - s18[t46.key])), t45; } hasTransition() { if (this._source.hasTransition()) return true; if (Dt(this._source.type)) for (const t45 in this._tiles) { const i26 = this._tiles[t45]; if (void 0 !== i26.fadeEndTime && i26.fadeEndTime >= e56.o.now()) return true; } return false; } setFeatureState(e57, t45, i26) { this._state.updateState(e57 = e57 || "_geojsonTileLayer", t45, i26); } removeFeatureState(e57, t45, i26) { this._state.removeFeatureState(e57 = e57 || "_geojsonTileLayer", t45, i26); } getFeatureState(e57, t45) { return this._state.getState(e57 = e57 || "_geojsonTileLayer", t45); } setDependencies(e57, t45, i26) { const o88 = this._tiles[e57]; o88 && o88.setDependencies(t45, i26); } reloadTilesForDependencies(e57, t45) { for (const i26 in this._tiles) this._tiles[i26].hasDependency(e57, t45) && this._reloadTile(+i26, "reloading"); this._cache.filter(((i26) => !i26.hasDependency(e57, t45))); } _preloadTiles(t45, i26) { if (!this._sourceLoaded) { const e57 = () => { this._sourceLoaded && (this._source.off("data", e57), this._preloadTiles(t45, i26)); }; return void this._source.on("data", e57); } const o88 = /* @__PURE__ */ new Map(), s18 = Array.isArray(t45) ? t45 : [t45], r86 = this.map.painter.terrain, n45 = this.usedForTerrain && r86 ? r86.getScaledDemTileSize() : this._source.tileSize; for (const e57 of s18) { const t46 = e57.coveringTiles({ tileSize: n45, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom && !this.usedForTerrain, reparseOverscaled: this._source.reparseOverscaled, isTerrainDEM: this.usedForTerrain }); for (const e58 of t46) o88.set(e58.key, e58); this.usedForTerrain && e57.updateElevation(false); } const a46 = Array.from(o88.values()); e56.bw(a46, ((e57, t46) => { const i27 = new Et(e57, this._source.tileSize * e57.overscaleFactor(), this.transform.tileZoom, this.map.painter, this._isRaster, this._source.worldview); this._loadTile(i27, ((e58) => { "raster-dem" === this._source.type && i27.dem && this._backfillDEM(i27), t46(e58, i27); })); }), i26); } } function At(e57, t45) { const i26 = Math.abs(2 * e57.wrap) - +(e57.wrap < 0), o88 = Math.abs(2 * t45.wrap) - +(t45.wrap < 0); return e57.overscaledZ - t45.overscaledZ || o88 - i26 || t45.canonical.y - e57.canonical.y || t45.canonical.x - e57.canonical.x; } function Dt(e57) { return "raster" === e57 || "image" === e57 || "video" === e57 || "custom" === e57; } function Lt2(e57, t45) { const i26 = 1 << e57.z; return [e57.x / i26 + t45, (e57.x + 1) / i26 + t45]; } Rt2.maxOverzooming = 10, Rt2.maxUnderzooming = 3; class Pt { constructor(e57) { this.style = e57, this.layersGotHidden = false, this.layers = []; } processLayersChanged() { this.layers = []; const e57 = false, t45 = false; for (const i26 in this.style._mergedLayers) { const o88 = this.style._mergedLayers[i26]; if ("fill-extrusion" === o88.type || "building" === o88.type) this.layers.push({ layer: o88, visible: e57, visibilityChanged: t45 }); else if ("model" === o88.type) { const i27 = this.style.getLayerSource(o88); i27 && "batched-model" === i27.type && this.layers.push({ layer: o88, visible: e57, visibilityChanged: t45 }); } } } onNewFrame(e57) { this.layersGotHidden = false; for (const t45 of this.layers) { const i26 = t45.layer; let o88 = false; "fill-extrusion" === i26.type ? o88 = !i26.isHidden(e57) && i26.paint.get("fill-extrusion-opacity") > 0 : "building" === i26.type ? o88 = !i26.isHidden(e57) && i26.paint.get("building-opacity") > 0 : "model" === i26.type && (o88 = !i26.isHidden(e57) && i26.paint.get("model-opacity").constantOr(1) > 0), this.layersGotHidden = this.layersGotHidden || !o88 && t45.visible, t45.visible = o88; } } updateZOffset(e57, t45) { this.currentBuildingBuckets = []; for (const e58 of this.layers) { const i27 = e58.layer, o88 = this.style.getLayerSourceCache(i27); let s18 = 1; "fill-extrusion" === i27.type ? s18 = e58.visible ? i27.paint.get("fill-extrusion-vertical-scale") : 0 : "building" === i27.type && (s18 = e58.visible ? i27.paint.get("building-vertical-scale") : 0); let r86 = o88 ? o88.getTile(t45) : null; if (!r86 && o88) for (const e59 in o88._tiles) { const i28 = o88._tiles[e59]; if (t45.canonical.isChildOf(i28.tileID.canonical)) { r86 = i28; break; } } this.currentBuildingBuckets.push({ bucket: r86 ? r86.getBucket(i27) : null, tileID: r86 ? r86.tileID : t45, verticalScale: s18 }); } e57.hasAnyZOffset = false; let i26 = false; for (let o88 = 0; o88 < e57.symbolInstances.length; o88++) { const s18 = e57.symbolInstances.get(o88), r86 = s18.zOffset, n45 = this._getHeightAtTileOffset(t45, s18.tileAnchorX, s18.tileAnchorY); s18.zOffset = n45 !== Number.NEGATIVE_INFINITY ? n45 : r86, i26 || r86 === s18.zOffset || (i26 = true), e57.hasAnyZOffset || 0 === s18.zOffset || (e57.hasAnyZOffset = true); } i26 && (e57.zOffsetBuffersNeedUpload = true, e57.zOffsetSortDirty = true); } _mapCoordToOverlappingTile(t45, i26, o88, s18) { let r86 = i26, n45 = o88; if (t45.canonical.z !== s18.canonical.z) { const a46 = s18.canonical, l21 = 1 / (1 << t45.canonical.z - a46.z); r86 = (i26 + t45.canonical.x * e56.al) * l21 - a46.x * e56.al | 0, n45 = (o88 + t45.canonical.y * e56.al) * l21 - a46.y * e56.al | 0; } return { tileX: r86, tileY: n45 }; } _getHeightAtTileOffset(e57, t45, i26) { let o88, s18; for (let r86 = 0; r86 < this.layers.length; ++r86) { const n45 = this.layers[r86].layer; if ("fill-extrusion" !== n45.type && "building" !== n45.type) continue; const { bucket: a46, tileID: l21, verticalScale: c28 } = this.currentBuildingBuckets[r86]; if (!a46) continue; const { tileX: h8, tileY: d34 } = this._mapCoordToOverlappingTile(e57, t45, i26, l21), u12 = a46.getHeightAtTileCoord(h8, d34); u12 && void 0 !== u12.height && (u12.hidden ? o88 = u12.height : s18 = Math.max(u12.height * c28, s18 || 0)); } if (void 0 !== s18) return s18; for (let s19 = 0; s19 < this.layers.length; ++s19) { const r86 = this.layers[s19]; if ("model" !== r86.layer.type || !r86.visible) continue; const { bucket: n45, tileID: a46 } = this.currentBuildingBuckets[s19]; if (!n45) continue; const { tileX: l21, tileY: c28 } = this._mapCoordToOverlappingTile(e57, t45, i26, a46), h8 = n45.getHeightAtTileCoord(l21, c28); if (h8 && !h8.hidden) return void 0 === h8.height && void 0 !== o88 ? Math.min(h8.maxHeight, o88) * h8.verticalScale : h8.height ? h8.height * h8.verticalScale : Number.NEGATIVE_INFINITY; } return this.layersGotHidden ? 0 : Number.NEGATIVE_INFINITY; } } function zt2(t45, i26) { const o88 = {}; for (const e57 in t45) "ref" !== e57 && (o88[e57] = t45[e57]); return e56.bx.forEach(((e57) => { e57 in i26 && (o88[e57] = i26[e57]); })), o88; } function Ot(e57) { e57 = e57.slice(); const t45 = /* @__PURE__ */ Object.create(null); for (let i26 = 0; i26 < e57.length; i26++) t45[e57[i26].id] = e57[i26]; for (let i26 = 0; i26 < e57.length; i26++) "ref" in e57[i26] && (e57[i26] = zt2(e57[i26], t45[e57[i26].ref])); return e57; } const Mt2 = { setStyle: "setStyle", addLayer: "addLayer", removeLayer: "removeLayer", setPaintProperty: "setPaintProperty", setLayoutProperty: "setLayoutProperty", setSlot: "setSlot", setFilter: "setFilter", addSource: "addSource", removeSource: "removeSource", setGeoJSONSourceData: "setGeoJSONSourceData", setLayerZoomRange: "setLayerZoomRange", setLayerProperty: "setLayerProperty", setCenter: "setCenter", setZoom: "setZoom", setBearing: "setBearing", setPitch: "setPitch", setSprite: "setSprite", setGlyphs: "setGlyphs", setTransition: "setTransition", setLight: "setLight", setTerrain: "setTerrain", setFog: "setFog", setSnow: "setSnow", setRain: "setRain", setCamera: "setCamera", setLights: "setLights", setProjection: "setProjection", addImport: "addImport", removeImport: "removeImport", updateImport: "updateImport", addIconset: "addIconset", removeIconset: "removeIconset" }; function Ft(e57, t45, i26) { i26.push({ command: Mt2.addSource, args: [e57, t45[e57]] }); } function Bt(e57, t45, i26) { t45.push({ command: Mt2.removeSource, args: [e57] }), i26[e57] = true; } function kt(e57, t45, i26, o88) { Bt(e57, i26, o88), Ft(e57, t45, i26); } function Nt(t45, i26, o88) { let s18; for (s18 in t45[o88]) if (t45[o88].hasOwnProperty(s18) && "data" !== s18 && !e56.by(t45[o88][s18], i26[o88][s18])) return false; for (s18 in i26[o88]) if (i26[o88].hasOwnProperty(s18) && "data" !== s18 && !e56.by(t45[o88][s18], i26[o88][s18])) return false; return true; } function Ut2(t45, i26, o88, s18, r86, n45) { let a46; for (a46 in i26 = i26 || {}, t45 = t45 || {}) t45.hasOwnProperty(a46) && (e56.by(t45[a46], i26[a46]) || o88.push({ command: n45, args: [s18, a46, i26[a46], r86] })); for (a46 in i26) i26.hasOwnProperty(a46) && !t45.hasOwnProperty(a46) && (e56.by(t45[a46], i26[a46]) || o88.push({ command: n45, args: [s18, a46, i26[a46], r86] })); } function jt(e57) { return e57.id; } function Vt(e57, t45) { return e57[t45.id] = t45, e57; } function Gt(t45, i26, o88) { const s18 = i26.createTileMatrix(t45, t45.worldSize, o88.toUnwrapped()); return e56.aB(new Float32Array(16), t45.projMatrix, s18); } function Ht2(e57, t45, i26) { if (t45.projection.name === i26.projection.name) return e57.projMatrix; const o88 = i26.clone(); return o88.setProjection(t45.projection), Gt(o88, t45.getProjection(), e57); } function qt(e57, t45, i26) { return t45.name === i26.projection.name ? e57.projMatrix : Gt(i26, t45, e57); } class Zt2 { constructor(e57, t45) { this.reset(e57, t45); } reset(e57, t45) { this.points = e57 || [], this._distances = [0]; for (let e58 = 1; e58 < this.points.length; e58++) this._distances[e58] = this._distances[e58 - 1] + this.points[e58].dist(this.points[e58 - 1]); this.length = this._distances[this._distances.length - 1], this.padding = Math.min(t45 || 0, 0.5 * this.length), this.paddedLength = this.length - 2 * this.padding; } lerp(t45) { if (1 === this.points.length) return this.points[0]; t45 = e56.aA(t45, 0, 1); let i26 = 1, o88 = this._distances[i26]; const s18 = t45 * this.paddedLength + this.padding; for (; o88 < s18 && i26 < this._distances.length; ) o88 = this._distances[++i26]; const r86 = i26 - 1, n45 = this._distances[r86], a46 = o88 - n45, l21 = a46 > 0 ? (s18 - n45) / a46 : 0; return this.points[r86].mult(1 - l21).add(this.points[i26].mult(l21)); } } class Wt { constructor(e57, t45, i26) { const o88 = this.boxCells = [], s18 = this.circleCells = []; this.xCellCount = Math.ceil(e57 / i26), this.yCellCount = Math.ceil(t45 / i26); for (let e58 = 0; e58 < this.xCellCount * this.yCellCount; e58++) o88.push([]), s18.push([]); this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = e57, this.height = t45, this.xScale = this.xCellCount / e57, this.yScale = this.yCellCount / t45, this.boxUid = 0, this.circleUid = 0; } keysLength() { return this.boxKeys.length + this.circleKeys.length; } insert(e57, t45, i26, o88, s18) { this._forEachCell(t45, i26, o88, s18, this._insertBoxCell, this.boxUid++), this.boxKeys.push(e57), this.bboxes.push(t45), this.bboxes.push(i26), this.bboxes.push(o88), this.bboxes.push(s18); } insertCircle(e57, t45, i26, o88) { this._forEachCell(t45 - o88, i26 - o88, t45 + o88, i26 + o88, this._insertCircleCell, this.circleUid++), this.circleKeys.push(e57), this.circles.push(t45), this.circles.push(i26), this.circles.push(o88); } _insertBoxCell(e57, t45, i26, o88, s18, r86) { this.boxCells[s18].push(r86); } _insertCircleCell(e57, t45, i26, o88, s18, r86) { this.circleCells[s18].push(r86); } _query(e57, t45, i26, o88, s18, r86) { if (i26 < 0 || e57 > this.width || o88 < 0 || t45 > this.height) return !s18 && []; const n45 = []; if (e57 <= 0 && t45 <= 0 && this.width <= i26 && this.height <= o88) { if (s18) return true; for (let e58 = 0; e58 < this.boxKeys.length; e58++) n45.push({ key: this.boxKeys[e58], x1: this.bboxes[4 * e58], y1: this.bboxes[4 * e58 + 1], x2: this.bboxes[4 * e58 + 2], y2: this.bboxes[4 * e58 + 3] }); for (let e58 = 0; e58 < this.circleKeys.length; e58++) { const t46 = this.circles[3 * e58], i27 = this.circles[3 * e58 + 1], o89 = this.circles[3 * e58 + 2]; n45.push({ key: this.circleKeys[e58], x1: t46 - o89, y1: i27 - o89, x2: t46 + o89, y2: i27 + o89 }); } return r86 ? n45.filter(r86) : n45; } return this._forEachCell(e57, t45, i26, o88, this._queryCell, n45, { hitTest: s18, seenUids: { box: {}, circle: {} } }, r86), s18 ? n45.length > 0 : n45; } _queryCircle(e57, t45, i26, o88, s18) { const r86 = e57 - i26, n45 = e57 + i26, a46 = t45 - i26, l21 = t45 + i26; if (n45 < 0 || r86 > this.width || l21 < 0 || a46 > this.height) return !o88 && []; const c28 = []; return this._forEachCell(r86, a46, n45, l21, this._queryCellCircle, c28, { hitTest: o88, circle: { x: e57, y: t45, radius: i26 }, seenUids: { box: {}, circle: {} } }, s18), o88 ? c28.length > 0 : c28; } query(e57, t45, i26, o88, s18) { return this._query(e57, t45, i26, o88, false, s18); } hitTest(e57, t45, i26, o88, s18) { return this._query(e57, t45, i26, o88, true, s18); } hitTestCircle(e57, t45, i26, o88) { return this._queryCircle(e57, t45, i26, true, o88); } _queryCell(e57, t45, i26, o88, s18, r86, n45, a46) { const l21 = n45.seenUids, c28 = this.boxCells[s18]; if (null !== c28) { const s19 = this.bboxes; for (const h9 of c28) if (!l21.box[h9]) { l21.box[h9] = true; const c29 = 4 * h9; if (e57 <= s19[c29 + 2] && t45 <= s19[c29 + 3] && i26 >= s19[c29 + 0] && o88 >= s19[c29 + 1] && (!a46 || a46(this.boxKeys[h9]))) { if (n45.hitTest) return r86.push(true), true; r86.push({ key: this.boxKeys[h9], x1: s19[c29], y1: s19[c29 + 1], x2: s19[c29 + 2], y2: s19[c29 + 3] }); } } } const h8 = this.circleCells[s18]; if (null !== h8) { const s19 = this.circles; for (const c29 of h8) if (!l21.circle[c29]) { l21.circle[c29] = true; const h9 = 3 * c29; if (this._circleAndRectCollide(s19[h9], s19[h9 + 1], s19[h9 + 2], e57, t45, i26, o88) && (!a46 || a46(this.circleKeys[c29]))) { if (n45.hitTest) return r86.push(true), true; { const e58 = s19[h9], t46 = s19[h9 + 1], i27 = s19[h9 + 2]; r86.push({ key: this.circleKeys[c29], x1: e58 - i27, y1: t46 - i27, x2: e58 + i27, y2: t46 + i27 }); } } } } } _queryCellCircle(e57, t45, i26, o88, s18, r86, n45, a46) { const l21 = n45.circle, c28 = n45.seenUids, h8 = this.boxCells[s18]; if (null !== h8) { const e58 = this.bboxes; for (const t46 of h8) if (!c28.box[t46]) { c28.box[t46] = true; const i27 = 4 * t46; if (this._circleAndRectCollide(l21.x, l21.y, l21.radius, e58[i27 + 0], e58[i27 + 1], e58[i27 + 2], e58[i27 + 3]) && (!a46 || a46(this.boxKeys[t46]))) return r86.push(true), true; } } const d34 = this.circleCells[s18]; if (null !== d34) { const e58 = this.circles; for (const t46 of d34) if (!c28.circle[t46]) { c28.circle[t46] = true; const i27 = 3 * t46; if (this._circlesCollide(e58[i27], e58[i27 + 1], e58[i27 + 2], l21.x, l21.y, l21.radius) && (!a46 || a46(this.circleKeys[t46]))) return r86.push(true), true; } } } _forEachCell(e57, t45, i26, o88, s18, r86, n45, a46) { const l21 = this._convertToXCellCoord(e57), c28 = this._convertToYCellCoord(t45), h8 = this._convertToXCellCoord(i26), d34 = this._convertToYCellCoord(o88); for (let u12 = l21; u12 <= h8; u12++) for (let l22 = c28; l22 <= d34; l22++) if (s18.call(this, e57, t45, i26, o88, this.xCellCount * l22 + u12, r86, n45, a46)) return; } _convertToXCellCoord(e57) { return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(e57 * this.xScale))); } _convertToYCellCoord(e57) { return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(e57 * this.yScale))); } _circlesCollide(e57, t45, i26, o88, s18, r86) { const n45 = o88 - e57, a46 = s18 - t45, l21 = i26 + r86; return l21 * l21 > n45 * n45 + a46 * a46; } _circleAndRectCollide(e57, t45, i26, o88, s18, r86, n45) { const a46 = (r86 - o88) / 2, l21 = Math.abs(e57 - (o88 + a46)); if (l21 > a46 + i26) return false; const c28 = (n45 - s18) / 2, h8 = Math.abs(t45 - (s18 + c28)); if (h8 > c28 + i26) return false; if (l21 <= a46 || h8 <= c28) return true; const d34 = l21 - a46, u12 = h8 - c28; return d34 * d34 + u12 * u12 <= i26 * i26; } } const $t = { unknown: 0, flipRequired: 1, flipNotRequired: 2 }, Xt = Math.tan(85 * Math.PI / 180); function Yt2(t45, i26, o88, s18, r86, n45, a46) { const l21 = e56.bC(); if (o88) if ("globe" === n45.name) { const t46 = e56.bD(r86, i26); e56.aB(l21, l21, t46); } else { const t46 = e56.bE([], a46); l21[0] = t46[0], l21[1] = t46[1], l21[4] = t46[2], l21[5] = t46[3], s18 || e56.bB(l21, l21, r86.angle); } else e56.aB(l21, r86.labelPlaneMatrix, t45); return l21; } function Kt2(e57, t45, i26, o88, s18, r86, n45) { const a46 = Yt2(e57, t45, i26, o88, s18, r86, n45); return "globe" === r86.name && i26 || (a46[2] = a46[6] = a46[10] = a46[14] = 0), a46; } function Jt2(t45, i26, o88, s18, r86, n45, a46) { if (o88) { if ("globe" === n45.name) { const l21 = Yt2(t45, i26, o88, s18, r86, n45, a46); return e56.bl(l21, l21), e56.aB(l21, t45, l21), l21; } { const i27 = e56.bz(t45), o89 = e56.bA([]); return o89[0] = a46[0], o89[1] = a46[1], o89[4] = a46[2], o89[5] = a46[3], e56.aB(i27, i27, o89), s18 || e56.bB(i27, i27, -r86.angle), i27; } } return r86.glCoordMatrix; } function Qt2(t45, i26, o88, s18) { const r86 = [t45, i26, o88, 1]; o88 ? e56.aC(r86, r86, s18) : hi(r86, r86, s18); const n45 = r86[3]; return r86[0] /= n45, r86[1] /= n45, r86[2] /= n45, r86; } function ei(e57, t45) { return Math.min(0.5 + e57 / t45 * 0.5, 1.5); } function ti(e57, t45) { const i26 = e57[0] / e57[3], o88 = e57[1] / e57[3]; return i26 >= -t45[0] && i26 <= t45[0] && o88 >= -t45[1] && o88 <= t45[1]; } function ii(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8) { const d34 = o88.transform, u12 = s18 ? t45.textSizeData : t45.iconSizeData, _4 = e56.bK(u12, o88.transform.zoom), p9 = "globe" === d34.projection.name, f8 = [256 / o88.width * 2 + 1, 256 / o88.height * 2 + 1], m6 = s18 ? t45.text.dynamicLayoutVertexArray : t45.icon.dynamicLayoutVertexArray; m6.clear(); let g9 = null; p9 && (g9 = s18 ? t45.text.globeExtVertexArray : t45.icon.globeExtVertexArray); const v8 = t45.lineVertexArray, y4 = s18 ? t45.text.placedSymbolArray : t45.icon.placedSymbolArray, x4 = o88.transform.width / o88.transform.height; let b8, w4 = false; for (let s19 = 0; s19 < y4.length; s19++) { const p10 = y4.get(s19), { numGlyphs: T5, writingMode: E5 } = p10; if (E5 !== e56.bL.vertical || w4 || b8 === e56.bL.horizontal || (w4 = true), b8 = E5, (p10.hidden || E5 === e56.bL.vertical) && !w4) { ci(T5, m6); continue; } w4 = false; const S5 = new e56.P(p10.tileAnchorX, p10.tileAnchorY); let { x: I4, y: C6, z: R5 } = d34.projection.projectTilePoint(S5.x, S5.y, h8.canonical); if (c28) { const [e57, t46, i27] = c28(S5); I4 += e57, C6 += t46, R5 += i27; } const A4 = [I4, C6, R5, 1]; if (e56.aC(A4, A4, i26), !ti(A4, f8)) { ci(T5, m6); continue; } const D5 = A4[3], L3 = ei(o88.transform.getCameraToCenterDistance(d34.projection), D5), P4 = e56.bM(u12, _4, p10), z4 = a46 ? P4 / L3 : P4 * L3, O4 = Qt2(I4, C6, R5, r86); if (O4[3] <= 0) { ci(T5, m6); continue; } let M5 = {}; const F17 = e56.an(t45.layers[0].layout.get("text-max-angle")), B6 = Math.cos(F17), k7 = a46 ? null : c28, N5 = ri(p10, z4, false, l21, i26, r86, n45, t45.glyphOffsetArray, v8, m6, g9, O4, S5, M5, x4, k7, d34.projection, h8, a46, B6); w4 = N5.useVertical, k7 && N5.needsFlipping && (M5 = {}), (N5.notEnoughRoom || w4 || N5.needsFlipping && ri(p10, z4, true, l21, i26, r86, n45, t45.glyphOffsetArray, v8, m6, g9, O4, S5, M5, x4, k7, d34.projection, h8, a46, B6).notEnoughRoom) && ci(T5, m6); } s18 ? (t45.text.dynamicLayoutVertexBuffer.updateData(m6), g9 && t45.text.globeExtVertexBuffer && t45.text.globeExtVertexBuffer.updateData(g9)) : (t45.icon.dynamicLayoutVertexBuffer.updateData(m6), g9 && t45.icon.globeExtVertexBuffer && t45.icon.globeExtVertexBuffer.updateData(g9)); } function oi(e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6) { const { lineStartIndex: g9, glyphStartIndex: v8, segment: y4 } = a46, x4 = v8 + a46.numGlyphs, b8 = g9 + a46.lineLength, w4 = t45.getoffsetX(v8), T5 = t45.getoffsetX(x4 - 1), E5 = li(e57 * w4, i26, o88, s18, r86, n45, y4, g9, b8, l21, c28, h8, d34, u12, true, _4, p9, f8, m6); if (!E5) return null; const S5 = li(e57 * T5, i26, o88, s18, r86, n45, y4, g9, b8, l21, c28, h8, d34, u12, true, _4, p9, f8, m6); return S5 ? { first: E5, last: S5 } : null; } function si(t45, i26, o88, s18) { return t45 === e56.bL.horizontal && Math.abs(s18) > Math.abs(o88) ? { useVertical: true } : t45 === e56.bL.vertical ? s18 > 0 ? { needsFlipping: true } : null : i26 !== $t.unknown && (function(e57, t46) { return 0 === e57 || Math.abs(t46 / e57) > Xt; })(o88, s18) ? i26 === $t.flipRequired ? { needsFlipping: true } : null : o88 < 0 ? { needsFlipping: true } : null; } function ri(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4, x4) { const b8 = i26 / 24, w4 = t45.lineOffsetX * b8, T5 = t45.lineOffsetY * b8, { lineStartIndex: E5, glyphStartIndex: S5, numGlyphs: I4, segment: C6, writingMode: R5, flipState: A4 } = t45, D5 = E5 + t45.lineLength, L3 = (t46) => { if (d34) { const [i28, o90, s20] = t46.up, r87 = h8.length; e56.bN(d34, r87 + 0, i28, o90, s20), e56.bN(d34, r87 + 1, i28, o90, s20), e56.bN(d34, r87 + 2, i28, o90, s20), e56.bN(d34, r87 + 3, i28, o90, s20); } const [i27, o89, s19] = t46.point; e56.bO(h8, i27, o89, s19, t46.angle); }; if (I4 > 1) { const e57 = oi(b8, l21, w4, T5, o88, u12, _4, t45, c28, n45, p9, m6, false, g9, v8, y4, x4); if (!e57) return { notEnoughRoom: true }; if (s18 && !o88) { let [i27, o89, s19] = e57.first.point, [r87, n46, l22] = e57.last.point; [i27, o89] = Qt2(i27, o89, s19, a46), [r87, n46] = Qt2(r87, n46, l22, a46); const c29 = si(R5, A4, (r87 - i27) * f8, n46 - o89); if (t45.flipState = c29 && c29.needsFlipping ? $t.flipRequired : $t.flipNotRequired, c29) return c29; } L3(e57.first); for (let e58 = S5 + 1; e58 < S5 + I4 - 1; e58++) { const t46 = li(b8 * l21.getoffsetX(e58), w4, T5, o88, u12, _4, C6, E5, D5, c28, n45, p9, m6, false, false, g9, v8, y4, x4); if (!t46) return h8.length -= 4 * (e58 - S5), { notEnoughRoom: true }; L3(t46); } L3(e57.last); } else { if (s18 && !o88) { const i28 = Qt2(_4.x, _4.y, 0, r86), o89 = E5 + C6 + 1, s19 = new e56.P(c28.getx(o89), c28.gety(o89)), n46 = Qt2(s19.x, s19.y, 0, r86), a47 = n46[3] > 0 ? n46 : ai(_4, s19, i28, 1, r86, void 0, g9, v8.canonical), l22 = si(R5, A4, (a47[0] - i28[0]) * f8, a47[1] - i28[1]); if (t45.flipState = l22 && l22.needsFlipping ? $t.flipRequired : $t.flipNotRequired, l22) return l22; } const i27 = li(b8 * l21.getoffsetX(S5), w4, T5, o88, u12, _4, C6, E5, D5, c28, n45, p9, m6, false, false, g9, v8, y4, x4); if (!i27) return { notEnoughRoom: true }; L3(i27); } return {}; } function ni(e57, t45, i26, o88, s18) { const { x: r86, y: n45, z: a46 } = o88.projectTilePoint(e57.x, e57.y, t45); if (!s18) return Qt2(r86, n45, a46, i26); const [l21, c28, h8] = s18(e57); return Qt2(r86 + l21, n45 + c28, a46 + h8, i26); } function ai(t45, i26, o88, s18, r86, n45, a46, l21) { const c28 = ni(t45.sub(i26)._unit()._add(t45), l21, r86, a46, n45); return e56.av(c28, o88, c28), e56.aw(c28, c28), e56.bH(c28, o88, c28, s18); } function li(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4) { const x4 = s18 ? t45 - i26 : t45 + i26; let b8 = x4 > 0 ? 1 : -1, w4 = 0; s18 && (b8 *= -1, w4 = Math.PI), b8 < 0 && (w4 += Math.PI); let T5 = l21 + a46 + (b8 > 0 ? 0 : 1) | 0, E5 = r86, S5 = r86, I4 = 0, C6 = 0; const R5 = Math.abs(x4), A4 = [], D5 = []; let L3 = n45, P4 = L3, z4 = e56.bF([]); const O4 = () => ai(P4, L3, S5, R5 - I4 + 1, d34, _4, m6, g9.canonical); for (; I4 + C6 <= R5; ) { if (T5 += b8, T5 < l21 || T5 >= c28) return null; if (S5 = E5, P4 = L3, A4.push(S5), p9 && D5.push(P4), L3 = new e56.P(h8.getx(T5), h8.gety(T5)), E5 = u12[T5], !E5) { const e57 = ni(L3, g9.canonical, d34, m6, _4); E5 = e57[3] > 0 ? u12[T5] = e57 : O4(); } I4 += C6; const t46 = e56.av([], E5, S5), i27 = e56.bG(S5, E5); if (o88 && i27 > 0 && C6 > 0 && e56.bJ(z4, t46) / (C6 * i27) < y4) return null; C6 = i27, z4 = t46; } f8 && _4 && (u12[T5] && (E5 = O4(), C6 = e56.bG(S5, E5), z4 = e56.av([], E5, S5)), u12[T5] = E5); const M5 = (R5 - I4) / C6, F17 = L3.sub(P4)._mult(M5)._add(P4), B6 = e56.bH([], S5, z4, M5); let k7 = [0, 0, 1], N5 = z4[0], U4 = z4[1]; if (v8 && (k7 = m6.upVector(g9.canonical, F17.x, F17.y), 0 !== k7[0] || 0 !== k7[1] || 1 !== k7[2])) { const t46 = [k7[2], 0, -k7[0]], i27 = e56.bI([], k7, t46); e56.aw(t46, t46), e56.aw(i27, i27), N5 = e56.bJ(z4, t46), U4 = e56.bJ(z4, i27); } if (o88) { const t46 = e56.bI([], k7, z4); e56.aw(t46, t46), e56.bH(B6, B6, t46, o88 * b8); } const j4 = w4 + Math.atan2(U4, N5); return A4.push(B6), p9 && D5.push(F17), { point: B6, angle: j4, path: A4, tilePath: D5, up: k7 }; } function ci(e57, t45) { const i26 = t45.length, o88 = i26 + 4 * e57; t45.resize(o88), t45.float32.fill(-1 / 0, 4 * i26, 4 * o88); } function hi(e57, t45, i26) { const o88 = t45[0], s18 = t45[1]; return e57[0] = i26[0] * o88 + i26[4] * s18 + i26[12], e57[1] = i26[1] * o88 + i26[5] * s18 + i26[13], e57[3] = i26[3] * o88 + i26[7] * s18 + i26[15], e57; } const di = 100; class ui { constructor(e57, t45, i26 = new Wt(e57.width + 200, e57.height + 200, 25), o88 = new Wt(e57.width + 200, e57.height + 200, 25)) { this.transform = e57, this.grid = i26, this.ignoredGrid = o88, this.pitchfactor = Math.cos(e57._pitch) * e57.cameraToCenterDistance, this.screenRightBoundary = e57.width + di, this.screenBottomBoundary = e57.height + di, this.gridRightBoundary = e57.width + 200, this.gridBottomBoundary = e57.height + 200, this.fogState = t45; } placeCollisionBox(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34) { let u12 = o88.projectedAnchorX, _4 = o88.projectedAnchorY, p9 = o88.projectedAnchorZ; const f8 = o88.tileAnchorX, m6 = o88.tileAnchorY, g9 = o88.elevation, v8 = o88.tileID, y4 = t45.getProjection(); if (g9 && v8) { const [e57, t46, i27] = y4.upVector(v8.canonical, o88.tileAnchorX, o88.tileAnchorY), s19 = y4.upVectorScale(v8.canonical, this.transform.center.lat, this.transform.worldSize).metersToTile; u12 += e57 * g9 * s19, _4 += t46 * g9 * s19, p9 += i27 * g9 * s19; } const x4 = "globe" === t45.projection.name, b8 = "globe" === t45.projection.name ? e56.aj(this.transform.zoom) : 0; if (v8 && x4 && b8 < 1 && !n45) { const t46 = 1 << v8.canonical.z, i27 = e56.bP(f8, m6); e56.bQ(i27, i27, 1 / e56.al), e56.bR(i27, i27, e56.bP(v8.canonical.x, v8.canonical.y)), e56.bQ(i27, i27, 1 / t46), e56.bS(i27, i27, e56.bP(s18[0], s18[1])), i27[0] = e56.bT(i27[0], -0.5, 0.5), e56.bQ(i27, i27, e56.al); const o89 = e56.bU(i27[0], i27[1], e56.al / (2 * Math.PI), 1); e56.aC(o89, o89, r86), u12 = e56.ak(u12, o89[0], b8), _4 = e56.ak(_4, o89[1], b8), p9 = e56.ak(p9, o89[2], b8); } const w4 = this.projectAndGetPerspectiveRatio(h8, u12, _4, p9, o88.tileID, "globe" === y4.name || !!g9 || this.transform.pitch > 0, y4), T5 = c28 * w4.perspectiveRatio, E5 = (o88.x1 * i26 + a46.x - o88.padding) * T5 + w4.point.x, S5 = (o88.y1 * i26 + a46.y - o88.padding) * T5 + w4.point.y, I4 = (o88.x2 * i26 + a46.x + o88.padding) * T5 + w4.point.x, C6 = (o88.y2 * i26 + a46.y + o88.padding) * T5 + w4.point.y, R5 = w4.perspectiveRatio <= 0.55 || w4.occluded; return !this.isInsideGrid(E5, S5, I4, C6) || !l21 && this.grid.hitTest(E5, S5, I4, C6, d34) || R5 ? { box: [], offscreen: false, occluded: w4.occluded } : { box: [E5, S5, I4, C6], offscreen: this.isOffscreen(E5, S5, I4, C6), occluded: false }; } placeCollisionCircles(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8) { const m6 = [], g9 = this.transform.elevation, v8 = t45.getProjection(), y4 = g9 ? g9.getAtTileOffsetFunc(f8, this.transform.center.lat, this.transform.worldSize, v8) : null, x4 = new e56.P(o88.tileAnchorX, o88.tileAnchorY); let { x: b8, y: w4, z: T5 } = v8.projectTilePoint(x4.x, x4.y, f8.canonical); if (y4) { const [e57, t46, i27] = y4(x4); b8 += e57, w4 += t46, T5 += i27; } const E5 = "globe" === v8.name, S5 = this.projectAndGetPerspectiveRatio(a46, b8, w4, T5, f8, E5 || !!g9 || this.transform.pitch > 0, v8), { perspectiveRatio: I4 } = S5, C6 = (d34 ? n45 / I4 : n45 * I4) / e56.bX, R5 = Qt2(b8, w4, T5, l21), A4 = o88.lineOffsetX * C6, D5 = o88.lineOffsetY * C6, L3 = e56.an(t45.layers[0].layout.get("text-max-angle")), P4 = Math.cos(L3), z4 = S5.signedDistanceFromCamera > 0 ? oi(C6, r86, A4, D5, false, R5, x4, o88, s18, l21, {}, g9 && !d34 ? y4 : null, d34 && !!g9, v8, f8, d34, P4) : null; let O4 = false, M5 = false, F17 = true; if (z4 && !S5.occluded) { const t46 = 0.5 * _4 * I4 + p9, o89 = new e56.P(-100, -100), s19 = new e56.P(this.screenRightBoundary, this.screenBottomBoundary), r87 = new Zt2(), { first: n46, last: a47 } = z4, l22 = n46.path.length; let d35 = []; for (let e57 = l22 - 1; e57 >= 1; e57--) d35.push(n46.path[e57]); for (let e57 = 1; e57 < a47.path.length; e57++) d35.push(a47.path[e57]); const f9 = 2.5 * t46; c28 && (d35 = d35.map((([e57, t47, i27], o90) => (y4 && !E5 && (i27 = y4(o90 < l22 - 1 ? n46.tilePath[l22 - 1 - o90] : a47.tilePath[o90 - l22 + 2])[2]), Qt2(e57, t47, i27, c28)))), d35.some(((e57) => e57[3] <= 0)) && (d35 = [])); let g10 = []; if (d35.length > 0) { let t47 = 1 / 0, i27 = -1 / 0, r88 = 1 / 0, n47 = -1 / 0; for (const e57 of d35) t47 = Math.min(t47, e57[0]), r88 = Math.min(r88, e57[1]), i27 = Math.max(i27, e57[0]), n47 = Math.max(n47, e57[1]); i27 >= o89.x && t47 <= s19.x && n47 >= o89.y && r88 <= s19.y && (g10 = [d35.map(((t48) => new e56.P(t48[0], t48[1])))], (t47 < o89.x || i27 > s19.x || r88 < o89.y || n47 > s19.y) && (g10 = e56.bV(g10, o89.x, o89.y, s19.x, s19.y))); } for (const e57 of g10) { r87.reset(e57, 0.25 * t46); let o90 = 0; o90 = r87.length <= 0.5 * t46 ? 1 : Math.ceil(r87.paddedLength / f9) + 1; for (let e58 = 0; e58 < o90; e58++) { const s20 = e58 / Math.max(o90 - 1, 1), n47 = r87.lerp(s20), a48 = n47.x + di, l23 = n47.y + di; m6.push(a48, l23, t46, 0); const c29 = a48 - t46, d36 = l23 - t46, _5 = a48 + t46, p10 = l23 + t46; if (F17 = F17 && this.isOffscreen(c29, d36, _5, p10), M5 = M5 || this.isInsideGrid(c29, d36, _5, p10), !i26 && this.grid.hitTestCircle(a48, l23, t46, u12) && (O4 = true, !h8)) return { circles: [], offscreen: false, collisionDetected: O4, occluded: false }; } } } return { circles: !h8 && O4 || !M5 ? [] : m6, offscreen: F17, collisionDetected: O4, occluded: S5.occluded }; } queryRenderedSymbols(t45) { if (0 === t45.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {}; const i26 = []; let o88 = 1 / 0, s18 = 1 / 0, r86 = -1 / 0, n45 = -1 / 0; for (const a47 of t45) { const t46 = new e56.P(a47.x + di, a47.y + di); o88 = Math.min(o88, t46.x), s18 = Math.min(s18, t46.y), r86 = Math.max(r86, t46.x), n45 = Math.max(n45, t46.y), i26.push(t46); } const a46 = this.grid.query(o88, s18, r86, n45).concat(this.ignoredGrid.query(o88, s18, r86, n45)), l21 = {}, c28 = {}; for (const t46 of a46) { const o89 = t46.key; if (void 0 === l21[o89.bucketInstanceId] && (l21[o89.bucketInstanceId] = {}), l21[o89.bucketInstanceId][o89.featureIndex]) continue; const s19 = [new e56.P(t46.x1, t46.y1), new e56.P(t46.x2, t46.y1), new e56.P(t46.x2, t46.y2), new e56.P(t46.x1, t46.y2)]; e56.bW(i26, s19) && (l21[o89.bucketInstanceId][o89.featureIndex] = true, void 0 === c28[o89.bucketInstanceId] && (c28[o89.bucketInstanceId] = []), c28[o89.bucketInstanceId].push(o89.featureIndex)); } return c28; } insertCollisionBox(e57, t45, i26, o88, s18) { (t45 ? this.ignoredGrid : this.grid).insert({ bucketInstanceId: i26, featureIndex: o88, collisionGroupID: s18 }, e57[0], e57[1], e57[2], e57[3]); } insertCollisionCircles(e57, t45, i26, o88, s18) { const r86 = t45 ? this.ignoredGrid : this.grid, n45 = { bucketInstanceId: i26, featureIndex: o88, collisionGroupID: s18 }; for (let t46 = 0; t46 < e57.length; t46 += 4) r86.insertCircle(n45, e57[t46], e57[t46 + 1], e57[t46 + 2]); } projectAndGetPerspectiveRatio(t45, i26, o88, s18, r86, n45, a46) { const l21 = [i26, o88, s18, 1]; let c28 = false; if (s18 || this.transform.pitch > 0) { if (e56.aC(l21, l21, t45), this.fogState && r86 && "globe" !== a46.name) { const t46 = (function(t47, i27, o89, s19, r87, n46) { const a47 = n46.calculateFogTileMatrix(r87), l22 = [i27, o89, s19]; return e56.af(l22, l22, a47), ke2(t47, e56.ag(l22), n46.pitch, n46._fov); })(this.fogState, i26, o88, s18, r86.toUnwrapped(), this.transform); c28 = t46 > 0.9; } } else hi(l21, l21, t45); const h8 = l21[3]; return { point: new e56.P((l21[0] / h8 + 1) / 2 * this.transform.width + di, (-l21[1] / h8 + 1) / 2 * this.transform.height + di), perspectiveRatio: Math.min(0.5 + this.transform.getCameraToCenterDistance(a46) / h8 * 0.5, 1.5), signedDistanceFromCamera: h8, occluded: n45 && l21[2] > h8 || c28 }; } isOffscreen(e57, t45, i26, o88) { return i26 < di || e57 >= this.screenRightBoundary || o88 < di || t45 > this.screenBottomBoundary; } isInsideGrid(e57, t45, i26, o88) { return i26 >= 0 && e57 < this.gridRightBoundary && o88 >= 0 && t45 < this.gridBottomBoundary; } getViewportMatrix() { const t45 = e56.bA([]); return e56.br(t45, t45, [-100, -100, 0]), t45; } } class _i { constructor(e57, t45, i26, o88) { this.opacity = e57 ? Math.max(0, Math.min(1, e57.opacity + (e57.placed ? t45 : -t45))) : o88 && i26 ? 1 : 0, this.placed = i26; } isHidden() { return 0 === this.opacity && !this.placed; } } class pi { constructor(e57, t45, i26, o88, s18, r86 = false) { this.text = new _i(e57 ? e57.text : null, t45, i26, s18), this.icon = new _i(e57 ? e57.icon : null, t45, o88, s18), this.clipped = r86; } isHidden() { return this.text.isHidden() && this.icon.isHidden(); } } class fi { constructor(e57, t45, i26, o88 = false) { this.text = e57, this.icon = t45, this.skipFade = i26, this.clipped = o88; } } class mi { constructor() { this.invProjMatrix = e56.bC(), this.viewportMatrix = e56.bC(), this.circles = []; } } class gi { constructor(e57, t45, i26, o88, s18) { this.bucketInstanceId = e57, this.featureIndex = t45, this.sourceLayerIndex = i26, this.bucketIndex = o88, this.tileID = s18; } } class vi { constructor(e57) { this.crossSourceCollisions = e57, this.maxGroupID = 0, this.collisionGroups = {}; } get(e57) { if (this.crossSourceCollisions) return { ID: 0, predicate: null }; if (!this.collisionGroups[e57]) { const t45 = ++this.maxGroupID; this.collisionGroups[e57] = { ID: t45, predicate: (e58) => e58.collisionGroupID === t45 }; } return this.collisionGroups[e57]; } } function yi(t45, i26, o88, s18, r86) { const { horizontalAlign: n45, verticalAlign: a46 } = e56.c0(t45), l21 = -(n45 - 0.5) * i26, c28 = -(a46 - 0.5) * o88, h8 = e56.c1(t45, s18); return new e56.P(l21 + h8[0] * r86, c28 + h8[1] * r86); } function xi(t45, i26, o88, s18, r86) { const n45 = new e56.P(t45, i26); return o88 && n45._rotate(s18 ? r86 : -r86), n45; } class bi { constructor(e57, t45, i26, o88, s18, r86) { this.transform = e57.clone(), this.projection = e57.projection.name, this.collisionIndex = new ui(this.transform, s18), this.buildingIndex = r86, this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = false, this.commitTime = 0, this.fadeDuration = t45, this.retainedQueryData = {}, this.collisionGroups = new vi(i26), this.collisionCircleArrays = {}, this.prevPlacement = o88, o88 && (o88.prevPlacement = void 0), this.placedOrientations = {}; } getBucketParts(t45, i26, o88, s18, r86 = 1) { const n45 = o88.getBucket(i26), a46 = o88.latestFeatureIndex; if (!n45 || !a46 || i26.fqid !== n45.layerIds[0]) return; const l21 = n45.layers[0].layout, c28 = n45.layers[0].paint, h8 = o88.collisionBoxArray, d34 = Math.pow(2, this.transform.zoom - o88.tileID.overscaledZ), u12 = o88.tileSize / e56.al, _4 = o88.tileID.toUnwrapped(); this.transform.setProjection(n45.projection); const p9 = (f8 = o88.tileID, m6 = n45.getProjection(), g9 = this.transform, m6.name === this.projection ? g9.calculateProjMatrix(f8.toUnwrapped()) : Gt(g9, m6, f8)); var f8, m6, g9; const v8 = "map" === l21.get("text-pitch-alignment"), y4 = "map" === l21.get("text-rotation-alignment"); i26.compileFilter(i26.options); const x4 = i26.dynamicFilter(), b8 = i26.dynamicFilterNeedsFeature(), w4 = this.transform.calculatePixelsToTileUnitsMatrix(o88), T5 = Kt2(p9, o88.tileID.canonical, v8, y4, this.transform, n45.getProjection(), w4); let E5 = null; const S5 = n45.getProjection().createInversionMatrix(this.transform, o88.tileID.canonical); if (v8) { const t46 = Jt2(p9, o88.tileID.canonical, v8, y4, this.transform, n45.getProjection(), w4); E5 = e56.aB([], this.transform.labelPlaneMatrix, t46); } let I4 = null; x4 && o88.latestFeatureIndex && (I4 = { unwrappedTileID: _4, dynamicFilter: x4, dynamicFilterNeedsFeature: b8 }), this.retainedQueryData[n45.bucketInstanceId] = new gi(n45.bucketInstanceId, a46, n45.sourceLayerIndex, n45.index, o88.tileID); const [C6, R5] = n45.layers[0].layout.get("text-size-scale-range"), A4 = e56.aA(r86, C6, R5), [D5, L3] = l21.get("icon-size-scale-range"), P4 = e56.aA(r86, D5, L3), z4 = { bucket: n45, layout: l21, paint: c28, posMatrix: p9, invMatrix: S5, mercatorCenter: [e56.aF(this.transform.center.lng), e56.aJ(this.transform.center.lat)], textLabelPlaneMatrix: T5, labelToScreenMatrix: E5, clippingData: I4, scale: d34, textPixelRatio: u12, holdingForFade: o88.holdingForFade(), collisionBoxArray: h8, partiallyEvaluatedTextSize: e56.bK(n45.textSizeData, this.transform.zoom, A4), partiallyEvaluatedIconSize: e56.bK(n45.iconSizeData, this.transform.zoom, P4), collisionGroup: this.collisionGroups.get(n45.sourceID), latestFeatureIndex: o88.latestFeatureIndex }; if (s18) for (const e57 of n45.sortKeyRanges) { const { sortKey: i27, symbolInstanceStart: o89, symbolInstanceEnd: s19 } = e57; t45.push({ sortKey: i27, symbolInstanceStart: o89, symbolInstanceEnd: s19, parameters: z4 }); } else t45.push({ symbolInstanceStart: 0, symbolInstanceEnd: n45.symbolInstances.length, parameters: z4 }); } attemptAnchorPlacement(e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4, x4) { const { textOffset0: b8, textOffset1: w4, crossTileID: T5 } = p9, E5 = [b8, w4], S5 = yi(e57, r86, n45, E5, a46), I4 = this.collisionIndex.placeCollisionBox(m6, a46, t45, i26, o88, s18, xi(S5.x, S5.y, l21, c28, this.transform.angle), _4, h8, d34, u12.predicate); if (v8) { const e58 = m6.getSymbolInstanceIconSize(x4, this.transform.zoom, p9.placedIconSymbolIndex); if (0 === this.collisionIndex.placeCollisionBox(m6, e58, v8, i26, o88, s18, xi(S5.x, S5.y, l21, c28, this.transform.angle), _4, h8, d34, u12.predicate).box.length) return; } if (I4.box.length > 0) { let t46; return this.prevPlacement && this.prevPlacement.variableOffsets[T5] && this.prevPlacement.placements[T5] && this.prevPlacement.placements[T5].text && (t46 = this.prevPlacement.variableOffsets[T5].anchor), this.variableOffsets[T5] = { textOffset: E5, width: r86, height: n45, anchor: e57, textScale: a46, prevAnchor: t46 }, this.markUsedJustification(m6, e57, p9, g9), m6.allowVerticalPlacement && (this.markUsedOrientation(m6, g9, p9), this.placedOrientations[T5] = g9), { shift: S5, placedGlyphBoxes: I4 }; } } placeLayerBucketPart(t45, i26, o88, s18, r86 = 1) { const { bucket: n45, layout: a46, paint: l21, posMatrix: c28, textLabelPlaneMatrix: h8, labelToScreenMatrix: d34, clippingData: u12, textPixelRatio: _4, mercatorCenter: p9, invMatrix: f8, holdingForFade: m6, collisionBoxArray: g9, partiallyEvaluatedTextSize: v8, partiallyEvaluatedIconSize: y4, collisionGroup: x4, latestFeatureIndex: b8 } = t45.parameters, w4 = a46.get("text-optional"), T5 = a46.get("icon-optional"), E5 = a46.get("text-allow-overlap"), S5 = a46.get("icon-allow-overlap"), I4 = "map" === a46.get("text-rotation-alignment"), C6 = "map" === a46.get("icon-rotation-alignment"), R5 = "map" === a46.get("text-pitch-alignment"), A4 = l21.get("symbol-z-offset"), D5 = "sea" === a46.get("symbol-elevation-reference"), L3 = a46.get("symbol-placement"), [P4, z4] = a46.get("text-size-scale-range"), [O4, M5] = a46.get("icon-size-scale-range"), F17 = e56.aA(r86, P4, z4), B6 = e56.aA(r86, O4, M5), k7 = a46.get("text-variable-anchor"), N5 = I4 && "point" !== L3, U4 = C6 && "point" !== L3, j4 = k7 && n45.hasTextData(), V4 = n45.hasIconTextFit() && j4 && n45.hasIconData(); this.transform.setProjection(n45.projection); const G5 = j4 || N5, H4 = U4 || V4; let q3 = E5 && (S5 || !n45.hasIconData() || T5), Z3 = S5 && (E5 || !n45.hasTextData() || w4); const W4 = !A4.isConstant(); !n45.collisionArrays && g9 && n45.deserializeCollisionBoxes(g9), o88 && s18 && n45.updateCollisionDebugBuffers(this.transform.zoom, g9, F17, B6); const $5 = (t46, s19, r87) => { const { crossTileID: l22, numVerticalGlyphVertices: g10 } = t46; let C7 = null; if (u12 && u12.dynamicFilterNeedsFeature || W4) { const e57 = this.retainedQueryData[n45.bucketInstanceId]; C7 = b8.loadFeature({ featureIndex: t46.featureIndex, bucketIndex: e57.bucketIndex, sourceLayerIndex: e57.sourceLayerIndex, layoutVertexArrayOffset: 0 }); } if (u12 && !(0, u12.dynamicFilter)({ zoom: this.transform.zoom, pitch: this.transform.pitch }, C7, this.retainedQueryData[n45.bucketInstanceId].tileID.canonical, new e56.P(t46.tileAnchorX, t46.tileAnchorY), this.transform.calculateDistanceTileData(u12.unwrappedTileID))) return this.placements[l22] = new fi(false, false, false, true), void i26.add(l22); const L4 = A4.evaluate(C7, {}); if (i26.has(l22)) return; if (m6) return void (this.placements[l22] = new fi(false, false, false)); let P5 = false, z5 = false, O5 = true, M6 = false, F18 = false, B7 = null, N6 = { box: null, offscreen: null, occluded: null }, U5 = { box: null }, j5 = null, V5 = null, $6 = null, X4 = 0, Y6 = 0, K5 = 0; r87.textFeatureIndex ? X4 = r87.textFeatureIndex : t46.useRuntimeCollisionCircles && (X4 = t46.featureIndex), r87.verticalTextFeatureIndex && (Y6 = r87.verticalTextFeatureIndex); const J4 = (e57) => { e57.tileID = this.retainedQueryData[n45.bucketInstanceId].tileID; const i27 = this.transform.elevation; e57.elevation = D5 ? L4 : L4 + (i27 ? i27.getAtTileOffset(e57.tileID, e57.tileAnchorX, e57.tileAnchorY) : 0), e57.elevation += t46.zOffset; }, Q5 = r87.textBox; if (Q5) { J4(Q5); const i27 = (i28) => { let o90 = e56.bL.horizontal; if (n45.allowVerticalPlacement && !i28 && this.prevPlacement) { const e57 = this.prevPlacement.placedOrientations[l22]; e57 && (this.placedOrientations[l22] = e57, o90 = e57, this.markUsedOrientation(n45, o90, t46)); } return o90; }, o89 = (t47, i28) => { if (n45.allowVerticalPlacement && g10 > 0 && r87.verticalTextBox) { for (const o90 of n45.writingModes) if (o90 === e56.bL.vertical ? (N6 = i28(), U5 = N6) : N6 = t47(), N6 && N6.box && N6.box.length) break; } else N6 = t47(); }; if (k7) { let a47 = k7; if (this.prevPlacement && this.prevPlacement.variableOffsets[l22]) { const e57 = this.prevPlacement.variableOffsets[l22]; a47.indexOf(e57.anchor) > 0 && (a47 = a47.filter(((t47) => t47 !== e57.anchor)), a47.unshift(e57.anchor)); } const h9 = (e57, i28, o90) => { const r88 = n45.getSymbolInstanceTextSize(v8, t46, this.transform.zoom, s19), l23 = (e57.x2 - e57.x1) * r88 + 2 * e57.padding, h10 = (e57.y2 - e57.y1) * r88 + 2 * e57.padding, d36 = t46.hasIconTextFit && !S5 ? i28 : null; d36 && J4(d36); let u13 = { box: [], offscreen: false, occluded: false }; const m7 = E5 ? 2 * a47.length : a47.length; for (let i29 = 0; i29 < m7; ++i29) { const m8 = this.attemptAnchorPlacement(a47[i29 % a47.length], e57, p9, f8, G5, l23, h10, r88, I4, R5, _4, c28, x4, i29 >= a47.length, t46, s19, n45, o90, d36, v8, y4); if (m8 && (u13 = m8.placedGlyphBoxes, u13 && u13.box && u13.box.length)) { P5 = true, B7 = m8.shift; break; } } return u13; }; o89((() => h9(Q5, r87.iconBox, e56.bL.horizontal)), (() => { const t47 = r87.verticalTextBox; return t47 && J4(t47), n45.allowVerticalPlacement && !(N6 && N6.box && N6.box.length) && g10 > 0 && t47 ? h9(t47, r87.verticalIconBox, e56.bL.vertical) : { box: null, offscreen: null, occluded: null }; })), N6 && (P5 = N6.box, O5 = N6.offscreen, M6 = N6.occluded); const d35 = i27(!(!N6 || !N6.box)); if (!P5 && this.prevPlacement) { const e57 = this.prevPlacement.variableOffsets[l22]; e57 && (this.variableOffsets[l22] = e57, this.markUsedJustification(n45, e57.anchor, t46, d35)); } } else { const a47 = (i28, o90) => { const r88 = n45.getSymbolInstanceTextSize(v8, t46, this.transform.zoom, s19), a48 = this.collisionIndex.placeCollisionBox(n45, r88, i28, p9, f8, G5, new e56.P(0, 0), E5, _4, c28, x4.predicate); return a48 && a48.box && a48.box.length && (this.markUsedOrientation(n45, o90, t46), this.placedOrientations[l22] = o90), a48; }; o89((() => a47(Q5, e56.bL.horizontal)), (() => { const t47 = r87.verticalTextBox; return n45.allowVerticalPlacement && g10 > 0 && t47 ? (J4(t47), a47(t47, e56.bL.vertical)) : { box: null, offscreen: null, occluded: null }; })), i27(!!(N6 && N6.box && N6.box.length)); } } if (j5 = N6, P5 = j5 && j5.box && j5.box.length > 0, O5 = j5 && j5.offscreen, M6 = j5 && j5.occluded, t46.useRuntimeCollisionCircles) { const i27 = n45.text.placedSymbolArray.get(t46.centerJustifiedTextSymbolIndex >= 0 ? t46.centerJustifiedTextSymbolIndex : t46.verticalPlacedTextSymbolIndex), s20 = e56.bM(n45.textSizeData, v8, i27), r88 = a46.get("text-padding"); V5 = this.collisionIndex.placeCollisionCircles(n45, E5, i27, n45.lineVertexArray, n45.glyphOffsetArray, s20, c28, h8, d34, o88, R5, x4.predicate, t46.collisionCircleDiameter * s20 / e56.bX, r88, this.retainedQueryData[n45.bucketInstanceId].tileID), P5 = E5 || V5.circles.length > 0 && !V5.collisionDetected, O5 = O5 && V5.offscreen, M6 = V5.occluded; } if (r87.iconFeatureIndex && (K5 = r87.iconFeatureIndex), r87.iconBox) { const i27 = (i28) => { J4(i28); const o89 = t46.hasIconTextFit && B7 ? xi(B7.x, B7.y, I4, R5, this.transform.angle) : new e56.P(0, 0), s20 = n45.getSymbolInstanceIconSize(y4, this.transform.zoom, t46.placedIconSymbolIndex); return this.collisionIndex.placeCollisionBox(n45, s20, i28, p9, f8, H4, o89, S5, _4, c28, x4.predicate); }; U5 && U5.box && U5.box.length && r87.verticalIconBox ? ($6 = i27(r87.verticalIconBox), z5 = $6.box.length > 0) : ($6 = i27(r87.iconBox), z5 = $6.box.length > 0), O5 = O5 && $6.offscreen, F18 = $6.occluded; } const ee3 = w4 || 0 === t46.numHorizontalGlyphVertices && 0 === g10, te2 = T5 || 0 === t46.numIconVertices; if (ee3 || te2 ? te2 ? ee3 || (z5 = z5 && P5) : P5 = z5 && P5 : z5 = P5 = z5 && P5, P5 && j5 && j5.box && this.collisionIndex.insertCollisionBox(j5.box, a46.get("text-ignore-placement"), n45.bucketInstanceId, U5 && U5.box && Y6 ? Y6 : X4, x4.ID), z5 && $6 && this.collisionIndex.insertCollisionBox($6.box, a46.get("icon-ignore-placement"), n45.bucketInstanceId, K5, x4.ID), V5 && (P5 && this.collisionIndex.insertCollisionCircles(V5.circles, a46.get("text-ignore-placement"), n45.bucketInstanceId, X4, x4.ID), o88)) { const e57 = n45.bucketInstanceId; let t47 = this.collisionCircleArrays[e57]; void 0 === t47 && (t47 = this.collisionCircleArrays[e57] = new mi()); for (let e58 = 0; e58 < V5.circles.length; e58 += 4) t47.circles.push(V5.circles[e58 + 0]), t47.circles.push(V5.circles[e58 + 1]), t47.circles.push(V5.circles[e58 + 2]), t47.circles.push(V5.collisionDetected ? 1 : 0); } const ie3 = "globe" !== n45.projection.name; q3 = q3 && (ie3 || !M6), Z3 = Z3 && (ie3 || !F18), this.placements[l22] = new fi(P5 || q3, z5 || Z3, O5 || n45.justReloaded), i26.add(l22); }, X3 = this.retainedQueryData[n45.bucketInstanceId].tileID; if ("offset" === n45.elevationType && this.buildingIndex && this.buildingIndex.updateZOffset(n45, X3), "road" === n45.elevationType && n45.updateRoadElevation(X3.canonical), n45.updateZOffset(), n45.sortFeaturesByY) { const t46 = n45.getSortedSymbolIndexes(this.transform.angle); for (let e57 = t46.length - 1; e57 >= 0; --e57) { const i27 = t46[e57]; $5(n45.symbolInstances.get(i27), i27, n45.collisionArrays[i27]); } n45.hasAnyZOffset && e56.w(`${n45.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`); } else if (n45.hasAnyZOffset) { const e57 = n45.getSortedIndexesByZOffset(); for (let t46 = 0; t46 < e57.length; ++t46) { const i27 = e57[t46]; $5(n45.symbolInstances.get(i27), i27, n45.collisionArrays[i27]); } } else for (let e57 = t45.symbolInstanceStart; e57 < t45.symbolInstanceEnd; e57++) $5(n45.symbolInstances.get(e57), e57, n45.collisionArrays[e57]); if (o88 && n45.bucketInstanceId in this.collisionCircleArrays) { const t46 = this.collisionCircleArrays[n45.bucketInstanceId]; e56.bl(t46.invProjMatrix, c28), t46.viewportMatrix = this.collisionIndex.getViewportMatrix(); } n45.justReloaded = false; } markUsedJustification(t45, i26, o88, s18) { const { leftJustifiedTextSymbolIndex: r86, centerJustifiedTextSymbolIndex: n45, rightJustifiedTextSymbolIndex: a46, verticalPlacedTextSymbolIndex: l21, crossTileID: c28 } = o88, h8 = e56.c2(i26), d34 = s18 === e56.bL.vertical ? l21 : "left" === h8 ? r86 : "center" === h8 ? n45 : "right" === h8 ? a46 : -1; r86 >= 0 && (t45.text.placedSymbolArray.get(r86).crossTileID = d34 >= 0 && r86 !== d34 ? 0 : c28), n45 >= 0 && (t45.text.placedSymbolArray.get(n45).crossTileID = d34 >= 0 && n45 !== d34 ? 0 : c28), a46 >= 0 && (t45.text.placedSymbolArray.get(a46).crossTileID = d34 >= 0 && a46 !== d34 ? 0 : c28), l21 >= 0 && (t45.text.placedSymbolArray.get(l21).crossTileID = d34 >= 0 && l21 !== d34 ? 0 : c28); } markUsedOrientation(t45, i26, o88) { const s18 = i26 === e56.bL.horizontal || i26 === e56.bL.horizontalOnly ? i26 : 0, r86 = i26 === e56.bL.vertical ? i26 : 0, { leftJustifiedTextSymbolIndex: n45, centerJustifiedTextSymbolIndex: a46, rightJustifiedTextSymbolIndex: l21, verticalPlacedTextSymbolIndex: c28 } = o88, h8 = t45.text.placedSymbolArray; n45 >= 0 && (h8.get(n45).placedOrientation = s18), a46 >= 0 && (h8.get(a46).placedOrientation = s18), l21 >= 0 && (h8.get(l21).placedOrientation = s18), c28 >= 0 && (h8.get(c28).placedOrientation = r86); } commit(e57) { this.commitTime = e57, this.zoomAtLastRecencyCheck = this.transform.zoom; const t45 = this.prevPlacement; let i26 = false; this.prevZoomAdjustment = t45 ? t45.zoomAdjustment(this.transform.zoom) : 0; const o88 = t45 ? t45.symbolFadeChange(e57) : 1, s18 = t45 ? t45.opacities : {}, r86 = t45 ? t45.variableOffsets : {}, n45 = t45 ? t45.placedOrientations : {}; for (const e58 in this.placements) { const t46 = this.placements[e58], r87 = s18[e58]; r87 ? (this.opacities[e58] = new pi(r87, o88, t46.text, t46.icon, null, t46.clipped), i26 = i26 || t46.text !== r87.text.placed || t46.icon !== r87.icon.placed) : (this.opacities[e58] = new pi(null, o88, t46.text, t46.icon, t46.skipFade, t46.clipped), i26 = i26 || t46.text || t46.icon); } for (const e58 in s18) { const t46 = s18[e58]; if (!this.opacities[e58]) { const s19 = new pi(t46, o88, false, false); s19.isHidden() || (this.opacities[e58] = s19, i26 = i26 || t46.text.placed || t46.icon.placed); } } for (const e58 in r86) this.variableOffsets[e58] || !this.opacities[e58] || this.opacities[e58].isHidden() || (this.variableOffsets[e58] = r86[e58]); for (const e58 in n45) this.placedOrientations[e58] || !this.opacities[e58] || this.opacities[e58].isHidden() || (this.placedOrientations[e58] = n45[e58]); i26 ? this.lastPlacementChangeTime = e57 : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = t45 ? t45.lastPlacementChangeTime : e57); } updateLayerOpacities(e57, t45, i26, o88) { const s18 = /* @__PURE__ */ new Set(); for (const r86 of t45) { const t46 = r86.getBucket(e57); t46 && r86.latestFeatureIndex && e57.fqid === t46.layerIds[0] && (this.updateBucketOpacities(t46, s18, r86, r86.collisionBoxArray, i26, o88, r86.tileID, e57.scope), "offset" === t46.elevationType && this.buildingIndex && this.buildingIndex.updateZOffset(t46, r86.tileID), "road" === t46.elevationType && t46.updateRoadElevation(r86.tileID.canonical), t46.updateZOffset()); } } updateBucketOpacities(t45, i26, o88, s18, r86, n45, a46, l21) { t45.hasTextData() && t45.text.opacityVertexArray.clear(), t45.hasIconData() && t45.icon.opacityVertexArray.clear(), t45.hasIconCollisionBoxData() && t45.iconCollisionBox.collisionVertexArray.clear(), t45.hasTextCollisionBoxData() && t45.textCollisionBox.collisionVertexArray.clear(); const c28 = t45.layers[0].layout, h8 = t45.layers[0].paint, d34 = !!t45.layers[0].dynamicFilter(), u12 = new pi(null, 0, false, false, true), _4 = c28.get("text-allow-overlap"), p9 = c28.get("icon-allow-overlap"), f8 = c28.get("text-variable-anchor"), m6 = "map" === c28.get("text-rotation-alignment"), g9 = "map" === c28.get("text-pitch-alignment"), v8 = h8.get("symbol-z-offset"), y4 = "sea" === c28.get("symbol-elevation-reference"), x4 = !v8.isConstant(), b8 = new pi(null, 0, _4 && (p9 || !t45.hasIconData() || c28.get("icon-optional")), p9 && (_4 || !t45.hasTextData() || c28.get("text-optional")), true); !t45.collisionArrays && s18 && (t45.hasIconCollisionBoxData() || t45.hasTextCollisionBoxData()) && t45.deserializeCollisionBoxes(s18); const w4 = (e57, t46, i27) => { for (let o89 = 0; o89 < t46 / 4; o89++) e57.opacityVertexArray.emplaceBack(i27); }; let T5 = 0; n45 && t45.updateReplacement(a46, n45); for (let s19 = 0; s19 < t45.symbolInstances.length; s19++) { const c29 = t45.symbolInstances.get(s19), { numHorizontalGlyphVertices: h9, numVerticalGlyphVertices: _5, crossTileID: p10, numIconVertices: E5, tileAnchorX: S5, tileAnchorY: I4 } = c29; let C6 = null; const R5 = this.retainedQueryData[t45.bucketInstanceId]; x4 && c29 && R5 && (C6 = o88.latestFeatureIndex.loadFeature({ featureIndex: c29.featureIndex, bucketIndex: R5.bucketIndex, sourceLayerIndex: R5.sourceLayerIndex, layoutVertexArrayOffset: 0 })); const A4 = v8.evaluate(C6, {}), D5 = i26.has(p10); let L3 = this.opacities[p10]; D5 ? L3 = u12 : L3 || (L3 = b8, this.opacities[p10] = L3), i26.add(p10); const P4 = h9 > 0 || _5 > 0, z4 = E5 > 0, O4 = this.placedOrientations[p10], M5 = O4 === e56.bL.vertical, F17 = O4 === e56.bL.horizontal || O4 === e56.bL.horizontalOnly; !P4 && !z4 || L3.isHidden() || T5++; let B6 = false; if ((P4 || z4) && n45) for (const i27 of t45.activeReplacements) { if (e56.bY(i27, r86, e56.bZ.Symbol, l21)) continue; if (i27.min.x > S5 || S5 > i27.max.x || i27.min.y > I4 || I4 > i27.max.y) continue; const t46 = e56.b_(S5, I4, a46.canonical, i27.footprintTileId.canonical); if (B6 = e56.b$(t46, i27.footprint), B6) break; } if (P4) { const e57 = B6 ? Li : Di(L3.text); w4(t45.text, h9, M5 ? Li : e57), w4(t45.text, _5, F17 ? Li : e57); const i27 = L3.text.isHidden(), { leftJustifiedTextSymbolIndex: o89, centerJustifiedTextSymbolIndex: s20, rightJustifiedTextSymbolIndex: r87, verticalPlacedTextSymbolIndex: n46 } = c29, a47 = t45.text.placedSymbolArray, l22 = i27 || M5 ? 1 : 0; o89 >= 0 && (a47.get(o89).hidden = l22), s20 >= 0 && (a47.get(s20).hidden = l22), r87 >= 0 && (a47.get(r87).hidden = l22), n46 >= 0 && (a47.get(n46).hidden = i27 || F17 ? 1 : 0); const d35 = this.variableOffsets[p10]; d35 && this.markUsedJustification(t45, d35.anchor, c29, O4); const u13 = this.placedOrientations[p10]; u13 && (this.markUsedJustification(t45, "left", c29, u13), this.markUsedOrientation(t45, u13, c29)); } if (z4) { const e57 = B6 ? Li : Di(L3.icon), { placedIconSymbolIndex: i27, verticalPlacedIconSymbolIndex: o89 } = c29, s20 = t45.icon.placedSymbolArray, r87 = L3.icon.isHidden() ? 1 : 0; i27 >= 0 && (w4(t45.icon, E5, M5 ? Li : e57), s20.get(i27).hidden = r87), o89 >= 0 && (w4(t45.icon, c29.numVerticalIconVertices, F17 ? Li : e57), s20.get(o89).hidden = r87); } if (t45.hasIconCollisionBoxData() || t45.hasTextCollisionBoxData()) { const i27 = t45.collisionArrays[s19]; if (i27) { let o89 = new e56.P(0, 0), s20 = true; if (i27.textBox || i27.verticalTextBox) { if (f8) { const e57 = this.variableOffsets[p10]; e57 ? (o89 = yi(e57.anchor, e57.width, e57.height, e57.textOffset, e57.textScale), m6 && o89._rotate(g9 ? this.transform.angle : -this.transform.angle)) : s20 = false; } d34 && (s20 = !L3.clipped), i27.textBox && wi(t45.textCollisionBox.collisionVertexArray, L3.text.placed, !s20 || M5, A4, y4, o89.x, o89.y), i27.verticalTextBox && wi(t45.textCollisionBox.collisionVertexArray, L3.text.placed, !s20 || F17, A4, y4, o89.x, o89.y); } const r87 = s20 && Boolean(!F17 && i27.verticalIconBox); i27.iconBox && wi(t45.iconCollisionBox.collisionVertexArray, L3.icon.placed, r87, A4, y4, c29.hasIconTextFit ? o89.x : 0, c29.hasIconTextFit ? o89.y : 0), i27.verticalIconBox && wi(t45.iconCollisionBox.collisionVertexArray, L3.icon.placed, !r87, A4, y4, c29.hasIconTextFit ? o89.x : 0, c29.hasIconTextFit ? o89.y : 0); } } } if (t45.fullyClipped = 0 === T5, t45.sortFeatures(this.transform.angle), this.retainedQueryData[t45.bucketInstanceId] && (this.retainedQueryData[t45.bucketInstanceId].featureSortOrder = t45.featureSortOrder), t45.hasTextData() && t45.text.opacityVertexBuffer && t45.text.opacityVertexBuffer.updateData(t45.text.opacityVertexArray), t45.hasIconData() && t45.icon.opacityVertexBuffer && t45.icon.opacityVertexBuffer.updateData(t45.icon.opacityVertexArray), t45.hasIconCollisionBoxData() && t45.iconCollisionBox.collisionVertexBuffer && t45.iconCollisionBox.collisionVertexBuffer.updateData(t45.iconCollisionBox.collisionVertexArray), t45.hasTextCollisionBoxData() && t45.textCollisionBox.collisionVertexBuffer && t45.textCollisionBox.collisionVertexBuffer.updateData(t45.textCollisionBox.collisionVertexArray), t45.bucketInstanceId in this.collisionCircleArrays) { const e57 = this.collisionCircleArrays[t45.bucketInstanceId]; t45.placementInvProjMatrix = e57.invProjMatrix, t45.placementViewportMatrix = e57.viewportMatrix, t45.collisionCircleArray = e57.circles, delete this.collisionCircleArrays[t45.bucketInstanceId]; } } symbolFadeChange(e57) { return 0 === this.fadeDuration ? 1 : (e57 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment; } zoomAdjustment(e57) { return Math.max(0, (this.transform.zoom - e57) / 1.5); } hasTransitions(e57) { return this.stale || e57 - this.lastPlacementChangeTime < this.fadeDuration; } stillRecent(e57, t45) { const i26 = this.zoomAtLastRecencyCheck === t45 ? 1 - this.zoomAdjustment(t45) : 1; return this.zoomAtLastRecencyCheck = t45, this.commitTime + this.fadeDuration * i26 > e57; } setStale() { this.stale = true; } } function wi(e57, t45, i26, o88, s18, r86, n45) { e57.emplaceBack(t45 ? 1 : 0, i26 ? 1 : 0, r86 || 0, n45 || 0, o88, s18 ? 1 : 0), e57.emplaceBack(t45 ? 1 : 0, i26 ? 1 : 0, r86 || 0, n45 || 0, o88, s18 ? 1 : 0), e57.emplaceBack(t45 ? 1 : 0, i26 ? 1 : 0, r86 || 0, n45 || 0, o88, s18 ? 1 : 0), e57.emplaceBack(t45 ? 1 : 0, i26 ? 1 : 0, r86 || 0, n45 || 0, o88, s18 ? 1 : 0); } const Ti = Math.pow(2, 25), Ei = Math.pow(2, 24), Si = Math.pow(2, 17), Ii = Math.pow(2, 16), Ci = Math.pow(2, 9), Ri = Math.pow(2, 8), Ai = Math.pow(2, 1); function Di(e57) { if (0 === e57.opacity && !e57.placed) return 0; if (1 === e57.opacity && e57.placed) return 4294967295; const t45 = e57.placed ? 1 : 0, i26 = Math.floor(127 * e57.opacity); return i26 * Ti + t45 * Ei + i26 * Si + t45 * Ii + i26 * Ci + t45 * Ri + i26 * Ai + t45; } const Li = 0; class Pi { constructor(e57) { this._sortAcrossTiles = "viewport-y" !== e57.layout.get("symbol-z-order") && void 0 !== e57.layout.get("symbol-sort-key").constantOr(1), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = /* @__PURE__ */ new Set(), this._bucketParts = []; } continuePlacement(e57, t45, i26, o88, s18, r86) { const n45 = this._bucketParts; for (; this._currentTileIndex < e57.length; ) if (t45.getBucketParts(n45, o88, e57[this._currentTileIndex], this._sortAcrossTiles, r86), this._currentTileIndex++, s18()) return true; for (this._sortAcrossTiles && (this._sortAcrossTiles = false, n45.sort(((e58, t46) => e58.sortKey - t46.sortKey))); this._currentPartIndex < n45.length; ) { const e58 = n45[this._currentPartIndex]; if (t45.placeLayerBucketPart(e58, this._seenCrossTileIDs, i26, 0 === e58.symbolInstanceStart, r86), this._currentPartIndex++, s18()) return true; } return false; } } class zi { constructor(e57, t45, i26, o88, s18, r86, n45, a46, l21) { this.placement = new bi(e57, s18, r86, n45, a46, l21), this._currentPlacementIndex = t45.length - 1, this._forceFullPlacement = i26, this._showCollisionBoxes = o88, this._done = false; } isDone() { return this._done; } continuePlacement(t45, i26, o88, s18, r86) { const n45 = e56.o.now(), a46 = () => { const t46 = e56.o.now() - n45; return !this._forceFullPlacement && t46 > 2; }; for (; this._currentPlacementIndex >= 0; ) { const n46 = i26[t45[this._currentPlacementIndex]], l21 = this.placement.collisionIndex.transform.zoom; if ("symbol" === n46.type && (!n46.minzoom || n46.minzoom <= l21) && (!n46.maxzoom || n46.maxzoom > l21)) { const t46 = n46, i27 = t46.layout.get("symbol-z-elevate"), l22 = void 0 !== t46.layout.get("symbol-sort-key").constantOr(1), c28 = t46.layout.get("symbol-z-order"), h8 = "viewport-y" === c28 || "auto" === c28 && !("viewport-y" !== c28 && l22), d34 = t46.layout.get("text-allow-overlap") || t46.layout.get("icon-allow-overlap") || t46.layout.get("text-ignore-placement") || t46.layout.get("icon-ignore-placement"), u12 = h8 && d34, _4 = this._inProgressLayer = this._inProgressLayer || new Pi(t46), p9 = e56.B(n46.source, n46.scope); if (_4.continuePlacement(i27 || u12 ? s18[p9] : o88[p9], this.placement, this._showCollisionBoxes, n46, a46, r86)) return; delete this._inProgressLayer; } this._currentPlacementIndex--; } this._done = true; } commit(e57) { return this.placement.commit(e57), this.placement; } } const Oi = 512 / e56.al / 2; class Mi { constructor(t45, i26, o88) { this.tileID = t45, this.bucketInstanceId = o88, this.index = new e56.c3(i26.length, 16, Int32Array), this.keys = [], this.crossTileIDs = []; const s18 = t45.canonical.x * e56.al, r86 = t45.canonical.y * e56.al; for (let e57 = 0; e57 < i26.length; e57++) { const { key: t46, crossTileID: o89, tileAnchorX: n45, tileAnchorY: a46 } = i26.get(e57), l21 = Math.floor((s18 + n45) * Oi), c28 = Math.floor((r86 + a46) * Oi); this.index.add(l21, c28), this.keys.push(t46), this.crossTileIDs.push(o89); } this.index.finish(); } findMatches(t45, i26, o88) { const s18 = this.tileID.canonical.z < i26.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - i26.canonical.z), r86 = Oi / Math.pow(2, i26.canonical.z - this.tileID.canonical.z), n45 = i26.canonical.x * e56.al, a46 = i26.canonical.y * e56.al; for (let e57 = 0; e57 < t45.length; e57++) { const i27 = t45.get(e57); if (i27.crossTileID) continue; const { key: l21, tileAnchorX: c28, tileAnchorY: h8 } = i27, d34 = Math.floor((n45 + c28) * r86), u12 = Math.floor((a46 + h8) * r86), _4 = this.index.range(d34 - s18, u12 - s18, d34 + s18, u12 + s18).sort(((e58, t46) => e58 - t46)); for (const e58 of _4) { const t46 = this.crossTileIDs[e58]; if (this.keys[e58] === l21 && !o88.has(t46)) { o88.add(t46), i27.crossTileID = t46; break; } } } } } class Fi { constructor() { this.maxCrossTileID = 0; } generate() { return ++this.maxCrossTileID; } } class Bi { constructor() { this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0; } handleWrapJump(e57) { const t45 = Math.round((e57 - this.lng) / 360); if (0 !== t45) for (const e58 in this.indexes) { const i26 = this.indexes[e58], o88 = {}; for (const e59 in i26) { const s18 = i26[e59]; s18.tileID = s18.tileID.unwrapTo(s18.tileID.wrap + t45), o88[s18.tileID.key] = s18; } this.indexes[e58] = o88; } this.lng = e57; } addBucket(e57, t45, i26) { if (this.indexes[e57.overscaledZ] && this.indexes[e57.overscaledZ][e57.key]) { if (this.indexes[e57.overscaledZ][e57.key].bucketInstanceId === t45.bucketInstanceId) return false; this.removeBucketCrossTileIDs(e57.overscaledZ, this.indexes[e57.overscaledZ][e57.key]); } for (let e58 = 0; e58 < t45.symbolInstances.length; e58++) t45.symbolInstances.get(e58).crossTileID = 0; this.usedCrossTileIDs[e57.overscaledZ] || (this.usedCrossTileIDs[e57.overscaledZ] = /* @__PURE__ */ new Set()); const o88 = this.usedCrossTileIDs[e57.overscaledZ]; for (const i27 in this.indexes) { const s18 = this.indexes[i27]; if (Number(i27) > e57.overscaledZ) for (const i28 in s18) { const r86 = s18[i28]; r86.tileID.isChildOf(e57) && r86.findMatches(t45.symbolInstances, e57, o88); } else { const r86 = s18[e57.scaledTo(Number(i27)).key]; r86 && r86.findMatches(t45.symbolInstances, e57, o88); } } for (let e58 = 0; e58 < t45.symbolInstances.length; e58++) { const s18 = t45.symbolInstances.get(e58); s18.crossTileID || (s18.crossTileID = i26.generate(), o88.add(s18.crossTileID)); } return void 0 === this.indexes[e57.overscaledZ] && (this.indexes[e57.overscaledZ] = {}), this.indexes[e57.overscaledZ][e57.key] = new Mi(e57, t45.symbolInstances, t45.bucketInstanceId), true; } removeBucketCrossTileIDs(e57, t45) { for (const i26 of t45.crossTileIDs) this.usedCrossTileIDs[e57].delete(i26); } removeStaleBuckets(e57) { let t45 = false; for (const i26 in this.indexes) { const o88 = this.indexes[i26]; for (const s18 in o88) e57[o88[s18].bucketInstanceId] || (this.removeBucketCrossTileIDs(i26, o88[s18]), delete o88[s18], t45 = true); } return t45; } } class ki { constructor() { this.layerIndexes = {}, this.crossTileIDs = new Fi(), this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {}; } addLayer(e57, t45, i26, o88) { let s18 = this.layerIndexes[e57.fqid]; void 0 === s18 && (s18 = this.layerIndexes[e57.fqid] = new Bi()); let r86 = false; const n45 = {}; "globe" !== o88.name && s18.handleWrapJump(i26); for (const i27 of t45) { const t46 = i27.getBucket(e57); t46 && e57.fqid === t46.layerIds[0] && (t46.bucketInstanceId || (t46.bucketInstanceId = ++this.maxBucketInstanceId), s18.addBucket(i27.tileID, t46, this.crossTileIDs) && (r86 = true), n45[t46.bucketInstanceId] = true); } return s18.removeStaleBuckets(n45) && (r86 = true), r86; } pruneUnusedLayers(e57) { const t45 = {}; e57.forEach(((e58) => { t45[e58] = true; })); for (const e58 in this.layerIndexes) t45[e58] || delete this.layerIndexes[e58]; } } const Ni = 771; class Ui { constructor(e57, t45, i26, o88) { this.blendFunction = e57, this.blendColor = t45.toNonPremultipliedRenderColor(null), this.mask = i26, this.blendEquation = o88; } } Ui.Replace = [1, 0, 1, 0], Ui.disabled = new Ui(Ui.Replace, e56.ao.transparent, [false, false, false, false]), Ui.unblended = new Ui(Ui.Replace, e56.ao.transparent, [true, true, true, true]), Ui.alphaBlended = new Ui([1, Ni, 1, Ni], e56.ao.transparent, [true, true, true, true]), Ui.alphaBlendedNonPremultiplied = new Ui([770, Ni, 770, Ni], e56.ao.transparent, [true, true, true, true]), Ui.multiply = new Ui([774, 0, 774, 0], e56.ao.transparent, [true, true, true, true]); class ji { constructor(e57, t45, i26) { this.func = e57, this.mask = t45, this.range = i26; } } ji.ReadOnly = false, ji.ReadWrite = true, ji.disabled = new ji(519, ji.ReadOnly, [0, 1]); const Vi = 7680; class Gi { constructor(e57, t45, i26, o88, s18, r86) { this.test = e57, this.ref = t45, this.mask = i26, this.fail = o88, this.depthFail = s18, this.pass = r86; } } Gi.disabled = new Gi({ func: 519, mask: 0 }, 0, 0, Vi, Vi, Vi); const Hi = 1029, qi = 2305; class Zi { constructor(e57, t45, i26) { this.enable = e57, this.mode = t45, this.frontFace = i26; } } function Wi(t45, i26) { const o88 = e56.c9(t45, 3); e56.cb(t45, i26), e56.cf(t45, 3, o88); } function $i(t45, i26) { const o88 = e56.c6([]); return e56.c7(o88, o88, -i26), e56.c8(o88, o88, -t45), o88; } function Xi(t45, i26) { const o88 = [t45[0], t45[1], 0], s18 = [i26[0], i26[1], 0]; if (e56.ag(o88) >= 1e-15) { const t46 = e56.aw([], o88); e56.c4(s18, t46, e56.bJ(s18, t46)), i26[0] = s18[0], i26[1] = s18[1]; } const r86 = e56.bI([], i26, t45); if (e56.c5(r86) < 1e-15) return null; const n45 = Math.atan2(-r86[1], r86[0]); return $i(Math.atan2(Math.sqrt(t45[0] * t45[0] + t45[1] * t45[1]), -t45[2]), n45); } Zi.disabled = new Zi(false, Hi, qi), Zi.backCCW = new Zi(true, Hi, qi), Zi.backCW = new Zi(true, Hi, 2304), Zi.frontCW = new Zi(true, 1028, 2304), Zi.frontCCW = new Zi(true, 1028, qi); class Yi { constructor(e57, t45) { this.position = e57, this.orientation = t45; } get position() { return this._position; } set position(t45) { if (t45) { const i26 = t45 instanceof e56.ae ? t45 : new e56.ae(t45[0], t45[1], t45[2]); this._renderWorldCopies && (i26.x = e56.bT(i26.x, 0, 1)), this._position = i26; } else this._position = null; } lookAtPoint(t45, i26) { if (this.orientation = null, !this.position) return; const o88 = this.position, s18 = this._elevation ? this._elevation.getAtPointOrZero(e56.ae.fromLngLat(t45)) : 0, r86 = e56.ae.fromLngLat(t45, s18), n45 = [r86.x - o88.x, r86.y - o88.y, r86.z - o88.z]; i26 || (i26 = [0, 0, 1]), i26[2] = Math.abs(i26[2]), this.orientation = Xi(n45, i26); } setPitchBearing(t45, i26) { this.orientation = $i(e56.an(t45), e56.an(-i26)); } } class Ki { constructor(t45, i26) { this._transform = e56.bA([]), this.orientation = i26, this.position = t45; } get mercatorPosition() { const t45 = this.position; return new e56.ae(t45[0], t45[1], t45[2]); } get position() { const t45 = e56.c9(this._transform, 3); return [t45[0], t45[1], t45[2]]; } set position(t45) { var i26; t45 && e56.cf(this._transform, 3, [(i26 = t45)[0], i26[1], i26[2], 1]); } get orientation() { return this._orientation; } set orientation(t45) { this._orientation = t45 || e56.c6([]), t45 && Wi(this._transform, this._orientation); } getPitchBearing() { const e57 = this.forward(), t45 = this.right(); return { bearing: Math.atan2(-t45[1], t45[0]), pitch: Math.atan2(Math.sqrt(e57[0] * e57[0] + e57[1] * e57[1]), -e57[2]) }; } setPitchBearing(e57, t45) { this._orientation = $i(e57, t45), Wi(this._transform, this._orientation); } forward() { const t45 = e56.c9(this._transform, 2); return [-t45[0], -t45[1], -t45[2]]; } up() { const t45 = e56.c9(this._transform, 1); return [-t45[0], -t45[1], -t45[2]]; } right() { const t45 = e56.c9(this._transform, 0); return [t45[0], t45[1], t45[2]]; } getCameraToWorld(t45, i26) { const o88 = new Float64Array(16); return e56.bl(o88, this.getWorldToCamera(t45, i26)), o88; } getCameraToWorldMercator() { return this._transform; } getWorldToCameraPosition(t45, i26, o88) { const s18 = this.position; e56.c4(s18, s18, -t45); const r86 = new Float64Array(16); return e56.bq(r86, [o88, o88, o88]), e56.br(r86, r86, s18), r86[10] *= i26, r86; } getWorldToCamera(t45, i26) { const o88 = new Float64Array(16), s18 = new Float64Array(4), r86 = this.position; return e56.ca(s18, this._orientation), e56.c4(r86, r86, -t45), e56.cb(o88, s18), e56.br(o88, o88, r86), o88[1] *= -1, o88[5] *= -1, o88[9] *= -1, o88[13] *= -1, o88[8] *= i26, o88[9] *= i26, o88[10] *= i26, o88[11] *= i26, o88; } getCameraToClipPerspective(t45, i26, o88, s18) { const r86 = new Float64Array(16); return e56.cc(r86, t45, i26, o88, s18), r86; } getCameraToClipOrthographic(t45, i26, o88, s18, r86, n45) { const a46 = new Float64Array(16); return e56.cd(a46, t45, i26, o88, s18, r86, n45), a46; } getDistanceToElevation(t45, i26 = false) { const o88 = 0 === t45 ? 0 : e56.ce(t45, i26 ? e56.a$(this.position[1]) : this.position[1]), s18 = this.forward(); return (o88 - this.position[2]) / s18[2]; } clone() { return new Ki([...this.position], [...this.orientation]); } } const Ji = { BaseColor: 5, MetallicRoughness: 6, Normal: 7, Occlusion: 8, Emission: 9, LUT: 10, ShadowMap0: 11 }; class Qi { constructor(e57 = 0, t45 = 0, i26 = 0, o88 = 0) { if (isNaN(e57) || e57 < 0 || isNaN(t45) || t45 < 0 || isNaN(i26) || i26 < 0 || isNaN(o88) || o88 < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers"); this.top = e57, this.bottom = t45, this.left = i26, this.right = o88; } interpolate(t45, i26, o88) { return null != i26.top && null != t45.top && (this.top = e56.ak(t45.top, i26.top, o88)), null != i26.bottom && null != t45.bottom && (this.bottom = e56.ak(t45.bottom, i26.bottom, o88)), null != i26.left && null != t45.left && (this.left = e56.ak(t45.left, i26.left, o88)), null != i26.right && null != t45.right && (this.right = e56.ak(t45.right, i26.right, o88)), this; } getCenter(t45, i26) { const o88 = e56.aA((this.left + t45 - this.right) / 2, 0, t45), s18 = e56.aA((this.top + i26 - this.bottom) / 2, 0, i26); return new e56.P(o88, s18); } equals(e57) { return this.top === e57.top && this.bottom === e57.bottom && this.left === e57.left && this.right === e57.right; } clone() { return new Qi(this.top, this.bottom, this.left, this.right); } toJSON() { return { top: this.top, bottom: this.bottom, left: this.left, right: this.right }; } } const eo = 15; class to3 { constructor(t45, i26, o88, s18, r86, n45, a46) { this.tileSize = 512, this._renderWorldCopies = void 0 === r86 || r86, this._minZoom = t45 || 0, this._maxZoom = i26 || 22, this._minPitch = o88 ?? 0, this._maxPitch = s18 ?? 60, this.setProjection(n45), this.setMaxBounds(a46), this.width = 0, this.height = 0, this._center = new e56.aR(0, 0), this.zoom = 0, this.angle = 0, this._fov = 0.6435011087932844, this._pitch = 0, this._nearZ = 0, this._farZ = 0, this._unmodified = true, this._edgeInsets = new Qi(), this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._fogTileMatrixCache = {}, this._expandedProjMatrixCache = {}, this._distanceTileDataCache = {}, this._camera = new Ki(), this._centerAltitude = 0, this._averageElevation = 0, this.cameraElevationReference = "ground", this._pixelsPerMercatorPixel = 1, this.globeRadius = 0, this.globeCenterInViewSpace = [0, 0, 0], this._tileCoverLift = 0, this.freezeTileCoverage = false, this._horizonShift = 0.1, this._orthographicProjectionAtLowPitch = false, this._allowWorldUnderZoom = false; } clone() { const e57 = new to3(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies, this.getProjection(), this.maxBounds); return e57._elevation = this._elevation, e57._centerAltitude = this._centerAltitude, e57._centerAltitudeValidForExaggeration = this._centerAltitudeValidForExaggeration, e57.tileSize = this.tileSize, e57.mercatorFromTransition = this.mercatorFromTransition, e57.width = this.width, e57.height = this.height, e57.cameraElevationReference = this.cameraElevationReference, e57._center = this._center, e57._setZoom(this.zoom), e57._seaLevelZoom = this._seaLevelZoom, e57.angle = this.angle, e57._fov = this._fov, e57._pitch = this._pitch, e57._nearZ = this._nearZ, e57._farZ = this._farZ, e57._averageElevation = this._averageElevation, e57._orthographicProjectionAtLowPitch = this._orthographicProjectionAtLowPitch, e57._unmodified = this._unmodified, e57._edgeInsets = this._edgeInsets.clone(), e57._camera = this._camera.clone(), e57._calcMatrices(), e57.freezeTileCoverage = this.freezeTileCoverage, e57.frustumCorners = this.frustumCorners, e57._allowWorldUnderZoom = this._allowWorldUnderZoom, e57; } get isOrthographic() { return "globe" !== this.projection.name && this._orthographicProjectionAtLowPitch && this.pitch < eo; } get elevation() { return this._elevation; } set elevation(e57) { this._elevation !== e57 && (this._elevation = e57, this._updateCameraOnTerrain(), this._calcMatrices()); } get depthOcclusionForSymbolsAndCircles() { return "globe" !== this.projection.name && !this.isOrthographic; } updateElevation(e57, t45 = false) { const i26 = this._elevation && this._elevation.exaggeration() !== this._centerAltitudeValidForExaggeration; (null == this._seaLevelZoom || i26) && this._updateCameraOnTerrain(), (e57 || i26) && this._constrainCamera(t45), this._calcMatrices(); } getProjection() { return e56.aH(this.projection, ["name", "center", "parallels"]); } setProjection(t45) { this.projectionOptions = t45 || { name: "mercator" }; const i26 = this.projection ? this.getProjection() : void 0; this.projection = e56.cl(this.projectionOptions); const o88 = this.getProjection(), s18 = !e56.by(i26, o88); return s18 && this._calcMatrices(), this.mercatorFromTransition = false, s18; } setOrthographicProjectionAtLowPitch(e57) { return this._orthographicProjectionAtLowPitch !== e57 && (this._orthographicProjectionAtLowPitch = e57, this._calcMatrices(), true); } setMercatorFromTransition() { const t45 = this.projection.name; this.mercatorFromTransition = true, this.projectionOptions = { name: "mercator" }, this.projection = e56.cl({ name: "mercator" }); const i26 = t45 !== this.projection.name; return i26 && this._calcMatrices(), i26; } get minZoom() { return this._minZoom; } set minZoom(e57) { this._minZoom !== e57 && (this._minZoom = e57, this.zoom = Math.max(this.zoom, e57)); } get maxZoom() { return this._maxZoom; } set maxZoom(e57) { this._maxZoom !== e57 && (this._maxZoom = e57, this.zoom = Math.min(this.zoom, e57)); } get minPitch() { return this._minPitch; } set minPitch(e57) { this._minPitch !== e57 && (this._minPitch = e57, this.pitch = Math.max(this.pitch, e57)); } get maxPitch() { return this._maxPitch; } set maxPitch(e57) { this._maxPitch !== e57 && (this._maxPitch = e57, this.pitch = Math.min(this.pitch, e57)); } get renderWorldCopies() { return this._renderWorldCopies && true === this.projection.supportsWorldCopies; } set renderWorldCopies(e57) { void 0 === e57 ? e57 = true : null === e57 && (e57 = false), this._renderWorldCopies = e57; } get worldSize() { return this.tileSize * this.scale; } get cameraWorldSizeForFog() { const e57 = Math.max(this._camera.getDistanceToElevation(this._averageElevation), Number.EPSILON); return this._worldSizeFromZoom(this._zoomFromMercatorZ(e57)); } get cameraWorldSize() { const e57 = Math.max(this._camera.getDistanceToElevation(this._averageElevation, true), Number.EPSILON); return this._worldSizeFromZoom(this._zoomFromMercatorZ(e57)); } get pixelsPerMeter() { return this.projection.pixelsPerMeter(this.center.lat, this.worldSize); } get cameraPixelsPerMeter() { return e56.ce(1, this.center.lat) * this.cameraWorldSizeForFog; } get centerOffset() { return this.centerPoint._sub(this.size._div(2)); } get size() { return new e56.P(this.width, this.height); } get bearing() { return e56.bT(this.rotation, -180, 180); } set bearing(e57) { this.rotation = e57; } get rotation() { return -this.angle / Math.PI * 180; } set rotation(t45) { const i26 = -t45 * Math.PI / 180; this.angle !== i26 && (this._unmodified = false, this.angle = i26, this._calcMatrices(), this.rotationMatrix = e56.cm(), e56.cn(this.rotationMatrix, this.rotationMatrix, this.angle)); } get pitch() { return this._pitch / Math.PI * 180; } set pitch(t45) { const i26 = e56.aA(t45, this.minPitch, this.maxPitch) / 180 * Math.PI; this._pitch !== i26 && (this._unmodified = false, this._pitch = i26, this._calcMatrices()); } get aspect() { return this.width / this.height; } get fov() { return this._fov / Math.PI * 180; } set fov(t45) { t45 = Math.max(0.01, Math.min(60, t45)), this._fov !== t45 && (this._unmodified = false, this._fov = e56.an(t45), this._calcMatrices()); } get fovX() { return this._fov; } get fovY() { const e57 = 1 / Math.tan(0.5 * this.fovX); return 2 * Math.atan(1 / this.aspect / e57); } get averageElevation() { return this._averageElevation; } set averageElevation(e57) { this._averageElevation = e57, this._calcFogMatrices(), this._distanceTileDataCache = {}; } get zoom() { return this._zoom; } set zoom(e57) { const t45 = Math.min(Math.max(e57, this.minZoom), this.maxZoom); this._zoom !== t45 && (this._unmodified = false, this._setZoom(t45), this._updateSeaLevelZoom(), this._constrain(), this._calcMatrices()); } _setZoom(e57) { this._zoom = e57, this.scale = this.zoomScale(e57), this.tileZoom = Math.floor(e57), this.zoomFraction = e57 - this.tileZoom; } get tileCoverLift() { return this._tileCoverLift; } set tileCoverLift(e57) { this._tileCoverLift !== e57 && (this._tileCoverLift = e57); } _updateCameraOnTerrain() { const e57 = this.elevation ? this.elevation.getAtPoint(this.locationCoordinate(this.center), Number.NEGATIVE_INFINITY) : Number.NEGATIVE_INFINITY, t45 = this.elevation && e57 === Number.NEGATIVE_INFINITY && this.elevation.visibleDemTiles.length > 0 && this.elevation.exaggeration() > 0 && this._centerAltitudeValidForExaggeration; if (!this._elevation || e57 === Number.NEGATIVE_INFINITY && (!t45 || !this._centerAltitude)) return this._centerAltitude = 0, this._seaLevelZoom = null, void (this._centerAltitudeValidForExaggeration = void 0); const i26 = this._elevation; t45 || this._centerAltitude && this._centerAltitudeValidForExaggeration && i26.exaggeration() && this._centerAltitudeValidForExaggeration !== i26.exaggeration() ? (this._centerAltitude = this._centerAltitude / this._centerAltitudeValidForExaggeration * i26.exaggeration(), this._centerAltitudeValidForExaggeration = i26.exaggeration()) : (this._centerAltitude = e57 || 0, this._centerAltitudeValidForExaggeration = i26.exaggeration()), this._updateSeaLevelZoom(); } _updateSeaLevelZoom() { if (void 0 === this._centerAltitudeValidForExaggeration) return; const e57 = Math.max(0, (this.pixelsPerMeter * this._centerAltitude + this.cameraToCenterDistance) / this.worldSize); this._seaLevelZoom = this._zoomFromMercatorZ(e57); } sampleAverageElevation() { if (!this._elevation) return 0; const t45 = this._elevation, i26 = [[0.5, 0.2], [0.3, 0.5], [0.5, 0.5], [0.7, 0.5], [0.5, 0.8]], o88 = this.horizonLineFromTop(); let s18 = 0, r86 = 0; for (let n45 = 0; n45 < i26.length; n45++) { const a46 = new e56.P(i26[n45][0] * this.width, o88 + i26[n45][1] * (this.height - o88)), l21 = t45.pointCoordinate(a46); if (!l21) continue; const c28 = 1 / Math.hypot(l21[0] - this._camera.position[0], l21[1] - this._camera.position[1]); s18 += l21[3] * c28, r86 += c28; } return 0 === r86 ? NaN : s18 / r86; } get center() { return this._center; } set center(e57) { e57.lat === this._center.lat && e57.lng === this._center.lng || (this._unmodified = false, this._center = e57, this._terrainEnabled() && ("ground" === this.cameraElevationReference ? this._updateCameraOnTerrain() : this._updateZoomFromElevation()), this._constrain(), this._calcMatrices()); } _updateZoomFromElevation() { if (null == this._seaLevelZoom || !this._elevation) return; const e57 = this._seaLevelZoom, t45 = this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)), i26 = this.pixelsPerMeter / this.worldSize * t45, o88 = this._mercatorZfromZoom(e57), s18 = this._mercatorZfromZoom(this._maxZoom), r86 = Math.max(o88 - i26, s18); this._setZoom(this._zoomFromMercatorZ(r86)); } get padding() { return this._edgeInsets.toJSON(); } set padding(e57) { this._edgeInsets.equals(e57) || (this._unmodified = false, this._edgeInsets.interpolate(this._edgeInsets, e57, 1), this._calcMatrices()); } computeZoomRelativeTo(t45) { const i26 = this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint, t45.toAltitude())); let o88; o88 = t45.z < this._camera.position[2] ? [i26.x, i26.y, i26.z] : [t45.x, t45.y, t45.z]; const s18 = e56.ag(e56.av([], this._camera.position, o88)); return e56.aA(this._zoomFromMercatorZ(s18), this._minZoom, this._maxZoom); } setFreeCameraOptions(t45) { if (!this.height) return; if (!t45.position && !t45.orientation) return; this._updateCameraState(); let i26 = false; if (t45.orientation && !e56.co(t45.orientation, this._camera.orientation) && (i26 = this._setCameraOrientation(t45.orientation)), t45.position) { const o88 = [t45.position.x, t45.position.y, t45.position.z]; e56.cp(o88, this._camera.position) || (this._setCameraPosition(o88), i26 = true); } i26 && (this._updateStateFromCamera(), this.recenterOnTerrain()); } getFreeCameraOptions() { this._updateCameraState(); const t45 = this._camera.position, i26 = new Yi(); return i26.position = new e56.ae(t45[0], t45[1], t45[2]), i26.orientation = this._camera.orientation, i26._elevation = this.elevation, i26._renderWorldCopies = this.renderWorldCopies, i26; } _setCameraOrientation(t45) { if (!e56.cq(t45)) return false; e56.cr(t45, t45); const i26 = e56.cs([], [0, 0, -1], t45), o88 = e56.cs([], [0, -1, 0], t45); if (o88[2] < 0) return false; const s18 = Xi(i26, o88); return !!s18 && (this._camera.orientation = s18, true); } _setCameraPosition(t45) { const i26 = this.zoomScale(this.minZoom) * this.tileSize, o88 = this.zoomScale(this.maxZoom) * this.tileSize, s18 = this.cameraToCenterDistance; t45[2] = e56.aA(t45[2], s18 / o88, s18 / i26), this._camera.position = t45; } get centerPoint() { return this._edgeInsets.getCenter(this.width, this.height); } get fovAboveCenter() { return this._fov * (0.5 + this.centerOffset.y / this.height); } isPaddingEqual(e57) { return this._edgeInsets.equals(e57); } interpolatePadding(e57, t45, i26) { this._unmodified = false, this._edgeInsets.interpolate(e57, t45, i26), this._constrain(), this._calcMatrices(); } coveringZoomLevel(e57) { const t45 = (e57.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / e57.tileSize)); return Math.max(0, t45); } getVisibleUnwrappedCoordinates(t45) { const i26 = [new e56.ct(0, t45)]; if (this.renderWorldCopies) { const o88 = this.pointCoordinate(new e56.P(0, 0)), s18 = this.pointCoordinate(new e56.P(this.width, 0)), r86 = this.pointCoordinate(new e56.P(this.width, this.height)), n45 = this.pointCoordinate(new e56.P(0, this.height)), a46 = Math.floor(Math.min(o88.x, s18.x, r86.x, n45.x)), l21 = Math.floor(Math.max(o88.x, s18.x, r86.x, n45.x)), c28 = 1; for (let o89 = a46 - c28; o89 <= l21 + c28; o89++) 0 !== o89 && i26.push(new e56.ct(o89, t45)); } return i26; } isLODDisabled(e57) { return (!e57 || this.pitch <= 60) && this._edgeInsets.top <= this._edgeInsets.bottom && !this._elevation && !this.projection.isReprojectedInTileSpace; } extendTileCover(t45, i26, o88) { let s18 = []; const r86 = null != o88, n45 = !r86; if (n45 && this.zoom < i26) return s18; if (r86 && 0 === o88[0] && 0 === o88[1]) return s18; const a46 = /* @__PURE__ */ new Set(), l21 = (t46, i27, o89, r87, n46) => { const l22 = e56.cX(i27, t46, o89, r87, n46); a46.has(l22) || (s18.push(new e56.aO(t46, i27, o89, r87, n46)), a46.add(l22)); }; for (let e57 = 0; e57 < t45.length; e57++) { const s19 = t45[e57]; if (n45 && s19.canonical.z !== i26) continue; const a47 = s19.canonical, c29 = s19.overscaledZ, h8 = s19.wrap, d34 = 1 << a47.z, u12 = a47.x + 1 < d34, _4 = a47.x > 0, p9 = a47.y + 1 < d34, f8 = a47.y > 0, m6 = s19.wrap - (_4 ? 0 : 1), g9 = s19.wrap + (u12 ? 0 : 1), v8 = _4 ? a47.x - 1 : d34 - 1, y4 = u12 ? a47.x + 1 : 0; if (r86) o88[0] < 0 ? (l21(c29, g9, a47.z, y4, a47.y), o88[1] < 0 && p9 && (l21(c29, h8, a47.z, a47.x, a47.y + 1), l21(c29, g9, a47.z, y4, a47.y + 1)), o88[1] > 0 && f8 && (l21(c29, h8, a47.z, a47.x, a47.y - 1), l21(c29, g9, a47.z, y4, a47.y - 1))) : o88[0] > 0 ? (l21(c29, m6, a47.z, v8, a47.y), o88[1] < 0 && p9 && (l21(c29, h8, a47.z, a47.x, a47.y + 1), l21(c29, m6, a47.z, v8, a47.y + 1)), o88[1] > 0 && f8 && (l21(c29, h8, a47.z, a47.x, a47.y - 1), l21(c29, m6, a47.z, v8, a47.y - 1))) : o88[1] < 0 && p9 ? l21(c29, h8, a47.z, a47.x, a47.y + 1) : f8 && l21(c29, h8, a47.z, a47.x, a47.y - 1); else { const e58 = s19.visibleQuadrants; 1 & e58 && (l21(c29, m6, a47.z, v8, a47.y), f8 && (l21(c29, h8, a47.z, a47.x, a47.y - 1), l21(c29, m6, a47.z, v8, a47.y - 1))), 2 & e58 && (l21(c29, g9, a47.z, y4, a47.y), f8 && (l21(c29, h8, a47.z, a47.x, a47.y - 1), l21(c29, g9, a47.z, y4, a47.y - 1))), 4 & e58 && (l21(c29, m6, a47.z, v8, a47.y), p9 && (l21(c29, h8, a47.z, a47.x, a47.y + 1), l21(c29, m6, a47.z, v8, a47.y + 1))), 8 & e58 && (l21(c29, g9, a47.z, y4, a47.y), p9 && (l21(c29, h8, a47.z, a47.x, a47.y + 1), l21(c29, g9, a47.z, y4, a47.y + 1))); } } const c28 = []; for (const e57 of s18) s18.some(((t46) => e57.isChildOf(t46))) || c28.push(e57); if (s18 = c28.filter(((e57) => !t45.some(((t46) => !!(e57.overscaledZ < i26 && t46.isChildOf(e57)) || e57.equals(t46) || e57.isChildOf(t46))))), n45) { const e57 = 1 << i26, t46 = "globe" === this.projection.name ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint()), o89 = [e57 * t46.x, e57 * t46.y], r87 = 4, n46 = r87 * r87; s18 = s18.filter(((e58) => { const t47 = e58.canonical.x + 0.5 - o89[0], i27 = e58.canonical.y + 0.5 - o89[1]; return t47 * t47 + i27 * i27 < n46; })); } return s18; } extendTileCoverToNearPlane(t45, i26, o88) { const s18 = [], r86 = /* @__PURE__ */ new Set(); for (const e57 of t45) r86.add(e57.key); const n45 = (t46, i27, o89, n46, a47) => { const l22 = e56.cX(i27, t46, o89, n46, a47); r86.has(l22) || (s18.push(new e56.aO(t46, i27, o89, n46, a47)), r86.add(l22)); }, a46 = t45.reduce(((e57, t46) => Math.max(e57, t46.overscaledZ)), o88), l21 = 1 << o88, c28 = [new e56.P(0, 0), new e56.P(e56.al, 0), new e56.P(e56.al, e56.al), new e56.P(0, e56.al)], h8 = new e56.P(0, 0), d34 = new e56.P(0, 0), u12 = (t46, i27) => { const s19 = Math.floor(t46[0]), r87 = Math.floor(t46[1]), u13 = (t46[0] - s19) * e56.al, _5 = (t46[1] - r87) * e56.al, p10 = Math.floor(i27[0]), f9 = Math.floor(i27[1]), m7 = (i27[0] - p10) * e56.al, g10 = (i27[1] - f9) * e56.al; for (let t47 = -1; t47 <= 1; t47++) { const i28 = s19 + t47; if (!(i28 < 0 || i28 >= l21)) { h8.x = u13 - t47 * e56.al, d34.x = m7 - (i28 - p10) * e56.al; for (let t48 = -1; t48 <= 1; t48++) { const s20 = r87 + t48; h8.y = _5 - t48 * e56.al, d34.y = g10 - (s20 - f9) * e56.al, e56.cY(h8, d34, c28) && n45(a46, 0, o88, i28, s20); } } } }, _4 = i26.points, p9 = _4[e56.cu], f8 = _4[e56.cv], m6 = this._projectToGround(p9, _4[e56.cw]), g9 = this._projectToGround(f8, _4[e56.cx]); return u12(p9, m6), u12(f8, g9), s18; } _projectToGround(t45, i26) { return e56.cy(e56.cz(), t45, i26, t45[2] / (t45[2] - i26[2])); } coveringTiles(t45) { let i26 = this.coveringZoomLevel(t45); const o88 = i26, s18 = this.elevation && this.elevation.exaggeration(), r86 = s18 && !t45.isTerrainDEM, n45 = "mercator" === this.projection.name; if (void 0 !== t45.minzoom && i26 < t45.minzoom) return []; void 0 !== t45.maxzoom && i26 > t45.maxzoom && (i26 = t45.maxzoom); const a46 = this.locationCoordinate(this.center), l21 = this.center.lat, c28 = 1 << i26, h8 = [c28 * a46.x, c28 * a46.y, 0], d34 = "globe" === this.projection.name, u12 = !d34, _4 = e56.cA.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, i26, u12), p9 = d34 ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint()), f8 = c28 * e56.ce(1, this.center.lat), m6 = this._camera.position[2] / e56.ce(1, this.center.lat), g9 = [c28 * p9.x, c28 * p9.y, m6 * (u12 ? 1 : f8)], v8 = d34 || s18, y4 = this.cameraToCenterDistance / t45.tileSize * (t45.roundZoom ? 1 : 0.502), x4 = this.isLODDisabled(true) ? i26 : 0; let b8; if (this._elevation && t45.isTerrainDEM) b8 = 1e4 * this._elevation.exaggeration(); else if (this._elevation) { const e57 = this._elevation.getMinMaxForVisibleTiles(); b8 = e57 ? e57.max : this._centerAltitude; } else b8 = this._centerAltitude; const w4 = t45.isTerrainDEM ? -b8 : this._elevation ? this._elevation.getMinElevationBelowMSL() : 0, T5 = this.projection.isReprojectedInTileSpace ? e56.cB(this) : 1, E5 = (t46) => { const i27 = 1 / 4e4, o89 = new e56.ae(t46.x + i27, t46.y, t46.z), s19 = new e56.ae(t46.x, t46.y + i27, t46.z), r87 = t46.toLngLat(), n46 = o89.toLngLat(), a47 = s19.toLngLat(), l22 = this.locationCoordinate(r87), c29 = this.locationCoordinate(n46), h9 = this.locationCoordinate(a47), d35 = Math.hypot(c29.x - l22.x, c29.y - l22.y), u13 = Math.hypot(h9.x - l22.x, h9.y - l22.y); return Math.sqrt(d35 * u13) * T5 / i27; }, S5 = (t46) => { const i27 = b8, o89 = w4; return { aabb: e56.cE(this, c28, 0, 0, 0, t46, o89, i27, this.projection), zoom: 0, x: 0, y: 0, minZ: o89, maxZ: i27, wrap: t46, fullyVisible: false }; }, I4 = []; let C6 = []; const R5 = i26, A4 = t45.reparseOverscaled ? o88 : i26, D5 = (m6 - this._centerAltitude) * f8, L3 = (e57) => { if (!this._elevation || !e57.tileID || !n45) return; const t46 = this._elevation.getMinMaxForTile(e57.tileID), i27 = e57.aabb; t46 ? (i27.min[2] = t46.min, i27.max[2] = t46.max, i27.center[2] = (i27.min[2] + i27.max[2]) / 2) : (e57.shouldSplit = z4(e57), e57.shouldSplit || (i27.min[2] = i27.max[2] = i27.center[2] = this._centerAltitude)); }, P4 = (e57, t46) => { if (0.707 * t46 < e57) return 1; const i27 = t46 / e57; return i27 / (1.4144271570014144 + (Math.pow(1.1, i27 - 1.4144271570014144 + 1) - 1) / (1.1 - 1) - 1); }, z4 = (t46) => { if (t46.zoom < x4) return true; if (t46.zoom === R5) return false; if (null != t46.shouldSplit) return t46.shouldSplit; const i27 = t46.aabb.distanceX(g9), s19 = t46.aabb.distanceY(g9); let a47 = D5, c29 = 1; if (d34) { a47 = t46.aabb.distanceZ(g9); const i28 = Math.pow(2, t46.zoom), o89 = e56.a$((t46.y + 1) / i28), s20 = e56.a$(t46.y / i28), r87 = Math.min(Math.max(l21, o89), s20), n46 = e56.d0(r87) / e56.d0(l21); if (c29 = r87 === l21 ? 1 / Math.max(1, this._mercatorScaleRatio - 0.3) : Math.min(1, n46 / this._mercatorScaleRatio), this.zoom <= e56.cZ && t46.zoom === R5 - 1 && n46 >= 0.9) return true; } else if (r86 && (a47 = t46.aabb.distanceZ(g9) * f8), this.projection.isReprojectedInTileSpace && o88 <= 5) { const i28 = Math.pow(2, t46.zoom), o89 = E5(new e56.ae((t46.x + 0.5) / i28, (t46.y + 0.5) / i28)); c29 = o89 > 0.85 ? 1 : o89; } if (!n45) { const e57 = Math.sqrt(i27 * i27 + s19 * s19 + a47 * a47); let o89 = (1 << R5 - t46.zoom) * y4 * c29; return o89 *= P4(Math.max(a47, D5), e57), e57 < o89; } let u13 = Number.MAX_VALUE, _5 = 0; const p10 = t46.aabb.getCorners(), m7 = []; for (const t47 of p10) { e56.av(m7, t47, g9), d34 || (r86 ? m7[2] *= f8 : m7[2] = D5); const i28 = e56.bJ(m7, this._camera.forward()); i28 < u13 && (u13 = i28, _5 = Math.abs(m7[2])); } let v9 = (1 << R5 - t46.zoom) * y4 * c29; if (v9 *= P4(Math.max(_5, D5), u13), u13 < v9) return true; const b9 = t46.aabb.closestPoint(h8); return b9[0] === h8[0] && b9[1] === h8[1]; }; if (this.renderWorldCopies) for (let e57 = 1; e57 <= 3; e57++) I4.push(S5(-e57)), I4.push(S5(e57)); for (I4.push(S5(0)); I4.length > 0; ) { const o89 = I4.pop(), s19 = o89.x, a47 = o89.y; let l22 = o89.fullyVisible; const u13 = () => "globe" === this.projection.name && (0 === o89.y || o89.y === (1 << o89.zoom) - 1); if (!l22) { let t46 = v8 ? o89.aabb.intersects(_4) : o89.aabb.intersectsFlat(_4); if (0 === t46 && u13()) { const i27 = new e56.cC(o89.zoom, s19, a47); t46 = e56.cD(this, c28, i27, true).intersects(_4); } if (0 === t46) continue; l22 = 2 === t46; } if (o89.zoom !== R5 && z4(o89)) for (let t46 = 0; t46 < 4; t46++) { const i27 = (s19 << 1) + t46 % 2, h9 = (a47 << 1) + (t46 >> 1), u14 = { aabb: n45 ? o89.aabb.quadrant(t46) : e56.cE(this, c28, o89.zoom + 1, i27, h9, o89.wrap, o89.minZ, o89.maxZ, this.projection), zoom: o89.zoom + 1, x: i27, y: h9, wrap: o89.wrap, fullyVisible: l22, tileID: void 0, shouldSplit: void 0, minZ: o89.minZ, maxZ: o89.maxZ }; r86 && !d34 && (u14.tileID = new e56.aO(o89.zoom + 1 === R5 ? A4 : o89.zoom + 1, o89.wrap, o89.zoom + 1, i27, h9), L3(u14)), I4.push(u14); } else { const r87 = o89.zoom === R5 ? A4 : o89.zoom; if (t45.minzoom && t45.minzoom > r87) continue; let n46 = 0; if (!l22) { let i27 = v8 ? o89.aabb.intersectsPrecise(_4) : o89.aabb.intersectsPreciseFlat(_4); if (0 === i27 && u13()) { const t46 = new e56.cC(o89.zoom, s19, a47); i27 = e56.cD(this, c28, t46, true).intersectsPrecise(_4); } if (0 === i27) continue; if (t45.calculateQuadrantVisibility) if (_4.containsPoint(o89.aabb.center)) n46 = 15; else for (let e57 = 0; e57 < 4; e57++) 0 !== o89.aabb.quadrant(e57).intersects(_4) && (n46 |= 1 << e57); } const d35 = h8[0] - (0.5 + s19 + (o89.wrap << o89.zoom)) * (1 << i26 - o89.zoom), p10 = h8[1] - 0.5 - a47, f9 = o89.tileID ? o89.tileID : new e56.aO(r87, o89.wrap, o89.zoom, s19, a47); t45.calculateQuadrantVisibility && (f9.visibleQuadrants = n46), C6.push({ tileID: f9, distanceSq: d35 * d35 + p10 * p10 }); } } if (this.fogCullDistSq) { const i27 = this.fogCullDistSq, o89 = this.horizonLineFromTop(); C6 = C6.filter(((s19) => { const r87 = [0, 0, 0, 1], n46 = [e56.al, e56.al, 0, 1], a47 = this.calculateFogTileMatrix(s19.tileID.toUnwrapped()); e56.aC(r87, r87, a47), e56.aC(n46, n46, a47); const l22 = e56.cF([], r87, n46), c29 = e56.cG([], r87, n46), h9 = e56.c_(l22, c29); if (0 === h9) return true; let d35 = false; const u13 = this._elevation; if (u13 && h9 > i27 && 0 !== o89) { const i28 = this.calculateProjMatrix(s19.tileID.toUnwrapped()); let r88; t45.isTerrainDEM || (r88 = u13.getMinMaxForTile(s19.tileID)), r88 || (r88 = { min: w4, max: b8 }); const n47 = e56.cH(this.rotation), a48 = [n47[0] * e56.al, n47[1] * e56.al, r88.max]; e56.af(a48, a48, i28), d35 = (1 - a48[1]) * this.height * 0.5 < o89; } return h9 < i27 || d35; })); } return C6.sort(((e57, t46) => e57.distanceSq - t46.distanceSq)).map(((e57) => e57.tileID)); } resize(e57, t45) { this.width = e57, this.height = t45, this.pixelsToGLUnits = [2 / e57, -2 / t45], this._constrain(), this._calcMatrices(); } get unmodified() { return this._unmodified; } zoomScale(e57) { return Math.pow(2, e57); } scaleZoom(e57) { return Math.log2(e57); } project(t45) { const i26 = e56.aA(t45.lat, -e56.cI, e56.cI), o88 = this.projection.project(t45.lng, i26); return new e56.P(o88.x * this.worldSize, o88.y * this.worldSize); } unproject(e57) { return this.projection.unproject(e57.x / this.worldSize, e57.y / this.worldSize); } get point() { return this.project(this.center); } get pointMerc() { return this.point._div(this.worldSize); } get pixelsPerMeterRatio() { return this.pixelsPerMeter / e56.ce(1, this.center.lat) / this.worldSize; } setLocationAtPoint(t45, i26) { let o88, s18; const r86 = this.centerPoint; if ("globe" === this.projection.name) { const e57 = this.worldSize; o88 = (i26.x - r86.x) / e57, s18 = (i26.y - r86.y) / e57; } else { const e57 = this.pointCoordinate(i26), t46 = this.pointCoordinate(r86); o88 = e57.x - t46.x, s18 = e57.y - t46.y; } const n45 = this.locationCoordinate(t45); this.setLocation(new e56.ae(n45.x - o88, n45.y - s18)); } setLocation(e57) { this.center = this.coordinateLocation(e57), this.projection.wrap && (this.center = this.center.wrap()); } locationPoint(e57, t45) { return this.projection.locationPoint(this, e57, t45); } locationPoint3D(e57, t45) { return this.projection.locationPoint(this, e57, t45, true); } pointLocation(e57) { return this.coordinateLocation(this.pointCoordinate(e57)); } pointLocation3D(e57, t45) { return this.coordinateLocation(this.pointCoordinate3D(e57, t45)); } locationCoordinate(t45, i26) { const o88 = i26 ? e56.ce(i26, t45.lat) : void 0, s18 = this.projection.project(t45.lng, t45.lat); return new e56.ae(s18.x, s18.y, o88); } coordinateLocation(e57) { return this.projection.unproject(e57.x, e57.y); } pointRayIntersection(t45, i26) { const o88 = null != i26 ? i26 : this._centerAltitude, s18 = [t45.x, t45.y, 0, 1], r86 = [t45.x, t45.y, 1, 1]; e56.aC(s18, s18, this.pixelMatrixInverse), e56.aC(r86, r86, this.pixelMatrixInverse); const n45 = r86[3]; e56.cJ(s18, s18, 1 / s18[3]), e56.cJ(r86, r86, 1 / n45); const a46 = s18[2], l21 = r86[2]; return { p0: s18, p1: r86, t: a46 === l21 ? 0 : (o88 - a46) / (l21 - a46) }; } screenPointToMercatorRay(t45) { const i26 = [t45.x, t45.y, 0, 1], o88 = [t45.x, t45.y, 1, 1]; return e56.aC(i26, i26, this.pixelMatrixInverse), e56.aC(o88, o88, this.pixelMatrixInverse), e56.cJ(i26, i26, 1 / i26[3]), e56.cJ(o88, o88, 1 / o88[3]), i26[2] = e56.ce(i26[2], this._center.lat) * this.worldSize, o88[2] = e56.ce(o88[2], this._center.lat) * this.worldSize, e56.cJ(i26, i26, 1 / this.worldSize), e56.cJ(o88, o88, 1 / this.worldSize), new e56.ax([i26[0], i26[1], i26[2]], e56.aw([], e56.av([], o88, i26))); } rayIntersectionCoordinate(t45) { const { p0: i26, p1: o88, t: s18 } = t45, r86 = e56.ce(i26[2], this._center.lat), n45 = e56.ce(o88[2], this._center.lat); return new e56.ae(e56.ak(i26[0], o88[0], s18) / this.worldSize, e56.ak(i26[1], o88[1], s18) / this.worldSize, e56.ak(r86, n45, s18)); } pointCoordinate(e57, t45 = this._centerAltitude) { return this.projection.pointCoordinate(this, e57.x, e57.y, t45); } pointCoordinate3D(t45, i26) { if (!this.elevation) return this.pointCoordinate(t45, i26); let o88 = this.projection.pointCoordinate3D(this, t45.x, t45.y); if (o88) return new e56.ae(o88[0], o88[1], o88[2]); let s18 = 0, r86 = this.horizonLineFromTop(); if (t45.y > r86) return this.pointCoordinate(t45, i26); const n45 = 0.02 * r86, a46 = t45.clone(); for (let t46 = 0; t46 < 10 && r86 - s18 > n45; t46++) { a46.y = e56.ak(s18, r86, 0.66); const t47 = this.projection.pointCoordinate3D(this, a46.x, a46.y); t47 ? (r86 = a46.y, o88 = t47) : s18 = a46.y; } return o88 ? new e56.ae(o88[0], o88[1], o88[2]) : this.pointCoordinate(t45); } isPointAboveHorizon(e57) { return this.projection.isPointAboveHorizon(this, e57); } isPointOnSurface(t45) { if (t45.y < 0 || t45.y > this.height || t45.x < 0 || t45.x > this.width) return false; if (this.elevation || this.zoom >= e56.cK) return !this.isPointAboveHorizon(t45); const i26 = this.pointCoordinate(t45); return i26.y >= 0 && i26.y <= 1; } _coordinatePoint(t45, i26) { const o88 = i26 && this.elevation ? this.elevation.getAtPointOrZero(t45, this._centerAltitude) : this._centerAltitude, s18 = [t45.x * this.worldSize, t45.y * this.worldSize, o88 + t45.toAltitude(), 1]; return e56.aC(s18, s18, this.pixelMatrix), s18[3] > 0 ? new e56.P(s18[0] / s18[3], s18[1] / s18[3]) : new e56.P(Number.MAX_VALUE, Number.MAX_VALUE); } _getBoundsNonRectangular() { const { top: t45, left: i26 } = this._edgeInsets, o88 = this.height - this._edgeInsets.bottom, s18 = this.width - this._edgeInsets.right, r86 = this.pointLocation3D(new e56.P(i26, t45)), n45 = this.pointLocation3D(new e56.P(s18, t45)), a46 = this.pointLocation3D(new e56.P(s18, o88)), l21 = this.pointLocation3D(new e56.P(i26, o88)); let c28 = Math.min(r86.lng, n45.lng, a46.lng, l21.lng), h8 = Math.max(r86.lng, n45.lng, a46.lng, l21.lng), d34 = Math.min(r86.lat, n45.lat, a46.lat, l21.lat), u12 = Math.max(r86.lat, n45.lat, a46.lat, l21.lat); const _4 = Math.pow(2, -this.zoom) / 16 * 270, p9 = "globe" === this.projection.name ? 1 : 4, f8 = (t46, i27, o89, s19, r87) => { const n46 = (t46 + o89) / 2, a47 = (i27 + s19) / 2, l22 = new e56.P(n46, a47), { lng: m6, lat: g9 } = this.pointLocation3D(l22), v8 = Math.max(0, c28 - m6, d34 - g9, m6 - h8, g9 - u12); c28 = Math.min(c28, m6), h8 = Math.max(h8, m6), d34 = Math.min(d34, g9), u12 = Math.max(u12, g9), (r87 < p9 || v8 > _4) && (f8(t46, i27, n46, a47, r87 + 1), f8(n46, a47, o89, s19, r87 + 1)); }; if (f8(i26, t45, s18, t45, 1), f8(s18, t45, s18, o88, 1), f8(s18, o88, i26, o88, 1), f8(i26, o88, i26, t45, 1), "globe" === this.projection.name) { const [t46, i27] = e56.cL(this); t46 ? (u12 = 90, h8 = 180, c28 = -180) : i27 && (d34 = -90, h8 = 180, c28 = -180); } return new e56.aI(new e56.aR(c28, d34), new e56.aR(h8, u12)); } _getBoundsRectangular(t45, i26) { const { top: o88, left: s18 } = this._edgeInsets, r86 = this.height - this._edgeInsets.bottom, n45 = this.width - this._edgeInsets.right, a46 = new e56.P(s18, o88), l21 = new e56.P(n45, o88), c28 = new e56.P(n45, r86), h8 = new e56.P(s18, r86); let d34 = this.pointCoordinate(a46, t45), u12 = this.pointCoordinate(l21, t45); const _4 = this.pointCoordinate(c28, i26), p9 = this.pointCoordinate(h8, i26), f8 = (e57, t46) => (t46.y - e57.y) / (t46.x - e57.x); return d34.y > 1 && u12.y >= 0 ? d34 = new e56.ae((1 - p9.y) / f8(p9, d34) + p9.x, 1) : d34.y < 0 && u12.y <= 1 && (d34 = new e56.ae(-p9.y / f8(p9, d34) + p9.x, 0)), u12.y > 1 && d34.y >= 0 ? u12 = new e56.ae((1 - _4.y) / f8(_4, u12) + _4.x, 1) : u12.y < 0 && d34.y <= 1 && (u12 = new e56.ae(-_4.y / f8(_4, u12) + _4.x, 0)), new e56.aI().extend(this.coordinateLocation(d34)).extend(this.coordinateLocation(u12)).extend(this.coordinateLocation(p9)).extend(this.coordinateLocation(_4)); } _getBoundsRectangularTerrain() { const e57 = this.elevation; if (!e57.visibleDemTiles.length || e57.isUsingMockSource()) return this._getBoundsRectangular(0, 0); const t45 = e57.visibleDemTiles.reduce(((e58, t46) => { if (t46.dem) { const i26 = t46.dem.tree; e58.min = Math.min(e58.min, i26.minimums[0]), e58.max = Math.max(e58.max, i26.maximums[0]); } return e58; }), { min: Number.MAX_VALUE, max: 0 }); return this._getBoundsRectangular(t45.min * e57.exaggeration(), t45.max * e57.exaggeration()); } getBounds() { return "mercator" === this.projection.name || "equirectangular" === this.projection.name ? this._terrainEnabled() ? this._getBoundsRectangularTerrain() : this._getBoundsRectangular(0, 0) : this._getBoundsNonRectangular(); } horizonLineFromTop(e57 = true) { const t45 = this.height / 2 / Math.tan(this._fov / 2) / Math.tan(Math.max(this._pitch, 0.1)) - this.centerOffset.y, i26 = this.height / 2 - t45 * (1 - this._horizonShift); return e57 ? Math.max(0, i26) : i26; } getMaxBounds() { return this.maxBounds; } setMaxBounds(t45) { this.maxBounds = t45, this.minLat = -e56.cI, this.maxLat = e56.cI, this.minLng = -180, this.maxLng = 180, t45 && (this.minLat = t45.getSouth(), this.maxLat = t45.getNorth(), this.minLng = t45.getWest(), this.maxLng = t45.getEast(), this.maxLng < this.minLng && (this.maxLng += 360)), this.worldMinX = e56.aF(this.minLng) * this.tileSize, this.worldMaxX = e56.aF(this.maxLng) * this.tileSize, this.worldMinY = e56.aJ(this.maxLat) * this.tileSize, this.worldMaxY = e56.aJ(this.minLat) * this.tileSize, this._constrain(); } calculatePosMatrix(e57, t45) { return this.projection.createTileMatrix(this, t45, e57); } calculateDistanceTileData(t45) { const i26 = t45.key, o88 = this._distanceTileDataCache; if (o88[i26]) return o88[i26]; const s18 = t45.canonical, r86 = 1 / this.height, n45 = this.cameraWorldSize, a46 = n45 / this.zoomScale(s18.z), l21 = (s18.x + Math.pow(2, s18.z) * t45.wrap) * a46, c28 = s18.y * a46, h8 = this.point; h8.x *= n45 / this.worldSize, h8.y *= n45 / this.worldSize; const d34 = this.angle, u12 = Math.sin(-d34), _4 = -Math.cos(-d34); return o88[i26] = { bearing: [u12, _4], center: [(h8.x - l21) * r86, (h8.y - c28) * r86], scale: a46 / e56.al * r86 }, o88[i26]; } calculateFogTileMatrix(t45) { const i26 = t45.key, o88 = this._fogTileMatrixCache; if (o88[i26]) return o88[i26]; const s18 = this.projection.createTileMatrix(this, this.cameraWorldSizeForFog, t45); return e56.aB(s18, this.worldToFogMatrix, s18), o88[i26] = new Float32Array(s18), o88[i26]; } calculateProjMatrix(t45, i26 = false, o88 = false) { const s18 = t45.key; let r86; if (r86 = o88 ? this._expandedProjMatrixCache : i26 ? this._alignedProjMatrixCache : this._projMatrixCache, r86[s18]) return r86[s18]; const n45 = this.calculatePosMatrix(t45, this.worldSize); let a46; return a46 = this.projection.isReprojectedInTileSpace ? this.mercatorMatrix : o88 ? this.expandedFarZProjMatrix : i26 ? this.alignedProjMatrix : this.projMatrix, e56.aB(n45, a46, n45), r86[s18] = new Float32Array(n45), r86[s18]; } calculatePixelsToTileUnitsMatrix(t45) { const i26 = t45.tileID.key, o88 = this._pixelsToTileUnitsCache; if (o88[i26]) return o88[i26]; const s18 = e56.cM(t45, this); return o88[i26] = s18, o88[i26]; } customLayerMatrix() { return this.mercatorMatrix.slice(); } globeToMercatorMatrix() { if ("globe" === this.projection.name) { const t45 = 1 / this.worldSize, i26 = e56.bq([], [t45, t45, t45]); return e56.aB(i26, i26, this.globeMatrix), i26; } } recenterOnTerrain() { if (!this._elevation || "globe" === this.projection.name) return; const t45 = this._elevation; this._updateCameraState(); const i26 = e56.ce(1, this._center.lat) * this.worldSize, o88 = this._computeCameraPosition(i26), s18 = this._camera.forward(), r86 = e56.ce(1, this._center.lat); o88[2] /= r86, s18[2] /= r86, e56.aw(s18, s18); const n45 = t45.raycast(o88, s18, t45.exaggeration()); if (n45) { const t46 = e56.bH([], o88, s18, n45), i27 = new e56.ae(t46[0], t46[1], e56.ce(t46[2], e56.a$(t46[1]))), a46 = (i27.z + e56.ag([i27.x - o88[0], i27.y - o88[1], i27.z - o88[2] * r86])) * this._pixelsPerMercatorPixel; this._seaLevelZoom = this._zoomFromMercatorZ(a46), this._centerAltitude = i27.toAltitude(), this._center = this.coordinateLocation(i27), this._updateZoomFromElevation(), this._constrain(), this._calcMatrices(); } } _constrainCamera(t45 = false) { if (!this._elevation) return; const i26 = this._elevation, o88 = e56.ce(1, this._center.lat) * this.worldSize, s18 = this._computeCameraPosition(o88), r86 = i26.getAtPointOrZero(new e56.ae(...s18)), n45 = this.pixelsPerMeter / this.worldSize * r86, a46 = this._minimumHeightOverTerrain(), l21 = s18[2] - n45; if (l21 <= a46) if (l21 < 0 || t45) { const t46 = this.locationCoordinate(this._center, this._centerAltitude), i27 = [s18[0], s18[1], t46.z - s18[2]], o89 = e56.ag(i27); i27[2] -= (a46 - l21) / this._pixelsPerMercatorPixel; const r87 = e56.ag(i27); if (0 === r87) return; e56.c4(i27, i27, o89 / r87 * this._pixelsPerMercatorPixel), this._camera.position = [s18[0], s18[1], t46.z * this._pixelsPerMercatorPixel - i27[2]], this._updateStateFromCamera(); } else this._isCameraConstrained = true; } _constrain() { if (!this.center || !this.width || !this.height || this._constraining) return; this._constraining = true; const t45 = "globe" === this.projection.name || this.mercatorFromTransition; if (this.projection.isReprojectedInTileSpace || t45) { const i27 = this.center; return i27.lat = e56.aA(i27.lat, this.minLat, this.maxLat), (this.maxBounds || !this.renderWorldCopies && !t45) && (i27.lng = e56.aA(i27.lng, this.minLng, this.maxLng)), this.center = i27, void (this._constraining = false); } const i26 = this._unmodified, { x: o88, y: s18 } = this.point; let r86 = 0, n45 = o88, a46 = s18; const l21 = this.width / 2, c28 = this.height / 2, h8 = this.worldMinY * this.scale, d34 = this.worldMaxY * this.scale; if (s18 - c28 < h8 && (a46 = h8 + c28), s18 + c28 > d34 && (a46 = d34 - c28), d34 - h8 < this.height && (r86 = Math.max(r86, this.height / (d34 - h8)), a46 = (d34 + h8) / 2), this.maxBounds || !this._renderWorldCopies || !this.projection.wrap) { const e57 = this.worldMinX * this.scale, t46 = this.worldMaxX * this.scale, i27 = this.worldSize / 2 - (e57 + t46) / 2; n45 = (o88 + i27 + this.worldSize) % this.worldSize - i27, n45 - l21 < e57 && (n45 = e57 + l21), n45 + l21 > t46 && (n45 = t46 - l21), t46 - e57 < this.width && (r86 = Math.max(r86, this.width / (t46 - e57)), n45 = (t46 + e57) / 2); } n45 === o88 && a46 === s18 || this._allowWorldUnderZoom || (this.center = this.unproject(new e56.P(n45, a46))), r86 && !this._allowWorldUnderZoom && (this.zoom += this.scaleZoom(r86)), this._constrainCamera(), this._unmodified = i26, this._constraining = false; } _minZoomForBounds() { let e57 = Math.max(0, this.scaleZoom(Math.max(0, this.height) / (this.worldMaxY - this.worldMinY))); return this.maxBounds && (e57 = Math.max(e57, this.scaleZoom(this.width / (this.worldMaxX - this.worldMinX)))), e57; } _maxCameraBoundsDistance() { return this._mercatorZfromZoom(this._minZoomForBounds()); } _calcMatrices() { if (!this.height) return; const t45 = this.centerOffset, i26 = "globe" === this.projection.name, o88 = this.pixelsPerMeter; "globe" === this.projection.name && (this._mercatorScaleRatio = e56.ce(1, this.center.lat) / e56.ce(1, e56.d1)); const s18 = e56.cN(this.projection, this.zoom, this.width, this.height, 1024); this._pixelsPerMercatorPixel = this.projection.pixelSpaceConversion(this.center.lat, this.worldSize, s18), this.cameraToCenterDistance = 0.5 / Math.tan(0.5 * this._fov) * this.height * this._pixelsPerMercatorPixel, this._updateCameraState(), this._farZ = this.projection.farthestPixelDistance(this), this._nearZ = this.height / 50; const r86 = "meters" === this.projection.zAxisUnit ? o88 : 1, n45 = this._camera.getWorldToCamera(this.worldSize, r86); let a46; const l21 = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, this._farZ); if (l21[8] = 2 * -t45.x / this.width, l21[9] = 2 * t45.y / this.height, this.isOrthographic) { let i27 = 0.5 * this.height / Math.tan(this._fov / 2) * 1 * Math.tan(0.5 * this._fov), o89 = i27 * this.aspect, s19 = -o89, r87 = -i27; o89 -= t45.x, s19 -= t45.x, i27 += t45.y, r87 += t45.y, a46 = this._camera.getCameraToClipOrthographic(s19, o89, r87, i27, this._nearZ, this._farZ), ((t46, i28, o90, s20) => { for (let r88 = 0; r88 < 16; r88++) t46[r88] = e56.ak(i28[r88], o90[r88], s20); })(a46, a46, l21, e56.c$(this.pitch >= eo ? 1 : this.pitch / eo)); } else a46 = l21; const c28 = e56.cO([], l21, n45); let h8 = e56.cO([], a46, n45); if (this.projection.isReprojectedInTileSpace) { const t46 = this.locationCoordinate(this.center), i27 = e56.bA([]); e56.br(i27, i27, [t46.x * this.worldSize, t46.y * this.worldSize, 0]), e56.aB(i27, i27, e56.cP(this)), e56.br(i27, i27, [-t46.x * this.worldSize, -t46.y * this.worldSize, 0]), e56.aB(h8, h8, i27), e56.aB(c28, c28, i27), this.inverseAdjustmentMatrix = e56.cQ(this); } else this.inverseAdjustmentMatrix = [1, 0, 0, 1]; if (this.mercatorMatrix = e56.cR([], h8, [this.worldSize, this.worldSize, this.worldSize / r86, 1]), this.projMatrix = h8, this.invProjMatrix = e56.bl(new Float64Array(16), this.projMatrix), i26) { const i27 = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, 1 / 0); i27[8] = 2 * -t45.x / this.width, i27[9] = 2 * t45.y / this.height, this.expandedFarZProjMatrix = e56.cO([], i27, n45); } else this.expandedFarZProjMatrix = this.projMatrix; const d34 = e56.bl([], a46); this.frustumCorners = e56.cS.fromInvProjectionMatrix(d34, this.horizonLineFromTop(), this.height), this.cameraFrustum = e56.cA.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, 0, !i26); const u12 = new Float32Array(16); e56.bA(u12), e56.cR(u12, u12, [1, -1, 1]), e56.cT(u12, u12, this._pitch), e56.bB(u12, u12, this.angle); const _4 = e56.cc(new Float32Array(16), this._fov, this.width / this.height, this._nearZ, this._farZ); this.starsProjMatrix = e56.bz(_4); const p9 = (Math.PI / 2 - this._pitch) * (this.height / this._fov) * this._horizonShift; _4[8] = 2 * -t45.x / this.width, _4[9] = 2 * (t45.y + p9) / this.height, this.skyboxMatrix = e56.aB(u12, _4, u12); const f8 = this.point, m6 = f8.x, g9 = f8.y, v8 = this.width % 2 / 2, y4 = this.height % 2 / 2, x4 = Math.cos(this.angle), b8 = Math.sin(this.angle), w4 = m6 - Math.round(m6) + x4 * v8 + b8 * y4, T5 = g9 - Math.round(g9) + x4 * y4 + b8 * v8, E5 = new Float64Array(h8); if (e56.br(E5, E5, [w4 > 0.5 ? w4 - 1 : w4, T5 > 0.5 ? T5 - 1 : T5, 0]), this.alignedProjMatrix = E5, h8 = e56.bC(), e56.cR(h8, h8, [this.width / 2, -this.height / 2, 1]), e56.br(h8, h8, [1, -1, 0]), this.labelPlaneMatrix = h8, h8 = e56.bC(), e56.cR(h8, h8, [1, -1, 1]), e56.br(h8, h8, [-1, -1, 0]), e56.cR(h8, h8, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = h8, this.pixelMatrix = e56.aB(new Float64Array(16), this.labelPlaneMatrix, c28), this._calcFogMatrices(), this._distanceTileDataCache = {}, h8 = e56.bl(new Float64Array(16), this.pixelMatrix), !h8) throw new Error("failed to invert matrix"); if (this.pixelMatrixInverse = h8, "globe" === this.projection.name || this.mercatorFromTransition) { this.globeMatrix = e56.cU(this); const t46 = [this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]]; this.globeCenterInViewSpace = e56.af(t46, t46, n45), this.globeRadius = this.worldSize / 2 / Math.PI - 1; } else this.globeMatrix = h8; this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._pixelsToTileUnitsCache = {}, this._expandedProjMatrixCache = {}; } _calcFogMatrices() { this._fogTileMatrixCache = {}; const t45 = this.cameraWorldSizeForFog, i26 = this.cameraPixelsPerMeter, o88 = this._camera.position, s18 = 1 / this.height / this._pixelsPerMercatorPixel, r86 = [t45, t45, i26]; e56.c4(r86, r86, s18), e56.c4(o88, o88, -1), e56.cV(o88, o88, r86); const n45 = e56.bC(); e56.br(n45, n45, o88), e56.cR(n45, n45, r86), this.mercatorFogMatrix = n45, this.worldToFogMatrix = this._camera.getWorldToCameraPosition(t45, i26, s18); } _computeCameraPosition(e57) { const t45 = (e57 = e57 || this.pixelsPerMeter) / this.pixelsPerMeter, i26 = this._camera.forward(), o88 = this.point, s18 = this._mercatorZfromZoom(this._seaLevelZoom ? this._seaLevelZoom : this._zoom) * t45 - e57 / this.worldSize * this._centerAltitude; return [o88.x / this.worldSize - i26[0] * s18, o88.y / this.worldSize - i26[1] * s18, e57 / this.worldSize * this._centerAltitude - i26[2] * s18]; } _updateCameraState() { this.height && (this._camera.setPitchBearing(this._pitch, this.angle), this._camera.position = this._computeCameraPosition()); } _translateCameraConstrained(t45) { const i26 = this._maxCameraBoundsDistance() * Math.cos(this._pitch), o88 = this._camera.position[2], s18 = t45[2]; let r86 = 1; this.projection.wrap && (this.center = this.center.wrap()), s18 > 0 && (r86 = Math.min((i26 - o88) / s18, 1)), this._camera.position = e56.bH([], this._camera.position, t45, r86), this._updateStateFromCamera(); } _updateStateFromCamera() { const t45 = this._camera.position, i26 = this._camera.forward(), { pitch: o88, bearing: s18 } = this._camera.getPitchBearing(), r86 = e56.ce(this._centerAltitude, this.center.lat) * this._pixelsPerMercatorPixel, n45 = this._mercatorZfromZoom(this._maxZoom) * Math.cos(e56.an(this._maxPitch)), a46 = Math.max((t45[2] - r86) / Math.cos(o88), n45), l21 = this._zoomFromMercatorZ(a46); e56.bH(t45, t45, i26, a46), this._pitch = e56.aA(o88, e56.an(this.minPitch), e56.an(this.maxPitch)), this.angle = e56.bT(s18, -Math.PI, Math.PI), this._setZoom(e56.aA(l21, this._minZoom, this._maxZoom)), this._updateSeaLevelZoom(), this._center = this.coordinateLocation(new e56.ae(t45[0], t45[1], t45[2])), this._unmodified = false, this._constrain(), this._calcMatrices(); } _worldSizeFromZoom(e57) { return Math.pow(2, e57) * this.tileSize; } _mercatorZfromZoom(e57) { return this.cameraToCenterDistance / this._worldSizeFromZoom(e57); } _minimumHeightOverTerrain() { const e57 = Math.min(null != this._seaLevelZoom ? this._seaLevelZoom : this._zoom, this._maxZoom) + 4; return this._mercatorZfromZoom(e57); } _zoomFromMercatorZ(e57) { return this.scaleZoom(this.cameraToCenterDistance / (Math.max(0, e57) * this.tileSize)); } zoomFromMercatorZAdjusted(t45) { let i26 = 0, o88 = e56.cK, s18 = 0, r86 = 1 / 0; for (; o88 - i26 > 1e-6 && o88 > i26; ) { const e57 = i26 + 0.5 * (o88 - i26), n45 = this.tileSize * Math.pow(2, e57), a46 = this.getCameraToCenterDistance(this.projection, e57, n45), l21 = this.scaleZoom(a46 / (Math.max(0, t45) * this.tileSize)), c28 = Math.abs(e57 - l21); c28 < r86 && (r86 = c28, s18 = e57), e57 < l21 ? i26 = e57 : o88 = e57; } return s18; } _terrainEnabled() { return !(!this._elevation || !this.projection.supportsTerrain && (e56.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."), 1)); } anyCornerOffEdge(t45, i26) { const o88 = Math.min(t45.x, i26.x), s18 = Math.max(t45.x, i26.x), r86 = Math.min(t45.y, i26.y), n45 = Math.max(t45.y, i26.y); if (r86 < this.horizonLineFromTop(false)) return true; if ("mercator" !== this.projection.name) return false; const a46 = [new e56.P(o88, r86), new e56.P(s18, n45), new e56.P(o88, n45), new e56.P(s18, r86)], l21 = this.renderWorldCopies ? -3 : 0, c28 = this.renderWorldCopies ? 4 : 1; for (const e57 of a46) { const t46 = this.pointRayIntersection(e57); if (t46.t < 0) return true; const i27 = this.rayIntersectionCoordinate(t46); if (i27.x < l21 || i27.y < 0 || i27.x > c28 || i27.y > 1) return true; } return false; } isHorizonVisible() { return this.pitch + e56.cW(this.fovAboveCenter) > 88 || this.anyCornerOffEdge(new e56.P(0, 0), new e56.P(this.width, this.height)); } zoomDeltaToMovement(t45, i26) { const o88 = e56.ag(e56.av([], this._camera.position, t45)), s18 = this._zoomFromMercatorZ(o88) + i26; return o88 - this._mercatorZfromZoom(s18); } getCameraPoint() { if ("globe" === this.projection.name) { const t45 = (function([t46, i26, o88], s18) { const r86 = [t46, i26, o88, 1]; e56.aC(r86, r86, s18); const n45 = r86[3] = Math.max(r86[3], 1e-6); return r86[0] /= n45, r86[1] /= n45, r86[2] /= n45, r86; })([this.globeMatrix[12], this.globeMatrix[13], this.globeMatrix[14]], this.pixelMatrix); return new e56.P(t45[0], t45[1]); } { const t45 = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1); return this.centerPoint.add(new e56.P(0, t45)); } } getCameraToCenterDistance(t45, i26 = this.zoom, o88 = this.worldSize) { const s18 = e56.cN(t45, i26, this.width, this.height, 1024), r86 = t45.pixelSpaceConversion(this.center.lat, o88, s18); let n45 = 0.5 / Math.tan(0.5 * this._fov) * this.height * r86; return this.isOrthographic && (n45 = e56.ak(1, n45, e56.c$(this.pitch >= eo ? 1 : this.pitch / eo))), n45; } getWorldToCameraMatrix() { const t45 = this._camera.getWorldToCamera(this.worldSize, "meters" === this.projection.zAxisUnit ? this.pixelsPerMeter : 1); return "globe" === this.projection.name && e56.aB(t45, t45, this.globeMatrix), t45; } getFrustum(t45) { return e56.cA.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, t45, "meters" === this.projection.zAxisUnit); } } const io = (t45, i26) => { if (i26 > 0 && t45.terrain && e56.w("Cutoff is currently disabled on terrain"), i26 <= 0 || t45.terrain) return { shouldRenderCutoff: false, uniformValues: { u_cutoff_params: [0, 0, 0, 1] } }; const o88 = t45.transform, s18 = Math.max(Math.abs(o88._zoom - (t45.minCutoffZoom - 1)), 1), r86 = o88.isLODDisabled(false) ? e56.ah(60, 45, o88.pitch) : e56.ah(30, 15, o88.pitch), n45 = o88._farZ - o88._nearZ, a46 = i26 * o88.height, l21 = ((1 - (c28 = r86)) * o88.cameraToCenterDistance + c28 * (o88._farZ + a46)) * s18; var c28; return { shouldRenderCutoff: r86 < 1, uniformValues: { u_cutoff_params: [o88._nearZ, o88._farZ, (l21 - o88._nearZ) / n45, (l21 - a46 - o88._nearZ) / n45] } }; }, oo = { cascadeCount: 2, normalOffset: 3, shadowMapResolution: 2048 }; class so { constructor(e57, t45) { this.aabb = e57, this.lastCascade = t45; } } class ro { add(e57, t45) { const i26 = this.receivers[e57.key]; void 0 !== i26 ? (i26.aabb.min[0] = Math.min(i26.aabb.min[0], t45.min[0]), i26.aabb.min[1] = Math.min(i26.aabb.min[1], t45.min[1]), i26.aabb.min[2] = Math.min(i26.aabb.min[2], t45.min[2]), i26.aabb.max[0] = Math.max(i26.aabb.max[0], t45.max[0]), i26.aabb.max[1] = Math.max(i26.aabb.max[1], t45.max[1]), i26.aabb.max[2] = Math.max(i26.aabb.max[2], t45.max[2])) : this.receivers[e57.key] = new so(t45, null); } clear() { this.receivers = {}; } get(e57) { return this.receivers[e57.key]; } computeRequiredCascades(t45, i26, o88) { const s18 = e56.d8.fromPoints(t45.points); let r86 = 0; for (const t46 in this.receivers) { const n45 = this.receivers[t46]; if (!n45) continue; if (!s18.intersectsAabb(n45.aabb)) continue; n45.aabb.min = s18.closestPoint(n45.aabb.min), n45.aabb.max = s18.closestPoint(n45.aabb.max); const a46 = n45.aabb.getCorners(); for (let t47 = 0; t47 < o88.length; t47++) { let s19 = true; for (const r87 of a46) { const n46 = [r87[0] * i26, r87[1] * i26, r87[2]]; if (e56.af(n46, n46, o88[t47].matrix), n46[0] < -1 || n46[0] > 1 || n46[1] < -1 || n46[1] > 1) { s19 = false; break; } } if (n45.lastCascade = t47, r86 = Math.max(r86, t47), s19) break; } } return r86 + 1; } } class no { constructor(e57) { this.painter = e57, this._enabled = false, this._shadowLayerCount = 0, this._numCascadesToRender = 0, this._cascades = [], this._groundShadowTiles = [], this._receivers = new ro(), this._depthMode = new ji(e57.context.gl.LEQUAL, ji.ReadWrite, [0, 1]), this._uniformValues = { u_light_matrix_0: new Float32Array(16), u_light_matrix_1: new Float32Array(16), u_shadow_intensity: 0, u_fade_range: [0, 0], u_shadow_normal_offset: [1, 1, 1], u_shadow_texel_size: 1, u_shadow_map_resolution: 1, u_shadow_direction: [0, 0, 1], u_shadow_bias: [36e-5, 12e-4, 0.012], u_shadowmap_0: 0, u_shadowmap_1: 0 }, this._forceDisable = false, this.useNormalOffset = false, e57.tp.registerParameter(this, ["Shadows"], "_forceDisable", { label: "forceDisable" }, (() => { this.painter.style.map.triggerRepaint(); })), e57.tp.registerParameter(oo, ["Shadows"], "cascadeCount", { min: 1, max: 2, step: 1 }), e57.tp.registerParameter(oo, ["Shadows"], "normalOffset", { min: 0, max: 10, step: 0.05 }), e57.tp.registerParameter(oo, ["Shadows"], "shadowMapResolution", { min: 32, max: 2048, step: 32 }), e57.tp.registerBinding(this, ["Shadows"], "_numCascadesToRender", { readonly: true, label: "numCascadesToRender" }); } destroy() { for (const e57 of this._cascades) e57.texture.destroy(), e57.framebuffer.destroy(); this._cascades = []; } updateShadowParameters(t45, i26) { const o88 = this.painter; if (this._enabled = false, this._shadowLayerCount = 0, this._receivers.clear(), !i26 || !i26.properties) return; const s18 = i26.properties.get("shadow-intensity"); if (!i26.shadowsEnabled() || s18 <= 0) return; if (this._shadowLayerCount = o88.style.order.reduce(((e57, i27) => { const s19 = o88.style._mergedLayers[i27]; return e57 + (s19.hasShadowPass() && !s19.isHidden(t45.zoom) ? 1 : 0); }), 0), this._enabled = this._shadowLayerCount > 0, !this.enabled) return; const r86 = o88.context, n45 = oo.shadowMapResolution, a46 = oo.shadowMapResolution; if (0 === this._cascades.length || oo.shadowMapResolution !== this._cascades[0].texture.size[0]) { this._cascades = []; for (let t46 = 0; t46 < oo.cascadeCount; ++t46) { const t47 = o88._shadowMapDebug, i27 = r86.gl, s19 = r86.createFramebuffer(n45, a46, t47, "texture"), l22 = new e56.T(r86, { width: n45, height: a46, data: null }, i27.DEPTH_COMPONENT16); if (s19.depthAttachment.set(l22.texture), t47) { const t48 = new e56.T(r86, { width: n45, height: a46, data: null }, i27.RGBA8); s19.colorAttachment.set(t48.texture); } this._cascades.push({ framebuffer: s19, texture: l22, matrix: [], far: 0, boundingSphereRadius: 0, frustum: new e56.cA(), scale: 0 }); } } this.shadowDirection = lo(i26); let l21 = 0; if (t45.elevation) { const e57 = t45.elevation, i27 = [1e4, -1e4]; e57.visibleDemTiles.filter(((e58) => e58.dem)).forEach(((e58) => { const t46 = e58.dem.tree; i27[0] = Math.min(i27[0], t46.minimums[0]), i27[1] = Math.max(i27[1], t46.maximums[0]); })), 1e4 !== i27[0] && (l21 = (i27[1] - i27[0]) * e57.exaggeration()); } const c28 = 1.5 * t45.cameraToCenterDistance, h8 = 3 * c28, d34 = new Float64Array(16); for (let i27 = 0; i27 < this._cascades.length; ++i27) { const o89 = this._cascades[i27]; let s19 = t45.height / 50, r87 = 1; 1 === oo.cascadeCount ? r87 = h8 : 0 === i27 ? r87 = c28 : (s19 = c28, r87 = h8); const [n46, a47] = ho(t45, this.shadowDirection, s19, r87, oo.shadowMapResolution, l21); o89.scale = t45.scale, o89.matrix = n46, o89.boundingSphereRadius = a47, e56.bl(d34, o89.matrix), o89.frustum = e56.cA.fromInvProjectionMatrix(d34, 1, 0, true), o89.far = r87; } const u12 = this._cascades.length - 1; this._uniformValues.u_fade_range = [0.75 * this._cascades[u12].far, this._cascades[u12].far], this._uniformValues.u_shadow_intensity = s18, this._uniformValues.u_shadow_direction = [this.shadowDirection[0], this.shadowDirection[1], this.shadowDirection[2]], this._uniformValues.u_shadow_texel_size = 1 / oo.shadowMapResolution, this._uniformValues.u_shadow_map_resolution = oo.shadowMapResolution, this._uniformValues.u_shadowmap_0 = Ji.ShadowMap0, this._uniformValues.u_shadowmap_1 = Ji.ShadowMap0 + 1, this._groundShadowTiles = o88.transform.coveringTiles({ tileSize: 512, renderWorldCopies: true }); const _4 = o88.transform.elevation; for (const e57 of this._groundShadowTiles) { let t46 = { min: 0, max: 0 }; if (_4) { const i27 = _4.getMinMaxForTile(e57); i27 && (t46 = i27); } this.addShadowReceiver(e57.toUnwrapped(), t46.min, t46.max); } } get enabled() { return this._enabled && !this._forceDisable; } set enabled(e57) { this._enabled = e57; } drawShadowPass(t45, i26) { if (!this.enabled) return; const o88 = this.painter, s18 = o88.context; this._numCascadesToRender = this._receivers.computeRequiredCascades(o88.transform.getFrustum(0), o88.transform.worldSize, this._cascades), s18.viewport.set([0, 0, oo.shadowMapResolution, oo.shadowMapResolution]); for (let r86 = 0; r86 < this._numCascadesToRender; ++r86) { o88.currentShadowCascade = r86, s18.bindFramebuffer.set(this._cascades[r86].framebuffer.framebuffer), s18.clear({ color: e56.ao.white, depth: 1 }); for (const e57 of t45.order) { const s19 = t45._mergedLayers[e57]; if (!s19.hasShadowPass() || s19.isHidden(o88.transform.zoom)) continue; const r87 = t45.getLayerSourceCache(s19), n45 = r87 ? i26[r87.id] : void 0; ("model" === s19.type || n45 && n45.length) && o88.renderLayer(o88, r87, s19, n45); } } o88.currentShadowCascade = 0; } drawGroundShadows() { if (!this.enabled) return; const e57 = this.painter, t45 = e57.style, i26 = e57.context, o88 = i26.gl, s18 = t45.directionalLight, r86 = t45.ambientLight; if (!s18 || !r86) return; const n45 = [], a46 = io(e57, e57.longestCutoffRange); a46.shouldRenderCutoff && n45.push("RENDER_CUTOFF"), n45.push("RENDER_SHADOWS", "DEPTH_TEXTURE"), this.useNormalOffset && n45.push("NORMAL_OFFSET"); const l21 = co(t45, s18, r86), c28 = new ji(o88.LEQUAL, ji.ReadOnly, e57.depthRangeFor3D), h8 = new Gi({ func: o88.EQUAL, mask: 255 }, 0, 255, o88.KEEP, o88.KEEP, o88.KEEP); for (const t46 of this._groundShadowTiles) { const s19 = t46.toUnwrapped(), r87 = e57.isTileAffectedByFog(t46), d34 = e57.getOrCreateProgram("groundShadow", { defines: n45, overrideFog: r87 }); this.setupShadows(s19, d34), e57.uploadCommonUniforms(i26, d34, s19, null, a46); const u12 = { u_matrix: e57.transform.calculateProjMatrix(s19), u_ground_shadow_factor: l21 }; d34.draw(e57, o88.TRIANGLES, c28, h8, Ui.multiply, Zi.disabled, u12, "ground_shadow", e57.tileExtentBuffer, e57.quadTriangleIndexBuffer, e57.tileExtentSegments, null, e57.transform.zoom, null, null); } } getShadowPassColorMode() { return this.painter._shadowMapDebug ? Ui.unblended : Ui.disabled; } getShadowPassDepthMode() { return this._depthMode; } getShadowCastingLayerCount() { return this._shadowLayerCount; } calculateShadowPassMatrixFromTile(t45) { const i26 = this.painter.transform, o88 = i26.calculatePosMatrix(t45, i26.worldSize); return e56.aB(o88, this._cascades[this.painter.currentShadowCascade].matrix, o88), Float32Array.from(o88); } calculateShadowPassMatrixFromMatrix(t45) { return e56.aB(t45, this._cascades[this.painter.currentShadowCascade].matrix, t45), Float32Array.from(t45); } setupShadows(t45, i26, o88) { if (!this.enabled) return; const s18 = this.painter.transform, r86 = this.painter.context, n45 = r86.gl, a46 = this._uniformValues, l21 = new Float64Array(16), c28 = s18.calculatePosMatrix(t45, s18.worldSize); for (let t46 = 0; t46 < this._cascades.length; t46++) e56.aB(l21, this._cascades[t46].matrix, c28), a46[0 === t46 ? "u_light_matrix_0" : "u_light_matrix_1"] = Float32Array.from(l21), r86.activeTexture.set(n45.TEXTURE0 + Ji.ShadowMap0 + t46), this._cascades[t46].texture.bindExtraParam(n45.LINEAR, n45.LINEAR, n45.CLAMP_TO_EDGE, n45.CLAMP_TO_EDGE, n45.GREATER); if (this.useNormalOffset = !!o88, this.useNormalOffset) { const i27 = e56.d6(t45.canonical), r87 = 2 / s18.tileSize * e56.al / oo.shadowMapResolution, n46 = r87 * this._cascades[0].boundingSphereRadius, l22 = r87 * this._cascades[this._cascades.length - 1].boundingSphereRadius, c29 = ("vector-tile" === o88 ? 1 : 3) * (function(t46, i28, o89, s19, r88) { const n47 = e56.aA((t46 - 22) / -22, 0, 1); return 0.125 * (1 - n47) + 4 * n47; })(s18.zoom); a46.u_shadow_normal_offset = [i27, n46 * c29, l22 * c29], a46.u_shadow_bias = [1e-4, 12e-4, 0.012]; } else a46.u_shadow_bias = [36e-5, 12e-4, 0.012]; i26.setShadowUniformValues(r86, a46); } setupShadowsFromMatrix(t45, i26, o88 = false) { if (!this.enabled) return; const s18 = this.painter.context, r86 = s18.gl, n45 = this._uniformValues, a46 = new Float64Array(16); for (let i27 = 0; i27 < oo.cascadeCount; i27++) e56.aB(a46, this._cascades[i27].matrix, t45), n45[0 === i27 ? "u_light_matrix_0" : "u_light_matrix_1"] = Float32Array.from(a46), s18.activeTexture.set(r86.TEXTURE0 + Ji.ShadowMap0 + i27), this._cascades[i27].texture.bindExtraParam(r86.LINEAR, r86.LINEAR, r86.CLAMP_TO_EDGE, r86.CLAMP_TO_EDGE, r86.GREATER); if (this.useNormalOffset = o88, o88) { const e57 = oo.normalOffset; n45.u_shadow_normal_offset = [1, e57, e57], n45.u_shadow_bias = [6e-5, 12e-4, 0.012]; } else n45.u_shadow_bias = [36e-5, 12e-4, 0.012]; i26.setShadowUniformValues(s18, n45); } getShadowUniformValues() { return this._uniformValues; } getCurrentCascadeFrustum() { return this._cascades[this.painter.currentShadowCascade].frustum; } computeSimplifiedTileShadowVolume(t45, i26, o88, s18) { if (s18[2] >= 0) return {}; const r86 = (function(t46, i27, o89) { const s19 = o89 / (1 << t46.canonical.z); return new e56.d8([t46.canonical.x * s19 + t46.wrap * o89, t46.canonical.y * s19 + t46.wrap * o89, 0], [(t46.canonical.x + 1) * s19 + t46.wrap * o89, (t46.canonical.y + 1) * s19 + t46.wrap * o89, i27]); })(t45, i26, o88).getCorners(), n45 = i26 / -s18[2]; s18[0] < 0 ? (e56.d7(r86[0], r86[0], [s18[0] * n45, 0, 0]), e56.d7(r86[3], r86[3], [s18[0] * n45, 0, 0])) : s18[0] > 0 && (e56.d7(r86[1], r86[1], [s18[0] * n45, 0, 0]), e56.d7(r86[2], r86[2], [s18[0] * n45, 0, 0])), s18[1] < 0 ? (e56.d7(r86[0], r86[0], [0, s18[1] * n45, 0]), e56.d7(r86[1], r86[1], [0, s18[1] * n45, 0])) : s18[1] > 0 && (e56.d7(r86[2], r86[2], [0, s18[1] * n45, 0]), e56.d7(r86[3], r86[3], [0, s18[1] * n45, 0])); const a46 = {}; return a46.vertices = r86, a46.planes = [ao(r86[1], r86[0], r86[4]), ao(r86[2], r86[1], r86[5]), ao(r86[3], r86[2], r86[6]), ao(r86[0], r86[3], r86[7])], a46; } addShadowReceiver(t45, i26, o88) { this._receivers.add(t45, e56.d8.fromTileIdAndHeight(t45, i26, o88)); } getMaxCascadeForTile(e57) { const t45 = this._receivers.get(e57); return t45 && t45.lastCascade ? t45.lastCascade : 0; } } function ao(t45, i26, o88) { const s18 = e56.av([], o88, i26), r86 = e56.av([], t45, i26), n45 = e56.bI([], s18, r86), a46 = e56.ag(n45); return 0 === a46 ? [0, 0, 1, 0] : (e56.c4(n45, n45, 1 / a46), [n45[0], n45[1], n45[2], -e56.bJ(n45, i26)]); } function lo(t45) { const i26 = t45.properties.get("direction"), o88 = e56.d3(i26.x, i26.y, i26.z); o88[2] = e56.aA(o88[2], 0, 75); const s18 = e56.d5([o88[0], o88[1], o88[2]]); return e56.d4(s18.x, s18.y, s18.z); } function co(t45, i26, o88) { const s18 = "none" === i26.properties.get("color-use-theme"), r86 = i26.properties.get("color"), n45 = i26.properties.get("intensity"), a46 = i26.properties.get("direction"), l21 = [a46.x, a46.y, a46.z], c28 = "none" === o88.properties.get("color-use-theme"), h8 = o88.properties.get("color"), d34 = o88.properties.get("intensity"), u12 = Math.max(e56.bJ([0, 0, 1], l21), 0), _4 = [0, 0, 0]; e56.c4(_4, h8.toPremultipliedRenderColor(c28 ? null : t45.getLut(i26.scope)).toArray01Linear().slice(0, 3), d34); const p9 = [0, 0, 0]; return e56.c4(p9, r86.toPremultipliedRenderColor(s18 ? null : t45.getLut(o88.scope)).toArray01Linear().slice(0, 3), u12 * n45), e56.da([_4[0] > 0 ? _4[0] / (_4[0] + p9[0]) : 0, _4[1] > 0 ? _4[1] / (_4[1] + p9[1]) : 0, _4[2] > 0 ? _4[2] / (_4[2] + p9[2]) : 0]); } function ho(t45, i26, o88, s18, r86, n45) { const a46 = t45.zoom, l21 = t45.scale, c28 = t45.worldSize, h8 = 1 / c28, d34 = t45.aspect, u12 = Math.sqrt(1 + d34 * d34) * Math.tan(0.5 * t45.fovX), _4 = u12 * u12, p9 = s18 - o88, f8 = s18 + o88; let m6, g9; _4 > p9 / f8 ? (m6 = s18, g9 = s18 * u12) : (m6 = 0.5 * f8 * (1 + _4), g9 = 0.5 * Math.sqrt(p9 * p9 + 2 * (s18 * s18 + o88 * o88) * _4 + f8 * f8 * _4 * _4)); const v8 = t45.projection.pixelsPerMeter(t45.center.lat, c28), y4 = t45._camera.getCameraToWorldMercator(), x4 = [0, 0, -m6 * h8]; e56.af(x4, x4, y4); let b8 = g9 * h8; const w4 = t45._edgeInsets; if (!(0 === w4.left && 0 === w4.top && 0 === w4.right && 0 === w4.bottom || w4.left === w4.right && w4.top === w4.bottom)) { const i27 = t45._camera.getWorldToCamera(t45.worldSize, "meters" === t45.projection.zAxisUnit ? v8 : 1), r87 = t45._camera.getCameraToClipPerspective(t45._fov, t45.width / t45.height, o88, s18); r87[8] = 2 * -t45.centerOffset.x / t45.width, r87[9] = 2 * t45.centerOffset.y / t45.height; const n46 = new Float64Array(16); e56.cO(n46, r87, i27); const h9 = new Float64Array(16); e56.bl(h9, n46); const d35 = e56.cA.fromInvProjectionMatrix(h9, c28, a46, true); for (const i28 of d35.points) { const o89 = ((T5 = i28)[0] /= l21, T5[1] /= l21, T5[2] = e56.ce(T5[2], t45._center.lat), T5); b8 = Math.max(b8, e56.c5(e56.d9([], x4, o89))); } } var T5; b8 *= r86 / (r86 - 1); const E5 = Math.acos(i26[2]), S5 = Math.atan2(-i26[0], -i26[1]), I4 = new Ki(); I4.position = x4, I4.setPitchBearing(E5, S5); const C6 = I4.getWorldToCamera(c28, v8), R5 = b8 * c28, A4 = Math.min(t45._mercatorZfromZoom(17) * c28 * -2, -2 * R5), D5 = I4.getCameraToClipOrthographic(-R5, R5, -R5, R5, A4, (R5 + n45 * v8) / i26[2]), L3 = new Float64Array(16); e56.aB(L3, D5, C6); const P4 = e56.d4(Math.floor(1e6 * x4[0]) / 1e6 * c28, Math.floor(1e6 * x4[1]) / 1e6 * c28, 0), z4 = 0.5 * r86, O4 = [0, 0, 0]; e56.af(O4, P4, L3), e56.c4(O4, O4, z4); const M5 = [Math.floor(O4[0]), Math.floor(O4[1]), Math.floor(O4[2])], F17 = [0, 0, 0]; e56.av(F17, O4, M5), e56.c4(F17, F17, -1 / z4); const B6 = new Float64Array(16); return e56.bA(B6), e56.br(B6, B6, F17), e56.aB(L3, B6, L3), [L3, R5]; } class uo extends e56.E { constructor(e57) { super(), this.requestManager = e57, this.models = { "": {} }, this.modelUris = { "": {} }, this.modelByURL = {}, this.numModelsLoading = {}; } loadModel(t45, i26) { return e56.aV(this.requestManager.transformRequest(i26, e56.R.Model).url).then(((i27) => { if (!i27) return; const o88 = e56.aW(i27), s18 = new e56.aX(t45, void 0, void 0, o88); return s18.computeBoundsAndApplyParent(), s18; })).catch(((o88) => { if (o88 && 404 === o88.status) return null; this.fire(new e56.y(new Error(`Could not load model ${t45} from ${i26}: ${o88.message}`))); })); } load(t45, i26, o88 = { forceReload: false }) { this.models[i26] || (this.models[i26] = {}); const s18 = Object.keys(t45), r86 = [], n45 = []; for (const e57 of s18) { const s19 = t45[e57]; this.hasURLBeenRequested(s19) && !o88.forceReload || (this.modelByURL[s19] = { modelId: e57, scope: i26 }, r86.push(this.loadModel(e57, s19)), n45.push(e57)), this.models[i26][e57] || (this.models[i26][e57] = { model: null, numReferences: 1 }); } this.numModelsLoading[i26] = (this.numModelsLoading[i26] || 0) + n45.length, Promise.allSettled(r86).then(((t46) => { for (let e57 = 0; e57 < t46.length; e57++) { const { status: o89 } = t46[e57]; if ("rejected" === o89) continue; const { value: s19 } = t46[e57]; this.models[i26][n45[e57]] || (this.models[i26][n45[e57]] = { model: null, numReferences: 1 }), this.models[i26][n45[e57]].model = s19; } this.numModelsLoading[i26] -= n45.length, this.fire(new e56.z("data", { dataType: "style" })); })).catch(((t46) => { this.fire(new e56.y(new Error(`Could not load models: ${t46.message}`))); })); } isLoaded() { for (const e57 in this.numModelsLoading) if (this.numModelsLoading[e57] > 0) return false; return true; } hasModel(e57, t45, i26 = { exactIdMatch: false }) { return !!(i26.exactIdMatch ? this.getModel(e57, t45) : this.getModelByURL(this.modelUris[t45][e57])); } getModel(e57, t45) { return this.models[t45] || (this.models[t45] = {}), this.models[t45][e57] ? this.models[t45][e57].model : void 0; } getModelByURL(e57) { if (!e57) return null; const t45 = this.modelByURL[e57]; return t45 ? this.models[t45.scope][t45.modelId].model : null; } hasModelBeenAdded(e57, t45) { return this.models[t45] && void 0 !== this.models[t45][e57]; } getModelURIs(e57) { return this.modelUris[e57] || {}; } addModel(e57, t45, i26) { this.models[i26] || (this.models[i26] = {}), this.modelUris[i26] || (this.modelUris[i26] = {}); const o88 = this.requestManager.normalizeModelURL(t45); if ((this.hasModel(e57, i26, { exactIdMatch: true }) || this.hasModelBeenAdded(e57, i26)) && this.modelUris[i26][e57] === o88) this.models[i26][e57].numReferences++; else if (this.hasURLBeenRequested(o88)) { const { scope: e58, modelId: t46 } = this.modelByURL[o88]; this.models[e58][t46].numReferences++; } else this.modelUris[i26][e57] = o88, this.load({ [e57]: this.modelUris[i26][e57] }, i26); } addModelURLs(e57, t45) { this.models[t45] || (this.models[t45] = {}), this.modelUris[t45] || (this.modelUris[t45] = {}); const i26 = this.modelUris[t45]; for (const t46 in e57) i26[t46] = this.requestManager.normalizeModelURL(e57[t46]); } reloadModels(e57) { this.load(this.modelUris[e57], e57, { forceReload: true }); } addModelsFromBucket(t45, i26) { this.models[i26] || (this.models[i26] = {}), this.modelUris[i26] || (this.modelUris[i26] = {}); const o88 = {}; for (const s18 of t45) this.hasModel(s18, i26, { exactIdMatch: true }) || this.hasURLBeenRequested(s18) ? this.models[i26][s18].numReferences++ : this.modelUris[i26][s18] && !this.hasURLBeenRequested(s18) ? o88[s18] = this.modelUris[i26][s18] : !this.hasURLBeenRequested(s18) && e56.db(s18, false) && (this.modelUris[i26][s18] = this.requestManager.normalizeModelURL(s18), o88[s18] = this.modelUris[i26][s18]); this.load(o88, i26); } hasURLBeenRequested(e57) { return void 0 !== this.modelByURL[e57]; } removeModel(e57, t45, i26 = false, o88 = false) { if (this.models[t45] && this.models[t45][e57] && (this.models[t45][e57].numReferences--, 0 === this.models[t45][e57].numReferences || o88)) { const o89 = this.modelUris[t45][e57]; i26 || delete this.modelUris[t45][e57], delete this.modelByURL[o89]; const s18 = this.models[t45][e57].model; if (!s18) return; delete this.models[t45][e57], s18.destroy(); } } destroy() { for (const e57 of Object.keys(this.models)) for (const t45 of Object.keys(this.models[e57])) { const i26 = this.models[e57][t45].model; delete this.models[e57][t45], i26 && i26.destroy(); } this.models = { "": {} }, this.modelUris = { "": {} }, this.modelByURL = {}, this.numModelsLoading = {}; } listModels(e57) { return this.models[e57] || (this.models[e57] = {}), Object.keys(this.models[e57]); } upload(e57, t45) { this.models[t45] || (this.models[t45] = {}); for (const i26 in this.models[t45]) this.models[t45][i26].model && this.models[t45][i26].model.upload(e57.context); } } const _o = new e56.a9({ data: new e56.aa(e56.a6.colorTheme.data) }); function po(t45) { if (!t45.metadata || !t45.metadata.content_area) return; const i26 = e56.o.devicePixelRatio, { left: o88, top: s18, width: r86, height: n45 } = t45.metadata.content_area, a46 = o88 * i26, l21 = s18 * i26; return [a46, l21, a46 + r86 * i26, l21 + n45 * i26]; } function fo(t45) { if (t45) return t45.map((([t46, i26]) => [t46 * e56.o.devicePixelRatio, i26 * e56.o.devicePixelRatio])); } class mo { constructor(e57, t45, i26) { this.id = e57, this.scope = t45, this.sourceCache = i26, this.pendingRequests = /* @__PURE__ */ new Set(), this.missingRequests = /* @__PURE__ */ new Set(); } addPendingRequest(e57) { this.missingRequests.has(e57.name) || this.pendingRequests.has(e57.name) || this.pendingRequests.add(e57.name); } hasPendingRequests() { return this.pendingRequests.size > 0; } resolvePendingRequests() { const t45 = /* @__PURE__ */ new Map(); if (!this.sourceCache.loaded()) return t45; const i26 = this.sourceCache.getVisibleCoordinates(); if (0 === i26.length) return t45; const o88 = this.sourceCache.getSource(); if (!(o88 instanceof nt2)) return t45; const s18 = i26.map(((e57) => this.sourceCache.getTile(e57))), r86 = o88.getImages(s18, Array.from(this.pendingRequests)); for (const [i27, o89] of r86) t45.set(e56.I.from({ name: i27, iconsetId: this.id }), o89), this.pendingRequests.delete(i27); for (const e57 of this.pendingRequests) this.missingRequests.add(e57); return this.pendingRequests.clear(), t45; } } const go = (e57, t45) => Le(e57, t45 && t45.filter(((e58) => "source.canvas" !== e58.identifier))), vo = e56.aH(Mt2, ["addLayer", "removeLayer", "setLights", "setPaintProperty", "setLayoutProperty", "setSlot", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData", "setTerrain", "setFog", "setSnow", "setRain", "setProjection", "setCamera", "addImport", "removeImport", "updateImport", "addIconset", "removeIconset"]), yo = e56.aH(Mt2, ["setCenter", "setZoom", "setBearing", "setPitch"]), xo = /* @__PURE__ */ new Set(["background", "sky", "slot", "custom"]), bo = { version: 8, layers: [], sources: {} }, wo = { duration: 300, delay: 0 }; class To extends e56.E { constructor(t45, i26 = {}) { super(), this.map = t45, this.scope = i26.scope || "", this.globalId = null, this.fragments = [], this.importDepth = i26.importDepth || 0, this.importsCache = i26.importsCache || /* @__PURE__ */ new Map(), this.resolvedImports = i26.resolvedImports || /* @__PURE__ */ new Set(), this.transition = Object.assign({}, wo), this._buildingIndex = new Pt(this), this.crossTileSymbolIndex = new ki(), this._mergedOrder = [], this._drapedFirstOrder = [], this._mergedLayers = {}, this._mergedSourceCaches = {}, this._mergedOtherSourceCaches = {}, this._mergedSymbolSourceCaches = {}, this._clipLayerPresent = false, this._has3DLayers = false, this._hasCircleLayers = false, this._hasSymbolLayers = false, this._changes = i26.styleChanges || new V3(), this.dispatcher = i26.dispatcher ? i26.dispatcher : new e56.D(e56.dd(), this), i26.imageManager ? this.imageManager = i26.imageManager : (this.imageManager = new H3(this.map._spriteFormat), this.imageManager.setEventedParent(this)), this.imageManager.addScope(this.scope), this.glyphManager = i26.glyphManager ? i26.glyphManager : new e56.de(t45._requestManager, i26.localFontFamily ? e56.df.all : i26.localIdeographFontFamily ? e56.df.ideographs : e56.df.none, i26.localFontFamily || i26.localIdeographFontFamily), i26.modelManager ? this.modelManager = i26.modelManager : (this.modelManager = new uo(t45._requestManager), this.modelManager.setEventedParent(this)), this._layers = {}, this._sourceCaches = {}, this._otherSourceCaches = {}, this._symbolSourceCaches = {}, this._loaded = false, this._precompileDone = false, this._shouldPrecompile = false, this._availableImages = [], this._availableModels = {}, this._order = [], this._markersNeedUpdate = false, this.options = i26.configOptions ? i26.configOptions : /* @__PURE__ */ new Map(), this._configDependentLayers = i26.configDependentLayers ? i26.configDependentLayers : /* @__PURE__ */ new Set(), this._config = i26.config, this._styleColorTheme = { lut: null, lutLoading: false, lutLoadingCorrelationID: 0, colorTheme: null, colorThemeOverride: i26.colorThemeOverride }, this._styleColorThemeForScope = {}, this._initialConfig = i26.initialConfig, this.dispatcher.broadcast("setReferrer", e56.dg()); const o88 = this; this._rtlTextPluginCallback = To.registerForPluginStateChange(((t46) => { o88.dispatcher.broadcast("syncRTLPluginState", { pluginStatus: t46.pluginStatus, pluginURL: t46.pluginURL }, ((t47, i27) => { if (e56.dh(t47), i27 && i27.every(((e57) => e57))) for (const e57 in o88._sourceCaches) { const t48 = o88._sourceCaches[e57], i28 = t48.getSource().type; "vector" !== i28 && "geojson" !== i28 || t48.reload(); } })); })), this.on("data", ((e57) => { if ("source" !== e57.dataType || "metadata" !== e57.sourceDataType) return; const t46 = this.getOwnSource(e57.sourceId); if (t46 && t46.vectorLayerIds) for (const e58 in this._layers) { const i27 = this._layers[e58]; i27.source === t46.id && this._validateLayer(i27); } })); } load(e57) { return e57 ? ("string" == typeof e57 ? this.loadURL(e57) : this.loadJSON(e57), this) : this; } _getGlobalId(t45) { if (!t45) return null; if ("string" == typeof t45) { if (e56.h(t45)) return t45; const i26 = e56.di(t45); if (!i26.startsWith("http")) try { return new URL(i26, location.href).toString(); } catch (e57) { return i26; } return i26; } return `json://${e56.dj(JSON.stringify(t45))}`; } _diffStyle(t45, i26, o88) { this.globalId = this._getGlobalId(t45); const s18 = (e57, t46) => { try { t46(null, this.setState(e57, o88)); } catch (e58) { t46(e58, false); } }; if ("string" == typeof t45) { const o89 = this.map._requestManager.normalizeStyleURL(t45), r86 = this.map._requestManager.transformRequest(o89, e56.R.Style); e56.m(r86, ((t46, o90) => { t46 ? this.fire(new e56.y(t46)) : o90 && s18(o90, i26); })); } else "object" == typeof t45 && s18(t45, i26); } loadURL(t45, i26 = {}) { this.fire(new e56.z("dataloading", { dataType: "style" })); const o88 = "boolean" == typeof i26.validate ? i26.validate : !e56.h(t45); this.globalId = this._getGlobalId(t45), t45 = this.map._requestManager.normalizeStyleURL(t45, i26.accessToken), this.resolvedImports.add(t45); const s18 = this.importsCache.get(t45); if (s18) return this._load(s18, o88); const r86 = this.map._requestManager.transformRequest(t45, e56.R.Style); this._request = e56.m(r86, ((i27, s19) => { if (this._request = null, i27) this.fire(new e56.y(i27)); else if (s19) return this.importsCache.set(t45, s19), this._load(s19, o88); })); } loadJSON(t45, i26 = {}) { this.fire(new e56.z("dataloading", { dataType: "style" })), this.globalId = this._getGlobalId(t45), this._request = e56.o.frame((() => { this._request = null, this._load(t45, false !== i26.validate); })); } loadEmpty() { this.fire(new e56.z("dataloading", { dataType: "style" })), this._load(bo, false); } _loadImports(t45, i26, o88) { if (this.importDepth >= 4) return e56.w("Style doesn't support nesting deeper than 5"), Promise.resolve(); const s18 = []; for (const e57 of t45) { const t46 = this._createFragmentStyle(e57), r86 = new Promise(((e58) => { t46.once("style.import.load", e58), t46.once("error", e58); })).then((() => this.mergeAll())); if (s18.push(r86), this.resolvedImports.has(e57.url)) { t46.loadEmpty(); continue; } const n45 = e57.data || this.importsCache.get(e57.url); n45 ? (t46.loadJSON(n45, { validate: i26 }), this._isInternalStyle(n45) && (t46.globalId = null)) : e57.url ? t46.loadURL(e57.url, { validate: i26 }) : t46.loadEmpty(); const a46 = { style: t46, id: e57.id, config: e57.config }; if (o88) { const e58 = this.fragments.findIndex((({ id: e59 }) => e59 === o88)); this.fragments = this.fragments.slice(0, e58).concat(a46).concat(this.fragments.slice(e58)); } else this.fragments.push(a46); } return Promise.allSettled(s18); } getImportGlobalIds(e57 = this, t45 = /* @__PURE__ */ new Set()) { for (const i26 of e57.fragments) i26.style.globalId && t45.add(i26.style.globalId), this.getImportGlobalIds(i26.style, t45); return [...t45.values()]; } _createFragmentStyle(t45) { const i26 = this.scope ? e56.B(t45.id, this.scope) : t45.id; let o88; const s18 = this._initialConfig && this._initialConfig[i26]; (t45.config || s18) && (o88 = Object.assign({}, t45.config, s18)); const r86 = new To(this.map, { scope: i26, styleChanges: this._changes, importDepth: this.importDepth + 1, importsCache: this.importsCache, resolvedImports: new Set(this.resolvedImports), dispatcher: this.dispatcher, imageManager: this.imageManager, glyphManager: this.glyphManager, modelManager: this.modelManager, config: o88, configOptions: this.options, colorThemeOverride: t45["color-theme"], configDependentLayers: this._configDependentLayers }); return r86.setEventedParent(this.map, { style: r86 }), r86; } _reloadImports() { this.mergeAll(), this._updateMapProjection(), this.updateConfigDependencies(), this.map._triggerCameraUpdate(this.camera), this.dispatcher.broadcast("setLayers", { layers: this._serializeLayers(this._order), scope: this.scope, options: this.options }), this._shouldPrecompile = this.map._precompilePrograms && this.isRootStyle(); } _isInternalStyle(e57) { return this.isRootStyle() && (e57.fragment || !!e57.schema && false !== e57.fragment); } _load(t45, i26) { if (this._isInternalStyle(t45)) { const e57 = Object.assign({}, bo, { imports: [{ id: "basemap", data: t45, url: "" }] }); return void this._load(e57, i26); } if (this.updateConfig(this._config, t45.schema), i26 && go(this, ge(t45))) return; this._loaded = true, this.stylesheet = e56.dk(t45); const o88 = () => { for (const e57 in t45.sources) this.addSource(e57, t45.sources[e57], { validate: false, isInitialLoad: true }); if (t45.iconsets) for (const e57 in t45.iconsets) this.addIconset(e57, t45.iconsets[e57]); t45.sprite ? this._loadIconset(t45.sprite) : (this.imageManager.setLoaded(true, this.scope), this.dispatcher.broadcast("spriteLoaded", { scope: this.scope, isLoaded: true })), !this.glyphManager.url && t45.glyphs && this.glyphManager.setURL(t45.glyphs); const o89 = Ot(this.stylesheet.layers); if (this._order = o89.map(((e57) => e57.id)), this.stylesheet.light && e56.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."), this.stylesheet.lights) if (1 === this.stylesheet.lights.length && "flat" === this.stylesheet.lights[0].type) { const e57 = this.stylesheet.lights[0]; this.light = new ze(e57.properties, e57.id); } else this.setLights(this.stylesheet.lights); this.light || (this.light = new ze(this.stylesheet.light)), this._layers = {}; for (const t46 of o89) { const i27 = e56.dq(t46, this.scope, this._styleColorTheme.lut, this.options); 0 !== i27.configDependencies.size && this._configDependentLayers.add(i27.fqid), i27.setEventedParent(this, { layer: { id: i27.id } }), this._layers[i27.id] = i27; const o90 = this.getOwnLayerSourceCache(i27), s20 = !!this.directionalLight && this.directionalLight.shadowsEnabled(); o90 && i27.canCastShadows() && s20 && (o90.castsShadows = true); } this.stylesheet.featuresets && this.setFeaturesetSelectors(this.stylesheet.featuresets), this.stylesheet.models && this.addModelURLs(this.stylesheet.models); const s19 = this.stylesheet.terrain; s19 && (this.checkCanvasFingerprintNoise(), this.disableElevatedTerrain || this.terrainSetForDrapingOnly() || this._createTerrain(s19, 1)), this.stylesheet.fog && this._createFog(this.stylesheet.fog), this.stylesheet.snow && this._createSnow(this.stylesheet.snow), this.stylesheet.rain && this._createRain(this.stylesheet.rain), this.stylesheet.transition && this.setTransition(this.stylesheet.transition), this.fire(new e56.z("data", { dataType: "style" })); const r86 = this.isRootStyle(); t45.imports ? this._loadImports(t45.imports, i26).then((() => { this._reloadImports(), this.fire(new e56.z(r86 ? "style.load" : "style.import.load")); })).catch(((t46) => { this.fire(new e56.y(new Error("Failed to load imports", t46))), this.fire(new e56.z(r86 ? "style.load" : "style.import.load")); })) : (this._reloadImports(), this.fire(new e56.z(r86 ? "style.load" : "style.import.load"))); }; this._styleColorTheme.colorTheme = this.stylesheet["color-theme"]; const s18 = this._styleColorTheme.colorThemeOverride ? this._styleColorTheme.colorThemeOverride : this._styleColorTheme.colorTheme; if (s18) { const t46 = this._evaluateColorThemeData(s18); this._loadColorTheme(t46).then((() => { o88(); })).catch(((t47) => { e56.w(`Couldn't load color theme from the stylesheet: ${t47}`), o88(); })); } else this._styleColorTheme.lut = null, o88(); } isRootStyle() { return 0 === this.importDepth; } mergeAll() { let e57, t45, i26, o88, s18, r86, n45, a46, l21, c28; const h8 = {}; this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle(((d34) => { if (d34.stylesheet) { if (null != d34.light && (e57 = d34.light), d34.stylesheet.lights) for (const e58 of d34.stylesheet.lights) "ambient" === e58.type && null != d34.ambientLight && (t45 = d34.ambientLight), "directional" === e58.type && null != d34.directionalLight && (i26 = d34.directionalLight); o88 = this._prioritizeTerrain(o88, d34.terrain, d34.stylesheet.terrain), d34.stylesheet.fog && null != d34.fog && (s18 = d34.fog), d34.stylesheet.snow && null != d34.snow && (r86 = d34.snow), d34.stylesheet.rain && null != d34.rain && (n45 = d34.rain), null != d34.stylesheet.camera && (c28 = d34.stylesheet.camera), null != d34.stylesheet.projection && (a46 = d34.stylesheet.projection), null != d34.stylesheet.transition && (l21 = d34.stylesheet.transition), h8[d34.scope] = d34._styleColorTheme; } })), this.light = e57, this.ambientLight = t45, this.directionalLight = i26, this.fog = s18, this.snow = r86, this.rain = n45, this._styleColorThemeForScope = h8, null === o88 ? delete this.terrain : this.terrain = o88, this.camera = c28 || { "camera-projection": "perspective" }, this.projection = a46 || { name: "mercator" }, this.transition = Object.assign({}, wo, l21), this.mergeSources(), this.mergeLayers(); } forEachFragmentStyle(e57) { const t45 = (i26) => { for (const e58 of i26.fragments) t45(e58.style); e57(i26); }; t45(this); } _prioritizeTerrain(e57, t45, i26) { const o88 = e57 && 0 === e57.drapeRenderMode; return null === i26 ? t45 && 0 === t45.drapeRenderMode ? t45 : o88 ? e57 : null : null != t45 && (!e57 || o88 || t45 && 1 === t45.drapeRenderMode) ? t45 : e57; } mergeTerrain() { let e57; this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle(((t45) => { e57 = this._prioritizeTerrain(e57, t45.terrain, t45.stylesheet.terrain); })), null === e57 ? delete this.terrain : this.terrain = e57; } mergeProjection() { let e57; this.forEachFragmentStyle(((t45) => { null != t45.stylesheet.projection && (e57 = t45.stylesheet.projection); })), this.projection = e57 || { name: "mercator" }; } mergeSources() { const t45 = {}, i26 = {}, o88 = {}; this.forEachFragmentStyle(((s18) => { for (const i27 in s18._sourceCaches) { const o89 = e56.B(i27, s18.scope); t45[o89] = s18._sourceCaches[i27]; } for (const t46 in s18._otherSourceCaches) { const o89 = e56.B(t46, s18.scope); i26[o89] = s18._otherSourceCaches[t46]; } for (const t46 in s18._symbolSourceCaches) { const i27 = e56.B(t46, s18.scope); o88[i27] = s18._symbolSourceCaches[t46]; } })), this._mergedSourceCaches = t45, this._mergedOtherSourceCaches = i26, this._mergedSymbolSourceCaches = o88; } mergeLayers() { const t45 = {}, i26 = [], o88 = {}; this._mergedSlots = [], this._has3DLayers = false, this._hasCircleLayers = false, this._hasSymbolLayers = false, this.forEachFragmentStyle(((o89) => { for (const s19 of o89._order) { const r87 = o89._layers[s19]; if ("slot" === r87.type) { const i27 = e56.dl(s19); if (t45[i27]) continue; t45[i27] = []; } r87.slot && t45[r87.slot] ? t45[r87.slot].push(r87) : i26.push(r87); } })), this._mergedOrder = []; let s18 = -1; const r86 = (i27 = []) => { for (const n45 of i27) if ("slot" === n45.type) { const i28 = e56.dl(n45.id); t45[i28] && r86(t45[i28]), this._mergedSlots.push(i28); } else { const t46 = e56.B(n45.id, n45.scope); this._mergedOrder.push(t46), o88[t46] = n45, n45.is3D(!!this.terrain) && (this._has3DLayers = true, s18 = this._mergedOrder.length - 1), "circle" === n45.type && (this._hasCircleLayers = true), "symbol" === n45.type && (this._hasSymbolLayers = true), "clip" === n45.type && (this._clipLayerPresent = true); } }; if (r86(i26), this._has3DLayers) { const e57 = {}; for (let t46 = 0; t46 < this._mergedOrder.length; ++t46) { const i27 = this._mergedOrder[t46]; e57[i27] = t46 === s18 ? 1 : t46 < s18 ? o88[i27].hasOcclusionOpacityProperties ? 2 : 0 : 4; } this._mergedOrder.sort(((t46, i27) => e57[t46] - e57[i27])); } this._mergedLayers = o88, this.updateDrapeFirstLayers(), this._buildingIndex.processLayersChanged(); } terrainSetForDrapingOnly() { return !!this.terrain && 0 === this.terrain.drapeRenderMode; } getCamera() { return this.stylesheet.camera; } setCamera(e57) { return this.stylesheet.camera = Object.assign({}, this.stylesheet.camera, e57), this.camera = this.stylesheet.camera, this; } _evaluateColorThemeData(t45) { return t45.data ? (function(t46, i26, o88, s18) { const r86 = Object.assign({}, i26); for (const t47 of Object.keys(e56.a6.colorTheme)) void 0 === r86[t47] && (r86[t47] = e56.a6.colorTheme[t47].default); const n45 = new e56.a8(_o, t46, new Map(o88)); return n45.setTransitionOrValue(r86, o88), n45.untransitioned().possiblyEvaluate(new e56.ac(0, { worldview: void 0 })); })(this.scope, t45, this.options).get("data") : null; } _loadColorTheme(t45) { this._styleColorTheme.lutLoading = true, this._styleColorTheme.lutLoadingCorrelationID += 1; const i26 = this._styleColorTheme.lutLoadingCorrelationID; return new Promise(((o88, s18) => { const r86 = "data:image/png;base64,"; if (!t45 || 0 === t45.length) return this._styleColorTheme.lut = null, this._styleColorTheme.lutLoading = false, void o88(); let n45 = t45; n45.startsWith(r86) || (n45 = r86 + n45); const a46 = e56.I.from("mapbox-reserved-lut"), l21 = new Image(); l21.src = n45, l21.onerror = () => { this._styleColorTheme.lutLoading = false, s18(new Error("Failed to load image data")); }, l21.onload = () => { if (this._styleColorTheme.lutLoadingCorrelationID !== i26) return void o88(); this._styleColorTheme.lutLoading = false; const { width: r87, height: n46, data: c28 } = e56.o.getImageData(l21); if (n46 > 32) return void s18(new Error("The height of the image must be less than or equal to 32 pixels.")); if (r87 !== n46 * n46) return void s18(new Error("The width of the image must be equal to the height squared.")); this.getImage(a46) && this.removeImage(a46), this.addImage(a46, { data: new e56.q({ width: r87, height: n46 }, c28), pixelRatio: 1, sdf: false, usvg: false, version: 0 }); const h8 = this.imageManager.getImage(a46, this.scope); h8 ? (this._styleColorTheme.lut = { image: h8.data, data: t45 }, o88()) : s18(new Error("Missing LUT image.")); }; })); } getLut(e57) { const t45 = this._styleColorThemeForScope[e57]; return t45 ? t45.lut : null; } setProjection(e57) { e57 ? this.stylesheet.projection = e57 : delete this.stylesheet.projection, this.mergeProjection(), this._updateMapProjection(); } applyProjectionUpdate() { this._loaded && (this.dispatcher.broadcast("setProjection", this.map.transform.projectionOptions), this.map.transform.projection.requiresDraping ? (this.getTerrain() || this.stylesheet.terrain) && !this.disableElevatedTerrain || this.setTerrainForDraping() : this.terrainSetForDrapingOnly() && this.setTerrain(null, 0)); } _updateMapProjection() { this.isRootStyle() && (this.map._useExplicitProjection ? this.applyProjectionUpdate() : this.map._prioritizeAndUpdateProjection(null, this.projection)); } _loadSprite(t45) { this._spriteRequest = (function(t46, i26, o88) { let s18, r86, n45; const a46 = e56.o.devicePixelRatio > 1 ? "@2x" : ""; let l21 = e56.m(i26.transformRequest(i26.normalizeSpriteURL(t46, a46, ".json"), e56.R.SpriteJSON), ((e57, t47) => { l21 = null, n45 || (n45 = e57, s18 = t47, h8()); })), c28 = e56.n(i26.transformRequest(i26.normalizeSpriteURL(t46, a46, ".png"), e56.R.SpriteImage), ((e57, t47) => { c28 = null, n45 || (n45 = e57, r86 = t47, h8()); })); function h8() { if (n45) o88(n45); else if (s18 && r86) { const t47 = e56.o.getImageData(r86), i27 = {}; for (const o89 in s18) { const { width: r87, height: n46, x: a47, y: l22, sdf: c29, pixelRatio: h9, stretchX: d34, stretchY: u12, content: _4 } = s18[o89], p9 = new e56.q({ width: r87, height: n46 }); e56.q.copy(t47, p9, { x: a47, y: l22 }, { x: 0, y: 0 }, { width: r87, height: n46 }, null), i27[o89] = { data: p9, pixelRatio: void 0 !== h9 ? h9 : 1, sdf: void 0 !== c29 && c29, stretchX: d34, stretchY: u12, content: _4, usvg: false, version: 0 }; } o88(null, i27); } } return { cancel() { l21 && (l21.cancel(), l21 = null), c28 && (c28.cancel(), c28 = null); } }; })(t45, this.map._requestManager, ((t46, i26) => { if (this._spriteRequest = null, t46) this.fire(new e56.y(t46)); else if (i26) { const t47 = /* @__PURE__ */ new Map(); for (const o88 in i26) t47.set(e56.I.from(o88), i26[o88]); this.addImages(t47); } this.imageManager.setLoaded(true, this.scope), this.dispatcher.broadcast("spriteLoaded", { scope: this.scope, isLoaded: true }), this.fire(new e56.z("data", { dataType: "style" })); })); } addIconset(t45, i26) { if ("sprite" === i26.type) return void this._loadSprite(i26.url); const o88 = this.getOwnSourceCache(i26.source); if (!o88) return void this.fire(new e56.y(new Error(`Source "${i26.source}" as specified by iconset "${t45}" does not exist and cannot be used as an iconset source`))); const s18 = o88.getSource(); if ("raster-array" !== s18.type) return void this.fire(new e56.y(new Error(`Source "${i26.source}" as specified by iconset "${t45}" is not a "raster-array" source and cannot be used as an iconset source`))); s18.partial = false; const r86 = new mo(t45, this.scope, o88); this.imageManager.addImageProvider(r86, this.scope); } removeIconset(e57) { this.imageManager.removeImageProvider(e57, this.scope); } _loadIconset(t45) { if (!e56.h(t45) && "icon_set" !== this.map._spriteFormat || "raster" === this.map._spriteFormat) return void this._loadSprite(t45); const i26 = "auto" === this.map._spriteFormat; var o88, s18; this._spriteRequest = (s18 = (o89, s19) => { if (this._spriteRequest = null, o89) i26 ? this._loadSprite(t45) : this.fire(new e56.y(o89)); else if (s19) { const t46 = /* @__PURE__ */ new Map(); for (const i27 in s19) t46.set(e56.I.from(i27), s19[i27]); this.addImages(t46); } this.imageManager.setLoaded(true, this.scope), this.dispatcher.broadcast("spriteLoaded", { scope: this.scope, isLoaded: true }), this.fire(new e56.z("data", { dataType: "style" })); }, e56.bu((o88 = this.map._requestManager).transformRequest(o88.normalizeIconsetURL(t45), e56.R.Iconset), ((t46, i27) => { if (t46) return void s18(t46); const o89 = {}, r86 = e56.dc(new e56.bt(i27)); for (const t47 of r86.icons) { const i28 = { version: 1, pixelRatio: e56.o.devicePixelRatio, content: po(t47), stretchX: t47.metadata ? fo(t47.metadata.stretch_x_areas) : void 0, stretchY: t47.metadata ? fo(t47.metadata.stretch_y_areas) : void 0, sdf: false, usvg: true, icon: t47 }; o89[t47.name] = i28; } s18(null, o89); }))); } _validateLayer(t45) { const i26 = this.getOwnSource(t45.source); if (!i26) return; const o88 = t45.sourceLayer; o88 && ("geojson" === i26.type || i26.vectorLayerIds && -1 === i26.vectorLayerIds.indexOf(o88)) && this.fire(new e56.y(new Error(`Source layer "${o88}" does not exist on source "${i26.id}" as specified by style layer "${t45.id}"`))); } loaded() { if (!this._loaded) return false; if (Object.keys(this._changes.getUpdatedSourceCaches()).length) return false; for (const e57 in this._sourceCaches) if (!this._sourceCaches[e57].loaded()) return false; if (!this.imageManager.isLoaded()) return false; if (this.imageManager.hasPatternsInFlight()) return false; if (!this.modelManager.isLoaded()) return false; if (this._styleColorTheme.lutLoading) return false; for (const { style: e57 } of this.fragments) if (!e57.loaded()) return false; return true; } _serializeImports() { if (this.stylesheet.imports) return this.stylesheet.imports.map(((e57, t45) => { const i26 = this.fragments[t45]; return i26 && i26.style && (e57.data = i26.style.serialize()), e57; })); } _serializeSources() { const e57 = {}; for (const t45 in this._sourceCaches) { const i26 = this._sourceCaches[t45].getSource(); e57[i26.id] || (e57[i26.id] = i26.serialize()); } return e57; } _serializeLayers(e57) { const t45 = []; for (const i26 of e57) { const e58 = this._layers[i26]; e58 && "custom" !== e58.type && t45.push(e58.serialize()); } return t45; } hasLightTransitions() { return !(!this.light || !this.light.hasTransition()) || !(!this.ambientLight || !this.ambientLight.hasTransition()) || !(!this.directionalLight || !this.directionalLight.hasTransition()); } hasFogTransition() { return !!this.fog && this.fog.hasTransition(); } hasSnowTransition() { return !!this.snow && this.snow.hasTransition(); } hasRainTransition() { return !!this.rain && this.rain.hasTransition(); } hasTransitions() { if (this.hasLightTransitions()) return true; if (this.hasFogTransition()) return true; if (this.hasSnowTransition()) return true; if (this.hasRainTransition()) return true; for (const e57 in this._sourceCaches) if (this._sourceCaches[e57].hasTransition()) return true; for (const e57 in this._layers) if (this._layers[e57].hasTransition()) return true; return false; } get order() { return this.terrain ? this._drapedFirstOrder : this._mergedOrder; } _getOrder(e57) { return e57 ? this.order : this._mergedOrder; } isLayerDraped(e57) { return !!this.terrain && e57.isDraped(this.getLayerSourceCache(e57)); } _checkLoaded() { if (!this._loaded) throw new Error("Style is not done loading"); } _checkLayer(t45) { const i26 = this.getOwnLayer(t45); if (i26) return i26; this.fire(new e56.y(new Error(`The layer '${t45}' does not exist in the map's style.`))); } _checkSource(t45) { const i26 = this.getOwnSource(t45); if (i26) return i26; this.fire(new e56.y(new Error(`The source '${t45}' does not exist in the map's style.`))); } precompilePrograms(e57, t45) { const i26 = this.map.painter; if (i26) for (let o88 = e57.minzoom || 0; o88 < (e57.maxzoom || 25.5); o88++) { const o89 = e57.getProgramIds(); if (o89) for (const s18 of o89) { const o90 = e57.getDefaultProgramParams(s18, t45.zoom, this._styleColorTheme.lut); o90 && (i26.style = this, this.fog && (i26._fogVisible = true, o90.overrideFog = true, i26.getOrCreateProgram(s18, o90)), i26._fogVisible = false, o90.overrideFog = false, i26.getOrCreateProgram(s18, o90), (this.stylesheet.terrain || this.stylesheet.projection && "globe" === this.stylesheet.projection.name) && (o90.overrideRtt = true, i26.getOrCreateProgram(s18, o90))); } } } update(t45) { if (!this._loaded) return; this.ambientLight && this.ambientLight.recalculate(t45), this.directionalLight && this.directionalLight.recalculate(t45); const i26 = this.calculateLightsBrightness(); t45.brightness = i26 || 0, i26 !== this._brightness && (this._brightness = i26, this.dispatcher.broadcast("setBrightness", i26)), t45.worldview !== this._worldview && (this._worldview = t45.worldview, this.dispatcher.broadcast("setWorldview", this._worldview)); const o88 = this._changes.isDirty(); let s18 = false; if (this._changes.isDirty()) { const e57 = this._changes.getLayerUpdatesByScope(); for (const t46 in e57) { const { updatedIds: i27, removedIds: o89 } = e57[t46]; (i27 || o89) && (this._updateWorkerLayers(t46, i27, o89), s18 = true); } this.updateSourceCaches(), this._updateTilesForChangedImages(), this.updateLayers(t45), this.light && this.light.updateTransitions(t45), this.ambientLight && this.ambientLight.updateTransitions(t45), this.directionalLight && this.directionalLight.updateTransitions(t45), this.fog && this.fog.updateTransitions(t45), this.snow && this.snow.updateTransitions(t45), this.rain && this.rain.updateTransitions(t45), this._changes.reset(); } const r86 = {}; for (const e57 in this._mergedSourceCaches) { const t46 = this._mergedSourceCaches[e57]; r86[e57] = t46.used, t46.used = false, t46.tileCoverLift = 0; } for (const e57 of this._mergedOrder) { const i27 = this._mergedLayers[e57]; if (i27.recalculate(t45, this._availableImages), !i27.isHidden(t45.zoom)) { const e58 = this.getLayerSourceCache(i27); e58 && (e58.used = true, e58.tileCoverLift = Math.max(e58.tileCoverLift, i27.tileCoverLift())); } !this._precompileDone && this._shouldPrecompile && ("requestIdleCallback" in window ? requestIdleCallback((() => { this.precompilePrograms(i27, t45); })) : this.precompilePrograms(i27, t45)); } this._shouldPrecompile && (this._precompileDone = true), this.terrain && s18 && this.mergeLayers(); const n45 = this.imageManager.getPendingImageProviders(); for (const e57 of n45) e57.sourceCache.used = true; for (const t46 in r86) { const i27 = this._mergedSourceCaches[t46]; r86[t46] !== i27.used && i27.getSource().fire(new e56.z("data", { sourceDataType: "visibility", dataType: "source", sourceId: i27.getSource().id })); } this.light && this.light.recalculate(t45), this.terrain && this.terrain.recalculate(t45), this.fog && this.fog.recalculate(t45), this.snow && this.snow.recalculate(t45), this.rain && this.rain.recalculate(t45), this.z = t45.zoom, this._markersNeedUpdate && (this._updateMarkersOpacity(), this._markersNeedUpdate = false), this.imageManager.clearUpdatedImages(this.scope), o88 && this.fire(new e56.z("data", { dataType: "style" })); } updateImageProviders() { const e57 = this.imageManager.getPendingImageProviders(); for (const t45 of e57) { const e58 = t45.resolvePendingRequests(), i26 = this.getFragmentStyle(t45.scope); i26 && i26.addImages(e58); } } _updateTilesForChangedImages() { const e57 = {}; for (const t45 in this._mergedSourceCaches) { const i26 = this._mergedSourceCaches[t45].getSource().scope; e57[i26] = e57[i26] || this._changes.getUpdatedImages(i26), 0 !== e57[i26].length && this._mergedSourceCaches[t45].reloadTilesForDependencies(["icons", "patterns"], e57[i26]); } for (const t45 in e57) this._changes.resetUpdatedImages(t45); } _updateWorkerLayers(e57, t45, i26) { const o88 = this.getFragmentStyle(e57); o88 && this.dispatcher.broadcast("updateLayers", { layers: t45 ? o88._serializeLayers(t45) : [], scope: e57, removedIds: i26 || [], options: o88.options }); } setState(t45, i26) { if (this._checkLoaded(), go(this, ge(t45))) return false; (t45 = e56.dk(t45)).layers = Ot(t45.layers); const o88 = (function(t46, i27) { if (!t46) return [{ command: Mt2.setStyle, args: [i27] }]; let o89 = []; try { if (!e56.by(t46.version, i27.version)) return [{ command: Mt2.setStyle, args: [i27] }]; if (e56.by(t46.center, i27.center) || o89.push({ command: Mt2.setCenter, args: [i27.center] }), e56.by(t46.zoom, i27.zoom) || o89.push({ command: Mt2.setZoom, args: [i27.zoom] }), e56.by(t46.bearing, i27.bearing) || o89.push({ command: Mt2.setBearing, args: [i27.bearing] }), e56.by(t46.pitch, i27.pitch) || o89.push({ command: Mt2.setPitch, args: [i27.pitch] }), e56.by(t46.sprite, i27.sprite) || o89.push({ command: Mt2.setSprite, args: [i27.sprite] }), e56.by(t46.glyphs, i27.glyphs) || o89.push({ command: Mt2.setGlyphs, args: [i27.glyphs] }), e56.by(t46.imports, i27.imports) || (function(t47 = [], i28 = [], o90) { i28 = i28 || []; const s20 = (t47 = t47 || []).map(jt), r88 = i28.map(jt), n46 = t47.reduce(Vt, {}), a47 = i28.reduce(Vt, {}), l21 = s20.slice(); let c28, h8, d34, u12; for (c28 = 0, h8 = 0; c28 < s20.length; c28++) d34 = s20[c28], a47.hasOwnProperty(d34) ? h8++ : (o90.push({ command: Mt2.removeImport, args: [d34] }), l21.splice(l21.indexOf(d34, h8), 1)); for (c28 = 0, h8 = 0; c28 < r88.length; c28++) d34 = r88[r88.length - 1 - c28], l21[l21.length - 1 - c28] !== d34 && (n46.hasOwnProperty(d34) ? (o90.push({ command: Mt2.removeImport, args: [d34] }), l21.splice(l21.lastIndexOf(d34, l21.length - h8), 1)) : h8++, u12 = l21[l21.length - c28], o90.push({ command: Mt2.addImport, args: [a47[d34], u12] }), l21.splice(l21.length - c28, 0, d34)); for (const t48 of i28) { const i29 = n46[t48.id]; i29 && (delete i29.data, e56.by(i29, t48) || o90.push({ command: Mt2.updateImport, args: [t48.id, t48] })); } })(t46.imports, i27.imports, o89), e56.by(t46.transition, i27.transition) || o89.push({ command: Mt2.setTransition, args: [i27.transition] }), e56.by(t46.light, i27.light) || o89.push({ command: Mt2.setLight, args: [i27.light] }), e56.by(t46.fog, i27.fog) || o89.push({ command: Mt2.setFog, args: [i27.fog] }), e56.by(t46.snow, i27.snow) || o89.push({ command: Mt2.setSnow, args: [i27.snow] }), e56.by(t46.rain, i27.rain) || o89.push({ command: Mt2.setRain, args: [i27.rain] }), e56.by(t46.projection, i27.projection) || o89.push({ command: Mt2.setProjection, args: [i27.projection] }), e56.by(t46.lights, i27.lights) || o89.push({ command: Mt2.setLights, args: [i27.lights] }), e56.by(t46.camera, i27.camera) || o89.push({ command: Mt2.setCamera, args: [i27.camera] }), e56.by(t46.iconsets, i27.iconsets) || (function(t47, i28, o90) { let s20; for (s20 in i28 = i28 || {}, t47 = t47 || {}) t47.hasOwnProperty(s20) && (i28.hasOwnProperty(s20) || o90.push({ command: Mt2.removeIconset, args: [s20] })); for (s20 in i28) { if (!i28.hasOwnProperty(s20)) continue; const r88 = i28[s20]; t47.hasOwnProperty(s20) ? e56.by(t47[s20], r88) || (o90.push({ command: Mt2.removeIconset, args: [s20] }), o90.push({ command: Mt2.addIconset, args: [s20, r88] })) : o90.push({ command: Mt2.addIconset, args: [s20, r88] }); } })(t46.iconsets, i27.iconsets, o89), !e56.by(t46["color-theme"], i27["color-theme"])) return [{ command: Mt2.setStyle, args: [i27] }]; const s19 = {}, r87 = []; !(function(t47, i28, o90, s20) { let r88; for (r88 in i28 = i28 || {}, t47 = t47 || {}) t47.hasOwnProperty(r88) && (i28.hasOwnProperty(r88) || Bt(r88, o90, s20)); for (r88 in i28) { if (!i28.hasOwnProperty(r88)) continue; const n46 = i28[r88]; t47.hasOwnProperty(r88) ? e56.by(t47[r88], n46) || ("geojson" === t47[r88].type && "geojson" === n46.type && Nt(t47, i28, r88) ? o90.push({ command: Mt2.setGeoJSONSourceData, args: [r88, n46.data] }) : kt(r88, i28, o90, s20)) : Ft(r88, i28, o90); } })(t46.sources, i27.sources, r87, s19); const n45 = []; t46.layers && t46.layers.forEach(((e57) => { e57.source && s19[e57.source] ? o89.push({ command: Mt2.removeLayer, args: [e57.id] }) : n45.push(e57); })); let a46 = t46.terrain; a46 && s19[a46.source] && (o89.push({ command: Mt2.setTerrain, args: [void 0] }), a46 = void 0), o89 = o89.concat(r87), e56.by(a46, i27.terrain) || o89.push({ command: Mt2.setTerrain, args: [i27.terrain] }), (function(t47, i28, o90) { i28 = i28 || []; const s20 = (t47 = t47 || []).map(jt), r88 = i28.map(jt), n46 = t47.reduce(Vt, {}), a47 = i28.reduce(Vt, {}), l21 = s20.slice(), c28 = /* @__PURE__ */ Object.create(null); let h8, d34, u12, _4, p9, f8, m6; for (h8 = 0, d34 = 0; h8 < s20.length; h8++) u12 = s20[h8], a47.hasOwnProperty(u12) ? d34++ : (o90.push({ command: Mt2.removeLayer, args: [u12] }), l21.splice(l21.indexOf(u12, d34), 1)); for (h8 = 0, d34 = 0; h8 < r88.length; h8++) u12 = r88[r88.length - 1 - h8], l21[l21.length - 1 - h8] !== u12 && (n46.hasOwnProperty(u12) ? (o90.push({ command: Mt2.removeLayer, args: [u12] }), l21.splice(l21.lastIndexOf(u12, l21.length - d34), 1)) : d34++, f8 = l21[l21.length - h8], o90.push({ command: Mt2.addLayer, args: [a47[u12], f8] }), l21.splice(l21.length - h8, 0, u12), c28[u12] = true); for (h8 = 0; h8 < r88.length; h8++) if (u12 = r88[h8], _4 = n46[u12], p9 = a47[u12], !c28[u12] && !e56.by(_4, p9)) if (e56.by(_4.source, p9.source) && e56.by(_4["source-layer"], p9["source-layer"]) && e56.by(_4.type, p9.type)) { for (m6 in Ut2(_4.layout, p9.layout, o90, u12, null, Mt2.setLayoutProperty), Ut2(_4.paint, p9.paint, o90, u12, null, Mt2.setPaintProperty), e56.by(_4.slot, p9.slot) || o90.push({ command: Mt2.setSlot, args: [u12, p9.slot] }), e56.by(_4.filter, p9.filter) || o90.push({ command: Mt2.setFilter, args: [u12, p9.filter] }), e56.by(_4.minzoom, p9.minzoom) && e56.by(_4.maxzoom, p9.maxzoom) || o90.push({ command: Mt2.setLayerZoomRange, args: [u12, p9.minzoom, p9.maxzoom] }), _4) _4.hasOwnProperty(m6) && "layout" !== m6 && "paint" !== m6 && "filter" !== m6 && "metadata" !== m6 && "minzoom" !== m6 && "maxzoom" !== m6 && "slot" !== m6 && (0 === m6.indexOf("paint.") ? Ut2(_4[m6], p9[m6], o90, u12, m6.slice(6), Mt2.setPaintProperty) : e56.by(_4[m6], p9[m6]) || o90.push({ command: Mt2.setLayerProperty, args: [u12, m6, p9[m6]] })); for (m6 in p9) p9.hasOwnProperty(m6) && !_4.hasOwnProperty(m6) && "layout" !== m6 && "paint" !== m6 && "filter" !== m6 && "metadata" !== m6 && "minzoom" !== m6 && "maxzoom" !== m6 && "slot" !== m6 && (0 === m6.indexOf("paint.") ? Ut2(_4[m6], p9[m6], o90, u12, m6.slice(6), Mt2.setPaintProperty) : e56.by(_4[m6], p9[m6]) || o90.push({ command: Mt2.setLayerProperty, args: [u12, m6, p9[m6]] })); } else o90.push({ command: Mt2.removeLayer, args: [u12] }), f8 = l21[l21.lastIndexOf(u12) + 1], o90.push({ command: Mt2.addLayer, args: [p9, f8] }); })(n45, i27.layers, o89); } catch (e57) { console.warn("Unable to compute style diff:", e57), o89 = [{ command: Mt2.setStyle, args: [i27] }]; } return o89; })(this.serialize(), t45).filter(((e57) => !(e57.command in yo))); if (0 === o88.length) return false; const s18 = o88.filter(((e57) => !(e57.command in vo))); if (s18.length > 0) throw new Error(`Unimplemented: ${s18.map(((e57) => e57.command)).join(", ")}.`); const r86 = []; return o88.forEach(((e57) => { r86.push(this[e57.command](...e57.args)); })), i26 && Promise.all(r86).then(i26).catch(i26), this.stylesheet = t45, this.mergeAll(), this.dispatcher.broadcast("setLayers", { layers: this._serializeLayers(this._order), scope: this.scope, options: this.options }), true; } _updateWorkerImages() { this._availableImages = this.imageManager.listImages(this.scope), this.dispatcher.broadcast("setImages", { scope: this.scope, images: this._availableImages }); } _updateWorkerModels() { this._availableModels = this.modelManager.getModelURIs(this.scope), this.dispatcher.broadcast("setModels", { scope: this.scope, models: this._availableModels }); } addImages(t45) { if (0 === t45.size) return this; for (const [i26, o88] of t45.entries()) { if (this.getImage(i26)) return this.fire(new e56.y(new Error(`An image with the name "${i26.name}" already exists.`))); this.imageManager.addImage(i26, this.scope, o88), this._changes.updateImage(i26, this.scope); } return this._updateWorkerImages(), this.fire(new e56.z("data", { dataType: "style" })), this; } addImage(t45, i26) { return this.getImage(t45) ? this.fire(new e56.y(new Error(`An image with the name "${t45.name}" already exists.`))) : (this.imageManager.addImage(t45, this.scope, i26), this._changes.updateImage(t45, this.scope), this._updateWorkerImages(), this.fire(new e56.z("data", { dataType: "style" })), this); } updateImage(t45, i26, o88 = false) { this.imageManager.updateImage(t45, this.scope, i26), o88 && (this._changes.updateImage(t45, this.scope), this._updateWorkerImages(), this.fire(new e56.z("data", { dataType: "style" }))); } getImage(e57) { return this.imageManager.getImage(e57, this.scope); } removeImage(t45) { return this.getImage(t45) ? (this.imageManager.removeImage(t45, this.scope), this._changes.updateImage(t45, this.scope), this._updateWorkerImages(), this.fire(new e56.z("data", { dataType: "style" })), this) : this.fire(new e56.y(new Error("No image with this name exists."))); } listImages() { return this._checkLoaded(), this._availableImages.slice(); } addModelURLs(t45) { return this.modelManager.addModelURLs(t45, this.scope), this._updateWorkerModels(), this.fire(new e56.z("data", { dataType: "style" })), this; } addModel(t45, i26, o88 = {}) { return this._checkLoaded(), this._validate(Ae, `models.${t45}`, i26, null, o88) || (this.modelManager.addModel(t45, i26, this.scope), this.fire(new e56.z("data", { dataType: "style" }))), this; } hasModel(e57) { return this.modelManager.hasModel(e57, this.scope); } removeModel(t45) { return this.hasModel(t45) ? (this.modelManager.removeModel(t45, this.scope, false, true), this.fire(new e56.z("data", { dataType: "style" })), this) : this.fire(new e56.y(new Error("No model with this ID exists."))); } listModels() { return this._checkLoaded(), this.modelManager.listModels(this.scope); } addSource(t45, i26, o88 = {}) { if (this._checkLoaded(), void 0 !== this.getOwnSource(t45)) throw new Error(`There is already a source with ID "${t45}".`); if (!i26.type) throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i26).join(", ")}.`); if (["vector", "raster", "geojson", "video", "image"].indexOf(i26.type) >= 0 && this._validate(ve2, `sources.${t45}`, i26, null, o88)) return; this.map && this.map._collectResourceTiming && (i26.collectResourceTiming = true); const s18 = lt(t45, i26, this.dispatcher, this); s18.scope = this.scope, s18.setEventedParent(this, (() => ({ isSourceLoaded: this._isSourceCacheLoaded(s18.id), source: s18.serialize(), sourceId: s18.id }))); const r86 = (t46) => { const i27 = (t46 ? "symbol:" : "other:") + s18.id, o89 = e56.B(i27, this.scope), r87 = this._sourceCaches[i27] = new Rt2(o89, s18, t46); (t46 ? this._symbolSourceCaches : this._otherSourceCaches)[s18.id] = r87, r87.onAdd(this.map); }; r86(false), "vector" !== i26.type && "geojson" !== i26.type || r86(true), s18.onAdd && s18.onAdd(this.map), o88.isInitialLoad || (this.mergeSources(), this._changes.setDirty()); } removeSource(t45) { this._checkLoaded(); const i26 = this.getOwnSource(t45); if (!i26) throw new Error("There is no source with this ID"); for (const i27 in this._layers) if (this._layers[i27].source === t45) return this.fire(new e56.y(new Error(`Source "${t45}" cannot be removed while layer "${i27}" is using it.`))); if (this.terrain && this.terrain.scope === this.scope && this.terrain.get().source === t45) return this.fire(new e56.y(new Error(`Source "${t45}" cannot be removed while terrain is using it.`))); if (this.stylesheet.iconsets) { const i27 = Object.entries(this.stylesheet.iconsets).find((([e57, i28]) => "source" === i28.type && i28.source === t45)); if (i27) return this.fire(new e56.y(new Error(`Source "${t45}" cannot be removed while iconset "${i27[0]}" is using it.`))); } const o88 = this.getOwnSourceCaches(t45); for (const t46 of o88) { const i27 = e56.dl(t46.id); delete this._sourceCaches[i27], this._changes.discardSourceCacheUpdate(t46.id), t46.fire(new e56.z("data", { sourceDataType: "metadata", dataType: "source", sourceId: t46.getSource().id })), t46.setEventedParent(null), t46.clearTiles(); } return delete this._otherSourceCaches[t45], delete this._symbolSourceCaches[t45], this.mergeSources(), i26.setEventedParent(null), i26.onRemove && i26.onRemove(this.map), this._changes.setDirty(), this; } setGeoJSONSourceData(e57, t45) { this._checkLoaded(), this.getOwnSource(e57).setData(t45), this._changes.setDirty(); } getOwnSource(e57) { const t45 = this.getOwnSourceCache(e57); return t45 && t45.getSource(); } getOwnSources() { const e57 = []; for (const t45 in this._otherSourceCaches) { const i26 = this.getOwnSourceCache(t45); i26 && e57.push(i26.getSource()); } return e57; } areTilesLoaded() { const e57 = this._mergedSourceCaches; for (const t45 in e57) { const i26 = e57[t45]._tiles; for (const e58 in i26) { const t46 = i26[e58]; if ("loaded" !== t46.state && "errored" !== t46.state) return false; } } return true; } setLights(t45) { if (this._checkLoaded(), !t45) return delete this.ambientLight, void delete this.directionalLight; const i26 = this._getTransitionParameters(); for (const o89 of t45) { if (this._validate(xe2, "lights", o89)) return; switch (o89.type) { case "ambient": if (this.ambientLight) { const e57 = this.ambientLight; e57.set(o89), e57.updateTransitions(i26); } else this.ambientLight = new Xe(o89, qe || (qe = new e56.a9({ color: new e56.aa(e56.a6.properties_light_ambient.color), "color-use-theme": new e56.aa({ type: "string", default: "default", "property-type": "data-constant" }), intensity: new e56.aa(e56.a6.properties_light_ambient.intensity) })), this.scope, this.options); break; case "directional": if (this.directionalLight) { const e57 = this.directionalLight; e57.set(o89), e57.updateTransitions(i26); } else this.directionalLight = new Xe(o89, Ze || (Ze = new e56.a9({ direction: new e56.ap(e56.a6.properties_light_directional.direction), color: new e56.aa(e56.a6.properties_light_directional.color), "color-use-theme": new e56.aa({ type: "string", default: "default", "property-type": "data-constant" }), intensity: new e56.aa(e56.a6.properties_light_directional.intensity), "cast-shadows": new e56.aa(e56.a6.properties_light_directional["cast-shadows"]), "shadow-quality": new e56.aa(e56.a6.properties_light_directional["shadow-quality"]), "shadow-intensity": new e56.aa(e56.a6.properties_light_directional["shadow-intensity"]) })), this.scope, this.options); } } const o88 = Object.assign(i26, { worldview: this.map.getWorldview() }), s18 = new e56.ac(this.z || 0, o88); this.ambientLight && this.ambientLight.recalculate(s18), this.directionalLight && this.directionalLight.recalculate(s18), this._brightness = this.calculateLightsBrightness(), this.dispatcher.broadcast("setBrightness", this._brightness); } calculateLightsBrightness() { const t45 = this.directionalLight, i26 = this.ambientLight; if (!t45 || !i26) return; const o88 = (e57) => 0.2126 * (e57[0] <= 0.03928 ? e57[0] / 12.92 : Math.pow((e57[0] + 0.055) / 1.055, 2.4)) + 0.7152 * (e57[1] <= 0.03928 ? e57[1] / 12.92 : Math.pow((e57[1] + 0.055) / 1.055, 2.4)) + 0.0722 * (e57[2] <= 0.03928 ? e57[2] / 12.92 : Math.pow((e57[2] + 0.055) / 1.055, 2.4)), s18 = t45.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(), r86 = t45.properties.get("intensity"), n45 = t45.properties.get("direction"), a46 = 1 - e56.d3(n45.x, n45.y, n45.z)[2] / 90, l21 = o88(s18) * r86 * a46, c28 = i26.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(), h8 = i26.properties.get("intensity"), d34 = o88(c28) * h8; return Number(((l21 + d34) / 2).toFixed(6)); } getBrightness() { return this._brightness; } getLights() { if (!this.enable3dLights()) return null; const e57 = []; return this.directionalLight && e57.push(this.directionalLight.get()), this.ambientLight && e57.push(this.ambientLight.get()), e57; } enable3dLights() { return !!this.ambientLight && !!this.directionalLight; } getFragmentStyle(t45) { if (null == t45 || "" === t45 && this.isRootStyle()) return this; if (e56.dm(t45)) { const i26 = e56.dn(t45), o88 = this.fragments.find((({ id: e57 }) => e57 === i26)); if (!o88) return; const s18 = e56.dl(t45); return o88.style.getFragmentStyle(s18); } { const e57 = this.fragments.find((({ id: e58 }) => e58 === t45)); return e57 ? e57.style : void 0; } } setFeaturesetSelectors(t45) { if (!t45) return; const i26 = {}, o88 = (e57, t46 = "") => `${e57}::${t46}`; this._featuresetSelectors = {}; for (const s18 in t45) { const r86 = this._featuresetSelectors[s18] = []; for (const n45 of t45[s18].selectors) { if (n45.featureNamespace) { const t47 = this.getOwnLayer(n45.layer); if (!t47) { e56.w(`Layer is undefined for selector: ${n45.layer}`); continue; } const r87 = o88(t47.source, t47.sourceLayer); if (r87 in i26 && i26[r87] !== n45.featureNamespace) { e56.w(`"featureNamespace ${n45.featureNamespace} of featureset ${s18}'s selector is not associated to the same source, skip this selector`); continue; } i26[r87] = n45.featureNamespace; } let t46; if (n45.properties) for (const i27 in n45.properties) { const o89 = e56.U(n45.properties[i27]); "success" === o89.result && (t46 = t46 || {}, t46[i27] = o89.value); } r86.push({ layerId: n45.layer, namespace: n45.featureNamespace, properties: t46, uniqueFeatureID: n45._uniqueFeatureID }); } } } getFeaturesetDescriptors(e57) { const t45 = this.getFragmentStyle(e57); if (!t45 || !t45.stylesheet.featuresets) return []; const i26 = []; for (const e58 in t45.stylesheet.featuresets) i26.push({ featuresetId: e58, importId: t45.scope ? t45.scope : void 0 }); return i26; } getFeaturesetLayers(t45, i26) { const o88 = this.getFragmentStyle(i26), s18 = o88.stylesheet.featuresets; if (!s18 || !s18[t45]) return this.fire(new e56.y(new Error(`The featureset '${t45}' does not exist in the map's style and cannot be queried.`))), []; const r86 = []; for (const e57 of s18[t45].selectors) { const t46 = o88.getOwnLayer(e57.layer); t46 && r86.push(t46); } return r86; } getConfigProperty(t45, i26) { const o88 = this.getFragmentStyle(t45); if (!o88) return null; const s18 = e56.B(i26, o88.scope), r86 = o88.options.get(s18), n45 = r86 ? r86.value || r86.default : null; return n45 ? n45.serialize() : null; } setConfigProperty(t45, i26, o88) { const s18 = this.getFragmentStyle(t45); if (!s18) return; const r86 = s18.stylesheet.schema; if (!r86 || !r86[i26]) return; const n45 = e56.U(o88); if ("success" !== n45.result) return void go(this, n45.value); const a46 = n45.value.expression, l21 = e56.B(i26, s18.scope), c28 = s18.options.get(l21); if (!c28) return; let h8; const { minValue: d34, maxValue: u12, stepValue: _4, type: p9, values: f8 } = r86[i26], m6 = e56.U(r86[i26].default); "success" === m6.result && (h8 = m6.value.expression), h8 ? (this.options.set(l21, Object.assign({}, c28, { value: a46, default: h8, minValue: d34, maxValue: u12, stepValue: _4, type: p9, values: f8 })), this.updateConfigDependencies(i26)) : this.fire(new e56.y(new Error(`No schema defined for the config option "${i26}" in the "${t45}" fragment.`))); } getConfig(t45) { const i26 = this.getFragmentStyle(t45); if (!i26) return null; const o88 = i26.stylesheet.schema; if (!o88) return null; const s18 = {}; for (const t46 in o88) { const o89 = e56.B(t46, i26.scope), r86 = i26.options.get(o89), n45 = r86 ? r86.value || r86.default : null; s18[t46] = n45 ? n45.serialize() : null; } return s18; } setConfig(e57, t45) { const i26 = this.getFragmentStyle(e57); i26 && (i26.updateConfig(t45, i26.stylesheet.schema), this.updateConfigDependencies()); } getSchema(e57) { const t45 = this.getFragmentStyle(e57); return t45 ? t45.stylesheet.schema : null; } setSchema(e57, t45) { const i26 = this.getFragmentStyle(e57); i26 && (i26.stylesheet.schema = t45, i26.updateConfig(i26._config, t45), this.updateConfigDependencies()); } updateConfig(t45, i26) { if (this._config = t45, t45 || i26) if (i26) for (const o88 in i26) { let s18, r86; const n45 = e56.U(i26[o88].default); if ("success" === n45.result && (s18 = n45.value.expression), t45 && void 0 !== t45[o88]) { const i27 = e56.U(t45[o88]); "success" === i27.result && (r86 = i27.value.expression); } const { minValue: a46, maxValue: l21, stepValue: c28, type: h8, values: d34 } = i26[o88]; if (s18) { const t46 = e56.B(o88, this.scope); this.options.set(t46, { default: s18, value: r86, minValue: a46, maxValue: l21, stepValue: c28, type: h8, values: d34 }); } else this.fire(new e56.y(new Error(`No schema defined for config option "${o88}".`))); } else this.fire(new e56.y(new Error("Attempting to set config for a style without schema."))); } updateConfigDependencies(e57) { for (const t45 of this._configDependentLayers) { const i26 = this.getLayer(t45); if (i26) { if (e57 && !i26.configDependencies.has(e57)) continue; i26.possiblyEvaluateVisibility(), this._updateLayer(i26); } } this.ambientLight && this.ambientLight.updateConfig(this.options), this.directionalLight && this.directionalLight.updateConfig(this.options), this.fog && this.fog.updateConfig(this.options), this.snow && this.snow.updateConfig(this.options), this.rain && this.rain.updateConfig(this.options), this.forEachFragmentStyle(((e58) => { const t45 = e58._styleColorTheme.colorThemeOverride ? e58._styleColorTheme.colorThemeOverride : e58._styleColorTheme.colorTheme; if (t45) { const i26 = e58._evaluateColorThemeData(t45); (!e58._styleColorTheme.lut && "" !== i26 || e58._styleColorTheme.lut && i26 !== e58._styleColorTheme.lut.data) && e58.setColorTheme(t45); } })), this._changes.setDirty(); } addLayer(t45, i26, o88 = {}) { this._checkLoaded(); const s18 = t45.id; if (this._layers[s18]) return void this.fire(new e56.y(new Error(`Layer with id "${s18}" already exists on this map`))); let r86; if ("custom" === t45.type) { if (go(this, e56.dp(t45))) return; r86 = e56.dq(t45, this.scope, this._styleColorTheme.lut, this.options); } else { if ("object" == typeof t45.source && (this.addSource(s18, t45.source), t45 = e56.dk(t45), t45 = Object.assign(t45, { source: s18 })), this._validate(Se, `layers.${s18}`, t45, { arrayIndex: -1 }, o88)) return; r86 = e56.dq(t45, this.scope, this._styleColorTheme.lut, this.options), this._validateLayer(r86), r86.setEventedParent(this, { layer: { id: s18 } }); } 0 !== r86.configDependencies.size && this._configDependentLayers.add(r86.fqid); let n45 = this._order.length; if (i26) { const t46 = this._order.indexOf(i26); if (-1 === t46) return void this.fire(new e56.y(new Error(`Layer with id "${i26}" does not exist on this map.`))); r86.slot === this._layers[i26].slot ? n45 = t46 : e56.w(`Layer with id "${i26}" has a different slot. Layers can only be rearranged within the same slot.`); } this._order.splice(n45, 0, s18), this._layerOrderChanged = true, this._layers[s18] = r86; const a46 = this.getOwnLayerSourceCache(r86), l21 = !!this.directionalLight && this.directionalLight.shadowsEnabled(); a46 && r86.canCastShadows() && l21 && (a46.castsShadows = true); const c28 = this._changes.getRemovedLayer(r86); if (c28 && r86.source && a46 && "custom" !== r86.type) { this._changes.discardLayerRemoval(r86); const t46 = e56.B(r86.source, r86.scope); c28.type !== r86.type ? this._changes.updateSourceCache(t46, "clear") : (this._changes.updateSourceCache(t46, "reload"), a46.pause()); } this._updateLayer(r86), r86.onAdd && r86.onAdd(this.map), r86.scope = this.scope, this.mergeLayers(); } moveLayer(t45, i26) { this._checkLoaded(); const o88 = this._checkLayer(t45); if (!o88) return; if (t45 === i26) return; const s18 = this._order.indexOf(t45); this._order.splice(s18, 1); let r86 = this._order.length; if (i26) { const t46 = this._order.indexOf(i26); if (-1 === t46) return void this.fire(new e56.y(new Error(`Layer with id "${i26}" does not exist on this map.`))); o88.slot === this._layers[i26].slot ? r86 = t46 : e56.w(`Layer with id "${i26}" has a different slot. Layers can only be rearranged within the same slot.`); } this._order.splice(r86, 0, t45), this._changes.setDirty(), this._layerOrderChanged = true, this.mergeLayers(); } removeLayer(e57) { this._checkLoaded(); const t45 = this._checkLayer(e57); if (!t45) return; t45.setEventedParent(null); const i26 = this._order.indexOf(e57); this._order.splice(i26, 1), delete this._layers[e57], this._changes.setDirty(), this._layerOrderChanged = true, this._configDependentLayers.delete(t45.fqid), this._changes.removeLayer(t45); const o88 = this.getOwnLayerSourceCache(t45); if (o88 && o88.castsShadows) { let e58 = false; for (const i27 in this._layers) if (this._layers[i27].source === t45.source && this._layers[i27].canCastShadows()) { e58 = true; break; } o88.castsShadows = e58; } t45.onRemove && t45.onRemove(this.map), this.mergeLayers(); } getOwnLayer(e57) { return this._layers[e57]; } hasLayer(e57) { return e57 in this._mergedLayers; } hasLayerType(e57) { for (const t45 in this._layers) if (this._layers[t45].type === e57) return true; return false; } setLayerZoomRange(e57, t45, i26) { this._checkLoaded(); const o88 = this._checkLayer(e57); o88 && (o88.minzoom === t45 && o88.maxzoom === i26 || (null != t45 && (o88.minzoom = t45), null != i26 && (o88.maxzoom = i26), this._updateLayer(o88))); } getSlots() { return this._checkLoaded(), this._mergedSlots; } setSlot(e57, t45) { this._checkLoaded(); const i26 = this._checkLayer(e57); i26 && i26.slot !== t45 && (i26.slot = t45, this._updateLayer(i26)); } setFilter(t45, i26, o88 = {}) { this._checkLoaded(); const s18 = this._checkLayer(t45); if (s18 && !e56.by(s18.filter, i26)) return null == i26 ? (s18.filter = void 0, void this._updateLayer(s18)) : void (this._validate(Ie, `layers.${s18.id}.filter`, i26, { layerType: s18.type }, o88) || (s18.filter = e56.dk(i26), this._updateLayer(s18))); } getFilter(t45) { const i26 = this._checkLayer(t45); if (i26) return e56.dk(i26.filter); } setLayoutProperty(t45, i26, o88, s18 = {}) { this._checkLoaded(); const r86 = this._checkLayer(t45); if (r86 && !e56.by(r86.getLayoutProperty(i26), o88)) { if (null != o88 && (!s18 || false !== s18.validate) && go(r86, Re2.call(ge, { key: `layers.${t45}.layout.${i26}`, layerType: r86.type, objectKey: i26, value: o88, styleSpec: e56.a6, style: { glyphs: true, sprite: true } }))) return; r86.setLayoutProperty(i26, o88), 0 !== r86.configDependencies.size && this._configDependentLayers.add(r86.fqid), this._updateLayer(r86); } } getLayoutProperty(e57, t45) { const i26 = this._checkLayer(e57); if (i26) return i26.getLayoutProperty(t45); } setPaintProperty(t45, i26, o88, s18 = {}) { this._checkLoaded(); const r86 = this._checkLayer(t45); if (!r86) return; if (e56.by(r86.getPaintProperty(i26), o88)) return; if (null != o88 && (!s18 || false !== s18.validate) && go(r86, Ce.call(ge, { key: `layers.${t45}.paint.${i26}`, layerType: r86.type, objectKey: i26, value: o88, styleSpec: e56.a6 }))) return; const n45 = r86.setPaintProperty(i26, o88); 0 !== r86.configDependencies.size && this._configDependentLayers.add(r86.fqid), n45 && this._updateLayer(r86), this._changes.updatePaintProperties(r86); } getPaintProperty(e57, t45) { const i26 = this._checkLayer(e57); if (i26) return i26.getPaintProperty(t45); } setFeatureState(t45, i26) { if (this._checkLoaded(), "target" in t45) { if ("featuresetId" in t45.target) { const { featuresetId: e57, importId: o89 } = t45.target, s19 = this.getFragmentStyle(o89), r87 = s19.getFeaturesetLayers(e57); for (const { source: e58, sourceLayer: o90 } of r87) s19.setFeatureState({ id: t45.id, source: e58, sourceLayer: o90 }, i26); } else if ("layerId" in t45.target) { const { layerId: e57 } = t45.target, o89 = this.getLayer(e57); this.setFeatureState({ id: t45.id, source: o89.source, sourceLayer: o89.sourceLayer }, i26); } return; } const o88 = t45.source, s18 = t45.sourceLayer, r86 = this._checkSource(o88); if (!r86) return; const n45 = r86.type; if ("geojson" === n45 && s18) return void this.fire(new e56.y(new Error("GeoJSON sources cannot have a sourceLayer parameter."))); if ("vector" === n45 && !s18) return void this.fire(new e56.y(new Error("The sourceLayer parameter must be provided for vector source types."))); void 0 === t45.id && this.fire(new e56.y(new Error("The feature id parameter must be provided."))); const a46 = this.getOwnSourceCaches(o88); for (const e57 of a46) e57.setFeatureState(s18, t45.id, i26); } removeFeatureState(t45, i26) { if (this._checkLoaded(), "target" in t45) { if ("featuresetId" in t45.target) { const { featuresetId: e57, importId: o89 } = t45.target, s19 = this.getFragmentStyle(o89), r87 = s19.getFeaturesetLayers(e57); for (const { source: e58, sourceLayer: o90 } of r87) s19.removeFeatureState({ id: t45.id, source: e58, sourceLayer: o90 }, i26); } else if ("layerId" in t45.target) { const { layerId: e57 } = t45.target, o89 = this.getLayer(e57); this.removeFeatureState({ id: t45.id, source: o89.source, sourceLayer: o89.sourceLayer }, i26); } return; } const o88 = t45.source, s18 = this._checkSource(o88); if (!s18) return; const r86 = s18.type, n45 = "vector" === r86 ? t45.sourceLayer : void 0; if ("vector" === r86 && !n45) return void this.fire(new e56.y(new Error("The sourceLayer parameter must be provided for vector source types."))); if (i26 && "string" != typeof t45.id && "number" != typeof t45.id) return void this.fire(new e56.y(new Error("A feature id is required to remove its specific state property."))); const a46 = this.getOwnSourceCaches(o88); for (const e57 of a46) e57.removeFeatureState(n45, t45.id, i26); } getFeatureState(t45) { if (this._checkLoaded(), "target" in t45) { let i27; if ("featuresetId" in t45.target) { const { featuresetId: o89, importId: s19 } = t45.target, r86 = this.getFragmentStyle(s19), n45 = r86.getFeaturesetLayers(o89); for (const { source: o90, sourceLayer: s20 } of n45) { const n46 = r86.getFeatureState({ id: t45.id, source: o90, sourceLayer: s20 }); if (n46 && !i27) i27 = n46; else if (!e56.by(i27, n46)) return void this.fire(new e56.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources."))); } } else if ("layerId" in t45.target) { const { layerId: e57 } = t45.target, o89 = this.getLayer(e57); i27 = this.getFeatureState({ id: t45.id, source: o89.source, sourceLayer: o89.sourceLayer }); } return i27; } const i26 = t45.source, o88 = t45.sourceLayer, s18 = this._checkSource(i26); if (s18) { if ("vector" !== s18.type || o88) return void 0 === t45.id && this.fire(new e56.y(new Error("The feature id parameter must be provided."))), this.getOwnSourceCaches(i26)[0].getFeatureState(o88, t45.id); this.fire(new e56.y(new Error("The sourceLayer parameter must be provided for vector source types."))); } } setTransition(e57) { return this.stylesheet.transition = Object.assign({}, this.stylesheet.transition, e57), this.transition = this.stylesheet.transition, this; } getTransition() { return Object.assign({}, this.stylesheet.transition); } serialize() { this._checkLoaded(); const t45 = this.getTerrain(), i26 = t45 && this.terrain && this.terrain.scope === this.scope ? t45 : this.stylesheet.terrain; return e56.dr({ version: this.stylesheet.version, name: this.stylesheet.name, metadata: this.stylesheet.metadata, fragment: this.stylesheet.fragment, iconsets: this.stylesheet.iconsets, imports: this._serializeImports(), schema: this.stylesheet.schema, camera: this.stylesheet.camera, light: this.stylesheet.light, lights: this.stylesheet.lights, terrain: i26, fog: this.stylesheet.fog, snow: this.stylesheet.snow, rain: this.stylesheet.rain, center: this.stylesheet.center, "color-theme": this.stylesheet["color-theme"], 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: this._serializeSources(), layers: this._serializeLayers(this._order) }, ((e57) => void 0 !== e57)); } _updateFilteredLayers(e57) { for (const t45 of Object.values(this._mergedLayers)) e57(t45) && this._updateLayer(t45); } _updateLayer(t45) { this._changes.updateLayer(t45); const i26 = this.getLayerSourceCache(t45), o88 = e56.B(t45.source, t45.scope), s18 = this._changes.getUpdatedSourceCaches(); t45.source && !s18[o88] && i26 && "raster" !== i26.getSource().type && (this._changes.updateSourceCache(o88, "reload"), i26.pause()), t45.invalidateCompiledFilter(); } _flattenAndSortRenderedFeatures(e57) { const t45 = (e58) => this._mergedLayers[e58].is3D(!!this.terrain), i26 = this.order, o88 = {}, s18 = []; for (let r87 = i26.length - 1; r87 >= 0; r87--) { const n45 = i26[r87]; if (t45(n45)) { o88[n45] = r87; for (const t46 of e57) { const e58 = t46[n45]; if (e58) for (const t47 of e58) s18.push(t47); } } } s18.sort(((e58, t46) => t46.intersectionZ - e58.intersectionZ)); const r86 = []; for (let n45 = i26.length - 1; n45 >= 0; n45--) { const a46 = i26[n45]; if (t45(a46)) for (let e58 = s18.length - 1; e58 >= 0; e58--) { const t46 = s18[e58].feature; if (t46.layer && o88[t46.layer.id] < n45) break; r86.push(t46), s18.pop(); } else for (const t46 of e57) { const e58 = t46[a46]; if (e58) for (const t47 of e58) r86.push(t47.feature); } } return r86; } queryRasterValue(t45, i26, o88) { const s18 = this.getOwnSource(t45); return s18 ? "raster-array" !== s18.type ? (this.fire(new e56.y(new Error('queryRasterValue support only "raster-array" sources.'))), Promise.resolve(null)) : s18.queryRasterArrayValue(i26, o88) : (this.fire(new e56.y(new Error(`Source with id "${t45}" does not exist in the style.`))), Promise.resolve(null)); } queryRenderedFeatures(t45, i26, o88) { let s18; i26 && !Array.isArray(i26) && i26.filter && (this._validate(Ie, "queryRenderedFeatures.filter", i26.filter, null, i26), s18 = e56.b6(i26.filter)); const r86 = {}, n45 = (e57) => { if (xo.has(e57.type)) return; const t46 = this.getOwnLayerSourceCache(e57), i27 = r86[t46.id] = r86[t46.id] || { sourceCache: t46, layers: {}, has3DLayers: false }; e57.is3D(!!this.terrain) && (i27.has3DLayers = true), i27.layers[e57.fqid] = i27.layers[e57.fqid] || { styleLayer: e57, targets: [] }, i27.layers[e57.fqid].targets.push({ filter: s18 }); }; if (i26 && i26.layers) { if (!Array.isArray(i26.layers)) return this.fire(new e56.y(new Error("parameters.layers must be an Array."))), []; for (const t46 of i26.layers) { const i27 = this._layers[t46]; if (!i27) return this.fire(new e56.y(new Error(`The layer '${t46}' does not exist in the map's style and cannot be queried for features.`))), []; n45(i27); } } else for (const e57 in this._layers) n45(this._layers[e57]); const a46 = this._queryRenderedFeatures(t45, r86, o88), l21 = this._flattenAndSortRenderedFeatures(a46), c28 = []; for (const t46 of l21) e56.ds(t46.layer.id) === this.scope && c28.push(t46); return c28; } queryRenderedFeatureset(t45, i26, o88) { let s18; i26 && !Array.isArray(i26) && i26.filter && (this._validate(Ie, "queryRenderedFeatures.filter", i26.filter, null, i26), s18 = e56.b6(i26.filter)); const r86 = "mock", n45 = []; if (i26 && i26.target) n45.push(Object.assign({}, i26, { targetId: r86, filter: s18 })); else { const e57 = this.getFeaturesetDescriptors(); for (const t46 of e57) n45.push({ targetId: r86, filter: s18, target: t46 }); for (const { style: e58 } of this.fragments) { const t46 = e58.getFeaturesetDescriptors(); for (const e59 of t46) n45.push({ targetId: r86, filter: s18, target: e59 }); } } const a46 = this.queryRenderedTargets(t45, n45, o88), l21 = [], c28 = /* @__PURE__ */ new Set(); for (const t46 of a46) for (const i27 of t46.variants[r86]) ht2(i27, t46, c28) || l21.push(new e56.dt(t46, i27)); return l21; } queryRenderedTargets(t45, i26, o88) { const s18 = {}, r86 = (e57, t46, i27, o89) => { const r87 = s18[t46.id] = s18[t46.id] || { sourceCache: t46, layers: {}, has3DLayers: false }; if (r87.layers[e57.fqid] = r87.layers[e57.fqid] || { styleLayer: e57, targets: [] }, e57.is3D(!!this.terrain) && (r87.has3DLayers = true), !o89) return i27.uniqueFeatureID = false, void r87.layers[e57.fqid].targets.push(i27); r87.layers[e57.fqid].targets.push(Object.assign({}, i27, { namespace: o89.namespace, properties: o89.properties, uniqueFeatureID: o89.uniqueFeatureID })); }; for (const t46 of i26) if ("featuresetId" in t46.target) { const { featuresetId: i27, importId: o89 } = t46.target, s19 = this.getFragmentStyle(o89); if (!s19 || !s19._featuresetSelectors) continue; const n46 = s19._featuresetSelectors[i27]; if (!n46) { this.fire(new e56.y(new Error(`The featureset '${i27}' does not exist in the map's style and cannot be queried for features.`))); continue; } for (const e57 of n46) { const i28 = s19.getOwnLayer(e57.layerId); i28 && !xo.has(i28.type) && r86(i28, s19.getOwnLayerSourceCache(i28), t46, e57); } } else if ("layerId" in t46.target) { const { layerId: e57 } = t46.target, i27 = this.getLayer(e57); if (!i27 || xo.has(i27.type)) continue; r86(i27, this.getLayerSourceCache(i27), t46); } const n45 = this._queryRenderedFeatures(t45, s18, o88); return this._flattenAndSortRenderedFeatures(n45); } _queryRenderedFeatures(e57, t45, i26) { const o88 = [], s18 = !!this.map._showQueryGeometry, r86 = Ye.createFromScreenPoints(e57, i26); for (const e58 in t45) { const n45 = dt3(r86, t45[e58], this._availableImages, i26, s18); Object.keys(n45).length && o88.push(n45); } if (this.placement) for (const e58 in t45) { if (!t45[e58].sourceCache._onlySymbols) continue; const i27 = ut2(r86.screenGeometry, t45[e58], this._availableImages, this.placement.collisionIndex, this.placement.retainedQueryData, this.map.getWorldview()); Object.keys(i27).length && o88.push(i27); } return o88; } querySourceFeatures(e57, t45) { const i26 = t45 && t45.filter; i26 && this._validate(Ie, "querySourceFeatures.filter", i26, null, t45); let o88 = []; const s18 = this.getOwnSourceCaches(e57); for (const e58 of s18) o88 = o88.concat(_t(e58, t45)); return o88; } addSourceType(e57, t45, i26) { return To.getSourceType(e57) ? i26(new Error(`A source type called "${e57}" already exists.`)) : (To.setSourceType(e57, t45), t45.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", { name: e57, url: t45.workerSourceURL }, i26) : i26(null, null)); } getFlatLight() { return this.light.getLight(); } setFlatLight(t45, i26, o88 = {}) { this._checkLoaded(); const s18 = this.light.getLight(); let r86 = false; for (const i27 in t45) if (!e56.by(t45[i27], s18[i27])) { r86 = true; break; } if (!r86) return; const n45 = this._getTransitionParameters(); this.light.setLight(t45, i26, o88), this.light.updateTransitions(n45); } getTerrain() { return this.terrain && 1 === this.terrain.drapeRenderMode ? this.terrain.get() : null; } setTerrainForDraping() { this.setTerrain({ source: "", exaggeration: 0 }, 0); } checkCanvasFingerprintNoise() { void 0 === this.disableElevatedTerrain && (this.disableElevatedTerrain = e56.o.hasCanvasFingerprintNoise(), this.disableElevatedTerrain && e56.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode).")); } setTerrain(t45, i26 = 1) { if (this._checkLoaded(), !t45) return this.terrainSetForDrapingOnly() || (delete this.terrain, this.map.transform.projection.requiresDraping && this.setTerrainForDraping()), 0 === i26 && delete this.terrain, null === t45 ? this.stylesheet.terrain = null : delete this.stylesheet.terrain, this._force3DLayerUpdate(), void (this._markersNeedUpdate = true); this.checkCanvasFingerprintNoise(); let o88 = t45; const s18 = null == t45.source; if (1 === i26) { if (this.disableElevatedTerrain) return; if ("object" == typeof o88.source) { const t47 = "terrain-dem-src"; this.addSource(t47, o88.source), o88 = e56.dk(o88), o88 = Object.assign(o88, { source: t47 }); } const t46 = Object.assign({}, o88), i27 = {}; if (this.terrain && s18) { t46.source = this.terrain.get().source; const e57 = this.terrain ? this.getFragmentStyle(this.terrain.scope) : null; e57 && (i27.style = e57.serialize()); } if (this._validate(be2, "terrain", t46, i27)) return; } if (!this.terrain || this.terrain.scope !== this.scope && !s18 || this.terrain && i26 !== this.terrain.drapeRenderMode) { if (!o88) return; this._createTerrain(o88, i26), this.fire(new e56.z("data", { dataType: "style" })); } else { const i27 = this.terrain, s19 = i27.get(); for (const t46 of Object.keys(e56.a6.terrain)) !o88.hasOwnProperty(t46) && e56.a6.terrain[t46].default && (o88[t46] = e56.a6.terrain[t46].default); for (const o89 in t45) if (!e56.by(t45[o89], s19[o89])) { i27.set(t45, this.options), this.stylesheet.terrain = t45; const o90 = this._getTransitionParameters({ duration: 0 }); i27.updateTransitions(o90), this.fire(new e56.z("data", { dataType: "style" })); break; } } this.mergeTerrain(), this.updateDrapeFirstLayers(), this._markersNeedUpdate = true; } _createFog(e57) { const t45 = this.fog = new Ve(e57, this.map.transform, this.scope, this.options); this.stylesheet.fog = t45.get(); const i26 = this._getTransitionParameters({ duration: 0 }); t45.updateTransitions(i26); } _createSnow(e57) { const t45 = this.snow = new We(e57, this.map.transform, this.scope, this.options); this.stylesheet.snow = t45.get(); const i26 = this._getTransitionParameters({ duration: 0 }); t45.updateTransitions(i26); } _createRain(e57) { const t45 = this.rain = new $e(e57, this.map.transform, this.scope, this.options); this.stylesheet.rain = t45.get(); const i26 = this._getTransitionParameters({ duration: 0 }); t45.updateTransitions(i26); } _updateMarkersOpacity() { 0 !== this.map._markers.length && this.map._requestDomTask((() => { for (const e57 of this.map._markers) e57._evaluateOpacity(); })); } getFog() { return this.fog ? this.fog.get() : null; } setFog(t45) { if (this._checkLoaded(), !t45) return delete this.fog, delete this.stylesheet.fog, void (this._markersNeedUpdate = true); if (this.fog) { const i26 = this.fog; if (!e56.by(i26.get(), t45)) { i26.set(t45, this.options), this.stylesheet.fog = i26.get(); const e57 = this._getTransitionParameters({ duration: 0 }); i26.updateTransitions(e57); } } else this._createFog(t45); this._markersNeedUpdate = true; } getSnow() { return this.snow ? this.snow.get() : null; } setSnow(t45) { if (this._checkLoaded(), !t45) return delete this.snow, void delete this.stylesheet.snow; if (this.snow) { const i26 = this.snow; if (!e56.by(i26.get(), t45)) { i26.set(t45, this.options), this.stylesheet.snow = i26.get(); const e57 = this._getTransitionParameters({ duration: 0 }); i26.updateTransitions(e57); } } else this._createSnow(t45); this._markersNeedUpdate = true; } getRain() { return this.rain ? this.rain.get() : null; } setRain(t45) { if (this._checkLoaded(), !t45) return delete this.rain, void delete this.stylesheet.rain; if (this.rain) { const i26 = this.rain; if (!e56.by(i26.get(), t45)) { i26.set(t45, this.options), this.stylesheet.rain = i26.get(); const e57 = this._getTransitionParameters({ duration: 0 }); i26.updateTransitions(e57); } } else this._createRain(t45); this._markersNeedUpdate = true; } _reloadColorTheme() { const t45 = () => { for (const e57 in this._layers) this._layers[e57].lut = this._styleColorTheme.lut; for (const e57 in this._sourceCaches) this._sourceCaches[e57].clearTiles(); }, i26 = this._styleColorTheme.colorThemeOverride ? this._styleColorTheme.colorThemeOverride : this._styleColorTheme.colorTheme; if (!i26) return this._styleColorTheme.lut = null, void t45(); const o88 = this._evaluateColorThemeData(i26); this._loadColorTheme(o88).then((() => { this.fire(new e56.z("colorthemeset")), t45(); })).catch(((t46) => { e56.w(`Couldn't set color theme: ${t46}`); })); } setColorTheme(t45) { this._checkLoaded(), this._styleColorTheme.colorThemeOverride && e56.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."), this._styleColorTheme.colorTheme = t45, this._reloadColorTheme(); } setImportColorTheme(e57, t45) { const i26 = this.getFragmentStyle(e57); i26 && (i26._styleColorTheme.colorThemeOverride = t45, i26._reloadColorTheme()); } _getTransitionParameters(t45) { return { now: e56.o.now(), transition: Object.assign(this.transition, t45) }; } updateDrapeFirstLayers() { if (!this.terrain) return; const e57 = [], t45 = []; for (const i26 of this._mergedOrder) this.isLayerDraped(this._mergedLayers[i26]) ? e57.push(i26) : t45.push(i26); this._drapedFirstOrder = [], this._drapedFirstOrder.push(...e57), this._drapedFirstOrder.push(...t45); } _createTerrain(e57, t45) { const i26 = this.terrain = new Oe(e57, t45, this.scope, this.options, this.map.getWorldview()); 1 === t45 && (this.stylesheet.terrain = e57), this.mergeTerrain(), this.updateDrapeFirstLayers(), this._force3DLayerUpdate(); const o88 = this._getTransitionParameters({ duration: 0 }); i26.updateTransitions(o88); } _force3DLayerUpdate() { for (const e57 in this._layers) { const t45 = this._layers[e57]; "fill-extrusion" === t45.type && this._updateLayer(t45); } } _forceSymbolLayerUpdate() { for (const e57 in this._layers) { const t45 = this._layers[e57]; "symbol" === t45.type && this._updateLayer(t45); } } _validate(t45, i26, o88, s18, r86 = {}) { if (r86 && false === r86.validate) return false; const n45 = Object.assign({}, this.serialize()); return go(this, t45.call(ge, Object.assign({ key: i26, style: n45, value: o88, styleSpec: e56.a6 }, s18))); } _remove() { this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.cancel(), this._spriteRequest = null), e56.du.off("pluginStateChange", this._rtlTextPluginCallback); for (const e57 in this._mergedLayers) this._mergedLayers[e57].setEventedParent(null); for (const e57 in this._mergedSourceCaches) this._mergedSourceCaches[e57].clearTiles(), this._mergedSourceCaches[e57].setEventedParent(null); this.imageManager.removeScope(this.scope), this.setEventedParent(null), delete this.fog, delete this.snow, delete this.rain, delete this.terrain, delete this.ambientLight, delete this.directionalLight, this.isRootStyle() && (this.imageManager.setEventedParent(null), this.imageManager.destroy(), this.modelManager.setEventedParent(null), this.modelManager.destroy(), this.dispatcher.remove()); } clearSource(e57) { const t45 = this.getSourceCaches(e57); for (const e58 of t45) e58.clearTiles(); } clearSources() { for (const e57 in this._mergedSourceCaches) this._mergedSourceCaches[e57].clearTiles(); } clearLayers() { for (const e57 in this._mergedLayers) { const t45 = this._mergedLayers[e57]; t45._clear && t45._clear(); } } reloadSource(e57) { const t45 = this.getSourceCaches(e57); for (const e58 of t45) e58.resume(), e58.reload(); } reloadSources() { for (const e57 of this.getSources()) e57.reload && e57.reload(); } reloadModels() { this.modelManager.reloadModels(""), this.forEachFragmentStyle(((e57) => { e57.modelManager.reloadModels(e57.scope); })); } updateSources(e57) { let t45; this.directionalLight && (t45 = lo(this.directionalLight)); const i26 = /* @__PURE__ */ new Set(); for (const e58 in this._mergedLayers) { const t46 = this._mergedLayers[e58]; t46.hasElevation() && !i26.has(t46.source) && i26.add(t46.source); } for (const o88 in this._mergedSourceCaches) { const s18 = this._mergedSourceCaches[o88], r86 = i26.has(s18._source.id); s18.update(e57, void 0, void 0, t45, r86); } } _generateCollisionBoxes() { for (const e57 in this._sourceCaches) { const t45 = this._sourceCaches[e57]; t45.resume(), t45.reload(); } } _updatePlacement(t45, i26, o88, s18, r86, n45, a46 = false) { let l21 = false, c28 = false; const h8 = {}, d34 = {}; for (const t46 of this._mergedOrder) { const o89 = this._mergedLayers[t46]; if ("symbol" !== o89.type) continue; const s19 = e56.B(o89.source, o89.scope); let r87 = h8[s19]; if (!r87) { const e57 = this.getLayerSourceCache(o89); if (!e57) continue; const t47 = e57.getRenderableIds(true).map(((t48) => e57.getTileByID(t48))); d34[s19] = t47.slice(), r87 = h8[s19] = t47.sort(((e58, t48) => t48.tileID.overscaledZ - e58.tileID.overscaledZ || (e58.tileID.isLessThan(t48.tileID) ? -1 : 1))); } const n46 = this.crossTileSymbolIndex.addLayer(o89, r87, i26.center.lng, i26.projection); l21 = l21 || n46; } if (this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder), a46 = a46 || this._layerOrderChanged || 0 === s18, this._layerOrderChanged && this.fire(new e56.z("neworder")), (a46 || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(e56.o.now(), i26.zoom)) && (this.pauseablePlacement = new zi(i26, this._mergedOrder, a46, o88, s18, r86, this.placement, this.fog && i26.projection.supportsFog ? this.fog.state : null, this._buildingIndex), this._layerOrderChanged = false), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._mergedOrder, this._mergedLayers, h8, d34, this.map.painter.scaleFactor), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(e56.o.now()), c28 = true), l21 && this.pauseablePlacement.placement.setStale()), c28 || l21) { this._buildingIndex.onNewFrame(i26.zoom); for (let t46 = 0; t46 < this._mergedOrder.length; t46++) { const i27 = this._mergedLayers[this._mergedOrder[t46]]; if ("symbol" !== i27.type) continue; const o89 = this.isLayerClipped(i27); this.placement.updateLayerOpacities(i27, h8[e56.B(i27.source, i27.scope)], t46, o89 ? n45 : null); } } return { needsRerender: !this.pauseablePlacement.isDone() || this.placement.hasTransitions(e56.o.now()) }; } _releaseSymbolFadeTiles() { for (const e57 in this._sourceCaches) this._sourceCaches[e57].releaseSymbolFadeTiles(); } addImport(t45, i26) { this._checkLoaded(); const o88 = this.stylesheet.imports = this.stylesheet.imports || []; if (-1 !== o88.findIndex((({ id: e57 }) => e57 === t45.id))) return void this.fire(new e56.y(new Error(`Import with id '${t45.id}' already exists in the map's style.`))); if (!i26) return o88.push(t45), this._loadImports([t45], true); const s18 = o88.findIndex((({ id: e57 }) => e57 === i26)); return -1 === s18 && this.fire(new e56.y(new Error(`Import with id "${i26}" does not exist on this map.`))), this.stylesheet.imports = o88.slice(0, s18).concat(t45).concat(o88.slice(s18)), this._loadImports([t45], true, i26); } updateImport(t45, i26) { this._checkLoaded(); const o88 = this.stylesheet.imports || [], s18 = this.getImportIndex(t45); return -1 === s18 ? this : "string" == typeof i26 ? (this.setImportUrl(t45, i26), this) : (i26.url && i26.url !== o88[s18].url && this.setImportUrl(t45, i26.url), e56.by(i26.config, o88[s18].config) || this.setImportConfig(t45, i26.config, i26.data.schema), e56.by(i26.data, o88[s18].data) || this.setImportData(t45, i26.data), this); } moveImport(e57, t45) { this._checkLoaded(); let i26 = this.stylesheet.imports || []; const o88 = this.getImportIndex(e57); if (-1 === o88) return this; const s18 = this.getImportIndex(t45); if (-1 === s18) return this; const r86 = i26[o88], n45 = this.fragments[o88]; return i26 = i26.filter((({ id: t46 }) => t46 !== e57)), this.fragments = this.fragments.filter((({ id: t46 }) => t46 !== e57)), this.stylesheet.imports = i26.slice(0, s18).concat(r86).concat(i26.slice(s18)), this.fragments = this.fragments.slice(0, s18).concat(n45).concat(this.fragments.slice(s18)), this.mergeLayers(), this; } setImportUrl(e57, t45) { this._checkLoaded(); const i26 = this.stylesheet.imports || [], o88 = this.getImportIndex(e57); if (-1 === o88) return this; i26[o88].url = t45; const s18 = this.fragments[o88]; return s18.style = this._createFragmentStyle(i26[o88]), s18.style.on("style.import.load", (() => this.mergeAll())), s18.style.loadURL(t45), this; } setImportData(e57, t45) { this._checkLoaded(); const i26 = this.getImportIndex(e57), o88 = this.stylesheet.imports || []; return -1 === i26 ? this : t45 ? (this.fragments[i26].style.setState(t45), this._reloadImports(), this) : (delete o88[i26].data, this.setImportUrl(e57, o88[i26].url)); } setImportConfig(e57, t45, i26) { this._checkLoaded(); const o88 = this.getImportIndex(e57), s18 = this.stylesheet.imports || []; if (-1 === o88) return this; t45 ? s18[o88].config = t45 : delete s18[o88].config; const r86 = this.fragments[o88]; i26 && r86.style.stylesheet && (r86.style.stylesheet.schema = i26); const n45 = r86.style.stylesheet && r86.style.stylesheet.schema; return r86.config = t45, r86.style.updateConfig(t45, n45), this.updateConfigDependencies(), this; } removeImport(e57) { this._checkLoaded(); const t45 = this.stylesheet.imports || [], i26 = this.getImportIndex(e57); -1 !== i26 && (t45.splice(i26, 1), this.fragments[i26].style._remove(), this.fragments.splice(i26, 1), this._reloadImports()); } getImportIndex(t45) { const i26 = (this.stylesheet.imports || []).findIndex(((e57) => e57.id === t45)); return -1 === i26 && this.fire(new e56.y(new Error(`Import '${t45}' does not exist in the map's style and cannot be updated.`))), i26; } getLayer(e57) { return this._mergedLayers[e57]; } getSources() { const e57 = []; for (const t45 in this._mergedOtherSourceCaches) { const i26 = this._mergedOtherSourceCaches[t45]; i26 && e57.push(i26.getSource()); } return e57; } getSource(e57, t45) { const i26 = this.getSourceCache(e57, t45); return i26 && i26.getSource(); } getLayerSource(e57) { const t45 = this.getLayerSourceCache(e57); return t45 && t45.getSource(); } getSourceCache(t45, i26) { const o88 = e56.B(t45, i26); return this._mergedOtherSourceCaches[o88]; } getLayerSourceCache(t45) { const i26 = e56.B(t45.source, t45.scope); return "symbol" === t45.type ? this._mergedSymbolSourceCaches[i26] : this._mergedOtherSourceCaches[i26]; } getSourceCaches(e57) { if (null == e57) return Object.values(this._mergedSourceCaches); const t45 = []; return this._mergedOtherSourceCaches[e57] && t45.push(this._mergedOtherSourceCaches[e57]), this._mergedSymbolSourceCaches[e57] && t45.push(this._mergedSymbolSourceCaches[e57]), t45; } updateSourceCaches() { const e57 = this._changes.getUpdatedSourceCaches(); for (const t45 in e57) { const i26 = e57[t45]; "reload" === i26 ? this.reloadSource(t45) : "clear" === i26 && this.clearSource(t45); } } updateLayers(e57) { const t45 = this._changes.getUpdatedPaintProperties(); for (const i26 of t45) { const t46 = this.getLayer(i26); t46 && t46.updateTransitions(e57); } } getGlyphsUrl() { return this.stylesheet.glyphs; } setGlyphsUrl(e57) { this.stylesheet.glyphs = e57, this.glyphManager.setURL(e57); } getImages(t45, i26, o88) { this.imageManager.getImages(i26.images, i26.scope, o88), this._updateTilesForChangedImages(); const s18 = (t46) => { if (t46) { const o89 = i26.images.map(((t47) => e56.I.toString(t47))); t46.setDependencies(i26.tileID.key, i26.type, o89); } }, r86 = e56.B(i26.source, i26.scope); s18(this._mergedOtherSourceCaches[r86]), s18(this._mergedSymbolSourceCaches[r86]), i26.images.some(((e57) => e57.iconsetId)) && this.fire(new e56.z("data", { dataType: "style" })); } rasterizeImages(e57, t45, i26) { this.imageManager.rasterizeImages(t45, i26); } getGlyphs(e57, t45, i26) { this.glyphManager.getGlyphs(t45.stacks, i26); } getResource(t45, i26, o88) { return e56.dv(i26, o88); } getOwnSourceCache(e57) { return this._otherSourceCaches[e57]; } getOwnLayerSourceCache(e57) { return "symbol" === e57.type ? this._symbolSourceCaches[e57.source] : this._otherSourceCaches[e57.source]; } getOwnSourceCaches(e57) { const t45 = []; return this._otherSourceCaches[e57] && t45.push(this._otherSourceCaches[e57]), this._symbolSourceCaches[e57] && t45.push(this._symbolSourceCaches[e57]), t45; } _isSourceCacheLoaded(t45) { const i26 = this.getOwnSourceCaches(t45); return 0 === i26.length ? (this.fire(new e56.y(new Error(`There is no source with ID '${t45}'`))), false) : i26.every(((e57) => e57.loaded())); } has3DLayers() { return this._has3DLayers; } hasSymbolLayers() { return this._hasSymbolLayers; } hasCircleLayers() { return this._hasCircleLayers; } isLayerClipped(e57, t45) { if (!this._clipLayerPresent && "fill-extrusion" !== e57.type && "building" !== e57.type) return false; const i26 = "fill-extrusion" === e57.type && ("building" === e57.sourceLayer || "procedural_buildings" === e57.sourceLayer), o88 = "building" === e57.type; if (e57.is3D(!!this.terrain)) { if (i26 || o88 || t45 && "batched-model" === t45.type) return true; if ("model" === e57.type) return true; } else if ("symbol" === e57.type) return true; return false; } _clearWorkerCaches() { this.dispatcher.broadcast("clearCaches"); } destroy() { this._clearWorkerCaches(), this.fragments.forEach(((e57) => { e57.style._remove(); })), this.terrainSetForDrapingOnly() && (delete this.terrain, delete this.stylesheet.terrain); } } To.getSourceType = function(e57) { return at2[e57]; }, To.setSourceType = function(e57, t45) { at2[e57] = t45; }, To.registerForPluginStateChange = e56.dw; class Eo { execute(e57) { const t45 = this._makeBuildingsQueryArea(e57), i26 = this._makeFloorsQueryArea(e57), o88 = e57.queryRenderedFeatures(t45).reduce(((e58, t46) => { const i27 = t46.properties.id; return "building" !== t46.properties.type || e58.some(((e59) => e59.properties.id === i27)) || e58.push(t46), e58; }), []), s18 = e57.queryRenderedFeatures(i26).reduce(((e58, t46) => { const i27 = t46.properties.id; return "floor" !== t46.properties.type || e58.some(((e59) => e59.properties.id === i27)) || e58.push(t46), e58; }), []), r86 = [e57.getCenter().lng, e57.getCenter().lat], n45 = this._findBuildingAtCenter(r86, o88), a46 = o88.length > 0 ? o88[0] : null; return { floors: s18.map(((e58) => ({ id: e58.properties.id, name: e58.properties.name, isDefault: e58.properties.is_default, zIndex: e58.properties.z_index, connectedFloorIds: e58.properties.connected_floor_ids, conflictedFloorIds: e58.properties.conflicted_floor_ids, buildingIds: e58.properties.building_ids }))), building: n45 ? { id: n45.properties.id, name: n45.properties.name } : { id: a46.properties.id, name: a46.properties.name } }; } _makeBuildingsQueryArea(t45) { const i26 = t45.transform.width, o88 = t45.transform.height, s18 = Math.min(i26, o88) * (1 / 8), r86 = 0.5 * (i26 - s18), n45 = 0.5 * (o88 - s18); return [new e56.P(r86, n45), new e56.P(r86 + s18, n45 + s18)]; } _makeFloorsQueryArea(t45) { const i26 = t45.transform.width, o88 = t45.transform.height; return [new e56.P(0, 0), new e56.P(i26, o88)]; } _findBuildingAtCenter(e57, t45) { for (const i26 of t45) if ("Polygon" === i26.geometry.type && this._pointInPolygon(e57, i26.geometry.coordinates[0])) return i26; return null; } _pointInPolygon(e57, t45) { let i26 = false; for (let o88 = 0, s18 = t45.length - 1; o88 < t45.length; s18 = o88++) { const r86 = t45[o88][0], n45 = t45[o88][1], a46 = t45[s18][1]; n45 > e57[1] != a46 > e57[1] && e57[0] < (t45[s18][0] - r86) * (e57[1] - n45) / (a46 - n45) + r86 && (i26 = !i26); } return i26; } } class So { constructor() { this._floors = /* @__PURE__ */ new Map(), this._buildings = /* @__PURE__ */ new Map(); } append(e57) { const t45 = e57.building; let i26 = false; if (t45) { const e58 = t45.id; e58 && (this._buildings.set(e58, t45), i26 || this._buildings.has(e58) || (i26 = true)); } return e57.floors.forEach(((e58) => { const t46 = e58.id; i26 || this._floors.has(t46) || (i26 = true), this._floors.set(t46, e58); })), i26; } clear() { this._floors.clear(), this._buildings.clear(); } getFloors(e57 = null) { const t45 = Array.from(this._floors.values()); return e57 ? t45.filter(((t46) => { const i26 = t46.buildingIds; return !!i26 && i26.split(";").includes(e57); })) : t45; } } class Io { constructor() { this._selectedFloorId = null, this._selectedBuildingId = null, this._lastActiveFloors = [], this._featuresStorage = new So(); } setIndoorData(e57) { const t45 = this._featuresStorage.append(e57); return this._selectedBuildingId = e57.building ? e57.building.id : null, t45; } setFloorId(e57) { const t45 = this._selectedFloorId !== e57; return t45 && (this._selectedFloorId = e57), t45; } getCurrentBuildingSelection() { if (!this._selectedBuildingId) return { selectedFloorId: null, floors: [] }; const e57 = this._featuresStorage.getFloors(this._selectedBuildingId), t45 = this.getActiveFloors().find(((e58) => { const t46 = e58.buildingIds; if (!t46) return false; const i26 = t46.split(";"); return !!this._selectedBuildingId && i26.includes(this._selectedBuildingId); })); return { selectedFloorId: t45 ? t45.id : null, floors: e57 }; } getActiveFloors(e57 = false) { const t45 = this._featuresStorage.getFloors(), i26 = t45.find(((e58) => e58.id === this._selectedFloorId)), o88 = t45.filter(((e58) => true === e58.isDefault)); let s18 = []; if (i26) return s18 = this._calculateCurrentActiveFloors(t45, i26, o88, e57), s18; if (0 === o88.length) { const e58 = this._featuresStorage.getFloors(this._selectedBuildingId); s18 = e58.length > 0 ? [e58[0]] : []; } else s18 = o88; const r86 = this._getNonConflictingLastActiveFloors(s18), n45 = [...s18, ...r86]; return this._lastActiveFloors = n45, n45; } hasBuildingChanged(e57) { return this._selectedBuildingId !== (e57.building ? e57.building.id : null); } hasActiveBuilding() { return null !== this._selectedBuildingId; } isEmpty() { return null === this._selectedFloorId && null === this._selectedBuildingId && 0 === this._lastActiveFloors.length; } _calculateCurrentActiveFloors(e57, t45, i26, o88) { if (!t45) return this._getNonConflictingDefaultFloors(this._lastActiveFloors, i26); const s18 = this._getConnectedFloors(t45, e57); return o88 ? this._buildExplicitSelectionFloors(t45, s18, i26) : this._buildImplicitSelectionFloors(s18, i26); } _getConnectedFloors(e57, t45) { const i26 = e57.connectedFloorIds; if (!i26) return []; const o88 = new Set(i26.split(";")); return t45.filter(((e58) => o88.has(e58.id))); } _buildExplicitSelectionFloors(e57, t45, i26) { const o88 = [e57, ...t45], s18 = this._getNonConflictingLastActiveFloors(o88), r86 = [...o88, ...s18], n45 = this._deduplicateFloors(r86), a46 = this._getConflictingFloorIdsFrom(n45), l21 = i26.filter(((e58) => !a46.has(e58.id))), c28 = [...n45, ...l21]; return this._lastActiveFloors = c28, c28; } _buildImplicitSelectionFloors(e57, t45) { const i26 = this._getConflictingFloorIdsFrom(this._lastActiveFloors), o88 = t45.filter(((e58) => !i26.has(e58.id))), s18 = this._deduplicateFloors([...this._lastActiveFloors, ...o88]); return this._lastActiveFloors = s18, s18; } _getNonConflictingDefaultFloors(e57, t45) { const i26 = this._getConflictingFloorIdsFrom(e57), o88 = t45.filter(((e58) => !i26.has(e58.id))), s18 = this._deduplicateFloors([...e57, ...o88]); return this._lastActiveFloors = s18, s18; } _deduplicateFloors(e57) { const t45 = /* @__PURE__ */ new Set(); return e57.filter(((e58) => { const i26 = e58.id; return !t45.has(i26) && (t45.add(i26), true); })); } _getConflictingFloorIdsFrom(e57) { const t45 = /* @__PURE__ */ new Set(); return e57.forEach(((e58) => { const i26 = e58.conflictedFloorIds; i26 && i26.split(";").forEach(((e59) => t45.add(e59))); })), t45; } _getNonConflictingLastActiveFloors(e57) { if (!this._lastActiveFloors || 0 === this._lastActiveFloors.length) return []; const t45 = new Set(e57.map(((e58) => e58.id))), i26 = this._getConflictingFloorIdsFrom(e57); return this._lastActiveFloors.filter(((e58) => { const o88 = e58.id; return !t45.has(o88) && !i26.has(o88); })); } _isFloorConflicted(e57, t45) { const i26 = e57.id; return t45.some(((e58) => { const t46 = e58.conflictedFloorIds; return !!t46 && t46.split(";").includes(i26); })); } reset() { this._selectedFloorId = null, this._selectedBuildingId = null, this._lastActiveFloors = [], this._featuresStorage.clear(); } } class Co extends e56.E { constructor(t45) { super(), e56.aY(["_onLoad", "_onMove"], this), this._map = t45, this._floorSelectionState = new Io(), this._queryIndoor(), this._map.on("load", this._onLoad), this._map.on("move", this._onMove); } destroy() { this._map.off("load", this._onLoad), this._map.off("move", this._onMove), this._map = null, this._floorSelectionState = null; } selectFloor(e57) { this._floorSelectionState.setFloorId(e57) && this._updateIndoorConfig(true); } _onLoad() { this._map.style.forEachFragmentStyle(((t45) => { t45.stylesheet.indoor && (this._indoorDataQuery ? this.fire(new e56.y(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))) : (this._scope = t45.scope, this._indoorDataQuery = new Eo())); })), this._map._addIndoorControl(), this._queryIndoor(); } _onMove() { this._queryIndoor(); } _queryIndoor() { if (!this._indoorDataQuery || !this._map.isStyleLoaded()) return; if (this._map.transform.zoom < 15) return void this._clearIndoorData(); const e57 = this._indoorDataQuery.execute(this._map); if (!e57 || 0 === e57.floors.length || this._map.transform.zoom < 16) this._clearIndoorData(); else if (this._floorSelectionState.hasBuildingChanged(e57)) { if (!e57.building && this._floorSelectionState.getActiveFloors().length <= 0) return void this._clearIndoorData(); this._setIndoorData(e57), e57.building && this._updateIndoorSelector(); } else this._setIndoorData(e57); } _setIndoorData(e57) { this._floorSelectionState.setIndoorData(e57) && this._updateIndoorConfig(); } _clearIndoorData() { this._floorSelectionState.isEmpty() || (this._floorSelectionState.reset(), this._updateIndoorSelector(), this._map.setConfigProperty(this._scope, "activeFloors", ["literal", []])); } _updateIndoorSelector() { const t45 = this._floorSelectionState.getCurrentBuildingSelection(), i26 = t45.floors.map(((e57) => ({ id: e57.id, name: e57.name, shortName: e57.zIndex.toString(), levelOrder: e57.zIndex }))); this.fire(new e56.z("indoorupdate", { selectedFloorId: t45.selectedFloorId, floors: i26 })); } _updateIndoorConfig(e57 = false) { const t45 = this._floorSelectionState.getActiveFloors(e57).map(((e58) => e58.id)) || []; this._map.setConfigProperty(this._scope, "activeFloors", ["literal", t45]); } } var Ro = "\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif", Ao = "\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}", Do = "\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}", Lo = "in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out 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;}", Po = "\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\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;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;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 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*texture(u_dem,pos).r;\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=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;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*texture(u_dem_prev,pos).r;\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=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;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) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return 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;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; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION", zo = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif", Oo = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}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;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif", Mo = "#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif", Fo = "#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}", Bo = "#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS", ko = "#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif"; const No = []; qo(Ro, No), qo(Do, No), qo(Ao, No); const Uo = { "_prelude_fog.vertex.glsl": zo, "_prelude_terrain.vertex.glsl": Po, "_prelude_shadow.vertex.glsl": Bo, "_prelude_fog.fragment.glsl": Oo, "_prelude_shadow.fragment.glsl": ko, "_prelude_lighting.glsl": "\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE", "_prelude_raster_array.glsl": Mo, "_prelude_raster_particle.glsl": Fo }, jo = {}; Zo("", Po), Zo(Oo, zo), Zo(ko, Bo), Zo(Mo, ""), Zo(Fo, ""); const Vo = Zo(Ao, Do), Go = Ro; var Ho = { background: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), backgroundPattern: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), building: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nfloat hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;\n#if 0\nif (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;\n#else\nif (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;\n#endif\nreturn out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nshadowed_lighting_factor=dot(normal,u_lighting_directional_dir);\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor.rgb=linearTosRGB(color.rgb);color*=u_opacity;\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_pos.z);\n#endif\nglFragColor=color; \n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive\nvec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;\n#ifdef BUILDING_FAUX_FACADE\nv_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);}\n#endif\nv_pos=a_pos_3f;\n#ifdef RENDER_CUTOFF\nvec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}'), buildingBloom: Zo("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}", "in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);}"), buildingDepth: Zo("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}", "in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"), circle: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\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;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out 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);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;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: Zo("void main() {glFragColor=vec4(1.0);}", "in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), heatmap: Zo('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout 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);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=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: Zo("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}", "in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"), collisionBox: Zo("in float v_placed;in 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);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}", '#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_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: Zo("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}", "in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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: Zo("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}", '#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout 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}'), elevatedStructuresDepth: Zo("void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=vec4(0.);\n#endif\n}", "in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"), elevatedStructuresDepthReconstruct: Zo("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#ifdef FEATURE_CUTOUT\napply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord);\n#endif\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}", "in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"), elevatedStructures: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fill: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'), fillOutline: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillOutlinePattern: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillPattern: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'), fillExtrusion: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,h);\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in 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\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), fillExtrusionDepth: Zo("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}", '#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;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;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'), fillExtrusionPattern: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in 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\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.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=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'), groundShadow: Zo('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\nglFragColor=vec4(shadow,1.0);}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'), fillExtrusionGroundEffect: Zo("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}", '#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'), hillshadePrepare: Zo("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}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+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=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+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}", "uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out 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: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out 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: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin 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;uniform float u_width_scale;uniform highp float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\noffset=-1.0*offset*u_width_scale;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);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.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#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'), linePattern: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump vec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump vec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\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);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'), raster: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 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 LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'), rasterParticle: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'), rasterParticleDraw: Zo("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}", '#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'), rasterParticleTexture: Zo("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}", "in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"), rasterParticleUpdate: Zo('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}', "in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"), symbol: Zo('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\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\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'), terrainRaster: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'), terrainDepth: Zo("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}", '#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'), skybox: Zo('#include "_prelude_fog.fragment.glsl"\nin 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=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', Lo), skyboxGradient: Zo('#include "_prelude_fog.fragment.glsl"\nin 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=texture(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;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', Lo), skyboxCapture: Zo("\nin 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;precision highp float;\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;glFragColor=vec4(color,1.0);}", "in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out 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: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'), globeAtmosphere: Zo('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}', "in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"), model: Zo('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'), modelDepth: Zo("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}", "in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"), stars: Zo("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}", "\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"), snowParticle: Zo("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}", "\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"), rainParticle: Zo("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}", "\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"), vignette: Zo("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}", "in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"), occlusion: Zo("uniform vec4 u_color;void main() {glFragColor=u_color;}", '#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}') }; function qo(e57, t45) { const i26 = e57.replace(/\s*\/\/[^\n]*\n/g, "\n").split("\n"); for (let e58 of i26) if (e58 = e58.trim(), "#" === e58[0] && e58.includes("if") && !e58.includes("endif")) { e58 = e58.replace("#", "").replace(/ifdef|ifndef|elif|if/g, "").replace(/!|defined|\(|\)|\|\||&&/g, "").replace(/\s+/g, " ").trim(); const i27 = e58.split(" "); for (const e59 of i27) t45.includes(e59) || t45.push(e59); } } function Zo(e57, t45) { const i26 = /#include\s+"([^"]+)"/g, o88 = /#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g, s18 = {}, r86 = [], n45 = []; if (e57 = e57.replace(i26, ((e58, t46) => (n45.push(t46), ""))), (t45 = t45.replace(i26, ((e58, t46) => (r86.push(t46), "")))).includes("flat out")) return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071'); let a46 = [...No]; qo(e57, a46), qo(t45, a46); for (const e58 of [...r86, ...n45]) Uo[e58] || console.error(`Undefined include: ${e58}`), jo[e58] || (jo[e58] = [], qo(Uo[e58], jo[e58])), a46 = [...a46, ...jo[e58]]; return { fragmentSource: e57 = e57.replace(o88, ((e58, t46, i27, o89, r87) => (s18[r87] = true, "define" === t46 ? ` #ifndef HAS_UNIFORM_u_${r87} in ${i27} ${o89} ${r87}; #else uniform ${i27} ${o89} u_${r87}; #endif ` : "initialize" === t46 ? ` #ifdef HAS_UNIFORM_u_${r87} ${i27} ${o89} ${r87} = u_${r87}; #endif ` : "define-attribute" === t46 ? ` #ifdef HAS_ATTRIBUTE_a_${r87} in ${i27} ${o89} ${r87}; #endif ` : "initialize-attribute" === t46 ? "" : void 0))), vertexSource: t45 = t45.replace(o88, ((e58, t46, i27, o89, r87) => { const n46 = "float" === o89 ? "vec2" : o89, a47 = r87.match(/color/) ? "color" : n46; return "define-attribute-vertex-shader-only" === t46 ? ` #ifdef HAS_ATTRIBUTE_a_${r87} in ${i27} ${o89} a_${r87}; #endif ` : s18[r87] ? "define" === t46 ? ` #ifndef HAS_UNIFORM_u_${r87} uniform lowp float u_${r87}_t; in ${i27} ${n46} a_${r87}; out ${i27} ${o89} ${r87}; #else uniform ${i27} ${o89} u_${r87}; #endif ` : "initialize" === t46 ? "vec4" === a47 ? ` #ifndef HAS_UNIFORM_u_${r87} ${r87} = a_${r87}; #else ${i27} ${o89} ${r87} = u_${r87}; #endif ` : ` #ifndef HAS_UNIFORM_u_${r87} ${r87} = unpack_mix_${a47}(a_${r87}, u_${r87}_t); #else ${i27} ${o89} ${r87} = u_${r87}; #endif ` : "define-attribute" === t46 ? ` #ifdef HAS_ATTRIBUTE_a_${r87} in ${i27} ${o89} a_${r87}; out ${i27} ${o89} ${r87}; #endif ` : "initialize-attribute" === t46 ? ` #ifdef HAS_ATTRIBUTE_a_${r87} ${r87} = a_${r87}; #endif ` : void 0 : "define" === t46 ? ` #ifndef HAS_UNIFORM_u_${r87} uniform lowp float u_${r87}_t; in ${i27} ${n46} a_${r87}; #else uniform ${i27} ${o89} u_${r87}; #endif ` : "define-instanced" === t46 ? "mat4" === a47 ? ` #ifdef INSTANCED_ARRAYS in vec4 a_${r87}0; in vec4 a_${r87}1; in vec4 a_${r87}2; in vec4 a_${r87}3; #else uniform ${i27} ${o89} u_${r87}; #endif ` : ` #ifdef INSTANCED_ARRAYS in ${i27} ${n46} a_${r87}; #else uniform ${i27} ${o89} u_${r87}; #endif ` : "initialize-attribute-custom" === t46 ? ` #ifdef HAS_ATTRIBUTE_a_${r87} ${i27} ${o89} ${r87} = a_${r87}; #endif ` : "vec4" === a47 ? ` #ifndef HAS_UNIFORM_u_${r87} ${i27} ${o89} ${r87} = a_${r87}; #else ${i27} ${o89} ${r87} = u_${r87}; #endif ` : ` #ifndef HAS_UNIFORM_u_${r87} ${i27} ${o89} ${r87} = unpack_mix_${a47}(a_${r87}, u_${r87}_t); #else ${i27} ${o89} ${r87} = u_${r87}; #endif `; })), usedDefines: a46, vertexIncludes: r86, fragmentIncludes: n45 }; } class Wo { constructor() { this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffers = [], this.vao = null; } bind(e57, t45, i26, o88, s18, r86, n45, a46) { this.context = e57; let l21 = this.boundPaintVertexBuffers.length !== o88.length; for (let e58 = 0; !l21 && e58 < o88.length; e58++) this.boundPaintVertexBuffers[e58] !== o88[e58] && (l21 = true); let c28 = this.boundDynamicVertexBuffers.length !== n45.length; for (let e58 = 0; !c28 && e58 < n45.length; e58++) this.boundDynamicVertexBuffers[e58] !== n45[e58] && (c28 = true); if (!this.vao || this.boundProgram !== t45 || this.boundLayoutVertexBuffer !== i26 || l21 || c28 || this.boundIndexBuffer !== s18 || this.boundVertexOffset !== r86) this.freshBind(t45, i26, o88, s18, r86, n45, a46); else { e57.bindVertexArrayOES.set(this.vao); for (const i27 of n45) i27 && (i27.bind(), a46 && i27.instanceCount && i27.setVertexAttribDivisor(e57.gl, t45, a46)); s18 && s18.dynamicDraw && s18.bind(); } } freshBind(e57, t45, i26, o88, s18, r86, n45) { const a46 = this.context, l21 = a46.gl; this.vao && this.destroy(), this.vao = a46.gl.createVertexArray(), a46.bindVertexArrayOES.set(this.vao), this.boundProgram = e57, this.boundLayoutVertexBuffer = t45, this.boundPaintVertexBuffers = i26, this.boundIndexBuffer = o88, this.boundVertexOffset = s18, this.boundDynamicVertexBuffers = r86, t45.enableAttributes(l21, e57), t45.bind(), t45.setVertexAttribPointers(l21, e57, s18); for (const t46 of i26) t46.enableAttributes(l21, e57), t46.bind(), t46.setVertexAttribPointers(l21, e57, s18); for (const t46 of r86) t46 && (t46.enableAttributes(l21, e57), t46.bind(), t46.setVertexAttribPointers(l21, e57, s18), n45 && t46.instanceCount && t46.setVertexAttribDivisor(l21, e57, n45)); o88 && o88.bind(); } destroy() { this.vao && (this.context.gl.deleteVertexArray(this.vao), this.vao = null); } } function $o(t45, i26) { const o88 = Math.pow(2, i26.canonical.z), s18 = i26.canonical.y; return [new e56.ae(0, s18 / o88).toLngLat().lat, new e56.ae(0, (s18 + 1) / o88).toLngLat().lat]; } function Xo(t45, i26, o88, s18, r86, n45, a46) { const l21 = t45.context, c28 = l21.gl, h8 = o88.hillshadeFBO; if (!h8) return; t45.prepareDrawTile(); const d34 = t45.isTileAffectedByFog(i26), u12 = t45.getOrCreateProgram("hillshade", { overrideFog: d34 }); l21.activeTexture.set(c28.TEXTURE0), c28.bindTexture(c28.TEXTURE_2D, h8.colorAttachment.get()); const _4 = ((t46, i27, o89, s19) => { const r87 = o89.paint.get("hillshade-shadow-color"), n46 = "none" === o89.paint.get("hillshade-shadow-color-use-theme").constantOr("default"), a47 = o89.paint.get("hillshade-highlight-color"), l22 = "none" === o89.paint.get("hillshade-highlight-color-use-theme").constantOr("default"), c29 = o89.paint.get("hillshade-accent-color"), h9 = "none" === o89.paint.get("hillshade-accent-color-use-theme").constantOr("default"), d35 = o89.paint.get("hillshade-emissive-strength"); let u13 = e56.an(o89.paint.get("hillshade-illumination-direction")); if ("viewport" === o89.paint.get("hillshade-illumination-anchor")) u13 -= t46.transform.angle; else if (t46.style && t46.style.enable3dLights() && t46.style.directionalLight) { const i28 = t46.style.directionalLight.properties.get("direction"), o90 = e56.d3(i28.x, i28.y, i28.z); u13 = e56.an(o90[1]); } const _5 = !t46.options.moving; return { u_matrix: s19 || t46.transform.calculateProjMatrix(i27.tileID.toUnwrapped(), _5), u_image: 0, u_latrange: $o(0, i27.tileID), u_light: [o89.paint.get("hillshade-exaggeration"), u13], u_shadow: r87.toPremultipliedRenderColor(n46 ? null : o89.lut), u_highlight: a47.toPremultipliedRenderColor(l22 ? null : o89.lut), u_emissive_strength: d35, u_accent: c29.toPremultipliedRenderColor(h9 ? null : o89.lut) }; })(t45, o88, s18, t45.terrain ? i26.projMatrix : null); t45.uploadCommonUniforms(l21, u12, i26.toUnwrapped()); const { tileBoundsBuffer: p9, tileBoundsIndexBuffer: f8, tileBoundsSegments: m6 } = t45.getTileBoundsBuffers(o88); u12.draw(t45, c28.TRIANGLES, r86, n45, a46, Zi.disabled, _4, s18.id, p9, f8, m6); } function Yo(t45, i26, o88) { if (!i26.needsDEMTextureUpload) return; const s18 = t45.context, r86 = s18.gl; s18.pixelStoreUnpackPremultiplyAlpha.set(false), i26.demTexture = i26.demTexture || t45.getTileTexture(o88.stride); const n45 = o88.getPixels(); i26.demTexture ? i26.demTexture.update(n45, { premultiply: false }) : i26.demTexture = new e56.T(s18, n45, r86.R32F, { premultiply: false }), i26.needsDEMTextureUpload = false; } function Ko(t45, i26, o88) { const s18 = t45.context, r86 = s18.gl; if (!i26.dem) return; const n45 = i26.dem; if (s18.activeTexture.set(r86.TEXTURE1), Yo(t45, i26, n45), !i26.demTexture) return; i26.demTexture.bind(r86.NEAREST, r86.CLAMP_TO_EDGE); const a46 = n45.dim; s18.activeTexture.set(r86.TEXTURE0); let l21 = i26.hillshadeFBO; if (!l21) { const t46 = new e56.T(s18, { width: a46, height: a46, data: null }, r86.RGBA8); t46.bind(r86.LINEAR, r86.CLAMP_TO_EDGE), l21 = i26.hillshadeFBO = s18.createFramebuffer(a46, a46, true, "renderbuffer"), l21.colorAttachment.set(t46.texture); } s18.bindFramebuffer.set(l21.framebuffer), s18.viewport.set([0, 0, a46, a46]); const { tileBoundsBuffer: c28, tileBoundsIndexBuffer: h8, tileBoundsSegments: d34 } = t45.getMercatorTileBoundsBuffers(), u12 = []; t45.linearFloatFilteringSupported() && u12.push("TERRAIN_DEM_FLOAT_FORMAT"), t45.getOrCreateProgram("hillshadePrepare", { defines: u12 }).draw(t45, r86.TRIANGLES, ji.disabled, Gi.disabled, Ui.unblended, Zi.disabled, ((t46, i27) => { const o89 = i27.stride, s19 = e56.bC(); return e56.cd(s19, 0, e56.al, -e56.al, 0, 0, 1), e56.br(s19, s19, [0, -e56.al, 0]), { u_matrix: s19, u_image: 1, u_dimension: [o89, o89], u_zoom: t46.overscaledZ }; })(i26.tileID, n45), o88.id, c28, h8, d34), i26.needsHillshadePrepare = false; } class Jo { constructor(e57) { this.gl = e57.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = false; } get() { return this.current; } set(e57) { } getDefault() { return this.default; } setDefault() { this.set(this.default); } } class Qo extends Jo { getDefault() { return e56.ao.transparent.toNonPremultipliedRenderColor(null); } set(e57) { const t45 = this.current; (e57.r !== t45.r || e57.g !== t45.g || e57.b !== t45.b || e57.a !== t45.a || this.dirty) && (this.gl.clearColor(e57.r, e57.g, e57.b, e57.a), this.current = e57, this.dirty = false); } } class es extends Jo { getDefault() { return 1; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.clearDepth(e57), this.current = e57, this.dirty = false); } } class ts extends Jo { getDefault() { return 0; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.clearStencil(e57), this.current = e57, this.dirty = false); } } class is extends Jo { getDefault() { return [true, true, true, true]; } set(e57) { const t45 = this.current; (e57[0] !== t45[0] || e57[1] !== t45[1] || e57[2] !== t45[2] || e57[3] !== t45[3] || this.dirty) && (this.gl.colorMask(e57[0], e57[1], e57[2], e57[3]), this.current = e57, this.dirty = false); } } class os extends Jo { getDefault() { return true; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.depthMask(e57), this.current = e57, this.dirty = false); } } class ss extends Jo { getDefault() { return 255; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.stencilMask(e57), this.current = e57, this.dirty = false); } } class rs extends Jo { getDefault() { return { func: this.gl.ALWAYS, ref: 0, mask: 255 }; } set(e57) { const t45 = this.current; (e57.func !== t45.func || e57.ref !== t45.ref || e57.mask !== t45.mask || this.dirty) && (this.gl.stencilFunc(e57.func, e57.ref, e57.mask), this.current = e57, this.dirty = false); } } class ns extends Jo { getDefault() { const e57 = this.gl; return [e57.KEEP, e57.KEEP, e57.KEEP]; } set(e57) { const t45 = this.current; (e57[0] !== t45[0] || e57[1] !== t45[1] || e57[2] !== t45[2] || this.dirty) && (this.gl.stencilOp(e57[0], e57[1], e57[2]), this.current = e57, this.dirty = false); } } class as extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; e57 ? t45.enable(t45.STENCIL_TEST) : t45.disable(t45.STENCIL_TEST), this.current = e57, this.dirty = false; } } class ls extends Jo { getDefault() { return [0, 1]; } set(e57) { const t45 = this.current; (e57[0] !== t45[0] || e57[1] !== t45[1] || this.dirty) && (this.gl.depthRange(e57[0], e57[1]), this.current = e57, this.dirty = false); } } class cs extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; e57 ? t45.enable(t45.DEPTH_TEST) : t45.disable(t45.DEPTH_TEST), this.current = e57, this.dirty = false; } } class hs extends Jo { getDefault() { return this.gl.LESS; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.depthFunc(e57), this.current = e57, this.dirty = false); } } class ds extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; e57 ? t45.enable(t45.BLEND) : t45.disable(t45.BLEND), this.current = e57, this.dirty = false; } } class us extends Jo { getDefault() { const e57 = this.gl; return [e57.ONE, e57.ZERO, e57.ONE, e57.ZERO]; } set(e57) { const t45 = this.current; (e57[0] !== t45[0] || e57[1] !== t45[1] || e57[2] !== t45[2] || e57[3] !== t45[3] || this.dirty) && (this.gl.blendFuncSeparate(e57[0], e57[1], e57[2], e57[3]), this.current = e57, this.dirty = false); } } class _s extends Jo { getDefault() { return e56.ao.transparent.toNonPremultipliedRenderColor(null); } set(e57) { const t45 = this.current; (e57.r !== t45.r || e57.g !== t45.g || e57.b !== t45.b || e57.a !== t45.a || this.dirty) && (this.gl.blendColor(e57.r, e57.g, e57.b, e57.a), this.current = e57, this.dirty = false); } } class ps extends Jo { getDefault() { return this.gl.FUNC_ADD; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.blendEquationSeparate(e57, e57), this.current = e57, this.dirty = false); } } class fs extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; e57 ? t45.enable(t45.CULL_FACE) : t45.disable(t45.CULL_FACE), this.current = e57, this.dirty = false; } } class ms extends Jo { getDefault() { return this.gl.BACK; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.cullFace(e57), this.current = e57, this.dirty = false); } } class gs extends Jo { getDefault() { return this.gl.CCW; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.frontFace(e57), this.current = e57, this.dirty = false); } } let vs = class extends Jo { getDefault() { return null; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.useProgram(e57), this.current = e57, this.dirty = false); } }; class ys extends Jo { getDefault() { return this.gl.TEXTURE0; } set(e57) { (e57 !== this.current || this.dirty) && (this.gl.activeTexture(e57), this.current = e57, this.dirty = false); } } class xs extends Jo { getDefault() { const e57 = this.gl; return [0, 0, e57.drawingBufferWidth, e57.drawingBufferHeight]; } set(e57) { const t45 = this.current; (e57[0] !== t45[0] || e57[1] !== t45[1] || e57[2] !== t45[2] || e57[3] !== t45[3] || this.dirty) && (this.gl.viewport(e57[0], e57[1], e57[2], e57[3]), this.current = e57, this.dirty = false); } } class bs extends Jo { getDefault() { return null; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.bindFramebuffer(t45.FRAMEBUFFER, e57), this.current = e57, this.dirty = false; } } class ws extends Jo { getDefault() { return null; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.bindRenderbuffer(t45.RENDERBUFFER, e57), this.current = e57, this.dirty = false; } } class Ts extends Jo { getDefault() { return null; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.bindTexture(t45.TEXTURE_2D, e57), this.current = e57, this.dirty = false; } } class Es extends Jo { getDefault() { return null; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.bindBuffer(t45.ARRAY_BUFFER, e57), this.current = e57, this.dirty = false; } } class Ss extends Jo { getDefault() { return null; } set(e57) { const t45 = this.gl; t45.bindBuffer(t45.ELEMENT_ARRAY_BUFFER, e57), this.current = e57, this.dirty = false; } } class Is extends Jo { getDefault() { return null; } set(e57) { this.gl && (e57 !== this.current || this.dirty) && (this.gl.bindVertexArray(e57), this.current = e57, this.dirty = false); } } class Cs extends Jo { getDefault() { return 4; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.pixelStorei(t45.UNPACK_ALIGNMENT, e57), this.current = e57, this.dirty = false; } } class Rs extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.pixelStorei(t45.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e57), this.current = e57, this.dirty = false; } } class As extends Jo { getDefault() { return false; } set(e57) { if (e57 === this.current && !this.dirty) return; const t45 = this.gl; t45.pixelStorei(t45.UNPACK_FLIP_Y_WEBGL, e57), this.current = e57, this.dirty = false; } } class Ds extends Jo { constructor(e57, t45) { super(e57), this.context = e57, this.parent = t45; } getDefault() { return null; } } class Ls extends Ds { setDirty() { this.dirty = true; } set(e57) { if (e57 === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t45 = this.gl; t45.framebufferTexture2D(t45.FRAMEBUFFER, t45.COLOR_ATTACHMENT0, t45.TEXTURE_2D, e57, 0), this.current = e57, this.dirty = false; } } class Ps extends Ds { attachment() { return this.gl.DEPTH_ATTACHMENT; } set(e57) { if (e57 === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t45 = this.gl; t45.framebufferRenderbuffer(t45.FRAMEBUFFER, this.attachment(), t45.RENDERBUFFER, e57), this.current = e57, this.dirty = false; } } class zs extends Ds { attachment() { return this.gl.DEPTH_ATTACHMENT; } set(e57) { if (e57 === this.current && !this.dirty) return; this.context.bindFramebuffer.set(this.parent); const t45 = this.gl; t45.framebufferTexture2D(t45.FRAMEBUFFER, this.attachment(), t45.TEXTURE_2D, e57, 0), this.current = e57, this.dirty = false; } } class Os extends Ps { attachment() { return this.gl.DEPTH_STENCIL_ATTACHMENT; } } const Ms = (e57, t45, i26) => ({ u_matrix: e57, u_image0: 0, u_skirt_height: t45, u_ground_shadow_factor: i26 }), Fs = (e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8) => ({ u_proj_matrix: Float32Array.from(e57), u_globe_matrix: t45, u_normalize_matrix: Float32Array.from(o88), u_merc_matrix: i26, u_zoom_transition: s18, u_merc_center: r86, u_image0: 0, u_frustum_tl: n45, u_frustum_tr: a46, u_frustum_br: l21, u_frustum_bl: c28, u_globe_pos: h8, u_globe_radius: d34, u_viewport: u12, u_grid_matrix: f8 ? Float32Array.from(f8) : new Float32Array(9), u_skirt_height: _4, u_far_z_cutoff: p9 }); function Bs(e57, t45) { return null != e57 && null != t45 && !(!e57.hasData() || !t45.hasData()) && null != e57.demTexture && null != t45.demTexture && e57.tileID.key !== t45.tileID.key; } const ks = new class { constructor() { this.operations = {}; } newMorphing(e57, t45, i26, o88, s18) { if (e57 in this.operations) { const t46 = this.operations[e57]; t46.to.tileID.key !== i26.tileID.key && (t46.queued = i26); } else this.operations[e57] = { startTime: o88, phase: 0, duration: s18, from: t45, to: i26, queued: null }; } getMorphValuesForProxy(e57) { if (!(e57 in this.operations)) return null; const t45 = this.operations[e57]; return { from: t45.from, to: t45.to, phase: t45.phase }; } update(e57) { for (const t45 in this.operations) { const i26 = this.operations[t45]; for (i26.phase = (e57 - i26.startTime) / i26.duration; i26.phase >= 1 || !this._validOp(i26); ) if (!this._nextOp(i26, e57)) { delete this.operations[t45]; break; } } } _nextOp(e57, t45) { return !!e57.queued && (e57.from = e57.to, e57.to = e57.queued, e57.queued = null, e57.phase = 0, e57.startTime = t45, true); } _validOp(e57) { return e57.from.hasData() && e57.to.hasData(); } }(), Ns = { 0: null, 1: "TERRAIN_VERTEX_MORPHING" }; function Us(e57, t45, i26) { if (0 === t45) return 0; const o88 = t45 < 1 && 514 === i26 ? 0.25 / t45 : 1; return 6 * Math.pow(1.5, 22 - e57) * Math.max(t45, 1) * o88; } function js(e57, t45) { const i26 = 1 << e57.z; return !t45 && (0 === e57.x || e57.x === i26 - 1) || 0 === e57.y || e57.y === i26 - 1; } const Vs = (e57) => ({ u_matrix: e57 }); function Gs(t45, i26, o88, s18, r86) { if (r86 > 0) { const n45 = e56.o.now(), a46 = (n45 - t45.timeAdded) / r86, l21 = i26 ? (n45 - i26.timeAdded) / r86 : -1, c28 = o88.getSource(), h8 = s18.coveringZoomLevel({ tileSize: c28.tileSize, roundZoom: c28.roundZoom }), d34 = !i26 || Math.abs(i26.tileID.overscaledZ - h8) > Math.abs(t45.tileID.overscaledZ - h8), u12 = d34 && t45.refreshedUponExpiration ? 1 : e56.aA(d34 ? a46 : 1 - l21, 0, 1); return i26 ? { opacity: 1, mix: 1 - u12, isFading: a46 < 1 } : { opacity: u12, mix: 0, isFading: a46 < 1 }; } return { opacity: 1, mix: 0, isFading: false }; } class Hs extends Rt2 { constructor(e57) { const t45 = lt("mock-dem", { type: "raster-dem", maxzoom: e57.transform.maxZoom }, e57.style.dispatcher, e57.style); super("mock-dem", t45, false), t45.setEventedParent(this), this._sourceLoaded = true; } _loadTile(e57, t45) { e57.state = "loaded", t45(null); } } class qs extends Rt2 { constructor(e57) { const t45 = lt("proxy", { type: "geojson", maxzoom: e57.transform.maxZoom }, e57.style.dispatcher, e57.style); super("proxy", t45, false), t45.setEventedParent(this), this.map = this.getSource().map = e57, this.used = this._sourceLoaded = true, this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; } update(e57, t45, i26) { if (e57.freezeTileCoverage) return; this.transform = e57; const o88 = e57.coveringTiles({ tileSize: this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled }).reduce(((t46, i27) => { if (t46[i27.key] = "", !this._tiles[i27.key]) { const t47 = new Et(i27, this._source.tileSize * i27.overscaleFactor(), e57.tileZoom, void 0, void 0, this._source.worldview); t47.state = "loaded", this._tiles[i27.key] = t47; } return t46; }), {}); for (const e58 in this._tiles) e58 in o88 || (this.freeFBO(e58), this._tiles[e58].unloadVectorData(), delete this._tiles[e58]); } freeFBO(e57) { const t45 = this.proxyCachedFBO[e57]; if (void 0 !== t45) { const i26 = Object.values(t45); this.renderCachePool.push(...i26), delete this.proxyCachedFBO[e57]; } } deallocRenderCache() { this.renderCache.forEach(((e57) => e57.fb.destroy())), this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; } } class Zs extends e56.aO { constructor(e57, t45, i26) { super(e57.overscaledZ, e57.wrap, e57.canonical.z, e57.canonical.x, e57.canonical.y), this.proxyTileKey = t45, this.projMatrix = i26; } } class Ws extends e56.dH { constructor(t45, i26) { super(), this._debugParams = { sortTilesHiZFirst: true, disableRenderCache: false }, t45.tp.registerParameter(this._debugParams, ["Terrain"], "sortTilesHiZFirst", {}, (() => { this._style.map.triggerRepaint(); })), t45.tp.registerParameter(this._debugParams, ["Terrain"], "disableRenderCache", {}, (() => { this._style.map.triggerRepaint(); })), t45.tp.registerButton(["Terrain"], "Invalidate Render Cache", (() => { this.invalidateRenderCache = true, this._style.map.triggerRepaint(); })), this.painter = t45, this.terrainTileForTile = {}, this.prevTerrainTileForTile = {}; const [o88, s18, r86] = (function(t46) { const i27 = new e56.bd(), o89 = new e56.b1(), s19 = 131; i27.reserve(17161), o89.reserve(33800); const r87 = e56.al / 128, n46 = e56.al + r87 / 2, a47 = n46 + r87; for (let t47 = -r87; t47 < a47; t47 += r87) for (let o90 = -r87; o90 < a47; o90 += r87) { const s20 = o90 < 0 || o90 > n46 || t47 < 0 || t47 > n46 ? 24575 : 0, r88 = e56.aA(Math.round(o90), 0, e56.al), a48 = e56.aA(Math.round(t47), 0, e56.al); i27.emplaceBack(r88 + s20, a48); } const l21 = (e57, t47) => { const i28 = t47 * s19 + e57; o89.emplaceBack(i28 + 1, i28, i28 + s19), o89.emplaceBack(i28 + s19, i28 + s19 + 1, i28 + 1); }; for (let e57 = 1; e57 < 129; e57++) for (let t47 = 1; t47 < 129; t47++) l21(t47, e57); return [0, 129].forEach(((e57) => { for (let t47 = 0; t47 < 130; t47++) l21(t47, e57), l21(e57, t47); })), [i27, o89, 32768]; })(), n45 = t45.context; this.gridBuffer = n45.createVertexBuffer(o88, e56.bf.members), this.gridIndexBuffer = n45.createIndexBuffer(s18), this.gridSegments = e56.bg.simpleSegment(0, 0, o88.length, s18.length), this.gridNoSkirtSegments = e56.bg.simpleSegment(0, 0, o88.length, r86), this.proxyCoords = [], this.proxiedCoords = {}, this._visibleDemTiles = [], this._drapedRenderBatches = [], this._sourceTilesOverlap = {}, this.proxySourceCache = new qs(i26.map), this.orthoMatrix = e56.bC(), e56.cd(this.orthoMatrix, "globe" === this.painter.transform.projection.name ? 0.015 : 0, e56.al, 0, e56.al, 0, 1); const a46 = n45.gl; this._overlapStencilMode = new Gi({ func: a46.GEQUAL, mask: 255 }, 0, 255, a46.KEEP, a46.KEEP, a46.REPLACE), this._previousZoom = t45.transform.zoom, this.pool = [], this._findCoveringTileCache = {}, this._tilesDirty = {}, this.style = i26, this._useVertexMorphing = true, this._exaggeration = 1, this._mockSourceCache = new Hs(i26.map), this._pendingGroundEffectLayers = []; } set style(e57) { e57.on("data", this._onStyleDataEvent.bind(this)), this._style = e57, this._style.map.on("moveend", (() => { this._clearLineLayersFromRenderCache(); })); } update(t45, i26, o88) { if (t45 && t45.terrain) { this._style !== t45 && (this.style = t45, this._evaluationZoom = void 0); const s18 = t45.terrain.properties, r86 = 0 === t45.terrain.drapeRenderMode, n45 = t45.terrain.isZoomDependent(); this._previousUpdateTimestamp = this.enabled ? this._updateTimestamp : void 0, this._updateTimestamp = e56.o.now(); const a46 = t45.terrain && t45.terrain.scope, l21 = s18.get("source"), c28 = r86 ? this._mockSourceCache : t45.getSourceCache(l21, a46); if (!c28) return void e56.w(`Couldn't find terrain source "${l21}".`); if (this.sourceCache = c28, this._attenuationRange = t45.terrain.getAttenuationRange(), this._exaggeration = n45 ? this.calculateExaggeration(i26) : s18.get("exaggeration"), !i26.projection.requiresDraping && n45 && 0 === this._exaggeration) return void this._disable(); this.enabled = true; const h8 = () => { this.sourceCache.used && e56.w(`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 t46 = this.getScaledDemTileSize(); this.sourceCache.update(i26, t46, true), this.resetTileLookupCache(this.sourceCache.id); }; this.sourceCache.usedForTerrain || (this.resetTileLookupCache(this.sourceCache.id), this.sourceCache.usedForTerrain = true, h8(), this._initializing = true), h8(), i26.updateElevation(true, o88), this.resetTileLookupCache(this.proxySourceCache.id), this.proxySourceCache.update(i26), this._emptyDEMTextureDirty = true, this._previousZoom = i26.zoom; } else this._disable(); } calculateExaggeration(t45) { if (this._attenuationRange && t45.zoom >= Math.ceil(this._attenuationRange[1])) return this._style.terrain.getExaggeration(t45.zoom); const i26 = this._previousCameraAltitude, o88 = t45.getFreeCameraOptions().position.z / t45.pixelsPerMeter * t45.worldSize; this._previousCameraAltitude = o88; const s18 = null != i26 ? o88 - i26 : Number.MAX_VALUE; if (Math.abs(s18) < 2) return this._exaggeration; const r86 = t45.zoom, n45 = this._style.terrain; if (!this._previousUpdateTimestamp) return n45.getExaggeration(r86); let a46 = r86 - this._previousZoom; const l21 = this._previousUpdateTimestamp; let c28 = r86; null != this._evaluationZoom && (c28 = this._evaluationZoom, Math.abs(r86 - c28) > 0.5 && (a46 = 0.5 * (r86 - c28 + a46)), a46 * s18 < 0 && (c28 += a46)), this._evaluationZoom = c28; const h8 = n45.getExaggeration(c28), d34 = h8 === n45.getExaggeration(Math.max(0, c28 - 0.1)); if (d34 && Math.abs(h8 - this._exaggeration) < 0.01) return h8; let u12 = Math.min(0.1, 375e-5 * (this._updateTimestamp - l21)); return (d34 || h8 < 0.1 || Math.abs(a46) < 1e-4) && (u12 = Math.min(0.2, 4 * u12)), e56.ak(this._exaggeration, h8, u12); } resetTileLookupCache(e57) { this._findCoveringTileCache[e57] = {}; } attenuationRange() { return this._attenuationRange; } getDemUpscale() { return this.proxySourceCache.getSource().tileSize / 128; } getScaledDemTileSize() { return this.sourceCache.getSource().tileSize / 128 * this.proxySourceCache.getSource().tileSize; } _onStyleDataEvent(e57) { "source" === e57.dataType && e57.coord ? this._clearRenderCacheForTile(e57.sourceCacheId, e57.coord) : "style" === e57.dataType && (this.invalidateRenderCache = true, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this._previousCameraAltitude = void 0); } _disable() { if (this.enabled && (this.enabled = false, this._emptyDEMTextureDirty = true, this._sharedDepthStencil = void 0, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this.proxySourceCache.deallocRenderCache(), this._style)) for (const e57 in this._style._mergedSourceCaches) this._style._mergedSourceCaches[e57].usedForTerrain = false; } destroy() { this._disable(), this._emptyDEMTexture && this._emptyDEMTexture.destroy(), this.pool.forEach(((e57) => e57.fb.destroy())), this.pool = [], this.framebufferCopyTexture && this.framebufferCopyTexture.destroy(); } _source() { return this.enabled ? this.sourceCache : null; } isUsingMockSource() { return this.sourceCache === this._mockSourceCache; } exaggeration() { return this.enabled ? this._exaggeration : 0; } get visibleDemTiles() { return this._visibleDemTiles; } get drapeBufferSize() { const e57 = 2 * this.proxySourceCache.getSource().tileSize; return [e57, e57]; } set useVertexMorphing(e57) { this._useVertexMorphing = e57; } updateTileBinding(t45) { if (!this.enabled) return; this.prevTerrainTileForTile = this.terrainTileForTile; const i26 = this.proxySourceCache, o88 = this.painter.transform; this._initializing && (this._initializing = 0 === o88._centerAltitude && -1 === this.getAtPointOrZero(e56.ae.fromLngLat(o88.center), -1), this._emptyDEMTextureDirty = !this._initializing); const s18 = this.proxyCoords = i26.getIds().map(((e57) => { const t46 = i26.getTileByID(e57).tileID; return t46.projMatrix = o88.calculateProjMatrix(t46.toUnwrapped()), t46; })); !(function(t46, i27) { const o89 = i27.transform.pointCoordinate(i27.transform.getCameraPoint()), s19 = new e56.P(o89.x, o89.y); t46.sort(((t47, i28) => { if (i28.overscaledZ - t47.overscaledZ) return i28.overscaledZ - t47.overscaledZ; const o90 = new e56.P(t47.canonical.x + (1 << t47.canonical.z) * t47.wrap, t47.canonical.y), r87 = new e56.P(i28.canonical.x + (1 << i28.canonical.z) * i28.wrap, i28.canonical.y), n46 = s19.mult(1 << t47.canonical.z); return n46.x -= 0.5, n46.y -= 0.5, n46.distSqr(o90) - n46.distSqr(r87); })); })(s18, this.painter); const r86 = this.proxyToSource || {}; this.proxyToSource = {}, s18.forEach(((e57) => { this.proxyToSource[e57.key] = {}; })), this.terrainTileForTile = {}; const n45 = this._style._mergedSourceCaches; for (const e57 in n45) { const i27 = n45[e57]; if (!i27.used) continue; if (i27 !== this.sourceCache && this.resetTileLookupCache(i27.id), this._setupProxiedCoordsForOrtho(i27, t45[e57], r86), i27.usedForTerrain) continue; const o89 = t45[e57]; i27.getSource().reparseOverscaled && this._assignTerrainTiles(o89); } this.proxiedCoords[i26.id] = s18.map(((e57) => new Zs(e57, e57.key, this.orthoMatrix))), this._assignTerrainTiles(s18), this._prepareDEMTextures(), this._setupDrapedRenderBatches(), this._initFBOPool(), this._setupRenderCache(r86), this.renderingToTexture = false; const a46 = {}; this._visibleDemTiles = []; for (const e57 of this.proxyCoords) { const t46 = this.terrainTileForTile[e57.key]; if (!t46) continue; const i27 = t46.tileID.key; i27 in a46 || (this._visibleDemTiles.push(t46), a46[i27] = i27); } } _assignTerrainTiles(e57) { this._initializing || e57.forEach(((e58) => { if (this.terrainTileForTile[e58.key]) return; const t45 = this._findTileCoveringTileID(e58, this.sourceCache); t45 && (this.terrainTileForTile[e58.key] = t45); })); } _prepareDEMTextures() { const e57 = this.painter.context, t45 = e57.gl; for (const i26 in this.terrainTileForTile) { const o88 = this.terrainTileForTile[i26], s18 = o88.dem; !s18 || o88.demTexture && !o88.needsDEMTextureUpload || (e57.activeTexture.set(t45.TEXTURE1), Yo(this.painter, o88, s18)); } } _prepareDemTileUniforms(e57, t45, i26, o88) { if (!t45 || null == t45.demTexture) return false; const s18 = e57.tileID.canonical, r86 = Math.pow(2, t45.tileID.canonical.z - s18.z), n45 = o88 || ""; return i26[`u_dem_tl${n45}`] = [s18.x * r86 % 1, s18.y * r86 % 1], i26[`u_dem_scale${n45}`] = r86, true; } get emptyDEMTexture() { return !this._emptyDEMTextureDirty && this._emptyDEMTexture ? this._emptyDEMTexture : this._updateEmptyDEMTexture(); } _getLoadedAreaMinimum() { if (!this.enabled) return 0; let e57 = 0; const t45 = this._visibleDemTiles.reduce(((t46, i26) => { if (!i26.dem) return t46; const o88 = i26.dem.tree.minimums[0]; return o88 > 0 && e57++, t46 + o88; }), 0); return e57 ? t45 / e57 : 0; } _updateEmptyDEMTexture() { const t45 = this.painter.context, i26 = t45.gl; t45.activeTexture.set(i26.TEXTURE2); const o88 = this._getLoadedAreaMinimum(), s18 = new e56.dI({ width: 1, height: 1 }, new Float32Array([o88])); this._emptyDEMTextureDirty = false; let r86 = this._emptyDEMTexture; return r86 ? r86.update(s18, { premultiply: false }) : r86 = this._emptyDEMTexture = new e56.T(t45, s18, i26.R32F, { premultiply: false }), r86; } setupElevationDraw(t45, i26, o88) { const s18 = this.painter.context, r86 = s18.gl, n45 = { u_dem: 2, u_dem_prev: 4, 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_depth_range_unpack: [0, 1], u_occluder_half_size: 16, u_occlusion_depth_offset: -1e-4, u_exaggeration: 0 }; n45.u_exaggeration = this.exaggeration(); let a46 = null, l21 = null, c28 = 1; if (o88 && o88.morphing && this._useVertexMorphing) { const e57 = o88.morphing.srcDemTile, i27 = o88.morphing.dstDemTile; c28 = o88.morphing.phase, e57 && i27 && (this._prepareDemTileUniforms(t45, e57, n45, "_prev") && (l21 = e57), this._prepareDemTileUniforms(t45, i27, n45) && (a46 = i27)); } const h8 = (e57) => e57 && e57.demTexture && this.painter.linearFloatFilteringSupported() ? r86.LINEAR : r86.NEAREST; let d34 = null; var u12; if (this.enabled ? l21 && a46 ? (d34 = a46.demTexture, s18.activeTexture.set(r86.TEXTURE4), l21.demTexture.bind(h8(l21), r86.CLAMP_TO_EDGE), n45.u_dem_lerp = c28) : (a46 = this.terrainTileForTile[t45.tileID.key], d34 = this._prepareDemTileUniforms(t45, a46, n45) ? a46.demTexture : this.emptyDEMTexture) : d34 = this.emptyDEMTexture, s18.activeTexture.set(r86.TEXTURE2), d34 && (n45.u_dem_size = 1 === (u12 = d34).size[0] ? 1 : u12.size[0] - 2, d34.bind(h8(a46), r86.CLAMP_TO_EDGE)), this.painter.setupDepthForOcclusion(o88 && o88.useDepthForOcclusion, i26, n45), o88 && o88.useMeterToDem && a46) { const t46 = (1 << a46.tileID.canonical.z) * e56.ce(1, this.painter.transform.center.lat) * this.sourceCache.getSource().tileSize; n45.u_meter_to_dem = t46; } if (o88 && o88.labelPlaneMatrixInv && (n45.u_label_plane_matrix_inv = o88.labelPlaneMatrixInv), i26.setTerrainUniformValues(s18, n45), "globe" === this.painter.transform.projection.name) { const e57 = this.globeUniformValues(this.painter.transform, t45.tileID.canonical, o88 && o88.useDenormalizedUpVectorScale); i26.setGlobeUniformValues(s18, e57); } } globeUniformValues(t45, i26, o88) { const s18 = t45.projection; return { u_tile_tl_up: s18.upVector(i26, 0, 0), u_tile_tr_up: s18.upVector(i26, e56.al, 0), u_tile_br_up: s18.upVector(i26, e56.al, e56.al), u_tile_bl_up: s18.upVector(i26, 0, e56.al), u_tile_up_scale: o88 ? e56.dJ(1) : s18.upVectorScale(i26, t45.center.lat, t45.worldSize).metersToTile }; } renderToBackBuffer(t45) { const i26 = this.painter, o88 = this.painter.context; 0 !== t45.length && (o88.bindFramebuffer.set(null), o88.viewport.set([0, 0, i26.width, i26.height]), i26.gpuTimingDeferredRenderStart(), this.renderingToTexture = false, (function(t46, i27, o89, s18, r86) { if ("globe" === t46.transform.projection.name) !(function(t47, i28, o90, s19, r87) { const n45 = t47.context, a46 = n45.gl; let l21, c28; const h8 = t47.transform, d34 = e56.dA(t47, n45, h8), u12 = (e57, i29) => { if (c28 === i29) return; const o91 = [Ns[i29], "PROJECTION_GLOBE_VIEW"]; d34 && o91.push("CUSTOM_ANTIALIASING"); const s20 = t47.isTileAffectedByFog(e57); l21 = t47.getOrCreateProgram("globeRaster", { defines: o91, overrideFog: s20 }), c28 = i29; }, _4 = t47.colorModeForRenderPass(), p9 = new ji(a46.LEQUAL, ji.ReadWrite, t47.depthRangeFor3D); ks.update(r87); const f8 = e56.dB(h8), m6 = [e56.aF(h8.center.lng), e56.aJ(h8.center.lat)], g9 = t47.globeSharedBuffers, v8 = [h8.width * e56.o.devicePixelRatio, h8.height * e56.o.devicePixelRatio], y4 = Float32Array.from(h8.globeMatrix), x4 = { useDenormalizedUpVectorScale: true }; { const h9 = t47.transform, d35 = Us(h9.zoom, i28.exaggeration(), i28.sourceCache._source.tileSize); c28 = -1; const b8 = a46.TRIANGLES; for (const c29 of s19) { const s20 = o90.getTile(c29), w4 = Gi.disabled, T5 = i28.prevTerrainTileForTile[c29.key], E5 = i28.terrainTileForTile[c29.key]; Bs(T5, E5) && ks.newMorphing(c29.key, T5, E5, r87, 250), n45.activeTexture.set(a46.TEXTURE0), s20.texture && s20.texture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE); const S5 = ks.getMorphValuesForProxy(c29.key), I4 = S5 ? 1 : 0; S5 && Object.assign(x4, { morphing: { srcDemTile: S5.from, dstDemTile: S5.to, phase: e56.dz(S5.phase) } }); const C6 = e56.dC(c29.canonical), R5 = e56.dD(C6.getCenter().lat), A4 = e56.dE(c29.canonical, C6, R5, h9.worldSize / h9._pixelsPerMercatorPixel), D5 = e56.bk(e56.dF(c29.canonical)), L3 = Fs(h9.expandedFarZProjMatrix, y4, f8, D5, e56.aj(h9.zoom), m6, h9.frustumCorners.TL, h9.frustumCorners.TR, h9.frustumCorners.BR, h9.frustumCorners.BL, h9.globeCenterInViewSpace, h9.globeRadius, v8, d35, h9._farZ, A4); if (u12(c29, I4), l21 && (i28.setupElevationDraw(s20, l21, x4), t47.uploadCommonUniforms(n45, l21, c29.toUnwrapped()), g9)) { const [e57, i29, o91] = g9.getGridBuffers(R5, 0 !== d35); l21.draw(t47, b8, p9, w4, _4, Zi.backCCW, L3, "globe_raster", e57, i29, o91); } } } if (g9 && (t47.renderDefaultNorthPole || t47.renderDefaultSouthPole)) { const r88 = ["GLOBE_POLES", "PROJECTION_GLOBE_VIEW"]; d34 && r88.push("CUSTOM_ANTIALIASING"), l21 = t47.getOrCreateProgram("globeRaster", { defines: r88 }); for (const r89 of s19) { const { x: s20, y: c29, z: d35 } = r89.canonical, u13 = 0 === c29, f9 = c29 === (1 << d35) - 1, [y5, b8, w4, T5] = g9.getPoleBuffers(d35, false); if (T5 && (u13 || f9)) { const c30 = o90.getTile(r89); n45.activeTexture.set(a46.TEXTURE0), c30.texture && c30.texture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE); let g10 = e56.dG(d35, s20, h8); const E5 = e56.bk(e56.dF(r89.canonical)), S5 = (e57, i29) => e57.draw(t47, a46.TRIANGLES, p9, Gi.disabled, _4, Zi.disabled, Fs(h8.expandedFarZProjMatrix, g10, g10, E5, 0, m6, h8.frustumCorners.TL, h8.frustumCorners.TR, h8.frustumCorners.BR, h8.frustumCorners.BL, h8.globeCenterInViewSpace, h8.globeRadius, v8, 0, h8._farZ), "globe_pole_raster", i29, w4, T5); i28.setupElevationDraw(c30, l21, x4), t47.uploadCommonUniforms(n45, l21, r89.toUnwrapped()), u13 && t47.renderDefaultNorthPole && S5(l21, y5), f9 && t47.renderDefaultSouthPole && (g10 = e56.cR(e56.bC(), g10, [1, -1, 1]), S5(l21, b8)); } } } })(t46, i27, o89, s18, r86); else { const n45 = t46.context, a46 = n45.gl; let l21, c28; const h8 = t46.shadowRenderer, d34 = io(t46, t46.longestCutoffRange), u12 = (e57) => { if (c28 === e57) return; const i28 = []; i28.push(Ns[e57]), d34.shouldRenderCutoff && i28.push("RENDER_CUTOFF"), h8 && (i28.push("RENDER_SHADOWS", "DEPTH_TEXTURE"), h8.useNormalOffset && i28.push("NORMAL_OFFSET")), l21 = t46.getOrCreateProgram("terrainRaster", { defines: i28 }), c28 = e57; }, _4 = t46.colorModeForRenderPass(), p9 = new ji(a46.LEQUAL, ji.ReadWrite, t46.depthRangeFor3D); ks.update(r86); const f8 = t46.transform, m6 = Us(f8.zoom, i27.exaggeration(), i27.sourceCache._source.tileSize); let g9 = [0, 0, 0]; if (h8) { const e57 = t46.style.directionalLight, i28 = t46.style.ambientLight; e57 && i28 && (g9 = co(t46.style, e57, i28)); } { c28 = -1; const v8 = a46.TRIANGLES, [y4, x4] = [i27.gridIndexBuffer, i27.gridSegments]; for (const c29 of s18) { const s19 = o89.getTile(c29), b8 = Gi.disabled, w4 = i27.prevTerrainTileForTile[c29.key], T5 = i27.terrainTileForTile[c29.key]; Bs(w4, T5) && ks.newMorphing(c29.key, w4, T5, r86, 250), n45.activeTexture.set(a46.TEXTURE0), s19.texture && s19.texture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE); const E5 = ks.getMorphValuesForProxy(c29.key), S5 = E5 ? 1 : 0; let I4; E5 && (I4 = { morphing: { srcDemTile: E5.from, dstDemTile: E5.to, phase: e56.dz(E5.phase) } }); const C6 = Ms(c29.projMatrix, js(c29.canonical, f8.renderWorldCopies) ? m6 / 10 : m6, g9); if (u12(S5), !l21) continue; i27.setupElevationDraw(s19, l21, I4); const R5 = c29.toUnwrapped(); h8 && h8.setupShadows(R5, l21), t46.uploadCommonUniforms(n45, l21, R5, null, d34), l21.draw(t46, v8, p9, b8, _4, Zi.backCCW, C6, "terrain_raster", i27.gridBuffer, y4, x4); } } } })(i26, this, this.proxySourceCache, t45, this._updateTimestamp), this.renderingToTexture = true, i26.gpuTimingDeferredRenderEnd(), t45.splice(0, t45.length)); } renderBatch(t45) { if (0 === this._drapedRenderBatches.length) return t45 + 1; this.renderingToTexture = true; const i26 = this.painter, o88 = this.painter.context, s18 = this.proxySourceCache, r86 = this.proxiedCoords[s18.id], n45 = this._drapedRenderBatches.shift(), a46 = i26.style.order, l21 = []; let c28 = 0; for (const h8 of r86) { const r87 = s18.getTileByID(h8.proxyTileKey), d34 = s18.proxyCachedFBO[h8.key] ? s18.proxyCachedFBO[h8.key][t45] : void 0, u12 = void 0 !== d34 ? s18.renderCache[d34] : this.pool[c28++], _4 = void 0 !== d34; if (r87.texture = u12.tex, _4 && !u12.dirty) { l21.push(r87.tileID); continue; } let p9; o88.bindFramebuffer.set(u12.fb.framebuffer), this.renderedToTile = false, u12.dirty && (o88.clear({ color: e56.ao.transparent, stencil: 0 }), u12.dirty = false); for (let e57 = n45.start; e57 <= n45.end; ++e57) { const t46 = i26.style._mergedLayers[a46[e57]]; if (t46.isHidden(i26.transform.zoom)) continue; const s19 = i26.style.getLayerSourceCache(t46), r88 = s19 ? this.proxyToSource[h8.key][s19.id] : [h8]; if (!r88) continue; const n46 = r88; o88.viewport.set([0, 0, u12.fb.width, u12.fb.height]), p9 !== (s19 ? s19.id : null) && (this._setupStencil(u12, r88, t46, s19), p9 = s19 ? s19.id : null), i26.renderLayer(i26, s19, t46, n46); } if (0 === this._drapedRenderBatches.length) for (const e57 of this._pendingGroundEffectLayers) { const t46 = i26.style._mergedLayers[a46[e57]]; if (t46.isHidden(i26.transform.zoom)) continue; const s19 = i26.style.getLayerSourceCache(t46), r88 = s19 ? this.proxyToSource[h8.key][s19.id] : [h8]; if (!r88) continue; const n46 = r88; o88.viewport.set([0, 0, u12.fb.width, u12.fb.height]), p9 !== (s19 ? s19.id : null) && (this._setupStencil(u12, r88, t46, s19), p9 = s19 ? s19.id : null), i26.renderLayer(i26, s19, t46, n46); } this.renderedToTile ? (u12.dirty = true, l21.push(r87.tileID)) : _4 || --c28, 5 === c28 && (c28 = 0, this.renderToBackBuffer(l21)); } return this.renderToBackBuffer(l21), this.renderingToTexture = false, o88.bindFramebuffer.set(null), o88.viewport.set([0, 0, i26.width, i26.height]), n45.end + 1; } postRender() { } isLayerOrderingCorrect(e57) { const t45 = e57.order.length; let i26 = -1, o88 = t45; for (let s18 = 0; s18 < t45; ++s18) this._style.isLayerDraped(e57._mergedLayers[e57.order[s18]]) ? i26 = Math.max(i26, s18) : o88 = Math.min(o88, s18); return o88 > i26; } getMinElevationBelowMSL() { let e57 = 0; return this._visibleDemTiles.filter(((e58) => e58.dem)).forEach(((t45) => { e57 = Math.min(e57, t45.dem.tree.minimums[0]); })), 0 === e57 ? e57 : (e57 - 30) * this._exaggeration; } raycast(e57, t45, i26) { if (!this._visibleDemTiles) return null; const o88 = this._visibleDemTiles.filter(((e58) => e58.dem)).map(((o89) => { const s18 = o89.tileID, r86 = 1 << s18.overscaledZ, { x: n45, y: a46 } = s18.canonical, l21 = n45 / r86, c28 = (n45 + 1) / r86, h8 = a46 / r86, d34 = (a46 + 1) / r86; return { minx: l21, miny: h8, maxx: c28, maxy: d34, t: o89.dem.tree.raycastRoot(l21, h8, c28, d34, e57, t45, i26), tile: o89 }; })); o88.sort(((e58, t46) => (null !== e58.t ? e58.t : Number.MAX_VALUE) - (null !== t46.t ? t46.t : Number.MAX_VALUE))); for (const s18 of o88) { if (null == s18.t) return null; const o89 = s18.tile.dem.tree.raycast(s18.minx, s18.miny, s18.maxx, s18.maxy, e57, t45, i26); if (null != o89) return o89; } return null; } _createFBO() { const t45 = this.painter.context, i26 = t45.gl, o88 = this.drapeBufferSize; t45.activeTexture.set(i26.TEXTURE0); const s18 = new e56.T(t45, { width: o88[0], height: o88[1], data: null }, i26.RGBA8); s18.bind(i26.LINEAR, i26.CLAMP_TO_EDGE); const r86 = t45.createFramebuffer(o88[0], o88[1], true, null); return r86.colorAttachment.set(s18.texture), r86.depthAttachment = new Os(t45, r86.framebuffer), void 0 === this._sharedDepthStencil ? (this._sharedDepthStencil = t45.createRenderbuffer(t45.gl.DEPTH_STENCIL, o88[0], o88[1]), this._stencilRef = 0, r86.depthAttachment.set(this._sharedDepthStencil), t45.clear({ stencil: 0 })) : r86.depthAttachment.set(this._sharedDepthStencil), t45.extTextureFilterAnisotropic && i26.texParameterf(i26.TEXTURE_2D, t45.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, t45.extTextureFilterAnisotropicMax), { fb: r86, tex: s18, dirty: false }; } _initFBOPool() { for (; this.pool.length < Math.min(5, this.proxyCoords.length); ) this.pool.push(this._createFBO()); } _shouldDisableRenderCache() { if (this._debugParams.disableRenderCache) return true; if (this._style.hasLightTransitions()) return true; for (const e57 in this._style._mergedSourceCaches) if (this._style._mergedSourceCaches[e57].hasTransition()) return true; return this._style.order.some(((e57) => { const t45 = this._style._mergedLayers[e57], i26 = t45.isHidden(this.painter.transform.zoom); return "hillshade" === t45.type || "custom" === t45.type ? !i26 && t45.shouldRedrape() : !i26 && t45.hasTransition(); })); } _clearLineLayersFromRenderCache() { let t45 = false; for (const e57 of this._style.getSources()) if (e57 instanceof ot) { t45 = true; break; } if (!t45) return; const i26 = {}; for (let t46 = 0; t46 < this._style.order.length; ++t46) { const o88 = this._style._mergedLayers[this._style.order[t46]], s18 = this._style.getLayerSourceCache(o88); if (s18 && !i26[s18.id] && !o88.isHidden(this.painter.transform.zoom) && "line" === o88.type && o88.widthExpression() instanceof e56.ad) { i26[s18.id] = true; for (const e57 of this.proxyCoords) { const t47 = this.proxyToSource[e57.key][s18.id]; if (t47) for (const e58 of t47) this._clearRenderCacheForTile(s18.id, e58); } } } } _clearRasterLayersFromRenderCache() { let e57 = false; for (const t46 in this._style._mergedSourceCaches) if (this._style._mergedSourceCaches[t46]._source instanceof st3) { e57 = true; break; } if (!e57) return; const t45 = {}; for (let e58 = 0; e58 < this._style.order.length; ++e58) { const i26 = this._style._mergedLayers[this._style.order[e58]], o88 = this._style.getLayerSourceCache(i26); if (!o88 || t45[o88.id]) continue; if (i26.isHidden(this.painter.transform.zoom) || "raster" !== i26.type) continue; const s18 = i26.paint.get("raster-fade-duration"); for (const e59 of this.proxyCoords) { const t46 = this.proxyToSource[e59.key][o88.id]; if (t46) for (const e60 of t46) { const t47 = Gs(o88.getTile(e60), o88.findLoadedParent(e60, 0), o88, this.painter.transform, s18); (1 !== t47.opacity || 0 !== t47.mix) && this._clearRenderCacheForTile(o88.id, e60); } } } } _setupDrapedRenderBatches() { this._style.updateDrapeFirstLayers(); const t45 = this._style.order, i26 = t45.length; if (0 === i26) return; const o88 = []; this._pendingGroundEffectLayers = []; let s18, r86 = 0, n45 = this._style._mergedLayers[t45[r86]]; for (; !this._style.isLayerDraped(n45) && n45.isHidden(this.painter.transform.zoom) && ++r86 < i26; ) n45 = this._style._mergedLayers[t45[r86]]; for (; r86 < i26; ++r86) { const e57 = this._style._mergedLayers[t45[r86]]; e57.isHidden(this.painter.transform.zoom) || (this._style.isLayerDraped(e57) ? void 0 === s18 && (s18 = r86) : ("fill-extrusion" === e57.type && this._pendingGroundEffectLayers.push(r86), void 0 !== s18 && (o88.push({ start: s18, end: r86 - 1 }), s18 = void 0))); } if (void 0 !== s18 && o88.push({ start: s18, end: r86 - 1 }), 0 !== o88.length) { const t46 = o88[o88.length - 1]; this._pendingGroundEffectLayers.every(((e57) => e57 > t46.end)) || e56.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers."); } this._drapedRenderBatches = o88; } _setupRenderCache(e57) { const t45 = this.proxySourceCache; if (this._shouldDisableRenderCache() || this.invalidateRenderCache) { if (this.invalidateRenderCache = false, t45.renderCache.length > t45.renderCachePool.length) { const e58 = Object.values(t45.proxyCachedFBO); t45.proxyCachedFBO = {}; for (let i27 = 0; i27 < e58.length; ++i27) { const o89 = Object.values(e58[i27]); t45.renderCachePool.push(...o89); } } return; } this._clearRasterLayersFromRenderCache(); const i26 = this.proxyCoords, o88 = this._tilesDirty; for (let s19 = i26.length - 1; s19 >= 0; s19--) { const r86 = i26[s19]; if (t45.getTileByID(r86.key), void 0 !== t45.proxyCachedFBO[r86.key]) { const i27 = e57[r86.key], s20 = this.proxyToSource[r86.key]; let n45 = 0; for (const e58 in s20) { const t46 = s20[e58], r87 = i27[e58]; if (!r87 || r87.length !== t46.length || t46.some(((t47, i28) => t47 !== r87[i28] || o88[e58] && o88[e58].hasOwnProperty(t47.key)))) { n45 = -1; break; } ++n45; } for (const e58 in t45.proxyCachedFBO[r86.key]) t45.renderCache[t45.proxyCachedFBO[r86.key][e58]].dirty = n45 < 0 || n45 !== Object.values(i27).length; } } const s18 = [...this._drapedRenderBatches]; s18.sort(((e58, t46) => t46.end - t46.start - (e58.end - e58.start))); for (const e58 of s18) for (const o89 of i26) { if (t45.proxyCachedFBO[o89.key]) continue; let i27 = t45.renderCachePool.pop(); void 0 === i27 && t45.renderCache.length < 50 && (i27 = t45.renderCache.length, t45.renderCache.push(this._createFBO())), void 0 !== i27 && (t45.proxyCachedFBO[o89.key] = {}, t45.proxyCachedFBO[o89.key][e58.start] = i27, t45.renderCache[i27].dirty = true); } this._tilesDirty = {}; } _setupStencil(e57, t45, i26, o88) { if (!o88 || !this._sourceTilesOverlap[o88.id]) return void (this._overlapStencilType && (this._overlapStencilType = false)); const s18 = this.painter.context, r86 = s18.gl; if (t45.length <= 1) return void (this._overlapStencilType = false); let n45; if (i26.isTileClipped()) n45 = t45.length, this._overlapStencilMode.test = { func: r86.EQUAL, mask: 255 }, this._overlapStencilType = "Clip"; else { if (!(t45[0].overscaledZ > t45[t45.length - 1].overscaledZ)) return void (this._overlapStencilType = false); n45 = 1, this._overlapStencilMode.test = { func: r86.GREATER, mask: 255 }, this._overlapStencilType = "Mask"; } this._stencilRef + n45 > 255 && (s18.clear({ stencil: 0 }), this._stencilRef = 0), this._stencilRef += n45, this._overlapStencilMode.ref = this._stencilRef, i26.isTileClipped() && this._renderTileClippingMasks(t45, this._overlapStencilMode.ref); } clipOrMaskOverlapStencilType() { return "Clip" === this._overlapStencilType || "Mask" === this._overlapStencilType; } stencilModeForRTTOverlap(e57) { return this.renderingToTexture && this._overlapStencilType ? ("Clip" === this._overlapStencilType && (this._overlapStencilMode.ref = this.painter._tileClippingMaskIDs[e57.key]), this._overlapStencilMode) : Gi.disabled; } _renderTileClippingMasks(e57, t45) { const i26 = this.painter, o88 = this.painter.context, s18 = o88.gl; i26._tileClippingMaskIDs = {}, o88.setColorMode(Ui.disabled), o88.setDepthMode(ji.disabled); const r86 = i26.getOrCreateProgram("clippingMask"); for (const o89 of e57) { const e58 = i26._tileClippingMaskIDs[o89.key] = --t45; r86.draw(i26, s18.TRIANGLES, ji.disabled, new Gi({ func: s18.ALWAYS, mask: 0 }, e58, 255, s18.KEEP, s18.KEEP, s18.REPLACE), Ui.disabled, Zi.disabled, Vs(o89.projMatrix), "$clipping", i26.tileExtentBuffer, i26.quadTriangleIndexBuffer, i26.tileExtentSegments); } } pointCoordinate(t45) { const i26 = this.painter.transform; if (t45.x < 0 || t45.x > i26.width || t45.y < 0 || t45.y > i26.height) return null; const o88 = [t45.x, t45.y, 1, 1]; e56.aC(o88, o88, i26.pixelMatrixInverse), e56.cJ(o88, o88, 1 / o88[3]), o88[0] /= i26.worldSize, o88[1] /= i26.worldSize; const s18 = i26._camera.position, r86 = e56.ce(1, i26.center.lat), n45 = [s18[0], s18[1], s18[2] / r86, 0], a46 = e56.d9([], o88.slice(0, 3), n45); e56.aw(a46, a46); const l21 = this.raycast(n45, a46, this._exaggeration); return null !== l21 && l21 ? (e56.bH(n45, n45, a46, l21), n45[3] = n45[2], n45[2] *= r86, n45) : null; } _setupProxiedCoordsForOrtho(t45, i26, o88) { if (t45.getSource() instanceof e56.aS) return this._setupProxiedCoordsForImageSource(t45, i26, o88); this._findCoveringTileCache[t45.id] = this._findCoveringTileCache[t45.id] || {}; const s18 = this.proxiedCoords[t45.id] = [], r86 = this.proxyCoords; for (let e57 = 0; e57 < r86.length; e57++) { const i27 = r86[e57], n46 = this._findTileCoveringTileID(i27, t45); if (n46) { const e58 = this._createProxiedId(i27, n46, o88[i27.key] && o88[i27.key][t45.id]); s18.push(e58), this.proxyToSource[i27.key][t45.id] = [e58]; } } let n45 = false; const a46 = /* @__PURE__ */ new Set(); for (let e57 = 0; e57 < i26.length; e57++) { const r87 = t45.getTile(i26[e57]); if (!r87 || !r87.hasData()) continue; const l21 = this._findTileCoveringTileID(r87.tileID, this.proxySourceCache); if (l21 && l21.tileID.canonical.z !== r87.tileID.canonical.z) { const e58 = this.proxyToSource[l21.tileID.key][t45.id], i27 = this._createProxiedId(l21.tileID, r87, o88[l21.tileID.key] && o88[l21.tileID.key][t45.id]); e58 ? e58.splice(e58.length - 1, 0, i27) : this.proxyToSource[l21.tileID.key][t45.id] = [i27]; const c28 = this.proxyToSource[l21.tileID.key][t45.id]; a46.has(c28) || a46.add(c28), s18.push(i27), n45 = true; } } if (this._sourceTilesOverlap[t45.id] = n45, n45 && this._debugParams.sortTilesHiZFirst) for (const e57 of a46) e57.sort(((e58, t46) => t46.overscaledZ - e58.overscaledZ)); } _setupProxiedCoordsForImageSource(t45, i26, o88) { if (!t45.getSource().loaded()) return; const s18 = this.proxiedCoords[t45.id] = [], r86 = this.proxyCoords, n45 = t45.getSource(), a46 = n45.tileID; if (!a46) return; const l21 = new e56.P(a46.x, a46.y)._div(1 << a46.z), c28 = n45.coordinates.map(e56.ae.fromLngLat).reduce(((e57, t46) => (e57.min.x = Math.min(e57.min.x, t46.x - l21.x), e57.min.y = Math.min(e57.min.y, t46.y - l21.y), e57.max.x = Math.max(e57.max.x, t46.x - l21.x), e57.max.y = Math.max(e57.max.y, t46.y - l21.y), e57)), { min: new e56.P(Number.MAX_VALUE, Number.MAX_VALUE), max: new e56.P(-Number.MAX_VALUE, -Number.MAX_VALUE) }), h8 = (t46, i27) => { const o89 = t46.wrap + t46.canonical.x / (1 << t46.canonical.z), s19 = t46.canonical.y / (1 << t46.canonical.z), r87 = e56.al / (1 << t46.canonical.z), n46 = i27.wrap + i27.canonical.x / (1 << i27.canonical.z), a47 = i27.canonical.y / (1 << i27.canonical.z); return o89 + r87 < n46 + c28.min.x || o89 > n46 + c28.max.x || s19 + r87 < a47 + c28.min.y || s19 > a47 + c28.max.y; }; for (let e57 = 0; e57 < r86.length; e57++) { const n46 = r86[e57]; for (let e58 = 0; e58 < i26.length; e58++) { const r87 = t45.getTile(i26[e58]); if (!r87 || !r87.hasData()) continue; if (h8(n46, r87.tileID)) continue; const a47 = this._createProxiedId(n46, r87, o88[n46.key] && o88[n46.key][t45.id]), l22 = this.proxyToSource[n46.key][t45.id]; l22 ? l22.push(a47) : this.proxyToSource[n46.key][t45.id] = [a47], s18.push(a47); } } } _createProxiedId(t45, i26, o88) { let s18 = this.orthoMatrix; if (o88) { const e57 = o88.find(((e58) => e58.key === i26.tileID.key)); if (e57) return e57; } if (i26.tileID.key !== t45.key) { const o89 = t45.canonical.z - i26.tileID.canonical.z; let r86, n45, a46; s18 = e56.bC(); const l21 = i26.tileID.wrap - t45.wrap << t45.overscaledZ; o89 > 0 ? (r86 = e56.al >> o89, n45 = r86 * ((i26.tileID.canonical.x << o89) - t45.canonical.x + l21), a46 = r86 * ((i26.tileID.canonical.y << o89) - t45.canonical.y)) : (r86 = e56.al << -o89, n45 = e56.al * (i26.tileID.canonical.x - (t45.canonical.x + l21 << -o89)), a46 = e56.al * (i26.tileID.canonical.y - (t45.canonical.y << -o89))), e56.cd(s18, 0, r86, 0, r86, 0, 1), e56.br(s18, s18, [n45, a46, 0]); } return new Zs(i26.tileID, t45.key, s18); } _findTileCoveringTileID(t45, i26) { let o88 = i26.getTile(t45); if (o88 && o88.hasData()) return o88; const s18 = this._findCoveringTileCache[i26.id], r86 = s18[t45.key]; if (o88 = r86 ? i26.getTileByID(r86) : null, o88 && o88.hasData() || null === r86) return o88; let n45 = o88 ? o88.tileID : t45, a46 = n45.overscaledZ; const l21 = i26.getSource().minzoom, c28 = []; if (!r86) { const s19 = i26.getSource().maxzoom; if (t45.canonical.z >= s19) { const o89 = t45.canonical.z - s19; i26.getSource().reparseOverscaled ? (a46 = Math.max(t45.canonical.z + 2, i26.transform.tileZoom), n45 = new e56.aO(a46, t45.wrap, s19, t45.canonical.x >> o89, t45.canonical.y >> o89)) : 0 !== o89 && (a46 = s19, n45 = new e56.aO(a46, t45.wrap, s19, t45.canonical.x >> o89, t45.canonical.y >> o89)); } n45.key !== t45.key && (c28.push(n45.key), o88 = i26.getTile(n45)); } const h8 = (e57) => { c28.forEach(((t46) => { s18[t46] = e57; })), c28.length = 0; }; for (a46 -= 1; a46 >= l21 && (!o88 || !o88.hasData()); a46--) { o88 && h8(o88.tileID.key); const e57 = n45.calculateScaledKey(a46); if (o88 = i26.getTileByID(e57), o88 && o88.hasData()) break; const t46 = s18[e57]; if (null === t46) break; void 0 === t46 ? c28.push(e57) : o88 = i26.getTileByID(t46); } return h8(o88 ? o88.tileID.key : null), o88 && o88.hasData() ? o88 : null; } findDEMTileFor(e57) { return this.enabled ? this._findTileCoveringTileID(e57, this.sourceCache) : null; } prepareDrawTile() { this.renderedToTile = true; } _clearRenderCacheForTile(e57, t45) { let i26 = this._tilesDirty[e57]; i26 || (i26 = this._tilesDirty[e57] = {}), i26[t45.key] = true; } } function $s(t45, i26, o88) { const s18 = (function(t46, i27, o89) { const s19 = e56.bJ(i27, t46), r87 = e56.bJ(o89, [0.2126, 0.7152, 0.0722]), n46 = (e57, t47, i28) => (1 - i28) * e57 + i28 * t47, a47 = n46(1 - 0.3 * Math.min(r87, 1), 1, Math.min(s19 + 1, 1)); return n46(0.92, 1, Math.asin(e56.aA(i27[2], -1, 1)) / Math.PI + 0.5) * a47; })(t45, [0, 0, 1], i26), r86 = [0, 0, 0]; e56.c4(r86, o88.slice(0, 3), s18); const n45 = [0, 0, 0]; e56.c4(n45, i26.slice(0, 3), t45[2]); const a46 = [0, 0, 0]; return e56.d7(a46, r86, n45), e56.da(a46); } const Xs = ["fill", "fillOutline", "fillPattern", "line", "linePattern", "background", "backgroundPattern", "hillshade", "raster"], Ys = ["stars", "rainParticle", "snowParticle", "fillExtrusion", "fillExtrusionGroundEffect", "elevatedStructures", "model", "symbol"]; class Ks { static cacheKey(e57, t45, i26, o88) { let s18 = `${t45}${o88 ? o88.cacheKey : ""}`; for (const t46 of i26) e57.usedDefines.includes(t46) && (s18 += `/${t46}`); return s18; } constructor(t45, i26, o88, s18, r86, n45) { const a46 = t45.gl; this.program = a46.createProgram(), this.configuration = s18, this.name = i26, this.fixedDefines = [...n45]; let l21 = s18 ? s18.defines() : []; l21 = l21.concat(n45.map(((e57) => `#define ${e57}`))); const c28 = "#version 300 es\n"; let h8 = c28 + l21.concat("precision mediump float;", Go, Vo.fragmentSource).join("\n"); for (const e57 of o88.fragmentIncludes) h8 += ` ${Uo[e57]}`; h8 += ` ${o88.fragmentSource}`; let d34 = c28 + l21.concat("precision highp float;", Go, Vo.vertexSource).join("\n"); for (const e57 of o88.vertexIncludes) d34 += ` ${Uo[e57]}`; this.forceManualRenderingForInstanceIDShaders = t45.forceManualRenderingForInstanceIDShaders && -1 !== o88.vertexSource.indexOf("gl_InstanceID"), this.forceManualRenderingForInstanceIDShaders && (d34 += "\nuniform int u_instanceID;\n"), d34 += ` ${o88.vertexSource}`, this.forceManualRenderingForInstanceIDShaders && (d34 = d34.replaceAll("gl_InstanceID", "u_instanceID")); const u12 = a46.createShader(a46.FRAGMENT_SHADER); if (a46.isContextLost()) return void (this.failedToCreate = true); a46.shaderSource(u12, h8), a46.compileShader(u12), a46.attachShader(this.program, u12); const _4 = a46.createShader(a46.VERTEX_SHADER); a46.isContextLost() ? this.failedToCreate = true : (a46.shaderSource(_4, d34), a46.compileShader(_4), a46.attachShader(this.program, _4), this.attributes = {}, a46.linkProgram(this.program), a46.deleteShader(_4), a46.deleteShader(u12), this.fixedUniforms = r86(t45), this.binderUniforms = s18 ? s18.getUniforms(t45) : [], this.forceManualRenderingForInstanceIDShaders && (this.instancingUniforms = ((t46) => ({ u_instanceID: new e56.cg(t46) }))(t45)), (n45.includes("TERRAIN") || -1 !== i26.indexOf("symbol") || -1 !== i26.indexOf("circle")) && (this.terrainUniforms = ((t46) => ({ u_dem: new e56.cg(t46), u_dem_prev: new e56.cg(t46), u_dem_tl: new e56.cj(t46), u_dem_scale: new e56.ci(t46), u_dem_tl_prev: new e56.cj(t46), u_dem_scale_prev: new e56.ci(t46), u_dem_size: new e56.ci(t46), u_dem_lerp: new e56.ci(t46), u_exaggeration: new e56.ci(t46), u_depth: new e56.cg(t46), u_depth_size_inv: new e56.cj(t46), u_depth_range_unpack: new e56.cj(t46), u_occluder_half_size: new e56.ci(t46), u_occlusion_depth_offset: new e56.ci(t46), u_meter_to_dem: new e56.ci(t46), u_label_plane_matrix_inv: new e56.ck(t46) }))(t45)), n45.includes("GLOBE") && (this.globeUniforms = ((t46) => ({ u_tile_tl_up: new e56.ch(t46), u_tile_tr_up: new e56.ch(t46), u_tile_br_up: new e56.ch(t46), u_tile_bl_up: new e56.ch(t46), u_tile_up_scale: new e56.ci(t46) }))(t45)), n45.includes("FOG") && (this.fogUniforms = ((t46) => ({ u_fog_matrix: new e56.ck(t46), u_fog_range: new e56.cj(t46), u_fog_color: new e56.d2(t46), u_fog_horizon_blend: new e56.ci(t46), u_fog_vertical_limit: new e56.cj(t46), u_fog_temporal_offset: new e56.ci(t46), u_frustum_tl: new e56.ch(t46), u_frustum_tr: new e56.ch(t46), u_frustum_br: new e56.ch(t46), u_frustum_bl: new e56.ch(t46), u_globe_pos: new e56.ch(t46), u_globe_radius: new e56.ci(t46), u_globe_transition: new e56.ci(t46), u_is_globe: new e56.cg(t46), u_viewport: new e56.cj(t46) }))(t45)), n45.includes("RENDER_CUTOFF") && (this.cutoffUniforms = ((t46) => ({ u_cutoff_params: new e56.d2(t46) }))(t45)), n45.includes("LIGHTING_3D_MODE") && (this.lightsUniforms = ((t46) => ({ u_lighting_ambient_color: new e56.ch(t46), u_lighting_directional_dir: new e56.ch(t46), u_lighting_directional_color: new e56.ch(t46), u_ground_radiance: new e56.ch(t46) }))(t45)), n45.includes("RENDER_SHADOWS") && (this.shadowUniforms = ((t46) => ({ u_light_matrix_0: new e56.ck(t46), u_light_matrix_1: new e56.ck(t46), u_fade_range: new e56.cj(t46), u_shadow_normal_offset: new e56.ch(t46), u_shadow_intensity: new e56.ci(t46), u_shadow_texel_size: new e56.ci(t46), u_shadow_map_resolution: new e56.ci(t46), u_shadow_direction: new e56.ch(t46), u_shadow_bias: new e56.ch(t46), u_shadowmap_0: new e56.cg(t46), u_shadowmap_1: new e56.cg(t46) }))(t45))); } getAttributeLocation(e57, t45) { let i26 = this.attributes[t45]; return void 0 === i26 && (i26 = this.attributes[t45] = e57.getAttribLocation(this.program, t45)), i26; } setTerrainUniformValues(e57, t45) { if (!this.terrainUniforms) return; const i26 = this.terrainUniforms; if (!this.failedToCreate) { e57.program.set(this.program); for (const e58 in t45) i26[e58] && i26[e58].set(this.program, e58, t45[e58]); } } setGlobeUniformValues(e57, t45) { if (!this.globeUniforms) return; const i26 = this.globeUniforms; if (!this.failedToCreate) { e57.program.set(this.program); for (const e58 in t45) i26[e58] && i26[e58].set(this.program, e58, t45[e58]); } } setFogUniformValues(e57, t45) { if (!this.fogUniforms) return; const i26 = this.fogUniforms; if (!this.failedToCreate) { e57.program.set(this.program); for (const e58 in t45) i26[e58].set(this.program, e58, t45[e58]); } } setCutoffUniformValues(e57, t45) { if (!this.cutoffUniforms) return; const i26 = this.cutoffUniforms; if (!this.failedToCreate) { e57.program.set(this.program); for (const e58 in t45) i26[e58].set(this.program, e58, t45[e58]); } } setLightsUniformValues(e57, t45) { if (!this.lightsUniforms) return; const i26 = this.lightsUniforms; if (!this.failedToCreate) { e57.program.set(this.program); for (const e58 in t45) i26[e58].set(this.program, e58, t45[e58]); } } setShadowUniformValues(e57, t45) { if (this.failedToCreate || !this.shadowUniforms) return; const i26 = this.shadowUniforms; e57.program.set(this.program); for (const e58 in t45) i26[e58].set(this.program, e58, t45[e58]); } _drawDebugWireframe(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8) { const d34 = t45.options.wireframe; if (false === d34.terrain && false === d34.layers2D && false === d34.layers3D) return; const u12 = t45.context; if (!(() => !(!d34.terrain || "terrainRaster" !== this.name && "globeRaster" !== this.name) || !(!d34.layers2D || t45._terrain && t45._terrain.renderingToTexture || !Xs.includes(this.name)) || !(!d34.layers3D || !Ys.includes(this.name)))()) return; const _4 = u12.gl, p9 = t45.wireframeDebugCache.getLinesFromTrianglesBuffer(t45.frameCounter, r86, u12); if (!p9) return; const f8 = [...this.fixedDefines]; f8.push("DEBUG_WIREFRAME"); const m6 = t45.getOrCreateProgram(this.name, { config: this.configuration, defines: f8 }); u12.program.set(m6.program); const g9 = (e57, t46, i27) => { if (t46[e57] && i27[e57]) for (const o89 in t46[e57]) i27[e57][o89] && i27[e57][o89].set(i27.program, o89, t46[e57][o89].current); }; c28 && c28.setUniforms(m6.program, u12, m6.binderUniforms, a46, { zoom: l21 }), g9("fixedUniforms", this, m6), g9("terrainUniforms", this, m6), g9("globeUniforms", this, m6), g9("fogUniforms", this, m6), g9("lightsUniforms", this, m6), g9("shadowUniforms", this, m6), p9.bind(), u12.setColorMode(new Ui([_4.ONE, _4.ONE_MINUS_SRC_ALPHA, _4.ZERO, _4.ONE], e56.ao.transparent, [true, true, true, false])), u12.setDepthMode(new ji(i26.func === _4.LESS ? _4.LEQUAL : i26.func, ji.ReadOnly, i26.range)), u12.setStencilMode(Gi.disabled); const v8 = 3 * n45.primitiveLength * 2, y4 = 3 * n45.primitiveOffset * 2 * 2; if (this.forceManualRenderingForInstanceIDShaders) { const e57 = h8 || 1; for (let t46 = 0; t46 < e57; ++t46) m6.instancingUniforms.u_instanceID.set(this.program, "u_instanceID", t46), _4.drawElements(_4.LINES, v8, _4.UNSIGNED_SHORT, y4); } else h8 && h8 > 1 ? _4.drawElementsInstanced(_4.LINES, v8, _4.UNSIGNED_SHORT, y4, h8) : _4.drawElements(_4.LINES, v8, _4.UNSIGNED_SHORT, y4); r86.bind(), u12.program.set(this.program), u12.setDepthMode(i26), u12.setStencilMode(o88), u12.setColorMode(s18); } checkUniforms(e57, t45, i26) { if (this.fixedDefines.includes(t45)) { for (const o88 of Object.keys(i26)) if (!i26[o88].initialized) throw new Error(`Program '${this.name}', from draw '${e57}': uniform ${o88} not set but required by ${t45} being defined`); } } draw(e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8) { const m6 = e57.context, g9 = m6.gl; if (this.failedToCreate) return; m6.program.set(this.program), m6.setDepthMode(i26), m6.setStencilMode(o88), m6.setColorMode(s18), m6.setCullFace(r86); for (const e58 of Object.keys(this.fixedUniforms)) this.fixedUniforms[e58].set(this.program, e58, n45[e58]); _4 && _4.setUniforms(this.program, m6, this.binderUniforms, d34, { zoom: u12 }); const v8 = { [g9.POINTS]: 1, [g9.LINES]: 2, [g9.TRIANGLES]: 3, [g9.LINE_STRIP]: 1 }[t45]; this.checkUniforms(a46, "RENDER_SHADOWS", this.shadowUniforms); const y4 = f8 && f8 > 0 ? 1 : void 0; for (const r87 of h8.get()) { const n46 = r87.vaos || (r87.vaos = {}); if ((n46[a46] || (n46[a46] = new Wo())).bind(m6, this, l21, _4 ? _4.getPaintVertexBuffers() : [], c28, r87.vertexOffset, p9 || [], y4), this.forceManualRenderingForInstanceIDShaders) { const e58 = f8 || 1; for (let i27 = 0; i27 < e58; ++i27) this.instancingUniforms.u_instanceID.set(this.program, "u_instanceID", i27), c28 ? g9.drawElements(t45, r87.primitiveLength * v8, g9.UNSIGNED_SHORT, r87.primitiveOffset * v8 * 2) : g9.drawArrays(t45, r87.vertexOffset, r87.vertexLength); } else f8 && f8 > 1 ? g9.drawElementsInstanced(t45, r87.primitiveLength * v8, g9.UNSIGNED_SHORT, r87.primitiveOffset * v8 * 2, f8) : c28 ? g9.drawElements(t45, r87.primitiveLength * v8, g9.UNSIGNED_SHORT, r87.primitiveOffset * v8 * 2) : g9.drawArrays(t45, r87.vertexOffset, r87.vertexLength); t45 === g9.TRIANGLES && c28 && this._drawDebugWireframe(e57, i26, o88, s18, c28, r87, d34, u12, _4, f8); } } } function Js(t45, i26, o88 = 0) { const s18 = Math.pow(2, i26.tileID.overscaledZ), r86 = i26.tileSize * Math.pow(2, t45.transform.tileZoom) / s18, n45 = r86 * (i26.tileID.canonical.x + i26.tileID.wrap * s18), a46 = r86 * i26.tileID.canonical.y; return { u_image: 0, u_texsize: i26.imageAtlasTexture ? i26.imageAtlasTexture.size : [0, 0], u_tile_units_to_pixels: 1 / e56.ay(i26, 1, t45.transform.tileZoom), u_pixel_coord_upper: [n45 >> 16, a46 >> 16], u_pixel_coord_lower: [65535 & n45, 65535 & a46], u_pattern_transition: o88 }; } const Qs = { terrain: 0, flat: 1 }, er = e56.bC(), tr = (t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8) => { const y4 = i26.style.light, x4 = y4.properties.get("position"), b8 = [x4.x, x4.y, x4.z], w4 = e56.dL(); "viewport" === y4.properties.get("anchor") && (e56.dM(w4, -i26.transform.angle), e56.dN(b8, b8, w4)); const T5 = y4.properties.get("color").toPremultipliedRenderColor(null), E5 = i26.transform, S5 = { u_matrix: t45, u_lightpos: b8, u_lightintensity: y4.properties.get("intensity"), u_lightcolor: [T5.r, T5.g, T5.b], u_vertical_gradient: +o88, u_opacity: s18, u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_inv_rot_matrix: er, u_merc_center: [0, 0], u_up_dir: [0, 0, 0], u_height_lift: 0, u_height_type: Qs[h8], u_base_type: Qs[d34], u_ao: r86, u_edge_radius: n45, u_width_scale: a46, u_flood_light_color: f8, u_vertical_scale: m6, u_flood_light_intensity: g9, u_ground_shadow_factor: v8 }; return "globe" === E5.projection.name && (S5.u_tile_id = [l21.canonical.x, l21.canonical.y, 1 << l21.canonical.z], S5.u_zoom_transition = u12, S5.u_inv_rot_matrix = p9, S5.u_merc_center = _4, S5.u_up_dir = E5.projection.upVector(new e56.cC(0, 0, 0), _4[0] * e56.al, _4[1] * e56.al), S5.u_height_lift = c28), S5; }, ir = (e57, t45, i26, o88, s18, r86) => ({ u_matrix: e57, u_edge_radius: t45, u_width_scale: i26, u_vertical_scale: o88, u_height_type: Qs[s18], u_base_type: Qs[r86] }), or = (e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9) => { const v8 = tr(e57, t45, i26, o88, s18, r86, n45, a46, c28, h8, d34, u12, _4, p9, f8, m6, 1, [0, 0, 0]), y4 = { u_height_factor: -Math.pow(2, a46.overscaledZ) / l21.tileSize / 8 }; return Object.assign(v8, Js(t45, l21, g9), y4); }, sr = (e57, t45, i26) => ({ u_matrix: e57, u_emissive_strength: t45, u_ground_shadow_factor: i26 }), rr2 = (e57, t45, i26, o88, s18, r86 = 0) => Object.assign(sr(e57, t45, s18), Js(i26, o88, r86)), nr = (e57, t45, i26, o88) => ({ u_matrix: e57, u_world: i26, u_emissive_strength: t45, u_ground_shadow_factor: o88 }), ar2 = (e57, t45, i26, o88, s18, r86, n45 = 0) => Object.assign(rr2(e57, t45, i26, o88, r86, n45), { u_world: s18 }), lr = (e57, t45) => ({ u_matrix: e57, u_ground_shadow_factor: t45 }), cr = (e57, t45, i26, o88, s18) => ({ u_matrix: e57, u_camera_pos: [t45[0], t45[1], t45[2]], u_depth_bias: i26, u_height_scale: o88, u_reset_depth: s18 }), hr = (e57, t45, i26, o88, s18, r86, n45) => ({ u_matrix: e57, u_normal_matrix: t45, u_opacity: i26, u_faux_facade_ao_intensity: o88, u_camera_pos: s18, u_tile_to_meter: r86, u_facade_emissive_chance: n45 }), dr = (e57) => ({ u_matrix: e57 }), ur = (e57) => ({ u_matrix: e57 }), _r = (t45, i26, o88, s18, r86, n45, a46, l21) => { const c28 = e56.al / n45.tileSize; return { u_matrix: t45, u_inv_rot_matrix: i26, u_camera_to_center_distance: o88.getCameraToCenterDistance(l21), u_extrude_scale: [o88.pixelsToGLUnits[0] / c28, o88.pixelsToGLUnits[1] / c28], u_zoom_transition: s18, u_tile_id: a46, u_merc_center: r86 }; }, pr = (e57, t45, i26 = 1) => ({ u_matrix: e57, u_color: t45, u_overlay: 0, u_overlay_scale: i26 }), fr = e56.bC(), mr = (t45, i26, o88, s18, r86, n45, a46) => { const l21 = t45.transform, c28 = "globe" === l21.projection.name, h8 = c28 ? e56.dO(l21.zoom, i26.canonical) * l21._pixelsPerMercatorPixel : e56.ay(o88, 1, n45), d34 = { u_matrix: i26.projMatrix, u_extrude_scale: h8, u_intensity: a46, u_inv_rot_matrix: fr, u_merc_center: [0, 0], u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_up_dir: [0, 0, 0] }; if (c28) { d34.u_inv_rot_matrix = s18, d34.u_merc_center = r86, d34.u_tile_id = [i26.canonical.x, i26.canonical.y, 1 << i26.canonical.z], d34.u_zoom_transition = e56.aj(l21.zoom); const t46 = r86[0] * e56.al, o89 = r86[1] * e56.al; d34.u_up_dir = l21.projection.upVector(new e56.cC(0, 0, 0), t46, o89); } return d34; }; function gr(e57, [t45, i26, o88, s18], [r86, n45]) { if (r86 === n45) return [0, 0, 0, 0]; const a46 = 255 * (e57 - 1) / (e57 * (n45 - r86)); return [t45 * a46, i26 * a46, o88 * a46, s18 * a46]; } function vr(e57, t45, [i26, o88]) { return i26 === o88 ? 0 : 0.5 / e57 + (t45 - i26) * (e57 - 1) / (e57 * (o88 - i26)); } const yr = (t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4, x4, b8) => ({ u_matrix: t45, u_normalize_matrix: i26, u_globe_matrix: o88, u_merc_matrix: s18, u_grid_matrix: r86, u_tl_parent: n45, u_scale_parent: h8, u_fade_t: d34.mix, u_opacity: d34.opacity * u12.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: u12.paint.get("raster-brightness-min"), u_brightness_high: u12.paint.get("raster-brightness-max"), u_saturation_factor: e56.dQ(u12.paint.get("raster-saturation")), u_contrast_factor: e56.dP(u12.paint.get("raster-contrast")), u_spin_weights: xr(u12.paint.get("raster-hue-rotate")), u_perspective_transform: _4, u_raster_elevation: p9, u_zoom_transition: a46, u_merc_center: l21, u_cutoff_params: c28, u_colorization_mix: gr(e56.dR, m6, v8), u_colorization_offset: vr(e56.dR, g9, v8), u_color_ramp: f8, u_texture_offset: [x4 / (y4 + 2 * x4), y4 / (y4 + 2 * x4)], u_texture_res: [y4 + 2 * x4, y4 + 2 * x4], u_emissive_strength: b8 }); function xr(e57) { e57 *= Math.PI / 180; const t45 = Math.sin(e57), i26 = Math.cos(e57); return [(2 * i26 + 1) / 3, (-Math.sqrt(3) * t45 - i26 + 1) / 3, (Math.sqrt(3) * t45 - i26 + 1) / 3]; } const br = 0.05, wr = (e57, t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34) => ({ u_matrix: e57, u_normalize_matrix: t45, u_globe_matrix: i26, u_merc_matrix: o88, u_grid_matrix: s18, u_tl_parent: r86, u_scale_parent: c28, u_fade_t: h8.mix, u_opacity: h8.opacity, u_image0: 0, u_image1: 1, u_raster_elevation: d34, u_zoom_transition: n45, u_merc_center: a46, u_cutoff_params: l21 }), Tr = (e57, t45, i26, o88, s18, r86, n45, a46, l21, c28) => ({ u_particle_texture: e57, u_particle_texture_side_len: t45, u_tile_offset: i26, u_velocity: o88, u_color_ramp: r86, u_velocity_res: s18, u_max_speed: n45, u_uv_offset: a46, u_data_scale: [255 * l21[0], 255 * l21[1]], u_data_offset: c28, u_particle_pos_scale: 1.1, u_particle_pos_offset: [br, br] }), Er = (e57, t45, i26, o88, s18, r86, n45, a46, l21, c28) => ({ u_particle_texture: e57, u_particle_texture_side_len: t45, u_velocity: i26, u_velocity_res: o88, u_max_speed: s18, u_speed_factor: r86, u_reset_rate: n45, u_rand_seed: Math.random(), u_uv_offset: a46, u_data_scale: [255 * l21[0], 255 * l21[1]], u_data_offset: c28, u_particle_pos_scale: 1.1, u_particle_pos_offset: [br, br] }), Sr = e56.bC(), Ir = (t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4, x4, b8, w4, T5, E5) => { const S5 = r86.transform, I4 = { u_is_size_zoom_constant: +("constant" === t45 || "source" === t45), u_is_size_feature_constant: +("constant" === t45 || "camera" === t45), u_size_t: i26 ? i26.uSizeT : 0, u_size: i26 ? i26.uSize : 0, u_camera_to_center_distance: S5.getCameraToCenterDistance(y4), u_rotate_symbol: +o88, u_aspect_ratio: S5.width / S5.height, u_fade_change: r86.options.fadeDuration ? r86.symbolFadeChange : 1, u_matrix: n45, u_label_plane_matrix: a46, u_coord_matrix: l21, u_is_text: +h8, u_elevation_from_sea: c28 ? 1 : 0, u_pitch_with_map: +s18, u_texsize: d34, u_texsize_icon: u12, u_texture: 0, u_texture_icon: 1, u_tile_id: [0, 0, 0], u_zoom_transition: 0, u_inv_rot_matrix: Sr, u_merc_center: [0, 0], u_camera_forward: [0, 0, 0], u_ecef_origin: [0, 0, 0], u_tile_matrix: Sr, u_up_vector: [0, -1, 0], u_color_adj_mat: w4, u_icon_transition: T5 || 0, u_gamma_scale: s18 ? r86.transform.getCameraToCenterDistance(y4) * Math.cos(r86.terrain ? 0 : r86.transform._pitch) : 1, u_device_pixel_ratio: e56.o.devicePixelRatio, u_is_halo: 1, u_scale_factor: E5 || 1, u_ground_shadow_factor: x4, u_inv_matrix: e56.bl(e56.bC(), a46), u_normal_scale: b8, u_lutTexture: Ji.LUT }; return "globe" === y4.name && (I4.u_tile_id = [p9.canonical.x, p9.canonical.y, 1 << p9.canonical.z], I4.u_zoom_transition = f8, I4.u_inv_rot_matrix = g9, I4.u_merc_center = m6, I4.u_camera_forward = S5._camera.forward(), I4.u_ecef_origin = e56.dS(S5.globeMatrix, p9.toUnwrapped()), I4.u_tile_matrix = Float32Array.from(S5.globeMatrix), I4.u_up_vector = v8), I4; }, Cr = (e57, t45, i26, o88) => ({ u_matrix: e57, u_emissive_strength: t45, u_opacity: i26, u_color: o88 }), Rr = (t45, i26, o88, s18, r86, n45, a46, l21, c28) => Object.assign((function(t46, i27, o89, s19, r87, n46) { const { width: a47, height: l22 } = s19.imageManager.getPixelSize(i27), c29 = Math.pow(2, n46.tileID.overscaledZ), h8 = n46.tileSize * Math.pow(2, s19.transform.tileZoom) / c29, d34 = h8 * (n46.tileID.canonical.x + n46.tileID.wrap * c29), u12 = h8 * n46.tileID.canonical.y; return { u_image: 0, u_pattern_tl: o89.tl, u_pattern_br: o89.br, u_texsize: [a47, l22], u_pattern_size: o89.displaySize, u_pattern_units_to_pixels: r87 ? [s19.transform.width, -1 * s19.transform.height] : [1 / e56.ay(n46, 1, s19.transform.tileZoom), 1 / e56.ay(n46, 1, s19.transform.tileZoom)], u_pixel_coord_upper: [d34 >> 16, u12 >> 16], u_pixel_coord_lower: [65535 & d34, 65535 & u12] }; })(0, n45, a46, s18, l21, c28), { u_matrix: t45, u_emissive_strength: i26, u_opacity: o88 }), Ar = new Float32Array(e56.bA([])), Dr = (t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9 = [0, 0, 0], f8) => { const m6 = r86.style.light, g9 = m6.properties.get("position"), v8 = [-g9.x, -g9.y, g9.z], y4 = e56.dL(); "viewport" === m6.properties.get("anchor") && (e56.dM(y4, -r86.transform.angle), e56.dN(v8, v8, y4)); const x4 = "MASK" === d34.alphaMode, b8 = m6.properties.get("color").toNonPremultipliedRenderColor(null), w4 = _4.paint.get("model-ambient-occlusion-intensity"), T5 = _4.paint.get("model-color").constantOr(e56.ao.white).toNonPremultipliedRenderColor(null); return T5.a = _4.paint.get("model-color-mix-intensity").constantOr(0), { u_matrix: t45, u_lighting_matrix: i26, u_normal_matrix: o88, u_node_matrix: s18 || Ar, u_lightpos: v8, u_lightintensity: m6.properties.get("intensity"), u_lightcolor: [b8.r, b8.g, b8.b], u_camera_pos: p9, u_opacity: n45, u_baseTextureIsAlpha: 0, u_alphaMask: +x4, u_alphaCutoff: d34.alphaCutoff, u_baseColorFactor: a46.toNonPremultipliedRenderColor(null).toArray01(), u_emissiveFactor: l21.toNonPremultipliedRenderColor(null).toArray01(), u_metallicFactor: c28, u_roughnessFactor: h8, u_baseColorTexture: Ji.BaseColor, u_metallicRoughnessTexture: Ji.MetallicRoughness, u_normalTexture: Ji.Normal, u_occlusionTexture: Ji.Occlusion, u_emissionTexture: Ji.Emission, u_lutTexture: Ji.LUT, u_color_mix: T5.toArray01(), u_aoIntensity: w4, u_emissive_strength: u12, u_occlusionTextureTransform: f8 || [0, 0, 0, 0] }; }, Lr = (e57, t45 = Ar, i26 = Ar) => ({ u_matrix: e57, u_instance: t45, u_node_matrix: i26 }), Pr = { fillExtrusion: (t45) => ({ u_matrix: new e56.ck(t45), u_lightpos: new e56.ch(t45), u_lightintensity: new e56.ci(t45), u_lightcolor: new e56.ch(t45), u_vertical_gradient: new e56.ci(t45), u_opacity: new e56.ci(t45), u_edge_radius: new e56.ci(t45), u_width_scale: new e56.ci(t45), u_ao: new e56.cj(t45), u_height_type: new e56.cg(t45), u_base_type: new e56.cg(t45), u_tile_id: new e56.ch(t45), u_zoom_transition: new e56.ci(t45), u_inv_rot_matrix: new e56.ck(t45), u_merc_center: new e56.cj(t45), u_up_dir: new e56.ch(t45), u_height_lift: new e56.ci(t45), u_flood_light_color: new e56.ch(t45), u_vertical_scale: new e56.ci(t45), u_flood_light_intensity: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45) }), fillExtrusionDepth: (t45) => ({ u_matrix: new e56.ck(t45), u_edge_radius: new e56.ci(t45), u_width_scale: new e56.ci(t45), u_vertical_scale: new e56.ci(t45), u_height_type: new e56.cg(t45), u_base_type: new e56.cg(t45) }), fillExtrusionPattern: (t45) => ({ u_matrix: new e56.ck(t45), u_lightpos: new e56.ch(t45), u_lightintensity: new e56.ci(t45), u_lightcolor: new e56.ch(t45), u_vertical_gradient: new e56.ci(t45), u_height_factor: new e56.ci(t45), u_edge_radius: new e56.ci(t45), u_width_scale: new e56.ci(t45), u_ao: new e56.cj(t45), u_height_type: new e56.cg(t45), u_base_type: new e56.cg(t45), u_tile_id: new e56.ch(t45), u_zoom_transition: new e56.ci(t45), u_inv_rot_matrix: new e56.ck(t45), u_merc_center: new e56.cj(t45), u_up_dir: new e56.ch(t45), u_height_lift: new e56.ci(t45), u_image: new e56.cg(t45), u_texsize: new e56.cj(t45), u_pixel_coord_upper: new e56.cj(t45), u_pixel_coord_lower: new e56.cj(t45), u_tile_units_to_pixels: new e56.ci(t45), u_opacity: new e56.ci(t45), u_pattern_transition: new e56.ci(t45) }), fillExtrusionGroundEffect: (t45) => ({ u_matrix: new e56.ck(t45), u_opacity: new e56.ci(t45), u_ao_pass: new e56.ci(t45), u_meter_to_tile: new e56.ci(t45), u_ao: new e56.cj(t45), u_flood_light_intensity: new e56.ci(t45), u_flood_light_color: new e56.ch(t45), u_attenuation: new e56.ci(t45), u_edge_radius: new e56.ci(t45), u_fb: new e56.cg(t45), u_fb_size: new e56.ci(t45), u_dynamic_offset: new e56.ci(t45) }), fill: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45) }), fillPattern: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_image: new e56.cg(t45), u_texsize: new e56.cj(t45), u_pixel_coord_upper: new e56.cj(t45), u_pixel_coord_lower: new e56.cj(t45), u_tile_units_to_pixels: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45), u_pattern_transition: new e56.ci(t45) }), fillOutline: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_world: new e56.cj(t45), u_ground_shadow_factor: new e56.ch(t45) }), fillOutlinePattern: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_world: new e56.cj(t45), u_image: new e56.cg(t45), u_texsize: new e56.cj(t45), u_pixel_coord_upper: new e56.cj(t45), u_pixel_coord_lower: new e56.cj(t45), u_tile_units_to_pixels: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45), u_pattern_transition: new e56.ci(t45) }), building: (t45) => ({ u_matrix: new e56.ck(t45), u_normal_matrix: new e56.ck(t45), u_opacity: new e56.ci(t45), u_faux_facade_ao_intensity: new e56.ci(t45), u_camera_pos: new e56.ch(t45), u_tile_to_meter: new e56.ci(t45), u_facade_emissive_chance: new e56.ci(t45) }), buildingBloom: (t45) => ({ u_matrix: new e56.ck(t45) }), buildingDepth: (t45) => ({ u_matrix: new e56.ck(t45) }), elevatedStructuresDepth: (t45) => ({ u_matrix: new e56.ck(t45), u_depth_bias: new e56.ci(t45) }), elevatedStructures: (t45) => ({ u_matrix: new e56.ck(t45), u_ground_shadow_factor: new e56.ch(t45) }), elevatedStructuresDepthReconstruct: (t45) => ({ u_matrix: new e56.ck(t45), u_camera_pos: new e56.ch(t45), u_depth_bias: new e56.ci(t45), u_height_scale: new e56.ci(t45), u_reset_depth: new e56.ci(t45) }), circle: e56.dV, collisionBox: (t45) => ({ u_matrix: new e56.ck(t45), u_inv_rot_matrix: new e56.ck(t45), u_camera_to_center_distance: new e56.ci(t45), u_extrude_scale: new e56.cj(t45), u_zoom_transition: new e56.ci(t45), u_merc_center: new e56.cj(t45), u_tile_id: new e56.ch(t45) }), collisionCircle: (t45) => ({ u_matrix: new e56.ck(t45), u_inv_matrix: new e56.ck(t45), u_camera_to_center_distance: new e56.ci(t45), u_viewport_size: new e56.cj(t45) }), debug: (t45) => ({ u_color: new e56.dx(t45), u_matrix: new e56.ck(t45), u_overlay: new e56.cg(t45), u_overlay_scale: new e56.ci(t45) }), clippingMask: (t45) => ({ u_matrix: new e56.ck(t45) }), heatmap: (t45) => ({ u_extrude_scale: new e56.ci(t45), u_intensity: new e56.ci(t45), u_matrix: new e56.ck(t45), u_inv_rot_matrix: new e56.ck(t45), u_merc_center: new e56.cj(t45), u_tile_id: new e56.ch(t45), u_zoom_transition: new e56.ci(t45), u_up_dir: new e56.ch(t45) }), heatmapTexture: (t45) => ({ u_image: new e56.cg(t45), u_color_ramp: new e56.cg(t45), u_opacity: new e56.ci(t45) }), hillshade: (t45) => ({ u_matrix: new e56.ck(t45), u_image: new e56.cg(t45), u_latrange: new e56.cj(t45), u_light: new e56.cj(t45), u_shadow: new e56.dx(t45), u_highlight: new e56.dx(t45), u_emissive_strength: new e56.ci(t45), u_accent: new e56.dx(t45) }), hillshadePrepare: (t45) => ({ u_matrix: new e56.ck(t45), u_image: new e56.cg(t45), u_dimension: new e56.cj(t45), u_zoom: new e56.ci(t45) }), line: e56.dU, linePattern: e56.dT, raster: (t45) => ({ u_matrix: new e56.ck(t45), u_normalize_matrix: new e56.ck(t45), u_globe_matrix: new e56.ck(t45), u_merc_matrix: new e56.ck(t45), u_grid_matrix: new e56.dy(t45), u_tl_parent: new e56.cj(t45), u_scale_parent: new e56.ci(t45), u_fade_t: new e56.ci(t45), u_opacity: new e56.ci(t45), u_image0: new e56.cg(t45), u_image1: new e56.cg(t45), u_brightness_low: new e56.ci(t45), u_brightness_high: new e56.ci(t45), u_saturation_factor: new e56.ci(t45), u_contrast_factor: new e56.ci(t45), u_spin_weights: new e56.ch(t45), u_perspective_transform: new e56.cj(t45), u_raster_elevation: new e56.ci(t45), u_zoom_transition: new e56.ci(t45), u_merc_center: new e56.cj(t45), u_cutoff_params: new e56.d2(t45), u_colorization_mix: new e56.d2(t45), u_colorization_offset: new e56.ci(t45), u_color_ramp: new e56.cg(t45), u_texture_offset: new e56.cj(t45), u_texture_res: new e56.cj(t45), u_emissive_strength: new e56.ci(t45) }), rasterParticle: (t45) => ({ u_matrix: new e56.ck(t45), u_normalize_matrix: new e56.ck(t45), u_globe_matrix: new e56.ck(t45), u_merc_matrix: new e56.ck(t45), u_grid_matrix: new e56.dy(t45), u_tl_parent: new e56.cj(t45), u_scale_parent: new e56.ci(t45), u_fade_t: new e56.ci(t45), u_opacity: new e56.ci(t45), u_image0: new e56.cg(t45), u_image1: new e56.cg(t45), u_raster_elevation: new e56.ci(t45), u_zoom_transition: new e56.ci(t45), u_merc_center: new e56.cj(t45), u_cutoff_params: new e56.d2(t45) }), rasterParticleTexture: (t45) => ({ u_texture: new e56.cg(t45), u_opacity: new e56.ci(t45) }), rasterParticleDraw: (t45) => ({ u_particle_texture: new e56.cg(t45), u_particle_texture_side_len: new e56.ci(t45), u_tile_offset: new e56.cj(t45), u_velocity: new e56.cg(t45), u_color_ramp: new e56.cg(t45), u_velocity_res: new e56.cj(t45), u_max_speed: new e56.ci(t45), u_uv_offset: new e56.cj(t45), u_data_scale: new e56.cj(t45), u_data_offset: new e56.ci(t45), u_particle_pos_scale: new e56.ci(t45), u_particle_pos_offset: new e56.cj(t45) }), rasterParticleUpdate: (t45) => ({ u_particle_texture: new e56.cg(t45), u_particle_texture_side_len: new e56.ci(t45), u_velocity: new e56.cg(t45), u_velocity_res: new e56.cj(t45), u_max_speed: new e56.ci(t45), u_speed_factor: new e56.ci(t45), u_reset_rate: new e56.ci(t45), u_rand_seed: new e56.ci(t45), u_uv_offset: new e56.cj(t45), u_data_scale: new e56.cj(t45), u_data_offset: new e56.ci(t45), u_particle_pos_scale: new e56.ci(t45), u_particle_pos_offset: new e56.cj(t45) }), symbol: (t45) => ({ u_is_size_zoom_constant: new e56.cg(t45), u_is_size_feature_constant: new e56.cg(t45), u_size_t: new e56.ci(t45), u_size: new e56.ci(t45), u_camera_to_center_distance: new e56.ci(t45), u_rotate_symbol: new e56.cg(t45), u_aspect_ratio: new e56.ci(t45), u_fade_change: new e56.ci(t45), u_matrix: new e56.ck(t45), u_label_plane_matrix: new e56.ck(t45), u_coord_matrix: new e56.ck(t45), u_is_text: new e56.cg(t45), u_elevation_from_sea: new e56.cg(t45), u_pitch_with_map: new e56.cg(t45), u_texsize: new e56.cj(t45), u_texsize_icon: new e56.cj(t45), u_texture: new e56.cg(t45), u_texture_icon: new e56.cg(t45), u_gamma_scale: new e56.ci(t45), u_device_pixel_ratio: new e56.ci(t45), u_tile_id: new e56.ch(t45), u_zoom_transition: new e56.ci(t45), u_inv_rot_matrix: new e56.ck(t45), u_merc_center: new e56.cj(t45), u_camera_forward: new e56.ch(t45), u_tile_matrix: new e56.ck(t45), u_up_vector: new e56.ch(t45), u_ecef_origin: new e56.ch(t45), u_is_halo: new e56.cg(t45), u_icon_transition: new e56.ci(t45), u_color_adj_mat: new e56.ck(t45), u_scale_factor: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45), u_inv_matrix: new e56.ck(t45), u_normal_scale: new e56.ci(t45), u_lutTexture: new e56.cg(t45) }), background: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_opacity: new e56.ci(t45), u_color: new e56.dx(t45) }), backgroundPattern: (t45) => ({ u_matrix: new e56.ck(t45), u_emissive_strength: new e56.ci(t45), u_opacity: new e56.ci(t45), u_image: new e56.cg(t45), u_pattern_tl: new e56.cj(t45), u_pattern_br: new e56.cj(t45), u_texsize: new e56.cj(t45), u_pattern_size: new e56.cj(t45), u_pixel_coord_upper: new e56.cj(t45), u_pixel_coord_lower: new e56.cj(t45), u_pattern_units_to_pixels: new e56.cj(t45) }), terrainRaster: (t45) => ({ u_matrix: new e56.ck(t45), u_image0: new e56.cg(t45), u_skirt_height: new e56.ci(t45), u_ground_shadow_factor: new e56.ch(t45) }), skybox: (t45) => ({ u_matrix: new e56.ck(t45), u_sun_direction: new e56.ch(t45), u_cubemap: new e56.cg(t45), u_opacity: new e56.ci(t45), u_temporal_offset: new e56.ci(t45) }), skyboxGradient: (t45) => ({ u_matrix: new e56.ck(t45), u_color_ramp: new e56.cg(t45), u_center_direction: new e56.ch(t45), u_radius: new e56.ci(t45), u_opacity: new e56.ci(t45), u_temporal_offset: new e56.ci(t45) }), skyboxCapture: (t45) => ({ u_matrix_3f: new e56.dy(t45), u_sun_direction: new e56.ch(t45), u_sun_intensity: new e56.ci(t45), u_color_tint_r: new e56.d2(t45), u_color_tint_m: new e56.d2(t45), u_luminance: new e56.ci(t45) }), globeRaster: (t45) => ({ u_proj_matrix: new e56.ck(t45), u_globe_matrix: new e56.ck(t45), u_normalize_matrix: new e56.ck(t45), u_merc_matrix: new e56.ck(t45), u_zoom_transition: new e56.ci(t45), u_merc_center: new e56.cj(t45), u_image0: new e56.cg(t45), u_grid_matrix: new e56.dy(t45), u_skirt_height: new e56.ci(t45), u_far_z_cutoff: new e56.ci(t45), u_frustum_tl: new e56.ch(t45), u_frustum_tr: new e56.ch(t45), u_frustum_br: new e56.ch(t45), u_frustum_bl: new e56.ch(t45), u_globe_pos: new e56.ch(t45), u_globe_radius: new e56.ci(t45), u_viewport: new e56.cj(t45) }), globeAtmosphere: (t45) => ({ u_frustum_tl: new e56.ch(t45), u_frustum_tr: new e56.ch(t45), u_frustum_br: new e56.ch(t45), u_frustum_bl: new e56.ch(t45), u_horizon: new e56.ci(t45), u_transition: new e56.ci(t45), u_fadeout_range: new e56.ci(t45), u_atmosphere_fog_color: new e56.d2(t45), u_high_color: new e56.d2(t45), u_space_color: new e56.d2(t45), u_temporal_offset: new e56.ci(t45), u_horizon_angle: new e56.ci(t45) }), model: (t45) => ({ u_matrix: new e56.ck(t45), u_lighting_matrix: new e56.ck(t45), u_normal_matrix: new e56.ck(t45), u_node_matrix: new e56.ck(t45), u_lightpos: new e56.ch(t45), u_lightintensity: new e56.ci(t45), u_lightcolor: new e56.ch(t45), u_camera_pos: new e56.ch(t45), u_opacity: new e56.ci(t45), u_baseColorFactor: new e56.d2(t45), u_emissiveFactor: new e56.d2(t45), u_metallicFactor: new e56.ci(t45), u_roughnessFactor: new e56.ci(t45), u_baseTextureIsAlpha: new e56.cg(t45), u_alphaMask: new e56.cg(t45), u_alphaCutoff: new e56.ci(t45), u_baseColorTexture: new e56.cg(t45), u_metallicRoughnessTexture: new e56.cg(t45), u_normalTexture: new e56.cg(t45), u_occlusionTexture: new e56.cg(t45), u_emissionTexture: new e56.cg(t45), u_lutTexture: new e56.cg(t45), u_color_mix: new e56.d2(t45), u_aoIntensity: new e56.ci(t45), u_emissive_strength: new e56.ci(t45), u_occlusionTextureTransform: new e56.d2(t45) }), modelDepth: (t45) => ({ u_matrix: new e56.ck(t45), u_instance: new e56.ck(t45), u_node_matrix: new e56.ck(t45) }), groundShadow: (t45) => ({ u_matrix: new e56.ck(t45), u_ground_shadow_factor: new e56.ch(t45) }), stars: (t45) => ({ u_matrix: new e56.ck(t45), u_up: new e56.ch(t45), u_right: new e56.ch(t45), u_intensity_multiplier: new e56.ci(t45) }), snowParticle: (t45) => ({ u_modelview: new e56.ck(t45), u_projection: new e56.ck(t45), u_time: new e56.ci(t45), u_cam_pos: new e56.ch(t45), u_velocityConeAperture: new e56.ci(t45), u_velocity: new e56.ci(t45), u_horizontalOscillationRadius: new e56.ci(t45), u_horizontalOscillationRate: new e56.ci(t45), u_boxSize: new e56.ci(t45), u_billboardSize: new e56.ci(t45), u_simpleShapeParameters: new e56.cj(t45), u_screenSize: new e56.cj(t45), u_thinningCenterPos: new e56.cj(t45), u_thinningShape: new e56.ch(t45), u_thinningAffectedRatio: new e56.ci(t45), u_thinningParticleOffset: new e56.ci(t45), u_particleColor: new e56.d2(t45), u_direction: new e56.ch(t45) }), rainParticle: (t45) => ({ u_modelview: new e56.ck(t45), u_projection: new e56.ck(t45), u_time: new e56.ci(t45), u_cam_pos: new e56.ch(t45), u_texScreen: new e56.cg(t45), u_velocityConeAperture: new e56.ci(t45), u_velocity: new e56.ci(t45), u_boxSize: new e56.ci(t45), u_rainDropletSize: new e56.cj(t45), u_distortionStrength: new e56.ci(t45), u_rainDirection: new e56.ch(t45), u_color: new e56.d2(t45), u_screenSize: new e56.cj(t45), u_thinningCenterPos: new e56.cj(t45), u_thinningShape: new e56.ch(t45), u_thinningAffectedRatio: new e56.ci(t45), u_thinningParticleOffset: new e56.ci(t45), u_shapeDirectionalPower: new e56.ci(t45), u_shapeNormalPower: new e56.ci(t45), u_mode: new e56.ci(t45) }), vignette: (t45) => ({ u_vignetteShape: new e56.ch(t45), u_vignetteColor: new e56.d2(t45) }), occlusion: (t45) => ({ u_matrix: new e56.ck(t45), u_anchorPos: new e56.ch(t45), u_screenSizePx: new e56.cj(t45), u_occluderSizePx: new e56.cj(t45), u_color: new e56.d2(t45) }) }; class zr { constructor(e57, t45, i26, o88) { this.id = zr.uniqueIdxCounter, zr.uniqueIdxCounter++, this.context = e57; const s18 = e57.gl; this.buffer = s18.createBuffer(), this.dynamicDraw = Boolean(i26), this.context.unbindVAO(), e57.bindElementBuffer.set(this.buffer), s18.bufferData(s18.ELEMENT_ARRAY_BUFFER, t45.arrayBuffer, this.dynamicDraw ? s18.DYNAMIC_DRAW : s18.STATIC_DRAW), this.dynamicDraw || o88 || t45.destroy(); } bind() { this.context.bindElementBuffer.set(this.buffer); } updateData(e57) { this.id = zr.uniqueIdxCounter, zr.uniqueIdxCounter++; const t45 = this.context.gl; this.context.unbindVAO(), this.bind(), t45.bufferSubData(t45.ELEMENT_ARRAY_BUFFER, 0, e57.arrayBuffer); } destroy() { this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); } } zr.uniqueIdxCounter = 0; const Or = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" }; class Mr { constructor(e57, t45, i26, o88, s18, r86) { this.length = t45.length, this.attributes = i26, this.itemSize = t45.bytesPerElement, this.dynamicDraw = o88, this.instanceCount = r86, this.context = e57; const n45 = e57.gl; this.buffer = n45.createBuffer(), e57.bindVertexBuffer.set(this.buffer), n45.bufferData(n45.ARRAY_BUFFER, t45.arrayBuffer, this.dynamicDraw ? n45.DYNAMIC_DRAW : n45.STATIC_DRAW), this.dynamicDraw || s18 || t45.destroy(); } bind() { this.context.bindVertexBuffer.set(this.buffer); } updateData(e57) { const t45 = this.context.gl; this.bind(), t45.bufferSubData(t45.ARRAY_BUFFER, 0, e57.arrayBuffer); } enableAttributes(e57, t45) { for (let i26 = 0; i26 < this.attributes.length; i26++) { const o88 = t45.getAttributeLocation(e57, this.attributes[i26].name); -1 !== o88 && e57.enableVertexAttribArray(o88); } } setVertexAttribPointers(e57, t45, i26) { for (let o88 = 0; o88 < this.attributes.length; o88++) { const s18 = this.attributes[o88], r86 = t45.getAttributeLocation(e57, s18.name); -1 !== r86 && e57.vertexAttribPointer(r86, s18.components, e57[Or[s18.type]], false, this.itemSize, s18.offset + this.itemSize * (i26 || 0)); } } setVertexAttribDivisor(e57, t45, i26) { for (let o88 = 0; o88 < this.attributes.length; o88++) { const s18 = t45.getAttributeLocation(e57, this.attributes[o88].name); -1 !== s18 && this.instanceCount && this.instanceCount > 0 && e57.vertexAttribDivisor(s18, i26); } } destroy() { this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); } } class Fr { constructor(e57, t45, i26, o88, s18) { this.context = e57, this.width = t45, this.height = i26; const r86 = this.framebuffer = e57.gl.createFramebuffer(); o88 && (this.colorAttachment = new Ls(e57, r86)), s18 && (this.depthAttachmentType = s18, this.depthAttachment = "renderbuffer" === s18 ? new Ps(e57, r86) : new zs(e57, r86)); } destroy() { const e57 = this.context.gl; if (this.colorAttachment) { const t45 = this.colorAttachment.get(); t45 && e57.deleteTexture(t45); } if (this.depthAttachment && this.depthAttachmentType) if ("renderbuffer" === this.depthAttachmentType) { const t45 = this.depthAttachment.get(); t45 && e57.deleteRenderbuffer(t45); } else { const t45 = this.depthAttachment.get(); t45 && e57.deleteTexture(t45); } e57.deleteFramebuffer(this.framebuffer); } } class Br { constructor(e57, t45) { this.gl = e57, this.clearColor = new Qo(this), this.clearDepth = new es(this), this.clearStencil = new ts(this), this.colorMask = new is(this), this.depthMask = new os(this), this.stencilMask = new ss(this), this.stencilFunc = new rs(this), this.stencilOp = new ns(this), this.stencilTest = new as(this), this.depthRange = new ls(this), this.depthTest = new cs(this), this.depthFunc = new hs(this), this.blend = new ds(this), this.blendFunc = new us(this), this.blendColor = new _s(this), this.blendEquation = new ps(this), this.cullFace = new fs(this), this.cullFaceSide = new ms(this), this.frontFace = new gs(this), this.program = new vs(this), this.activeTexture = new ys(this), this.viewport = new xs(this), this.bindFramebuffer = new bs(this), this.bindRenderbuffer = new ws(this), this.bindTexture = new Ts(this), this.bindVertexBuffer = new Es(this), this.bindElementBuffer = new Ss(this), this.bindVertexArrayOES = new Is(this), this.pixelStoreUnpack = new Cs(this), this.pixelStoreUnpackPremultiplyAlpha = new Rs(this), this.pixelStoreUnpackFlipY = new As(this), this.options = t45 ? Object.assign({}, t45) : {}, this.options.extTextureFilterAnisotropicForceOff || (this.extTextureFilterAnisotropic = e57.getExtension("EXT_texture_filter_anisotropic") || e57.getExtension("MOZ_EXT_texture_filter_anisotropic") || e57.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = e57.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))), this.extDebugRendererInfo = e57.getExtension("WEBGL_debug_renderer_info"), this.extDebugRendererInfo && (this.renderer = e57.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL), this.vendor = e57.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)), this.forceManualRenderingForInstanceIDShaders = t45 && !!t45.forceManualRenderingForInstanceIDShaders || this.renderer && -1 !== this.renderer.indexOf("PowerVR"), this.options.extTextureFloatLinearForceOff || (this.extTextureFloatLinear = e57.getExtension("OES_texture_float_linear")), this.extRenderToTextureHalfFloat = e57.getExtension("EXT_color_buffer_half_float"), this.extTimerQuery = e57.getExtension("EXT_disjoint_timer_query_webgl2"), this.maxTextureSize = e57.getParameter(e57.MAX_TEXTURE_SIZE), this.maxPointSize = e57.getParameter(e57.ALIASED_POINT_SIZE_RANGE)[1]; } setDefault() { this.unbindVAO(), this.clearColor.setDefault(), this.clearDepth.setDefault(), this.clearStencil.setDefault(), this.colorMask.setDefault(), this.depthMask.setDefault(), this.stencilMask.setDefault(), this.stencilFunc.setDefault(), this.stencilOp.setDefault(), this.stencilTest.setDefault(), this.depthRange.setDefault(), this.depthTest.setDefault(), this.depthFunc.setDefault(), this.blend.setDefault(), this.blendFunc.setDefault(), this.blendColor.setDefault(), this.blendEquation.setDefault(), this.cullFace.setDefault(), this.cullFaceSide.setDefault(), this.frontFace.setDefault(), this.program.setDefault(), this.activeTexture.setDefault(), this.bindFramebuffer.setDefault(), this.pixelStoreUnpack.setDefault(), this.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.pixelStoreUnpackFlipY.setDefault(); } setDirty() { this.clearColor.dirty = true, this.clearDepth.dirty = true, this.clearStencil.dirty = true, this.colorMask.dirty = true, this.depthMask.dirty = true, this.stencilMask.dirty = true, this.stencilFunc.dirty = true, this.stencilOp.dirty = true, this.stencilTest.dirty = true, this.depthRange.dirty = true, this.depthTest.dirty = true, this.depthFunc.dirty = true, this.blend.dirty = true, this.blendFunc.dirty = true, this.blendColor.dirty = true, this.blendEquation.dirty = true, this.cullFace.dirty = true, this.cullFaceSide.dirty = true, this.frontFace.dirty = true, this.program.dirty = true, this.activeTexture.dirty = true, this.viewport.dirty = true, this.bindFramebuffer.dirty = true, this.bindRenderbuffer.dirty = true, this.bindTexture.dirty = true, this.bindVertexBuffer.dirty = true, this.bindElementBuffer.dirty = true, this.bindVertexArrayOES.dirty = true, this.pixelStoreUnpack.dirty = true, this.pixelStoreUnpackPremultiplyAlpha.dirty = true, this.pixelStoreUnpackFlipY.dirty = true; } createIndexBuffer(e57, t45, i26) { return new zr(this, e57, t45, i26); } createVertexBuffer(e57, t45, i26, o88, s18) { return new Mr(this, e57, t45, i26, o88, s18); } createRenderbuffer(e57, t45, i26) { const o88 = this.gl, s18 = o88.createRenderbuffer(); return this.bindRenderbuffer.set(s18), o88.renderbufferStorage(o88.RENDERBUFFER, e57, t45, i26), this.bindRenderbuffer.set(null), s18; } createFramebuffer(e57, t45, i26, o88) { return new Fr(this, e57, t45, i26, o88); } clear({ color: e57, depth: t45, stencil: i26, colorMask: o88 }) { const s18 = this.gl; let r86 = 0; e57 && (r86 |= s18.COLOR_BUFFER_BIT, this.clearColor.set(e57.toNonPremultipliedRenderColor(null)), this.colorMask.set(o88 || [true, true, true, true])), void 0 !== t45 && (r86 |= s18.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(t45), this.depthMask.set(true)), void 0 !== i26 && (r86 |= s18.STENCIL_BUFFER_BIT, this.clearStencil.set(i26), this.stencilMask.set(255)), s18.clear(r86); } setCullFace(e57) { false === e57.enable ? this.cullFace.set(false) : (this.cullFace.set(true), this.cullFaceSide.set(e57.mode), this.frontFace.set(e57.frontFace)); } setDepthMode(e57) { e57.func !== this.gl.ALWAYS || e57.mask ? (this.depthTest.set(true), this.depthFunc.set(e57.func), this.depthMask.set(e57.mask), this.depthRange.set(e57.range)) : this.depthTest.set(false); } setStencilMode(e57) { e57.test.func !== this.gl.ALWAYS || e57.mask ? (this.stencilTest.set(true), this.stencilMask.set(e57.mask), this.stencilOp.set([e57.fail, e57.depthFail, e57.pass]), this.stencilFunc.set({ func: e57.test.func, ref: e57.ref, mask: e57.test.mask })) : this.stencilTest.set(false); } setColorMode(t45) { e56.by(t45.blendFunction, Ui.Replace) ? this.blend.set(false) : (this.blend.set(true), this.blendFunc.set(t45.blendFunction), this.blendColor.set(t45.blendColor), t45.blendEquation ? this.blendEquation.set(t45.blendEquation) : this.blendEquation.setDefault()), this.colorMask.set(t45.mask); } unbindVAO() { this.bindVertexArrayOES.set(null); } } let kr; function Nr(t45, i26, o88, s18, r86, n45, a46) { const l21 = t45.context, c28 = l21.gl, h8 = t45.transform, d34 = [e56.aF(h8.center.lng), e56.aJ(h8.center.lat)], u12 = o88.layout.get("symbol-placement"), _4 = o88.layout.get("text-variable-anchor"), p9 = "map" === o88.layout.get("icon-rotation-alignment"), f8 = "map" === o88.layout.get("text-rotation-alignment"), m6 = "point" !== u12, g9 = []; let v8 = 0, y4 = 0; for (let l22 = 0; l22 < s18.length; l22++) { const u13 = s18[l22], x5 = i26.getTile(u13), b9 = x5.getBucket(o88); if (!b9) continue; const w5 = b9.getProjection().createInversionMatrix(h8, u13.canonical), T6 = [], E6 = Ht2(u13, b9, h8), S6 = !a46 && p9 && m6, I4 = a46 && f8 && m6, C6 = _4 && b9.hasTextData(), R5 = b9.hasIconTextFit() && C6 && b9.hasIconData(), A4 = S6 || I4 || a46 && C6 || R5, D5 = "globe" === b9.projection.name, L3 = D5 ? e56.aj(h8.zoom) : 0; D5 && (T6.push("PROJECTION_GLOBE_VIEW"), A4 && T6.push("PROJECTED_POS_ON_VIEWPORT")); const P4 = t45.getOrCreateProgram("collisionBox", { defines: T6 }); let z4 = E6; 0 === r86[0] && 0 === r86[1] || (z4 = t45.translatePosMatrix(E6, x5, r86, n45)); const O4 = a46 ? b9.textCollisionBox : b9.iconCollisionBox, M5 = b9.collisionCircleArray; if (M5.length > 0) { const t46 = e56.bC(), i27 = z4; e56.cO(t46, b9.placementInvProjMatrix, h8.glCoordMatrix), e56.cO(t46, t46, b9.placementViewportMatrix), g9.push({ circleArray: M5, circleOffset: y4, transform: i27, invTransform: t46, projection: b9.getProjection() }), v8 += M5.length / 4, y4 = v8; } if (!O4) continue; t45.terrain && t45.terrain.setupElevationDraw(x5, P4); const F17 = D5 ? [u13.canonical.x, u13.canonical.y, 1 << u13.canonical.z] : [0, 0, 0]; P4.draw(t45, c28.LINES, ji.disabled, Gi.disabled, t45.colorModeForRenderPass(), Zi.disabled, _r(z4, w5, h8, L3, d34, x5, F17, b9.getProjection()), o88.id, O4.layoutVertexBuffer, O4.indexBuffer, O4.segments, null, h8.zoom, null, [O4.collisionVertexBuffer, O4.collisionVertexBufferExt]); } if (!a46 || !g9.length) return; const x4 = t45.getOrCreateProgram("collisionCircle"), b8 = new e56.dW(); b8.resize(4 * v8), b8._trim(); let w4 = 0; for (const e57 of g9) for (let t46 = 0; t46 < e57.circleArray.length / 4; t46++) { const i27 = 4 * t46, o89 = e57.circleArray[i27 + 0], s19 = e57.circleArray[i27 + 1], r87 = e57.circleArray[i27 + 2], n46 = e57.circleArray[i27 + 3]; b8.emplace(w4++, o89, s19, r87, n46, 0), b8.emplace(w4++, o89, s19, r87, n46, 1), b8.emplace(w4++, o89, s19, r87, n46, 2), b8.emplace(w4++, o89, s19, r87, n46, 3); } (!kr || kr.length < 2 * v8) && (kr = (function(t46) { const i27 = 2 * t46, o89 = new e56.b1(); o89.resize(i27), o89._trim(); for (let e57 = 0; e57 < i27; e57++) { const t47 = 6 * e57; o89.uint16[t47 + 0] = 4 * e57 + 0, o89.uint16[t47 + 1] = 4 * e57 + 1, o89.uint16[t47 + 2] = 4 * e57 + 2, o89.uint16[t47 + 3] = 4 * e57 + 2, o89.uint16[t47 + 4] = 4 * e57 + 3, o89.uint16[t47 + 5] = 4 * e57 + 0; } return o89; })(v8)); const T5 = l21.createIndexBuffer(kr, true), E5 = l21.createVertexBuffer(b8, e56.dX.members, true); for (const i27 of g9) { const s19 = { u_matrix: i27.transform, u_inv_matrix: i27.invTransform, u_camera_to_center_distance: (S5 = h8).getCameraToCenterDistance(i27.projection), u_viewport_size: [S5.width, S5.height] }; x4.draw(t45, c28.TRIANGLES, ji.disabled, Gi.disabled, t45.colorModeForRenderPass(), Zi.disabled, s19, o88.id, E5, T5, e56.bg.simpleSegment(0, 2 * i27.circleOffset, i27.circleArray.length, i27.circleArray.length / 2), null, h8.zoom); } var S5; E5.destroy(), T5.destroy(); } const Ur = e56.bC(); function jr(t45) { const i26 = t45._camera.getWorldToCamera(t45.worldSize, 1), o88 = e56.aB([], i26, t45.globeMatrix); e56.bl(o88, o88); const s18 = [0, 0, 0], r86 = [0, 1, 0, 0]; return e56.aC(r86, r86, o88), s18[0] = r86[0], s18[1] = r86[1], s18[2] = r86[2], e56.aw(s18, s18), s18; } function Vr({ width: t45, height: i26, anchor: o88, textOffset: s18, textScale: r86 }, n45) { const { horizontalAlign: a46, verticalAlign: l21 } = e56.c0(o88), c28 = -(a46 - 0.5) * t45, h8 = -(l21 - 0.5) * i26, d34 = e56.c1(o88, s18); return new e56.P((c28 / r86 + d34[0]) * n45, (h8 / r86 + d34[1]) * n45); } function Gr(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8) { const d34 = t45.text.placedSymbolArray, u12 = t45.text.dynamicLayoutVertexArray, _4 = t45.icon.dynamicLayoutVertexArray, p9 = {}, f8 = t45.getProjection(), m6 = qt(a46, f8, r86), g9 = r86.elevation, v8 = f8.upVectorScale(a46.canonical, r86.center.lat, r86.worldSize).metersToTile; u12.clear(); for (let _5 = 0; _5 < d34.length; _5++) { const y4 = d34.get(_5), { tileAnchorX: x4, tileAnchorY: b8, numGlyphs: w4 } = y4, T5 = y4.hidden || !y4.crossTileID || t45.allowVerticalPlacement && !y4.placedOrientation ? null : s18[y4.crossTileID]; if (T5) { let s19 = 0, d35 = 0, _6 = 0; if (g9) { const e57 = g9 ? g9.getAtTileOffset(a46, x4, b8) : 0, [t46, i27, o89] = f8.upVector(a46.canonical, x4, b8); s19 = e57 * t46 * v8, d35 = e57 * i27 * v8, _6 = e57 * o89 * v8; } let [E5, S5, I4, C6] = Qt2(y4.projectedAnchorX + s19, y4.projectedAnchorY + d35, y4.projectedAnchorZ + _6, o88 ? m6 : n45); const R5 = ei(r86.getCameraToCenterDistance(f8), C6); let A4 = e56.bM(t45.textSizeData, c28, y4) * R5 / e56.bX; o88 && (A4 *= t45.tilePixelRatio / l21); const D5 = Vr(T5, A4); o88 ? ({ x: E5, y: S5, z: I4 } = f8.projectTilePoint(x4 + D5.x, b8 + D5.y, a46.canonical), [E5, S5, I4] = Qt2(E5 + s19, S5 + d35, I4 + _6, n45)) : (i26 && D5._rotate(-r86.angle), E5 += D5.x, S5 += D5.y, I4 = 0); const L3 = t45.allowVerticalPlacement && y4.placedOrientation === e56.bL.vertical ? Math.PI / 2 : 0; for (let t46 = 0; t46 < w4; t46++) e56.bO(u12, E5, S5, I4, L3); h8 && y4.associatedIconIndex >= 0 && (p9[y4.associatedIconIndex] = { x: E5, y: S5, z: I4, angle: L3 }); } else ci(w4, u12); } if (h8) { _4.clear(); const i27 = t45.icon.placedSymbolArray; for (let t46 = 0; t46 < i27.length; t46++) { const o89 = i27.get(t46), { numGlyphs: s19 } = o89, r87 = p9[t46]; if (o89.hidden || !r87) ci(s19, _4); else { const { x: t47, y: i28, z: o90, angle: n46 } = r87; for (let r88 = 0; r88 < s19; r88++) e56.bO(_4, t47, i28, o90, n46); } } t45.icon.dynamicLayoutVertexBuffer.updateData(_4); } t45.text.dynamicLayoutVertexBuffer.updateData(u12); } function Hr(t45, i26, o88, s18, r86, n45, a46 = {}) { const l21 = o88.paint.get("icon-translate"), c28 = o88.paint.get("text-translate"), h8 = o88.paint.get("icon-translate-anchor"), d34 = o88.paint.get("text-translate-anchor"), u12 = o88.layout.get("icon-rotation-alignment"), _4 = o88.layout.get("text-rotation-alignment"), p9 = o88.layout.get("icon-pitch-alignment"), f8 = o88.layout.get("text-pitch-alignment"), m6 = o88.layout.get("icon-keep-upright"), g9 = o88.layout.get("text-keep-upright"), v8 = o88.paint.get("icon-color-saturation"), y4 = o88.paint.get("icon-color-contrast"), x4 = o88.paint.get("icon-color-brightness-min"), b8 = o88.paint.get("icon-color-brightness-max"), w4 = "sea" === o88.layout.get("symbol-elevation-reference"), T5 = "none" === o88.layout.get("icon-image-use-theme"), E5 = t45.context, S5 = E5.gl, I4 = t45.transform, C6 = "map" === u12, R5 = "map" === _4, A4 = "map" === p9, D5 = "map" === f8, L3 = void 0 !== o88.layout.get("symbol-sort-key").constantOr(1); let P4 = false; const z4 = t45.depthModeForSublayer(0, ji.ReadOnly), O4 = new ji(t45.context.gl.LEQUAL, ji.ReadOnly, t45.depthRangeFor3D), M5 = [e56.aF(I4.center.lng), e56.aJ(I4.center.lat)], F17 = o88.layout.get("text-variable-anchor"), B6 = "globe" === I4.projection.name, k7 = [], N5 = [0, -1, 0]; for (const r87 of s18) { const s19 = i26.getTile(r87), n46 = s19.getBucket(o88); if (!n46) continue; if ("mercator" === n46.projection.name && B6) continue; if (n46.fullyClipped) continue; const u13 = "globe" === n46.projection.name, _5 = u13 ? e56.aj(I4.zoom) : 0, p10 = qt(r87, n46.getProjection(), I4), f9 = I4.calculatePixelsToTileUnitsMatrix(s19), U4 = F17 && n46.hasTextData(), j4 = n46.hasIconTextFit() && U4 && n46.hasIconData(), V4 = n46.getProjection().createInversionMatrix(I4, r87.canonical), G5 = (1 << s19.tileID.canonical.z) * e56.al / t45.transform.worldSize, H4 = (e57) => { let i27 = [0, 0, 0]; if (e57) { const e58 = t45.style.directionalLight, o89 = t45.style.ambientLight; e58 && o89 && (i27 = co(t45.style, e58, o89)); } return i27; }, q3 = (e57) => { I4.depthOcclusionForSymbolsAndCircles && (o88.hasOcclusionOpacityProperties || t45.terrain) && (e57.push("DEPTH_D24"), e57.push("DEPTH_OCCLUSION")); }, Z3 = (i27) => { o88.lut && !T5 && (o88.lut.texture || (o88.lut.texture = new e56.dY(t45.context, o88.lut.image, [o88.lut.image.height, o88.lut.image.height, o88.lut.image.height], E5.gl.RGBA8)), E5.activeTexture.set(E5.gl.TEXTURE0 + Ji.LUT), o88.lut.texture && o88.lut.texture.bind(E5.gl.LINEAR, E5.gl.CLAMP_TO_EDGE), i27.push("APPLY_LUT_ON_GPU")); }, W4 = () => { const i27 = C6 && "point" !== o88.layout.get("symbol-placement"), a47 = []; q3(a47), Z3(a47); const c29 = i27 || j4, d35 = "road" === n46.elevationType, g10 = t45.shadowRenderer, T6 = d35 && A4 && !!g10 && g10.enabled, E6 = H4(T6), R6 = d35 && A4 && !t45.terrain ? O4 : z4, D6 = o88.paint.get("icon-image-cross-fade"); t45.terrainRenderModeElevated() && A4 && a47.push("PITCH_WITH_MAP_TERRAIN"), u13 && (a47.push("PROJECTION_GLOBE_VIEW"), c29 && a47.push("PROJECTED_POS_ON_VIEWPORT")), D6 > 0 && n46.hasAnySecondaryIcon && a47.push("ICON_TRANSITION"), !n46.icon.zOffsetVertexBuffer || d35 && t45.terrain || a47.push("Z_OFFSET"), 0 === v8 && 0 === y4 && 0 === x4 && 1 === b8 || a47.push("COLOR_ADJUSTMENT"), n46.sdfIcons && a47.push("RENDER_SDF"), T6 && a47.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET"), d35 && A4 && !t45.terrain && n46.icon.orientationVertexBuffer && a47.push("ELEVATED_ROADS"); const L4 = n46.icon.programConfigurations.get(o88.id), P5 = t45.getOrCreateProgram("symbol", { config: L4, defines: a47 }), F18 = s19.imageAtlasTexture ? s19.imageAtlasTexture.size : [0, 0], k8 = n46.iconSizeData, U5 = e56.bK(k8, I4.zoom), W5 = A4 || !I4.isOrthographic, $6 = Yt2(p10, s19.tileID.canonical, A4, C6, I4, n46.getProjection(), f9), X4 = Jt2(p10, s19.tileID.canonical, A4, C6, I4, n46.getProjection(), f9), Y7 = t45.translatePosMatrix(X4, s19, l21, h8, true), K6 = t45.translatePosMatrix(p10, s19, l21, h8), J5 = c29 ? Ur : $6, Q6 = C6 && !A4 && !i27; let ee4 = N5; !B6 && !I4.mercatorFromTransition || C6 || (ee4 = jr(I4)); const te2 = u13 ? ee4 : N5, ie3 = o88.getColorAdjustmentMatrix(v8, y4, x4, b8), oe4 = Ir(k8.kind, U5, Q6, A4, t45, K6, J5, Y7, w4, false, F18, [0, 0], 0, r87, _5, M5, V4, te2, n46.getProjection(), E6, G5, ie3, D6, null), se2 = s19.imageAtlasTexture ? s19.imageAtlasTexture : null, re3 = 1 !== o88.layout.get("icon-size").constantOr(0) || n46.iconsNeedLinear, ne3 = n46.sdfIcons || t45.options.rotating || t45.options.zooming || re3 || W5 ? S5.LINEAR : S5.NEAREST, ae3 = n46.sdfIcons && 0 !== o88.paint.get("icon-halo-width").constantOr(1), le3 = t45.terrain && A4 && i27 ? e56.bl(e56.bC(), $6) : Ur; if (i27 && n46.icon) { const e57 = I4.elevation, i28 = e57 ? e57.getAtTileOffsetFunc(r87, I4.center.lat, I4.worldSize, n46.getProjection()) : null, o89 = Kt2(p10, s19.tileID.canonical, A4, C6, I4, n46.getProjection(), f9); ii(n46, p10, t45, false, o89, X4, A4, m6, i28, r87); } return { program: P5, buffers: n46.icon, uniformValues: oe4, atlasTexture: se2, atlasTextureIcon: null, atlasInterpolation: ne3, atlasInterpolationIcon: null, isSDF: n46.sdfIcons, hasHalo: ae3, depthMode: R6, tile: s19, renderWithShadows: T6, labelPlaneMatrixInv: le3 }; }, $5 = () => { const i27 = R5 && "point" !== o88.layout.get("symbol-placement"), a47 = [], l22 = i27 || F17 || j4, h9 = "road" === n46.elevationType, m7 = t45.shadowRenderer, v9 = h9 && D5 && !!m7 && m7.enabled, y5 = H4(v9), x5 = h9 && D5 && !t45.terrain ? O4 : z4; t45.terrainRenderModeElevated() && D5 && a47.push("PITCH_WITH_MAP_TERRAIN"), u13 && (a47.push("PROJECTION_GLOBE_VIEW"), l22 && a47.push("PROJECTED_POS_ON_VIEWPORT")), !n46.text.zOffsetVertexBuffer || h9 && t45.terrain || a47.push("Z_OFFSET"), n46.iconsInText && a47.push("RENDER_TEXT_AND_SYMBOL"), a47.push("RENDER_SDF"), v9 && a47.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET"), h9 && D5 && !t45.terrain && n46.text.orientationVertexBuffer && a47.push("ELEVATED_ROADS"), q3(a47); const b9 = n46.text.programConfigurations.get(o88.id), T6 = t45.getOrCreateProgram("symbol", { config: b9, defines: a47 }); let E6, C7 = [0, 0], A5 = null; const L4 = n46.textSizeData; n46.iconsInText && (C7 = s19.imageAtlasTexture ? s19.imageAtlasTexture.size : [0, 0], A5 = s19.imageAtlasTexture ? s19.imageAtlasTexture : null, E6 = D5 || !I4.isOrthographic || t45.options.rotating || t45.options.zooming || "composite" === L4.kind || "camera" === L4.kind ? S5.LINEAR : S5.NEAREST); const P5 = s19.glyphAtlasTexture ? s19.glyphAtlasTexture.size : [0, 0], k8 = o88.layout.get("text-size-scale-range"), U5 = e56.aA(t45.scaleFactor, k8[0], k8[1]), Z4 = e56.bK(L4, I4.zoom, U5), W5 = Yt2(p10, s19.tileID.canonical, D5, R5, I4, n46.getProjection(), f9), $6 = Jt2(p10, s19.tileID.canonical, D5, R5, I4, n46.getProjection(), f9), X4 = t45.translatePosMatrix($6, s19, c28, d34, true), Y7 = t45.translatePosMatrix(p10, s19, c28, d34), K6 = l22 ? Ur : W5, J5 = R5 && !D5 && !i27; let Q6 = N5; !B6 && !I4.mercatorFromTransition || R5 || (Q6 = jr(I4)); const ee4 = Ir(L4.kind, Z4, J5, D5, t45, Y7, K6, X4, w4, true, P5, C7, 0, r87, _5, M5, V4, u13 ? Q6 : N5, n46.getProjection(), y5, G5, null, null, U5), te2 = s19.glyphAtlasTexture ? s19.glyphAtlasTexture : null, ie3 = S5.LINEAR, oe4 = 0 !== o88.paint.get("text-halo-width").constantOr(1), se2 = t45.terrain && D5 && i27 ? e56.bl(e56.bC(), W5) : Ur; if (i27 && n46.text) { const e57 = I4.elevation, i28 = e57 ? e57.getAtTileOffsetFunc(r87, I4.center.lat, I4.worldSize, n46.getProjection()) : null, o89 = Kt2(p10, s19.tileID.canonical, D5, R5, I4, n46.getProjection(), f9); ii(n46, p10, t45, true, o89, $6, D5, g9, i28, r87); } return { program: T6, buffers: n46.text, uniformValues: ee4, atlasTexture: te2, atlasTextureIcon: A5, atlasInterpolation: ie3, atlasInterpolationIcon: E6, isSDF: true, hasHalo: oe4, depthMode: x5, tile: s19, renderWithShadows: v9, labelPlaneMatrixInv: se2 }; }, X3 = n46.icon.segments.get().length, Y6 = n46.text.segments.get().length, K5 = X3 && !a46.onlyText ? W4() : null, J4 = Y6 && !a46.onlyIcons ? $5() : null, Q5 = o88.paint.get("icon-opacity").constantOr(1), ee3 = o88.paint.get("text-opacity").constantOr(1); if (L3 && n46.canOverlap) { P4 = true; const t46 = Q5 && !a46.onlyText ? n46.icon.segments.get() : [], i27 = ee3 && !a46.onlyIcons ? n46.text.segments.get() : []; for (const i28 of t46) k7.push({ segments: new e56.bg([i28]), sortKey: i28.sortKey, state: K5 }); for (const t47 of i27) k7.push({ segments: new e56.bg([t47]), sortKey: t47.sortKey, state: J4 }); } else a46.onlyText || k7.push({ segments: Q5 ? n46.icon.segments : new e56.bg([]), sortKey: 0, state: K5 }), a46.onlyIcons || k7.push({ segments: ee3 ? n46.text.segments : new e56.bg([]), sortKey: 0, state: J4 }); } P4 && k7.sort(((e57, t46) => e57.sortKey - t46.sortKey)); for (const e57 of k7) { const i27 = e57.state; if (i27) if (t45.terrain ? t45.terrain.setupElevationDraw(i27.tile, i27.program, { useDepthForOcclusion: I4.depthOcclusionForSymbolsAndCircles, labelPlaneMatrixInv: i27.labelPlaneMatrixInv }) : t45.setupDepthForOcclusion(I4.depthOcclusionForSymbolsAndCircles, i27.program), E5.activeTexture.set(S5.TEXTURE0), i27.atlasTexture && i27.atlasTexture.bind(i27.atlasInterpolation, S5.CLAMP_TO_EDGE, true), i27.atlasTextureIcon && (E5.activeTexture.set(S5.TEXTURE1), i27.atlasTextureIcon && i27.atlasTextureIcon.bind(i27.atlasInterpolationIcon, S5.CLAMP_TO_EDGE, true)), i27.renderWithShadows && t45.shadowRenderer.setupShadows(i27.tile.tileID.toUnwrapped(), i27.program, "vector-tile"), t45.uploadCommonLightUniforms(t45.context, i27.program), i27.hasHalo) { const s19 = i27.uniformValues; s19.u_is_halo = 1, qr(i27.buffers, e57.segments, o88, t45, i27.program, i27.depthMode, r86, n45, s19, 2), s19.u_is_halo = 0; } else { if (i27.isSDF) { const s19 = i27.uniformValues; i27.hasHalo && (s19.u_is_halo = 1, qr(i27.buffers, e57.segments, o88, t45, i27.program, i27.depthMode, r86, n45, s19, 1)), s19.u_is_halo = 0; } qr(i27.buffers, e57.segments, o88, t45, i27.program, i27.depthMode, r86, n45, i27.uniformValues, 1); } } } function qr(e57, t45, i26, o88, s18, r86, n45, a46, l21, c28) { const h8 = [e57.dynamicLayoutVertexBuffer, e57.opacityVertexBuffer, e57.iconTransitioningVertexBuffer, e57.globeExtVertexBuffer, e57.zOffsetVertexBuffer, e57.orientationVertexBuffer]; s18.draw(o88, o88.context.gl.TRIANGLES, r86, n45, a46, Zi.disabled, l21, i26.id, e57.layoutVertexBuffer, e57.indexBuffer, t45, i26.paint, o88.transform.zoom, e57.programConfigurations.get(i26.id), h8, c28); } function Zr(t45, i26) { const o88 = 1 << t45.canonical.z, s18 = (i26.x * o88 - t45.canonical.x - t45.wrap * o88) * e56.al, r86 = (i26.y * o88 - t45.canonical.y) * e56.al, n45 = e56.e5(i26.z, i26.y); return e56.d4(s18, r86, n45); } function Wr(t45, i26, o88, s18, r86) { if (!o88.layout || "none" === o88.layout.get("fill-elevation-reference")) return; const n45 = t45.context.gl, a46 = new ji(t45.context.gl.LEQUAL, ji.ReadWrite, t45.depthRangeFor3D), l21 = new ji(t45.context.gl.GREATER, ji.ReadWrite, t45.depthRangeFor3D), c28 = (function(t46) { let i27 = 0.01; return t46.isOrthographic && (i27 = e56.ak(1e-4, i27, e56.c$(t46.pitch >= eo ? 1 : t46.pitch / eo))), 2 * i27; })(t45.transform), h8 = t45.transform.getFreeCameraOptions().position, d34 = "elevatedStructuresDepthReconstruct", u12 = t45.getOrCreateProgram(d34, { defines: ["DEPTH_RECONSTRUCTION"] }), _4 = t45.getOrCreateProgram(d34); for (const e57 of s18) { const s19 = i26.getTile(e57), d35 = s19.getBucket(o88); if (!d35) continue; const p9 = d35.elevatedStructures; if (!p9) continue; const f8 = d35.elevationBufferData.heightRange, m6 = Zr(e57.toUnwrapped(), h8), g9 = t45.translatePosMatrix(e57.projMatrix, s19, o88.paint.get("fill-translate"), o88.paint.get("fill-translate-anchor")); let v8, y4, x4, b8; if ("initialize" === r86) { if (!f8 || f8.min >= 1 || 0 === p9.depthSegments.segments[0].primitiveLength) continue; v8 = cr(g9, m6, c28, 1, 0), y4 = a46, x4 = p9.depthSegments, b8 = u12; } else if ("reset" === r86) { if (!f8 || f8.min >= 0 || 0 === p9.maskSegments.segments[0].primitiveLength) continue; v8 = cr(g9, m6, 0, 0, 1), y4 = l21, x4 = p9.maskSegments, b8 = u12; } else if ("geometry" === r86) { if (0 === p9.depthSegments.segments[0].primitiveLength) continue; v8 = cr(g9, m6, c28, 1, 0), y4 = a46, x4 = p9.depthSegments, b8 = _4; } b8.draw(t45, n45.TRIANGLES, y4, Gi.disabled, Ui.disabled, Zi.disabled, v8, o88.id, p9.vertexBuffer, p9.indexBuffer, x4, o88.paint, t45.transform.zoom); } } function $r(t45, i26, o88) { const { painter: s18, sourceCache: r86, layer: n45, coords: a46, colorMode: l21, elevationType: c28, terrainEnabled: h8, pass: d34 } = t45, u12 = s18.context.gl, _4 = n45.paint.get("fill-pattern"), p9 = n45.paint.get("fill-pattern-cross-fade"), f8 = _4.constantOr(null); let m6 = c28; "road" !== c28 || i26 && !h8 || (m6 = "none"); const g9 = "road" === m6, v8 = t45.painter.shadowRenderer, y4 = g9 && !!v8 && v8.enabled, x4 = new ji(s18.context.gl.LEQUAL, ji.ReadOnly, s18.depthRangeFor3D); let b8 = [0, 0, 0]; if (y4) { const e57 = s18.style.directionalLight, t46 = s18.style.ambientLight; e57 && t46 && (b8 = co(s18.style, e57, t46)); } const w4 = _4 && _4.constantOr(1), T5 = (t46, d35) => { let _5, m7, T6, E5, S5; d35 ? (_5 = w4 && !n45.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", T6 = u12.LINES) : (_5 = w4 ? "fillPattern" : "fill", T6 = u12.TRIANGLES); for (const I4 of a46) { const a47 = r86.getTile(I4); if (w4 && !a47.patternsLoaded()) continue; const C6 = a47.getBucket(n45); if (!C6) continue; const R5 = i26 ? C6.elevationBufferData : C6.bufferData; if (R5.isEmpty()) continue; s18.prepareDrawTile(); const A4 = R5.programConfigurations.get(n45.id), D5 = s18.isTileAffectedByFog(I4), L3 = [], P4 = []; g9 && (L3.push("ELEVATED_ROADS"), P4.push(R5.elevatedLayoutVertexBuffer)), y4 && L3.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET"), w4 && (s18.context.activeTexture.set(u12.TEXTURE0), a47.imageAtlasTexture && a47.imageAtlasTexture.bind(u12.LINEAR, u12.CLAMP_TO_EDGE), A4.updatePaintBuffers()); let z4 = false; if (f8 && a47.imageAtlas) { const t47 = a47.imageAtlas, i27 = e56.e0.from(f8), o89 = i27.getPrimary().scaleSelf(e56.o.devicePixelRatio).toString(), s19 = i27.getSecondary(), r87 = t47.patternPositions.get(o89), n46 = s19 ? t47.patternPositions.get(s19.scaleSelf(e56.o.devicePixelRatio).toString()) : null; z4 = !!r87 && !!n46, r87 && A4.setConstantPatternPositions(r87, n46); } p9 > 0 && (z4 || A4.getPatternTransitionVertexBuffer("fill-pattern")) && L3.push("FILL_PATTERN_TRANSITION"); const O4 = s18.getOrCreateProgram(_5, { config: A4, overrideFog: D5, defines: L3 }), M5 = s18.translatePosMatrix(I4.projMatrix, a47, n45.paint.get("fill-translate"), n45.paint.get("fill-translate-anchor")); y4 && v8.setupShadows(a47.tileID.toUnwrapped(), O4, "vector-tile"); const F17 = n45.paint.get("fill-emissive-strength"); if (d35) { E5 = R5.lineIndexBuffer, S5 = R5.lineSegments; const e57 = s18.terrain && s18.terrain.renderingToTexture ? s18.terrain.drapeBufferSize : [u12.drawingBufferWidth, u12.drawingBufferHeight]; m7 = "fillOutlinePattern" === _5 && w4 ? ar2(M5, F17, s18, a47, e57, b8, p9) : nr(M5, F17, e57, b8); } else E5 = R5.indexBuffer, S5 = R5.triangleSegments, m7 = w4 ? rr2(M5, F17, s18, a47, b8, p9) : sr(M5, F17, b8); s18.uploadCommonUniforms(s18.context, O4, I4.toUnwrapped()); let B6 = t46; ("road" === c28 && !h8 || "offset" === c28) && (B6 = x4), O4.draw(s18, T6, B6, o88 || s18.stencilModeForClipping(I4), l21, Zi.disabled, m7, n45.id, R5.layoutVertexBuffer, E5, S5, n45.paint, s18.transform.zoom, A4, P4); } }; s18.renderPass === d34 && T5(s18.depthModeForSublayer(1, "opaque" === s18.renderPass ? ji.ReadWrite : ji.ReadOnly), false), "none" === m6 && "translucent" === s18.renderPass && n45.paint.get("fill-antialias") && T5(s18.depthModeForSublayer(n45.getPaintProperty("fill-outline-color") ? 2 : 0, ji.ReadOnly), true); } function Xr(t45, i26, o88, s18, r86, n45, a46, l21) { o88.resetLayerRenderingStats(t45); const c28 = t45.context, h8 = c28.gl, d34 = t45.transform, u12 = o88.paint.get("fill-extrusion-pattern"), _4 = o88.paint.get("fill-extrusion-pattern-cross-fade"), p9 = u12.constantOr(null), f8 = u12.constantOr(1), m6 = o88.paint.get("fill-extrusion-opacity"), g9 = t45.style.enable3dLights(), v8 = o88.paint.get(g9 && !f8 ? "fill-extrusion-ambient-occlusion-wall-radius" : "fill-extrusion-ambient-occlusion-radius"), y4 = [o88.paint.get("fill-extrusion-ambient-occlusion-intensity"), v8], x4 = o88.layout.get("fill-extrusion-edge-radius"), b8 = x4 > 0 && !o88.paint.get("fill-extrusion-rounded-roof"), w4 = b8 ? 0 : x4, T5 = "globe" === d34.projection.name ? e56.e8() : 0, E5 = "globe" === d34.projection.name, S5 = E5 ? e56.aj(d34.zoom) : 0, I4 = [e56.aF(d34.center.lng), e56.aJ(d34.center.lat)], C6 = "none" === o88.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"), R5 = o88.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(C6 ? null : o88.lut).toArray01().slice(0, 3), A4 = o88.paint.get("fill-extrusion-flood-light-intensity"), D5 = o88.paint.get("fill-extrusion-vertical-scale"), L3 = 0 !== o88.paint.get("fill-extrusion-line-width").constantOr(1), P4 = o88.paint.get("fill-extrusion-height-alignment"), z4 = o88.paint.get("fill-extrusion-base-alignment"), O4 = io(t45, o88.paint.get("fill-extrusion-cutoff-fade-range")), M5 = []; let F17; E5 && M5.push("PROJECTION_GLOBE_VIEW"), y4[0] > 0 && M5.push("FAUX_AO"), b8 && M5.push("ZERO_ROOF_RADIUS"), l21 && M5.push("HAS_CENTROID"), A4 > 0 && M5.push("FLOOD_LIGHT"), O4.shouldRenderCutoff && M5.push("RENDER_CUTOFF"), L3 && M5.push("RENDER_WALL_MODE"); const B6 = "shadow" === t45.renderPass, k7 = t45.shadowRenderer, N5 = B6 && !!k7, U4 = B6 ? Zi.disabled : Zi.backCCW; t45.shadowRenderer && (t45.shadowRenderer.useNormalOffset = true); let j4 = [0, 0, 0]; if (k7) { const e57 = t45.style.directionalLight, i27 = t45.style.ambientLight; e57 && i27 && (j4 = co(t45.style, e57, i27)), B6 || (M5.push("RENDER_SHADOWS", "DEPTH_TEXTURE"), k7.useNormalOffset && M5.push("NORMAL_OFFSET")), F17 = M5.concat(["SHADOWS_SINGLE_CASCADE"]); } const V4 = N5 ? "fillExtrusionDepth" : f8 ? "fillExtrusionPattern" : "fillExtrusion", G5 = o88.getLayerRenderingStats(); for (const u13 of s18) { const s19 = i26.getTile(u13), g10 = s19.getBucket(o88); if (!g10 || g10.projection.name !== d34.projection.name) continue; let v9 = false; k7 && (v9 = 0 === k7.getMaxCascadeForTile(u13.toUnwrapped())); const x5 = t45.isTileAffectedByFog(u13), b9 = g10.programConfigurations.get(o88.id); let C7 = false; if (p9 && s19.imageAtlas) { const t46 = s19.imageAtlas, i27 = e56.e0.from(p9), o89 = i27.getPrimary().scaleSelf(e56.o.devicePixelRatio).toString(), r87 = i27.getSecondary(), n46 = t46.patternPositions.get(o89), a47 = r87 ? t46.patternPositions.get(r87.scaleSelf(e56.o.devicePixelRatio).toString()) : null; C7 = !!n46 && !!a47, n46 && b9.setConstantPatternPositions(n46, a47); } _4 > 0 && (C7 || b9.getPatternTransitionVertexBuffer("fill-extrusion-pattern")) && M5.push("FILL_EXTRUSION_PATTERN_TRANSITION"); const N6 = t45.getOrCreateProgram(V4, { config: b9, defines: v9 ? F17 : M5, overrideFog: x5 }); if (t45.terrain && t45.terrain.setupElevationDraw(s19, N6, { useMeterToDem: true }), !g10.centroidVertexBuffer) { const e57 = N6.getAttributeLocation(h8, "a_centroid_pos"); -1 !== e57 && h8.vertexAttrib2f(e57, 0, 0); } !B6 && k7 && k7.setupShadows(s19.tileID.toUnwrapped(), N6, "vector-tile"), f8 && (t45.context.activeTexture.set(h8.TEXTURE0), s19.imageAtlasTexture && s19.imageAtlasTexture.bind(h8.LINEAR, h8.CLAMP_TO_EDGE), b9.updatePaintBuffers()); const H4 = o88.paint.get("fill-extrusion-vertical-gradient"), q3 = 1 / g10.tileToMeter; let Z3; if (B6 && k7) { if (on(s19.tileID, g10.maxHeight, t45)) continue; const e57 = k7.calculateShadowPassMatrixFromTile(s19.tileID.toUnwrapped()); Z3 = ir(e57, w4, q3, D5, P4, z4); } else { const e57 = t45.translatePosMatrix(u13.expandedProjMatrix, s19, o88.paint.get("fill-extrusion-translate"), o88.paint.get("fill-extrusion-translate-anchor")), i27 = d34.projection.createInversionMatrix(d34, u13.canonical); Z3 = f8 ? or(e57, t45, H4, m6, y4, w4, q3, u13, s19, T5, P4, z4, S5, I4, i27, R5, D5, _4) : tr(e57, t45, H4, m6, y4, w4, q3, u13, T5, P4, z4, S5, I4, i27, R5, D5, A4, j4); } t45.uploadCommonUniforms(c28, N6, u13.toUnwrapped(), null, O4); let W4 = g10.segments; if ("mercator" === d34.projection.name && !B6 && (W4 = g10.getVisibleSegments(s19.tileID, t45.terrain, t45.transform.getFrustum(0)), !W4.get().length)) continue; if (G5) if (B6) for (const e57 of W4.get()) G5.numRenderedVerticesInShadowPass += e57.primitiveLength; else for (const e57 of W4.get()) G5.numRenderedVerticesInTransparentPass += e57.primitiveLength; const $5 = []; (t45.terrain || l21) && $5.push(g10.centroidVertexBuffer), E5 && $5.push(g10.layoutVertexExtBuffer), L3 && $5.push(g10.wallVertexBuffer), N6.draw(t45, c28.gl.TRIANGLES, r86, n45, a46, U4, Z3, o88.id, g10.layoutVertexBuffer, g10.indexBuffer, W4, o88.paint, t45.transform.zoom, b9, $5); } t45.shadowRenderer && (t45.shadowRenderer.useNormalOffset = false); } class Yr { constructor() { this.translate = [0, 0], this.translateAnchor = "map", this.edgeRadius = 0, this.cutoffFadeRange = 0; } } function Kr(t45, i26, o88, s18, r86, n45, a46, l21, c28, h8, d34, u12, _4, p9, f8, m6, g9, v8, y4, x4) { const b8 = i26.context, w4 = b8.gl, T5 = i26.transform, E5 = i26.transform.zoom, S5 = [], I4 = t45.translate, C6 = t45.translateAnchor, R5 = t45.edgeRadius, A4 = io(i26, t45.cutoffFadeRange); "clear" === d34 ? (S5.push("CLEAR_SUBPASS"), x4 && (S5.push("CLEAR_FROM_TEXTURE"), b8.activeTexture.set(w4.TEXTURE0), x4.bind(w4.LINEAR, w4.CLAMP_TO_EDGE))) : "sdf" === d34 && S5.push("SDF_SUBPASS"), v8 && S5.push("HAS_CENTROID"), A4.shouldRenderCutoff && S5.push("RENDER_CUTOFF"); const D5 = (e57, t46, o89, r87, d35) => { const y5 = t46.programConfigurations.get(s18.id), w5 = i26.isTileAffectedByFog(e57), T6 = i26.getOrCreateProgram("fillExtrusionGroundEffect", { config: y5, defines: S5, overrideFog: w5 }), I5 = /* @__PURE__ */ ((e58, t47, i27, o90, s19, r88, n46, a47, l22, c29, h9) => ({ u_matrix: t47, u_opacity: i27, u_ao_pass: o90 ? 1 : 0, u_meter_to_tile: s19, u_ao: r88, u_flood_light_intensity: n46, u_flood_light_color: a47, u_attenuation: l22, u_edge_radius: c29, u_fb: 0, u_fb_size: h9, u_dynamic_offset: 1 }))(0, r87, u12, h8, d35, [_4, p9 * d35], f8, m6, g9, E5 >= 17 ? 0 : R5 * d35, x4 ? x4.size[0] : 0), C7 = []; v8 && C7.push(t46.hiddenByLandmarkVertexBuffer), i26.uploadCommonUniforms(b8, T6, e57.toUnwrapped(), null, A4), T6.draw(i26, b8.gl.TRIANGLES, n45, a46, l21, c28, I5, s18.id, t46.vertexBuffer, t46.indexBuffer, o89, s18.paint, E5, y5, C7); }; for (const t46 of r86) { const r87 = o88.getTile(t46), n46 = r87.getBucket(s18); if (!n46 || n46.projection.name !== T5.projection.name || !n46.groundEffect || n46.groundEffect && !n46.groundEffect.hasData()) continue; const a47 = n46.groundEffect, l22 = 1 / n46.tileToMeter; { const e57 = i26.translatePosMatrix(t46.projMatrix, r87, I4, C6), o89 = a47.getDefaultSegment(); D5(t46, a47, o89, e57, l22); } if (y4) for (let n47 = 0; n47 < 4; n47++) { const a48 = e56.e6[n47](t46), c29 = o88.getTile(a48); if (!c29) continue; const h9 = c29.getBucket(s18); if (!h9 || h9.projection.name !== T5.projection.name || !h9.groundEffect || h9.groundEffect && !h9.groundEffect.hasData()) continue; const d35 = h9.groundEffect; let u13, _5; 0 === n47 ? (u13 = [-e56.al, 0, 0], _5 = 1) : 1 === n47 ? (u13 = [e56.al, 0, 0], _5 = 0) : 2 === n47 ? (u13 = [0, -e56.al, 0], _5 = 3) : (u13 = [0, e56.al, 0], _5 = 2); const p10 = d35.regionSegments[_5]; if (!p10) continue; const f9 = new Float32Array(16); e56.br(f9, t46.projMatrix, u13), D5(t46, d35, p10, i26.translatePosMatrix(f9, r87, I4, C6), l22); } } } function Jr(t45, i26, o88, s18, r86, n45, a46) { 0 === s18.centroidVertexArray.length && s18.createCentroidsBuffer(); const l21 = n45 ? n45.findDEMTileFor(o88) : null; if (!(l21 && l21.dem || a46)) return; n45 && l21 && l21.dem && s18.selfDEMTileTimestamp !== l21.dem._timestamp && (s18.borderDoneWithNeighborZ = [-1, -1, -1, -1], s18.selfDEMTileTimestamp = l21.dem._timestamp); const c28 = (t46) => new e56.P(Math.ceil((t46 + e56.ea) * e56.eb), 0), h8 = (e57) => { const t46 = i26.getSource().minzoom, o89 = (e58) => { const t47 = i26.getTileByID(e58); if (t47 && t47.hasData()) return t47.getBucket(r86); }, s19 = [0, -1, 1]; for (const i27 of s19) { if (e57.overscaledZ + i27 < t46) continue; const s20 = o89(e57.calculateScaledKey(e57.overscaledZ + i27)); if (s20) return s20; } }, d34 = [0, 0, 0], u12 = (t46, i27) => (d34[0] = Math.min(t46.min.y, i27.min.y), d34[1] = Math.max(t46.max.y, i27.max.y), d34[2] = e56.al - i27.min.x > t46.max.x ? i27.min.x - e56.al : t46.max.x, d34), _4 = (t46, i27) => (d34[0] = Math.min(t46.min.x, i27.min.x), d34[1] = Math.max(t46.max.x, i27.max.x), d34[2] = e56.al - i27.min.y > t46.max.y ? i27.min.y - e56.al : t46.max.y, d34), p9 = [(e57, t46) => u12(e57, t46), (e57, t46) => u12(t46, e57), (e57, t46) => _4(e57, t46), (e57, t46) => _4(t46, e57)], f8 = (t46, i27, s19, r87, a47, c29, h9) => { if (!n45) return 0; const d35 = [[c29 ? s19 : t46, c29 ? t46 : s19, 0], [c29 ? s19 : i27, c29 ? i27 : s19, 0]], u13 = h9 < 0 ? e56.al + h9 : h9, _5 = [c29 ? u13 : (t46 + i27) / 2, c29 ? (t46 + i27) / 2 : u13, 0]; return 0 === s19 && h9 < 0 || 0 !== s19 && h9 > 0 ? n45.getForTilePoints(a47, [_5], true, r87) : d35.push(_5), n45.getForTilePoints(o88, d35, true, l21), Math.max(d35[0][2], d35[1][2], _5[2]) / n45.exaggeration(); }; for (let t46 = 0; t46 < 4; t46++) { const i27 = s18.borderFeatureIndices[t46]; if (0 === i27.length) continue; const r87 = e56.e6[t46](o88), l22 = h8(r87); if (!(l22 && l22 instanceof e56.e7)) continue; const d35 = n45 ? n45.findDEMTileFor(r87) : null; if (!(d35 && d35.dem || a46)) continue; if (n45 && d35 && d35.dem && s18.borderDEMTileTimestamp[t46] !== d35.dem._timestamp && (s18.borderDoneWithNeighborZ[t46] = -1, s18.borderDEMTileTimestamp[t46] = d35.dem._timestamp), s18.borderDoneWithNeighborZ[t46] === l22.canonical.z) continue; 0 === l22.centroidVertexArray.length && l22.createCentroidsBuffer(); const u13 = (t46 < 2 ? 1 : 5) - t46, _5 = l22.borderDoneWithNeighborZ[u13] !== s18.canonical.z, v8 = l22.borderFeatureIndices[u13]; let y4 = 0; if (s18.canonical.z !== l22.canonical.z) { for (const e57 of i27) s18.showCentroid(s18.featuresOnBorder[e57]); if (_5) for (const e57 of v8) l22.showCentroid(l22.featuresOnBorder[e57]); s18.borderDoneWithNeighborZ[t46] = l22.canonical.z, l22.borderDoneWithNeighborZ[u13] = s18.canonical.z; } for (const o89 of i27) { const i28 = s18.featuresOnBorder[o89], n46 = s18.centroidData[i28.centroidDataIndex], h9 = i28.borders[t46]; let _6; for (; y4 < v8.length; ) { _6 = l22.featuresOnBorder[v8[y4]]; const e57 = _6.borders[u13]; if (e57[1] > h9[0] + 3 || e57[0] > h9[0] - 3) break; l22.showCentroid(_6), y4++; } if (_6 && y4 < v8.length) { const o90 = y4; let x4 = 0; for (; !(_6.borders[u13][0] > h9[1] - 3) && (x4++, ++y4 !== v8.length); ) _6 = l22.featuresOnBorder[v8[y4]]; _6 = l22.featuresOnBorder[v8[o90]]; let b8 = false; if (x4 >= 1) { const e57 = _6.borders[u13]; Math.abs(h9[0] - e57[0]) < 3 && Math.abs(h9[1] - e57[1]) < 3 && (x4 = 1, b8 = true, y4 = o90 + 1); } else if (0 === x4) { s18.showCentroid(i28); continue; } const w4 = l22.centroidData[_6.centroidDataIndex]; a46 && b8 && (((m6 = n46).flags | (g9 = w4).flags) & e56.e9 ? (m6.flags |= e56.e9, g9.flags |= e56.e9) : (m6.flags &= ~e56.e9, g9.flags &= ~e56.e9)); const T5 = i28.intersectsCount() > 1 || _6.intersectsCount() > 1; if (x4 > 1) y4 = o90, n46.centroidXY = w4.centroidXY = new e56.P(0, 0); else if (d35 && d35.dem && !T5) { const i29 = p9[t46](n46, w4), o91 = t46 % 2 ? e56.al - 1 : 0, s19 = f8(i29[0], Math.min(e56.al - 1, i29[1]), o91, d35, r87, t46 < 2, i29[2]); n46.centroidXY = w4.centroidXY = c28(s19); } else T5 ? n46.centroidXY = w4.centroidXY = new e56.P(0, 0) : (n46.centroidXY = s18.encodeBorderCentroid(i28), w4.centroidXY = l22.encodeBorderCentroid(_6)); s18.writeCentroidToBuffer(n46), l22.writeCentroidToBuffer(w4); } else s18.showCentroid(i28); } s18.borderDoneWithNeighborZ[t46] = l22.canonical.z, l22.borderDoneWithNeighborZ[u13] = s18.canonical.z; } var m6, g9; (s18.needsCentroidUpdate || !s18.centroidVertexBuffer && 0 !== s18.centroidVertexArray.length) && s18.uploadCentroid(t45); } const Qr = [1, 0, 0], en = [0, 1, 0], tn = [0, 0, 1]; function on(t45, i26, o88) { const s18 = o88.transform, r86 = o88.shadowRenderer; if (!r86) return true; const n45 = t45.toUnwrapped(), a46 = s18.tileSize * r86._cascades[o88.currentShadowCascade].scale; let l21 = i26; if (s18.elevation) { const e57 = s18.elevation.getMinMaxForTile(t45); e57 && (l21 += e57.max); } const c28 = [...r86.shadowDirection]; c28[2] = -c28[2]; const h8 = r86.computeSimplifiedTileShadowVolume(n45, l21, a46, c28); if (!h8) return false; const d34 = [Qr, en, tn, c28, [c28[0], 0, c28[2]], [0, c28[1], c28[2]]], u12 = "globe" === s18.projection.name, _4 = s18.scaleZoom(a46), p9 = e56.cA.fromInvProjectionMatrix(s18.invProjMatrix, s18.worldSize, _4, !u12), f8 = r86.getCurrentCascadeFrustum(); return 0 === p9.intersectsPrecise(h8.vertices, h8.planes, d34) || 0 === f8.intersectsPrecise(h8.vertices, h8.planes, d34); } function sn(t45) { const { painter: i26, source: o88, layer: s18, coords: r86 } = t45; let n45 = t45.defines; const a46 = i26.context, l21 = "shadow" === i26.renderPass, c28 = "light-beam" === i26.renderPass, h8 = i26.shadowRenderer, d34 = e56.ec(i26.transform.center.lat, i26.transform.zoom), u12 = io(i26, s18.paint.get("building-cutoff-fade-range")); u12.shouldRenderCutoff && (n45 = n45.concat("RENDER_CUTOFF")); for (const _4 of r86) { const r87 = o88.getTile(_4), p9 = r87.getBucket(s18); if (!p9) continue; h8 && 0 === h8.getMaxCascadeForTile(_4.toUnwrapped()) && (n45 = n45.concat("SHADOWS_SINGLE_CASCADE")); const f8 = p9.programConfigurations.get(s18.id); let m6, g9, v8, y4 = i26.translatePosMatrix(_4.expandedProjMatrix, r87, [0, 0], "map"); if (y4 = e56.cR(e56.bC(), y4, [1, 1, t45.verticalScale]), l21 && h8) { if (on(r87.tileID, p9.maxHeight * d34, i26)) continue; let o89 = h8.calculateShadowPassMatrixFromTile(r87.tileID.toUnwrapped()); o89 = e56.cR(e56.bC(), o89, [1, 1, t45.verticalScale]), v8 = ur(o89), m6 = g9 = i26.getOrCreateProgram("buildingDepth", { config: f8, defines: n45, overrideFog: false }); } else if (c28) m6 = g9 = i26.getOrCreateProgram("buildingBloom", { config: f8, defines: n45, overrideFog: false }), v8 = dr(y4); else { const o89 = i26.transform.calculatePosMatrix(_4.toUnwrapped(), i26.transform.worldSize); e56.cR(o89, o89, [1, 1, t45.verticalScale]); const s19 = e56.bC(); e56.cR(s19, o89, [1, -1, 1 / d34]), e56.bl(s19, s19), e56.ed(s19, s19); const r88 = i26.transform.getFreeCameraOptions().position, a47 = 1 << _4.canonical.z; v8 = hr(y4, s19, t45.opacity, t45.facadeAOIntensity, [((r88.x - _4.wrap) * a47 - _4.canonical.x) * e56.al, (r88.y * a47 - _4.canonical.y) * e56.al, r88.z * a47 * e56.al], p9.tileToMeter, t45.facadeEmissiveChance), g9 = i26.getOrCreateProgram("building", { config: f8, defines: n45, overrideFog: false }); const l22 = n45.concat(["BUILDING_FAUX_FACADE", "HAS_ATTRIBUTE_a_faux_facade_color_emissive"]); m6 = i26.getOrCreateProgram("building", { config: f8, defines: l22, overrideFog: false }), h8 && (h8.setupShadowsFromMatrix(o89, g9, true), h8.setupShadowsFromMatrix(o89, m6, true)); } const x4 = (e57, o89) => { if (c28) { const r88 = e57.entranceBloom; o89.draw(i26, a46.gl.TRIANGLES, t45.depthMode, Gi.disabled, t45.blendMode, Zi.disabled, v8, s18.id, r88.layoutVertexBuffer, r88.indexBuffer, r88.segmentsBucket, s18.paint, i26.transform.zoom, f8, [r88.layoutAttenuationBuffer, r88.layoutColorBuffer]); } else { const r88 = e57.segmentsBucket; let n46 = [e57.layoutNormalBuffer, e57.layoutCentroidBuffer, e57.layoutColorBuffer]; e57.layoutFacadePaintBuffer && (n46 = n46.concat([e57.layoutFacadeDataBuffer, e57.layoutFacadeVerticalRangeBuffer, e57.layoutFacadePaintBuffer])), o89.draw(i26, a46.gl.TRIANGLES, t45.depthMode, Gi.disabled, t45.blendMode, l21 ? Zi.disabled : Zi.backCW, v8, s18.id, e57.layoutVertexBuffer, e57.indexBuffer, r88, s18.paint, i26.transform.zoom, f8, n46); } }; i26.uploadCommonUniforms(a46, g9, _4.toUnwrapped(), null, u12), p9.buildingWithoutFacade && x4(p9.buildingWithoutFacade, g9), m6 !== g9 && i26.uploadCommonUniforms(a46, m6, _4.toUnwrapped(), null, u12), p9.buildingWithFacade && x4(p9.buildingWithFacade, m6); } } function rn(t45) { return [t45[0] * e56.ee, t45[1] * e56.ee, t45[2] * e56.ee, 0]; } function nn(t45, i26, o88, s18, r86, n45, a46, l21, c28) { const h8 = s18.getSource(), d34 = o88.globeSharedBuffers; if (!d34) return; let u12, _4, p9; if (i26 && (u12 = s18.getTile(i26)), h8 instanceof e56.aS ? (_4 = h8.texture, p9 = e56.dG(0, 0, o88.transform)) : u12 && i26 && (_4 = u12.texture, p9 = e56.dG(i26.canonical.z, i26.canonical.x, o88.transform)), !_4 || !p9) return; t45 || (p9 = e56.cR(e56.bC(), p9, [1, -1, 1])); const f8 = o88.context, m6 = f8.gl, g9 = "nearest" === r86.paint.get("raster-resampling") ? m6.NEAREST : m6.LINEAR, v8 = o88.colorModeForDrapableLayerRenderPass(n45), y4 = a46.defines; y4.push("GLOBE_POLES"); const x4 = new ji(m6.LEQUAL, ji.ReadWrite, o88.depthRangeFor3D), b8 = Float32Array.from(o88.transform.expandedFarZProjMatrix), w4 = Float32Array.from(e56.bk(e56.dF(new e56.cC(0, 0, 0)))); o88.terrain && o88.terrain.prepareDrawTile(), f8.activeTexture.set(m6.TEXTURE0), _4.bind(g9, m6.CLAMP_TO_EDGE), f8.activeTexture.set(m6.TEXTURE1), _4.bind(g9, m6.CLAMP_TO_EDGE), "useMipmap" in _4 && f8.extTextureFilterAnisotropic && o88.transform.pitch > 20 && m6.texParameterf(m6.TEXTURE_2D, f8.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, f8.extTextureFilterAnisotropicMax); const [T5, E5, S5, I4] = i26 ? d34.getPoleBuffers(i26.canonical.z, false) : d34.getPoleBuffers(0, true), C6 = r86.paint.get("raster-elevation"); let R5; t45 ? (R5 = T5, o88.renderDefaultNorthPole = 0 !== C6) : (R5 = E5, o88.renderDefaultSouthPole = 0 !== C6); const A4 = rn(a46.mix), D5 = ((e57, t46, i27, o89, s19, r87, n46, a47, l22, c29, h9, d35, u13) => yr(e57, t46, i27, new Float32Array(16), new Float32Array(9), [0, 0], o89, [0, 0], [0, 0, 0, 0], 1, { opacity: 1, mix: 0 }, r87, [0, 0], a47, 2, c29, h9, d35, 1, 0, u13))(b8, w4, p9, e56.aj(o88.transform.zoom), 0, r86, 0, C6, 0, A4, a46.offset, a46.range, n45), L3 = o88.getOrCreateProgram("raster", { defines: y4 }); o88.uploadCommonUniforms(f8, L3, null), L3.draw(o88, m6.TRIANGLES, x4, c28, v8, l21, D5, r86.id, R5, S5, I4); } function an(e57) { const t45 = e57._nearZ, i26 = e57.projection.farthestPixelDistance(e57), o88 = i26 - t45, s18 = 0.2 * e57.height, r86 = t45 + s18; return [t45, i26, (r86 - s18 - t45) / o88, (r86 - t45) / o88]; } function ln(e57, t45, i26, o88) { if (e57) return t45 instanceof nt2 && e57 instanceof St ? t45.getTextureDescriptor(e57, i26, true) : { texture: e57.texture, mix: rn(o88.mix), offset: o88.offset, buffer: 0, tileSize: 1 }; } var cn = e56.ef([{ name: "a_index", type: "Int16", components: 1 }]); class hn { constructor(t45, i26, o88, s18) { const r86 = { width: o88[0], height: o88[1], data: null }, n45 = t45.gl; this.targetColorTexture = new e56.T(t45, r86, n45.RGBA8, { useMipmap: false }), this.backgroundColorTexture = new e56.T(t45, r86, n45.RGBA8, { useMipmap: false }), this.context = t45, this.updateParticleTexture(i26, s18), this.lastInvalidatedAt = 0; } updateParticleTexture(t45, i26) { if (this.particleTextureDimension === i26.width) return; (this.particleTexture0 || this.particleTexture1 || this.particleIndexBuffer || this.particleSegment) && (this.particleTexture0.destroy(), this.particleTexture1.destroy(), this.particleIndexBuffer.destroy(), this.particleSegment.destroy()); const o88 = this.context.gl, s18 = i26.width * i26.height; this.particleTexture0 = new e56.T(this.context, i26, o88.RGBA8, { premultiply: false, useMipmap: false }), this.particleTexture1 = new e56.T(this.context, i26, o88.RGBA8, { premultiply: false, useMipmap: false }); const r86 = new e56.eg(); r86.reserve(s18); for (let e57 = 0; e57 < s18; e57++) r86.emplaceBack(e57); this.particleIndexBuffer = this.context.createVertexBuffer(r86, cn.members, true), this.particleSegment = e56.bg.simpleSegment(0, 0, this.particleIndexBuffer.length, 0), this.particleTextureDimension = i26.width; } update(t45) { return !(this.lastInvalidatedAt < t45 && (this.lastInvalidatedAt = e56.o.now(), 1)); } destroy() { this.targetColorTexture.destroy(), this.backgroundColorTexture.destroy(), this.particleIndexBuffer.destroy(), this.particleTexture0.destroy(), this.particleTexture1.destroy(), this.particleSegment.destroy(); } } function dn(t45, i26, o88) { if (!t45) return null; const s18 = i26.getTextureDescriptor(t45, o88, true); if (!s18) return null; let { texture: r86, mix: n45, offset: a46, tileSize: l21, buffer: c28, format: h8 } = s18; if (!r86 || !h8) return null; let d34 = false; return "uint32" === h8 && (d34 = true, n45[3] = 0, n45 = gr(e56.eh, n45, [0, o88.paint.get("raster-particle-max-speed")]), a46 = vr(e56.eh, a46, [0, o88.paint.get("raster-particle-max-speed")])), { texture: r86, textureOffset: [c28 / (l21 + 2 * c28), l21 / (l21 + 2 * c28)], tileSize: l21, scalarData: d34, scale: n45, offset: a46, defines: ["RASTER_ARRAY", { uint8: "DATA_FORMAT_UINT8", uint16: "DATA_FORMAT_UINT16", uint32: "DATA_FORMAT_UINT32" }[h8]] }; } function un(e57) { const t45 = e57._nearZ, i26 = e57.projection.farthestPixelDistance(e57), o88 = i26 - t45, s18 = 0.2 * e57.height, r86 = t45 + s18; return [t45, i26, (r86 - s18 - t45) / o88, (r86 - t45) / o88]; } const _n = new e56.ao(1, 0, 0, 1), pn = new e56.ao(0, 1, 0, 1), fn = new e56.ao(0, 0, 1, 1), mn = new e56.ao(1, 0, 1, 1), gn = new e56.ao(0, 1, 1, 1); function vn(t45, i26, o88, s18, r86, n45) { for (let a46 = 0; a46 < o88.length; a46++) if (r86) { const r87 = 1, l21 = 0.8, c28 = new e56.ao(s18.r * l21, s18.g * l21, s18.b * l21, 1); yn(t45, i26, o88[a46], s18, -r87, -r87, n45), yn(t45, i26, o88[a46], s18, -r87, r87, n45), yn(t45, i26, o88[a46], s18, r87, r87, n45), yn(t45, i26, o88[a46], s18, r87, -r87, n45), yn(t45, i26, o88[a46], c28, 0, 0, n45); } else yn(t45, i26, o88[a46], s18, 0, 0, n45); } function yn(t45, i26, o88, s18, r86, n45, a46) { const l21 = t45.context, c28 = t45.transform, h8 = l21.gl, d34 = "globe" === c28.projection.name, u12 = d34 ? ["PROJECTION_GLOBE_VIEW"] : []; let _4 = e56.bz(o88.projMatrix); if (d34 && e56.aj(c28.zoom) > 0) { const t46 = e56.bj(o88.canonical, c28), i27 = e56.ei(t46); _4 = e56.aB(new Float32Array(16), c28.globeMatrix, i27), e56.aB(_4, c28.projMatrix, _4); } const p9 = e56.bC(); p9[12] += 2 * r86 / (e56.o.devicePixelRatio * c28.width), p9[13] += 2 * n45 / (e56.o.devicePixelRatio * c28.height), e56.aB(_4, p9, _4); const f8 = t45.getOrCreateProgram("debug", { defines: u12 }), m6 = i26.getTileByID(o88.key); t45.terrain && t45.terrain.setupElevationDraw(m6, f8); const g9 = ji.disabled, v8 = Gi.disabled, y4 = t45.colorModeForRenderPass(), x4 = "$debug"; l21.activeTexture.set(h8.TEXTURE0), t45.emptyTexture.bind(h8.LINEAR, h8.CLAMP_TO_EDGE), d34 ? m6._makeGlobeTileDebugBuffers(t45.context, c28) : m6._makeDebugTileBoundsBuffers(t45.context, c28.projection); const b8 = m6._tileDebugBuffer || t45.debugBuffer, w4 = m6._tileDebugIndexBuffer || t45.debugIndexBuffer, T5 = m6._tileDebugSegments || t45.debugSegments; if (f8.draw(t45, h8.LINE_STRIP, g9, v8, y4, Zi.disabled, pr(_4, s18.toPremultipliedRenderColor(null)), x4, b8, w4, T5, null, null, null, [m6._globeTileDebugBorderBuffer]), a46) { const e57 = m6.latestRawTileData, i27 = Math.floor((e57 && e57.byteLength || 0) / 1024); let s19 = o88.canonical.toString(); o88.overscaledZ !== o88.canonical.z && (s19 += ` => ${o88.overscaledZ}`), s19 += ` ${m6.state}`, s19 += ` ${i27}kb`, (function(e58, t46) { e58.initDebugOverlayCanvas(); const i28 = e58.debugOverlayCanvas, o89 = e58.context.gl, s20 = e58.debugOverlayCanvas.getContext("2d"); s20.clearRect(0, 0, i28.width, i28.height), s20.shadowColor = "white", s20.shadowBlur = 2, s20.lineWidth = 1.5, s20.strokeStyle = "white", s20.textBaseline = "top", s20.font = "bold 36px Open Sans, sans-serif", s20.fillText(t46, 5, 5), s20.strokeText(t46, 5, 5), e58.debugOverlayTexture.update(i28), e58.debugOverlayTexture.bind(o89.LINEAR, o89.CLAMP_TO_EDGE); })(t45, s19); } const E5 = i26.getTile(o88).tileSize, S5 = 512 / Math.min(E5, 512) * (o88.overscaledZ / c28.zoom) * 0.5, I4 = m6._tileDebugTextBuffer || t45.debugBuffer, C6 = m6._tileDebugTextIndexBuffer || t45.quadTriangleIndexBuffer, R5 = m6._tileDebugTextSegments || t45.debugSegments; f8.draw(t45, h8.TRIANGLES, g9, v8, Ui.alphaBlended, Zi.disabled, pr(_4, e56.ao.transparent.toPremultipliedRenderColor(null), S5), x4, I4, C6, R5, null, null, null, [m6._globeTileDebugTextBuffer]); } function xn(e57, t45, i26, o88) { wn(e57, 0, t45 + i26 / 2, e57.transform.width, i26, o88); } function bn(e57, t45, i26, o88) { wn(e57, t45 - i26 / 2, 0, i26, e57.transform.height, o88); } function wn(t45, i26, o88, s18, r86, n45) { const a46 = t45.context, l21 = a46.gl; l21.enable(l21.SCISSOR_TEST), l21.scissor(i26 * e56.o.devicePixelRatio, o88 * e56.o.devicePixelRatio, s18 * e56.o.devicePixelRatio, r86 * e56.o.devicePixelRatio), a46.clear({ color: n45 }), l21.disable(l21.SCISSOR_TEST); } const Tn = e56.ef([{ name: "a_pos_3f", components: 3, type: "Float32" }]), { members: En } = Tn; function Sn(e57, t45, i26, o88) { e57.emplaceBack(t45, i26, o88); } class In { constructor(t45) { this.vertexArray = new e56.ej(), this.indices = new e56.b1(), Sn(this.vertexArray, -1, -1, 1), Sn(this.vertexArray, 1, -1, 1), Sn(this.vertexArray, -1, 1, 1), Sn(this.vertexArray, 1, 1, 1), Sn(this.vertexArray, -1, -1, -1), Sn(this.vertexArray, 1, -1, -1), Sn(this.vertexArray, -1, 1, -1), Sn(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 = t45.createVertexBuffer(this.vertexArray, En), this.indexBuffer = t45.createIndexBuffer(this.indices), this.segment = e56.bg.simpleSegment(0, 0, 36, 12); } } function Cn(t45, i26, o88, s18, r86, n45) { const a46 = t45.context.gl, l21 = i26.paint.get("sky-atmosphere-color"), c28 = i26.paint.get("sky-atmosphere-halo-color"), h8 = i26.paint.get("sky-atmosphere-sun-intensity"), d34 = ((e57, t46, i27, o89, s19) => ({ u_matrix_3f: e57, u_sun_direction: t46, u_sun_intensity: i27, u_color_tint_r: [o89.r, o89.g, o89.b, o89.a], u_color_tint_m: [s19.r, s19.g, s19.b, s19.a], u_luminance: 5e-5 }))(e56.el(e56.dL(), s18), r86, h8, l21.toPremultipliedRenderColor(null), c28.toPremultipliedRenderColor(null)); a46.framebufferTexture2D(a46.FRAMEBUFFER, a46.COLOR_ATTACHMENT0, a46.TEXTURE_CUBE_MAP_POSITIVE_X + n45, i26.skyboxTexture, 0), o88.draw(t45, a46.TRIANGLES, ji.disabled, Gi.disabled, Ui.unblended, Zi.frontCW, d34, "skyboxCapture", i26.skyboxGeometry.vertexBuffer, i26.skyboxGeometry.indexBuffer, i26.skyboxGeometry.segment); } const Rn = e56.ef([{ type: "Float32", name: "a_pos", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }]); class An { constructor(t45) { const i26 = new e56.em(); i26.emplaceBack(-1, 1, 1, 0, 0), i26.emplaceBack(1, 1, 1, 1, 0), i26.emplaceBack(1, -1, 1, 1, 1), i26.emplaceBack(-1, -1, 1, 0, 1); const o88 = new e56.b1(); o88.emplaceBack(0, 1, 2), o88.emplaceBack(2, 3, 0), this.vertexBuffer = t45.createVertexBuffer(i26, Rn.members), this.indexBuffer = t45.createIndexBuffer(o88), this.segments = e56.bg.simpleSegment(0, 0, 4, 2); } destroy() { this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(); } } const Dn = e56.ef([{ type: "Float32", name: "a_pos_3f", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }, { type: "Float32", name: "a_size_scale", components: 1 }, { type: "Float32", name: "a_fade_opacity", components: 1 }]); class Ln { constructor() { this.starsCount = 16e3, this.sizeMultiplier = 0.15, this.sizeRange = 100, this.intensityRange = 200; } } class Pn { constructor(t45) { this.colorModeAlphaBlendedWriteRGB = new Ui([1, Ni, 1, Ni], e56.ao.transparent, [true, true, true, false]), this.colorModeWriteAlpha = new Ui([1, 0, 1, 0], e56.ao.transparent, [false, false, false, true]), this.params = new Ln(), this.updateNeeded = true, t45.tp.registerParameter(this.params, ["Stars"], "starsCount", { min: 100, max: 16e3, step: 1 }, (() => { this.updateNeeded = true; })), t45.tp.registerParameter(this.params, ["Stars"], "sizeMultiplier", { min: 0.01, max: 2, step: 0.01 }), t45.tp.registerParameter(this.params, ["Stars"], "sizeRange", { min: 0, max: 200, step: 1 }, (() => { this.updateNeeded = true; })), t45.tp.registerParameter(this.params, ["Stars"], "intensityRange", { min: 0, max: 200, step: 1 }, (() => { this.updateNeeded = true; })); } update(t45) { const i26 = t45.context; if (!this.atmosphereBuffer || this.updateNeeded) { this.updateNeeded = false, this.atmosphereBuffer = new An(i26); const t46 = this.params.sizeRange, o88 = this.params.intensityRange, s18 = (function(t47) { const i27 = e56.eo(30), o89 = []; for (let s19 = 0; s19 < t47; ++s19) { const t48 = 2 * Math.PI * i27(), s20 = Math.acos(1 - 2 * i27()) - 0.5 * Math.PI; o89.push(e56.d4(Math.cos(s20) * Math.cos(t48), Math.cos(s20) * Math.sin(t48), Math.sin(s20))); } return o89; })(this.params.starsCount), r86 = e56.eo(300), n45 = new e56.en(), a46 = new e56.b1(); let l21 = 0; for (let i27 = 0; i27 < s18.length; ++i27) { const c28 = e56.c4([], s18[i27], 200), h8 = Math.max(0, 1 + 0.01 * t46 * (1 * r86() - 0.5)), d34 = Math.max(0, 1 + 0.01 * o88 * (1 * r86() - 0.5)); n45.emplaceBack(c28[0], c28[1], c28[2], -1, -1, h8, d34), n45.emplaceBack(c28[0], c28[1], c28[2], 1, -1, h8, d34), n45.emplaceBack(c28[0], c28[1], c28[2], 1, 1, h8, d34), n45.emplaceBack(c28[0], c28[1], c28[2], -1, 1, h8, d34), a46.emplaceBack(l21 + 0, l21 + 1, l21 + 2), a46.emplaceBack(l21 + 0, l21 + 2, l21 + 3), l21 += 4; } this.starsVx = i26.createVertexBuffer(n45, Dn.members), this.starsIdx = i26.createIndexBuffer(a46), this.starsSegments = e56.bg.simpleSegment(0, 0, n45.length, a46.length); } } destroy() { this.atmosphereBuffer && this.atmosphereBuffer.destroy(), this.starsVx && this.starsVx.destroy(), this.starsIdx && this.starsIdx.destroy(); } drawAtmosphereGlow(t45, i26) { const o88 = t45.context, s18 = o88.gl, r86 = t45.transform, n45 = new ji(s18.LEQUAL, ji.ReadOnly, [0, 1]), a46 = e56.aj(r86.zoom), l21 = t45.style.getLut(i26.scope), c28 = "none" === i26.properties.get("color-use-theme"), h8 = i26.properties.get("color").toNonPremultipliedRenderColor(c28 ? null : l21), d34 = "none" === i26.properties.get("high-color-use-theme"), u12 = i26.properties.get("high-color").toNonPremultipliedRenderColor(d34 ? null : l21), _4 = "none" === i26.properties.get("space-color-use-theme"), p9 = i26.properties.get("space-color").toNonPremultipliedRenderColor(_4 ? null : l21), f8 = 5e-4, m6 = e56.ep(i26.properties.get("horizon-blend"), 0, 1, f8, 0.25), g9 = e56.dA(t45, o88, r86) && m6 === f8 ? r86.worldSize / (2 * Math.PI * 1.025) - 1 : r86.globeRadius, v8 = t45.frameCounter / 1e3 % 1, y4 = e56.ag(r86.globeCenterInViewSpace), x4 = Math.sqrt(Math.pow(y4, 2) - Math.pow(g9, 2)), b8 = Math.acos(x4 / y4), w4 = (e57) => { const i27 = "globe" === r86.projection.name ? ["PROJECTION_GLOBE_VIEW", "FOG"] : ["FOG"]; e57 && i27.push("ALPHA_PASS"); const l22 = t45.getOrCreateProgram("globeAtmosphere", { defines: i27 }), c29 = ((e58, t46, i28, o89, s19, r87, n46, a47, l23, c30, h9, d36) => ({ u_frustum_tl: e58, u_frustum_tr: t46, u_frustum_br: i28, u_frustum_bl: o89, u_horizon: s19, u_transition: r87, u_fadeout_range: n46, u_atmosphere_fog_color: a47.toArray01(), u_high_color: l23.toArray01(), u_space_color: c30.toArray01(), u_temporal_offset: h9, u_horizon_angle: d36 }))(r86.frustumCorners.TL, r86.frustumCorners.TR, r86.frustumCorners.BR, r86.frustumCorners.BL, r86.frustumCorners.horizon, a46, m6, h8, u12, p9, v8, b8); t45.uploadCommonUniforms(o88, l22); const d35 = this.atmosphereBuffer; d35 && l22.draw(t45, s18.TRIANGLES, n45, Gi.disabled, e57 ? this.colorModeWriteAlpha : this.colorModeAlphaBlendedWriteRGB, Zi.backCW, c29, e57 ? "atmosphere_glow_alpha" : "atmosphere_glow", d35.vertexBuffer, d35.indexBuffer, d35.segments); }; w4(false), w4(true); } drawStars(t45, i26) { const o88 = e56.aA(i26.properties.get("star-intensity"), 0, 1); if (0 === o88) return; const s18 = t45.context, r86 = s18.gl, n45 = t45.transform, a46 = t45.getOrCreateProgram("stars"), l21 = e56.c6([]); e56.c8(l21, l21, -n45._pitch), e56.c7(l21, l21, -n45.angle), e56.c8(l21, l21, e56.an(n45._center.lat)), e56.eq(l21, l21, -e56.an(n45._center.lng)); const c28 = e56.cb(new Float32Array(16), l21), h8 = e56.aB([], n45.starsProjMatrix, c28), d34 = e56.el([], c28), u12 = e56.er([], d34), _4 = [0, 1, 0]; e56.dN(_4, _4, u12), e56.c4(_4, _4, this.params.sizeMultiplier); const p9 = [1, 0, 0]; e56.dN(p9, p9, u12), e56.c4(p9, p9, this.params.sizeMultiplier); const f8 = (m6 = _4, g9 = p9, v8 = o88, { u_matrix: Float32Array.from(h8), u_up: m6, u_right: g9, u_intensity_multiplier: v8 }); var m6, g9, v8; t45.uploadCommonUniforms(s18, a46), this.starsVx && this.starsIdx && a46.draw(t45, r86.TRIANGLES, ji.disabled, Gi.disabled, this.colorModeAlphaBlendedWriteRGB, Zi.disabled, f8, "atmosphere_stars", this.starsVx, this.starsIdx, this.starsSegments); } } class zn { constructor() { this.visibleTiles = []; } updateBorders(t45, i26) { const o88 = [], s18 = [], r86 = t45._getRenderableCoordinates(false, true); for (const e57 of r86) { const r87 = t45.getTile(e57); if (!r87.hasData()) continue; const n46 = r87.getBucket(i26); n46 && (n46.isEmpty() || (o88.push(e57.key), s18.push({ bucket: n46, tileID: e57.canonical }))); } let n45 = o88.length !== this.visibleTiles.length; if (!n45) { o88.sort(); for (let e57 = 0; e57 < o88.length; e57++) if (o88[e57] !== this.visibleTiles[e57]) { n45 = true; break; } } if (!n45) return; const a46 = /* @__PURE__ */ new Set(); this.visibleTiles = o88, s18.sort(((e57, t46) => e57.tileID.z - t46.tileID.z || e57.tileID.x - t46.tileID.x || e57.tileID.y - t46.tileID.y)); for (const t46 of s18) { const i27 = new Array(), o89 = new Array(), s19 = t46.bucket; for (const e57 of s19.featuresOnBorder) a46.has(e57.featureId) ? o89.push(e57.footprintIndex) : (a46.add(e57.featureId), i27.push(e57.footprintIndex)); s19.updateFootprintHiddenFlags(i27, e56.es, false), s19.updateFootprintHiddenFlags(o89, e56.es, true); } } } function On(t45, i26) { const o88 = [...t45], s18 = i26.cameraWorldSizeForFog / i26.worldSize, r86 = e56.bA([]); return e56.cR(r86, r86, [s18, s18, 1]), e56.aB(o88, r86, o88), e56.aB(o88, i26.worldToFogMatrix, o88), o88; } function Mn(t45, i26, o88, s18, r86) { const n45 = o88.material, a46 = s18.context, { baseColorTexture: l21, metallicRoughnessTexture: c28 } = n45.pbrMetallicRoughness, { normalTexture: h8, occlusionTexture: d34, emissionTexture: u12 } = n45; function _4(e57, i27, o89) { if (e57 && (t45.push(i27), a46.activeTexture.set(a46.gl.TEXTURE0 + o89), e57.gfxTexture)) { const { minFilter: t46, magFilter: i28, wrapS: o90, wrapT: s19 } = e57.sampler; e57.gfxTexture.bindExtraParam(t46, i28, o90, s19); } } _4(l21, "HAS_TEXTURE_u_baseColorTexture", Ji.BaseColor), _4(c28, "HAS_TEXTURE_u_metallicRoughnessTexture", Ji.MetallicRoughness), _4(h8, "HAS_TEXTURE_u_normalTexture", Ji.Normal), _4(d34, "HAS_TEXTURE_u_occlusionTexture", Ji.Occlusion), _4(u12, "HAS_TEXTURE_u_emissionTexture", Ji.Emission), r86 && (r86.texture || (r86.texture = new e56.dY(s18.context, r86.image, [r86.image.height, r86.image.height, r86.image.height], a46.gl.RGBA8)), a46.activeTexture.set(a46.gl.TEXTURE0 + Ji.LUT), r86.texture && r86.texture.bind(a46.gl.LINEAR, a46.gl.CLAMP_TO_EDGE), t45.push("APPLY_LUT_ON_GPU")), o88.texcoordBuffer && (t45.push("HAS_ATTRIBUTE_a_uv_2f"), i26.push(o88.texcoordBuffer)), o88.colorBuffer && (t45.push(12 === o88.colorBuffer.itemSize ? "HAS_ATTRIBUTE_a_color_3f" : "HAS_ATTRIBUTE_a_color_4f"), i26.push(o88.colorBuffer)), o88.normalBuffer && (t45.push("HAS_ATTRIBUTE_a_normal_3f"), i26.push(o88.normalBuffer)), o88.pbrBuffer && (t45.push("HAS_ATTRIBUTE_a_pbr"), t45.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"), i26.push(o88.pbrBuffer)), "OPAQUE" !== n45.alphaMode && "MASK" !== n45.alphaMode || t45.push("UNPREMULT_TEXTURE_IN_SHADER"), n45.defined || t45.push("DIFFUSE_SHADED"); const p9 = s18.shadowRenderer; p9 && (t45.push("RENDER_SHADOWS", "DEPTH_TEXTURE"), p9.useNormalOffset && t45.push("NORMAL_OFFSET")); } function Fn(t45, i26, o88, s18, r86, n45) { const a46 = o88.paint.get("model-opacity").constantOr(1), l21 = i26.context, c28 = new ji(i26.context.gl.LEQUAL, ji.ReadWrite, i26.depthRangeFor3D), h8 = i26.transform, d34 = t45.mesh, u12 = d34.material, _4 = u12.pbrMetallicRoughness, p9 = i26.style.fog; let f8; f8 = "pixels" === i26.transform.projection.zAxisUnit ? [...t45.nodeModelMatrix] : e56.aB([], s18.zScaleMatrix, t45.nodeModelMatrix), e56.aB(f8, s18.negCameraPosMatrix, f8); const m6 = e56.bl([], f8); e56.ed(m6, m6); const g9 = "none" === o88.paint.get("model-color-use-theme").constantOr("default"), v8 = o88.paint.get("model-emissive-strength").constantOr(0), y4 = Dr(new Float32Array(t45.worldViewProjection), new Float32Array(f8), new Float32Array(m6), null, i26, a46, _4.baseColorFactor, u12.emissiveFactor, _4.metallicFactor, _4.roughnessFactor, u12, v8, o88), x4 = { defines: [] }, b8 = [], w4 = i26.shadowRenderer; w4 && (w4.useNormalOffset = false), Mn(x4.defines, b8, d34, i26, g9 ? null : o88.lut); let T5 = null; if (p9) { const e57 = On(t45.nodeModelMatrix, i26.transform); if (T5 = new Float32Array(e57), "globe" !== h8.projection.name) { const t46 = d34.aabb.min, i27 = d34.aabb.max, [o89, s19] = p9.getOpacityForBounds(e57, t46[0], t46[1], i27[0], i27[1]); x4.overrideFog = o89 >= Be || s19 >= Be; } } const E5 = io(i26, o88.paint.get("model-cutoff-fade-range")); E5.shouldRenderCutoff && x4.defines.push("RENDER_CUTOFF"); const S5 = i26.getOrCreateProgram("model", x4); i26.uploadCommonUniforms(l21, S5, null, T5, E5), "shadow" !== i26.renderPass && w4 && w4.setupShadowsFromMatrix(t45.nodeModelMatrix, S5), S5.draw(i26, l21.gl.TRIANGLES, c28, r86, n45, d34.material.doubleSided ? Zi.disabled : Zi.backCCW, y4, o88.id, d34.vertexBuffer, d34.indexBuffer, d34.segments, o88.paint, i26.transform.zoom, void 0, b8); } function Bn(t45, i26, o88, s18, r86, n45, a46) { let l21; l21 = "globe" === t45.projection.name ? e56.eu(o88, t45) : [...o88], e56.aB(l21, l21, i26.matrix); const c28 = e56.aB([], s18, l21); if (i26.meshes) for (const o89 of i26.meshes) { if ("BLEND" !== o89.material.alphaMode) { a46.push({ mesh: o89, depth: 0, modelIndex: r86, worldViewProjection: c28, nodeModelMatrix: l21 }); continue; } const i27 = e56.af([], o89.centroid, c28); !t45.isOrthographic && i27[2] <= 0 || n45.push({ mesh: o89, depth: i27[2], modelIndex: r86, worldViewProjection: c28, nodeModelMatrix: l21 }); } if (i26.children) for (const e57 of i26.children) Bn(t45, e57, o88, s18, r86, n45, a46); } function kn(e57, t45, i26, o88) { const s18 = i26.shadowRenderer; if (!s18) return; const r86 = s18.getShadowPassDepthMode(), n45 = s18.getShadowPassColorMode(), a46 = s18.calculateShadowPassMatrixFromMatrix(t45), l21 = Lr(a46); i26.getOrCreateProgram("modelDepth", { defines: i26._shadowMapDebug ? [] : ["DEPTH_TEXTURE"] }).draw(i26, i26.context.gl.TRIANGLES, r86, Gi.disabled, n45, Zi.backCCW, l21, o88.id, e57.vertexBuffer, e57.indexBuffer, e57.segments, o88.paint, i26.transform.zoom, void 0, void 0); } function Nn(t45, i26, o88) { const s18 = i26.updateZoomBasedPaintProperties(), r86 = (function(t46, i27, o89) { let s19, r87, n45, a46 = t46.terrain ? t46.terrain.exaggeration() : 0; if (t46.terrain && a46 > 0) { const i28 = t46.terrain, r88 = i28.findDEMTileFor(o89); r88 && r88.dem ? s19 = e56.ew.create(i28, o89, r88) : a46 = 0; } if (0 === a46 && (i27.terrainElevationMin = 0, i27.terrainElevationMax = 0), a46 === i27.validForExaggeration && (0 === a46 || s19 && s19._demTile && s19._demTile.tileID === i27.validForDEMTile.id && s19._dem._timestamp === i27.validForDEMTile.timestamp)) return false; for (const e57 in i27.instancesPerModel) { const t47 = i27.instancesPerModel[e57]; for (let e58 = 0; e58 < t47.instancedDataArray.length; ++e58) { const o90 = (s19 ? a46 * s19.getElevationAt(0 | t47.instancedDataArray.float32[16 * e58], 0 | t47.instancedDataArray.float32[16 * e58 + 1], true, true) : 0) + t47.instancesEvaluatedElevation[e58]; t47.instancedDataArray.float32[16 * e58 + 6] = o90, r87 = r87 ? Math.min(i27.terrainElevationMin, o90) : o90, n45 = n45 ? Math.max(i27.terrainElevationMax, o90) : o90; } } return i27.terrainElevationMin = r87 || 0, i27.terrainElevationMax = n45 || 0, i27.validForExaggeration = a46, i27.validForDEMTile = s19 && s19._demTile ? { id: s19._demTile.tileID, timestamp: s19._dem._timestamp } : { id: void 0, timestamp: 0 }, true; })(t45, i26, o88); (s18 || r86) && (i26.uploaded = false, i26.upload(t45.context)); } const Un = { shadowUniformsInitialized: false, useSingleShadowCascade: false, tileMatrix: new Float64Array(16), shadowTileMatrix: new Float32Array(16), aabb: new e56.d8([0, 0, 0], [e56.al, e56.al, 0]) }; function jn(t45, i26) { const o88 = 1 << t45.canonical.z, s18 = i26.getFreeCameraOptions().position, r86 = i26.elevation, n45 = t45.canonical.x / o88, a46 = (t45.canonical.x + 1) / o88, l21 = t45.canonical.y / o88, c28 = (t45.canonical.y + 1) / o88; let h8 = i26._centerAltitude; if (r86) { const e57 = r86.getMinMaxForTile(t45); e57 && e57.max > h8 && (h8 = e57.max); } const d34 = e56.aA(s18.x, n45, a46) - s18.x, u12 = e56.aA(s18.y, l21, c28) - s18.y, _4 = e56.ce(h8, i26.center.lat) - s18.z; return i26._zoomFromMercatorZ(Math.sqrt(d34 * d34 + u12 * u12 + _4 * _4)); } function Vn(e57, t45, i26, o88, s18, r86, n45) { const a46 = e57.context, l21 = "shadow" === e57.renderPass, c28 = e57.shadowRenderer, h8 = l21 && c28 ? c28.getShadowPassDepthMode() : new ji(a46.gl.LEQUAL, ji.ReadWrite, e57.depthRangeFor3D), d34 = e57.isTileAffectedByFog(r86); if (i26.meshes) for (const u12 of i26.meshes) { const _4 = ["MODEL_POSITION_ON_GPU"], p9 = []; let f8, m6, g9; o88.instancedDataArray.length > 20 && _4.push("INSTANCED_ARRAYS"); const v8 = io(e57, t45.paint.get("model-cutoff-fade-range")); if (v8.shouldRenderCutoff && _4.push("RENDER_CUTOFF"), l21 && c28) f8 = e57.getOrCreateProgram("modelDepth", { defines: _4 }), m6 = Lr(n45.shadowTileMatrix, n45.shadowTileMatrix, Float32Array.from(i26.matrix)), g9 = c28.getShadowPassColorMode(); else { Mn(_4, p9, u12, e57, "none" === t45.paint.get("model-color-use-theme").constantOr("default") ? null : t45.lut), f8 = e57.getOrCreateProgram("model", { defines: _4, overrideFog: d34 }); const o89 = u12.material, l22 = o89.pbrMetallicRoughness, h9 = t45.paint.get("model-opacity").constantOr(1), y5 = t45.paint.get("model-emissive-strength").constantOr(0); m6 = Dr(r86.expandedProjMatrix, Float32Array.from(i26.matrix), new Float32Array(16), null, e57, h9, l22.baseColorFactor, o89.emissiveFactor, l22.metallicFactor, l22.roughnessFactor, o89, y5, t45, s18), c28 && (n45.shadowUniformsInitialized ? f8.setShadowUniformValues(a46, c28.getShadowUniformValues()) : (c28.setupShadows(r86.toUnwrapped(), f8, "model-tile"), n45.shadowUniformsInitialized = true)), g9 = v8.shouldRenderCutoff || h9 < 1 || "OPAQUE" !== o89.alphaMode ? Ui.alphaBlended : Ui.unblended; } e57.uploadCommonUniforms(a46, f8, r86.toUnwrapped(), null, v8); const y4 = u12.material.doubleSided ? Zi.disabled : Zi.backCCW; if (o88.instancedDataArray.length > 20) p9.push(o88.instancedDataBuffer), f8.draw(e57, a46.gl.TRIANGLES, h8, Gi.disabled, g9, y4, m6, t45.id, u12.vertexBuffer, u12.indexBuffer, u12.segments, t45.paint, e57.transform.zoom, void 0, p9, o88.instancedDataArray.length); else { const i27 = l21 ? "u_instance" : "u_normal_matrix"; for (let s19 = 0; s19 < o88.instancedDataArray.length; ++s19) m6[i27] = new Float32Array(o88.instancedDataArray.arrayBuffer, 64 * s19, 16), f8.draw(e57, a46.gl.TRIANGLES, h8, Gi.disabled, g9, y4, m6, t45.id, u12.vertexBuffer, u12.indexBuffer, u12.segments, t45.paint, e57.transform.zoom, void 0, p9); } } if (i26.children) for (const a47 of i26.children) Vn(e57, t45, a47, o88, s18, r86, n45); } const Gn = [1, -1, 1]; function Hn(t45, i26, o88, s18) { if (!o88.modelManager) return true; const r86 = o88.modelManager; if (!o88.shadowRenderer) return true; const n45 = o88.shadowRenderer, a46 = i26.aabb; let l21 = true, c28 = t45.maxHeight; if (0 === c28) { let e57 = 0; for (const i27 in t45.instancesPerModel) { const t46 = r86.getModel(i27, s18); t46 ? e57 = Math.max(e57, Math.max(Math.max(t46.aabb.max[0], t46.aabb.max[1]), t46.aabb.max[2])) : l21 = false; } c28 = t45.maxScale * e57 * 1.41 + t45.maxVerticalOffset, l21 && (t45.maxHeight = c28); } a46.max[2] = c28, a46.min[2] += t45.terrainElevationMin, a46.max[2] += t45.terrainElevationMax, e56.af(a46.min, a46.min, i26.tileMatrix), e56.af(a46.max, a46.max, i26.tileMatrix); const h8 = a46.intersects(n45.getCurrentCascadeFrustum()); return 0 === o88.currentShadowCascade && (t45.isInsideFirstShadowMapFrustum = 2 === h8), 0 === h8; } function qn(t45, i26) { const o88 = t45.uniformValues.u_cutoff_params[0], s18 = t45.uniformValues.u_cutoff_params[1], r86 = t45.uniformValues.u_cutoff_params[2], n45 = t45.uniformValues.u_cutoff_params[3]; return s18 === o88 || n45 === r86 ? 1 : e56.aA(((i26 - o88) / (s18 - o88) - r86) / (n45 - r86), 0, 1); } function Zn(t45, i26, o88, s18) { if (i26.pitch < 20) return 1; const r86 = i26.getWorldToCameraMatrix(); e56.aB(r86, r86, t45); const n45 = e56.bU(o88.min[0], o88.min[1], o88.min[2], 1); let a46 = e56.aC(e56.ex(), n45, r86), l21 = a46, c28 = a46; n45[1] = o88.max[1], a46 = e56.aC(e56.ex(), n45, r86), l21 = a46[1] < l21[1] ? a46 : l21, c28 = a46[1] > c28[1] ? a46 : c28, n45[0] = o88.max[0], a46 = e56.aC(e56.ex(), n45, r86), l21 = a46[1] < l21[1] ? a46 : l21, c28 = a46[1] > c28[1] ? a46 : c28, n45[1] = o88.min[1], a46 = e56.aC(e56.ex(), n45, r86), l21 = a46[1] < l21[1] ? a46 : l21, c28 = a46[1] > c28[1] ? a46 : c28; const h8 = e56.aA(s18[0], 0, 1), d34 = 100 * i26.pixelsPerMeter * e56.aA(s18[1], 0, 1), u12 = e56.aA(s18[2], 0, 1), _4 = e56.ey(e56.ex(), l21, c28, h8), p9 = Math.tan(0.5 * i26.fovX), f8 = -_4[2] * p9; if (0 === d34) return _4[1] < -Math.abs(f8) ? u12 : 1; const m6 = (-Math.abs(f8) - _4[1]) / d34, g9 = (e57, t46, i27) => (1 - i27) * e57 + i27 * t46, v8 = e56.aA(g9(1, u12, m6), u12, 1); return g9(1, v8, e56.aA((i26.pitch - 20) / 20, 0, 1)); } class Wn { } class $n { constructor() { this._storage = /* @__PURE__ */ new Map(); } getLinesFromTrianglesBuffer(t45, i26, o88) { { const e57 = this._storage.get(i26.id); if (e57) return e57.lastUsedFrameIdx = t45, e57.buf; } const s18 = o88.gl, r86 = s18.getBufferParameter(s18.ELEMENT_ARRAY_BUFFER, s18.BUFFER_SIZE), n45 = new ArrayBuffer(r86), a46 = new Int16Array(n45); s18.getBufferSubData(s18.ELEMENT_ARRAY_BUFFER, 0, new Int16Array(n45)); const l21 = new e56.eA(); for (let e57 = 0; e57 < r86 / 2; e57 += 3) { const t46 = a46[e57], i27 = a46[e57 + 1], o89 = a46[e57 + 2]; l21.emplaceBack(t46, i27), l21.emplaceBack(i27, o89), l21.emplaceBack(o89, t46); } const c28 = o88.bindVertexArrayOES.current, h8 = new Wn(); return h8.buf = new zr(o88, l21), h8.lastUsedFrameIdx = t45, this._storage.set(i26.id, h8), o88.bindVertexArrayOES.set(c28), h8.buf; } update(e57) { for (const [t45, i26] of this._storage) e57 - i26.lastUsedFrameIdx > 30 && (i26.buf.destroy(), this._storage.delete(t45)); } destroy() { for (const [e57, t45] of this._storage) t45.buf.destroy(), this._storage.delete(e57); } } class Xn { constructor(e57) { this.occluderSize = 30, this.depthOffset = -1e-4, e57.registerParameter(this, ["Occlusion"], "occluderSize", { min: 1, max: 100, step: 1 }), e57.registerParameter(this, ["Occlusion"], "depthOffset", { min: -0.05, max: 0, step: 1e-5 }); } } const Yn = e56.ef([{ type: "Float32", name: "a_pos_3f", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }, { type: "Float32", name: "a_rainParticleData", components: 4 }]); class Kn { registerParameter() { } registerButton() { } registerBinding() { } refreshUI() { } } class Jn { constructor(e57, t45) { this.revealStart = 11, this.revealRange = 2, e57.registerParameter(this, [...t45, "Reveal"], "revealStart", { min: 0, max: 17, step: 0.05 }), e57.registerParameter(this, [...t45, "Reveal"], "revealRange", { min: 0.1, max: 5.1, step: 0.05 }); } } const Qn = e56.ef([{ type: "Float32", name: "a_pos_2f", components: 2 }]); class ea2 { destroy() { this.vignetteVx && this.vignetteVx.destroy(), this.vignetteIdx && this.vignetteIdx.destroy(); } draw(t45, i26) { const o88 = t45.getOrCreateProgram("vignette"); if (!this.vignetteVx || !this.vignetteIdx) { const i27 = new e56.eB(), o89 = new e56.b1(); i27.emplaceBack(-1, -1), i27.emplaceBack(1, -1), i27.emplaceBack(1, 1), i27.emplaceBack(-1, 1), o89.emplaceBack(0, 1, 2), o89.emplaceBack(0, 2, 3), this.vignetteVx = t45.context.createVertexBuffer(i27, Qn.members), this.vignetteIdx = t45.context.createIndexBuffer(o89); } const s18 = e56.bg.simpleSegment(0, 0, 4, 6); if (this.vignetteVx && this.vignetteIdx) { t45.uploadCommonUniforms(t45.context, o88); const e57 = { u_vignetteShape: (r86 = { vignetteShape: [i26.start, i26.range, Math.pow(10, i26.fadePower)], vignetteColor: [i26.color.r, i26.color.g, i26.color.b, i26.color.a * i26.strength] }).vignetteShape, u_vignetteColor: r86.vignetteColor }; o88.draw(t45, t45.context.gl.TRIANGLES, ji.disabled, Gi.disabled, Ui.alphaBlended, Zi.disabled, e57, "vignette", this.vignetteVx, this.vignetteIdx, s18); } var r86; } } class ta { constructor() { this._accumulatedOffsetX = 0, this._accumulatedOffsetY = 0, this._accumulatedElevation = 0; } update(t45, i26) { const o88 = t45.getFreeCameraOptions().position, s18 = o88.toAltitude(), r86 = o88.toLngLat(), n45 = e56.an(r86.lng), a46 = e56.an(r86.lat), l21 = t45.pixelsPerMeter / i26, c28 = n45 * e56.eD, h8 = e56.eD * Math.log(Math.tan(Math.PI / 4 + a46 / 2)); if (void 0 === this._offsetXPrev) this._offsetXPrev = 0, this._offsetYPrev = 0, this._elevationPrev = 0, this._accumulatedOffsetX = 0, this._accumulatedOffsetY = 0, this._accumulatedElevation = 0; else { const e57 = -this._offsetYPrev + h8, t46 = -this._elevationPrev + s18; this._accumulatedOffsetX += (-this._offsetXPrev + c28) * l21, this._accumulatedOffsetY += e57 * l21, this._accumulatedElevation += t46 * l21, this._offsetXPrev = c28, this._offsetYPrev = h8, this._elevationPrev = s18; } } getPosition() { return [this._accumulatedOffsetX, this._accumulatedOffsetY, this._accumulatedElevation]; } } function ia(e57, t45) { return [-(e57[0] - Math.floor(e57[0] / t45) * t45), -(e57[1] - Math.floor(e57[1] / t45) * t45), -(e57[2] - Math.floor(e57[2] / t45) * t45)]; } function oa(t45) { const i26 = e56.eo(1323123451230), o88 = []; for (let s18 = 0; s18 < t45; ++s18) { const t46 = 2 * i26() - 1, s19 = 2 * i26() - 1, r86 = 2 * i26() - 1; o88.push(e56.d4(t46, s19, r86)); } return o88; } function sa(t45, i26, o88, s18, r86) { const n45 = e56.aA((r86 - o88) / (s18 - o88), 0, 1); return (1 - n45) * t45 + n45 * i26; } class ra { constructor(e57) { this._movement = new ta(), this._accumulatedTimeFromStart = 0, this._prevTime = Date.now() / 1e3, this._vignette = new ea2(), this._ppmScaleFactor = e57; } destroy() { this.particlesVx && this.particlesVx.destroy(), this.particlesIdx && this.particlesIdx.destroy(), this._vignette && this._vignette.destroy(); } updateOnRender(t45, i26) { const o88 = t45.transform; this._movement.update(o88, this._ppmScaleFactor); const s18 = o88.starsProjMatrix, r86 = e56.c6([]); e56.c8(r86, r86, e56.an(90) - o88._pitch), e56.c7(r86, r86, -o88.angle); const n45 = e56.cb(new Float32Array(16), r86), a46 = e56.eC(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1), l21 = e56.ed([], a46), c28 = e56.aB([], l21, n45), h8 = Date.now() / 1e3; return this._accumulatedTimeFromStart += (h8 - this._prevTime) * i26, this._prevTime = h8, { projectionMatrix: s18, modelviewMatrix: c28 }; } } class na extends ra { constructor(e57) { super(4.25), this._params = { overrideStyleParameters: false, intensity: 0.5, timeFactor: 1, velocityConeAperture: 0, velocity: 300, boxSize: 2500, dropletSizeX: 1, dropletSizeYScale: 10, distortionStrength: 70, screenThinning: { intensity: 0.57, start: 0.46, range: 1.17, fadePower: 0.17, affectedRatio: 1, particleOffset: -0.2 }, color: { r: 0.66, g: 0.68, b: 0.74, a: 0.7 }, direction: { x: -50, y: -35 }, shapeDirPower: 2, shapeNormalPower: 1 }, this._revealParams = new Jn(e57.tp, ["Precipitation", "Rain"]), this._vignetteParams = { strength: 1, start: 0.7, range: 1, fadePower: 0.4, color: { r: 0.27, g: 0.27, b: 0.27, a: 1 } }, this.particlesCount = 16e3; } update(t45) { const i26 = t45.context; if (!this.particlesVx) { const t46 = oa(this.particlesCount), o88 = new e56.eE(), s18 = new e56.b1(); let r86 = 0; const n45 = e56.eo(1323123451230); for (let e57 = 0; e57 < t46.length; ++e57) { const i27 = t46[e57], a46 = [2 * n45() - 1, n45(), n45(), n45()]; o88.emplaceBack(i27[0], i27[1], i27[2], -1, -1, ...a46), o88.emplaceBack(i27[0], i27[1], i27[2], 1, -1, ...a46), o88.emplaceBack(i27[0], i27[1], i27[2], 1, 1, ...a46), o88.emplaceBack(i27[0], i27[1], i27[2], -1, 1, ...a46), s18.emplaceBack(r86 + 0, r86 + 1, r86 + 2), s18.emplaceBack(r86 + 0, r86 + 2, r86 + 3), r86 += 4; } this.particlesVx = i26.createVertexBuffer(o88, Yn.members), this.particlesIdx = i26.createIndexBuffer(s18); } } draw(t45) { if (!this._params.overrideStyleParameters && !t45.style.rain) return; const i26 = this._params.overrideStyleParameters ? this._revealParams : { revealStart: 0, revealRange: 0.01 }, o88 = t45.transform.zoom; if (i26.revealStart > o88) return; const s18 = sa(0, 1, i26.revealStart, i26.revealStart + i26.revealRange, o88); if (!this.particlesVx || !this.particlesIdx) return; const r86 = structuredClone(this._params); let n45 = [-r86.direction.x, r86.direction.y, -100]; e56.aw(n45, n45); const a46 = structuredClone(this._vignetteParams); a46.strength *= s18, r86.overrideStyleParameters || (r86.intensity = t45.style.rain.state.density, r86.timeFactor = t45.style.rain.state.intensity, r86.color = structuredClone(t45.style.rain.state.color), n45 = structuredClone(t45.style.rain.state.direction), r86.screenThinning.intensity = t45.style.rain.state.centerThinning, r86.dropletSizeX = t45.style.rain.state.dropletSize[0], r86.dropletSizeYScale = t45.style.rain.state.dropletSize[1] / t45.style.rain.state.dropletSize[0], r86.distortionStrength = 100 * t45.style.rain.state.distortionStrength, a46.strength = 1, a46.color = structuredClone(t45.style.rain.state.vignetteColor)); const l21 = this.updateOnRender(t45, r86.timeFactor), c28 = t45.context, h8 = c28.gl, d34 = t45.transform; this.screenTexture && this.screenTexture.size[0] === t45.width && this.screenTexture.size[1] === t45.height || (this.screenTexture = new e56.T(c28, { width: t45.width, height: t45.height, data: null }, h8.RGBA8)), r86.distortionStrength > 0 && (c28.activeTexture.set(h8.TEXTURE0), this.screenTexture.bind(h8.LINEAR, h8.CLAMP_TO_EDGE), h8.copyTexSubImage2D(h8.TEXTURE_2D, 0, 0, 0, 0, 0, t45.width, t45.height)); const u12 = t45.getOrCreateProgram("rainParticle"); t45.uploadCommonUniforms(c28, u12), c28.activeTexture.set(h8.TEXTURE0), this.screenTexture.bind(h8.LINEAR, h8.CLAMP_TO_EDGE); const _4 = [r86.color.r, r86.color.g, r86.color.b, r86.color.a], p9 = (i27, o89) => { const s19 = ia(this._movement.getPosition(), i27), a47 = r86.dropletSizeX, c29 = r86.dropletSizeX * r86.dropletSizeYScale, p10 = t45.width / 2, f8 = t45.height / 2, m6 = sa(0, r86.screenThinning.start, 0, 1, r86.screenThinning.intensity), g9 = sa(1e-3, r86.screenThinning.range, 0, 1, r86.screenThinning.intensity), v8 = sa(0, r86.screenThinning.particleOffset, 0, 1, r86.screenThinning.intensity), y4 = (x4 = { modelview: l21.modelviewMatrix, projection: l21.projectionMatrix, time: this._accumulatedTimeFromStart, camPos: s19, velocityConeAperture: r86.velocityConeAperture, velocity: r86.velocity, boxSize: i27, rainDropletSize: [a47, c29], distortionStrength: r86.distortionStrength, rainDirection: n45, color: _4, screenSize: [d34.width, d34.height], thinningCenterPos: [p10, f8], thinningShape: [m6, g9, Math.pow(10, r86.screenThinning.fadePower)], thinningAffectedRatio: r86.screenThinning.affectedRatio, thinningParticleOffset: v8, shapeDirectionalPower: r86.shapeDirPower, shapeNormalPower: r86.shapeNormalPower, mode: o89 ? 0 : 1 }, { u_modelview: Float32Array.from(x4.modelview), u_projection: Float32Array.from(x4.projection), u_time: x4.time, u_cam_pos: x4.camPos, u_texScreen: 0, u_velocityConeAperture: x4.velocityConeAperture, u_velocity: x4.velocity, u_boxSize: x4.boxSize, u_rainDropletSize: x4.rainDropletSize, u_distortionStrength: x4.distortionStrength, u_rainDirection: x4.rainDirection, u_color: x4.color, u_screenSize: x4.screenSize, u_thinningCenterPos: x4.thinningCenterPos, u_thinningShape: x4.thinningShape, u_thinningAffectedRatio: x4.thinningAffectedRatio, u_thinningParticleOffset: x4.thinningParticleOffset, u_shapeDirectionalPower: x4.shapeDirectionalPower, u_shapeNormalPower: x4.shapeNormalPower, u_mode: x4.mode }); var x4; const b8 = Math.round(r86.intensity * this.particlesCount), w4 = e56.bg.simpleSegment(0, 0, 4 * b8, 2 * b8); u12.draw(t45, h8.TRIANGLES, ji.disabled, Gi.disabled, Ui.alphaBlended, Zi.disabled, y4, "rain_particles", this.particlesVx, this.particlesIdx, w4); }; r86.distortionStrength > 0 && p9(r86.boxSize, true), p9(r86.boxSize, false), this._vignette.draw(t45, a46); } } const aa2 = e56.ef([{ type: "Float32", name: "a_pos_3f", components: 3 }, { type: "Float32", name: "a_uv", components: 2 }, { type: "Float32", name: "a_snowParticleData", components: 4 }, { type: "Float32", name: "a_snowParticleDataHorizontalOscillation", components: 2 }]); class la extends ra { constructor(e57) { super(2.25), this._params = { overrideStyleParameters: false, intensity: 0.85, timeFactor: 0.75, velocityConeAperture: 70, velocity: 40, horizontalOscillationRadius: 4, horizontalOscillationRate: 1.5, boxSize: 2e3, billboardSize: 2, shapeFadeStart: 0.27, shapeFadePower: 0.21, screenThinning: { intensity: 0.4, start: 0.15, range: 1.4, fadePower: 0.24, affectedRatio: 1, particleOffset: -0.2 }, color: { r: 1, g: 1, b: 1, a: 1 }, direction: { x: -50, y: -35 } }, this._revealParams = new Jn(e57.tp, ["Precipitation", "Snow"]), this._vignetteParams = { strength: 0.3, start: 0.78, range: 0.46, fadePower: 0.2, color: { r: 1, g: 1, b: 1, a: 1 } }, this.particlesCount = 16e3; } update(t45) { const i26 = t45.context; if (!this.particlesVx) { const t46 = oa(this.particlesCount), o88 = new e56.eF(), s18 = new e56.b1(); let r86 = 0; const n45 = e56.eo(1323123451230); for (let e57 = 0; e57 < t46.length; ++e57) { const i27 = t46[e57], a46 = n45(), l21 = n45(), c28 = n45(), h8 = [e57 / t46.length, a46, l21, c28], d34 = [n45(), n45()]; o88.emplaceBack(i27[0], i27[1], i27[2], -1, -1, ...h8, ...d34), o88.emplaceBack(i27[0], i27[1], i27[2], 1, -1, ...h8, ...d34), o88.emplaceBack(i27[0], i27[1], i27[2], 1, 1, ...h8, ...d34), o88.emplaceBack(i27[0], i27[1], i27[2], -1, 1, ...h8, ...d34), s18.emplaceBack(r86 + 0, r86 + 1, r86 + 2), s18.emplaceBack(r86 + 0, r86 + 2, r86 + 3), r86 += 4; } this.particlesVx = i26.createVertexBuffer(o88, aa2.members), this.particlesIdx = i26.createIndexBuffer(s18); } } draw(t45) { if (!this._params.overrideStyleParameters && !t45.style.snow) return; const i26 = structuredClone(this._params); let o88 = [-i26.direction.x, i26.direction.y, -100]; e56.aw(o88, o88); const s18 = structuredClone(this._vignetteParams), r86 = i26.overrideStyleParameters ? this._revealParams : { revealStart: 0, revealRange: 0.01 }, n45 = t45.transform.zoom; if (r86.revealStart > n45) return; const a46 = sa(0, 1, r86.revealStart, r86.revealStart + r86.revealRange, n45); s18.strength *= a46, i26.overrideStyleParameters || (i26.intensity = t45.style.snow.state.density, i26.timeFactor = t45.style.snow.state.intensity, i26.color = structuredClone(t45.style.snow.state.color), o88 = structuredClone(t45.style.snow.state.direction), i26.screenThinning.intensity = t45.style.snow.state.centerThinning, i26.billboardSize = 2.79 * t45.style.snow.state.flakeSize, s18.strength = 1, s18.color = structuredClone(t45.style.snow.state.vignetteColor)); const l21 = this.updateOnRender(t45, i26.timeFactor); if (!this.particlesVx || !this.particlesIdx) return; const c28 = t45.context, h8 = c28.gl, d34 = t45.transform, u12 = t45.getOrCreateProgram("snowParticle"); t45.uploadCommonUniforms(c28, u12), ((i27, s19, r87) => { const n46 = ia(this._movement.getPosition(), i27), a47 = d34.width / 2, c29 = d34.height / 2, _4 = sa(0, r87.screenThinning.start, 0, 1, r87.screenThinning.intensity), p9 = sa(1e-3, r87.screenThinning.range, 0, 1, r87.screenThinning.intensity), f8 = sa(0, r87.screenThinning.particleOffset, 0, 1, r87.screenThinning.intensity), m6 = (g9 = { modelview: l21.modelviewMatrix, projection: l21.projectionMatrix, time: this._accumulatedTimeFromStart, camPos: n46, velocityConeAperture: r87.velocityConeAperture, velocity: r87.velocity, horizontalOscillationRadius: r87.horizontalOscillationRadius, horizontalOscillationRate: r87.horizontalOscillationRate, boxSize: i27, billboardSize: 1 * r87.billboardSize, simpleShapeParameters: [r87.shapeFadeStart, r87.shapeFadePower], screenSize: [d34.width, d34.height], thinningCenterPos: [a47, c29], thinningShape: [_4, p9, Math.pow(10, r87.screenThinning.fadePower)], thinningAffectedRatio: r87.screenThinning.affectedRatio, thinningParticleOffset: f8, color: [r87.color.r, r87.color.g, r87.color.b, r87.color.a], direction: o88 }, { u_modelview: Float32Array.from(g9.modelview), u_projection: Float32Array.from(g9.projection), u_time: g9.time, u_cam_pos: g9.camPos, u_velocityConeAperture: g9.velocityConeAperture, u_velocity: g9.velocity, u_horizontalOscillationRadius: g9.horizontalOscillationRadius, u_horizontalOscillationRate: g9.horizontalOscillationRate, u_boxSize: g9.boxSize, u_billboardSize: g9.billboardSize, u_simpleShapeParameters: g9.simpleShapeParameters, u_screenSize: g9.screenSize, u_thinningCenterPos: g9.thinningCenterPos, u_thinningShape: g9.thinningShape, u_thinningAffectedRatio: g9.thinningAffectedRatio, u_thinningParticleOffset: g9.thinningParticleOffset, u_particleColor: g9.color, u_direction: g9.direction }); var g9; const v8 = Math.round(r87.intensity * this.particlesCount), y4 = e56.bg.simpleSegment(0, 0, 4 * v8, 2 * v8); this.particlesVx && this.particlesIdx && u12.draw(t45, h8.TRIANGLES, ji.disabled, Gi.disabled, Ui.alphaBlended, Zi.disabled, m6, "snow_particles", this.particlesVx, this.particlesIdx, y4); })(i26.boxSize, 0, i26), this._vignette.draw(t45, s18); } } const ca3 = { symbol: function(t45, i26, o88, s18, r86) { if ("translucent" !== t45.renderPass) return; const n45 = Gi.disabled, a46 = t45.colorModeForRenderPass(), l21 = o88.layout.get("text-variable-anchor"), c28 = o88.layout.get("text-size-scale-range"), h8 = e56.aA(t45.scaleFactor, c28[0], c28[1]); l21 && (function(t46, i27, o89, s19, r87, n46, a47, l22) { const c29 = i27.transform, h9 = "map" === r87, d35 = "map" === n46; for (const i28 of t46) { const t47 = s19.getTile(i28), r88 = t47.getBucket(o89); if (!r88 || !r88.text || !r88.text.segments.get().length) continue; const n47 = e56.bK(r88.textSizeData, c29.zoom, l22), u13 = qt(i28, r88.getProjection(), c29), _4 = c29.calculatePixelsToTileUnitsMatrix(t47), p9 = Yt2(u13, t47.tileID.canonical, d35, h9, c29, r88.getProjection(), _4), f8 = r88.hasIconTextFit() && r88.hasIconData(); n47 && Gr(r88, h9, d35, a47, c29, p9, i28, Math.pow(2, c29.zoom - t47.tileID.overscaledZ), n47, f8); } })(s18, t45, o88, i26, o88.layout.get("text-rotation-alignment"), o88.layout.get("text-pitch-alignment"), r86, h8); const d34 = 0 !== o88.paint.get("icon-opacity").constantOr(1), u12 = 0 !== o88.paint.get("text-opacity").constantOr(1); void 0 !== o88.layout.get("symbol-sort-key").constantOr(1) && (d34 || u12) ? Hr(t45, i26, o88, s18, n45, a46) : (d34 && Hr(t45, i26, o88, s18, n45, a46, { onlyIcons: true }), u12 && Hr(t45, i26, o88, s18, n45, a46, { onlyText: true })), i26.map.showCollisionBoxes && (Nr(t45, i26, o88, s18, o88.paint.get("text-translate"), o88.paint.get("text-translate-anchor"), true), Nr(t45, i26, o88, s18, o88.paint.get("icon-translate"), o88.paint.get("icon-translate-anchor"), false)); }, circle: function(t45, i26, o88, s18) { if ("translucent" !== t45.renderPass) return; const r86 = o88.paint.get("circle-opacity"), n45 = o88.paint.get("circle-stroke-width"), a46 = o88.paint.get("circle-stroke-opacity"), l21 = void 0 !== o88.layout.get("circle-sort-key").constantOr(1), c28 = o88.paint.get("circle-emissive-strength"); if (0 === r86.constantOr(1) && (0 === n45.constantOr(1) || 0 === a46.constantOr(1))) return; const h8 = t45.context, d34 = h8.gl, u12 = t45.transform, _4 = !(!t45.terrain || !t45.terrain.enabled), p9 = o88.layout.get("circle-elevation-reference"), f8 = t45.depthModeForSublayer(0, ji.ReadOnly), m6 = new ji(t45.context.gl.LEQUAL, ji.ReadOnly, t45.depthRangeFor3D), g9 = "none" === p9 || _4 ? f8 : m6, v8 = Gi.disabled, y4 = t45.colorModeForDrapableLayerRenderPass(c28), x4 = "globe" === u12.projection.name, b8 = [e56.aF(u12.center.lng), e56.aJ(u12.center.lat)], w4 = []; for (let r87 = 0; r87 < s18.length; r87++) { const n46 = s18[r87], a47 = i26.getTile(n46), c29 = a47.getBucket(o88); if (!c29 || c29.projection.name !== u12.projection.name) continue; const h9 = c29.programConfigurations.get(o88.id), d35 = c29.layoutVertexBuffer, _5 = c29.globeExtVertexBuffer, p10 = c29.indexBuffer, f9 = e56.dZ(o88), m7 = [_5], g10 = t45.isTileAffectedByFog(n46); x4 && f9.push("PROJECTION_GLOBE_VIEW"), f9.push("DEPTH_D24"), t45.terrain && u12.depthOcclusionForSymbolsAndCircles && f9.push("DEPTH_OCCLUSION"), c29.hasElevation && !t45.terrain && (f9.push("ELEVATED_ROADS"), m7.push(c29.elevatedLayoutVertexBuffer)); const v9 = t45.getOrCreateProgram("circle", { config: h9, defines: f9, overrideFog: g10 }), y5 = u12.projection.createInversionMatrix(u12, n46.canonical), T6 = { programConfiguration: h9, program: v9, layoutVertexBuffer: d35, dynamicBuffers: m7, indexBuffer: p10, uniformValues: e56.d_(t45, n46, a47, y5, b8, o88), tile: a47 }; if (l21) { const t46 = c29.segments.get(); for (const i27 of t46) w4.push({ segments: new e56.bg([i27]), sortKey: i27.sortKey, state: T6 }); } else w4.push({ segments: c29.segments, sortKey: 0, state: T6 }); } l21 && w4.sort(((e57, t46) => e57.sortKey - t46.sortKey)); const T5 = { useDepthForOcclusion: u12.depthOcclusionForSymbolsAndCircles }; for (const e57 of w4) { const { programConfiguration: i27, program: s19, layoutVertexBuffer: r87, dynamicBuffers: n46, indexBuffer: a47, uniformValues: l22, tile: c29 } = e57.state, _5 = e57.segments; t45.terrain && t45.terrain.setupElevationDraw(c29, s19, T5), t45.uploadCommonUniforms(h8, s19, c29.tileID.toUnwrapped()), s19.draw(t45, d34.TRIANGLES, g9, v8, y4, Zi.disabled, l22, o88.id, r87, a47, _5, o88.paint, u12.zoom, i27, n46); } }, heatmap: function(t45, i26, o88, s18) { if (0 !== o88.paint.get("heatmap-opacity")) if ("offscreen" === t45.renderPass) { const r86 = t45.context, n45 = r86.gl, a46 = Gi.disabled, l21 = new Ui([n45.ONE, n45.ONE, n45.ONE, n45.ONE], e56.ao.transparent, [true, true, true, true]); !(function(e57, t46, i27, o89) { const s19 = e57.gl, r87 = t46.width * o89, n46 = t46.height * o89; e57.activeTexture.set(s19.TEXTURE1), e57.viewport.set([0, 0, r87, n46]); let a47 = i27.heatmapFbo; if (!a47 || a47 && (a47.width !== r87 || a47.height !== n46)) { a47 && a47.destroy(); const t47 = s19.createTexture(); s19.bindTexture(s19.TEXTURE_2D, t47), s19.texParameteri(s19.TEXTURE_2D, s19.TEXTURE_WRAP_S, s19.CLAMP_TO_EDGE), s19.texParameteri(s19.TEXTURE_2D, s19.TEXTURE_WRAP_T, s19.CLAMP_TO_EDGE), s19.texParameteri(s19.TEXTURE_2D, s19.TEXTURE_MIN_FILTER, s19.LINEAR), s19.texParameteri(s19.TEXTURE_2D, s19.TEXTURE_MAG_FILTER, s19.LINEAR), a47 = i27.heatmapFbo = e57.createFramebuffer(r87, n46, true, null), (function(e58, t48, i28, o90, s20, r88) { const n47 = e58.gl; n47.texImage2D(n47.TEXTURE_2D, 0, e58.extRenderToTextureHalfFloat ? n47.RGBA16F : n47.RGBA, s20, r88, 0, n47.RGBA, e58.extRenderToTextureHalfFloat ? n47.HALF_FLOAT : n47.UNSIGNED_BYTE, null), o90.colorAttachment.set(i28); })(e57, 0, t47, a47, r87, n46); } else s19.bindTexture(s19.TEXTURE_2D, a47.colorAttachment.get()), e57.bindFramebuffer.set(a47.framebuffer); })(r86, t45, o88, "globe" === t45.transform.projection.name ? 0.5 : 0.25), r86.clear({ color: e56.ao.transparent }); const c28 = t45.transform, h8 = "globe" === c28.projection.name, d34 = h8 ? ["PROJECTION_GLOBE_VIEW"] : [], u12 = h8 ? Zi.frontCCW : Zi.disabled, _4 = [e56.aF(c28.center.lng), e56.aJ(c28.center.lat)]; for (let e57 = 0; e57 < s18.length; e57++) { const p9 = s18[e57]; if (i26.hasRenderableParent(p9)) continue; const f8 = i26.getTile(p9), m6 = f8.getBucket(o88); if (!m6 || m6.projection.name !== c28.projection.name) continue; const g9 = t45.isTileAffectedByFog(p9), v8 = m6.programConfigurations.get(o88.id), y4 = t45.getOrCreateProgram("heatmap", { config: v8, defines: d34, overrideFog: g9 }), { zoom: x4 } = t45.transform; t45.terrain && t45.terrain.setupElevationDraw(f8, y4), t45.uploadCommonUniforms(r86, y4, p9.toUnwrapped()); const b8 = c28.projection.createInversionMatrix(c28, p9.canonical); y4.draw(t45, n45.TRIANGLES, ji.disabled, a46, l21, u12, mr(t45, p9, f8, b8, _4, x4, o88.paint.get("heatmap-intensity")), o88.id, m6.layoutVertexBuffer, m6.indexBuffer, m6.segments, o88.paint, t45.transform.zoom, v8, h8 ? [m6.globeExtVertexBuffer] : null); } r86.viewport.set([0, 0, t45.width, t45.height]); } else "translucent" === t45.renderPass && (t45.context.setColorMode(t45.colorModeForRenderPass()), (function(t46, i27) { const o89 = t46.context, s19 = o89.gl, r86 = i27.heatmapFbo; if (!r86) return; o89.activeTexture.set(s19.TEXTURE0), s19.bindTexture(s19.TEXTURE_2D, r86.colorAttachment.get()), o89.activeTexture.set(s19.TEXTURE1); let n45 = i27.colorRampTexture; n45 || (n45 = i27.colorRampTexture = new e56.T(o89, i27.colorRamp, s19.RGBA8)), n45.bind(s19.LINEAR, s19.CLAMP_TO_EDGE), t46.getOrCreateProgram("heatmapTexture").draw(t46, s19.TRIANGLES, ji.disabled, Gi.disabled, t46.colorModeForRenderPass(), Zi.disabled, ((e57, t47, i28, o90) => ({ u_image: 0, u_color_ramp: 1, u_opacity: t47.paint.get("heatmap-opacity") }))(0, i27), i27.id, t46.viewportBuffer, t46.quadTriangleIndexBuffer, t46.viewportSegments, i27.paint, t46.transform.zoom); })(t45, o88)); }, line: function(t45, i26, o88, s18) { if ("translucent" !== t45.renderPass) return; const r86 = o88.paint.get("line-opacity"), n45 = o88.paint.get("line-width"); if (0 === r86.constantOr(1) || 0 === n45.constantOr(1)) return; const a46 = o88.paint.get("line-emissive-strength"), l21 = o88.paint.get("line-occlusion-opacity"), c28 = o88.layout.get("line-elevation-reference"), h8 = "meters" === o88.layout.get("line-width-unit"), d34 = "sea" === c28, u12 = !(!t45.terrain || !t45.terrain.enabled), _4 = t45.context, p9 = _4.gl; if (o88.hasElevatedBuckets && "globe" === t45.transform.projection.name) return; const f8 = o88.layout.get("line-cross-slope"), m6 = void 0 !== f8, g9 = f8 < 1, v8 = t45.colorModeForDrapableLayerRenderPass(a46), y4 = t45.terrain && t45.terrain.renderingToTexture, x4 = y4 ? 1 : e56.o.devicePixelRatio, b8 = o88.paint.get("line-dasharray"), w4 = b8.constantOr(1), T5 = o88.layout.get("line-cap"), E5 = b8.constantOr(null), S5 = T5.constantOr(null), I4 = o88.paint.get("line-pattern"), C6 = I4.constantOr(1), R5 = o88.paint.get("line-pattern-cross-fade"), A4 = I4.constantOr(null), D5 = o88.paint.get("line-opacity").constantOr(1); let L3 = !C6 && 1 !== D5 || t45.depthOcclusion && l21 > 0 && l21 < 1; const P4 = o88.paint.get("line-gradient"), z4 = C6 ? "linePattern" : "line", O4 = e56.d$(o88); let M5; if (y4 && t45.terrain && t45.terrain.clipOrMaskOverlapStencilType() && (L3 = false), 0 !== l21 && t45.depthOcclusion) { const t46 = o88.paint._values["line-opacity"]; t46 && t46.value && "constant" === t46.value.kind ? M5 = t46.value : e56.w(`Occlusion opacity for layer ${o88.id} is supported only when line-opacity isn't data-driven.`); } "constant" !== n45.value.kind && false === n45.value.isLineProgressConstant && O4.push("VARIABLE_LINE_WIDTH"); const F17 = (s19, r87, n46, a47, c29, u13) => { for (const f9 of s19) { const s20 = i26.getTile(f9); if (C6 && !s20.patternsLoaded()) continue; const m7 = s20.getBucket(o88); if (!m7) continue; if ("none" !== m7.elevationType && !c29 || "none" === m7.elevationType && c29) continue; t45.prepareDrawTile(); const g10 = [...r87], b9 = t45.shadowRenderer, T6 = "road" === m7.elevationType && !!b9 && b9.enabled; let I5 = [0, 0, 0]; if (T6) { const e57 = t45.style.directionalLight, i27 = t45.style.ambientLight; e57 && i27 && (I5 = co(t45.style, e57, i27)), g10.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET"); } const O5 = m7.programConfigurations.get(o88.id); let F18 = false; if (A4 && s20.imageAtlas) { const t46 = e56.e0.from(A4), i27 = t46.getPrimary().scaleSelf(x4).toString(), o89 = s20.imageAtlas.patternPositions.get(i27), r88 = t46.getSecondary(), n47 = r88 ? s20.imageAtlas.patternPositions.get(r88.scaleSelf(x4).toString()) : null; F18 = !!o89 && !!n47, o89 && O5.setConstantPatternPositions(o89, n47); } R5 > 0 && (F18 || O5.getPatternTransitionVertexBuffer("line-pattern")) && g10.push("LINE_PATTERN_TRANSITION"); const B7 = t45.isTileAffectedByFog(f9), k8 = t45.getOrCreateProgram(z4, { config: O5, defines: g10, overrideFog: B7 }); if (!C6 && E5 && S5 && s20.lineAtlas) { const e57 = s20.lineAtlas.getDash(E5, S5); e57 && O5.setConstantPatternPositions(e57); } T6 && b9.setupShadows(s20.tileID.toUnwrapped(), k8, "vector-tile"); let [N5, U4] = o88.paint.get("line-trim-offset"); if ("round" === S5 || "square" === S5) { const e57 = 1; N5 !== U4 && (0 === N5 && (N5 -= e57), 1 === U4 && (U4 += e57)); } const j4 = y4 ? f9.projMatrix : null, V4 = h8 ? 1 / m7.tileToMeter / e56.ay(s20, 1, t45.transform.zoom) : 1, G5 = h8 ? 1 / m7.tileToMeter / e56.ay(s20, 1, Math.floor(t45.transform.zoom)) : 1, H4 = C6 ? e56.e1(t45, s20, o88, j4, x4, V4, G5, [N5, U4], I5, R5) : e56.e2(t45, s20, o88, j4, m7.lineClipsArray.length, x4, V4, G5, [N5, U4], I5); if (P4) { const s21 = m7.gradients[o88.id]; let r88 = s21.texture; if (o88.gradientVersion !== s21.version) { let n47 = 256; if (o88.stepInterpolant) { const o89 = i26.getSource().maxzoom, s22 = f9.canonical.z === o89 ? Math.ceil(1 << t45.transform.maxZoom - f9.canonical.z) : 1; n47 = e56.aA(e56.e3(m7.maxLineLength / e56.al * 1024 * s22), 256, _4.maxTextureSize); } s21.gradient = e56.e4({ expression: o88.gradientExpression(), evaluationKey: "lineProgress", resolution: n47, image: s21.gradient || void 0, clips: m7.lineClipsArray }), s21.texture ? s21.texture.update(s21.gradient) : s21.texture = new e56.T(_4, s21.gradient, p9.RGBA8), s21.version = o88.gradientVersion, r88 = s21.texture; } _4.activeTexture.set(p9.TEXTURE1), r88.bind(o88.stepInterpolant ? p9.NEAREST : p9.LINEAR, p9.CLAMP_TO_EDGE); } w4 && (_4.activeTexture.set(p9.TEXTURE0), s20.lineAtlasTexture && s20.lineAtlasTexture.bind(p9.LINEAR, p9.REPEAT), O5.updatePaintBuffers()), C6 && (_4.activeTexture.set(p9.TEXTURE0), s20.imageAtlasTexture && s20.imageAtlasTexture.bind(p9.LINEAR, p9.CLAMP_TO_EDGE), O5.updatePaintBuffers()), c29 && !d34 && t45.terrain.setupElevationDraw(s20, k8), t45.uploadCommonUniforms(_4, k8, f9.toUnwrapped()); const q3 = (e57) => { null != M5 && (M5.value = D5 * l21), k8.draw(t45, p9.TRIANGLES, n46, e57, v8, Zi.disabled, H4, o88.id, m7.layoutVertexBuffer, m7.indexBuffer, m7.segments, o88.paint, t45.transform.zoom, O5, [m7.layoutVertexBuffer2, m7.patternVertexBuffer, m7.zOffsetVertexBuffer]), null != M5 && (M5.value = D5); }; if (L3 && !c29) { const e57 = t45.stencilModeForClipping(f9).ref; 0 === e57 && y4 && _4.clear({ stencil: 0 }); const i27 = { func: p9.EQUAL, mask: 255 }; H4.u_alpha_discard_threshold = 0.8, q3(new Gi(i27, e57, 255, p9.KEEP, p9.KEEP, p9.INVERT)), H4.u_alpha_discard_threshold = 0, q3(new Gi(i27, e57, 255, p9.KEEP, p9.KEEP, p9.KEEP)); } else H4.u_alpha_discard_threshold = L3 && c29 && u13 ? 0.8 : 0, q3(c29 ? a47 : t45.stencilModeForClipping(f9)); } }; let B6 = t45.depthModeForSublayer(0, ji.ReadOnly); const k7 = new ji(t45.depthOcclusion ? p9.GREATER : p9.LEQUAL, ji.ReadOnly, t45.depthRangeFor3D); if (o88.hasNonElevatedBuckets) { const i27 = !y4 && t45.terrain; 0 !== l21 && i27 ? e56.w(`Occlusion opacity for layer ${o88.id} is supported on terrain only if the layer has line-z-offset enabled.`) : i27 ? e56.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o88.id}.`) : F17(s18, O4, B6, Gi.disabled, false, true); } if (o88.hasElevatedBuckets) { "hd-road-markup" === c28 ? u12 || (B6 = k7, O4.push("ELEVATED_ROADS")) : (O4.push("ELEVATED"), B6 = k7, m6 && O4.push(g9 ? "CROSS_SLOPE_HORIZONTAL" : "CROSS_SLOPE_VERTICAL"), d34 && O4.push("ELEVATION_REFERENCE_SEA")); const e57 = L3 ? t45.stencilModeFor3D() : Gi.disabled; t45.forceTerrainMode = true, F17(s18, O4, B6, e57, true, true), L3 && F17(s18, O4, B6, e57, true, false), t45.forceTerrainMode = false; } L3 && (t45.resetStencilClippingMasks(), y4 && _4.clear({ stencil: 0 })), 0 === l21 || t45.depthOcclusion || y4 || t45.layersWithOcclusionOpacity.push(t45.currentLayer); }, fill: function(t45, i26, o88, s18) { const r86 = o88.paint.get("fill-color"), n45 = o88.paint.get("fill-opacity"); if (0 === n45.constantOr(1)) return; const a46 = o88.paint.get("fill-emissive-strength"), l21 = t45.colorModeForDrapableLayerRenderPass(a46), c28 = o88.paint.get("fill-pattern"), h8 = t45.opaquePassEnabledForLayer() && !c28.constantOr(1) && 1 === r86.constantOr(e56.ao.transparent).a && 1 === n45.constantOr(0) ? "opaque" : "translucent"; let d34 = "none"; "none" !== o88.layout.get("fill-elevation-reference") ? d34 = "road" : 0 !== o88.paint.get("fill-z-offset").constantOr(1) && (d34 = "offset"); const u12 = !(!t45.terrain || !t45.terrain.enabled), _4 = { painter: t45, sourceCache: i26, layer: o88, coords: s18, colorMode: l21, elevationType: d34, terrainEnabled: u12, pass: h8 }; if ("shadow" !== t45.renderPass) if ("offset" !== d34) { if ($r(_4, false), "road" === d34) { const e57 = !u12 && "translucent" === t45.renderPass; e57 && Wr(t45, i26, o88, s18, "geometry"), $r(_4, true, Gi.disabled), e57 && (function(e58) { const { painter: t46, sourceCache: i27, layer: o89, coords: s19, colorMode: r87 } = e58, n46 = t46.context.gl, a47 = e58.painter.shadowRenderer, l22 = !!a47 && a47.enabled, c29 = new ji(t46.context.gl.LEQUAL, ji.ReadOnly, t46.depthRangeFor3D); let h9 = [0, 0, 0]; if (l22) { const e59 = t46.style.directionalLight, i28 = t46.style.ambientLight; e59 && i28 && (h9 = co(t46.style, e59, i28)); } const d35 = (e59) => { for (const d36 of s19) { const s20 = i27.getTile(d36), u13 = s20.getBucket(o89); if (!u13) continue; const _5 = u13.elevatedStructures; if (!_5) continue; let p9, f8; if (e59 ? (p9 = _5.renderableBridgeSegments, f8 = _5.bridgeProgramConfigurations.get(o89.id)) : (p9 = _5.renderableTunnelSegments, f8 = _5.tunnelProgramConfigurations.get(o89.id)), !p9 || 0 === p9.segments[0].primitiveLength) continue; f8.updatePaintBuffers(), t46.prepareDrawTile(); const m6 = t46.isTileAffectedByFog(d36), g9 = []; l22 && g9.push("RENDER_SHADOWS", "DEPTH_TEXTURE", "NORMAL_OFFSET"); const v8 = t46.getOrCreateProgram("elevatedStructures", { config: f8, overrideFog: m6, defines: g9 }), y4 = t46.translatePosMatrix(d36.projMatrix, s20, o89.paint.get("fill-translate"), o89.paint.get("fill-translate-anchor")); l22 && a47.setupShadows(s20.tileID.toUnwrapped(), v8, "vector-tile"); const x4 = lr(y4, h9); t46.uploadCommonUniforms(t46.context, v8, d36.toUnwrapped()), v8.draw(t46, n46.TRIANGLES, c29, Gi.disabled, r87, Zi.backCCW, x4, o89.id, _5.vertexBuffer, _5.indexBuffer, p9, o89.paint, t46.transform.zoom, f8, [_5.vertexBufferNormal]); } }; d35(true), d35(false); })(_4); } } else $r(_4, false, t45.stencilModeFor3D()); else t45.shadowRenderer && "road" === d34 && !u12 && (function(e57) { const { painter: t46, sourceCache: i27, layer: o89, coords: s19 } = e57, r87 = t46.context.gl, n46 = e57.painter.shadowRenderer; for (const e58 of s19) { const s20 = i27.getTile(e58), a47 = s20.getBucket(o89); if (!a47) continue; const l22 = a47.elevatedStructures; if (!l22) continue; if (!l22.shadowCasterSegments || 0 === l22.shadowCasterSegments.segments[0].primitiveLength) continue; t46.prepareDrawTile(); const c29 = a47.bufferData.programConfigurations.get(o89.id), h9 = t46.isTileAffectedByFog(e58), d35 = t46.getOrCreateProgram("elevatedStructuresDepth", { config: c29, overrideFog: h9 }), u13 = n46.calculateShadowPassMatrixFromTile(s20.tileID.toUnwrapped()); t46.uploadCommonUniforms(t46.context, d35, e58.toUnwrapped()); const _5 = { u_matrix: u13, u_depth_bias: 0 }; d35.draw(t46, r87.TRIANGLES, n46.getShadowPassDepthMode(), Gi.disabled, n46.getShadowPassColorMode(), Zi.disabled, _5, o89.id, l22.vertexBuffer, l22.indexBuffer, l22.shadowCasterSegments, o89.paint, t46.transform.zoom, c29); } })(_4); }, "fill-extrusion": function(t45, i26, o88, s18) { const r86 = o88.paint.get("fill-extrusion-opacity"), n45 = t45.context, a46 = n45.gl, l21 = t45.terrain, c28 = l21 && l21.renderingToTexture; if (0 === r86) return; const h8 = t45.conflationActive && t45.style.isLayerClipped(o88, i26.getSource()), d34 = t45.style.order.indexOf(o88.fqid); if (h8 && (function(e57, t46, i27, o89, s19) { for (const r87 of o89) { const o90 = t46.getTile(r87).getBucket(i27); o90 && (o90.updateReplacement(r87, e57.replacementSource, s19), o90.uploadCentroid(e57.context)); } })(t45, i26, o88, s18, d34), l21 || h8) for (const e57 of s18) { const s19 = i26.getTile(e57).getBucket(o88); s19 && Jr(t45.context, i26, e57, s19, o88, l21, h8); } if ("shadow" === t45.renderPass && t45.shadowRenderer) { const n46 = t45.shadowRenderer; if (l21 && r86 < 0.65 && o88._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e56.ad) return; const a47 = n46.getShadowPassDepthMode(), c29 = n46.getShadowPassColorMode(); Xr(t45, i26, o88, s18, a47, Gi.disabled, c29, h8); } else if ("translucent" === t45.renderPass) { const d35 = !o88.paint.get("fill-extrusion-pattern").constantOr(1), u12 = o88.paint.get("fill-extrusion-color").constantOr(e56.ao.white); if (!c28 && 0 !== u12.a) { const e57 = new ji(t45.context.gl.LEQUAL, ji.ReadWrite, t45.depthRangeFor3D); 1 === r86 && d35 ? Xr(t45, i26, o88, s18, e57, Gi.disabled, Ui.unblended, h8) : (Xr(t45, i26, o88, s18, e57, Gi.disabled, Ui.disabled, h8), Xr(t45, i26, o88, s18, e57, t45.stencilModeFor3D(), t45.colorModeForRenderPass(), h8), t45.resetStencilClippingMasks()); } if (t45.style.enable3dLights() && d35 && (!l21 && "globe" !== t45.transform.projection.name || c28)) { const r87 = o88.paint.get("fill-extrusion-opacity"), d36 = o88.paint.get("fill-extrusion-ambient-occlusion-intensity"), u13 = o88.paint.get("fill-extrusion-ambient-occlusion-ground-radius"), _4 = o88.paint.get("fill-extrusion-flood-light-intensity"), p9 = "none" === o88.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"), f8 = o88.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(p9 ? null : o88.lut).toArray01().slice(0, 3), m6 = d36 > 0 && u13 > 0, g9 = _4 > 0, v8 = (e57, t46, i27) => (1 - i27) * e57 + i27 * t46, y4 = new Yr(); y4.translate = o88.paint.get("fill-extrusion-translate"), y4.translateAnchor = o88.paint.get("fill-extrusion-translate-anchor"), y4.edgeRadius = o88.layout.get("fill-extrusion-edge-radius"), y4.cutoffFadeRange = o88.paint.get("fill-extrusion-cutoff-fade-range"); const x4 = (n46) => { const l22 = t45.depthModeForSublayer(1, ji.ReadOnly, a46.LEQUAL, true), c29 = o88.paint.get(n46 ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), p10 = v8(0.1, 3, c29), m7 = t45._showOverdrawInspector; if (!m7) { const c30 = new Gi({ func: a46.ALWAYS, mask: 255 }, 255, 255, a46.KEEP, a46.KEEP, a46.REPLACE), m8 = new Ui([a46.ONE, a46.ONE, a46.ONE, a46.ONE], e56.ao.transparent, [false, false, false, true], a46.MIN); Kr(y4, t45, i26, o88, s18, l22, c30, m8, Zi.disabled, n46, "sdf", r87, d36, u13, _4, f8, p10, h8, false); } { const c30 = m7 ? Gi.disabled : new Gi({ func: a46.EQUAL, mask: 255 }, 255, 255, a46.KEEP, a46.DECR, a46.DECR), g10 = m7 ? t45.colorModeForRenderPass() : new Ui([a46.ONE_MINUS_DST_ALPHA, a46.DST_ALPHA, a46.ONE, a46.ONE], e56.ao.transparent, [true, true, true, true]); Kr(y4, t45, i26, o88, s18, l22, c30, g10, Zi.disabled, n46, "color", r87, d36, u13, _4, f8, p10, h8, false); } }; if (c28) { const c29 = (n46, l22, c30) => { const p10 = t45.depthModeForSublayer(1, ji.ReadOnly, a46.LEQUAL, false), m7 = o88.paint.get(n46 ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), g10 = v8(0.1, 3, m7); { const c31 = new Ui([a46.ONE, a46.ONE, a46.ONE, a46.ONE], e56.ao.transparent, [false, false, false, true]); Kr(y4, t45, i26, o88, s18, p10, Gi.disabled, c31, Zi.disabled, n46, "clear", r87, d36, u13, _4, f8, g10, h8, l22); } { const c31 = new Gi({ func: a46.ALWAYS, mask: 255 }, 255, 255, a46.KEEP, a46.KEEP, a46.REPLACE), m8 = new Ui([a46.ONE, a46.ONE, a46.ONE, a46.ONE], e56.ao.transparent, [false, false, false, true], a46.MIN); Kr(y4, t45, i26, o88, s18, p10, c31, m8, Zi.disabled, n46, "sdf", r87, d36, u13, _4, f8, g10, h8, l22); } { const c31 = n46 ? a46.ZERO : a46.ONE_MINUS_DST_ALPHA, m8 = new Gi({ func: a46.EQUAL, mask: 255 }, 255, 255, a46.KEEP, a46.DECR, a46.DECR), v9 = new Ui([c31, a46.DST_ALPHA, a46.ONE_MINUS_DST_ALPHA, a46.ZERO], e56.ao.transparent, [true, true, true, true]); Kr(y4, t45, i26, o88, s18, p10, m8, v9, Zi.disabled, n46, "color", r87, d36, u13, _4, f8, g10, h8, l22); } { const m8 = new Ui([a46.ONE, a46.ONE, a46.ONE, n46 ? a46.ZERO : a46.ONE], e56.ao.transparent, [false, false, false, true], n46 ? a46.FUNC_ADD : a46.MAX); Kr(y4, t45, i26, o88, s18, p10, Gi.disabled, m8, Zi.disabled, n46, "clear", r87, d36, u13, _4, f8, g10, h8, l22, c30); } }; if (m6 || g9) { let i27; if (t45.prepareDrawTile(), l21) { const t46 = l21.drapeBufferSize[0], o89 = l21.drapeBufferSize[1]; i27 = l21.framebufferCopyTexture, i27 && (!i27 || i27.size[0] === t46 && i27.size[1] === o89) || (i27 && i27.destroy(), i27 = l21.framebufferCopyTexture = new e56.T(n45, new e56.q({ width: t46, height: o89 }), a46.RGBA8)), i27.bind(a46.LINEAR, a46.CLAMP_TO_EDGE), a46.copyTexSubImage2D(a46.TEXTURE_2D, 0, 0, 0, 0, 0, t46, o89); } m6 && c29(true, false, i27), g9 && c29(false, true, i27); } } else m6 && x4(true), g9 && x4(false), (m6 || g9) && t45.resetStencilClippingMasks(); } } }, building: function(t45, i26, o88, s18) { t45.currentLayer < t45.firstLightBeamLayer && (t45.firstLightBeamLayer = t45.currentLayer); const r86 = o88.paint.get("building-ambient-occlusion-ground-intensity"), n45 = o88.paint.get("building-ambient-occlusion-ground-radius"), a46 = o88.paint.get("building-ambient-occlusion-ground-attenuation"), l21 = o88.paint.get("building-opacity"); if (l21 <= 0) return; let c28 = r86 > 0 && n45 > 0, h8 = true; const d34 = o88.paint.get("building-vertical-scale"); (!t45.shadowRenderer || d34 < 1) && (h8 = false); const u12 = t45.conflationActive && t45.style.isLayerClipped(o88, i26.getSource()), _4 = t45.style.order.indexOf(o88.fqid); if ((function(e57, t46, i27, o89, s19, r87) { for (const n46 of r87) { const r88 = t46.getTile(n46).getBucket(i27); r88 && (s19 && r88.updateReplacement(n46, e57.replacementSource, o89), r88.uploadUpdatedIndexBuffer(e57.context)); } })(t45, i26, o88, _4, u12, s18), (function(e57, t46, i27, o89) { for (const s19 of o89) { const o90 = t46.getTile(s19).getBucket(i27); o90 && o90.needsEvaluation() && o90.uploadUpdatedColorBuffer(e57.context); } })(t45, i26, o88, s18), o88.resetLayerRenderingStats(t45), t45.shadowRenderer && (t45.shadowRenderer.useNormalOffset = true), "shadow" === t45.renderPass && t45.shadowRenderer) { const e57 = t45.shadowRenderer, r87 = [], n46 = e57.getShadowPassDepthMode(); sn({ painter: t45, source: i26, layer: o88, coords: s18, defines: r87, blendMode: e57.getShadowPassColorMode(), depthMode: n46, opacity: l21, verticalScale: d34, facadeEmissiveChance: 0, facadeAOIntensity: 0 }); } else if ("translucent" === t45.renderPass) { let _5 = ["HAS_ATTRIBUTE_a_part_color_emissive", "LIGHTING_3D_MODE"]; h8 && (_5 = _5.concat("RENDER_SHADOWS", "DEPTH_TEXTURE")), t45.shadowRenderer && t45.shadowRenderer.useNormalOffset && (_5 = _5.concat("NORMAL_OFFSET")); const p9 = o88.paint.get("building-facade-emissive-chance"), f8 = o88.paint.get("building-ambient-occlusion-intensity"), m6 = new ji(t45.context.gl.LEQUAL, ji.ReadWrite, t45.depthRangeFor3D); l21 < 1 && sn({ painter: t45, source: i26, layer: o88, coords: s18, defines: _5, blendMode: Ui.disabled, depthMode: m6, opacity: l21, verticalScale: d34, facadeEmissiveChance: p9, facadeAOIntensity: f8 }); const g9 = t45.colorModeForRenderPass(); sn({ painter: t45, source: i26, layer: o88, coords: s18, defines: _5, blendMode: g9, depthMode: m6, opacity: l21, verticalScale: d34, facadeEmissiveChance: p9, facadeAOIntensity: f8 }), c28 && (function(t46, i27, o89, s19, r87, n46, a47, l22, c29, h9, d35, u13, _6) { const p10 = t46.context.gl, f9 = t46.depthModeForSublayer(1, ji.ReadOnly, p10.LEQUAL, true), m7 = 0.1 * (1 - (g10 = d35)) + 3 * g10; var g10; const v8 = t46._showOverdrawInspector, y4 = u13, x4 = new Yr(); v8 || Kr(x4, t46, i27, o89, s19, f9, new Gi({ func: p10.ALWAYS, mask: 255 }, 255, 255, p10.KEEP, p10.KEEP, p10.REPLACE), new Ui([p10.ONE, p10.ONE, p10.ONE, p10.ONE], e56.ao.transparent, [false, false, false, true], p10.MIN), Zi.disabled, r87, "sdf", n46, a47, l22, 0, h9, m7, y4, false); { const c30 = v8 ? Gi.disabled : new Gi({ func: p10.EQUAL, mask: 255 }, 255, 255, p10.KEEP, p10.DECR, p10.DECR), d36 = v8 ? t46.colorModeForRenderPass() : new Ui([p10.ONE_MINUS_DST_ALPHA, p10.DST_ALPHA, p10.ONE, p10.ONE], e56.ao.transparent, [true, true, true, true]); Kr(x4, t46, i27, o89, s19, f9, c30, d36, Zi.disabled, r87, "color", n46, a47, l22, 0, h9, m7, y4, false); } })(t45, i26, o88, s18, true, l21, r86, n45, 0, [0, 0, 0], a46, u12); } else if ("light-beam" === t45.renderPass) { const e57 = ["HAS_ATTRIBUTE_a_part_color_emissive", "HAS_ATTRIBUTE_a_bloom_attenuation"], r87 = new ji(t45.context.gl.LEQUAL, ji.ReadOnly, t45.depthRangeFor3D); sn({ painter: t45, source: i26, layer: o88, coords: s18, defines: e57, blendMode: Ui.alphaBlended, depthMode: r87, opacity: l21, verticalScale: d34, facadeEmissiveChance: 0, facadeAOIntensity: 0 }); } t45.shadowRenderer && (t45.shadowRenderer.useNormalOffset = false), t45.resetStencilClippingMasks(); }, hillshade: function(e57, t45, i26, o88) { if ("offscreen" !== e57.renderPass && "translucent" !== e57.renderPass) return; if (e57.style.disableElevatedTerrain) return; const s18 = e57.context, r86 = e57.terrain && e57.terrain.renderingToTexture, [n45, a46] = "translucent" !== e57.renderPass || r86 ? [{}, o88] : e57.stencilConfigForOverlap(o88); for (const o89 of a46) { const s19 = t45.getTile(o89); if (s19.needsHillshadePrepare && "offscreen" === e57.renderPass) Ko(e57, s19, i26); else if ("translucent" === e57.renderPass) { const t46 = e57.depthModeForSublayer(0, ji.ReadOnly), a47 = i26.paint.get("hillshade-emissive-strength"), l21 = e57.colorModeForDrapableLayerRenderPass(a47), c28 = r86 && e57.terrain ? e57.terrain.stencilModeForRTTOverlap(o89) : n45[o89.overscaledZ]; Xo(e57, o89, s19, i26, t46, c28, l21); } } s18.viewport.set([0, 0, e57.width, e57.height]), e57.resetStencilClippingMasks(); }, raster: function(t45, i26, o88, s18, r86, n45) { if ("translucent" !== t45.renderPass) return; if (0 === o88.paint.get("raster-opacity")) return; const a46 = "globe" === t45.transform.projection.name, l21 = 0 !== o88.paint.get("raster-elevation"), c28 = l21 && a46; if (t45.renderElevatedRasterBackface && !c28) return; const h8 = t45.context, d34 = h8.gl, u12 = i26.getSource(), _4 = (function(t46, i27, o89, s19) { const r87 = i27.paint.get("raster-color"), n46 = "raster-array" === t46.type, a47 = [], l22 = i27.paint.get("raster-resampling"), c29 = i27.paint.get("raster-color-mix"); let h9 = i27.paint.get("raster-color-range"); const d35 = [c29[0], c29[1], c29[2], 0], u13 = c29[3]; let _5 = "nearest" === l22 ? s19.NEAREST : s19.LINEAR; if (n46 && (a47.push("RASTER_ARRAY"), r87 || a47.push("RASTER_COLOR"), "linear" === l22 && a47.push("RASTER_ARRAY_LINEAR"), _5 = s19.NEAREST, !h9 && t46.rasterLayers)) { const e57 = t46.rasterLayers.find((({ id: e58 }) => e58 === i27.sourceLayer)); e57 && e57.fields && e57.fields.range && (h9 = e57.fields.range); } if (h9 = h9 || [0, 1], r87) { a47.push("RASTER_COLOR"), o89.activeTexture.set(s19.TEXTURE2), i27.updateColorRamp(h9); let t47 = i27.colorRampTexture; t47 || (t47 = i27.colorRampTexture = new e56.T(o89, i27.colorRamp, s19.RGBA8)), t47.bind(s19.LINEAR, s19.CLAMP_TO_EDGE); } return { mix: d35, range: h9, offset: u13, defines: a47, resampling: _5 }; })(u12, o88, h8, d34); if (u12 instanceof e56.aS && !s18.length && !a46) return; const p9 = o88.paint.get("raster-emissive-strength"), f8 = t45.colorModeForDrapableLayerRenderPass(p9), m6 = t45.terrain && t45.terrain.renderingToTexture, g9 = !t45.options.moving, v8 = "nearest" === o88.paint.get("raster-resampling") ? d34.NEAREST : d34.LINEAR; if (u12 instanceof e56.aS && !s18.length && (u12.onNorthPole || u12.onSouthPole)) { const e57 = l21 ? t45.stencilModeFor3D() : Gi.disabled; return void nn(!!u12.onNorthPole, null, t45, i26, o88, p9, _4, Zi.disabled, e57); } if (!s18.length) return; const [y4, x4] = u12 instanceof e56.aS || m6 ? [{}, s18] : t45.stencilConfigForOverlap(s18), b8 = x4[x4.length - 1].overscaledZ; c28 && _4.defines.push("PROJECTION_GLOBE_VIEW"), l21 && _4.defines.push("RENDER_CUTOFF"); const w4 = (s19, r87, x5) => { for (const w5 of s19) { const s20 = w5.toUnwrapped(), T5 = i26.getTile(w5); if (m6 && (!T5 || !T5.hasData())) continue; h8.activeTexture.set(d34.TEXTURE0); const E5 = ln(T5, u12, o88, _4); if (!E5 || !E5.texture) continue; const { texture: S5, mix: I4, offset: C6, tileSize: R5, buffer: A4 } = E5; let D5, L3; m6 ? (D5 = ji.disabled, L3 = w5.projMatrix) : l21 ? (D5 = new ji(d34.LEQUAL, ji.ReadWrite, t45.depthRangeFor3D), L3 = a46 ? Float32Array.from(t45.transform.expandedFarZProjMatrix) : t45.transform.calculateProjMatrix(s20, g9)) : (D5 = t45.depthModeForSublayer(w5.overscaledZ - b8, 1 === o88.paint.get("raster-opacity") ? ji.ReadWrite : ji.ReadOnly, d34.LESS), L3 = t45.transform.calculateProjMatrix(s20, g9)); const P4 = t45.terrain && m6 ? t45.terrain.stencilModeForRTTOverlap(w5) : y4[w5.overscaledZ], z4 = n45 ? 0 : o88.paint.get("raster-fade-duration"); T5.registerFadeDuration(z4); const O4 = i26.findLoadedParent(w5, 0), M5 = Gs(T5, O4, i26, t45.transform, z4); let F17, B6; !M5.isFading && T5.refreshedUponExpiration && (T5.refreshedUponExpiration = false), t45.terrain && t45.terrain.prepareDrawTile(), h8.activeTexture.set(d34.TEXTURE0), S5.bind(v8, d34.CLAMP_TO_EDGE), h8.activeTexture.set(d34.TEXTURE1), O4 ? (O4.texture && O4.texture.bind(v8, d34.CLAMP_TO_EDGE), F17 = Math.pow(2, O4.tileID.overscaledZ - T5.tileID.overscaledZ), B6 = [T5.tileID.canonical.x * F17 % 1, T5.tileID.canonical.y * F17 % 1]) : S5.bind(v8, d34.CLAMP_TO_EDGE), "useMipmap" in S5 && h8.extTextureFilterAnisotropic && t45.transform.pitch > 20 && d34.texParameterf(d34.TEXTURE_2D, h8.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, h8.extTextureFilterAnisotropicMax); const k7 = t45.transform; let N5; const U4 = l21 ? an(k7) : [0, 0, 0, 0]; let j4, V4, G5, H4, q3, Z3 = 0; if (c28 && u12 instanceof e56.aS && u12.coordinates.length > 3) j4 = Float32Array.from(e56.bk(e56.dF(new e56.cC(0, 0, 0)))), V4 = Float32Array.from(k7.globeMatrix), G5 = Float32Array.from(e56.dB(k7)), H4 = [e56.aF(k7.center.lng), e56.aJ(k7.center.lat)], N5 = u12.elevatedGlobePerspectiveTransform, q3 = u12.elevatedGlobeGridMatrix || new Float32Array(9); else if (c28) { const t46 = e56.dC(w5.canonical); Z3 = e56.dD(t46.getCenter().lat), j4 = Float32Array.from(e56.bk(e56.dF(w5.canonical))), V4 = Float32Array.from(k7.globeMatrix), G5 = Float32Array.from(e56.dB(k7)), H4 = [e56.aF(k7.center.lng), e56.aJ(k7.center.lat)], N5 = [0, 0], q3 = Float32Array.from(e56.dE(w5.canonical, t46, Z3, k7.worldSize / k7._pixelsPerMercatorPixel)); } else N5 = u12 instanceof e56.aS ? u12.perspectiveTransform : [0, 0], j4 = new Float32Array(16), V4 = new Float32Array(9), G5 = new Float32Array(16), H4 = [0, 0], q3 = new Float32Array(9); const W4 = yr(L3, j4, V4, G5, q3, B6 || [0, 0], e56.aj(t45.transform.zoom), H4, U4, F17 || 1, M5, o88, N5, l21 ? o88.paint.get("raster-elevation") : 0, 2, I4, C6, _4.range, R5, A4, p9), $5 = t45.isTileAffectedByFog(w5), X3 = t45.getOrCreateProgram("raster", { defines: _4.defines, overrideFog: $5 }); if (t45.uploadCommonUniforms(h8, X3, s20), u12 instanceof e56.aS) { const i27 = u12.elevatedGlobeVertexBuffer, s21 = u12.elevatedGlobeIndexBuffer; if (m6 || !a46) u12.boundsBuffer && u12.boundsSegments && X3.draw(t45, d34.TRIANGLES, D5, Gi.disabled, f8, Zi.disabled, W4, o88.id, u12.boundsBuffer, t45.quadTriangleIndexBuffer, u12.boundsSegments); else if (i27 && s21) { const n46 = k7.zoom <= e56.cZ ? u12.elevatedGlobeSegments : u12.getSegmentsForLongitude(k7.center.lng); n46 && X3.draw(t45, d34.TRIANGLES, D5, Gi.disabled, f8, r87, W4, o88.id, i27, s21, n46); } } else if (c28) { D5 = new ji(d34.LEQUAL, ji.ReadOnly, t45.depthRangeFor3D); const e57 = t45.globeSharedBuffers; if (e57) { const [i27, s21, n46] = e57.getGridBuffers(Z3, false); X3.draw(t45, d34.TRIANGLES, D5, x5 || P4, t45.colorModeForRenderPass(), r87, W4, o88.id, i27, s21, n46); } } else { const { tileBoundsBuffer: e57, tileBoundsIndexBuffer: i27, tileBoundsSegments: s21 } = t45.getTileBoundsBuffers(T5); X3.draw(t45, d34.TRIANGLES, D5, P4, f8, Zi.disabled, W4, o88.id, e57, i27, s21); } } if (!(u12 instanceof e56.aS) && c28) for (const e57 of s19) { const s20 = e57.canonical.y === (1 << e57.canonical.z) - 1; 0 === e57.canonical.y && nn(true, e57, t45, i26, o88, p9, _4, r87, x5 || Gi.disabled), s20 && nn(false, e57, t45, i26, o88, p9, _4, r87 === Zi.frontCW ? Zi.backCW : Zi.frontCW, x5 || Gi.disabled); } }; c28 ? w4(x4, t45.renderElevatedRasterBackface ? Zi.backCW : Zi.frontCW, t45.stencilModeFor3D()) : w4(x4, Zi.disabled, void 0), t45.resetStencilClippingMasks(); }, "raster-particle": function(t45, i26, o88, s18, r86, n45) { "offscreen" === t45.renderPass && (function(t46, i27, o89, s19) { if (!s19.length) return; const r87 = t46.context, n46 = r87.gl, a46 = i27.getSource(); if (!(a46 instanceof nt2)) return; const l21 = Math.ceil(Math.sqrt(o89.paint.get("raster-particle-count"))); let c28 = o89.particlePositionRGBAImage; if (!c28 || c28.width !== l21) { const t47 = (function(e57) { const t48 = e57 * e57, i28 = new Uint8Array(4 * t48), o90 = function(e58) { return e58 |= 0, e58 = Math.imul(2747636419 ^ e58, 2654435769), e58 = Math.imul(e58 ^ e58 >>> 16, 2654435769), ((e58 = Math.imul(e58 ^ e58 >>> 16, 2654435769)) >>> 0) / 4294967296; }, s20 = 1 / 1.1; for (let e58 = 0; e58 < t48; e58++) { const t49 = s20 * (o90(2 * e58 + 0) + br), r88 = s20 * (o90(2 * e58 + 1) + br), n47 = 255 * t49 % 1, a47 = 255 * r88 % 1, l22 = n47, c29 = r88 - a47 / 255, h9 = a47; i28[4 * e58 + 0] = 255 * (t49 - n47 / 255), i28[4 * e58 + 1] = 255 * l22, i28[4 * e58 + 2] = 255 * c29, i28[4 * e58 + 3] = 255 * h9; } return i28; })(l21); c28 = o89.particlePositionRGBAImage = new e56.q({ width: l21, height: l21 }, t47); } let h8 = o89.particleFramebuffer; h8 ? h8.width !== l21 && (h8.destroy(), h8 = o89.particleFramebuffer = r87.createFramebuffer(l21, l21, true, null)) : h8 = o89.particleFramebuffer = r87.createFramebuffer(l21, l21, true, null); const d34 = []; for (const e57 of s19) { const t47 = i27.getTile(e57); if (!(t47 instanceof St)) continue; const s20 = dn(t47, a46, o89); if (!s20) continue; const n47 = [t47.tileSize, t47.tileSize]; let h9 = o89.tileFramebuffer; h9 || (h9 = o89.tileFramebuffer = r87.createFramebuffer(n47[0], n47[1], true, null)); let u13 = t47.rasterParticleState; u13 || (u13 = t47.rasterParticleState = new hn(r87, e57, n47, c28)); const _5 = u13.update(o89.lastInvalidatedAt); u13.particleTextureDimension !== l21 && u13.updateParticleTexture(e57, c28); const p9 = u13.targetColorTexture; u13.targetColorTexture = u13.backgroundColorTexture, u13.backgroundColorTexture = p9; const f8 = u13.particleTexture0; u13.particleTexture0 = u13.particleTexture1, u13.particleTexture1 = f8, d34.push([e57, s20, u13, _5]); } if (0 === d34.length) return; const u12 = e56.o.now(), _4 = o89.previousDrawTimestamp ? 1e-3 * (u12 - o89.previousDrawTimestamp) : 0.0167; if (o89.previousDrawTimestamp = u12, o89.hasColorMap()) { r87.activeTexture.set(n46.TEXTURE0 + 2); let t47 = o89.colorRampTexture; t47 || (t47 = o89.colorRampTexture = new e56.T(r87, o89.colorRamp, n46.RGBA8)), t47.bind(n46.LINEAR, n46.CLAMP_TO_EDGE); } r87.bindFramebuffer.set(o89.tileFramebuffer.framebuffer), (function(t47, i28, o90) { const s20 = t47.context, r88 = s20.gl, n47 = i28.tileFramebuffer; s20.activeTexture.set(r88.TEXTURE0); const a47 = { u_texture: 0, u_opacity: 1.05 * (c29 = i28.paint.get("raster-particle-fade-opacity-factor")) / (c29 + 0.05) }, l22 = t47.getOrCreateProgram("rasterParticleTexture", { defines: [], overrideFog: false }); var c29; for (const c30 of o90) { const [, , o91, h9] = c30; n47.colorAttachment.set(o91.targetColorTexture.texture), s20.viewport.set([0, 0, n47.width, n47.height]), s20.clear({ color: e56.ao.transparent }), h9 && (o91.backgroundColorTexture.bind(r88.NEAREST, r88.CLAMP_TO_EDGE), l22.draw(t47, r88.TRIANGLES, ji.disabled, Gi.disabled, Ui.alphaBlended, Zi.disabled, a47, i28.id, t47.viewportBuffer, t47.quadTriangleIndexBuffer, t47.viewportSegments)); } })(t46, o89, d34), (function(t47, i28, o90, s20) { const r88 = t47.context, n47 = r88.gl, a47 = o90.tileFramebuffer, l22 = "globe" === t47.transform.projection.name, c29 = o90.paint.get("raster-particle-max-speed"); for (const h9 of s20) { const [s21, d35, u13] = h9; r88.activeTexture.set(n47.TEXTURE0 + 0), d35.texture.bind(n47.LINEAR, n47.CLAMP_TO_EDGE), a47.colorAttachment.set(u13.targetColorTexture.texture); const _5 = t47.getOrCreateProgram("rasterParticleDraw", { defines: d35.defines, overrideFog: false }); r88.activeTexture.set(n47.TEXTURE0 + 1); const p9 = d35.scalarData ? [] : [0, 1, 2, 3].map(((t48) => e56.e6[t48](s21))); p9.push(s21); const f8 = s21.canonical.x, m6 = s21.canonical.y; for (const e57 of p9) { const r89 = i28.getTile(l22 ? e57.wrapped() : e57); if (!r89) continue; const a48 = r89.rasterParticleState; if (!a48) continue; const h10 = e57.canonical.x + (1 << e57.canonical.z) * (e57.wrap - s21.wrap), u14 = e57.canonical.y; a48.particleTexture0.bind(n47.NEAREST, n47.CLAMP_TO_EDGE); const p10 = Tr(1, a48.particleTexture0.size[0], [h10 - f8, u14 - m6], 0, d35.texture.size, 2, c29, d35.textureOffset, d35.scale, d35.offset); _5.draw(t47, n47.POINTS, ji.disabled, Gi.disabled, Ui.alphaBlended, Zi.disabled, p10, o90.id, a48.particleIndexBuffer, void 0, a48.particleSegment); } } })(t46, i27, o89, d34), r87.bindFramebuffer.set(o89.particleFramebuffer.framebuffer), (function(t47, i28, o90, s20) { const r88 = t47.context, n47 = r88.gl, a47 = i28.paint.get("raster-particle-max-speed"), l22 = s20 * i28.paint.get("raster-particle-speed-factor") * 0.15, c29 = (function(e57) { return Math.pow(e57, 6); })(0.01 + 1 * i28.paint.get("raster-particle-reset-rate-factor")), h9 = i28.particleFramebuffer; r88.viewport.set([0, 0, h9.width, h9.height]); for (const s21 of o90) { const [, o91, d35] = s21; r88.activeTexture.set(n47.TEXTURE0 + 0), o91.texture.bind(n47.LINEAR, n47.CLAMP_TO_EDGE), r88.activeTexture.set(n47.TEXTURE0 + 1); const u13 = d35.particleTexture0; u13.bind(n47.NEAREST, n47.CLAMP_TO_EDGE); const _5 = Er(1, u13.size[0], 0, o91.texture.size, a47, l22, c29, o91.textureOffset, o91.scale, o91.offset); h9.colorAttachment.set(d35.particleTexture1.texture), r88.clear({ color: e56.ao.transparent }), t47.getOrCreateProgram("rasterParticleUpdate", { defines: o91.defines }).draw(t47, n47.TRIANGLES, ji.disabled, Gi.disabled, Ui.unblended, Zi.disabled, _5, i28.id, t47.viewportBuffer, t47.quadTriangleIndexBuffer, t47.viewportSegments); } })(t46, o89, d34, _4); })(t45, i26, o88, s18), "translucent" === t45.renderPass && ((function(t46, i27, o89, s19, r87) { const n46 = t46.context, a46 = n46.gl, l21 = i27.getSource().tileSize, c28 = 5 * (1 - e56.ah(e56.cK, e56.cK + 1, t46.transform.zoom)) * l21 + o89.paint.get("raster-particle-elevation"), h8 = !t46.options.moving, d34 = "globe" === t46.transform.projection.name; if (!s19.length) return; const [u12, _4] = t46.stencilConfigForOverlap(s19), p9 = []; d34 && p9.push("PROJECTION_GLOBE_VIEW"); const f8 = t46.stencilModeFor3D(); for (const s20 of _4) { const r88 = s20.toUnwrapped(), l22 = i27.getTile(s20); if (!l22.rasterParticleState) continue; const _5 = l22.rasterParticleState, m6 = 100; l22.registerFadeDuration(m6); const g9 = i27.findLoadedParent(s20, 0), v8 = Gs(l22, g9, i27, t46.transform, m6); let y4, x4; t46.terrain && t46.terrain.prepareDrawTile(), n46.activeTexture.set(a46.TEXTURE0), _5.targetColorTexture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE), n46.activeTexture.set(a46.TEXTURE1), g9 && g9.rasterParticleState ? (g9.rasterParticleState.targetColorTexture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE), y4 = Math.pow(2, g9.tileID.overscaledZ - l22.tileID.overscaledZ), x4 = [l22.tileID.canonical.x * y4 % 1, l22.tileID.canonical.y * y4 % 1]) : _5.targetColorTexture.bind(a46.LINEAR, a46.CLAMP_TO_EDGE); const b8 = d34 ? Float32Array.from(t46.transform.expandedFarZProjMatrix) : t46.transform.calculateProjMatrix(r88, h8), w4 = t46.transform, T5 = un(w4), E5 = e56.dC(s20.canonical), S5 = e56.dD(E5.getCenter().lat); let I4, C6, R5, A4, D5; d34 ? (I4 = Float32Array.from(e56.bk(e56.dF(s20.canonical))), C6 = Float32Array.from(w4.globeMatrix), R5 = Float32Array.from(e56.dB(w4)), A4 = [e56.aF(w4.center.lng), e56.aJ(w4.center.lat)], D5 = Float32Array.from(e56.dE(s20.canonical, E5, S5, w4.worldSize / w4._pixelsPerMercatorPixel))) : (I4 = new Float32Array(16), C6 = new Float32Array(9), R5 = new Float32Array(16), A4 = [0, 0], D5 = new Float32Array(9)); const L3 = wr(b8, I4, C6, R5, D5, x4 || [0, 0], e56.aj(t46.transform.zoom), A4, T5, y4 || 1, v8, c28), P4 = t46.isTileAffectedByFog(s20), z4 = t46.getOrCreateProgram("rasterParticle", { defines: p9, overrideFog: P4 }); if (t46.uploadCommonUniforms(n46, z4, r88), d34) { const e57 = new ji(a46.LEQUAL, ji.ReadOnly, t46.depthRangeFor3D), i28 = 0, s21 = t46.globeSharedBuffers; if (s21) { const [r89, n47, l23] = s21.getGridBuffers(S5, 0 !== i28); z4.draw(t46, a46.TRIANGLES, e57, f8, Ui.alphaBlended, t46.renderElevatedRasterBackface ? Zi.frontCCW : Zi.backCCW, L3, o89.id, r89, n47, l23); } } else { const e57 = t46.depthModeForSublayer(0, ji.ReadOnly), i28 = u12[s20.overscaledZ], { tileBoundsBuffer: r89, tileBoundsIndexBuffer: n47, tileBoundsSegments: c29 } = t46.getTileBoundsBuffers(l22); z4.draw(t46, a46.TRIANGLES, e57, i28, Ui.alphaBlended, Zi.disabled, L3, o89.id, r89, n47, c29); } } t46.resetStencilClippingMasks(); })(t45, i26, o88, s18), t45.style.map.triggerRepaint()); }, background: function(t45, i26, o88, s18) { const r86 = o88.paint.get("background-color"), n45 = "none" === o88.paint.get("background-color-use-theme").constantOr("default"), a46 = o88.paint.get("background-opacity"), l21 = o88.paint.get("background-emissive-strength"), c28 = "viewport" === o88.paint.get("background-pitch-alignment"); if (0 === a46) return; const h8 = t45.context, d34 = h8.gl, u12 = t45.transform, _4 = u12.tileSize, p9 = o88.paint.get("background-pattern"); let f8; if (void 0 !== p9) { if (null === p9) return; if (f8 = t45.imageManager.getPattern(e56.I.from(p9.toString()), o88.scope, t45.style.getLut(o88.scope)), !f8) return; } const m6 = !p9 && 1 === r86.a && 1 === a46 && t45.opaquePassEnabledForLayer() ? "opaque" : "translucent"; if (t45.renderPass !== m6) return; const g9 = Gi.disabled, v8 = t45.depthModeForSublayer(0, "opaque" === m6 ? ji.ReadWrite : ji.ReadOnly), y4 = t45.colorModeForDrapableLayerRenderPass(l21), x4 = p9 ? "backgroundPattern" : "background"; let b8, w4 = s18; if (w4 || (b8 = t45.getBackgroundTiles(), w4 = Object.values(b8).map(((e57) => e57.tileID))), p9 && (h8.activeTexture.set(d34.TEXTURE0), t45.imageManager.bind(t45.context, o88.scope)), c28) { const i27 = t45.getOrCreateProgram(x4, { overrideFog: false, overrideRtt: true }), s19 = new Float32Array(e56.bA([])), h9 = new e56.aO(0, 0, 0, 0, 0), u13 = p9 ? Rr(s19, l21, a46, t45, 0, o88.scope, f8, c28, { tileID: h9, tileSize: _4 }) : Cr(s19, l21, a46, r86.toPremultipliedRenderColor(n45 ? null : o88.lut)); i27.draw(t45, d34.TRIANGLES, v8, g9, y4, Zi.disabled, u13, o88.id, t45.viewportBuffer, t45.quadTriangleIndexBuffer, t45.viewportSegments); } else for (const e57 of w4) { const m7 = t45.isTileAffectedByFog(e57), w5 = t45.getOrCreateProgram(x4, { overrideFog: m7 }), T5 = e57.toUnwrapped(), E5 = s18 ? e57.projMatrix : t45.transform.calculateProjMatrix(T5); t45.prepareDrawTile(); const S5 = i26 ? i26.getTile(e57) : b8 ? b8[e57.key] : new Et(e57, _4, u12.zoom, t45), I4 = p9 ? Rr(E5, l21, a46, t45, 0, o88.scope, f8, c28, { tileID: e57, tileSize: _4 }) : Cr(E5, l21, a46, r86.toPremultipliedRenderColor(n45 ? null : o88.lut)); t45.uploadCommonUniforms(h8, w5, T5); const { tileBoundsBuffer: C6, tileBoundsIndexBuffer: R5, tileBoundsSegments: A4 } = t45.getTileBoundsBuffers(S5); w5.draw(t45, d34.TRIANGLES, v8, g9, y4, Zi.disabled, I4, o88.id, C6, R5, A4); } }, sky: function(t45, i26, o88) { const s18 = t45._atmosphere ? e56.aj(t45.transform.zoom) : 1, r86 = o88.paint.get("sky-opacity") * s18; if (0 === r86) return; const n45 = t45.context, a46 = o88.paint.get("sky-type"), l21 = new ji(n45.gl.LEQUAL, ji.ReadOnly, [0, 1]), c28 = t45.frameCounter / 1e3 % 1; "atmosphere" === a46 ? "offscreen" === t45.renderPass ? o88.needsSkyboxCapture(t45) && ((function(t46, i27, o89, s19) { const r87 = t46.context, n46 = r87.gl; let a47 = i27.skyboxFbo; if (!a47) { a47 = i27.skyboxFbo = r87.createFramebuffer(32, 32, true, null), i27.skyboxGeometry = new In(r87), i27.skyboxTexture = r87.gl.createTexture(), n46.bindTexture(n46.TEXTURE_CUBE_MAP, i27.skyboxTexture), n46.texParameteri(n46.TEXTURE_CUBE_MAP, n46.TEXTURE_WRAP_S, n46.CLAMP_TO_EDGE), n46.texParameteri(n46.TEXTURE_CUBE_MAP, n46.TEXTURE_WRAP_T, n46.CLAMP_TO_EDGE), n46.texParameteri(n46.TEXTURE_CUBE_MAP, n46.TEXTURE_MIN_FILTER, n46.LINEAR), n46.texParameteri(n46.TEXTURE_CUBE_MAP, n46.TEXTURE_MAG_FILTER, n46.LINEAR); for (let e57 = 0; e57 < 6; ++e57) n46.texImage2D(n46.TEXTURE_CUBE_MAP_POSITIVE_X + e57, 0, n46.RGBA, 32, 32, 0, n46.RGBA, n46.UNSIGNED_BYTE, null); } r87.bindFramebuffer.set(a47.framebuffer), r87.viewport.set([0, 0, 32, 32]); const l22 = i27.getCenter(t46, true), c29 = t46.getOrCreateProgram("skyboxCapture"), h8 = new Float64Array(16); e56.bA(h8), e56.ek(h8, h8, 0.5 * -Math.PI), Cn(t46, i27, c29, h8, l22, 0), e56.bA(h8), e56.ek(h8, h8, 0.5 * Math.PI), Cn(t46, i27, c29, h8, l22, 1), e56.bA(h8), e56.cT(h8, h8, 0.5 * -Math.PI), Cn(t46, i27, c29, h8, l22, 2), e56.bA(h8), e56.cT(h8, h8, 0.5 * Math.PI), Cn(t46, i27, c29, h8, l22, 3), e56.bA(h8), Cn(t46, i27, c29, h8, l22, 4), e56.bA(h8), e56.ek(h8, h8, Math.PI), Cn(t46, i27, c29, h8, l22, 5), r87.viewport.set([0, 0, t46.width, t46.height]); })(t45, o88), o88.markSkyboxValid(t45)) : "sky" === t45.renderPass && (function(e57, t46, i27, o89, s19) { const r87 = e57.context, n46 = r87.gl, a47 = e57.transform, l22 = e57.getOrCreateProgram("skybox"); r87.activeTexture.set(n46.TEXTURE0), n46.bindTexture(n46.TEXTURE_CUBE_MAP, t46.skyboxTexture); const c29 = /* @__PURE__ */ ((e58, t47, i28, o90, s20) => ({ u_matrix: e58, u_sun_direction: t47, u_cubemap: 0, u_opacity: o90, u_temporal_offset: s20 }))(a47.skyboxMatrix, t46.getCenter(e57, false), 0, o89, s19); e57.uploadCommonUniforms(r87, l22), l22.draw(e57, n46.TRIANGLES, i27, Gi.disabled, e57.colorModeForRenderPass(), Zi.backCW, c29, "skybox", t46.skyboxGeometry.vertexBuffer, t46.skyboxGeometry.indexBuffer, t46.skyboxGeometry.segment); })(t45, o88, l21, r86, c28) : "gradient" === a46 && "sky" === t45.renderPass && (function(t46, i27, o89, s19, r87) { const n46 = t46.context, a47 = n46.gl, l22 = t46.transform, c29 = t46.getOrCreateProgram("skyboxGradient"); i27.skyboxGeometry || (i27.skyboxGeometry = new In(n46)), n46.activeTexture.set(a47.TEXTURE0); let h8 = i27.colorRampTexture; h8 || (h8 = i27.colorRampTexture = new e56.T(n46, i27.colorRamp, a47.RGBA8)), h8.bind(a47.LINEAR, a47.CLAMP_TO_EDGE); const d34 = ((t47, i28, o90, s20, r88) => ({ u_matrix: t47, u_color_ramp: 0, u_center_direction: i28, u_radius: e56.an(o90), u_opacity: s20, u_temporal_offset: r88 }))(l22.skyboxMatrix, i27.getCenter(t46, false), i27.paint.get("sky-gradient-radius"), s19, r87); t46.uploadCommonUniforms(n46, c29), c29.draw(t46, a47.TRIANGLES, o89, Gi.disabled, t46.colorModeForRenderPass(), Zi.backCW, d34, "skyboxGradient", i27.skyboxGeometry.vertexBuffer, i27.skyboxGeometry.indexBuffer, i27.skyboxGeometry.segment); })(t45, o88, l21, r86, c28); }, custom: function(t45, i26, o88, s18) { const r86 = t45.context, n45 = o88.implementation; if (!t45.transform.projection.unsupportedLayers || !t45.transform.projection.unsupportedLayers.includes("custom") || t45.terrain && (t45.terrain.renderingToTexture || "offscreen" === t45.renderPass) && o88.isDraped(i26)) { if ("offscreen" === t45.renderPass) { const i27 = n45.prerender; if (i27) { if (t45.setCustomLayerDefaults(), r86.setColorMode(t45.colorModeForRenderPass()), "globe" === t45.transform.projection.name) { const o89 = t45.transform.pointMerc; i27.call(n45, r86.gl, t45.transform.customLayerMatrix(), t45.transform.getProjection(), t45.transform.globeToMercatorMatrix(), e56.aj(t45.transform.zoom), [o89.x, o89.y], t45.transform.pixelsPerMeterRatio); } else i27.call(n45, r86.gl, t45.transform.customLayerMatrix()); r86.setDirty(), t45.setBaseState(); } } else if ("translucent" === t45.renderPass) { if (t45.terrain && t45.terrain.renderingToTexture) { const e57 = n45.renderToTile; if (e57) { const i28 = s18[0].canonical, o89 = { x: i28.x + s18[0].wrap * (n45.wrapTileId ? 0 : 1 << i28.z), y: i28.y, z: i28.z }; r86.setDepthMode(ji.disabled), r86.setStencilMode(Gi.disabled), r86.setColorMode(t45.colorModeForRenderPass()), t45.setCustomLayerDefaults(), e57.call(n45, r86.gl, o89), r86.setDirty(), t45.setBaseState(); } return; } t45.setCustomLayerDefaults(), r86.setColorMode(t45.colorModeForRenderPass()), r86.setStencilMode(Gi.disabled); const i27 = "3d" === n45.renderingMode ? new ji(t45.context.gl.LEQUAL, ji.ReadWrite, t45.depthRangeFor3D) : t45.depthModeForSublayer(0, ji.ReadOnly); if (r86.setDepthMode(i27), "globe" === t45.transform.projection.name) { const i28 = t45.transform.pointMerc; n45.render(r86.gl, t45.transform.customLayerMatrix(), t45.transform.getProjection(), t45.transform.globeToMercatorMatrix(), e56.aj(t45.transform.zoom), [i28.x, i28.y], t45.transform.pixelsPerMeterRatio); } else n45.render(r86.gl, t45.transform.customLayerMatrix()); r86.setDirty(), t45.setBaseState(), r86.bindFramebuffer.set(null); } } else e56.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers."); }, model: function(t45, i26, o88, s18) { if ("opaque" === t45.renderPass) return; const r86 = o88.paint.get("model-opacity").constantOr(1); if (0 === r86) return; const n45 = o88.paint.get("model-cast-shadows"); if ("shadow" === t45.renderPass) { if (!n45) return; if (t45.terrain && r86 < 0.65 && o88._transitionablePaint._values["model-opacity"].value.expression instanceof e56.ad) return; } const a46 = t45.shadowRenderer, l21 = o88.paint.get("model-receive-shadows"); a46 && (a46.useNormalOffset = true, l21 || (a46.enabled = false)); const c28 = () => { a46 && (a46.useNormalOffset = true, l21 || (a46.enabled = true)); }, h8 = i26.getSource(); if ("light-beam" === t45.renderPass && "batched-model" !== h8.type) return; if ("vector" === h8.type || "geojson" === h8.type) return (function(t46, i27, o89, s19, r87) { const n46 = t46.transform; if ("mercator" !== n46.projection.name) return void e56.w(`Drawing 3D models for ${n46.projection.name} projection is not yet implemented`); const a47 = n46.getFreeCameraOptions().position; if (!t46.modelManager) return; const l22 = t46.modelManager; o89.modelManager = l22; const c29 = t46.shadowRenderer; if (!o89._unevaluatedLayout._values.hasOwnProperty("model-id")) return; const h9 = o89._unevaluatedLayout._values["model-id"], d35 = Object.assign({}, o89.layout.get("model-id").parameters), u13 = t46.style.order.indexOf(o89.fqid); for (const _5 of s19) { const s20 = i27.getTile(_5).getBucket(o89); if (!s20 || s20.projection.name !== n46.projection.name) continue; const p10 = s20.getModelUris(); p10 && !s20.modelsRequested && (l22.addModelsFromBucket(p10, r87), s20.modelsRequested = true); const f9 = jn(_5, n46); d35.zoom = f9; const m7 = h9.possiblyEvaluate(d35); if (Nn(t46, s20, _5), Un.shadowUniformsInitialized = false, Un.useSingleShadowCascade = !!c29 && 0 === c29.getMaxCascadeForTile(_5.toUnwrapped()), "shadow" === t46.renderPass && c29) { if (1 === t46.currentShadowCascade && s20.isInsideFirstShadowMapFrustum) continue; const i28 = n46.calculatePosMatrix(_5.toUnwrapped(), n46.worldSize); if (Un.tileMatrix.set(i28), Un.shadowTileMatrix = Float32Array.from(c29.calculateShadowPassMatrixFromMatrix(i28)), Un.aabb.min = [0, 0, 0], Un.aabb.max[0] = Un.aabb.max[1] = e56.al, Un.aabb.max[2] = 0, Hn(s20, Un, t46, o89.scope)) continue; } const g10 = 1 << _5.canonical.z, v8 = [((a47.x - _5.wrap) * g10 - _5.canonical.x) * e56.al, (a47.y * g10 - _5.canonical.y) * e56.al, a47.z * g10 * e56.al]; t46.conflationActive && Object.keys(s20.instancesPerModel).length > 0 && t46.style.isLayerClipped(o89, i27.getSource()) && s20.updateReplacement(_5, t46.replacementSource, u13, r87) && (s20.uploaded = false, s20.upload(t46.context)); for (let e57 in s20.instancesPerModel) { const i28 = s20.instancesPerModel[e57]; i28.features.length > 0 && (e57 = m7.evaluate(i28.features[0].feature, {})); const n47 = l22.getModel(e57, r87); if (n47 || l22.hasURLBeenRequested(e57) || s20.modelUris.includes(e57) || (s20.modelUris.push(e57), s20.modelsRequested = false), n47 && n47.uploaded) for (const e58 of n47.nodes) Vn(t46, o89, e58, i28, v8, _5, Un); } } })(t45, i26, o88, s18, "vector" === h8.type ? o88.scope : ""), void c28(); if (!h8.loaded()) return; if ("batched-model" === h8.type) return (function(t46, i27, o89, s19) { o89.resetLayerRenderingStats(t46); const r87 = t46.context, n46 = t46.transform, a47 = t46.style.fog, l22 = t46.shadowRenderer; if ("mercator" !== n46.projection.name) return void e56.w(`Drawing 3D landmark models for ${n46.projection.name} projection is not yet implemented`); const c29 = t46.transform.getFreeCameraOptions().position, h9 = e56.c4([], [c29.x, c29.y, c29.z], t46.transform.worldSize), d35 = e56.et([], h9), u13 = e56.bA([]), _5 = e56.ec(n46.center.lat, n46.zoom), p10 = e56.bq([], [1, 1, 1 / _5]); e56.br(u13, u13, d35); const f9 = o89.paint.get("model-opacity").constantOr(1), m7 = new ji(r87.gl.LEQUAL, ji.ReadWrite, t46.depthRangeFor3D), g10 = new ji(r87.gl.LEQUAL, ji.ReadOnly, t46.depthRangeFor3D), v8 = new e56.d8([1 / 0, 1 / 0, 1 / 0], [-1 / 0, -1 / 0, -1 / 0]), y4 = "shadow" === t46.renderPass, x4 = y4 && l22 ? l22.getCurrentCascadeFrustum() : n46.getFrustum(n46.scaleZoom(n46.worldSize)), b8 = o89.paint.get("model-front-cutoff"), w4 = b8[2] < 1, T5 = io(t46, o89.paint.get("model-cutoff-fade-range")), E5 = o89.getLayerRenderingStats(); (function(e57, t47, i28, o90) { const s20 = e57.terrain ? e57.terrain.exaggeration() : 0, r88 = e57.transform.zoom; for (const n47 of o90) { const o91 = t47.getTile(n47).getBucket(i28); o91 && (o91.setFilter(i28.filter), e57.conflationActive && o91.updateReplacement(n47, e57.replacementSource), o91.evaluateTransform(e57, i28), e57.terrain && s20 > 0 && o91.elevationUpdate(e57.terrain, s20, n47, i28.source), o91.needsReEvaluation(e57, r88, i28) && o91.evaluate(i28)); } })(t46, i27, o89, s19), (function() { let c30, d36, S5; w4 ? (c30 = s19.length - 1, d36 = -1, S5 = -1) : (c30 = 0, d36 = s19.length, S5 = 1); const I4 = new Float64Array(16), C6 = e56.cz(), R5 = new e56.P(0, 0); for (let A4 = c30; A4 !== d36; A4 += S5) { const c31 = s19[A4], d37 = i27.getTile(c31).getBucket(o89); if (!d37 || !d37.uploaded) continue; let S6 = false; l22 && (S6 = 0 === l22.getMaxCascadeForTile(c31.toUnwrapped())); const D5 = n46.calculatePosMatrix(c31.toUnwrapped(), n46.worldSize), L3 = d37.modelTraits; !y4 && w4 && (e56.bl(I4, D5), e56.af(C6, h9, I4), R5.x = C6[0], R5.y = C6[1]); const P4 = []; d37.setFilter(o89.filter); for (const i28 of d37.getNodesInfo()) { if (i28.hiddenByReplacement) continue; if (!i28.node.meshes) continue; const o90 = i28.node; let s20 = 0; t46.terrain && o90.elevation && (s20 = o90.elevation * t46.terrain.exaggeration()); const r88 = (() => { const t47 = i28.aabb; return v8.min = [...t47.min], v8.max = [...t47.max], v8.min[2] += s20, v8.max[2] += s20, e56.af(v8.min, v8.min, D5), e56.af(v8.max, v8.max, D5), v8; })(), a48 = i28.evaluatedScale; if (a48[0] <= 1 && a48[1] <= 1 && a48[2] <= 1 && 0 === r88.intersects(x4)) continue; if (!y4 && w4) { const t47 = 1 / 6; i28.cameraCollisionOpacity = h9[0] > r88.min[0] && h9[0] < r88.max[0] && h9[1] > r88.min[1] && h9[1] < r88.max[1] && h9[2] * _5 < r88.max[2] && o90.footprint && e56.b$(R5, o90.footprint) ? Math.max(i28.cameraCollisionOpacity - t47, 0) : Math.min(1, i28.cameraCollisionOpacity + t47); } const l23 = [...D5], d38 = 1 / e56.d6(c31.canonical), u14 = o90.anchor ? o90.anchor[0] : 0, p11 = o90.anchor ? o90.anchor[1] : 0; e56.br(l23, l23, [u14 * (a48[0] - 1) + i28.evaluatedTranslation[0] * d38, p11 * (a48[1] - 1) + i28.evaluatedTranslation[1] * d38, s20 + i28.evaluatedTranslation[2]]), e56.cp(a48, e56.ev) || e56.cR(l23, l23, a48); const m8 = e56.aB([], l23, o90.matrix), g11 = e56.aB([], n46.expandedFarZProjMatrix, m8), E6 = e56.aB([], n46.expandedFarZProjMatrix, l23), S7 = e56.aC([], [u14, p11, s20, 1], g11)[2]; o90.hidden = false; let I5 = f9; y4 || (w4 && (I5 *= i28.cameraCollisionOpacity, I5 *= Zn(l23, n46, i28.aabb, b8)), I5 *= qn(T5, S7)), 0 !== I5 ? P4.push({ nodeInfo: i28, depth: S7, opacity: I5, wvpForNode: g11, wvpForTile: E6, nodeModelMatrix: m8, tileModelMatrix: l23 }) : o90.hidden = true; } y4 || P4.sort(((e57, t47) => !w4 || 1 === e57.opacity && 1 === t47.opacity ? e57.depth < t47.depth ? -1 : 1 : 1 === e57.opacity ? -1 : 1 === t47.opacity ? 1 : e57.depth > t47.depth ? -1 : 1)); for (const i28 of P4) { const s20 = i28.nodeInfo, c32 = s20.node; let h10 = e56.aB([], p10, i28.tileModelMatrix); e56.aB(h10, u13, h10); const d38 = e56.bl([], h10); e56.ed(d38, d38), e56.cR(d38, d38, Gn), h10 = e56.aB(h10, h10, c32.matrix); const _6 = "light-beam" === t46.renderPass, f10 = "none" === o89.paint.get("model-color-use-theme").constantOr("default"), v9 = L3 & e56.ez.HasMapboxMeshFeatures, x5 = v9 ? 0 : s20.evaluatedRMEA[0][2]; for (let e57 = 0; e57 < c32.meshes.length; ++e57) { const u14 = c32.meshes[e57], p11 = e57 === c32.lightMeshIndex; let b9 = i28.wvpForNode; if (p11) { if (!_6 && !t46.terrain && t46.shadowRenderer) { t46.currentLayer < t46.firstLightBeamLayer && (t46.firstLightBeamLayer = t46.currentLayer); continue; } b9 = i28.wvpForTile; } else if (_6) continue; const w5 = { defines: [] }, T6 = []; if (!y4 && l22 && (l22.useNormalOffset = !!u14.normalBuffer), Mn(w5.defines, T6, u14, t46, f10 ? null : o89.lut), v9 || w5.defines.push("DIFFUSE_SHADED"), S6 && w5.defines.push("SHADOWS_SINGLE_CASCADE"), E5 && (y4 ? E5.numRenderedVerticesInShadowPass += u14.vertexArray.length : E5.numRenderedVerticesInTransparentPass += u14.vertexArray.length), y4) { kn(u14, i28.nodeModelMatrix, t46, o89); continue; } let I5 = null; if (a47) { const e58 = On(i28.nodeModelMatrix, t46.transform); if (I5 = new Float32Array(e58), "globe" !== n46.projection.name) { const t47 = u14.aabb.min, i29 = u14.aabb.max, [o90, s21] = a47.getOpacityForBounds(e58, t47[0], t47[1], i29[0], i29[1]); w5.overrideFog = o90 >= Be || s21 >= Be; } } const C7 = u14.material; let R6; C7.occlusionTexture && C7.occlusionTexture.offsetScale && (R6 = C7.occlusionTexture.offsetScale, w5.defines.push("OCCLUSION_TEXTURE_TRANSFORM")); const A5 = t46.getOrCreateProgram("model", w5); !y4 && l22 && l22.setupShadowsFromMatrix(i28.tileModelMatrix, A5, l22.useNormalOffset), t46.uploadCommonUniforms(r87, A5, null, I5); const D6 = C7.pbrMetallicRoughness; D6.metallicFactor = 0.9, D6.roughnessFactor = 0.5; const L4 = Dr(new Float32Array(b9), new Float32Array(h10), new Float32Array(d38), new Float32Array(c32.matrix), t46, i28.opacity, D6.baseColorFactor, C7.emissiveFactor, D6.metallicFactor, D6.roughnessFactor, C7, x5, o89, [0, 0, 0], R6); !p11 && (s20.hasTranslucentParts || i28.opacity < 1) && A5.draw(t46, r87.gl.TRIANGLES, m7, Gi.disabled, Ui.disabled, Zi.backCCW, L4, o89.id, u14.vertexBuffer, u14.indexBuffer, u14.segments, o89.paint, t46.transform.zoom, void 0, T6), A5.draw(t46, r87.gl.TRIANGLES, p11 ? g10 : m7, Gi.disabled, p11 || i28.opacity < 1 || s20.hasTranslucentParts ? Ui.alphaBlended : Ui.unblended, Zi.backCCW, L4, o89.id, u14.vertexBuffer, u14.indexBuffer, u14.segments, o89.paint, t46.transform.zoom, void 0, T6); } } } })(); })(t45, i26, o88, s18), void c28(); if ("model" !== h8.type) return; const d34 = h8.getModels(), u12 = [], _4 = t45.transform.getFreeCameraOptions().position, p9 = e56.c4([], [_4.x, _4.y, _4.z], t45.transform.worldSize); e56.et(p9, p9); const f8 = [], m6 = []; let g9 = 0; for (const i27 of d34) { const s19 = o88.paint.get("model-rotation").constantOr(null), r87 = o88.paint.get("model-scale").constantOr(null), n46 = o88.paint.get("model-translation").constantOr(null); i27.computeModelMatrix(t45, s19, r87, n46, true, true, false); const a47 = e56.bA([]), l22 = e56.ec(i27.position.lat, t45.transform.zoom), c29 = e56.bq([], [1, 1, 1 / l22]); e56.br(a47, a47, p9), u12.push({ zScaleMatrix: c29, negCameraPosMatrix: a47 }); for (const e57 of i27.nodes) Bn(t45.transform, e57, i27.matrix, t45.transform.expandedFarZProjMatrix, g9, f8, m6); g9++; } if (f8.sort(((e57, t46) => t46.depth - e57.depth)), "shadow" !== t45.renderPass) { if (1 === r86) for (const e57 of m6) Fn(e57, t45, o88, u12[e57.modelIndex], Gi.disabled, t45.colorModeForRenderPass()); else { for (const e57 of m6) Fn(e57, t45, o88, u12[e57.modelIndex], Gi.disabled, Ui.disabled); for (const e57 of m6) Fn(e57, t45, o88, u12[e57.modelIndex], t45.stencilModeFor3D(), t45.colorModeForRenderPass()); t45.resetStencilClippingMasks(); } for (const e57 of f8) Fn(e57, t45, o88, u12[e57.modelIndex], Gi.disabled, t45.colorModeForRenderPass()); c28(); } else { for (const e57 of m6) kn(e57.mesh, e57.nodeModelMatrix, t45, o88); for (const e57 of f8) kn(e57.mesh, e57.nodeModelMatrix, t45, o88); c28(); } } }, ha = { line: function(e57, t45, i26) { if (e57.hasElevatedBuckets = false, e57.hasNonElevatedBuckets = false, void 0 !== e57._unevaluatedLayout.getValue("line-elevation-reference") || void 0 !== e57._unevaluatedLayout.getValue("line-z-offset")) { if (t45) { const i27 = t45.getVisibleCoordinates(); for (const o88 of i27) { const i28 = t45.getTile(o88).getBucket(e57); if (i28 && ("none" !== i28.elevationType ? e57.hasElevatedBuckets = true : e57.hasNonElevatedBuckets = true, e57.hasElevatedBuckets && e57.hasNonElevatedBuckets)) break; } } } else e57.hasNonElevatedBuckets = true; }, model: function(e57, t45, i26) { const o88 = t45.getSource(); if (!o88.loaded()) return; if ("vector" === o88.type || "geojson" === o88.type) return void (i26.modelManager && i26.modelManager.upload(i26, "vector" === o88.type ? e57.scope : "")); if ("batched-model" === o88.type) return; if ("model" !== o88.type) return; const s18 = o88.getModels(); for (const e58 of s18) e58.upload(i26.context); }, raster: function(e57, t45, i26) { const o88 = t45.getSource(); if (!(o88 instanceof nt2 && o88.loaded())) return; const s18 = e57.sourceLayer || o88.rasterLayerIds && o88.rasterLayerIds[0]; if (!s18) return; const r86 = e57.paint.get("raster-array-band") || o88.getInitialBand(s18); if (null == r86) return; const n45 = t45.getIds().map(((e58) => t45.getTileByID(e58))); for (const t46 of n45) t46.updateNeeded(e57.id, r86) && o88.prepareTile(t46, s18, e57.id, r86); }, "raster-particle": function(e57, t45, i26) { const o88 = t45.getSource(); if (!(o88 instanceof nt2 && o88.loaded())) return; const s18 = e57.sourceLayer || o88.rasterLayerIds && o88.rasterLayerIds[0]; if (!s18) return; const r86 = e57.paint.get("raster-particle-array-band") || o88.getInitialBand(s18); if (null == r86) return; const n45 = t45.getIds().map(((e58) => t45.getTileByID(e58))); for (const t46 of n45) t46.updateNeeded(e57.id, r86) && o88.prepareTile(t46, s18, e57.id, r86); } }, da2 = { fill: Wr }, ua = { fill: function(e57, t45, i26, o88) { if (!i26.layout || "none" === i26.layout.get("fill-elevation-reference")) return; const s18 = e57.context.gl, r86 = new ji(s18.LEQUAL, ji.ReadOnly, e57.depthRangeFor3D), n45 = new Gi({ func: s18.ALWAYS, mask: 255 }, 255, 255, s18.KEEP, s18.KEEP, s18.REPLACE), a46 = e57.transform.getFreeCameraOptions().position, l21 = e57.getOrCreateProgram("elevatedStructuresDepthReconstruct"); for (const c28 of o88) { const o89 = t45.getTile(c28), h8 = o89.getBucket(i26); if (!h8) continue; const d34 = h8.elevatedStructures; if (!d34 || 0 === d34.depthSegments.segments[0].primitiveLength) continue; const u12 = Zr(c28.toUnwrapped(), a46), _4 = e57.translatePosMatrix(c28.projMatrix, o89, i26.paint.get("fill-translate"), i26.paint.get("fill-translate-anchor")), p9 = cr(_4, u12, 0, 1, 0); l21.draw(e57, s18.TRIANGLES, r86, n45, Ui.disabled, Zi.disabled, p9, i26.id, d34.vertexBuffer, d34.indexBuffer, d34.depthSegments, i26.paint, e57.transform.zoom); } } }; class _a12 { constructor(t45, i26, o88, s18, r86, n45) { this.context = new Br(t45, i26), this.transform = o88, this._tileTextures = {}, this.frameCopies = [], this.loadTimeStamps = [], this.tp = r86, this._timeStamp = e56.o.now(), this._averageFPS = 0, this._fpsHistory = [], this._dt = 0, this._debugParams = { forceEnablePrecipitation: false, showTerrainProxyTiles: false, fpsWindow: 30, continousRedraw: false, enabledLayers: {} }; const a46 = ["fill", "line", "symbol", "circle", "heatmap", "fill-extrusion", "building", "raster", "raster-particle", "hillshade", "model", "background", "sky"]; for (const e57 of a46) this._debugParams.enabledLayers[e57] = true; r86.registerParameter(this._debugParams, ["Terrain"], "showTerrainProxyTiles", {}, (() => { this.style.map.triggerRepaint(); })), r86.registerParameter(this._debugParams, ["Precipitation"], "forceEnablePrecipitation"), r86.registerParameter(this._debugParams, ["FPS"], "fpsWindow", { min: 1, max: 100, step: 1 }), r86.registerBinding(this._debugParams, ["FPS"], "continousRedraw", { readonly: true, label: "continuous redraw" }), r86.registerBinding(this, ["FPS"], "_averageFPS", { readonly: true, label: "value" }), r86.registerBinding(this, ["FPS"], "_averageFPS", { readonly: true, label: "graph", view: "graph", min: 0, max: 200 }); for (const e57 of a46) r86.registerParameter(this._debugParams.enabledLayers, ["Debug", "Layers"], e57); this.occlusionParams = new Xn(r86), this.setup(), this.numSublayers = Rt2.maxUnderzooming + Rt2.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.deferredRenderGpuTimeQueries = [], this.gpuTimers = {}, this.frameCounter = 0, this._backgroundTiles = {}, this.conflationActive = false, this.replacementSource = new e56.eG(), this.longestCutoffRange = 0, this.minCutoffZoom = 0, this._fogVisible = false, this._cachedTileFogOpacities = {}, this._shadowRenderer = new no(this), this._wireframeDebugCache = new $n(), this.renderDefaultNorthPole = true, this.renderDefaultSouthPole = true, this.layersWithOcclusionOpacity = []; const l21 = new e56.q({ width: 1, height: 1 }, Uint8Array.of(0, 0, 0, 0)); this.emptyDepthTexture = new e56.T(this.context, l21, t45.RGBA8), this._clippingActiveLastFrame = false, this.scaleFactor = s18, this.worldview = n45; } updateTerrain(e57, t45) { const i26 = !!e57 && !!e57.terrain && this.transform.projection.supportsTerrain; if (!(i26 || this._terrain && this._terrain.enabled)) return; this._terrain || (this._terrain = new Ws(this, e57)); const o88 = this._terrain; this.transform.elevation = i26 ? o88 : null, o88.update(e57, this.transform, t45), this.transform.elevation && !o88.enabled && (this.transform.elevation = null); } _updateFog(e57) { const t45 = e57.fog; if (!t45 || "globe" === this.transform.projection.name || t45.getOpacity(this.transform.pitch) < 1 || t45.properties.get("horizon-blend") < 0.03) return void (this.transform.fogCullDistSq = null); const [i26, o88] = t45.getFovAdjustedRange(this.transform._fov); if (i26 > o88) return void (this.transform.fogCullDistSq = null); const s18 = i26 + 0.78 * (o88 - i26); this.transform.fogCullDistSq = s18 * s18; } get terrain() { return this.transform._terrainEnabled() && this._terrain && this._terrain.enabled || this._forceTerrainMode ? this._terrain : null; } get forceTerrainMode() { return this._forceTerrainMode; } set forceTerrainMode(e57) { e57 && !this._terrain && (this._terrain = new Ws(this, this.style)), this._forceTerrainMode = e57; } get shadowRenderer() { return this._shadowRenderer && this._shadowRenderer.enabled ? this._shadowRenderer : null; } get wireframeDebugCache() { return this._wireframeDebugCache; } resize(t45, i26) { if (this.width = t45 * e56.o.devicePixelRatio, this.height = i26 * e56.o.devicePixelRatio, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (const e57 of this.style.order) this.style._mergedLayers[e57].resize(); } setup() { const t45 = this.context, i26 = new e56.bd(); i26.emplaceBack(0, 0), i26.emplaceBack(e56.al, 0), i26.emplaceBack(0, e56.al), i26.emplaceBack(e56.al, e56.al), this.tileExtentBuffer = t45.createVertexBuffer(i26, e56.bf.members), this.tileExtentSegments = e56.bg.simpleSegment(0, 0, 4, 2); const o88 = new e56.bd(); o88.emplaceBack(0, 0), o88.emplaceBack(e56.al, 0), o88.emplaceBack(0, e56.al), o88.emplaceBack(e56.al, e56.al), this.debugBuffer = t45.createVertexBuffer(o88, e56.bf.members), this.debugSegments = e56.bg.simpleSegment(0, 0, 4, 5); const s18 = new e56.bd(); s18.emplaceBack(-1, -1), s18.emplaceBack(1, -1), s18.emplaceBack(-1, 1), s18.emplaceBack(1, 1), this.viewportBuffer = t45.createVertexBuffer(s18, e56.bf.members), this.viewportSegments = e56.bg.simpleSegment(0, 0, 4, 2); const r86 = new e56.b0(); r86.emplaceBack(0, 0, 0, 0), r86.emplaceBack(e56.al, 0, e56.al, 0), r86.emplaceBack(0, e56.al, 0, e56.al), r86.emplaceBack(e56.al, e56.al, e56.al, e56.al), this.mercatorBoundsBuffer = t45.createVertexBuffer(r86, e56.bi.members), this.mercatorBoundsSegments = e56.bg.simpleSegment(0, 0, 4, 2); const n45 = new e56.b1(); n45.emplaceBack(0, 1, 2), n45.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = t45.createIndexBuffer(n45); const a46 = new e56.be(); for (const e57 of [0, 1, 3, 2, 0]) a46.emplaceBack(e57); this.debugIndexBuffer = t45.createIndexBuffer(a46), this.emptyTexture = new e56.T(t45, new e56.q({ width: 1, height: 1 }, Uint8Array.of(0, 0, 0, 0)), t45.gl.RGBA8), this.identityMat = e56.bC(); const l21 = this.context.gl; this.stencilClearMode = new Gi({ func: l21.ALWAYS, mask: 0 }, 0, 255, l21.ZERO, l21.ZERO, l21.ZERO), this.loadTimeStamps.push(performance.now()); } getMercatorTileBoundsBuffers() { return { tileBoundsBuffer: this.mercatorBoundsBuffer, tileBoundsIndexBuffer: this.quadTriangleIndexBuffer, tileBoundsSegments: this.mercatorBoundsSegments }; } getTileBoundsBuffers(e57) { return e57._makeTileBoundsBuffers(this.context, this.transform.projection), e57._tileBoundsBuffer ? { tileBoundsBuffer: e57._tileBoundsBuffer, tileBoundsIndexBuffer: e57._tileBoundsIndexBuffer, tileBoundsSegments: e57._tileBoundsSegments } : this.getMercatorTileBoundsBuffers(); } clearStencil() { const e57 = this.context.gl; this.nextStencilID = 1, this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}, this.getOrCreateProgram("clippingMask").draw(this, e57.TRIANGLES, ji.disabled, this.stencilClearMode, Ui.disabled, Zi.disabled, Vs(this.identityMat), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments); } resetStencilClippingMasks() { this.terrain || (this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}); } _renderTileClippingMasks(e57, t45, i26) { if (!t45 || this.currentStencilSource === t45.id || !e57.isTileClipped() || !i26 || 0 === i26.length) return; if (this._tileClippingMaskIDs && !this.terrain) { let e58 = false; for (const t46 of i26) if (void 0 === this._tileClippingMaskIDs[t46.key]) { e58 = true; break; } if (!e58) return; } this.currentStencilSource = t45.id; const o88 = this.context, s18 = o88.gl; this.nextStencilID + i26.length > 256 && this.clearStencil(), o88.setColorMode(Ui.disabled), o88.setDepthMode(ji.disabled); const r86 = this.getOrCreateProgram("clippingMask"); this._tileClippingMaskIDs = {}; for (const e58 of i26) { const i27 = t45.getTile(e58), o89 = this._tileClippingMaskIDs[e58.key] = this.nextStencilID++, { tileBoundsBuffer: n45, tileBoundsIndexBuffer: a46, tileBoundsSegments: l21 } = this.getTileBoundsBuffers(i27); r86.draw(this, s18.TRIANGLES, ji.disabled, new Gi({ func: s18.ALWAYS, mask: 0 }, o89, 255, s18.KEEP, s18.KEEP, s18.REPLACE), Ui.disabled, Zi.disabled, Vs(e58.projMatrix), "$clipping", n45, a46, l21); } } stencilModeFor3D() { this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil(); const e57 = this.nextStencilID++, t45 = this.context.gl; return new Gi({ func: t45.NOTEQUAL, mask: 255 }, e57, 255, t45.KEEP, t45.KEEP, t45.REPLACE); } stencilModeForClipping(e57) { if (this.terrain) return this.terrain.stencilModeForRTTOverlap(e57); const t45 = this.context.gl; return new Gi({ func: t45.EQUAL, mask: 255 }, this._tileClippingMaskIDs[e57.key], 0, t45.KEEP, t45.KEEP, t45.REPLACE); } stencilConfigForOverlap(e57) { const t45 = this.context.gl, i26 = e57.sort(((e58, t46) => t46.overscaledZ - e58.overscaledZ)), o88 = i26[i26.length - 1].overscaledZ, s18 = i26[0].overscaledZ - o88 + 1; if (s18 > 1) { this.currentStencilSource = void 0, this.nextStencilID + s18 > 256 && this.clearStencil(); const e58 = {}; for (let i27 = 0; i27 < s18; i27++) e58[i27 + o88] = new Gi({ func: t45.GEQUAL, mask: 255 }, i27 + this.nextStencilID, 255, t45.KEEP, t45.KEEP, t45.REPLACE); return this.nextStencilID += s18, [e58, i26]; } return [{ [o88]: Gi.disabled }, i26]; } colorModeForRenderPass() { const t45 = this.context.gl; if (this._showOverdrawInspector) { const i26 = 1 / 8; return new Ui([t45.CONSTANT_COLOR, t45.ONE, t45.CONSTANT_COLOR, t45.ONE], new e56.ao(i26, i26, i26, 0), [true, true, true, true]); } return "opaque" === this.renderPass ? Ui.unblended : Ui.alphaBlended; } colorModeForDrapableLayerRenderPass(t45) { const i26 = this.context.gl; return (() => this.style && this.style.enable3dLights() && this.terrain && this.terrain.renderingToTexture)() && "translucent" === this.renderPass ? new Ui([i26.ONE, i26.ONE_MINUS_SRC_ALPHA, i26.CONSTANT_ALPHA, i26.ONE_MINUS_SRC_ALPHA], new e56.ao(0, 0, 0, void 0 === t45 ? 0 : t45), [true, true, true, true]) : this.colorModeForRenderPass(); } depthModeForSublayer(e57, t45, i26, o88 = false) { if (this.depthOcclusion) return new ji(this.context.gl.GREATER, ji.ReadOnly, this.depthRangeFor3D); if (!this.opaquePassEnabledForLayer() && !o88) return ji.disabled; const s18 = 1 - ((1 + this.currentLayer) * this.numSublayers + e57) * this.depthEpsilon; return new ji(i26 || this.context.gl.LEQUAL, t45, [s18, s18]); } opaquePassEnabledForLayer() { return this.currentLayer < this.opaquePassCutoff; } blitDepth() { const t45 = this.context.gl, i26 = Math.ceil(this.width), o88 = Math.ceil(this.height), s18 = this.context.bindFramebuffer.get(), r86 = t45.getParameter(t45.TEXTURE_BINDING_2D); this.depthFBO && this.depthFBO.width === i26 && this.depthFBO.height === o88 || (this.depthFBO && (this.depthFBO.destroy(), this.depthFBO = void 0, this.depthTexture = void 0), 0 !== i26 && 0 !== o88 && (this.depthFBO = new Fr(this.context, i26, o88, false, "texture"), this.depthTexture = new e56.T(this.context, { width: i26, height: o88, data: null }, t45.DEPTH24_STENCIL8), this.depthFBO.depthAttachment.set(this.depthTexture.texture))), this.context.bindFramebuffer.set(s18), t45.bindTexture(t45.TEXTURE_2D, r86), this.depthFBO && (t45.bindFramebuffer(t45.READ_FRAMEBUFFER, null), t45.bindFramebuffer(t45.DRAW_FRAMEBUFFER, this.depthFBO.framebuffer), t45.blitFramebuffer(0, 0, i26, o88, 0, 0, i26, o88, t45.DEPTH_BUFFER_BIT, t45.NEAREST), t45.bindFramebuffer(t45.FRAMEBUFFER, this.context.bindFramebuffer.current)); } updateAverageFPS() { this._fpsHistory.push(0 === this._dt ? 0 : 1e3 / this._dt), this._fpsHistory.length > this._debugParams.fpsWindow && this._fpsHistory.splice(0, this._fpsHistory.length - this._debugParams.fpsWindow), this._averageFPS = Math.round(this._fpsHistory.reduce(((e57, t45) => e57 + t45 / this._fpsHistory.length), 0)); } render(t45, i26) { const o88 = e56.o.now(); this._dt = o88 - this._timeStamp, this._timeStamp = o88, this._wireframeDebugCache.update(this.frameCounter), this._debugParams.continousRedraw = t45.map.repaint, this.style = t45, this.options = i26; const s18 = this.style._mergedLayers, r86 = !(!this.terrain || !this.terrain.enabled), n45 = () => this.style._getOrder(r86).filter(((e57) => { const t46 = s18[e57]; return !(t46.type in this._debugParams.enabledLayers) || this._debugParams.enabledLayers[t46.type]; })); let a46 = n45(), l21 = false, c28 = false, h8 = null; for (const e57 of a46) { const t46 = s18[e57]; "circle" === t46.type ? l21 = true : "building" === t46.type ? h8 = t46 : "symbol" === t46.type && (t46.hasOcclusionOpacityProperties ? c28 = true : l21 = true); } let d34 = a46.map(((e57) => s18[e57])); const u12 = this.style._mergedSourceCaches; this.imageManager = t45.imageManager, this.modelManager = t45.modelManager, this.symbolFadeChange = t45.placement.symbolFadeChange(e56.o.now()), this.imageManager.beginFrame(); let _4 = 0, p9 = false; for (const e57 in u12) { const t46 = u12[e57]; t46.used && (t46.prepare(this.context), t46.getSource().usedInConflation && ++_4); } let f8 = false; for (const e57 of d34) e57.isHidden(this.transform.zoom) || ("clip" === e57.type && (f8 = true), this.prepareLayer(e57)); const m6 = {}, g9 = {}, v8 = {}, y4 = {}, x4 = {}; for (const e57 in u12) { const t46 = u12[e57]; m6[e57] = t46.getVisibleCoordinates(), g9[e57] = m6[e57].slice().reverse(), v8[e57] = t46.getVisibleCoordinates(true).reverse(), y4[e57] = t46.getShadowCasterCoordinates(), x4[e57] = t46.sortCoordinatesByDistance(m6[e57]); } const b8 = (e57) => { const t46 = this.style.getLayerSourceCache(e57); return t46 && t46.used ? t46.getSource() : null; }; if (_4 || f8 || this._clippingActiveLastFrame) { const t46 = [], i27 = []; let o89 = 0; for (const e57 of d34) this.isSourceForClippingOrConflation(e57, b8(e57)) && (t46.push(e57), i27.push(o89)), o89++; if (t46 && (f8 || t46.length > 1) || this._clippingActiveLastFrame) { f8 = false; const o90 = []; for (let s19 = 0; s19 < t46.length; s19++) { const r87 = t46[s19], n46 = i27[s19], a47 = this.style.getLayerSourceCache(r87); if (!a47 || !a47.used || !a47.getSource().usedInConflation && "clip" !== r87.type && "building" !== r87.type) continue; let l22 = e56.eH, c29 = e56.bZ.None; const h9 = []; let d35 = true; if ("building" === r87.type) l22 = e56.eJ; else if ("clip" === r87.type) { l22 = n46; for (const t47 of r87.layout.get("clip-layer-types")) c29 |= "model" === t47 ? e56.bZ.Model : "symbol" === t47 ? e56.bZ.Symbol : e56.bZ.FillExtrusion; for (const e57 of r87.layout.get("clip-layer-scope")) h9.push(e57); r87.isHidden(this.transform.zoom) ? d35 = false : f8 = true; } d35 && o90.push({ layer: r87.fqid, cache: a47, order: l22, clipMask: c29, clipScope: h9 }); } this.replacementSource.setSources(o90), p9 = true; } } this._clippingActiveLastFrame = f8, p9 || this.replacementSource.clear(), this.conflationActive = p9, this.minCutoffZoom = 0, this.longestCutoffRange = 0, this.opaquePassCutoff = 1 / 0, this._lastOcclusionLayer = -1, this.layersWithOcclusionOpacity = []; for (let e57 = 0; e57 < d34.length; e57++) { const t46 = d34[e57], i27 = t46.cutoffRange(); if (this.longestCutoffRange = Math.max(i27, this.longestCutoffRange), i27 > 0) { const e58 = b8(t46); e58 && (this.minCutoffZoom = Math.max(e58.minzoom, this.minCutoffZoom)), t46.minzoom && (this.minCutoffZoom = Math.max(t46.minzoom, this.minCutoffZoom)); } t46.is3D(r86) && (this.opaquePassCutoff === 1 / 0 && (this.opaquePassCutoff = e57), this._lastOcclusionLayer = e57); } const w4 = this.style && this.style.fog; w4 ? (this._fogVisible = 0 !== w4.getOpacity(this.transform.pitch), this._fogVisible && "globe" !== this.transform.projection.name && (this._fogVisible = w4.isVisibleOnFrustum(this.transform.cameraFrustum))) : this._fogVisible = false, this._cachedTileFogOpacities = {}, this.terrain && (this.terrain.updateTileBinding(v8), this.opaquePassCutoff = 0, a46 = n45(), d34 = a46.map(((e57) => s18[e57]))); const T5 = this._shadowRenderer; if (T5) { T5.updateShadowParameters(this.transform, this.style.directionalLight); for (const e57 in u12) for (const t46 of m6[e57]) { let e58 = { min: 0, max: 0 }; this.terrain && (e58 = this.terrain.getMinMaxForTile(t46) || e58), T5.addShadowReceiver(t46.toUnwrapped(), e58.min, e58.max); } } "globe" !== this.transform.projection.name || this.globeSharedBuffers || (this.globeSharedBuffers = new e56.eI(this.context)), this.style.fog && this.transform.projection.supportsFog ? (this._atmosphere || (this._atmosphere = new Pn(this)), this._atmosphere.update(this)) : this._atmosphere && (this._atmosphere.destroy(), this._atmosphere = void 0); const E5 = this._debugParams.forceEnablePrecipitation || !(!this.style || !this.style.snow), S5 = this._debugParams.forceEnablePrecipitation || !(!this.style || !this.style.rain); if (E5 && !this._snow && (this._snow = new la(this)), !E5 && this._snow && (this._snow.destroy(), delete this._snow), S5 && !this._rain && (this._rain = new na(this)), !S5 && this._rain && (this._rain.destroy(), delete this._rain), this._snow && this._snow.update(this), this._rain && this._rain.update(this), h8) { this.buildingTileBorderManager || (this.buildingTileBorderManager = new zn()); const e57 = this.style.getLayerSourceCache(h8); this.buildingTileBorderManager.updateBorders(e57, h8); } if (!U3.has(this.context.gl)) return; this.renderPass = "offscreen"; for (const e57 of d34) { const i27 = t45.getLayerSourceCache(e57); if (!e57.hasOffscreenPass() || e57.isHidden(this.transform.zoom)) continue; const o89 = i27 ? g9[i27.id] : void 0; ("custom" === e57.type || "raster" === e57.type || "raster-particle" === e57.type || e57.isSky() || o89 && o89.length) && this.renderLayer(this, i27, e57, o89); } this.depthRangeFor3D = [0, 1 - (d34.length + 2) * this.numSublayers * this.depthEpsilon], this._shadowRenderer && (this.renderPass = "shadow", this._shadowRenderer.drawShadowPass(this.style, y4)), this.context.bindFramebuffer.set(null), this.context.viewport.set([0, 0, this.width, this.height]); const I4 = "globe" === this.transform.projection.name || this.transform.isHorizonVisible(), C6 = (() => { if (i26.showOverdrawInspector) return e56.ao.black; const t46 = this.style.fog; if (t46 && this.transform.projection.supportsFog) { const i27 = this.style.getLut(t46.scope); if (!I4) { const o89 = "none" === t46.properties.get("color-use-theme"), s19 = t46.properties.get("color").toNonPremultipliedRenderColor(o89 ? null : i27).toArray01(); return new e56.ao(...s19); } if (I4) { const o89 = "none" === t46.properties.get("space-color-use-theme"), s19 = t46.properties.get("space-color").toNonPremultipliedRenderColor(o89 ? null : i27).toArray01(); return new e56.ao(...s19); } } return e56.ao.transparent; })(); if (this.context.clear({ color: C6, depth: 1 }), this.clearStencil(), this._showOverdrawInspector = i26.showOverdrawInspector, this.renderPass = "opaque", this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && I4 && this._atmosphere.drawStars(this, this.style.fog), !this.terrain) for (this.currentLayer = a46.length - 1; this.currentLayer >= 0; this.currentLayer--) { const e57 = d34[this.currentLayer], i27 = t45.getLayerSourceCache(e57); if (e57.isSky()) continue; const o89 = i27 ? (e57.is3D(r86) ? x4 : g9)[i27.id] : void 0; this._renderTileClippingMasks(e57, i27, o89), this.renderLayer(this, i27, e57, o89); } if (this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && I4 && this._atmosphere.drawAtmosphereGlow(this, this.style.fog), this.renderPass = "sky", (!this._atmosphere || e56.aj(this.transform.zoom) > 0) && ("globe" === this.transform.projection.name || this.transform.isHorizonVisible())) for (this.currentLayer = 0; this.currentLayer < a46.length; this.currentLayer++) { const e57 = d34[this.currentLayer], i27 = t45.getLayerSourceCache(e57); e57.isSky() && this.renderLayer(this, i27, e57, i27 ? g9[i27.id] : void 0); } function R5(e57, t46) { let i27; return t46 && (i27 = ("symbol" === e57.type ? v8 : e57.is3D(r86) ? x4 : g9)[t46.id]), i27; } if (this.renderPass = "translucent", "globe" === this.transform.projection.name) { for (this.renderElevatedRasterBackface = true, this.currentLayer = 0; this.currentLayer < a46.length; ) { const e57 = d34[this.currentLayer]; if ("raster" === e57.type || "raster-particle" === e57.type) { const i27 = t45.getLayerSourceCache(e57); this.renderLayer(this, i27, e57, R5(e57, i27)); } ++this.currentLayer; } this.renderElevatedRasterBackface = false; } this.currentLayer = 0, this.firstLightBeamLayer = Number.MAX_SAFE_INTEGER; let A4 = 0; T5 && (A4 = T5.getShadowCastingLayerCount()); let D5 = false, L3 = -1; for (let e57 = 0; e57 < a46.length; ++e57) { const t46 = d34[e57]; t46.isHidden(this.transform.zoom) || t46.is3D(r86) && (L3 = e57); } c28 && -1 === L3 && (l21 = true); let P4 = false; for (; this.currentLayer < a46.length; ) { const e57 = d34[this.currentLayer], i27 = t45.getLayerSourceCache(e57); if (e57.isSky()) ++this.currentLayer; else if (this.terrain && this.style.isLayerDraped(e57)) { if (e57.isHidden(this.transform.zoom)) { ++this.currentLayer; continue; } this.currentLayer = this.terrain.renderBatch(this.currentLayer), this._lastOcclusionLayer = Math.max(this.currentLayer, this._lastOcclusionLayer); } else { if (!P4 && e57.is3D(r86) && !r86) { const e58 = this.currentLayer, t46 = (e59) => { for (this.currentLayer = 0; this.currentLayer < d34.length; this.currentLayer++) { const t47 = d34[this.currentLayer]; if (da2[t47.type]) { const i28 = this.style.getLayerSourceCache(t47); da2[t47.type](this, i28, t47, R5(t47, i28), e59); } } }; t46("initialize"), t46("reset"), this.currentLayer = e58, P4 = true; } if (l21 && !D5 && this.terrain && !this.transform.isOrthographic && (D5 = true, this.blitDepth()), c28 && -1 !== L3 && this.currentLayer === L3 + 1 && !this.transform.isOrthographic && this.blitDepth(), this.terrain || this._renderTileClippingMasks(e57, i27, i27 ? m6[i27.id] : void 0), this.renderLayer(this, i27, e57, R5(e57, i27)), !this.terrain && T5 && A4 > 0 && e57.hasShadowPass() && 0 == --A4) { { this.clearStencil(), this.resetStencilClippingMasks(); const e58 = this.currentLayer; for (this.currentLayer = 0; this.currentLayer < d34.length; this.currentLayer++) { const e59 = d34[this.currentLayer]; if (ua[e59.type]) { const t46 = this.style.getLayerSourceCache(e59); ua[e59.type](this, t46, e59, R5(e59, t46)); } } this.currentLayer = e58; } if (T5.drawGroundShadows(), this.firstLightBeamLayer <= this.currentLayer) { const e58 = this.currentLayer; for (this.renderPass = "light-beam", this.currentLayer = this.firstLightBeamLayer; this.currentLayer <= e58; this.currentLayer++) { const e59 = d34[this.currentLayer]; if (!e59.hasLightBeamPass()) continue; const i28 = t45.getLayerSourceCache(e59); this.renderLayer(this, i28, e59, i28 ? g9[i28.id] : void 0); } this.currentLayer = e58, this.renderPass = "translucent"; } } if (this.currentLayer >= this._lastOcclusionLayer && this.layersWithOcclusionOpacity.length > 0) { const e58 = this.currentLayer; this.depthOcclusion = true; for (const e59 of this.layersWithOcclusionOpacity) { this.currentLayer = e59; const i28 = d34[this.currentLayer], o89 = t45.getLayerSourceCache(i28), s19 = o89 ? g9[o89.id] : void 0; this.terrain || this._renderTileClippingMasks(i28, o89, o89 ? m6[o89.id] : void 0), this.renderLayer(this, o89, i28, s19); } this.depthOcclusion = false, this.currentLayer = e58, this.renderPass = "translucent", this.layersWithOcclusionOpacity = []; } ++this.currentLayer; } } if (this.terrain && this.terrain.postRender(), this._snow && this._snow.draw(this), this._rain && this._rain.draw(this), this.options.showTileBoundaries || this.options.showQueryGeometry || this.options.showTileAABBs) { let i27 = null; d34.forEach(((e57) => { const o89 = t45.getLayerSourceCache(e57); o89 && !e57.isHidden(this.transform.zoom) && o89.getVisibleCoordinates().length && (!i27 || i27.getSource().maxzoom < o89.getSource().maxzoom) && (i27 = o89); })), i27 && this.options.showTileBoundaries && vn(this, i27, i27.getVisibleCoordinates(), e56.ao.red, false, this.options.showParseStatus); } this.terrain && this._debugParams.showTerrainProxyTiles && vn(this, this.terrain.proxySourceCache, this.terrain.proxyCoords, new e56.ao(1, 0.8, 0.1, 1), true, this.options.showParseStatus), this.options.showPadding && (function(e57) { const t46 = e57.transform.padding; xn(e57, e57.transform.height - (t46.top || 0), 3, _n), xn(e57, t46.bottom || 0, 3, pn), bn(e57, t46.left || 0, 3, fn), bn(e57, e57.transform.width - (t46.right || 0), 3, mn); const i27 = e57.transform.centerPoint; !(function(e58, t47, i28, o89) { wn(e58, t47 - 1, i28 - 10, 2, 20, o89), wn(e58, t47 - 10, i28 - 1, 20, 2, o89); })(e57, i27.x, e57.transform.height - i27.y, gn); })(this), this.context.setDefault(), this.frameCounter = (this.frameCounter + 1) % Number.MAX_SAFE_INTEGER, this.tileLoaded && this.options.speedIndexTiming && (this.loadTimeStamps.push(performance.now()), this.saveCanvasCopy()), p9 || (this.conflationActive = false); } prepareLayer(e57) { this.gpuTimingStart(e57); const { unsupportedLayers: t45 } = this.transform.projection, i26 = !t45 || !t45.includes(e57.type); if (ha[e57.type] && (i26 || this.terrain && "custom" === e57.type)) { const t46 = this.style.getLayerSourceCache(e57); ha[e57.type](e57, t46, this); } this.gpuTimingEnd(); } renderLayer(e57, t45, i26, o88) { i26.isHidden(this.transform.zoom) || ("background" === i26.type || "sky" === i26.type || "custom" === i26.type || "model" === i26.type || "raster" === i26.type || "raster-particle" === i26.type || o88 && o88.length) && (this.id = i26.id, this.gpuTimingStart(i26), e57.transform.projection.unsupportedLayers && e57.transform.projection.unsupportedLayers.includes(i26.type) && (!e57.terrain || "custom" !== i26.type) || "clip" === i26.type || ca3[i26.type](e57, t45, i26, o88, this.style.placement.variableOffsets, this.options.isInitialLoad), this.gpuTimingEnd()); } gpuTimingStart(e57) { if (!this.options.gpuTiming) return; const t45 = this.context.extTimerQuery, i26 = this.context.gl; let o88 = this.gpuTimers[e57.id]; o88 || (o88 = this.gpuTimers[e57.id] = { calls: 0, cpuTime: 0, query: i26.createQuery() }), o88.calls++, i26.beginQuery(t45.TIME_ELAPSED_EXT, o88.query); } gpuTimingDeferredRenderStart() { if (this.options.gpuTimingDeferredRender) { const e57 = this.context.extTimerQuery, t45 = this.context.gl, i26 = t45.createQuery(); this.deferredRenderGpuTimeQueries.push(i26), t45.beginQuery(e57.TIME_ELAPSED_EXT, i26); } } gpuTimingDeferredRenderEnd() { this.options.gpuTimingDeferredRender && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); } gpuTimingEnd() { this.options.gpuTiming && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); } collectGpuTimers() { const e57 = this.gpuTimers; return this.gpuTimers = {}, e57; } collectDeferredRenderGpuQueries() { const e57 = this.deferredRenderGpuTimeQueries; return this.deferredRenderGpuTimeQueries = [], e57; } queryGpuTimers(e57) { const t45 = {}; for (const i26 in e57) { const o88 = e57[i26], s18 = this.context.extTimerQuery, r86 = s18.getQueryParameter(o88.query, this.context.gl.QUERY_RESULT) / 1e6; s18.deleteQueryEXT(o88.query), t45[i26] = r86; } return t45; } queryGpuTimeDeferredRender(e57) { if (!this.options.gpuTimingDeferredRender) return 0; const t45 = this.context.gl; let i26 = 0; for (const o88 of e57) i26 += t45.getQueryParameter(o88, t45.QUERY_RESULT) / 1e6, t45.deleteQuery(o88); return i26; } translatePosMatrix(t45, i26, o88, s18, r86) { if (!o88[0] && !o88[1]) return t45; const n45 = r86 ? "map" === s18 ? this.transform.angle : 0 : "viewport" === s18 ? -this.transform.angle : 0; if (n45) { const e57 = Math.sin(n45), t46 = Math.cos(n45); o88 = [o88[0] * t46 - o88[1] * e57, o88[0] * e57 + o88[1] * t46]; } const a46 = [r86 ? o88[0] : e56.ay(i26, o88[0], this.transform.zoom), r86 ? o88[1] : e56.ay(i26, o88[1], this.transform.zoom), 0], l21 = new Float32Array(16); return e56.br(l21, t45, a46), l21; } saveTileTexture(e57) { if (e57.context !== this.context) return; const t45 = e57.size[0], i26 = this._tileTextures[t45]; i26 ? i26.push(e57) : this._tileTextures[t45] = [e57]; } getTileTexture(e57) { const t45 = this._tileTextures[e57]; return t45 && t45.length > 0 ? t45.pop() : null; } terrainRenderModeElevated() { return this.style && !!this.style.getTerrain() && !!this.terrain && !this.terrain.renderingToTexture || this.forceTerrainMode; } linearFloatFilteringSupported() { return null != this.context.extTextureFloatLinear; } currentGlobalDefines(e57, t45, i26) { const o88 = void 0 === i26 ? this.terrain && this.terrain.renderingToTexture : i26, s18 = []; return this.style && this.style.enable3dLights() && ("globeRaster" === e57 || "terrainRaster" === e57 ? (s18.push("LIGHTING_3D_MODE"), s18.push("LIGHTING_3D_ALPHA_EMISSIVENESS")) : o88 || s18.push("LIGHTING_3D_MODE")), "shadow" === this.renderPass && (this._shadowMapDebug || s18.push("DEPTH_TEXTURE")), this.terrainRenderModeElevated() && (s18.push("TERRAIN"), this.linearFloatFilteringSupported() && s18.push("TERRAIN_DEM_FLOAT_FORMAT")), "globe" === this.transform.projection.name && s18.push("GLOBE"), !this._fogVisible || o88 || void 0 !== t45 && !t45 || s18.push("FOG", "FOG_DITHERING"), o88 && s18.push("RENDER_TO_TEXTURE"), this._showOverdrawInspector && s18.push("OVERDRAW_INSPECTOR"), s18; } getOrCreateProgram(e57, t45) { this.cache = this.cache || {}; const i26 = t45 && t45.defines || [], o88 = t45 && t45.config, s18 = this.currentGlobalDefines(e57, t45 && t45.overrideFog, t45 && t45.overrideRtt).concat(i26), r86 = Ks.cacheKey(Ho[e57], e57, s18, o88); return this.cache[r86] || (this.cache[r86] = new Ks(this.context, e57, Ho[e57], o88, Pr[e57], s18)), this.cache[r86]; } 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 e57 = this.context.gl; this.context.cullFace.set(false), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(e57.FUNC_ADD); } initDebugOverlayCanvas() { null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new e56.T(this.context, this.debugOverlayCanvas, this.context.gl.RGBA8)); } destroy() { this._terrain && this._terrain.destroy(), this._atmosphere && (this._atmosphere.destroy(), this._atmosphere = void 0), this.globeSharedBuffers && this.globeSharedBuffers.destroy(), this.emptyTexture.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this._wireframeDebugCache.destroy(), this.depthFBO && (this.depthFBO.destroy(), this.depthFBO = void 0, this.depthTexture = void 0), this.emptyDepthTexture && this.emptyDepthTexture.destroy(); } prepareDrawTile() { this.terrain && this.terrain.prepareDrawTile(); } uploadCommonLightUniforms(t45, i26) { if (this.style.enable3dLights()) { const o88 = this.style.directionalLight, s18 = this.style.ambientLight; if (o88 && s18) { const r86 = ((t46, i27, o89) => { const s19 = t46.properties.get("direction"), r87 = "none" === t46.properties.get("color-use-theme"), n45 = t46.properties.get("color").toNonPremultipliedRenderColor(r87 ? null : o89.getLut(t46.scope)).toArray01(), a46 = t46.properties.get("intensity"), l21 = "none" === i27.properties.get("color-use-theme"), c28 = i27.properties.get("color").toNonPremultipliedRenderColor(l21 ? null : o89.getLut(i27.scope)).toArray01(), h8 = i27.properties.get("intensity"), d34 = [s19.x, s19.y, s19.z], u12 = e56.dK(c28, h8), _4 = e56.dK(n45, a46); return { u_lighting_ambient_color: u12, u_lighting_directional_dir: d34, u_lighting_directional_color: _4, u_ground_radiance: $s(d34, _4, u12) }; })(o88, s18, this.style); i26.setLightsUniformValues(t45, r86); } } } uploadCommonUniforms(t45, i26, o88, s18, r86) { if (this.uploadCommonLightUniforms(t45, i26), this.terrain && this.terrain.renderingToTexture) return; const n45 = this.style.fog; if (n45) { const r87 = n45.getOpacity(this.transform.pitch), a46 = ((t46, i27, o89, s19, r88, n46, a47, l21, c28, h8, d34, u12) => { const _4 = t46.transform, p9 = "none" === i27.properties.get("color-use-theme"), f8 = i27.properties.get("color").toNonPremultipliedRenderColor(p9 ? null : t46.style.getLut(i27.scope)).toArray01(); f8[3] = s19; const m6 = t46.frameCounter / 1e3 % 1, [g9, v8] = i27.properties.get("vertical-range"); return { u_fog_matrix: o89 ? _4.calculateFogTileMatrix(o89) : u12 || t46.identityMat, u_fog_range: i27.getFovAdjustedRange(_4._fov), u_fog_color: f8, u_fog_horizon_blend: i27.properties.get("horizon-blend"), u_fog_vertical_limit: [Math.min(g9, v8), v8], u_fog_temporal_offset: m6, u_frustum_tl: r88, u_frustum_tr: n46, u_frustum_br: a47, u_frustum_bl: l21, u_globe_pos: c28, u_globe_radius: h8, u_viewport: d34, u_globe_transition: e56.aj(_4.zoom), u_is_globe: +("globe" === _4.projection.name) }; })(this, n45, o88, r87, this.transform.frustumCorners.TL, this.transform.frustumCorners.TR, this.transform.frustumCorners.BR, this.transform.frustumCorners.BL, this.transform.globeCenterInViewSpace, this.transform.globeRadius, [this.transform.width * e56.o.devicePixelRatio, this.transform.height * e56.o.devicePixelRatio], s18); i26.setFogUniformValues(t45, a46); } r86 && i26.setCutoffUniformValues(t45, r86.uniformValues); } setTileLoadedFlag(e57) { this.tileLoaded = e57; } saveCanvasCopy() { const e57 = this.canvasCopy(); e57 && (this.frameCopies.push(e57), this.tileLoaded = false); } canvasCopy() { const e57 = this.context.gl, t45 = e57.createTexture(); return e57.bindTexture(e57.TEXTURE_2D, t45), e57.copyTexImage2D(e57.TEXTURE_2D, 0, e57.RGBA, 0, 0, e57.drawingBufferWidth, e57.drawingBufferHeight, 0), t45; } getCanvasCopiesAndTimestamps() { return { canvasCopies: this.frameCopies, timeStamps: this.loadTimeStamps }; } averageElevationNeedsEasing() { if (!this.transform._elevation) return false; const e57 = this.style && this.style.fog; return !!e57 && 0 !== e57.getOpacity(this.transform.pitch); } getBackgroundTiles() { const e57 = this._backgroundTiles, t45 = this._backgroundTiles = {}, i26 = this.transform.coveringTiles({ tileSize: 512 }); for (const o88 of i26) t45[o88.key] = e57[o88.key] || new Et(o88, 512, this.transform.tileZoom, this, void 0, this.worldview); return t45; } clearBackgroundTiles() { this._backgroundTiles = {}; } isSourceForClippingOrConflation(e57, t45) { return !(!e57.is3D(!(!this.terrain || !this.terrain.enabled)) || "clip" !== e57.type && "building" !== e57.type && (e57.minzoom && e57.minzoom > this.transform.zoom || (this.style._clipLayerPresent || "building" !== e57.sourceLayer && "procedural_buildings" !== e57.sourceLayer) && (!t45 || "batched-model" !== t45.type))); } isTileAffectedByFog(e57) { if (!this.style || !this.style.fog) return false; if ("globe" === this.transform.projection.name) return true; let t45 = this._cachedTileFogOpacities[e57.key]; return t45 || (this._cachedTileFogOpacities[e57.key] = t45 = this.style.fog.getOpacityForTile(e57)), t45[0] >= Be || t45[1] >= Be; } setupDepthForOcclusion(e57, t45, i26) { const o88 = this.context, s18 = o88.gl, r86 = !!i26; var n45; i26 || (i26 = { u_dem: 2, u_dem_prev: 4, 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_depth_range_unpack: [0, 1], u_occluder_half_size: 16, u_occlusion_depth_offset: -1e-4, u_exaggeration: 0 }), o88.activeTexture.set(s18.TEXTURE3), e57 && this.depthFBO && this.depthTexture ? (this.depthTexture.bind(s18.NEAREST, s18.CLAMP_TO_EDGE), i26.u_depth_size_inv = [1 / this.depthFBO.width, 1 / this.depthFBO.height], i26.u_depth_range_unpack = [2 / ((n45 = this.depthRangeFor3D)[1] - n45[0]), -1 - 2 * n45[0] / (n45[1] - n45[0])], i26.u_occluder_half_size = 0.5 * this.occlusionParams.occluderSize, i26.u_occlusion_depth_offset = this.occlusionParams.depthOffset) : this.emptyDepthTexture.bind(s18.NEAREST, s18.CLAMP_TO_EDGE), o88.activeTexture.set(s18.TEXTURE0), r86 || t45.setTerrainUniformValues(o88, i26); } } function pa(e57, t45) { let i26 = false, o88 = null; const s18 = () => { o88 = null, i26 && (e57(), o88 = setTimeout(s18, t45), i26 = false); }; return () => (i26 = true, o88 || s18(), o88); } class fa { constructor(t45) { this._hashName = t45 && encodeURIComponent(t45), e56.aY(["_getCurrentHash", "_onHashChange", "_updateHash"], this), this._updateHash = pa(this._updateHashUnthrottled.bind(this), 300); } addTo(e57) { return this._map = e57, window.addEventListener("hashchange", this._onHashChange, false), e57.on("moveend", this._updateHash), this; } remove() { return this._map ? (this._map.off("moveend", this._updateHash), window.removeEventListener("hashchange", this._onHashChange, false), clearTimeout(this._updateHash()), this._map = void 0, this) : this; } getHashString() { const e57 = this._map; if (!e57) return ""; const t45 = ma(e57); if (this._hashName) { const e58 = this._hashName; let i26 = false; const o88 = location.hash.slice(1).split("&").map(((o89) => { const s18 = o89.split("=")[0]; return s18 === e58 ? (i26 = true, `${s18}=${t45}`) : o89; })).filter(((e59) => e59)); return i26 || o88.push(`${e58}=${t45}`), `#${o88.join("&")}`; } return `#${t45}`; } _getCurrentHash() { const e57 = location.hash.replace("#", ""); if (this._hashName) { let t45; return e57.split("&").map(((e58) => e58.split("="))).forEach(((e58) => { e58[0] === this._hashName && (t45 = e58); })), (t45 && t45[1] || "").split("/"); } return e57.split("/"); } _onHashChange() { const e57 = this._map; if (!e57) return false; const t45 = this._getCurrentHash(); if (t45.length >= 3 && !t45.some(((e58) => isNaN(Number(e58))))) { const i26 = e57.dragRotate.isEnabled() && e57.touchZoomRotate.isEnabled() ? +(t45[3] || 0) : e57.getBearing(); return e57.jumpTo({ center: [+t45[2], +t45[1]], zoom: +t45[0], bearing: i26, pitch: +(t45[4] || 0) }), true; } return false; } _updateHashUnthrottled() { history.replaceState(history.state, "", location.href.replace(/(#.+)?$/, this.getHashString())); } } function ma(e57, t45) { const i26 = e57.getCenter(), o88 = Math.round(100 * e57.getZoom()) / 100, s18 = Math.ceil((o88 * Math.LN2 + Math.log(512 / 360 / 0.5)) / Math.LN10), r86 = Math.pow(10, s18), n45 = Math.round(i26.lng * r86) / r86, a46 = Math.round(i26.lat * r86) / r86, l21 = e57.getBearing(), c28 = e57.getPitch(); let h8 = t45 ? `/${n45}/${a46}/${o88}` : `${o88}/${a46}/${n45}`; return (l21 || c28) && (h8 += "/" + Math.round(10 * l21) / 10), c28 && (h8 += `/${Math.round(c28)}`), h8; } const ga = { linearity: 0.3, easing: e56.eK(0, 0, 0.3, 1) }, va = Object.assign({ deceleration: 2500, maxSpeed: 1400 }, ga), ya = Object.assign({ deceleration: 20, maxSpeed: 1400 }, ga), xa = Object.assign({ deceleration: 1e3, maxSpeed: 360 }, ga), ba = Object.assign({ deceleration: 1e3, maxSpeed: 90 }, ga); class wa { constructor(e57) { this._map = e57, this.clear(); } clear() { this._inertiaBuffer = []; } record(t45) { this._drainInertiaBuffer(), this._inertiaBuffer.push({ time: e56.o.now(), settings: t45 }); } _drainInertiaBuffer() { const t45 = this._inertiaBuffer, i26 = e56.o.now(); for (; t45.length > 0 && i26 - t45[0].time > 160; ) t45.shift(); } _onMoveEnd(t45) { if (this._map._prefersReducedMotion()) return; if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return; const i26 = { zoom: 0, bearing: 0, pitch: 0, pan: new e56.P(0, 0), pinchAround: void 0, around: void 0 }; for (const { settings: e57 } of this._inertiaBuffer) i26.zoom += e57.zoomDelta || 0, i26.bearing += e57.bearingDelta || 0, i26.pitch += e57.pitchDelta || 0, e57.panDelta && i26.pan._add(e57.panDelta), e57.around && (i26.around = e57.around), e57.pinchAround && (i26.pinchAround = e57.pinchAround); const o88 = this._inertiaBuffer[this._inertiaBuffer.length - 1].time - this._inertiaBuffer[0].time, s18 = {}; if (i26.pan.mag()) { const e57 = Ea(i26.pan.mag(), o88, Object.assign({}, va, t45 || {})); s18.offset = i26.pan.mult(e57.amount / i26.pan.mag()), s18.center = this._map.transform.center, Ta(s18, e57); } if (i26.zoom) { const e57 = Ea(i26.zoom, o88, ya); s18.zoom = this._map.transform.zoom + e57.amount, Ta(s18, e57); } if (i26.bearing) { const t46 = Ea(i26.bearing, o88, xa); s18.bearing = this._map.transform.bearing + e56.aA(t46.amount, -179, 179), Ta(s18, t46); } if (i26.pitch) { const e57 = Ea(i26.pitch, o88, ba); s18.pitch = this._map.transform.pitch + e57.amount, Ta(s18, e57); } if (s18.zoom || s18.bearing) { const e57 = void 0 === i26.pinchAround ? i26.around : i26.pinchAround; s18.around = e57 ? this._map.unproject(e57) : this._map.getCenter(); } return this.clear(), s18.noMoveStart = true, s18; } } function Ta(e57, t45) { (!e57.duration || e57.duration < t45.duration) && (e57.duration = t45.duration, e57.easing = t45.easing); } function Ea(t45, i26, o88) { const { maxSpeed: s18, linearity: r86, deceleration: n45 } = o88, a46 = e56.aA(t45 * r86 / (i26 / 1e3), -s18, s18), l21 = Math.abs(a46) / (n45 * r86); return { easing: o88.easing, duration: 1e3 * l21, amount: a46 * (l21 / 2) }; } class Sa extends e56.z { preventDefault() { this._defaultPrevented = true; } get defaultPrevented() { return this._defaultPrevented; } constructor(e57, t45, i26, o88 = {}) { const s18 = g8(t45.getCanvasContainer(), i26), r86 = t45.unproject(s18); super(e57, Object.assign({ point: s18, lngLat: r86, originalEvent: i26 }, o88)), this._defaultPrevented = false, this.target = t45; } } class Ia extends e56.z { preventDefault() { this._defaultPrevented = true; } get defaultPrevented() { return this._defaultPrevented; } constructor(t45, i26, o88) { const s18 = "touchend" === t45 ? o88.changedTouches : o88.touches, r86 = v7(i26.getCanvasContainer(), s18), n45 = r86.map(((e57) => i26.unproject(e57))), a46 = r86.reduce(((e57, t46, i27, o89) => e57.add(t46.div(o89.length))), new e56.P(0, 0)); super(t45, { points: r86, point: a46, lngLats: n45, lngLat: i26.unproject(a46), originalEvent: o88 }), this._defaultPrevented = false; } } class Ca extends e56.z { preventDefault() { this._defaultPrevented = true; } get defaultPrevented() { return this._defaultPrevented; } constructor(e57, t45) { super("wheel", { originalEvent: t45 }), this._defaultPrevented = false; } } class Ra { constructor(e57, t45) { this._map = e57, this._clickTolerance = t45.clickTolerance; } reset() { this._mousedownPos = void 0; } wheel(e57) { return this._firePreventable(new Ca(this._map, e57)); } mousedown(e57, t45) { return this._mousedownPos = t45, this._firePreventable(new Sa(e57.type, this._map, e57)); } mouseup(e57) { this._map.fire(new Sa(e57.type, this._map, e57)); } preclick(e57) { const t45 = new MouseEvent("preclick", e57); this._map.fire(new Sa(t45.type, this._map, t45)); } click(e57, t45) { this._mousedownPos && this._mousedownPos.dist(t45) >= this._clickTolerance || (this.preclick(e57), this._map.fire(new Sa(e57.type, this._map, e57))); } dblclick(e57) { return this._firePreventable(new Sa(e57.type, this._map, e57)); } mouseover(e57) { this._map.fire(new Sa(e57.type, this._map, e57)); } mouseout(e57) { this._map.fire(new Sa(e57.type, this._map, e57)); } touchstart(e57) { return this._firePreventable(new Ia(e57.type, this._map, e57)); } touchmove(e57) { this._map.fire(new Ia(e57.type, this._map, e57)); } touchend(e57) { this._map.fire(new Ia(e57.type, this._map, e57)); } touchcancel(e57) { this._map.fire(new Ia(e57.type, this._map, e57)); } _firePreventable(e57) { if (this._map.fire(e57), e57.defaultPrevented) return {}; } isEnabled() { return true; } isActive() { return false; } enable() { } disable() { } } class Aa { constructor(e57) { this._map = e57; } reset() { this._delayContextMenu = false, this._contextMenuEvent = void 0; } mousemove(e57) { this._map.fire(new Sa(e57.type, this._map, e57)); } mousedown() { this._delayContextMenu = true; } mouseup() { this._delayContextMenu = false, this._contextMenuEvent && (this._map.fire(new Sa("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent); } contextmenu(e57) { this._delayContextMenu ? this._contextMenuEvent = e57 : this._map.fire(new Sa(e57.type, this._map, e57)), this._map.listens("contextmenu") && e57.preventDefault(); } isEnabled() { return true; } isActive() { return false; } enable() { } disable() { } } class Da { constructor(e57, t45) { this._map = e57, this._el = e57.getCanvasContainer(), this._container = e57.getContainer(), this._clickTolerance = t45.clickTolerance || 1; } isEnabled() { return !!this._enabled; } isActive() { return !!this._active; } enable() { this.isEnabled() || (this._enabled = true); } disable() { this.isEnabled() && (this._enabled = false); } mousedown(e57, t45) { this.isEnabled() && e57.shiftKey && 0 === e57.button && (_3(), this._startPos = this._lastPos = t45, this._active = true); } mousemoveWindow(e57, t45) { if (!this._active) return; const i26 = t45, o88 = this._startPos, s18 = this._lastPos; if (!o88 || !s18 || s18.equals(i26) || !this._box && i26.dist(o88) < this._clickTolerance) return; this._lastPos = i26, this._box || (this._box = l20("div", "mapboxgl-boxzoom", this._container), this._container.classList.add("mapboxgl-crosshair"), this._fireEvent("boxzoomstart", e57)); const r86 = Math.min(o88.x, i26.x), n45 = Math.max(o88.x, i26.x), a46 = Math.min(o88.y, i26.y), c28 = Math.max(o88.y, i26.y); this._map._requestDomTask((() => { this._box && (this._box.style.transform = `translate(${r86}px,${a46}px)`, this._box.style.width = n45 - r86 + "px", this._box.style.height = c28 - a46 + "px"); })); } mouseupWindow(t45, i26) { if (!this._active) return; const o88 = this._startPos, s18 = i26; if (o88 && 0 === t45.button) { if (this.reset(), m5(), o88.x !== s18.x || o88.y !== s18.y) return this._map.fire(new e56.z("boxzoomend", { originalEvent: t45 })), { cameraAnimation: (e57) => e57.fitScreenCoordinates(o88, s18, this._map.getBearing(), { linear: false }) }; this._fireEvent("boxzoomcancel", t45); } } keydown(e57) { this._active && 27 === e57.keyCode && (this.reset(), this._fireEvent("boxzoomcancel", e57)); } blur() { this.reset(); } reset() { this._active = false, this._container.classList.remove("mapboxgl-crosshair"), this._box && (this._box.remove(), this._box = null), p8(), delete this._startPos, delete this._lastPos; } _fireEvent(t45, i26) { return this._map.fire(new e56.z(t45, { originalEvent: i26 })); } } function La(e57, t45) { const i26 = {}; for (let o88 = 0; o88 < e57.length; o88++) i26[e57[o88].identifier] = t45[o88]; return i26; } class Pa { constructor(e57) { this.reset(), this.numTouches = e57.numTouches; } reset() { this.centroid = void 0, this.startTime = 0, this.touches = {}, this.aborted = false; } touchstart(t45, i26, o88) { (this.centroid || o88.length > this.numTouches) && (this.aborted = true), this.aborted || (0 === this.startTime && (this.startTime = t45.timeStamp), o88.length === this.numTouches && (this.centroid = (function(t46) { const i27 = new e56.P(0, 0); for (const e57 of t46) i27._add(e57); return i27.div(t46.length); })(i26), this.touches = La(o88, i26))); } touchmove(e57, t45, i26) { if (this.aborted || !this.centroid) return; const o88 = La(i26, t45); for (const e58 in this.touches) { const t46 = o88[e58]; (!t46 || t46.dist(this.touches[e58]) > 30) && (this.aborted = true); } } touchend(e57, t45, i26) { if ((!this.centroid || e57.timeStamp - this.startTime > 500) && (this.aborted = true), 0 === i26.length) { const e58 = !this.aborted && this.centroid; if (this.reset(), e58) return e58; } } } class za { constructor(e57) { this.singleTap = new Pa(e57), this.numTaps = e57.numTaps, this.reset(); } reset() { this.lastTime = 1 / 0, this.lastTap = void 0, this.count = 0, this.singleTap.reset(); } touchstart(e57, t45, i26) { this.singleTap.touchstart(e57, t45, i26); } touchmove(e57, t45, i26) { this.singleTap.touchmove(e57, t45, i26); } touchend(e57, t45, i26) { const o88 = this.singleTap.touchend(e57, t45, i26); if (o88) { const t46 = e57.timeStamp - this.lastTime < 500, i27 = !this.lastTap || this.lastTap.dist(o88) < 30; if (t46 && i27 || this.reset(), this.count++, this.lastTime = e57.timeStamp, this.lastTap = o88, this.count === this.numTaps) return this.reset(), o88; } } } class Oa { constructor() { this._zoomIn = new za({ numTouches: 1, numTaps: 2 }), this._zoomOut = new za({ numTouches: 2, numTaps: 1 }), this.reset(); } reset() { this._active = false, this._zoomIn.reset(), this._zoomOut.reset(); } touchstart(e57, t45, i26) { this._zoomIn.touchstart(e57, t45, i26), this._zoomOut.touchstart(e57, t45, i26); } touchmove(e57, t45, i26) { this._zoomIn.touchmove(e57, t45, i26), this._zoomOut.touchmove(e57, t45, i26); } touchend(e57, t45, i26) { const o88 = this._zoomIn.touchend(e57, t45, i26), s18 = this._zoomOut.touchend(e57, t45, i26); return o88 ? (this._active = true, e57.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (t46) => t46.easeTo({ duration: 300, zoom: t46.getZoom() + 1, around: t46.unproject(o88) }, { originalEvent: e57 }) }) : s18 ? (this._active = true, e57.preventDefault(), setTimeout((() => this.reset()), 0), { cameraAnimation: (t46) => t46.easeTo({ duration: 300, zoom: t46.getZoom() - 1, around: t46.unproject(s18) }, { originalEvent: e57 }) }) : void 0; } touchcancel() { this.reset(); } enable() { this._enabled = true; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } } const Ma = { 0: 1, 2: 2 }, Fa = { Control: "ctrlKey", Alt: "altKey", Shift: "shiftKey", Meta: "metaKey" }; class Ba { constructor(e57) { this.reset(), this._clickTolerance = e57.clickTolerance || 1; } blur() { this.reset(); } reset() { this._active = false, this._moved = false, this._lastPoint = void 0, this._eventButton = void 0; } _correctButton(e57, t45) { return false; } _move(e57, t45) { return {}; } mousedown(e57, t45) { if (this._lastPoint) return; const i26 = y3(e57); this._correctButton(e57, i26) && (this._lastPoint = t45, this._eventButton = i26); } mousemoveWindow(e57, t45) { const i26 = this._lastPoint; if (i26) { if (e57.preventDefault(), null != this._eventButton && (function(e58, t46) { const i27 = Ma[t46]; return void 0 === e58.buttons || (e58.buttons & i27) !== i27; })(e57, this._eventButton)) this.reset(); else if (this._moved || !(t45.dist(i26) < this._clickTolerance)) return this._moved = true, this._lastPoint = t45, this._move(i26, t45); } } mouseupWindow(e57) { this._lastPoint && y3(e57) === this._eventButton && (this._moved && m5(), this.reset()); } enable() { this._enabled = true; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } } class ka extends Ba { mousedown(e57, t45) { super.mousedown(e57, t45), this._lastPoint && (this._active = true); } _correctButton(e57, t45) { return 0 === t45 && !e57.ctrlKey; } _move(e57, t45) { return { around: t45, panDelta: t45.sub(e57) }; } } class Na extends Ba { constructor(e57) { super(e57), this._pitchRotateKey = e57.pitchRotateKey ? Fa[e57.pitchRotateKey] : void 0; } _correctButton(e57, t45) { return this._pitchRotateKey ? 0 === t45 && e57[this._pitchRotateKey] : 0 === t45 && e57.ctrlKey || 2 === t45; } _move(e57, t45) { const i26 = 0.8 * (t45.x - e57.x); if (i26) return this._active = true, { bearingDelta: i26 }; } contextmenu(e57) { this._pitchRotateKey || e57.preventDefault(); } } class Ua extends Ba { constructor(e57) { super(e57), this._pitchRotateKey = e57.pitchRotateKey ? Fa[e57.pitchRotateKey] : void 0; } _correctButton(e57, t45) { return this._pitchRotateKey ? 0 === t45 && e57[this._pitchRotateKey] : 0 === t45 && e57.ctrlKey || 2 === t45; } _move(e57, t45) { const i26 = -0.5 * (t45.y - e57.y); if (i26) return this._active = true, { pitchDelta: i26 }; } contextmenu(e57) { this._pitchRotateKey || e57.preventDefault(); } } class ja { constructor(t45, i26) { this._map = t45, this._el = t45.getCanvasContainer(), this._minTouches = 1, this._clickTolerance = i26.clickTolerance || 1, this.reset(), e56.aY(["_addTouchPanBlocker", "_showTouchPanBlockerAlert"], this); } reset() { this._active = false, this._touches = {}, this._sum = new e56.P(0, 0); } touchstart(e57, t45, i26) { return this._calculateTransform(e57, t45, i26); } touchmove(t45, i26, o88) { if (this._active && !(o88.length < this._minTouches)) { if (this._map._cooperativeGestures && !this._map.isMoving()) { if (1 === o88.length && !e56.eL()) return void this._showTouchPanBlockerAlert(); "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); } return t45.cancelable && t45.preventDefault(), this._calculateTransform(t45, i26, o88); } } touchend(e57, t45, i26) { this._calculateTransform(e57, t45, i26), this._active && i26.length < this._minTouches && this.reset(); } touchcancel() { this.reset(); } _calculateTransform(t45, i26, o88) { o88.length > 0 && (this._active = true); const s18 = La(o88, i26), r86 = new e56.P(0, 0), n45 = new e56.P(0, 0); let a46 = 0; for (const e57 in s18) { const t46 = s18[e57], i27 = this._touches[e57]; i27 && (r86._add(t46), n45._add(t46.sub(i27)), a46++, s18[e57] = t46); } if (this._touches = s18, a46 < this._minTouches || !n45.mag()) return; const l21 = n45.div(a46); return this._sum._add(l21), this._sum.mag() < this._clickTolerance ? void 0 : { around: r86.div(a46), panDelta: l21 }; } enable() { this._enabled = true, this._map._cooperativeGestures && (this._addTouchPanBlocker(), this._el.classList.add("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page")); } disable() { this._enabled = false, this._map._cooperativeGestures && (clearTimeout(this._alertTimer), this._alertContainer.remove(), this._el.classList.remove("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page")), this.reset(); } isEnabled() { return !!this._enabled; } isActive() { return !!this._active; } _addTouchPanBlocker() { this._map && !this._alertContainer && (this._alertContainer = l20("div", "mapboxgl-touch-pan-blocker", this._map._container), this._alertContainer.textContent = this._map._getUIString("TouchPanBlocker.Message"), this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(0.05 * this._el.clientWidth)))}px`); } _showTouchPanBlockerAlert() { this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = window.setTimeout((() => { this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"), this._alertContainer.removeAttribute("role"); }), 500); } } class Va { constructor() { this.reset(); } reset() { this._active = false, this._firstTwoTouches = void 0; } _start(e57) { } _move(e57, t45, i26) { return {}; } touchstart(e57, t45, i26) { this._firstTwoTouches || i26.length < 2 || (this._firstTwoTouches = [i26[0].identifier, i26[1].identifier], this._start([t45[0], t45[1]])); } touchmove(e57, t45, i26) { const o88 = this._firstTwoTouches; if (!o88) return; e57.preventDefault(); const [s18, r86] = o88, n45 = Ga(i26, t45, s18), a46 = Ga(i26, t45, r86); if (!n45 || !a46) return; const l21 = this._aroundCenter ? null : n45.add(a46).div(2); return this._move([n45, a46], l21, e57); } touchend(e57, t45, i26) { if (!this._firstTwoTouches) return; const [o88, s18] = this._firstTwoTouches, r86 = Ga(i26, t45, o88), n45 = Ga(i26, t45, s18); r86 && n45 || (this._active && m5(), this.reset()); } touchcancel() { this.reset(); } enable(e57) { this._enabled = true, this._aroundCenter = !!e57 && "center" === e57.around; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } } function Ga(e57, t45, i26) { for (let o88 = 0; o88 < e57.length; o88++) if (e57[o88].identifier === i26) return t45[o88]; } function Ha(e57, t45) { return Math.log2(e57 / t45); } class qa extends Va { reset() { super.reset(), this._distance = 0, this._startDistance = 0; } _start(e57) { this._startDistance = this._distance = e57[0].dist(e57[1]); } _move(e57, t45) { const i26 = this._distance; if (this._distance = e57[0].dist(e57[1]), this._active || !(Math.abs(Ha(this._distance, this._startDistance)) < 0.1)) return this._active = true, { zoomDelta: Ha(this._distance, i26), pinchAround: t45 }; } } function Za(e57, t45) { return 180 * e57.angleWith(t45) / Math.PI; } class Wa extends Va { reset() { super.reset(), this._minDiameter = 0, this._startVector = void 0, this._vector = void 0; } _start(e57) { this._startVector = this._vector = e57[0].sub(e57[1]), this._minDiameter = e57[0].dist(e57[1]); } _move(e57, t45) { const i26 = this._vector; if (this._vector = e57[0].sub(e57[1]), i26 && (this._active || !this._isBelowThreshold(this._vector))) return this._active = true, { bearingDelta: Za(this._vector, i26), pinchAround: t45 }; } _isBelowThreshold(e57) { this._minDiameter = Math.min(this._minDiameter, e57.mag()); const t45 = 25 / (Math.PI * this._minDiameter) * 360, i26 = this._startVector; if (!i26) return false; const o88 = Za(e57, i26); return Math.abs(o88) < t45; } } function $a(e57) { return Math.abs(e57.y) > Math.abs(e57.x); } class Xa extends Va { constructor(e57) { super(), this._map = e57; } reset() { super.reset(), this._valid = void 0, this._firstMove = void 0, this._lastPoints = void 0; } _start(e57) { this._lastPoints = e57, $a(e57[0].sub(e57[1])) && (this._valid = false); } _move(t45, i26, o88) { const s18 = this._lastPoints; if (!s18) return; const r86 = t45[0].sub(s18[0]), n45 = t45[1].sub(s18[1]); return this._map._cooperativeGestures && !e56.eL() && o88.touches.length < 3 || (this._valid = this.gestureBeginsVertically(r86, n45, o88.timeStamp), !this._valid) ? void 0 : (this._lastPoints = t45, this._active = true, { pitchDelta: (r86.y + n45.y) / 2 * -0.5 }); } gestureBeginsVertically(e57, t45, i26) { if (void 0 !== this._valid) return this._valid; const o88 = e57.mag() >= 2, s18 = t45.mag() >= 2; if (!o88 && !s18) return; if (!o88 || !s18) return null == this._firstMove && (this._firstMove = i26), i26 - this._firstMove < 100 && void 0; const r86 = e57.y > 0 == t45.y > 0; return $a(e57) && $a(t45) && r86; } } const Ya = { panStep: 100, bearingStep: 15, pitchStep: 10 }; class Ka { constructor() { const e57 = Ya; this._panStep = e57.panStep, this._bearingStep = e57.bearingStep, this._pitchStep = e57.pitchStep, this._rotationDisabled = false; } blur() { this.reset(); } reset() { this._active = false; } keydown(e57) { if (e57.altKey || e57.ctrlKey || e57.metaKey) return; let t45 = 0, i26 = 0, o88 = 0, s18 = 0, r86 = 0; switch (e57.keyCode) { case 61: case 107: case 171: case 187: t45 = 1; break; case 189: case 109: case 173: t45 = -1; break; case 37: e57.shiftKey ? i26 = -1 : (e57.preventDefault(), s18 = -1); break; case 39: e57.shiftKey ? i26 = 1 : (e57.preventDefault(), s18 = 1); break; case 38: e57.shiftKey ? o88 = 1 : (e57.preventDefault(), r86 = -1); break; case 40: e57.shiftKey ? o88 = -1 : (e57.preventDefault(), r86 = 1); break; default: return; } return this._rotationDisabled && (i26 = 0, o88 = 0), { cameraAnimation: (n45) => { const a46 = n45.getZoom(); n45.easeTo({ duration: 300, easeId: "keyboardHandler", easing: Ja, zoom: t45 ? Math.round(a46) + t45 * (e57.shiftKey ? 2 : 1) : a46, bearing: n45.getBearing() + i26 * this._bearingStep, pitch: n45.getPitch() + o88 * this._pitchStep, offset: [-s18 * this._panStep, -r86 * this._panStep], center: n45.getCenter() }, { originalEvent: e57 }); } }; } enable() { this._enabled = true; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } disableRotation() { this._rotationDisabled = true; } enableRotation() { this._rotationDisabled = false; } } function Ja(e57) { return e57 * (2 - e57); } const Qa = 4.000244140625, el = 1 / 450; class tl { constructor(t45, i26) { this._map = t45, this._el = t45.getCanvasContainer(), this._handler = i26, this._delta = 0, this._lastDelta = 0, this._defaultZoomRate = 0.01, this._wheelZoomRate = el, e56.aY(["_onTimeout", "_addScrollZoomBlocker", "_showBlockerAlert"], this); } setZoomRate(e57) { this._defaultZoomRate = e57; } setWheelZoomRate(e57) { this._wheelZoomRate = e57; } isEnabled() { return !!this._enabled; } isActive() { return this._active || void 0 !== this._finishTimeout; } isZooming() { return !!this._zooming; } enable(e57) { this.isEnabled() || (this._enabled = true, this._aroundCenter = !!e57 && "center" === e57.around, this._map._cooperativeGestures && this._addScrollZoomBlocker()); } disable() { this.isEnabled() && (this._enabled = false, this._map._cooperativeGestures && (clearTimeout(this._alertTimer), this._alertContainer.remove())); } wheel(t45) { if (!this.isEnabled()) return; if (this._map._cooperativeGestures) { if (!(t45.ctrlKey || t45.metaKey || this.isZooming() || e56.eL())) return void this._showBlockerAlert(); "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); } let i26 = t45.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * t45.deltaY : t45.deltaY; const o88 = e56.o.now(), s18 = o88 - (this._lastWheelEventTime || 0); this._lastWheelEventTime = o88, 0 !== i26 && i26 % Qa == 0 ? this._type = "wheel" : 0 !== i26 && Math.abs(i26) < 4 ? this._type = "trackpad" : s18 > 400 ? (this._type = null, this._lastValue = i26, this._timeout = window.setTimeout(this._onTimeout, 40, t45)) : this._type || (this._type = Math.abs(s18 * i26) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, i26 += this._lastValue)), t45.shiftKey && i26 && (i26 /= 4), this._type && (this._lastWheelEvent = t45, this._delta -= i26, this._active || this._start(t45)), t45.preventDefault(); } _onTimeout(e57) { this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(e57); } _start(e57) { if (!this._delta) return; this._frameId && (this._frameId = null), this._active = true, this.isZooming() || (this._zooming = true), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout); const t45 = g8(this._el, e57); this._aroundPoint = this._aroundCenter ? this._map.transform.centerPoint : t45, this._aroundCoord = this._map.transform.pointCoordinate3D(this._aroundPoint), this._targetZoom = void 0, this._frameId || (this._frameId = true, this._handler._triggerRenderFrame()); } renderFrame() { if (!this._frameId) return; if (this._frameId = null, !this.isActive()) return; const t45 = this._map.transform; "wheel" === this._type && t45.projection.wrap && (t45._center.lng >= 180 || t45._center.lng <= -180) && (this._prevEase = null, this._easing = null, this._lastWheelEvent = null, this._lastWheelEventTime = 0); const i26 = () => t45._terrainEnabled() && this._aroundCoord ? t45.computeZoomRelativeTo(this._aroundCoord) : t45.zoom; if (0 !== this._delta) { const e57 = "wheel" === this._type && Math.abs(this._delta) > Qa ? this._wheelZoomRate : this._defaultZoomRate; let o89 = 2 / (1 + Math.exp(-Math.abs(this._delta * e57))); this._delta < 0 && 0 !== o89 && (o89 = 1 / o89); const s19 = i26(), r87 = Math.pow(2, s19), n46 = "number" == typeof this._targetZoom ? t45.zoomScale(this._targetZoom) : r87; this._targetZoom = Math.min(t45.maxZoom, Math.max(t45.minZoom, t45.scaleZoom(n46 * o89))), "wheel" === this._type && (this._startZoom = s19, this._easing = this._smoothOutEasing(200)), this._lastDelta = this._delta, this._delta = 0; } const o88 = "number" == typeof this._targetZoom ? this._targetZoom : i26(), s18 = this._startZoom, r86 = this._easing; let n45, a46 = false; if ("wheel" === this._type && s18 && r86) { const t46 = Math.min((e56.o.now() - this._lastWheelEventTime) / 200, 1), i27 = r86(t46); n45 = e56.ak(s18, o88, i27), t46 < 1 ? this._frameId || (this._frameId = true) : a46 = true; } else n45 = o88, a46 = true; this._active = true, a46 && (this._active = false, this._finishTimeout = window.setTimeout((() => { this._zooming = false, this._handler._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout; }), 200)); let l21 = n45 - i26(); return l21 * this._lastDelta < 0 && (l21 = 0), { noInertia: true, needsRenderFrame: !a46, zoomDelta: l21, around: this._aroundPoint, aroundCoord: this._aroundCoord, originalEvent: this._lastWheelEvent }; } _smoothOutEasing(t45) { let i26 = e56.eM; if (this._prevEase) { const t46 = this._prevEase, o88 = (e56.o.now() - t46.start) / t46.duration, s18 = t46.easing(o88 + 0.01) - t46.easing(o88), r86 = 0.27 / Math.sqrt(s18 * s18 + 1e-4) * 0.01, n45 = Math.sqrt(0.0729 - r86 * r86); i26 = e56.eK(r86, n45, 0.25, 1); } return this._prevEase = { start: e56.o.now(), duration: t45, easing: i26 }, i26; } blur() { this.reset(); } reset() { this._active = false; } _addScrollZoomBlocker() { this._map && !this._alertContainer && (this._alertContainer = l20("div", "mapboxgl-scroll-zoom-blocker", this._map._container), this._alertContainer.textContent = /(Mac|iPad)/i.test(navigator.userAgent) ? this._map._getUIString("ScrollZoomBlocker.CmdMessage") : this._map._getUIString("ScrollZoomBlocker.CtrlMessage"), this._alertContainer.style.fontSize = `${Math.max(10, Math.min(24, Math.floor(0.05 * this._el.clientWidth)))}px`); } _showBlockerAlert() { this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = window.setTimeout((() => { this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.removeAttribute("role"); }), 200); } } class il { constructor(e57, t45) { this._clickZoom = e57, this._tapZoom = t45; } 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 ol { constructor() { this.reset(); } reset() { this._active = false; } blur() { this.reset(); } dblclick(e57, t45) { return e57.preventDefault(), { cameraAnimation: (i26) => { i26.easeTo({ duration: 300, zoom: i26.getZoom() + (e57.shiftKey ? -1 : 1), around: i26.unproject(t45) }, { originalEvent: e57 }); } }; } enable() { this._enabled = true; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } } class sl { constructor() { this._tap = new za({ numTouches: 1, numTaps: 1 }), this.reset(); } reset() { this._active = false, this._swipePoint = void 0, this._swipeTouch = 0, this._tapTime = 0, this._tap.reset(); } touchstart(e57, t45, i26) { this._swipePoint || (this._tapTime && e57.timeStamp - this._tapTime > 500 && this.reset(), this._tapTime ? i26.length > 0 && (this._swipePoint = t45[0], this._swipeTouch = i26[0].identifier) : this._tap.touchstart(e57, t45, i26)); } touchmove(e57, t45, i26) { if (this._tapTime) { if (this._swipePoint) { if (i26[0].identifier !== this._swipeTouch) return; const o88 = t45[0], s18 = o88.y - this._swipePoint.y; return this._swipePoint = o88, e57.preventDefault(), this._active = true, { zoomDelta: s18 / 128 }; } } else this._tap.touchmove(e57, t45, i26); } touchend(e57, t45, i26) { this._tapTime ? this._swipePoint && 0 === i26.length && this.reset() : this._tap.touchend(e57, t45, i26) && (this._tapTime = e57.timeStamp); } touchcancel() { this.reset(); } enable() { this._enabled = true; } disable() { this._enabled = false, this.reset(); } isEnabled() { return this._enabled; } isActive() { return this._active; } } class rl { constructor(e57, t45, i26) { this._el = e57, this._mousePan = t45, this._touchPan = i26; } enable(e57) { this._inertiaOptions = e57 || {}, 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 nl { constructor(e57, t45, i26) { this._pitchWithRotate = e57.pitchWithRotate, this._mouseRotate = t45, this._mousePitch = i26; } 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 al { constructor(e57, t45, i26, o88) { this._el = e57, this._touchZoom = t45, this._touchRotate = i26, this._tapDragZoom = o88, this._rotationDisabled = false, this._enabled = true; } enable(e57) { this._touchZoom.enable(e57), this._rotationDisabled || this._touchRotate.enable(e57), 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 = true, this._touchRotate.disable(); } enableRotation() { this._rotationDisabled = false, this._touchZoom.isEnabled() && this._touchRotate.enable(); } } const ll = (e57) => e57.zoom || e57.drag || e57.pitch || e57.rotate; class cl extends e56.z { } class hl { constructor() { this.constants = [1, 1, 0.01], this.radius = 0; } setup(t45, i26) { const o88 = e56.av([], i26, t45); this.radius = e56.ag(o88[2] < 0 ? e56.eO([], o88, this.constants) : [o88[0], o88[1], 0]); } projectRay(t45) { e56.eO(t45, t45, this.constants), e56.aw(t45, t45), e56.eP(t45, t45, this.constants); const i26 = e56.c4([], t45, this.radius); if (i26[2] > 0) { const t46 = e56.c4([], [0, 0, 1], e56.bJ(i26, [0, 0, 1])), o88 = e56.c4([], e56.aw([], [i26[0], i26[1], 0]), this.radius), s18 = e56.d7([], i26, e56.c4([], e56.av([], e56.d7([], o88, t46), i26), 2)); i26[0] = s18[0], i26[1] = s18[1]; } return i26; } } function dl(e57) { return e57.panDelta && e57.panDelta.mag() || e57.zoomDelta || e57.bearingDelta || e57.pitchDelta; } class ul { constructor(t45, i26) { this._map = t45, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new wa(t45), this._bearingSnap = i26.bearingSnap, this._previousActiveHandlers = {}, this._trackingEllipsoid = new hl(), this._dragOrigin = null, this._eventsInProgress = {}, this._addDefaultHandlers(i26), e56.aY(["handleEvent", "handleWindowEvent"], this); const o88 = this._el; this._listeners = [[o88, "touchstart", { passive: true }], [o88, "touchmove", { passive: false }], [o88, "touchend", void 0], [o88, "touchcancel", void 0], [o88, "mousedown", void 0], [o88, "mousemove", void 0], [o88, "mouseup", void 0], [document, "mousemove", { capture: true }], [document, "mouseup", void 0], [o88, "mouseover", void 0], [o88, "mouseout", void 0], [o88, "dblclick", void 0], [o88, "click", void 0], [o88, "keydown", { capture: false }], [o88, "keyup", void 0], [o88, "wheel", { passive: false }], [o88, "contextmenu", void 0], [window, "blur", void 0]]; for (const [e57, t46, i27] of this._listeners) { const o89 = e57 === document ? this.handleWindowEvent : this.handleEvent; e57.addEventListener(t46, o89, i27); } } destroy() { for (const [e57, t45, i26] of this._listeners) { const o88 = e57 === document ? this.handleWindowEvent : this.handleEvent; e57.removeEventListener(t45, o88, i26); } } _addDefaultHandlers(e57) { const t45 = this._map, i26 = t45.getCanvasContainer(); this._add("mapEvent", new Ra(t45, e57)); const o88 = t45.boxZoom = new Da(t45, e57); this._add("boxZoom", o88); const s18 = new Oa(), r86 = new ol(); t45.doubleClickZoom = new il(r86, s18), this._add("tapZoom", s18), this._add("clickZoom", r86); const n45 = new sl(); this._add("tapDragZoom", n45); const a46 = t45.touchPitch = new Xa(t45); this._add("touchPitch", a46); const l21 = new Na(e57), c28 = new Ua(e57); t45.dragRotate = new nl(e57, l21, c28), this._add("mouseRotate", l21, ["mousePitch"]), this._add("mousePitch", c28, ["mouseRotate"]); const h8 = new ka(e57), d34 = new ja(t45, e57); t45.dragPan = new rl(i26, h8, d34), this._add("mousePan", h8), this._add("touchPan", d34, ["touchZoom", "touchRotate"]); const u12 = new Wa(), _4 = new qa(); t45.touchZoomRotate = new al(i26, _4, u12, n45), this._add("touchRotate", u12, ["touchPan", "touchZoom"]), this._add("touchZoom", _4, ["touchPan", "touchRotate"]), this._add("blockableMapEvent", new Aa(t45)); const p9 = t45.scrollZoom = new tl(t45, this); this._add("scrollZoom", p9, ["mousePan"]); const f8 = t45.keyboard = new Ka(); this._add("keyboard", f8); for (const i27 of ["boxZoom", "doubleClickZoom", "tapDragZoom", "touchPitch", "dragRotate", "dragPan", "touchZoomRotate", "scrollZoom", "keyboard"]) e57.interactive && e57[i27] && t45[i27].enable(e57[i27]); } _add(e57, t45, i26) { this._handlers.push({ handlerName: e57, handler: t45, allowed: i26 }), this._handlersById[e57] = t45; } stop(e57) { if (!this._updatingCamera) { for (const { handler: e58 } of this._handlers) e58.reset(); this._inertia.clear(), this._fireEvents({}, {}, e57), this._changes = [], this._originalZoom = void 0; } } isActive() { for (const { handler: e57 } of this._handlers) if (e57.isActive()) return true; return false; } isZooming() { return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming(); } isRotating() { return !!this._eventsInProgress.rotate; } isMoving() { return !!ll(this._eventsInProgress) || this.isZooming(); } _isDragging() { return !!this._eventsInProgress.drag; } _blockedByActive(e57, t45, i26) { for (const o88 in e57) if (o88 !== i26 && (!t45 || t45.indexOf(o88) < 0)) return true; return false; } handleWindowEvent(e57) { this.handleEvent(e57, `${e57.type}Window`); } _getMapTouches(e57) { const t45 = []; for (const i26 of e57) this._el.contains(i26.target) && t45.push(i26); return t45; } handleEvent(e57, t45) { this._updatingCamera = true; const i26 = "renderFrame" === e57.type, o88 = i26 ? void 0 : e57, s18 = { needsRenderFrame: false }, r86 = {}, n45 = {}, a46 = e57.touches ? this._getMapTouches(e57.touches) : void 0, l21 = a46 ? v7(this._el, a46) : i26 ? void 0 : g8(this._el, e57); for (const { handlerName: i27, handler: c29, allowed: h9 } of this._handlers) { if (!c29.isEnabled()) continue; let d34; this._blockedByActive(n45, h9, i27) ? c29.reset() : c29[t45 || e57.type] && (d34 = c29[t45 || e57.type](e57, l21, a46), this.mergeHandlerResult(s18, r86, d34, i27, o88), d34 && d34.needsRenderFrame && this._triggerRenderFrame()), (d34 || c29.isActive()) && (n45[i27] = c29); } const c28 = {}; for (const e58 in this._previousActiveHandlers) n45[e58] || (c28[e58] = o88); this._previousActiveHandlers = n45, (Object.keys(c28).length || dl(s18)) && (this._changes.push([s18, r86, c28]), this._triggerRenderFrame()), (Object.keys(n45).length || dl(s18)) && this._map._stop(true), this._updatingCamera = false; const { cameraAnimation: h8 } = s18; h8 && (this._inertia.clear(), this._fireEvents({}, {}, true), this._changes = [], h8(this._map)); } mergeHandlerResult(e57, t45, i26, o88, s18) { if (!i26) return; Object.assign(e57, i26); const r86 = { handlerName: o88, originalEvent: i26.originalEvent || s18 }; void 0 !== i26.zoomDelta && (t45.zoom = r86), void 0 !== i26.panDelta && (t45.drag = r86), void 0 !== i26.pitchDelta && (t45.pitch = r86), void 0 !== i26.bearingDelta && (t45.rotate = r86); } _applyChanges() { const t45 = {}, i26 = {}, o88 = {}; for (const [s18, r86, n45] of this._changes) s18.panDelta && (t45.panDelta = (t45.panDelta || new e56.P(0, 0))._add(s18.panDelta)), s18.zoomDelta && (t45.zoomDelta = (t45.zoomDelta || 0) + s18.zoomDelta), s18.bearingDelta && (t45.bearingDelta = (t45.bearingDelta || 0) + s18.bearingDelta), s18.pitchDelta && (t45.pitchDelta = (t45.pitchDelta || 0) + s18.pitchDelta), void 0 !== s18.around && (t45.around = s18.around), void 0 !== s18.aroundCoord && (t45.aroundCoord = s18.aroundCoord), void 0 !== s18.pinchAround && (t45.pinchAround = s18.pinchAround), s18.noInertia && (t45.noInertia = s18.noInertia), Object.assign(i26, r86), Object.assign(o88, n45); this._updateMapTransform(t45, i26, o88), this._changes = []; } _updateMapTransform(t45, i26, o88) { const s18 = this._map, r86 = s18.transform, n45 = (e57) => [e57.x, e57.y, e57.z]; if (((e57) => { const t46 = this._eventsInProgress.drag; return t46 && !this._handlersById[t46.handlerName].isActive(); })() && !dl(t45)) { const e57 = r86.zoom; r86.cameraElevationReference = "sea", null != this._originalZoom && r86._orthographicProjectionAtLowPitch && "globe" !== r86.projection.name && 0 === r86.pitch ? (r86.cameraElevationReference = "ground", r86.zoom = this._originalZoom) : (r86.recenterOnTerrain(), r86.cameraElevationReference = "ground"), e57 !== r86.zoom && this._map._update(true); } if (r86._isCameraConstrained && s18._stop(true), !dl(t45)) return void this._fireEvents(i26, o88, true); let { panDelta: a46, zoomDelta: l21, bearingDelta: c28, pitchDelta: h8, around: d34, aroundCoord: u12, pinchAround: _4 } = t45; r86._isCameraConstrained && (l21 > 0 && (l21 = 0), r86._isCameraConstrained = false), void 0 !== _4 && (d34 = _4), (l21 || ((e57) => i26[e57] && !this._eventsInProgress[e57])("drag")) && d34 && (this._dragOrigin = n45(r86.pointCoordinate3D(d34)), this._originalZoom = r86.zoom, this._trackingEllipsoid.setup(r86._camera.position, this._dragOrigin)), r86.cameraElevationReference = "sea", s18._stop(true), d34 = d34 || s18.transform.centerPoint, c28 && (r86.bearing += c28), h8 && (r86.pitch += h8), r86._updateCameraState(); const p9 = [0, 0, 0]; if (a46) if ("mercator" === r86.projection.name) { const e57 = this._trackingEllipsoid.projectRay(r86.screenPointToMercatorRay(d34).dir), t46 = this._trackingEllipsoid.projectRay(r86.screenPointToMercatorRay(d34.sub(a46)).dir); p9[0] = t46[0] - e57[0], p9[1] = t46[1] - e57[1]; } else { const t46 = r86.pointCoordinate(d34); if ("globe" === r86.projection.name) { a46 = a46.rotate(-r86.angle); const i27 = r86._pixelsPerMercatorPixel / r86.worldSize; p9[0] = -a46.x * e56.eN(e56.a$(t46.y)) * i27, p9[1] = -a46.y * e56.eN(r86.center.lat) * i27; } else { const e57 = r86.pointCoordinate(d34.sub(a46)); t46 && e57 && (p9[0] = e57.x - t46.x, p9[1] = e57.y - t46.y); } } const f8 = r86.zoom, m6 = [0, 0, 0]; if (l21) { const t46 = n45(u12 || r86.pointCoordinate3D(d34)), i27 = { dir: e56.aw([], e56.av([], t46, r86._camera.position)) }; if (i27.dir[2] < 0) { const o89 = r86.zoomDeltaToMovement(t46, l21); e56.c4(m6, i27.dir, o89); } } const g9 = e56.d7(p9, p9, m6); r86._translateCameraConstrained(g9), l21 && Math.abs(r86.zoom - f8) > 1e-4 && r86.recenterOnTerrain(), r86.cameraElevationReference = "ground", this._map._update(), t45.noInertia || this._inertia.record(t45), this._fireEvents(i26, o88, true); } _fireEvents(t45, i26, o88) { const s18 = ll(this._eventsInProgress), r86 = ll(t45), n45 = {}; for (const e57 in t45) { const { originalEvent: i27 } = t45[e57]; this._eventsInProgress[e57] || (n45[`${e57}start`] = i27), this._eventsInProgress[e57] = t45[e57]; } !s18 && r86 && this._fireEvent("movestart", r86.originalEvent); for (const e57 in n45) this._fireEvent(e57, n45[e57]); r86 && this._fireEvent("move", r86.originalEvent); for (const e57 in t45) { const { originalEvent: i27 } = t45[e57]; this._fireEvent(e57, i27); } const a46 = {}; let l21; for (const e57 in this._eventsInProgress) { const { handlerName: t46, originalEvent: o89 } = this._eventsInProgress[e57]; this._handlersById[t46].isActive() || (delete this._eventsInProgress[e57], l21 = i26[t46] || o89, a46[`${e57}end`] = l21); } for (const e57 in a46) this._fireEvent(e57, a46[e57]); const c28 = ll(this._eventsInProgress); if (o88 && (s18 || r86) && !c28) { this._updatingCamera = true; const t46 = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i27 = (e57) => 0 !== e57 && -this._bearingSnap < e57 && e57 < this._bearingSnap; t46 ? (i27(t46.bearing || this._map.getBearing()) && (t46.bearing = 0), this._map.easeTo(t46, { originalEvent: l21 })) : (this._map.fire(new e56.z("moveend", { originalEvent: l21 })), i27(this._map.getBearing()) && this._map.resetNorth()), this._updatingCamera = false; } } _fireEvent(t45, i26) { this._map.fire(new e56.z(t45, i26 ? { originalEvent: i26 } : {})); } _requestFrame() { return this._map.triggerRepaint(), this._map._renderTaskQueue.add(((e57) => { this._frameId = void 0, this.handleEvent(new cl("renderFrame", { timeStamp: e57 })), this._applyChanges(); })); } _triggerRenderFrame() { void 0 === this._frameId && (this._frameId = this._requestFrame()); } } const _l = "map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections."; class pl extends e56.E { constructor(t45, i26) { super(), this._moving = false, this._zooming = false, this.transform = t45, this._bearingSnap = i26.bearingSnap, this._respectPrefersReducedMotion = false !== i26.respectPrefersReducedMotion, e56.aY(["_renderFrameCallback"], this); } getCenter() { return new e56.aR(this.transform.center.lng, this.transform.center.lat); } setCenter(e57, t45) { return this.jumpTo({ center: e57 }, t45); } panBy(t45, i26, o88) { return t45 = e56.P.convert(t45).mult(-1), this.panTo(this.transform.center, Object.assign({ offset: t45 }, i26), o88); } panTo(e57, t45, i26) { return this.easeTo(Object.assign({ center: e57 }, t45), i26); } getZoom() { return this.transform.zoom; } setZoom(e57, t45) { return this.jumpTo({ zoom: e57 }, t45), this; } zoomTo(e57, t45, i26) { return this.easeTo(Object.assign({ zoom: e57 }, t45), i26); } zoomIn(e57, t45) { return this.zoomTo(this.getZoom() + 1, e57, t45), this; } zoomOut(e57, t45) { return this.zoomTo(this.getZoom() - 1, e57, t45), this; } getBearing() { return this.transform.bearing; } setBearing(e57, t45) { return this.jumpTo({ bearing: e57 }, t45), this; } getPadding() { return this.transform.padding; } setPadding(e57, t45) { return this.jumpTo({ padding: e57 }, t45), this; } rotateTo(e57, t45, i26) { return this.easeTo(Object.assign({ bearing: e57 }, t45), i26); } resetNorth(e57, t45) { return this.rotateTo(0, Object.assign({ duration: 1e3 }, e57), t45), this; } resetNorthPitch(e57, t45) { return this.easeTo(Object.assign({ bearing: 0, pitch: 0, duration: 1e3 }, e57), t45), this; } snapToNorth(e57, t45) { return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(e57, t45) : this; } getPitch() { return this.transform.pitch; } setPitch(e57, t45) { return this.jumpTo({ pitch: e57 }, t45), this; } cameraForBounds(t45, i26) { t45 = e56.aI.convert(t45); const o88 = i26 && i26.bearing || 0, s18 = i26 && i26.pitch || 0, r86 = t45.getNorthWest(), n45 = t45.getSouthEast(); return this._cameraForBounds(this.transform, r86, n45, o88, s18, i26); } _extendPadding(e57) { const t45 = { top: 0, right: 0, bottom: 0, left: 0 }; return null == e57 ? Object.assign({}, t45, this.transform.padding) : "number" == typeof e57 ? { top: e57, bottom: e57, right: e57, left: e57 } : Object.assign({}, t45, e57); } _extendCameraOptions(e57) { return (e57 = Object.assign({ offset: [0, 0], maxZoom: this.transform.maxZoom }, e57)).padding = this._extendPadding(e57.padding), e57; } _minimumAABBFrustumDistance(e57, t45) { const i26 = t45.max[0] - t45.min[0], o88 = t45.max[1] - t45.min[1]; return i26 / o88 > e57.aspect ? i26 / (2 * Math.tan(0.5 * e57.fovX) * e57.aspect) : o88 / (2 * Math.tan(0.5 * e57.fovY) * e57.aspect); } _cameraForBoundsOnGlobe(t45, i26, o88, s18, r86, n45) { const a46 = t45.clone(), l21 = this._extendCameraOptions(n45); a46.bearing = s18, a46.pitch = r86; const c28 = e56.aR.convert(i26), h8 = e56.aR.convert(o88), d34 = 0.5 * (c28.lat + h8.lat), u12 = 0.5 * (c28.lng + h8.lng), _4 = e56.eQ(d34, u12), p9 = e56.aw([], _4), f8 = e56.aw([], e56.bI([], p9, [0, 1, 0])), m6 = e56.bI([], f8, p9), g9 = [f8[0], f8[1], f8[2], 0, m6[0], m6[1], m6[2], 0, p9[0], p9[1], p9[2], 0, 0, 0, 0, 1], v8 = [_4, e56.eQ(c28.lat, c28.lng), e56.eQ(h8.lat, c28.lng), e56.eQ(h8.lat, h8.lng), e56.eQ(c28.lat, h8.lng), e56.eQ(d34, c28.lng), e56.eQ(d34, h8.lng), e56.eQ(c28.lat, u12), e56.eQ(h8.lat, u12)]; let y4 = e56.d8.fromPoints(v8.map(((t46) => [e56.bJ(f8, t46), e56.bJ(m6, t46), e56.bJ(p9, t46)]))); const x4 = e56.af([], y4.center, g9); 0 === e56.eR(x4) && e56.eS(x4, 0, 0, 1), e56.aw(x4, x4), e56.c4(x4, x4, e56.aD), a46.center = e56.eT(x4); const b8 = a46.getWorldToCameraMatrix(), w4 = e56.bl(new Float64Array(16), b8); y4 = e56.d8.applyTransform(y4, e56.aB([], b8, g9)); const T5 = this._extendAABB(y4, a46, l21, s18); if (!T5) return void e56.w("Map cannot fit within canvas with the given bounds, padding, and/or offset."); y4 = T5, e56.af(x4, x4, b8); const E5 = 0.5 * (y4.max[2] - y4.min[2]), S5 = this._minimumAABBFrustumDistance(a46, y4), I4 = e56.c4([], [0, 0, 1], E5), C6 = e56.d7(I4, x4, I4), R5 = S5 + (0 === a46.pitch ? 0 : e56.bG(x4, C6)), A4 = a46.globeCenterInViewSpace, D5 = e56.av([], x4, [A4[0], A4[1], A4[2]]); e56.aw(D5, D5), e56.c4(D5, D5, R5); const L3 = e56.d7([], x4, D5); e56.af(L3, L3, w4); const P4 = e56.eD / e56.aD, z4 = e56.ag(L3), O4 = e56.ce(Math.max(z4 * P4 - e56.eD, Number.EPSILON), 0), M5 = Math.min(a46.zoomFromMercatorZAdjusted(O4), l21.maxZoom); return M5 > 0.5 * (e56.cZ + e56.cK) ? (a46.setProjection({ name: "mercator" }), a46.zoom = M5, this._cameraForBounds(a46, i26, o88, s18, r86, n45)) : { center: a46.center, zoom: M5, bearing: s18, pitch: r86 }; } _extendAABB(t45, i26, o88, s18) { const r86 = 0.5 * ((o88.padding.left || 0) + (o88.padding.right || 0)), n45 = 0.5 * ((o88.padding.top || 0) + (o88.padding.bottom || 0)), a46 = n45, l21 = r86, c28 = r86, h8 = n45, d34 = i26.width - (l21 + c28), u12 = i26.height - (a46 + h8), _4 = e56.av([], t45.max, t45.min), p9 = Math.min(d34 / _4[0], u12 / _4[1]), f8 = Math.min(i26.scaleZoom(i26.scale * p9), o88.maxZoom); if (isNaN(f8)) return null; const m6 = i26.scale / i26.zoomScale(f8), g9 = new e56.d8([t45.min[0] - l21 * m6, t45.min[1] - h8 * m6, t45.min[2]], [t45.max[0] + c28 * m6, t45.max[1] + a46 * m6, t45.max[2]]), v8 = ("number" == typeof o88.offset.x && "number" == typeof o88.offset.y ? new e56.P(o88.offset.x, o88.offset.y) : e56.P.convert(o88.offset)).rotate(-e56.an(s18)); return g9.center[0] -= v8.x * m6, g9.center[1] += v8.y * m6, g9; } queryTerrainElevation(t45, i26) { const o88 = this.transform.elevation; return o88 ? (i26 = Object.assign({}, { exaggerated: true }, i26), o88.getAtPoint(e56.ae.fromLngLat(t45), null, i26.exaggerated)) : null; } _cameraForBounds(t45, i26, o88, s18, r86, n45) { if ("globe" === t45.projection.name) return this._cameraForBoundsOnGlobe(t45, i26, o88, s18, r86, n45); const a46 = t45.clone(), l21 = this._extendCameraOptions(n45); a46.bearing = s18, a46.pitch = r86; const c28 = e56.aR.convert(i26), h8 = e56.aR.convert(o88), d34 = new e56.aR(c28.lng, h8.lat), u12 = new e56.aR(h8.lng, c28.lat), _4 = a46.project(c28), p9 = a46.project(h8), f8 = this.queryTerrainElevation(c28), m6 = this.queryTerrainElevation(h8), g9 = this.queryTerrainElevation(d34), v8 = this.queryTerrainElevation(u12), y4 = [[_4.x, _4.y, Math.min(f8 || 0, m6 || 0, g9 || 0, v8 || 0)], [p9.x, p9.y, Math.max(f8 || 0, m6 || 0, g9 || 0, v8 || 0)]]; let x4 = e56.d8.fromPoints(y4); const b8 = a46.getWorldToCameraMatrix(), w4 = e56.bl(new Float64Array(16), b8); x4 = e56.d8.applyTransform(x4, b8); const T5 = this._extendAABB(x4, a46, l21, s18); if (!T5) return void e56.w("Map cannot fit within canvas with the given bounds, padding, and/or offset."); x4 = T5; const E5 = 0.5 * e56.av([], x4.max, x4.min)[2], S5 = this._minimumAABBFrustumDistance(a46, x4), I4 = [0, 0, 1, 0]; e56.aC(I4, I4, b8), e56.eU(I4, I4); const C6 = e56.c4([], I4, S5 + E5), R5 = e56.d7([], x4.center, C6); e56.af(x4.center, x4.center, w4), e56.af(R5, R5, w4); const A4 = a46.unproject(new e56.P(x4.center[0], x4.center[1])), D5 = e56.eV(a46.projection, A4), L3 = Math.pow(2, D5), P4 = Math.min(a46._zoomFromMercatorZ(R5[2] * a46.pixelsPerMeter * L3 / a46.worldSize), l21.maxZoom); return a46.mercatorFromTransition && P4 < 0.5 * (e56.cZ + e56.cK) ? (a46.setProjection({ name: "globe" }), a46.zoom = P4, this._cameraForBounds(a46, i26, o88, s18, r86, n45)) : { center: A4, zoom: P4, bearing: s18, pitch: r86 }; } fitBounds(e57, t45, i26) { const o88 = this.cameraForBounds(e57, t45); return this._fitInternal(o88, t45, i26); } fitScreenCoordinates(t45, i26, o88, s18, r86) { const n45 = e56.P.convert(t45), a46 = e56.P.convert(i26), l21 = new e56.P(Math.min(n45.x, a46.x), Math.min(n45.y, a46.y)), c28 = new e56.P(Math.max(n45.x, a46.x), Math.max(n45.y, a46.y)); if ("mercator" === this.transform.projection.name && this.transform.anyCornerOffEdge(n45, a46)) return this; const h8 = this.transform.pointLocation3D(l21), d34 = this.transform.pointLocation3D(c28), u12 = this.transform.pointLocation3D(new e56.P(l21.x, c28.y)), _4 = this.transform.pointLocation3D(new e56.P(c28.x, l21.y)), p9 = [Math.min(h8.lng, d34.lng, u12.lng, _4.lng), Math.min(h8.lat, d34.lat, u12.lat, _4.lat)], f8 = [Math.max(h8.lng, d34.lng, u12.lng, _4.lng), Math.max(h8.lat, d34.lat, u12.lat, _4.lat)], m6 = s18 && s18.pitch ? s18.pitch : this.getPitch(), g9 = this._cameraForBounds(this.transform, p9, f8, o88, m6, s18); return this._fitInternal(g9, s18, r86); } _fitInternal(e57, t45, i26) { return e57 ? (t45 = Object.assign(e57, t45)).linear ? this.easeTo(t45, i26) : this.flyTo(t45, i26) : this; } jumpTo(t45, i26) { this.stop(); const o88 = t45.preloadOnly ? this.transform.clone() : this.transform; let s18 = false, r86 = false, n45 = false; "zoom" in t45 && o88.zoom !== +t45.zoom && (s18 = true, o88.zoom = +t45.zoom), void 0 !== t45.center && (o88.center = e56.aR.convert(t45.center)), "bearing" in t45 && o88.bearing !== +t45.bearing && (r86 = true, o88.bearing = +t45.bearing), "pitch" in t45 && o88.pitch !== +t45.pitch && (n45 = true, o88.pitch = +t45.pitch); const a46 = "number" == typeof t45.padding ? this._extendPadding(t45.padding) : t45.padding; if (null != t45.padding && !o88.isPaddingEqual(a46)) if (false === t45.retainPadding) { const e57 = o88.clone(); e57.padding = a46, o88.setLocationAtPoint(o88.center, e57.centerPoint); } else o88.padding = a46; return t45.preloadOnly ? (this._preloadTiles(o88), this) : (this.fire(new e56.z("movestart", i26)).fire(new e56.z("move", i26)), s18 && this.fire(new e56.z("zoomstart", i26)).fire(new e56.z("zoom", i26)).fire(new e56.z("zoomend", i26)), r86 && this.fire(new e56.z("rotatestart", i26)).fire(new e56.z("rotate", i26)).fire(new e56.z("rotateend", i26)), n45 && this.fire(new e56.z("pitchstart", i26)).fire(new e56.z("pitch", i26)).fire(new e56.z("pitchend", i26)), this.fire(new e56.z("moveend", i26))); } getFreeCameraOptions() { return this.transform.projection.supportsFreeCamera || e56.w(_l), this.transform.getFreeCameraOptions(); } setFreeCameraOptions(t45, i26) { const o88 = this.transform; if (!o88.projection.supportsFreeCamera) return e56.w(_l), this; this.stop(); const s18 = o88.zoom, r86 = o88.pitch, n45 = o88.bearing; o88.setFreeCameraOptions(t45); const a46 = s18 !== o88.zoom, l21 = r86 !== o88.pitch, c28 = n45 !== o88.bearing; return this.fire(new e56.z("movestart", i26)).fire(new e56.z("move", i26)), a46 && this.fire(new e56.z("zoomstart", i26)).fire(new e56.z("zoom", i26)).fire(new e56.z("zoomend", i26)), c28 && this.fire(new e56.z("rotatestart", i26)).fire(new e56.z("rotate", i26)).fire(new e56.z("rotateend", i26)), l21 && this.fire(new e56.z("pitchstart", i26)).fire(new e56.z("pitch", i26)).fire(new e56.z("pitchend", i26)), this.fire(new e56.z("moveend", i26)), this; } easeTo(t45, i26) { this._stop(false, t45.easeId), (false === (t45 = Object.assign({ offset: [0, 0], duration: 500, easing: e56.eM }, t45)).animate || this._prefersReducedMotion(t45)) && (t45.duration = 0); const o88 = this.transform, s18 = this.getZoom(), r86 = this.getBearing(), n45 = this.getPitch(), a46 = this.getPadding(), l21 = "zoom" in t45 ? +t45.zoom : s18, c28 = "bearing" in t45 ? this._normalizeBearing(t45.bearing, r86) : r86, h8 = "pitch" in t45 ? +t45.pitch : n45, d34 = this._extendPadding(t45.padding), u12 = e56.P.convert(t45.offset); let _4, p9, f8; if ("globe" === o88.projection.name) { const i27 = e56.ae.fromLngLat(o88.center), s19 = u12.rotate(-o88.angle); i27.x += s19.x / o88.worldSize, i27.y += s19.y / o88.worldSize; const r87 = i27.toLngLat(), n46 = e56.aR.convert(t45.center || r87); this._normalizeCenter(n46), _4 = o88.centerPoint.add(s19), p9 = new e56.P(i27.x, i27.y).mult(o88.worldSize), f8 = new e56.P(e56.aF(n46.lng), e56.aJ(n46.lat)).mult(o88.worldSize).sub(p9); } else { _4 = o88.centerPoint.add(u12); const i27 = o88.pointLocation(_4), s19 = e56.aR.convert(t45.center || i27); this._normalizeCenter(s19), p9 = o88.project(i27), f8 = o88.project(s19).sub(p9); } const m6 = o88.zoomScale(l21 - s18); let g9, v8; t45.around && (g9 = e56.aR.convert(t45.around), v8 = o88.locationPoint(g9)); const y4 = this._zooming || l21 !== s18, x4 = this._rotating || r86 !== c28, b8 = this._pitching || h8 !== n45, w4 = !o88.isPaddingEqual(d34), T5 = false === t45.retainPadding ? o88.clone() : o88, E5 = (o89) => (E6) => { if (y4 && (o89.zoom = e56.ak(s18, l21, E6)), x4 && (o89.bearing = e56.ak(r86, c28, E6)), b8 && (o89.pitch = e56.ak(n45, h8, E6)), w4 && (T5.interpolatePadding(a46, d34, E6), _4 = T5.centerPoint.add(u12)), g9) o89.setLocationAtPoint(g9, v8); else { const e57 = o89.zoomScale(o89.zoom - s18), t46 = l21 > s18 ? Math.min(2, m6) : Math.max(0.5, m6), i27 = Math.pow(t46, 1 - E6), r87 = o89.unproject(p9.add(f8.mult(E6 * i27)).mult(e57)); o89.setLocationAtPoint(o89.renderWorldCopies ? r87.wrap() : r87, _4); } return t45.preloadOnly || this._fireMoveEvents(i26), o89; }; if (t45.preloadOnly) { const e57 = this._emulate(E5, t45.duration, o88); return this._preloadTiles(e57), this; } const S5 = { moving: this._moving, zooming: this._zooming, rotating: this._rotating, pitching: this._pitching }; return this._zooming = y4, this._rotating = x4, this._pitching = b8, this._padding = w4, this._easeId = t45.easeId, this._prepareEase(i26, t45.noMoveStart, S5), this._ease(E5(o88), ((e57) => { "sea" === o88.cameraElevationReference && o88.recenterOnTerrain(), this._afterEase(i26, e57); }), t45), this; } _prepareEase(t45, i26, o88 = {}) { this._moving = true, this.transform.cameraElevationReference = "sea", this.transform._orthographicProjectionAtLowPitch && 0 === this.transform.pitch && "globe" !== this.transform.projection.name && (this.transform.cameraElevationReference = "ground"), i26 || o88.moving || this.fire(new e56.z("movestart", t45)), this._zooming && !o88.zooming && this.fire(new e56.z("zoomstart", t45)), this._rotating && !o88.rotating && this.fire(new e56.z("rotatestart", t45)), this._pitching && !o88.pitching && this.fire(new e56.z("pitchstart", t45)); } _fireMoveEvents(t45) { this.fire(new e56.z("move", t45)), this._zooming && this.fire(new e56.z("zoom", t45)), this._rotating && this.fire(new e56.z("rotate", t45)), this._pitching && this.fire(new e56.z("pitch", t45)); } _afterEase(t45, i26) { if (this._easeId && i26 && this._easeId === i26) return; this._easeId = void 0, this.transform.cameraElevationReference = "ground"; const o88 = this._zooming, s18 = this._rotating, r86 = this._pitching; this._moving = false, this._zooming = false, this._rotating = false, this._pitching = false, this._padding = false, o88 && this.fire(new e56.z("zoomend", t45)), s18 && this.fire(new e56.z("rotateend", t45)), r86 && this.fire(new e56.z("pitchend", t45)), this.fire(new e56.z("moveend", t45)); } flyTo(t45, i26) { if (this._prefersReducedMotion(t45)) { const o89 = e56.aH(t45, ["center", "zoom", "bearing", "pitch", "around", "padding", "retainPadding"]); return this.jumpTo(o89, i26); } this.stop(), t45 = Object.assign({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: e56.eM }, t45); const o88 = this.transform, s18 = this.getZoom(), r86 = this.getBearing(), n45 = this.getPitch(), a46 = this.getPadding(), l21 = "zoom" in t45 ? e56.aA(+t45.zoom, o88.minZoom, o88.maxZoom) : s18, c28 = "bearing" in t45 ? this._normalizeBearing(t45.bearing, r86) : r86, h8 = "pitch" in t45 ? +t45.pitch : n45, d34 = this._extendPadding(t45.padding), u12 = o88.zoomScale(l21 - s18), _4 = e56.P.convert(t45.offset); let p9 = o88.centerPoint.add(_4); const f8 = o88.pointLocation(p9), m6 = e56.aR.convert(t45.center || f8); this._normalizeCenter(m6); const g9 = o88.project(f8), v8 = o88.project(m6).sub(g9); let y4 = t45.curve; const x4 = Math.max(o88.width, o88.height), b8 = x4 / u12, w4 = v8.mag(); if ("minZoom" in t45) { const i27 = e56.aA(Math.min(t45.minZoom, s18, l21), o88.minZoom, o88.maxZoom), r87 = x4 / o88.zoomScale(i27 - s18); y4 = Math.sqrt(r87 / w4 * 2); } const T5 = y4 * y4; function E5(e57) { const t46 = (b8 * b8 - x4 * x4 + (e57 ? -1 : 1) * T5 * T5 * w4 * w4) / (2 * (e57 ? b8 : x4) * T5 * w4); return Math.log(Math.sqrt(t46 * t46 + 1) - t46); } function S5(e57) { return (Math.exp(e57) - Math.exp(-e57)) / 2; } function I4(e57) { return (Math.exp(e57) + Math.exp(-e57)) / 2; } const C6 = E5(0); let R5 = function(e57) { return I4(C6) / I4(C6 + y4 * e57); }, A4 = function(e57) { return x4 * ((I4(C6) * (S5(t46 = C6 + y4 * e57) / I4(t46)) - S5(C6)) / T5) / w4; var t46; }, D5 = (E5(1) - C6) / y4; if (Math.abs(w4) < 1e-6 || !isFinite(D5)) { if (Math.abs(x4 - b8) < 1e-6) return this.easeTo(t45, i26); const e57 = b8 < x4 ? -1 : 1; D5 = Math.abs(Math.log(b8 / x4)) / y4, A4 = function() { return 0; }, R5 = function(t46) { return Math.exp(e57 * y4 * t46); }; } t45.duration = "duration" in t45 ? +t45.duration : 1e3 * D5 / ("screenSpeed" in t45 ? +t45.screenSpeed / y4 : +t45.speed), t45.maxDuration && t45.duration > t45.maxDuration && (t45.duration = 0); const L3 = r86 !== c28, P4 = h8 !== n45, z4 = !o88.isPaddingEqual(d34), O4 = false === t45.retainPadding ? o88.clone() : o88, M5 = (o89) => (u13) => { const f9 = u13 * D5, y5 = 1 / R5(f9); o89.zoom = 1 === u13 ? l21 : s18 + o89.scaleZoom(y5), L3 && (o89.bearing = e56.ak(r86, c28, u13)), P4 && (o89.pitch = e56.ak(n45, h8, u13)), z4 && (O4.interpolatePadding(a46, d34, u13), p9 = O4.centerPoint.add(_4)); const x5 = 1 === u13 ? m6 : o89.unproject(g9.add(v8.mult(A4(f9))).mult(y5)); return o89.setLocationAtPoint(o89.renderWorldCopies ? x5.wrap() : x5, p9), o89._updateCameraOnTerrain(), t45.preloadOnly || this._fireMoveEvents(i26), o89; }; if (t45.preloadOnly) { const e57 = this._emulate(M5, t45.duration, o88); return this._preloadTiles(e57), this; } return this._zooming = true, this._rotating = L3, this._pitching = P4, this._padding = z4, this._prepareEase(i26, false), this._ease(M5(o88), (() => this._afterEase(i26)), t45), this; } isEasing() { return !!this._easeFrameId; } stop() { return this._stop(); } _requestRenderFrame(e57) { } _cancelRenderFrame(e57) { } _stop(e57, t45) { if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), this._easeFrameId = void 0, this._onEaseFrame = void 0), this._onEaseEnd) { const e58 = this._onEaseEnd; this._onEaseEnd = void 0, e58.call(this, t45); } if (!e57) { const e58 = this.handlers; e58 && e58.stop(false); } return this; } _ease(t45, i26, o88) { false === o88.animate || 0 === o88.duration ? (t45(1), i26()) : (this._easeStart = e56.o.now(), this._easeOptions = o88, this._onEaseFrame = t45, this._onEaseEnd = i26, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback)); } _renderFrameCallback() { const t45 = Math.min((e56.o.now() - this._easeStart) / this._easeOptions.duration, 1), i26 = this._onEaseFrame; i26 && i26(this._easeOptions.easing(t45)), t45 < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop(); } _normalizeBearing(t45, i26) { t45 = e56.bT(t45, -180, 180); const o88 = Math.abs(t45 - i26); return Math.abs(t45 - 360 - i26) < o88 && (t45 -= 360), Math.abs(t45 + 360 - i26) < o88 && (t45 += 360), t45; } _normalizeCenter(e57) { const t45 = this.transform; if (t45.maxBounds) return; if ("globe" !== t45.projection.name && !t45.renderWorldCopies) return; const i26 = e57.lng - t45.center.lng; e57.lng += i26 > 180 ? -360 : i26 < -180 ? 360 : 0; } _prefersReducedMotion(t45) { return this._respectPrefersReducedMotion && e56.o.prefersReducedMotion && !(t45 && t45.essential); } _emulate(e57, t45, i26) { const o88 = Math.ceil(15 * t45 / 1e3), s18 = [], r86 = e57(i26.clone()); for (let e58 = 0; e58 <= o88; e58++) { const t46 = r86(e58 / o88); s18.push(t46.clone()); } return s18; } _preloadTiles(e57, t45) { } } class fl { constructor(t45 = {}) { this.options = t45, e56.aY(["_toggleAttribution", "_updateEditLink", "_updateData", "_updateCompact"], this); } getDefaultPosition() { return "bottom-right"; } onAdd(e57) { const t45 = this.options && this.options.compact, i26 = e57._getUIString("AttributionControl.ToggleAttribution"); this._map = e57, this._container = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"), this._compactButton = l20("button", "mapboxgl-ctrl-attrib-button", this._container), this._compactButton.type = "button", this._compactButton.addEventListener("click", this._toggleAttribution), this._compactButton.setAttribute("aria-label", i26); const o88 = l20("span", "mapboxgl-ctrl-icon", this._compactButton); return o88.setAttribute("aria-hidden", "true"), o88.setAttribute("title", i26), this._innerContainer = l20("div", "mapboxgl-ctrl-attrib-inner", this._container), t45 && 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 === t45 && (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; } _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 t45 = this._editLink; t45 || (t45 = this._editLink = this._container.querySelector(".mapbox-improve-map")); const i26 = [{ key: "owner", value: this.styleOwner }, { key: "id", value: this.styleId }, { key: "access_token", value: this._map._requestManager._customAccessToken || e56.e.ACCESS_TOKEN }]; if (t45) { const o88 = i26.reduce(((e57, t46, o89) => (t46.value && (e57 += `${t46.key}=${t46.value}${o89 < i26.length - 1 ? "&" : ""}`), e57)), "?"); t45.href = `${e56.e.FEEDBACK_URL}/${o88}#${ma(this._map, true)}`, t45.rel = "noopener nofollow"; } } _updateData(e57) { !e57 || ("source" !== e57.dataType || "metadata" !== e57.sourceDataType && "visibility" !== e57.sourceDataType) && "style" !== e57.dataType || (this._updateAttributions(), this._updateEditLink()); } _updateAttributions() { if (!this._map.style) return; let e57 = []; if (this._map.style.stylesheet) { const e58 = this._map.style.stylesheet; this.styleOwner = e58.owner, this.styleId = e58.id; } const t45 = this._map.style._mergedSourceCaches; for (const i27 in t45) { const o88 = t45[i27]; if (o88.used) { const t46 = o88.getSource(); t46.attribution && e57.indexOf(t46.attribution) < 0 && e57.push(t46.attribution); } } e57.sort(((e58, t46) => e58.length - t46.length)), e57 = e57.filter(((t46, i27) => { for (let o88 = i27 + 1; o88 < e57.length; o88++) if (e57[o88].indexOf(t46) >= 0) return false; return true; })), this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? e57 = [...this.options.customAttribution, ...e57] : e57.unshift(this.options.customAttribution)); const i26 = e57.join(" | "); i26 !== this._attribHTML && (this._attribHTML = i26, e57.length ? (this._innerContainer.innerHTML = i26, 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 ml { constructor() { e56.aY(["_updateLogo", "_updateCompact"], this); } onAdd(e57) { this._map = e57, this._container = l20("div", "mapboxgl-ctrl"); const t45 = l20("a", "mapboxgl-ctrl-logo"); return t45.target = "_blank", t45.rel = "noopener nofollow", t45.href = "https://www.mapbox.com/", t45.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), t45.setAttribute("rel", "noopener nofollow"), this._container.appendChild(t45), 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(e57) { e57 && "metadata" !== e57.sourceDataType || (this._container.style.display = this._logoRequired() ? "block" : "none"); } _logoRequired() { if (!this._map.style) return true; const e57 = this._map.style._sourceCaches; if (0 === Object.entries(e57).length) return true; for (const t45 in e57) { const i26 = e57[t45].getSource(); if (i26.hasOwnProperty("mapbox_logo") && !i26.mapbox_logo) return false; } return true; } _updateCompact() { const e57 = this._container.children; if (e57.length) { const t45 = e57[0]; this._map.getCanvasContainer().offsetWidth < 250 ? t45.classList.add("mapboxgl-compact") : t45.classList.remove("mapboxgl-compact"); } } } class gl { constructor() { e56.aY(["_onIndoorUpdate"], this); } onAdd(e57) { return this._map = e57, this._container = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._map.indoor.on("indoorupdate", ((e58) => this._onIndoorUpdate({ selectedFloorId: e58.selectedFloorId, floors: e58.floors }))), this._container; } _createButton(e57, t45) { const i26 = l20("button", e57, this._container); return i26.type = "button", i26.addEventListener("click", t45), i26; } _createSeparator() { return l20("div", "mapboxgl-ctrl-separator", this._container); } _setButtonTitle(e57, t45) { this._map && (e57.setAttribute("aria-label", t45), e57.textContent = t45); } onRemove() { this._container && this._container.remove(), this._map && this._map.indoor && (this._map.indoor.off("indoorupdate", this._onIndoorUpdate), this._map = null); } getDefaultPosition() { return "right"; } _onIndoorUpdate(e57) { if (!e57 || !e57.floors) return void (this._container.style.display = "none"); const t45 = this._model; this._model = e57, this._container.style.display = "inline-block", this._container.style.borderRadius = "8px"; const i26 = e57.floors.sort(((e58, t46) => t46.levelOrder - e58.levelOrder)); t45 ? (Array.from(this._container.children).forEach(((e58) => e58.remove())), this.addCurrentFloors(i26)) : this.addCurrentFloors(i26); } addCurrentFloors(e57) { for (let t45 = 0; t45 < e57.length; t45++) { const i26 = e57[t45], o88 = this._createButton("mapboxgl-ctrl-level-button", (() => { this._map._selectIndoorFloor(i26.id), this._model && (this._model.selectedFloorId = i26.id), Array.from(this._container.children).forEach(((e58) => { e58.classList.contains("mapboxgl-ctrl-level-button") && e58.classList.remove("mapboxgl-ctrl-level-button-selected"); })), o88.classList.add("mapboxgl-ctrl-level-button-selected"); })); this._setButtonTitle(o88, i26.shortName), this._model && i26.id === this._model.selectedFloorId && o88.classList.add("mapboxgl-ctrl-level-button-selected"), this._container.append(o88), t45 < e57.length - 1 && this._createSeparator(); } } } class vl { constructor() { this._queue = [], this._id = 0, this._cleared = false, this._currentlyRunning = false; } add(e57) { const t45 = ++this._id; return this._queue.push({ callback: e57, id: t45, cancelled: false }), t45; } remove(e57) { const t45 = this._currentlyRunning, i26 = t45 ? this._queue.concat(t45) : this._queue; for (const t46 of i26) if (t46.id === e57) return void (t46.cancelled = true); } run(e57 = 0) { const t45 = this._currentlyRunning = this._queue; this._queue = []; for (const i26 of t45) if (!i26.cancelled && (i26.callback(e57), this._cleared)) break; this._cleared = false, this._currentlyRunning = false; } clear() { this._currentlyRunning && (this._cleared = true), this._queue = []; } } class yl { constructor(e57) { this.jumpTo(e57); } getValue(t45) { if (t45 <= this._startTime) return this._start; if (t45 >= this._endTime) return this._end; const i26 = e56.dz((t45 - this._startTime) / (this._endTime - this._startTime)); return this._start * (1 - i26) + this._end * i26; } isEasing(e57) { return e57 >= this._startTime && e57 <= this._endTime; } jumpTo(e57) { this._startTime = -1 / 0, this._endTime = -1 / 0, this._start = e57, this._end = e57; } easeTo(e57, t45, i26) { this._start = this.getValue(t45), this._end = e57, this._startTime = t45, this._endTime = t45 + i26; } } const xl = { "AttributionControl.ToggleAttribution": "Toggle attribution", "FullscreenControl.Enter": "Enter fullscreen", "FullscreenControl.Exit": "Exit fullscreen", "GeolocateControl.FindMyLocation": "Find my location", "GeolocateControl.LocationNotAvailable": "Location not available", "LogoControl.Title": "Mapbox homepage", "Map.Title": "Map", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map", "ScrollZoomBlocker.CmdMessage": "Use \u2318 + scroll to zoom the map", "TouchPanBlocker.Message": "Use two fingers to move the map" }; class bl extends e56.z { constructor(e57, t45, i26, o88) { const { point: s18, lngLat: r86, originalEvent: n45, target: a46 } = e57; super(e57.type, { point: s18, lngLat: r86, originalEvent: n45, target: a46 }), this.preventDefault = () => { e57.preventDefault(); }, this.id = t45, this.interaction = i26, this.feature = o88; } } class wl { constructor(e57) { this.map = e57, this.interactionsByType = /* @__PURE__ */ new Map(), this.delegatedInteractions = /* @__PURE__ */ new Map(), this.typeById = /* @__PURE__ */ new Map(), this.filters = /* @__PURE__ */ new Map(), this.handleType = this.handleType.bind(this), this.handleMove = this.handleMove.bind(this), this.handleOut = this.handleOut.bind(this), this.hoveredFeatures = /* @__PURE__ */ new Map(), this.prevHoveredFeatures = /* @__PURE__ */ new Map(); } add(t45, i26) { if (this.typeById.has(t45)) throw new Error(`Interaction id "${t45}" already exists.`); const o88 = i26.filter; let s18 = i26.type; o88 && this.filters.set(t45, e56.b6(o88)), "mouseover" === s18 && (s18 = "mouseenter"), "mouseout" === s18 && (s18 = "mouseleave"); const r86 = this.interactionsByType.get(s18) || /* @__PURE__ */ new Map(); "mouseenter" === s18 || "mouseleave" === s18 ? (0 === this.delegatedInteractions.size && (this.map.on("mousemove", this.handleMove), this.map.on("mouseout", this.handleOut)), this.delegatedInteractions.set(t45, i26)) : 0 === r86.size && this.map.on(s18, this.handleType), 0 === r86.size && this.interactionsByType.set(s18, r86), r86.set(t45, i26), this.typeById.set(t45, s18); } get(e57) { const t45 = this.typeById.get(e57); if (!t45) return; const i26 = this.interactionsByType.get(t45); return i26 ? i26.get(e57) : void 0; } remove(e57) { const t45 = this.typeById.get(e57); if (!t45) return; this.typeById.delete(e57), this.filters.delete(e57); const i26 = this.interactionsByType.get(t45); i26 && (i26.delete(e57), "mouseenter" === t45 || "mouseleave" === t45 ? (this.delegatedInteractions.delete(e57), 0 === this.delegatedInteractions.size && (this.map.off("mousemove", this.handleMove), this.map.off("mouseout", this.handleOut))) : 0 === i26.size && this.map.off(t45, this.handleType)); } queryTargets(e57, t45) { const i26 = []; for (const [e58, o88] of t45) o88.target && i26.push({ targetId: e58, target: o88.target, filter: this.filters.get(e58) }); return this.map.style.queryRenderedTargets(e57, i26, this.map.transform); } handleMove(e57) { this.prevHoveredFeatures = this.hoveredFeatures, this.hoveredFeatures = /* @__PURE__ */ new Map(); const t45 = this.queryTargets(e57.point, Array.from(this.delegatedInteractions).reverse()); t45.length && (e57.type = "mouseenter", this.handleType(e57, t45)); const i26 = /* @__PURE__ */ new Map(); for (const [e58, { feature: t46 }] of this.prevHoveredFeatures) this.hoveredFeatures.has(e58) || i26.set(t46.id, t46); i26.size && (e57.type = "mouseleave", this.handleType(e57, Array.from(i26.values()))); } handleOut(e57) { const t45 = Array.from(this.hoveredFeatures.values()).map((({ feature: e58 }) => e58)); t45.length && (e57.type = "mouseleave", this.handleType(e57, t45)), this.hoveredFeatures.clear(); } handleType(t45, i26) { const o88 = "mouseenter" === t45.type; if (o88 && !this.interactionsByType.has(t45.type)) return void e56.w("mouseenter interaction required for mouseleave to work."); const s18 = Array.from(this.interactionsByType.get(t45.type)).reverse(), r86 = !!i26; i26 = i26 || this.queryTargets(t45.point, s18); let n45 = false; const a46 = /* @__PURE__ */ new Set(); for (const l21 of i26) { for (const [i27, c28] of s18) { if (!c28.target) continue; const s19 = l21.variants ? l21.variants[i27] : null; if (s19) { for (const h8 of s19) { if (ht2(h8, l21, a46, i27)) continue; const s20 = new e56.dt(l21, h8), d34 = ct(h8, l21, i27); r86 && (s20.state = this.map.getFeatureState(s20)); const u12 = o88 ? this.prevHoveredFeatures.get(d34) : null, _4 = new bl(t45, i27, c28, s20), p9 = u12 ? u12.stop : c28.handler(_4); if (o88 && this.hoveredFeatures.set(d34, { feature: l21, stop: p9 }), false !== p9) { n45 = true; break; } } if (n45) break; } } if (n45) break; } if (!n45) for (const [e57, i27] of s18) { const { handler: o89, target: s19 } = i27; if (!s19 && false !== o89(new bl(t45, e57, i27, null))) break; } } } function Tl(t45, i26) { if (Array.isArray(t45) && Array.isArray(i26)) { const e57 = new Set(t45), o88 = new Set(i26); return e57.size === o88.size && t45.every(((e58) => o88.has(e58))); } return e56.by(t45, i26); } const El = { center: [0, 0], zoom: 0, bearing: 0, pitch: 0, minZoom: -2, maxZoom: 22, minPitch: 0, maxPitch: 85, interactive: true, scrollZoom: true, boxZoom: true, dragRotate: true, dragPan: true, keyboard: true, doubleClickZoom: true, touchZoomRotate: true, touchPitch: true, cooperativeGestures: false, performanceMetricsCollection: true, bearingSnap: 7, clickTolerance: 3, pitchWithRotate: true, hash: false, attributionControl: true, antialias: false, failIfMajorPerformanceCaveat: false, preserveDrawingBuffer: false, trackResize: true, renderWorldCopies: true, refreshExpiredTiles: true, minTileCacheSize: null, maxTileCacheSize: null, localIdeographFontFamily: "sans-serif", localFontFamily: null, transformRequest: null, accessToken: null, fadeDuration: 300, respectPrefersReducedMotion: true, crossSourceCollisions: true, collectResourceTiming: false, testMode: false, precompilePrograms: true, scaleFactor: 1, spriteFormat: "auto" }, Sl = { showCompass: true, showZoom: true, visualizePitch: false }; class Il { constructor(t45, i26, o88 = false) { this._clickTolerance = 10, this.element = i26, this.mouseRotate = new Na({ clickTolerance: t45.dragRotate._mouseRotate._clickTolerance }), this.map = t45, o88 && (this.mousePitch = new Ua({ clickTolerance: t45.dragRotate._mousePitch._clickTolerance })), e56.aY(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "reset"], this), i26.addEventListener("mousedown", this.mousedown), i26.addEventListener("touchstart", this.touchstart, { passive: false }), i26.addEventListener("touchmove", this.touchmove), i26.addEventListener("touchend", this.touchend), i26.addEventListener("touchcancel", this.reset); } down(e57, t45) { this.mouseRotate.mousedown(e57, t45), this.mousePitch && this.mousePitch.mousedown(e57, t45), _3(); } move(e57, t45) { const i26 = this.map, o88 = this.mouseRotate.mousemoveWindow(e57, t45), s18 = o88 && o88.bearingDelta; if (s18 && i26.setBearing(i26.getBearing() + s18), this.mousePitch) { const o89 = this.mousePitch.mousemoveWindow(e57, t45), s19 = o89 && o89.pitchDelta; s19 && i26.setPitch(i26.getPitch() + s19); } } off() { const e57 = this.element; e57.removeEventListener("mousedown", this.mousedown), e57.removeEventListener("touchstart", this.touchstart), e57.removeEventListener("touchmove", this.touchmove), e57.removeEventListener("touchend", this.touchend), e57.removeEventListener("touchcancel", this.reset), this.offTemp(); } offTemp() { p8(), window.removeEventListener("mousemove", this.mousemove), window.removeEventListener("mouseup", this.mouseup); } mousedown(e57) { this.down(Object.assign({}, e57, { ctrlKey: true, preventDefault: () => e57.preventDefault() }), g8(this.element, e57)), window.addEventListener("mousemove", this.mousemove), window.addEventListener("mouseup", this.mouseup); } mousemove(e57) { this.move(e57, g8(this.element, e57)); } mouseup(e57) { this.mouseRotate.mouseupWindow(e57), this.mousePitch && this.mousePitch.mouseupWindow(e57), this.offTemp(); } touchstart(e57) { 1 !== e57.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = v7(this.element, e57.targetTouches)[0], this.down({ type: "mousedown", button: 0, ctrlKey: true, preventDefault: () => e57.preventDefault() }, this._startPos)); } touchmove(e57) { 1 !== e57.targetTouches.length ? this.reset() : (this._lastPos = v7(this.element, e57.targetTouches)[0], this.move({ preventDefault: () => e57.preventDefault() }, this._lastPos)); } touchend(e57) { 0 === e57.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), this.reset(); } reset() { this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp(); } } function Cl(t45, i26, o88) { if (t45 = new e56.aR(t45.lng, t45.lat), i26) { const s18 = new e56.aR(t45.lng - 360, t45.lat), r86 = new e56.aR(t45.lng + 360, t45.lat), n45 = 360 * Math.ceil(Math.abs(t45.lng - o88.center.lng) / 360), a46 = o88.locationPoint3D(t45).distSqr(i26), l21 = i26.x < 0 || i26.y < 0 || i26.x > o88.width || i26.y > o88.height; o88.locationPoint3D(s18).distSqr(i26) < a46 && (l21 || Math.abs(s18.lng - o88.center.lng) < n45) ? t45 = s18 : o88.locationPoint3D(r86).distSqr(i26) < a46 && (l21 || Math.abs(r86.lng - o88.center.lng) < n45) && (t45 = r86); } for (; Math.abs(t45.lng - o88.center.lng) > 180; ) { const e57 = o88.locationPoint3D(t45); if (e57.x >= 0 && e57.y >= 0 && e57.x <= o88.width && e57.y <= o88.height) break; t45.lng > o88.center.lng ? t45.lng -= 360 : t45.lng += 360; } return t45; } const Rl = { 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%)" }, Al = { rotation: 0, rotationAlignment: "auto", pitchAlignment: "auto", occludedOpacity: 0.2, altitude: 0 }; class Dl extends e56.E { constructor(t45, i26) { super(), (t45 instanceof HTMLElement || i26) && (t45 = Object.assign({ element: t45 }, i26)), e56.aY(["_update", "_onMove", "_onUp", "_addDragHandler", "_onMapClick", "_onKeyPress", "_clearFadeTimer"], this); const { anchor: o88 = "center", color: s18 = "#3FB1CE", scale: r86 = 1, draggable: n45 = false, clickTolerance: a46 = 0, rotation: l21 = Al.rotation, rotationAlignment: c28 = Al.rotationAlignment, pitchAlignment: h8 = Al.pitchAlignment, occludedOpacity: d34 = Al.occludedOpacity, altitude: u12 = Al.altitude } = t45 || {}; this._anchor = o88, this._color = s18, this._scale = r86, this._draggable = n45, this._clickTolerance = a46, this._rotation = l21, this._rotationAlignment = c28, this._pitchAlignment = h8, this._occludedOpacity = d34, this._altitude = u12, this._state = "inactive", this._isDragging = false, this._updateMoving = () => this._update(true), t45 && t45.element ? (this._element = t45.element, this._offset = e56.P.convert(t45 && t45.offset || [0, 0])) : (this._defaultMarker = true, this._element = this._createDefaultMarker(), this._offset = e56.P.convert(t45 && t45.offset || [0, -14])), this._element.hasAttribute("aria-label") || this._element.setAttribute("aria-label", "Map marker"), this._element.hasAttribute("role") || this._element.setAttribute("role", "img"), this._element.classList.add("mapboxgl-marker"), this._element.addEventListener("dragstart", ((e57) => { e57.preventDefault(); })), this._element.addEventListener("mousedown", ((e57) => { e57.preventDefault(); })); const _4 = this._element.classList; for (const e57 in Rl) _4.remove(`mapboxgl-marker-anchor-${e57}`); _4.add(`mapboxgl-marker-anchor-${this._anchor}`); const p9 = t45 && t45.className ? t45.className.trim().split(/\s+/) : []; _4.add(...p9), this._popup = null; } _createDefaultMarker() { const e57 = l20("div"), t45 = c27("svg", { display: "block", height: 41 * this._scale + "px", width: 27 * this._scale + "px", viewBox: "0 0 27 41" }, e57); if (0 === this._altitude) { const e58 = c27("radialGradient", { id: "shadowGradient" }, c27("defs", {}, t45)); c27("stop", { offset: "10%", "stop-opacity": 0.4 }, e58), c27("stop", { offset: "100%", "stop-opacity": 0.05 }, e58), c27("ellipse", { cx: 13.5, cy: 34.8, rx: 10.5, ry: 5.25, fill: "url(#shadowGradient)" }, t45); } return c27("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" }, t45), c27("path", { opacity: 0.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" }, t45), c27("circle", { fill: "white", cx: 13.5, cy: 13.5, r: 5.5 }, t45), e57; } addTo(e57) { return e57 === this._map || (this.remove(), this._map = e57, e57.getCanvasContainer().appendChild(this._element), e57.on("move", this._updateMoving), e57.on("moveend", this._update), e57.on("remove", this._clearFadeTimer), e57._addMarker(this), this.setDraggable(this._draggable), this._update(), e57.on("click", this._onMapClick)), this; } remove() { const e57 = this._map; return e57 && (e57.off("click", this._onMapClick), e57.off("move", this._updateMoving), e57.off("moveend", this._update), e57.off("mousedown", this._addDragHandler), e57.off("touchstart", this._addDragHandler), e57.off("mouseup", this._onUp), e57.off("touchend", this._onUp), e57.off("mousemove", this._onMove), e57.off("touchmove", this._onMove), e57.off("remove", this._clearFadeTimer), e57._removeMarker(this), this._map = void 0), this._clearFadeTimer(), this._element.remove(), this._popup && this._popup.remove(), this; } getLngLat() { return this._lngLat; } setLngLat(t45) { return this._lngLat = e56.aR.convert(t45), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(true), this; } setAltitude(e57) { return e57 === this._altitude || (this._defaultMarker && (0 === this._altitude && 0 !== e57 || 0 !== this._altitude && 0 === e57) && (this._element = this._createDefaultMarker()), this._altitude = e57 || Al.altitude, this._update()), this; } getAltitude() { return this._altitude; } getElement() { return this._element; } setPopup(e57) { 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")), e57) { if (!("offset" in e57.options)) { const t45 = 38.1, i26 = 13.5, o88 = Math.sqrt(Math.pow(i26, 2) / 2); e57.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -t45], "bottom-left": [o88, -1 * (t45 - i26 + o88)], "bottom-right": [-o88, -1 * (t45 - i26 + o88)], left: [i26, -1 * (t45 - i26)], right: [-i26, -1 * (t45 - i26)] } : this._offset; } this._popup = e57, e57._marker = this, e57._altitude = this._altitude, 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(e57) { const t45 = e57.code, i26 = e57.charCode || e57.keyCode; "Space" !== t45 && "Enter" !== t45 && 32 !== i26 && 13 !== i26 || this.togglePopup(); } _onMapClick(e57) { const t45 = e57.originalEvent.target, i26 = this._element; this._popup && (t45 === i26 || i26.contains(t45)) && this.togglePopup(); } getPopup() { return this._popup; } togglePopup() { const e57 = this._popup; return e57 ? (e57.isOpen() ? (e57.remove(), this._element.setAttribute("aria-expanded", "false")) : this._map && (e57.addTo(this._map), this._element.setAttribute("aria-expanded", "true")), this) : this; } _behindTerrain() { const e57 = this._map, t45 = this._pos; if (!e57 || !t45) return false; const i26 = e57.unproject(t45, this._altitude), o88 = e57.getFreeCameraOptions(); if (!o88.position) return false; const s18 = o88.position.toLngLat(); return s18.distanceTo(i26) < 0.9 * s18.distanceTo(this._lngLat); } _evaluateOpacity() { const t45 = this._map; if (!t45) return; const i26 = this._pos; if (!i26 || i26.x < 0 || i26.x > t45.transform.width || i26.y < 0 || i26.y > t45.transform.height) return void this._clearFadeTimer(); const o88 = t45.unproject(i26, this._altitude); let s18; t45._showingGlobe() && e56.eY(t45.transform, this._lngLat) ? s18 = 0 : (s18 = 1 - t45._queryFogOpacity(o88), t45.transform._terrainEnabled() && t45.getTerrain() && this._behindTerrain() && (s18 *= this._occludedOpacity)), this._element.style.opacity = `${s18}`, this._element.style.pointerEvents = s18 > 0 ? "auto" : "none", this._popup && this._popup._setOpacity(s18), this._fadeTimer = null; } _clearFadeTimer() { this._fadeTimer && (clearTimeout(this._fadeTimer), this._fadeTimer = null); } _updateDOM() { const e57 = this._pos; if (!e57 || !this._map) return; const t45 = this._offset.mult(this._scale); this._element.style.transform = ` translate(${e57.x}px,${e57.y}px) ${Rl[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${t45.x}px,${t45.y}px) `; } _calculateXYTransform() { const t45 = this._pos, i26 = this._map, o88 = this.getPitchAlignment(); if (!i26 || !t45 || "map" !== o88) return ""; if (!i26._showingGlobe()) { const e57 = i26.getPitch(); return e57 ? `rotateX(${e57}deg)` : ""; } const s18 = e56.cW(e56.eZ(i26.transform, this._lngLat)), r86 = t45.sub(e56.e_(i26.transform)), n45 = Math.abs(r86.x) + Math.abs(r86.y); if (0 === n45) return ""; const a46 = s18 / n45; return `rotateX(${-r86.y * a46}deg) rotateY(${r86.x * a46}deg)`; } _calculateZTransform() { const t45 = this._pos, i26 = this._map; if (!i26 || !t45) return ""; let o88 = 0; const s18 = this.getRotationAlignment(); if ("map" === s18) if (i26._showingGlobe()) { const t46 = i26.project(new e56.aR(this._lngLat.lng, this._lngLat.lat + 1e-3), this._altitude), s19 = i26.project(new e56.aR(this._lngLat.lng, this._lngLat.lat - 1e-3), this._altitude).sub(t46); o88 = e56.cW(Math.atan2(s19.y, s19.x)) - 90; } else o88 = -i26.getBearing(); else if ("horizon" === s18) { const s19 = e56.ah(4, 6, i26.getZoom()), r86 = e56.e_(i26.transform); r86.y += s19 * i26.transform.height; const n45 = t45.sub(r86), a46 = e56.cW(Math.atan2(n45.y, n45.x)); o88 = (a46 > 90 ? a46 - 270 : a46 + 90) * (1 - s19); } return o88 += this._rotation, o88 ? `rotateZ(${o88}deg)` : ""; } _update(e57) { cancelAnimationFrame(this._updateFrameId); const t45 = this._map; t45 && (t45.transform.renderWorldCopies && (this._lngLat = Cl(this._lngLat, this._pos, t45.transform)), this._pos = t45.project(this._lngLat, this._altitude), true === e57 ? this._updateFrameId = requestAnimationFrame((() => { this._element && this._pos && this._anchor && (this._pos = this._pos.round(), this._updateDOM()); })) : this._pos = this._pos.round(), t45._requestDomTask((() => { this._map && (this._element && this._pos && this._anchor && this._updateDOM(), (t45._showingGlobe() || t45.getTerrain() || t45.getFog()) && !this._fadeTimer && (this._fadeTimer = window.setTimeout(this._evaluateOpacity.bind(this), 60))); }))); } getOffset() { return this._offset; } setOffset(t45) { return this._offset = e56.P.convert(t45), this._update(), this; } addClassName(e57) { return this._element.classList.add(e57), this; } removeClassName(e57) { return this._element.classList.remove(e57), this; } toggleClassName(e57) { return this._element.classList.toggle(e57); } _onMove(t45) { const i26 = this._map; if (!i26) return; const o88 = this._pointerdownPos, s18 = this._positionDelta; if (o88 && s18) { if (!this._isDragging) { const e57 = this._clickTolerance || i26._clickTolerance; if (t45.point.dist(o88) < e57) return; this._isDragging = true; } this._pos = t45.point.sub(s18), this._lngLat = i26.unproject(this._pos, this._altitude), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new e56.z("dragstart"))), this.fire(new e56.z("drag")); } } _onUp() { this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = false; const t45 = this._map; t45 && (t45.off("mousemove", this._onMove), t45.off("touchmove", this._onMove)), "active" === this._state && this.fire(new e56.z("dragend")), this._state = "inactive"; } _addDragHandler(e57) { const t45 = this._map, i26 = this._pos; t45 && i26 && this._element.contains(e57.originalEvent.target) && (e57.preventDefault(), this._positionDelta = e57.point.sub(i26), this._pointerdownPos = e57.point, this._state = "pending", t45.on("mousemove", this._onMove), t45.on("touchmove", this._onMove), t45.once("mouseup", this._onUp), t45.once("touchend", this._onUp)); } setDraggable(e57) { this._draggable = !!e57; const t45 = this._map; return t45 && (e57 ? (t45.on("mousedown", this._addDragHandler), t45.on("touchstart", this._addDragHandler)) : (t45.off("mousedown", this._addDragHandler), t45.off("touchstart", this._addDragHandler))), this; } isDraggable() { return this._draggable; } setRotation(e57) { return this._rotation = e57 || Al.rotation, this._update(), this; } getRotation() { return this._rotation; } setRotationAlignment(e57) { return this._rotationAlignment = e57 || Al.rotationAlignment, this._update(), this; } getRotationAlignment() { return "auto" === this._rotationAlignment || "horizon" === this._rotationAlignment && this._map && !this._map._showingGlobe() ? "viewport" : this._rotationAlignment; } setPitchAlignment(e57) { return this._pitchAlignment = e57 || Al.pitchAlignment, this._update(), this; } getPitchAlignment() { return "auto" === this._pitchAlignment ? this.getRotationAlignment() : this._pitchAlignment; } setOccludedOpacity(e57) { return this._occludedOpacity = e57 || Al.occludedOpacity, this._update(), this; } getOccludedOpacity() { return this._occludedOpacity; } } const Ll = { positionOptions: { enableHighAccuracy: false, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: false, showAccuracyCircle: true, showUserLocation: true, showUserHeading: false }, Pl = { maxWidth: 100, unit: "metric" }, zl = { kilometer: "km", meter: "m", mile: "mi", foot: "ft", "nautical-mile": "nm" }, Ol = { closeButton: true, closeOnClick: true, focusAfterOpen: true, className: "", maxWidth: "240px", altitude: 0 }, Ml = ["a[href]", "[tabindex]:not([tabindex='-1'])", "[contenteditable]:not([contenteditable='false'])", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].join(", "); function Fl(t45 = new e56.P(0, 0), i26 = "bottom") { if ("number" == typeof t45) { const o88 = Math.round(Math.sqrt(0.5 * Math.pow(t45, 2))); switch (i26) { case "top": return new e56.P(0, t45); case "top-left": return new e56.P(o88, o88); case "top-right": return new e56.P(-o88, o88); case "bottom": return new e56.P(0, -t45); case "bottom-left": return new e56.P(o88, -o88); case "bottom-right": return new e56.P(-o88, -o88); case "left": return new e56.P(t45, 0); case "right": return new e56.P(-t45, 0); } return new e56.P(0, 0); } return t45 instanceof e56.P || Array.isArray(t45) ? e56.P.convert(t45) : e56.P.convert(t45[i26] || [0, 0]); } const Bl = { version: t44, supported: a45.supported, setRTLTextPlugin: e56.f2, getRTLTextPluginStatus: e56.f1, Map: class extends pl { constructor(t45) { o87.mark(i25.create); const s18 = t45; if (null != (t45 = Object.assign({}, El, t45)).minZoom && null != t45.maxZoom && t45.minZoom > t45.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom"); if (null != t45.minPitch && null != t45.maxPitch && t45.minPitch > t45.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch"); if (null != t45.minPitch && t45.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0"); if (null != t45.maxPitch && t45.maxPitch > 85) throw new Error("maxPitch must be less than or equal to 85"); if (t45.antialias && e56.eW(window) && (t45.antialias = false, e56.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")), super(new to3(t45.minZoom, t45.maxZoom, t45.minPitch, t45.maxPitch, t45.renderWorldCopies, null, null), t45), this._repaint = !!t45.repaint, this._interactive = t45.interactive, this._minTileCacheSize = t45.minTileCacheSize, this._maxTileCacheSize = t45.maxTileCacheSize, this._failIfMajorPerformanceCaveat = t45.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = t45.preserveDrawingBuffer, this._antialias = t45.antialias, this._trackResize = t45.trackResize, this._bearingSnap = t45.bearingSnap, this._refreshExpiredTiles = t45.refreshExpiredTiles, this._fadeDuration = t45.fadeDuration, this._isInitialLoad = true, this._crossSourceCollisions = t45.crossSourceCollisions, this._collectResourceTiming = t45.collectResourceTiming, this._language = this._parseLanguage(t45.language), this._worldview = t45.worldview, this._renderTaskQueue = new vl(), this._domRenderTaskQueue = new vl(), this._controls = [], this._markers = [], this._popups = [], this._mapId = e56.b2(), this._locale = Object.assign({}, xl, t45.locale), this._clickTolerance = t45.clickTolerance, this._cooperativeGestures = t45.cooperativeGestures, this._performanceMetricsCollection = t45.performanceMetricsCollection, this._tessellationStep = t45.tessellationStep, this._containerWidth = 0, this._containerHeight = 0, this._showParseStatus = true, this._precompilePrograms = t45.precompilePrograms, this._scaleFactorChanged = false, this._averageElevationLastSampledAt = -1 / 0, this._averageElevationExaggeration = 0, this._averageElevation = new yl(0), this._interactionRange = [1 / 0, -1 / 0], this._visibilityHidden = 0, this._useExplicitProjection = false, this._frameId = 0, this._scaleFactor = t45.scaleFactor, this._requestManager = new T4(t45.transformRequest, t45.accessToken, t45.testMode), this._silenceAuthErrors = !!t45.testMode, this._contextCreateOptions = t45.contextCreateOptions ? Object.assign({}, t45.contextCreateOptions) : {}, "string" == typeof t45.container) { const e57 = document.getElementById(t45.container); if (!e57) throw new Error(`Container '${t45.container.toString()}' not found.`); this._container = e57; } else { if (!(t45.container instanceof HTMLElement)) throw new Error("Invalid type: 'container' must be a String or HTMLElement."); this._container = t45.container; } if (this._container.childNodes.length > 0 && e56.w("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."), t45.maxBounds && this.setMaxBounds(t45.maxBounds), this._spriteFormat = t45.spriteFormat, e56.aY(["_onWindowOnline", "_onWindowResize", "_onVisibilityChange", "_onMapScroll", "_contextLost", "_contextRestored"], this), this._setupContainer(), this._tp || (this._tp = new Kn()), this._tp.registerParameter(this, ["Debug"], "showOverdrawInspector"), this._tp.registerParameter(this, ["Debug"], "showTileBoundaries"), this._tp.registerParameter(this, ["Debug"], "showParseStatus"), this._tp.registerParameter(this, ["Debug"], "repaint"), this._tp.registerParameter(this, ["Debug"], "showTileAABBs"), this._tp.registerParameter(this, ["Debug"], "showPadding"), this._tp.registerParameter(this, ["Debug"], "showCollisionBoxes", { noSave: true }), this._tp.registerParameter(this.transform, ["Debug"], "freezeTileCoverage", { noSave: true }, (() => { this._update(); })), this._tp.registerParameter(this, ["Debug", "Wireframe"], "showTerrainWireframe"), this._tp.registerParameter(this, ["Debug", "Wireframe"], "showLayers2DWireframe"), this._tp.registerParameter(this, ["Debug", "Wireframe"], "showLayers3DWireframe"), this._tp.registerParameter(this, ["Scaling"], "_scaleFactor", { min: 0.1, max: 10, step: 0.1 }, (() => { this.setScaleFactor(this._scaleFactor); })), this._setupPainter(), void 0 === this.painter) throw new Error("Failed to initialize WebGL."); if (this.on("move", (() => this._update(false))), this.on("moveend", (() => this._update(false))), this.on("zoom", (() => this._update(true))), this._fullscreenchangeEvent = "onfullscreenchange" in document ? "fullscreenchange" : "webkitfullscreenchange", window.addEventListener("online", this._onWindowOnline, false), window.addEventListener("resize", this._onWindowResize, false), window.addEventListener("orientationchange", this._onWindowResize, false), window.addEventListener(this._fullscreenchangeEvent, this._onWindowResize, false), window.addEventListener("visibilitychange", this._onVisibilityChange, false), this.handlers = new ul(this, t45), this._localFontFamily = t45.localFontFamily, this._localIdeographFontFamily = t45.localIdeographFontFamily, (t45.style || !t45.testMode) && this.setStyle(t45.style || e56.e.DEFAULT_STYLE, { config: t45.config, localFontFamily: this._localFontFamily, localIdeographFontFamily: this._localIdeographFontFamily }), t45.projection && this.setProjection(t45.projection), this.indoor = new Co(this), t45.hash && (this._hash = new fa("string" == typeof t45.hash && t45.hash || void 0).addTo(this)), !this._hash || !this._hash._onHashChange()) { null == s18.center && null == s18.zoom || (this.transform._unmodified = false), this.jumpTo({ center: t45.center, zoom: t45.zoom, bearing: t45.bearing, pitch: t45.pitch }); const e57 = t45.bounds; e57 && (this.resize(), this.fitBounds(e57, Object.assign({}, t45.fitBoundsOptions, { duration: 0 }))); } this.resize(), t45.attributionControl && this.addControl(new fl({ customAttribution: t45.customAttribution })), this._logoControl = new ml(), this.addControl(this._logoControl, t45.logoPosition), this.on("style.load", (() => { this.transform.unmodified && this.jumpTo(this.style.stylesheet), this._postStyleLoadEvent(); })), this.on("data", ((t46) => { this._update("style" === t46.dataType), this.fire(new e56.z(`${t46.dataType}data`, t46)); })), this.on("dataloading", ((t46) => { this.fire(new e56.z(`${t46.dataType}dataloading`, t46)); })), this._interactions = new wl(this); } _getMapId() { return this._mapId; } addControl(t45, i26) { if (void 0 === i26 && (i26 = t45.getDefaultPosition ? t45.getDefaultPosition() : "top-right"), !t45 || !t45.onAdd) return this.fire(new e56.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))); const o88 = t45.onAdd(this); this._controls.push(t45); const s18 = this._controlPositions[i26]; return -1 !== i26.indexOf("bottom") ? s18.insertBefore(o88, s18.firstChild) : s18.appendChild(o88), this; } removeControl(t45) { if (!t45 || !t45.onRemove) return this.fire(new e56.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods."))); const i26 = this._controls.indexOf(t45); return i26 > -1 && this._controls.splice(i26, 1), t45.onRemove(this), this; } hasControl(e57) { return this._controls.indexOf(e57) > -1; } getContainer() { return this._container; } getCanvasContainer() { return this._canvasContainer; } getCanvas() { return this._canvas; } resize(t45) { 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 i26 = !this._moving; return i26 && this.fire(new e56.z("movestart", t45)).fire(new e56.z("move", t45)), this.fire(new e56.z("resize", t45)), i26 && this.fire(new e56.z("moveend", t45)), this; } getBounds() { return this.transform.getBounds(); } getMaxBounds() { return this.transform.getMaxBounds() || null; } setMaxBounds(t45) { return this.transform.setMaxBounds(e56.aI.convert(t45)), this._update(); } setMinZoom(t45) { if ((t45 = t45 ?? -2) >= -2 && t45 <= this.transform.maxZoom) return this.transform.minZoom = t45, this._update(), this.getZoom() < t45 ? this.setZoom(t45) : this.fire(new e56.z("zoomstart")).fire(new e56.z("zoom")).fire(new e56.z("zoomend")), this; throw new Error("minZoom must be between -2 and the current maxZoom, inclusive"); } getMinZoom() { return this.transform.minZoom; } setMaxZoom(t45) { if ((t45 = t45 ?? 22) >= this.transform.minZoom) return this.transform.maxZoom = t45, this._update(), this.getZoom() > t45 ? this.setZoom(t45) : this.fire(new e56.z("zoomstart")).fire(new e56.z("zoom")).fire(new e56.z("zoomend")), this; throw new Error("maxZoom must be greater than the current minZoom"); } getMaxZoom() { return this.transform.maxZoom; } setMinPitch(t45) { if ((t45 = t45 ?? 0) < 0) throw new Error("minPitch must be greater than or equal to 0"); if (t45 >= 0 && t45 <= this.transform.maxPitch) return this.transform.minPitch = t45, this._update(), this.getPitch() < t45 ? this.setPitch(t45) : this.fire(new e56.z("pitchstart")).fire(new e56.z("pitch")).fire(new e56.z("pitchend")), this; throw new Error("minPitch must be between 0 and the current maxPitch, inclusive"); } getMinPitch() { return this.transform.minPitch; } setMaxPitch(t45) { if ((t45 = t45 ?? 85) > 85) throw new Error("maxPitch must be less than or equal to 85"); if (t45 >= this.transform.minPitch) return this.transform.maxPitch = t45, this._update(), this.getPitch() > t45 ? this.setPitch(t45) : this.fire(new e56.z("pitchstart")).fire(new e56.z("pitch")).fire(new e56.z("pitchend")), this; throw new Error("maxPitch must be greater than or equal to minPitch"); } getMaxPitch() { return this.transform.maxPitch; } getScaleFactor() { return this._scaleFactor; } setScaleFactor(e57) { return this._scaleFactor = e57, this.painter.scaleFactor = e57, this._tp.refreshUI(), this._scaleFactorChanged = true, this.style._updateFilteredLayers(((e58) => "symbol" === e58.type)), this._update(true), this; } getRenderWorldCopies() { return this.transform.renderWorldCopies; } setRenderWorldCopies(e57) { return this.transform.renderWorldCopies = e57, this.transform.renderWorldCopies || this._forceMarkerAndPopupUpdate(true), this._update(); } getLanguage() { return this._language; } _parseLanguage(e57) { return "auto" === e57 ? navigator.language : Array.isArray(e57) ? 0 === e57.length ? void 0 : e57.map(((e58) => "auto" === e58 ? navigator.language : e58)) : e57; } setLanguage(e57) { const t45 = this._parseLanguage(e57); if (!this.style || t45 === this._language) return this; this._language = t45, this.style.reloadSources(); for (const e58 of this._controls) e58._setLanguage && e58._setLanguage(this._language); return this; } getWorldview() { return this._worldview; } setWorldview(e57) { return this.style && e57 !== this._worldview ? (this._worldview = e57, this._styleDirty = true, this.style.reloadSources(), this) : this; } getProjection() { return this.transform.mercatorFromTransition ? { name: "globe", center: [0, 0] } : this.transform.getProjection(); } _showingGlobe() { return "globe" === this.transform.projection.name; } setProjection(e57) { return this._lazyInitEmptyStyle(), e57 ? "string" == typeof e57 && (e57 = { name: e57 }) : e57 = null, this._useExplicitProjection = !!e57, this._prioritizeAndUpdateProjection(e57, this.style.projection); } _updateProjectionTransition() { if ("globe" !== this.getProjection().name) return; const t45 = this.transform, i26 = t45.projection.name; let o88; "globe" === i26 && t45.zoom >= e56.cK ? (t45.setMercatorFromTransition(), o88 = true) : "mercator" === i26 && t45.zoom < e56.cK && (t45.setProjection({ name: "globe" }), o88 = true), o88 && (this.style.applyProjectionUpdate(), this.style._forceSymbolLayerUpdate(), this._update(true)); } _prioritizeAndUpdateProjection(e57, t45) { return this._updateProjection(e57 || t45 || { name: "mercator" }); } _updateProjection(t45) { let i26; return i26 = "globe" === t45.name && this.transform.zoom >= e56.cK ? this.transform.setMercatorFromTransition() : this.transform.setProjection(t45), this.style.applyProjectionUpdate(), i26 && (this.painter.clearBackgroundTiles(), this.style.clearSources(), this._update(true), this._forceMarkerAndPopupUpdate(true)), this; } project(t45, i26) { return this.transform.locationPoint3D(e56.aR.convert(t45), i26); } unproject(t45, i26) { return this.transform.pointLocation3D(e56.P.convert(t45), i26); } isMoving() { return this._moving || this.handlers && this.handlers.isMoving() || false; } isZooming() { return this._zooming || this.handlers && this.handlers.isZooming() || false; } isRotating() { return this._rotating || this.handlers && this.handlers.isRotating() || false; } _isDragging() { return this.handlers && this.handlers._isDragging() || false; } _createDelegatedListener(e57, t45, i26) { const o88 = (e58) => { let i27 = []; if (Array.isArray(t45)) { const o89 = t45.filter(((e59) => this.getLayer(e59))); i27 = o89.length ? this.queryRenderedFeatures(e58, { layers: o89 }) : []; } else i27 = this.queryRenderedFeatures(e58, { target: t45 }); return i27; }; if ("mouseenter" === e57 || "mouseover" === e57) { let s18 = false; const r86 = (t46) => { const r87 = o88(t46.point); r87.length ? s18 || (s18 = true, i26.call(this, new Sa(e57, this, t46.originalEvent, { features: r87 }))) : s18 = false; }; return { listener: i26, targets: t45, delegates: { mousemove: r86, mouseout: () => { s18 = false; } } }; } if ("mouseleave" === e57 || "mouseout" === e57) { let s18 = false; const r86 = (t46) => { o88(t46.point).length ? s18 = true : s18 && (s18 = false, i26.call(this, new Sa(e57, this, t46.originalEvent))); }, n45 = (t46) => { s18 && (s18 = false, i26.call(this, new Sa(e57, this, t46.originalEvent))); }; return { listener: i26, targets: t45, delegates: { mousemove: r86, mouseout: n45 } }; } { const s18 = (e58) => { const t46 = o88(e58.point); t46.length && (e58.features = t46, i26.call(this, e58), delete e58.features); }; return { listener: i26, targets: t45, delegates: { [e57]: s18 } }; } } on(e57, t45, i26) { if ("function" == typeof t45 || void 0 === i26) return super.on(e57, t45); if ("string" == typeof t45 && (t45 = [t45]), !this._areTargetsValid(t45)) return this; const o88 = this._createDelegatedListener(e57, t45, i26); this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[e57] = this._delegatedListeners[e57] || [], this._delegatedListeners[e57].push(o88); for (const e58 in o88.delegates) this.on(e58, o88.delegates[e58]); return this; } once(e57, t45, i26) { if ("function" == typeof t45 || void 0 === i26) return super.once(e57, t45); if ("string" == typeof t45 && (t45 = [t45]), !this._areTargetsValid(t45)) return this; const o88 = this._createDelegatedListener(e57, t45, i26); for (const e58 in o88.delegates) this.once(e58, o88.delegates[e58]); return this; } off(e57, t45, i26) { if ("function" == typeof t45 || void 0 === i26) return super.off(e57, t45); if ("string" == typeof t45 && (t45 = [t45]), !this._areTargetsValid(t45)) return this; const o88 = this._delegatedListeners ? this._delegatedListeners[e57] : void 0; return o88 && ((e58) => { for (let o89 = 0; o89 < e58.length; o89++) { const s18 = e58[o89]; if (s18.listener === i26 && Tl(s18.targets, t45)) { for (const e59 in s18.delegates) this.off(e59, s18.delegates[e59]); return e58.splice(o89, 1), this; } } })(o88), this; } queryRenderedFeatures(t45, i26) { if (!this.style) return []; if (void 0 === t45 || t45 instanceof e56.P || Array.isArray(t45) || void 0 !== i26 || (i26 = t45, t45 = void 0), t45 = t45 || [[0, 0], [this.transform.width, this.transform.height]], !i26) { const e57 = this.style.queryRenderedFeatures(t45, void 0, this.transform), i27 = this.style.queryRenderedFeatureset(t45, void 0, this.transform); return e57.concat(i27); } let o88 = true; if (i26.target && (o88 = this._isTargetValid(i26.target), o88 && !i26.layers)) return this.style.queryRenderedFeatureset(t45, i26, this.transform); let s18 = true; if (i26.layers && Array.isArray(i26.layers)) { for (const e57 of i26.layers) if (!this._isValidId(e57)) { s18 = false; break; } if (s18 && !i26.target) return this.style.queryRenderedFeatures(t45, i26, this.transform); } let r86 = []; return s18 && (r86 = r86.concat(this.style.queryRenderedFeatures(t45, i26, this.transform))), o88 && (r86 = r86.concat(this.style.queryRenderedFeatureset(t45, i26, this.transform))), r86; } querySourceFeatures(e57, t45) { return !e57 || "string" == typeof e57 && !this._isValidId(e57) ? [] : this.style.querySourceFeatures(e57, t45); } queryRasterValue(e57, t45, i26) { return this._isValidId(e57) ? this.style.queryRasterValue(e57, t45, i26) : Promise.resolve(null); } isPointOnSurface(t45) { const { name: i26 } = this.transform.projection; return "globe" !== i26 && "mercator" !== i26 && e56.w(`${i26} projection does not support isPointOnSurface, this API may behave unexpectedly.`), this.transform.isPointOnSurface(e56.P.convert(t45)); } addInteraction(e57, t45) { return this._interactions.add(e57, t45), this; } removeInteraction(e57) { return this._interactions.remove(e57), this; } getCooperativeGestures() { return this._cooperativeGestures; } setCooperativeGestures(e57) { return this._cooperativeGestures = e57, this; } setStyle(t45, i26) { return i26 = Object.assign({}, { localIdeographFontFamily: this._localIdeographFontFamily, localFontFamily: this._localFontFamily }, i26), this.style && t45 && false !== i26.diff && i26.localFontFamily === this._localFontFamily && i26.localIdeographFontFamily === this._localIdeographFontFamily && !i26.config ? (this.style._diffStyle(t45, ((o88, s18) => { if (o88) { const s19 = "string" == typeof o88 ? o88 : o88 instanceof Error ? o88.message : o88.error; e56.w(`Unable to perform style diff: ${s19}. Rebuilding the style from scratch.`), this._updateStyle(t45, i26); } else s18 && this._update(true); }), (() => this._postStyleLoadEvent())), this) : (this._localIdeographFontFamily = i26.localIdeographFontFamily, this._localFontFamily = i26.localFontFamily, this._updateStyle(t45, i26)); } _getUIString(e57) { const t45 = this._locale[e57]; if (null == t45) throw new Error(`Missing UI string '${e57}'`); return t45; } _updateStyle(e57, t45) { if (this.style && (this.style.setEventedParent(null), this.style._remove(), this.style = void 0), e57) { const i26 = Object.assign({}, t45); t45 && t45.config && (i26.initialConfig = t45.config, delete i26.config), this.style = new To(this, i26).load(e57), this.style.setEventedParent(this, { style: this.style }); } return this._updateTerrain(), this; } _lazyInitEmptyStyle() { this.style || (this.style = new To(this, {}), this.style.setEventedParent(this, { style: this.style }), this.style.loadEmpty()); } getStyle() { if (this.style) return this.style.serialize(); } isStyleLoaded() { return this.style ? this.style.loaded() : (e56.w("There is no style added to the map."), false); } _isValidId(t45) { return null == t45 ? (this.fire(new e56.y(new Error("IDs can't be empty."))), false) : !e56.dm(t45) || (this.fire(new e56.y(new Error(`IDs can't contain special symbols: "${t45}".`))), false); } _isTargetValid(e57) { return "featuresetId" in e57 ? this._isValidId("importId" in e57 ? e57.importId : e57.featuresetId) : "layerId" in e57 && this._isValidId(e57.layerId); } _areTargetsValid(e57) { if (Array.isArray(e57)) { for (const t45 of e57) if (!this._isValidId(t45)) return false; return true; } return this._isTargetValid(e57); } addSource(e57, t45) { return this._isValidId(e57) ? (this._lazyInitEmptyStyle(), this.style.addSource(e57, t45), this._update(true)) : this; } isSourceLoaded(e57) { return !!this._isValidId(e57) && !!this.style && this.style._isSourceCacheLoaded(e57); } areTilesLoaded() { return this.style.areTilesLoaded(); } addSourceType(e57, t45, i26) { this._lazyInitEmptyStyle(), this.style.addSourceType(e57, t45, i26); } removeSource(e57) { return this._isValidId(e57) ? (this.style.removeSource(e57), this._updateTerrain(), this._update(true)) : this; } getSource(e57) { return this._isValidId(e57) ? this.style.getOwnSource(e57) : null; } addImage(t45, i26, { pixelRatio: o88 = 1, sdf: s18 = false, stretchX: r86, stretchY: n45, content: a46 } = {}) { this._lazyInitEmptyStyle(); const l21 = e56.I.from(t45); if (i26 instanceof HTMLImageElement || ImageBitmap && i26 instanceof ImageBitmap) { const { width: t46, height: c28, data: h8 } = e56.o.getImageData(i26); this.style.addImage(l21, { data: new e56.q({ width: t46, height: c28 }, h8), pixelRatio: o88, stretchX: r86, stretchY: n45, content: a46, sdf: s18, version: 0, usvg: false }); } else if (void 0 === i26.width || void 0 === i26.height) this.fire(new e56.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); else { const { width: c28, height: h8 } = i26, d34 = i26; this.style.addImage(l21, { data: new e56.q({ width: c28, height: h8 }, new Uint8Array(d34.data)), pixelRatio: o88, stretchX: r86, stretchY: n45, content: a46, sdf: s18, usvg: false, version: 0, userImage: d34 }), d34.onAdd && d34.onAdd(this, t45); } } updateImage(t45, i26) { this._lazyInitEmptyStyle(); const o88 = e56.I.from(t45), s18 = this.style.getImage(o88); if (!s18) return void this.fire(new e56.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead."))); const r86 = i26 instanceof HTMLImageElement || ImageBitmap && i26 instanceof ImageBitmap ? e56.o.getImageData(i26) : i26, { width: n45, height: a46, data: l21 } = r86; if (void 0 === n45 || void 0 === a46) return void this.fire(new e56.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); if (n45 !== (s18.usvg ? s18.icon.usvg_tree.width : s18.data.width) || a46 !== (s18.usvg ? s18.icon.usvg_tree.height : s18.data.height)) return void this.fire(new e56.y(new Error(`The width and height of the updated image (${n45}, ${a46}) must be that same as the previous version of the image (${s18.data.width}, ${s18.data.height})`))); const c28 = !(i26 instanceof HTMLImageElement || ImageBitmap && i26 instanceof ImageBitmap); let h8 = false; s18.usvg ? (s18.data = new e56.q({ width: n45, height: a46 }, new Uint8Array(l21)), s18.usvg = false, s18.icon = void 0, h8 = true) : s18.data.replace(l21, c28), this.style.updateImage(o88, s18, h8); } hasImage(t45) { return t45 ? !!this.style && !!this.style.getImage(e56.I.from(t45)) : (this.fire(new e56.y(new Error("Missing required image id"))), false); } removeImage(t45) { this.style.removeImage(e56.I.from(t45)); } loadImage(t45, i26) { e56.n(this._requestManager.transformRequest(t45, e56.R.Image), ((t46, o88) => { i26(t46, o88 instanceof HTMLImageElement ? e56.o.getImageData(o88) : o88); })); } listImages() { return this.style.listImages().map(((e57) => e57.name)); } addModel(e57, t45) { this._lazyInitEmptyStyle(), this.style.addModel(e57, t45); } hasModel(t45) { return t45 ? this.style.hasModel(t45) : (this.fire(new e56.y(new Error("Missing required model id"))), false); } removeModel(e57) { this.style.removeModel(e57); } listModels() { return this.style.listModels(); } addLayer(e57, t45) { return this._isValidId(e57.id) ? (this._lazyInitEmptyStyle(), this.style.addLayer(e57, t45), this._update(true)) : this; } getSlot(e57) { const t45 = this.getLayer(e57); return t45 && t45.slot || null; } setSlot(e57, t45) { return this.style.setSlot(e57, t45), this.style.mergeLayers(), this._update(true); } addImport(t45, i26) { return this.style.addImport(t45, i26).catch(((t46) => this.fire(new e56.y(new Error("Failed to add import", t46))))), this; } updateImport(e57, t45) { return "string" != typeof t45 && t45.id !== e57 ? (this.removeImport(e57), this.addImport(t45)) : (this.style.updateImport(e57, t45), this._update(true)); } removeImport(e57) { return this.style.removeImport(e57), this; } moveImport(e57, t45) { return this.style.moveImport(e57, t45), this._update(true); } moveLayer(e57, t45) { return this._isValidId(e57) ? (this.style.moveLayer(e57, t45), this._update(true)) : this; } removeLayer(e57) { return this._isValidId(e57) ? (this.style.removeLayer(e57), this._update(true)) : this; } getLayer(e57) { if (!this._isValidId(e57)) return null; const t45 = this.style.getOwnLayer(e57); return t45 ? "custom" === t45.type ? t45.implementation : t45.serialize() : void 0; } getSlots() { return this.style.getSlots(); } setLayerZoomRange(e57, t45, i26) { return this._isValidId(e57) ? (this.style.setLayerZoomRange(e57, t45, i26), this._update(true)) : this; } setFilter(e57, t45, i26 = {}) { return this._isValidId(e57) ? (this.style.setFilter(e57, t45, i26), this._update(true)) : this; } getFilter(e57) { return this._isValidId(e57) ? this.style.getFilter(e57) : null; } setPaintProperty(e57, t45, i26, o88 = {}) { return this._isValidId(e57) ? (this.style.setPaintProperty(e57, t45, i26, o88), this._update(true)) : this; } getPaintProperty(e57, t45) { return this._isValidId(e57) ? this.style.getPaintProperty(e57, t45) : null; } setLayoutProperty(e57, t45, i26, o88 = {}) { return this._isValidId(e57) ? (this.style.setLayoutProperty(e57, t45, i26, o88), this._update(true)) : this; } getLayoutProperty(e57, t45) { return this._isValidId(e57) ? this.style.getLayoutProperty(e57, t45) : null; } getGlyphsUrl() { return this.style.getGlyphsUrl(); } setGlyphsUrl(e57) { return this.style.setGlyphsUrl(e57), this._update(true); } getSchema(e57) { return this.style.getSchema(e57); } setSchema(e57, t45) { return this.style.setSchema(e57, t45), this._update(true); } getConfig(e57) { return this.style.getConfig(e57); } setConfig(e57, t45) { return this.style.setConfig(e57, t45), this._update(true); } getConfigProperty(e57, t45) { return this.style.getConfigProperty(e57, t45); } setConfigProperty(e57, t45, i26) { return this.style.setConfigProperty(e57, t45, i26), this._update(true); } getFeaturesetDescriptors(e57) { return this.style.getFeaturesetDescriptors(e57); } setLights(e57) { if (this._lazyInitEmptyStyle(), e57 && 1 === e57.length && "flat" === e57[0].type) { const t45 = e57[0]; t45.properties ? this.style.setFlatLight(t45.properties, t45.id, {}) : this.style.setFlatLight({}, "flat"); } else this.style.setLights(e57), this.painter.terrain && (this.painter.terrain.invalidateRenderCache = true); return this._update(true); } getLights() { const e57 = this.style.getLights() || []; return 0 === e57.length && e57.push({ id: this.style.light.id, type: "flat", properties: this.style.getFlatLight() }), e57; } setLight(e57, t45 = {}) { return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."), this.setLights([{ id: "flat", type: "flat", properties: e57 }]); } getLight() { return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."), this.style.getFlatLight(); } setTerrain(e57) { return this._lazyInitEmptyStyle(), !e57 && this.transform.projection.requiresDraping ? this.style.setTerrainForDraping() : this.style.setTerrain(e57), this._averageElevationLastSampledAt = -1 / 0, this._update(true); } getTerrain() { return this.style ? this.style.getTerrain() : null; } setFog(e57) { return this._lazyInitEmptyStyle(), this.style.setFog(e57), this._update(true); } getFog() { return this.style ? this.style.getFog() : null; } setSnow(e57) { return this._lazyInitEmptyStyle(), this.style.setSnow(e57), this._update(true); } getSnow() { return this.style ? this.style.getSnow() : null; } setRain(e57) { return this._lazyInitEmptyStyle(), this.style.setRain(e57), this._update(true); } getRain() { return this.style ? this.style.getRain() : null; } setColorTheme(e57) { return this._lazyInitEmptyStyle(), this.style.setColorTheme(e57), this._update(true); } setImportColorTheme(e57, t45) { return this._lazyInitEmptyStyle(), this.style.setImportColorTheme(e57, t45), this._update(true); } setCamera(e57) { return this.style.setCamera(e57), this._triggerCameraUpdate(e57); } _triggerCameraUpdate(e57) { return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic" === e57["camera-projection"])); } getCamera() { return this.style.camera; } _queryFogOpacity(t45) { return this.style && this.style.fog ? this.style.fog.getOpacityAtLatLng(e56.aR.convert(t45), this.transform) : 0; } setFeatureState(e57, t45) { return e57.source && !this._isValidId(e57.source) ? this : (this.style.setFeatureState(e57, t45), this._update()); } removeFeatureState(e57, t45) { return e57.source && !this._isValidId(e57.source) ? this : (this.style.removeFeatureState(e57, t45), this._update()); } getFeatureState(e57) { return e57.source && !this._isValidId(e57.source) ? null : this.style.getFeatureState(e57); } _selectIndoorFloor(e57) { this.indoor.selectFloor(e57); } _addIndoorControl() { this._indoorControl || (this._indoorControl = new gl()), this.addControl(this._indoorControl, "right"); } _removeIndoorControl() { this._indoorControl && this.removeControl(this._indoorControl); } _updateContainerDimensions() { if (!this._container) return; const e57 = this._container.getBoundingClientRect().width || 400, t45 = this._container.getBoundingClientRect().height || 300; let i26, o88, s18, r86 = this._container; for (; r86 && (!o88 || !s18); ) { const e58 = window.getComputedStyle(r86).transform; e58 && "none" !== e58 && (i26 = e58.match(/matrix.*\((.+)\)/)[1].split(", "), i26[0] && "0" !== i26[0] && "1" !== i26[0] && (o88 = i26[0]), i26[3] && "0" !== i26[3] && "1" !== i26[3] && (s18 = i26[3])), r86 = r86.parentElement; } this._containerWidth = o88 ? Math.abs(e57 / o88) : e57, this._containerHeight = s18 ? Math.abs(t45 / s18) : t45; } _detectMissingCSS() { "rgb(250, 128, 114)" !== window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") && e56.w("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 e57 = this._container; e57.classList.add("mapboxgl-map"), (this._missingCSSCanary = l20("div", "mapboxgl-canary", e57)).style.visibility = "hidden", this._detectMissingCSS(); const t45 = this._canvasContainer = l20("div", "mapboxgl-canvas-container", e57); this._canvas = l20("canvas", "mapboxgl-canvas", t45), this._interactive && (t45.classList.add("mapboxgl-interactive"), this._canvas.setAttribute("tabindex", "0")), this._canvas.addEventListener("webglcontextlost", this._contextLost, false), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, false), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region"), this._updateContainerDimensions(), this._resizeCanvas(this._containerWidth, this._containerHeight); const i26 = this._controlContainer = l20("div", "mapboxgl-control-container", e57), o88 = this._controlPositions = {}; ["top-left", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left"].forEach(((e58) => { o88[e58] = l20("div", `mapboxgl-ctrl-${e58}`, i26); })), this._container.addEventListener("scroll", this._onMapScroll, false); } _resizeCanvas(t45, i26) { const o88 = e56.o.devicePixelRatio || 1; this._canvas.width = o88 * Math.ceil(t45), this._canvas.height = o88 * Math.ceil(i26), this._canvas.style.width = `${t45}px`, this._canvas.style.height = `${i26}px`; } _addMarker(e57) { this._markers.push(e57); } _removeMarker(e57) { const t45 = this._markers.indexOf(e57); -1 !== t45 && this._markers.splice(t45, 1); } _addPopup(e57) { this._popups.push(e57); } _removePopup(e57) { const t45 = this._popups.indexOf(e57); -1 !== t45 && this._popups.splice(t45, 1); } _setupPainter() { const t45 = Object.assign({}, a45.supported.webGLContextAttributes, { failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || false }), i26 = this._canvas.getContext("webgl2", t45); i26 ? (j3(i26, true), this.painter = new _a12(i26, this._contextCreateOptions, this.transform, this._scaleFactor, this._tp, this._worldview), this.on("data", ((e57) => { "source" === e57.dataType && this.painter.setTileLoadedFlag(true); })), e56.k.testSupport(i26)) : this.fire(new e56.y(new Error("Failed to initialize WebGL"))); } _contextLost(t45) { t45.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.fire(new e56.z("webglcontextlost", { originalEvent: t45 })); } _contextRestored(t45) { this._setupPainter(), this.painter.resize(Math.ceil(this._containerWidth), Math.ceil(this._containerHeight)), this._updateTerrain(), this.style && (this.style.clearLayers(), this.style.imageManager.destroyAtlasTextures(), this.style.reloadModels(), this.style.clearSources()), this._update(), this.fire(new e56.z("webglcontextrestored", { originalEvent: t45 })); } _onMapScroll(e57) { if (e57.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, false; } idle() { return !this.isMoving() && this.loaded(); } loaded() { return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded(); } frameReady() { return this.loaded() && !this._placementDirty; } _update(e57) { return this.style ? (this._styleDirty = this._styleDirty || e57, this._sourcesDirty = true, this.triggerRepaint(), this) : this; } _requestRenderFrame(e57) { return this._update(), this._renderTaskQueue.add(e57); } _cancelRenderFrame(e57) { this._renderTaskQueue.remove(e57); } _requestDomTask(e57) { !this.loaded() || this.loaded() && !this.isMoving() ? e57() : this._domRenderTaskQueue.add(e57); } _render(t45) { let s18; this.fire(new e56.z("renderstart")), ++this._frameId; const r86 = this.painter.context.extTimerQuery, n45 = e56.o.now(), a46 = this.painter.context.gl; if (this.listens("gpu-timing-frame") && (s18 = a46.createQuery(), a46.beginQuery(r86.TIME_ELAPSED_EXT, s18)), this.painter.context.setDirty(), this.painter.setBaseState(), (this.isMoving() || this.isRotating() || this.isZooming()) && (this._interactionRange[0] = Math.min(this._interactionRange[0], performance.now()), this._interactionRange[1] = Math.max(this._interactionRange[1], performance.now())), this._renderTaskQueue.run(t45), this._domRenderTaskQueue.run(t45), this._removed) return; this._updateProjectionTransition(); const l21 = this._isInitialLoad ? 0 : this._fadeDuration; if (this.style && this._styleDirty) { this._styleDirty = false; const t46 = this.transform.zoom, i26 = this.transform.pitch, o88 = e56.o.now(), s19 = new e56.ac(t46, { now: o88, fadeDuration: l21, pitch: i26, transition: this.style.transition, worldview: this._worldview }); this.style.update(s19); } this.style && this.style.hasFogTransition() && (this.style._markersNeedUpdate = true, this._sourcesDirty = true); let c28 = false; this.style && this._sourcesDirty ? (this._sourcesDirty = false, this.painter._updateFog(this.style), this._updateTerrain(), c28 = this._updateAverageElevation(n45), this.style.updateSources(this.transform), this.style.updateImageProviders(), this.isMoving() || this._forceMarkerAndPopupUpdate()) : c28 = this._updateAverageElevation(n45); const h8 = this.style && this.style._updatePlacement(this.painter, this.painter.transform, this.showCollisionBoxes, l21, this._crossSourceCollisions, this.painter.replacementSource, this._scaleFactorChanged); if (this._scaleFactorChanged && (this._scaleFactorChanged = false), h8 && (this._placementDirty = h8.needsRerender), this.style && this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showParseStatus: this.showParseStatus, wireframe: { terrain: this.showTerrainWireframe, layers2D: this.showLayers2DWireframe, layers3D: this.showLayers3DWireframe }, showOverdrawInspector: this._showOverdrawInspector, showQueryGeometry: !!this._showQueryGeometry, showTileAABBs: this.showTileAABBs, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), fadeDuration: l21, isInitialLoad: this._isInitialLoad, showPadding: this.showPadding, gpuTiming: !!this.listens("gpu-timing-layer"), gpuTimingDeferredRender: !!this.listens("gpu-timing-deferred-render"), speedIndexTiming: this.speedIndexTiming }), this.fire(new e56.z("render")), this.loaded() && !this._loaded && (this._loaded = true, o87.mark(i25.load), this.fire(new e56.z("load"))), this.style && this.style.hasTransitions() && (this._styleDirty = true), this.style && (this.style.snow || this.style.rain) && (this._styleDirty = true), this.style && this.style.imageManager.hasPatternsInFlight() && (this._styleDirty = true), this.style && !this.style.modelManager.isLoaded() && (this._styleDirty = true), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(), s18) { const t46 = e56.o.now() - n45; a46.endQuery(r86.TIME_ELAPSED_EXT), setTimeout((() => { const i26 = a46.getQueryParameter(s18, a46.QUERY_RESULT) / 1e6; a46.deleteQuery(s18), this.fire(new e56.z("gpu-timing-frame", { cpuTime: t46, gpuTime: i26 })); }), 50); } if (this.listens("gpu-timing-layer")) { const t46 = this.painter.collectGpuTimers(); setTimeout((() => { const i26 = this.painter.queryGpuTimers(t46); this.fire(new e56.z("gpu-timing-layer", { layerTimes: i26 })); }), 50); } if (this.listens("gpu-timing-deferred-render")) { const t46 = this.painter.collectDeferredRenderGpuQueries(); setTimeout((() => { const i26 = this.painter.queryGpuTimeDeferredRender(t46); this.fire(new e56.z("gpu-timing-deferred-render", { gpuTime: i26 })); }), 50); } const d34 = this._sourcesDirty || this._styleDirty || this._placementDirty || c28; if (d34 || this._repaint) this.triggerRepaint(); else { const t46 = this.idle(); if (t46 && (c28 = this._updateAverageElevation(n45, true)), c28) this.triggerRepaint(); else if (this._triggerFrame(false), t46 && (this.fire(new e56.z("idle")), this._isInitialLoad = false, this.speedIndexTiming)) { const t47 = this._calculateSpeedIndex(); this.fire(new e56.z("speedindexcompleted", { speedIndex: t47 })), this.speedIndexTiming = false; } } !this._loaded || this._fullyLoaded || d34 || (this._fullyLoaded = true, o87.mark(i25.fullLoad), this._performanceMetricsCollection && B5(this._requestManager._customAccessToken, { width: this.painter.width, height: this.painter.height, interactionRange: this._interactionRange, visibilityHidden: this._visibilityHidden, terrainEnabled: !!this.painter.style.getTerrain(), fogEnabled: !!this.painter.style.getFog(), projection: this.getProjection().name, zoom: this.transform.zoom, renderer: this.painter.context.renderer, vendor: this.painter.context.vendor }), this._authenticate()); } _forceMarkerAndPopupUpdate(e57) { for (const t45 of this._markers) e57 && !this.getRenderWorldCopies() && (t45._lngLat = t45._lngLat.wrap()), t45._update(); for (const t45 of this._popups) !e57 || this.getRenderWorldCopies() || t45._trackPointer || (t45._lngLat = t45._lngLat.wrap()), t45._update(); } _updateAverageElevation(e57, t45 = false) { const i26 = (e58) => (this.transform.averageElevation = e58, this._update(false), true); if (!this.painter.averageElevationNeedsEasing()) return 0 !== this.transform.averageElevation && i26(0); const o88 = this.transform.elevation && this.transform.elevation.exaggeration() !== this._averageElevationExaggeration; if (o88 || (t45 || e57 - this._averageElevationLastSampledAt > 500) && !this._averageElevation.isEasing(e57)) { const t46 = this.transform.averageElevation; let s18 = this.transform.sampleAverageElevation(); null != this.transform.elevation && (this._averageElevationExaggeration = this.transform.elevation.exaggeration()), isNaN(s18) ? s18 = 0 : this._averageElevationLastSampledAt = e57; const r86 = Math.abs(t46 - s18); if (r86 > 1) { if (this._isInitialLoad || o88) return this._averageElevation.jumpTo(s18), i26(s18); this._averageElevation.easeTo(s18, e57, 300); } else if (r86 > 1e-4) return this._averageElevation.jumpTo(s18), i26(s18); } return !!this._averageElevation.isEasing(e57) && i26(this._averageElevation.getValue(e57)); } _authenticate() { N4(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, ((t45) => { if (t45 && (t45.message === w3 || 401 === t45.status)) { const t46 = this.painter.context.gl; j3(t46, false), this._logoControl instanceof ml && this._logoControl._updateLogo(), t46 && t46.clear(t46.DEPTH_BUFFER_BIT | t46.COLOR_BUFFER_BIT | t46.STENCIL_BUFFER_BIT), this._silenceAuthErrors || this.fire(new e56.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/"))); } })), z3(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (() => { })); } _postStyleLoadEvent() { this.style.globalId && M4(this._requestManager._customAccessToken, { map: this, style: this.style.globalId, importedStyles: this.style.getImportGlobalIds() }); } _updateTerrain() { const e57 = this._isDragging(); this.painter.updateTerrain(this.style, e57); } _calculateSpeedIndex() { const e57 = this.painter.canvasCopy(), t45 = this.painter.getCanvasCopiesAndTimestamps(); t45.timeStamps.push(performance.now()); const i26 = this.painter.context.gl, o88 = i26.createFramebuffer(); function s18(e58) { i26.framebufferTexture2D(i26.FRAMEBUFFER, i26.COLOR_ATTACHMENT0, i26.TEXTURE_2D, e58, 0); const t46 = new Uint8Array(i26.drawingBufferWidth * i26.drawingBufferHeight * 4); return i26.readPixels(0, 0, i26.drawingBufferWidth, i26.drawingBufferHeight, i26.RGBA, i26.UNSIGNED_BYTE, t46), t46; } return i26.bindFramebuffer(i26.FRAMEBUFFER, o88), this._canvasPixelComparison(s18(e57), t45.canvasCopies.map(s18), t45.timeStamps); } _canvasPixelComparison(e57, t45, i26) { let o88 = i26[1] - i26[0]; const s18 = e57.length / 4; for (let r86 = 0; r86 < t45.length; r86++) { const n45 = t45[r86]; let a46 = 0; for (let t46 = 0; t46 < n45.length; t46 += 4) n45[t46] === e57[t46] && n45[t46 + 1] === e57[t46 + 1] && n45[t46 + 2] === e57[t46 + 2] && n45[t46 + 3] === e57[t46 + 3] && (a46 += 1); o88 += (i26[r86 + 2] - i26[r86 + 1]) * (1 - a46 / s18); } return o88; } remove() { this._hash && this._hash.remove(); for (const e57 of this._controls) e57.onRemove(this); this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this._domRenderTaskQueue.clear(), this.style && this.style.destroy(), this.indoor.destroy(), this.painter.destroy(), this.handlers && this.handlers.destroy(), this.handlers = void 0, this.setStyle(null), window.removeEventListener("resize", this._onWindowResize, false), window.removeEventListener("orientationchange", this._onWindowResize, false), window.removeEventListener(this._fullscreenchangeEvent, this._onWindowResize, false), window.removeEventListener("online", this._onWindowOnline, false), window.removeEventListener("visibilitychange", this._onVisibilityChange, false); const t45 = this.painter.context.gl.getExtension("WEBGL_lose_context"); t45 && t45.loseContext(), this._canvas.removeEventListener("webglcontextlost", this._contextLost, false), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, false), this._canvasContainer.remove(), this._controlContainer.remove(), this._missingCSSCanary.remove(), this._canvas = void 0, this._canvasContainer = void 0, this._controlContainer = void 0, this._missingCSSCanary = void 0, this._container.classList.remove("mapboxgl-map"), this._container.removeEventListener("scroll", this._onMapScroll, false), U3.delete(this.painter.context.gl), k6.remove(), P3.remove(), this._removed = true, this.fire(new e56.z("remove")); } triggerRepaint() { this._triggerFrame(true); } _triggerFrame(t45) { this._renderNextFrame = this._renderNextFrame || t45, this.style && !this._frame && (this._frame = e56.o.frame(((e57) => { const t46 = !!this._renderNextFrame; this._frame = null, this._renderNextFrame = null, t46 && this._render(e57); }))); } _preloadTiles(t45) { const i26 = this.style ? this.style.getSourceCaches() : []; return e56.bw(i26, ((e57, i27) => e57._preloadTiles(t45, i27)), (() => { this.triggerRepaint(); })), this; } _onWindowOnline() { this._update(); } _onWindowResize(e57) { this._trackResize && this.resize({ originalEvent: e57 })._update(); } _onVisibilityChange() { "hidden" === document.visibilityState && this._visibilityHidden++; } get showTileBoundaries() { return !!this._showTileBoundaries; } set showTileBoundaries(e57) { this._showTileBoundaries !== e57 && (this._showTileBoundaries = e57, this._tp.refreshUI(), this._update()); } get showParseStatus() { return !!this._showParseStatus; } set showParseStatus(e57) { this._showParseStatus !== e57 && (this._showParseStatus = e57, this._tp.refreshUI(), this._update()); } get showTerrainWireframe() { return !!this._showTerrainWireframe; } set showTerrainWireframe(e57) { this._showTerrainWireframe !== e57 && (this._showTerrainWireframe = e57, this._tp.refreshUI(), this._update()); } get showLayers2DWireframe() { return !!this._showLayers2DWireframe; } set showLayers2DWireframe(e57) { this._showLayers2DWireframe !== e57 && (this._showLayers2DWireframe = e57, this._tp.refreshUI(), this._update()); } get showLayers3DWireframe() { return !!this._showLayers3DWireframe; } set showLayers3DWireframe(e57) { this._showLayers3DWireframe !== e57 && (this._showLayers3DWireframe = e57, this._tp.refreshUI(), this._update()); } get speedIndexTiming() { return !!this._speedIndexTiming; } set speedIndexTiming(e57) { this._speedIndexTiming !== e57 && (this._speedIndexTiming = e57, this._update()); } get showPadding() { return !!this._showPadding; } set showPadding(e57) { this._showPadding !== e57 && (this._showPadding = e57, this._tp.refreshUI(), this._update()); } get showCollisionBoxes() { return !!this._showCollisionBoxes; } set showCollisionBoxes(e57) { this._showCollisionBoxes !== e57 && (this._showCollisionBoxes = e57, this._tp.refreshUI(), e57 ? this.style._generateCollisionBoxes() : this._update()); } get showOverdrawInspector() { return !!this._showOverdrawInspector; } set showOverdrawInspector(e57) { this._showOverdrawInspector !== e57 && (this._showOverdrawInspector = e57, this._tp.refreshUI(), this._update()); } get repaint() { return !!this._repaint; } set repaint(e57) { this._repaint !== e57 && (this._repaint = e57, this._tp.refreshUI(), this.triggerRepaint()); } get vertices() { return !!this._vertices; } set vertices(e57) { this._vertices = e57, this._update(); } get showTileAABBs() { return !!this._showTileAABBs; } set showTileAABBs(e57) { this._showTileAABBs !== e57 && (this._showTileAABBs = e57, this._tp.refreshUI(), e57 && this._update()); } _setCacheLimits(t45, i26) { e56.eX(t45, i26); } get version() { return t44; } }, NavigationControl: class { constructor(t45 = {}) { this.options = Object.assign({}, Sl, t45), this._container = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.addEventListener("contextmenu", ((e57) => e57.preventDefault())), this.options.showZoom && (e56.aY(["_setButtonTitle", "_updateZoomButtons"], this), this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", ((e57) => { this._map && this._map.zoomIn({}, { originalEvent: e57 }); })), l20("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", ((e57) => { this._map && this._map.zoomOut({}, { originalEvent: e57 }); })), l20("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (e56.aY(["_rotateCompassArrow"], this), this._compass = this._createButton("mapboxgl-ctrl-compass", ((e57) => { const t46 = this._map; t46 && (this.options.visualizePitch ? t46.resetNorthPitch({}, { originalEvent: e57 }) : t46.resetNorth({}, { originalEvent: e57 })); })), this._compassIcon = l20("span", "mapboxgl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true")); } _updateZoomButtons() { const e57 = this._map; if (!e57) return; const t45 = e57.getZoom(), i26 = t45 === e57.getMaxZoom(), o88 = t45 === e57.getMinZoom(); this._zoomInButton.disabled = i26, this._zoomOutButton.disabled = o88, this._zoomInButton.setAttribute("aria-disabled", i26.toString()), this._zoomOutButton.setAttribute("aria-disabled", o88.toString()); } _rotateCompassArrow() { const e57 = this._map; if (!e57) return; const t45 = this.options.visualizePitch ? `scale(${1 / Math.pow(Math.cos(e57.transform.pitch * (Math.PI / 180)), 0.5)}) rotateX(${e57.transform.pitch}deg) rotateZ(${e57.transform.angle * (180 / Math.PI)}deg)` : `rotate(${e57.transform.angle * (180 / Math.PI)}deg)`; e57._requestDomTask((() => { this._compassIcon && (this._compassIcon.style.transform = t45); })); } onAdd(e57) { return this._map = e57, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), e57.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && e57.on("pitch", this._rotateCompassArrow), e57.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new Il(e57, this._compass, this.options.visualizePitch)), this._container; } onRemove() { const e57 = this._map; e57 && (this._container.remove(), this.options.showZoom && e57.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && e57.off("pitch", this._rotateCompassArrow), e57.off("rotate", this._rotateCompassArrow), this._handler && this._handler.off(), this._handler = void 0), this._map = void 0); } _createButton(e57, t45) { const i26 = l20("button", e57, this._container); return i26.type = "button", i26.addEventListener("click", t45), i26; } _setButtonTitle(e57, t45) { if (!this._map) return; const i26 = this._map._getUIString(`NavigationControl.${t45}`); e57.setAttribute("aria-label", i26), e57.firstElementChild && e57.firstElementChild.setAttribute("title", i26); } }, GeolocateControl: class extends e56.E { constructor(t45 = {}) { super(); const i26 = navigator.geolocation; this.options = Object.assign({ geolocation: i26 }, Ll, t45), e56.aY(["_onSuccess", "_onError", "_onZoom", "_finish", "_setupUI", "_updateCamera", "_updateMarker", "_updateMarkerRotation", "_onDeviceOrientation"], this), this._updateMarkerRotationThrottled = pa(this._updateMarkerRotation, 20), this._numberOfWatches = 0; } onAdd(e57) { return this._map = e57, this._container = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkGeolocationSupport(this._setupUI), this._container; } onRemove() { void 0 !== this._geolocationWatchID && (this.options.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), this._container.remove(), this._map.off("zoom", this._onZoom), this._map = void 0, this._numberOfWatches = 0, this._noTimeout = false; } _checkGeolocationSupport(e57) { const t45 = (t46 = !!this.options.geolocation) => { this._supportsGeolocation = t46, e57(t46); }; void 0 !== this._supportsGeolocation ? e57(this._supportsGeolocation) : void 0 !== navigator.permissions ? navigator.permissions.query({ name: "geolocation" }).then(((e58) => t45("denied" !== e58.state))).catch((() => t45())) : t45(); } _isOutOfMapMaxBounds(e57) { const t45 = this._map.getMaxBounds(), i26 = e57.coords; return !!t45 && (i26.longitude < t45.getWest() || i26.longitude > t45.getEast() || i26.latitude < t45.getSouth() || i26.latitude > t45.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(t45) { if (this._map) { if (this._isOutOfMapMaxBounds(t45)) return this._setErrorState(), this.fire(new e56.z("outofmaxbounds", t45)), this._updateMarker(), void this._finish(); if (this.options.trackUserLocation) switch (this._lastKnownPosition = t45, 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(t45), this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(t45), this.options.showUserLocation && this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"), this.fire(new e56.z("geolocate", t45)), this._finish(); } } _updateCamera(t45) { const i26 = new e56.aR(t45.coords.longitude, t45.coords.latitude), o88 = t45.coords.accuracy, s18 = this._map.getBearing(), r86 = Object.assign({ bearing: s18 }, this.options.fitBoundsOptions); this._map.fitBounds(i26.toBounds(o88), r86, { geolocateSource: true }); } _updateMarker(t45) { if (t45) { const i26 = new e56.aR(t45.coords.longitude, t45.coords.latitude); this._accuracyCircleMarker.setLngLat(i26).addTo(this._map), this._userLocationDotMarker.setLngLat(i26).addTo(this._map), this._accuracy = t45.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove(); } _updateCircleRadius() { const t45 = this._map.transform, i26 = e56.ce(1, t45._center.lat) * t45.worldSize, o88 = Math.ceil(2 * this._accuracy * i26); this._circleElement.style.width = `${o88}px`, this._circleElement.style.height = `${o88}px`; } _onZoom() { this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); } _updateMarkerRotation() { this._userLocationDotMarker && "number" == typeof this._heading ? (this._userLocationDotMarker.setRotation(this._heading), this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")) : (this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"), this._userLocationDotMarker.setRotation(0)); } _onError(t45) { if (this._map) { if (this.options.trackUserLocation) if (1 === t45.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 = true; const e57 = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.setAttribute("aria-label", e57), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e57), void 0 !== this._geolocationWatchID && this._clearWatch(); } else { if (3 === t45.code && this._noTimeout) return; this._setErrorState(); } "OFF" !== this._watchState && this.options.showUserLocation && this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"), this.fire(new e56.z("error", t45)), this._finish(); } } _finish() { this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0; } _setupUI(t45) { if (void 0 !== this._map) { if (this._container.addEventListener("contextmenu", ((e57) => e57.preventDefault())), this._geolocateButton = l20("button", "mapboxgl-ctrl-geolocate", this._container), l20("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", false === t45) { e56.w("Geolocation support is not available so the GeolocateControl will be disabled."); const t46 = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.disabled = true, this._geolocateButton.setAttribute("aria-label", t46), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", t46); } else { const e57 = this._map._getUIString("GeolocateControl.FindMyLocation"); this._geolocateButton.setAttribute("aria-label", e57), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", e57); } this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = l20("div", "mapboxgl-user-location"), this._dotElement.appendChild(l20("div", "mapboxgl-user-location-dot")), this._dotElement.appendChild(l20("div", "mapboxgl-user-location-heading")), this._userLocationDotMarker = new Dl({ element: this._dotElement, rotationAlignment: "map", pitchAlignment: "map" }), this._circleElement = l20("div", "mapboxgl-user-location-accuracy-circle"), this._accuracyCircleMarker = new Dl({ element: this._circleElement, pitchAlignment: "map" }), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("zoom", this._onZoom)), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = true, this.options.trackUserLocation && this._map.on("movestart", ((t46) => { t46.geolocateSource || "ACTIVE_LOCK" !== this._watchState || t46.originalEvent && "resize" === t46.originalEvent.type || (this._watchState = "BACKGROUND", this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this.fire(new e56.z("trackuserlocationend"))); })); } } _onDeviceOrientation(e57) { this._userLocationDotMarker && (e57.webkitCompassHeading ? this._heading = e57.webkitCompassHeading : true === e57.absolute && (this._heading = -1 * e57.alpha), this._updateMarkerRotationThrottled()); } trigger() { if (!this._setup) return e56.w("Geolocate control triggered before added to a map"), false; if (this.options.trackUserLocation) { switch (this._watchState) { case "OFF": this._watchState = "WAITING_ACTIVE", this.fire(new e56.z("trackuserlocationstart")); break; case "WAITING_ACTIVE": case "ACTIVE_LOCK": case "ACTIVE_ERROR": case "BACKGROUND_ERROR": this._numberOfWatches--, this._noTimeout = false, 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 e56.z("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 e56.z("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 e57; this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), this._numberOfWatches++, this._numberOfWatches > 1 ? (e57 = { maximumAge: 6e5, timeout: 0 }, this._noTimeout = true) : (e57 = this.options.positionOptions, this._noTimeout = false), this._geolocationWatchID = this.options.geolocation.watchPosition(this._onSuccess, this._onError, e57), this.options.showUserHeading && this._addDeviceOrientationListener(); } } else this.options.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = window.setTimeout(this._finish, 1e4); return true; } _addDeviceOrientationListener() { const e57 = () => { "ondeviceorientationabsolute" in window ? window.addEventListener("deviceorientationabsolute", this._onDeviceOrientation) : window.addEventListener("deviceorientation", this._onDeviceOrientation); }; "undefined" != typeof DeviceMotionEvent && "function" == typeof DeviceMotionEvent.requestPermission ? DeviceOrientationEvent.requestPermission().then(((t45) => { "granted" === t45 && e57(); })).catch(console.error) : e57(); } _clearWatch() { this.options.geolocation.clearWatch(this._geolocationWatchID), window.removeEventListener("deviceorientation", this._onDeviceOrientation), window.removeEventListener("deviceorientationabsolute", this._onDeviceOrientation), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null); } }, AttributionControl: fl, ScaleControl: class { constructor(t45 = {}) { this.options = Object.assign({}, Pl, t45), this._isNumberFormatSupported = (function() { try { return new Intl.NumberFormat("en", { style: "unit", unitDisplay: "short", unit: "meter" }), true; } catch (e57) { return false; } })(), e56.aY(["_update", "_setScale", "setUnit"], this); } getDefaultPosition() { return "bottom-left"; } _update() { const e57 = this.options.maxWidth || 100, t45 = this._map, i26 = t45._containerHeight / 2, o88 = t45._containerWidth / 2 - e57 / 2, s18 = t45.unproject([o88, i26]), r86 = t45.unproject([o88 + e57, i26]), n45 = s18.distanceTo(r86); if ("imperial" === this.options.unit) { const t46 = 3.2808 * n45; t46 > 5280 ? this._setScale(e57, t46 / 5280, "mile") : this._setScale(e57, t46, "foot"); } else "nautical" === this.options.unit ? this._setScale(e57, n45 / 1852, "nautical-mile") : n45 >= 1e3 ? this._setScale(e57, n45 / 1e3, "kilometer") : this._setScale(e57, n45, "meter"); } _setScale(e57, t45, i26) { this._map._requestDomTask((() => { const o88 = (function(e58) { const t46 = Math.pow(10, `${Math.floor(e58)}`.length - 1); let i27 = e58 / t46; return i27 = i27 >= 10 ? 10 : i27 >= 5 ? 5 : i27 >= 3 ? 3 : i27 >= 2 ? 2 : i27 >= 1 ? 1 : (function(e59) { const t47 = Math.pow(10, Math.ceil(-Math.log(e59) / Math.LN10)); return Math.round(e59 * t47) / t47; })(i27), t46 * i27; })(t45), s18 = o88 / t45; this._container.innerHTML = this._isNumberFormatSupported && "nautical-mile" !== i26 ? new Intl.NumberFormat(this._language, { style: "unit", unitDisplay: "short", unit: i26 }).format(o88) : `${o88} ${zl[i26]}`, this._container.style.width = e57 * s18 + "px"; })); } onAdd(e57) { return this._map = e57, this._language = e57.getLanguage(), this._container = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", e57.getContainer()), this._container.dir = "auto", this._map.on("move", this._update), this._update(), this._container; } onRemove() { this._container.remove(), this._map.off("move", this._update), this._map = void 0; } _setLanguage(e57) { this._language = e57, this._update(); } setUnit(e57) { this.options.unit = e57, this._update(); } }, FullscreenControl: class { constructor(t45 = {}) { this._fullscreen = false, t45 && t45.container && (t45.container instanceof HTMLElement ? this._container = t45.container : e56.w("Full screen control 'container' must be a DOM element.")), e56.aY(["_onClickFullscreen", "_changeIcon"], this), "onfullscreenchange" in document ? this._fullscreenchange = "fullscreenchange" : "onwebkitfullscreenchange" in document && (this._fullscreenchange = "webkitfullscreenchange"); } onAdd(t45) { return this._map = t45, this._container || (this._container = this._map.getContainer()), this._controlContainer = l20("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none", e56.w("This device does not support fullscreen mode.")), this._controlContainer; } onRemove() { this._controlContainer.remove(), this._map = null, document.removeEventListener(this._fullscreenchange, this._changeIcon); } _checkFullscreenSupport() { return !(!document.fullscreenEnabled && !document.webkitFullscreenEnabled); } _setupUI() { const e57 = this._fullscreenButton = l20("button", "mapboxgl-ctrl-fullscreen", this._controlContainer); l20("span", "mapboxgl-ctrl-icon", e57).setAttribute("aria-hidden", "true"), e57.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), document.addEventListener(this._fullscreenchange, this._changeIcon); } _updateTitle() { const e57 = this._getTitle(); this._fullscreenButton.setAttribute("aria-label", e57), this._fullscreenButton.firstElementChild && this._fullscreenButton.firstElementChild.setAttribute("title", e57); } _getTitle() { return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter"); } _isFullscreen() { return this._fullscreen; } _changeIcon() { (document.fullscreenElement || 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() ? document.exitFullscreen ? document.exitFullscreen() : document.webkitCancelFullScreen && document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen(); } }, IndoorControl: gl, Popup: class extends e56.E { constructor(t45) { super(), this.options = Object.assign(Object.create(Ol), t45), this._altitude = this.options.altitude, e56.aY(["_update", "_onClose", "remove", "_onMouseEvent"], this), this._classList = new Set(t45 && t45.className ? t45.className.trim().split(/\s+/) : []); } addTo(t45) { return this._map && this.remove(), this._map = t45, this.options.closeOnClick && t45.on("preclick", this._onClose), this.options.closeOnMove && t45.on("move", this._onClose), t45.on("remove", this.remove), this._update(), t45._addPopup(this), this._focusFirstElement(), this._trackPointer ? (t45.on("mousemove", this._onMouseEvent), t45.on("mouseup", this._onMouseEvent), t45._canvasContainer.classList.add("mapboxgl-track-pointer")) : t45.on("move", this._update), this.fire(new e56.z("open")), this; } isOpen() { return !!this._map; } remove() { this._content && this._content.remove(), this._container && (this._container.remove(), this._container = void 0); const t45 = this._map; return t45 && (t45.off("move", this._update), t45.off("move", this._onClose), t45.off("preclick", this._onClose), t45.off("click", this._onClose), t45.off("remove", this.remove), t45.off("mousemove", this._onMouseEvent), t45.off("mouseup", this._onMouseEvent), t45.off("drag", this._onMouseEvent), t45._canvasContainer && t45._canvasContainer.classList.remove("mapboxgl-track-pointer"), t45._removePopup(this), this._map = void 0), this.fire(new e56.z("close")), this; } getLngLat() { return this._lngLat; } setLngLat(t45) { this._lngLat = e56.aR.convert(t45), this._pos = null, this._trackPointer = false, this._update(); const i26 = this._map; return i26 && (i26.on("move", this._update), i26.off("mousemove", this._onMouseEvent), i26._canvasContainer.classList.remove("mapboxgl-track-pointer")), this; } getAltitude() { return this._altitude; } setAltitude(e57) { return this._altitude = e57, this._update(), this; } trackPointer() { this._trackPointer = true, this._pos = null, this._update(); const e57 = this._map; return e57 && (e57.off("move", this._update), e57.on("mousemove", this._onMouseEvent), e57.on("drag", this._onMouseEvent), e57._canvasContainer.classList.add("mapboxgl-track-pointer")), this; } getElement() { return this._container; } setText(e57) { return this.setDOMContent(document.createTextNode(e57)); } setHTML(e57) { const t45 = document.createDocumentFragment(), i26 = document.createElement("body"); let o88; for (i26.innerHTML = e57; o88 = i26.firstChild, o88; ) t45.appendChild(o88); return this.setDOMContent(t45); } getMaxWidth() { return this._container && this._container.style.maxWidth; } setMaxWidth(e57) { return this.options.maxWidth = e57, this._update(), this; } setDOMContent(e57) { let t45 = this._content; if (t45) for (; t45.hasChildNodes(); ) t45.firstChild && t45.removeChild(t45.firstChild); else t45 = this._content = l20("div", "mapboxgl-popup-content", this._container || void 0); if (t45.appendChild(e57), this.options.closeButton) { const e58 = this._closeButton = l20("button", "mapboxgl-popup-close-button", t45); e58.type = "button", e58.setAttribute("aria-label", "Close popup"), e58.innerHTML = '', e58.addEventListener("click", this._onClose); } return this._update(), this._focusFirstElement(), this; } addClassName(e57) { return this._classList.add(e57), this._updateClassList(), this; } removeClassName(e57) { return this._classList.delete(e57), this._updateClassList(), this; } setOffset(e57) { return this.options.offset = e57, this._update(), this; } toggleClassName(e57) { let t45; return this._classList.delete(e57) ? t45 = false : (this._classList.add(e57), t45 = true), this._updateClassList(), t45; } _onMouseEvent(e57) { this._update(e57.point); } _getAnchor(e57) { if (this.options.anchor) return this.options.anchor; const t45 = this._map, i26 = this._container, o88 = this._pos; if (!t45 || !i26 || !o88) return "bottom"; const s18 = i26.offsetWidth, r86 = i26.offsetHeight, n45 = o88.x < s18 / 2, a46 = o88.x > t45.transform.width - s18 / 2; if (o88.y + e57 < r86) return n45 ? "top-left" : a46 ? "top-right" : "top"; if (o88.y > t45.transform.height - r86) { if (n45) return "bottom-left"; if (a46) return "bottom-right"; } return n45 ? "left" : a46 ? "right" : "bottom"; } _updateClassList() { const e57 = this._container; if (!e57) return; const t45 = [...this._classList]; t45.push("mapboxgl-popup"), this._anchor && t45.push(`mapboxgl-popup-anchor-${this._anchor}`), this._trackPointer && t45.push("mapboxgl-popup-track-pointer"), e57.className = t45.join(" "); } _update(t45) { const i26 = this._map, o88 = this._content; if (!i26 || !this._lngLat && !this._trackPointer || !o88) return; let s18 = this._container; if (s18 || (s18 = this._container = l20("div", "mapboxgl-popup", i26.getContainer()), this._tip = l20("div", "mapboxgl-popup-tip", s18), s18.appendChild(o88)), this.options.maxWidth && s18.style.maxWidth !== this.options.maxWidth && (s18.style.maxWidth = this.options.maxWidth), i26.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = Cl(this._lngLat, this._pos, i26.transform)), !this._trackPointer || t45) { const o89 = this._pos = this._trackPointer && t45 instanceof e56.P ? t45 : i26.project(this._lngLat, this._altitude), s19 = Fl(this.options.offset), r86 = this._anchor = this._getAnchor(s19.y), n45 = Fl(this.options.offset, r86), a46 = o89.add(n45).round(); i26._requestDomTask((() => { this._container && r86 && (this._container.style.transform = `${Rl[r86]} translate(${a46.x}px,${a46.y}px)`); })); } if (!this._marker && i26._showingGlobe()) { const t46 = e56.eY(i26.transform, this._lngLat) ? 0 : 1; this._setOpacity(t46); } this._updateClassList(); } _focusFirstElement() { if (!this.options.focusAfterOpen || !this._container) return; const e57 = this._container.querySelector(Ml); e57 && e57.focus(); } _onClose() { this.remove(); } _setOpacity(e57) { this._container && (this._container.style.opacity = `${e57}`), this._content && (this._content.style.pointerEvents = e57 ? "auto" : "none"); } }, Marker: Dl, Style: To, LngLat: e56.aR, LngLatBounds: e56.aI, Point: e56.P, MercatorCoordinate: e56.ae, FreeCameraOptions: Yi, Evented: e56.E, config: e56.e, prewarm: e56.f0, clearPrewarmedResources: e56.e$, get accessToken() { return e56.e.ACCESS_TOKEN; }, set accessToken(t45) { e56.e.ACCESS_TOKEN = t45; }, get baseApiUrl() { return e56.e.API_URL; }, set baseApiUrl(t45) { e56.e.API_URL = t45; }, get workerCount() { return e56.f9.workerCount; }, set workerCount(t45) { e56.f9.workerCount = t45; }, get maxParallelImageRequests() { return e56.e.MAX_PARALLEL_IMAGE_REQUESTS; }, set maxParallelImageRequests(t45) { e56.e.MAX_PARALLEL_IMAGE_REQUESTS = t45; }, clearStorage(t45) { e56.f8(t45); }, get workerUrl() { return e56.f7.workerUrl; }, set workerUrl(t45) { e56.f7.workerUrl = t45; }, get workerClass() { return e56.f7.workerClass; }, set workerClass(t45) { e56.f7.workerClass = t45; }, get workerParams() { return e56.f7.workerParams; }, set workerParams(t45) { e56.f7.workerParams = t45; }, get dracoUrl() { return e56.f6(); }, set dracoUrl(t45) { e56.f5(t45); }, get meshoptUrl() { return e56.f4(); }, set meshoptUrl(t45) { e56.f3(t45); }, setNow: e56.o.setNow, restoreNow: e56.o.restoreNow }; return Bl; })); var mapboxgl$1 = mapboxgl2; return mapboxgl$1; })); } }); // node_modules/file-saver/dist/FileSaver.min.js var require_FileSaver_min = __commonJS({ "node_modules/file-saver/dist/FileSaver.min.js"(exports, module) { "use strict"; (function(a45, b7) { if ("function" == typeof define && define.amd) define([], b7); else if ("undefined" != typeof exports) b7(); else { b7(), a45.FileSaver = { exports: {} }.exports; } })(exports, function() { "use strict"; function b7(a46, b8) { return "undefined" == typeof b8 ? b8 = { autoBom: false } : "object" != typeof b8 && (console.warn("Deprecated: Expected third argument to be a object"), b8 = { autoBom: !b8 }), b8.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a46.type) ? new Blob(["\uFEFF", a46], { type: a46.type }) : a46; } function c27(a46, b8, c28) { var d34 = new XMLHttpRequest(); d34.open("GET", a46), d34.responseType = "blob", d34.onload = function() { g8(d34.response, b8, c28); }, d34.onerror = function() { console.error("could not download file"); }, d34.send(); } function d33(a46) { var b8 = new XMLHttpRequest(); b8.open("HEAD", a46, false); try { b8.send(); } catch (a47) { } return 200 <= b8.status && 299 >= b8.status; } function e56(a46) { try { a46.dispatchEvent(new MouseEvent("click")); } catch (c28) { var b8 = document.createEvent("MouseEvents"); b8.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null), a46.dispatchEvent(b8); } } var f7 = "object" == typeof window && window.window === window ? window : "object" == typeof self && self.self === self ? self : "object" == typeof global && global.global === global ? global : void 0, a45 = f7.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), g8 = f7.saveAs || ("object" != typeof window || window !== f7 ? function() { } : "download" in HTMLAnchorElement.prototype && !a45 ? function(b8, g9, h7) { var i25 = f7.URL || f7.webkitURL, j3 = document.createElement("a"); g9 = g9 || b8.name || "download", j3.download = g9, j3.rel = "noopener", "string" == typeof b8 ? (j3.href = b8, j3.origin === location.origin ? e56(j3) : d33(j3.href) ? c27(b8, g9, h7) : e56(j3, j3.target = "_blank")) : (j3.href = i25.createObjectURL(b8), setTimeout(function() { i25.revokeObjectURL(j3.href); }, 4e4), setTimeout(function() { e56(j3); }, 0)); } : "msSaveOrOpenBlob" in navigator ? function(f8, g9, h7) { if (g9 = g9 || f8.name || "download", "string" != typeof f8) navigator.msSaveOrOpenBlob(b7(f8, h7), g9); else if (d33(f8)) c27(f8, g9, h7); else { var i25 = document.createElement("a"); i25.href = f8, i25.target = "_blank", setTimeout(function() { e56(i25); }); } } : function(b8, d34, e57, g9) { if (g9 = g9 || open("", "_blank"), g9 && (g9.document.title = g9.document.body.innerText = "downloading..."), "string" == typeof b8) return c27(b8, d34, e57); var h7 = "application/octet-stream" === b8.type, i25 = /constructor/i.test(f7.HTMLElement) || f7.safari, j3 = /CriOS\/[\d]+/.test(navigator.userAgent); if ((j3 || h7 && i25 || a45) && "undefined" != typeof FileReader) { var k6 = new FileReader(); k6.onloadend = function() { var a46 = k6.result; a46 = j3 ? a46 : a46.replace(/^data:[^;]*;/, "data:attachment/file;"), g9 ? g9.location.href = a46 : location = a46, g9 = null; }, k6.readAsDataURL(b8); } else { var l20 = f7.URL || f7.webkitURL, m5 = l20.createObjectURL(b8); g9 ? g9.location = m5 : location.href = m5, g9 = null, setTimeout(function() { l20.revokeObjectURL(m5); }, 4e4); } }); f7.saveAs = g8.saveAs = g8, "undefined" != typeof module && (module.exports = g8); }); } }); // node_modules/jszip/dist/jszip.min.js var require_jszip_min = __commonJS({ "node_modules/jszip/dist/jszip.min.js"(exports, module) { "use strict"; !(function(e56) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e56(); else if ("function" == typeof define && define.amd) define([], e56); else { ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e56(); } })(function() { return (function s17(a45, o87, h7) { function u11(r85, e57) { if (!o87[r85]) { if (!a45[r85]) { var t44 = "function" == typeof __require && __require; if (!e57 && t44) return t44(r85, true); if (l20) return l20(r85, true); var n44 = new Error("Cannot find module '" + r85 + "'"); throw n44.code = "MODULE_NOT_FOUND", n44; } var i25 = o87[r85] = { exports: {} }; a45[r85][0].call(i25.exports, function(e58) { var t45 = a45[r85][1][e58]; return u11(t45 || e58); }, i25, i25.exports, s17, a45, o87, h7); } return o87[r85].exports; } for (var l20 = "function" == typeof __require && __require, e56 = 0; e56 < h7.length; e56++) u11(h7[e56]); return u11; })({ 1: [function(e56, t44, r85) { "use strict"; var d33 = e56("./utils"), c27 = e56("./support"), p8 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; r85.encode = function(e57) { for (var t45, r86, n44, i25, s17, a45, o87, h7 = [], u11 = 0, l20 = e57.length, f7 = l20, c28 = "string" !== d33.getTypeOf(e57); u11 < e57.length; ) f7 = l20 - u11, n44 = c28 ? (t45 = e57[u11++], r86 = u11 < l20 ? e57[u11++] : 0, u11 < l20 ? e57[u11++] : 0) : (t45 = e57.charCodeAt(u11++), r86 = u11 < l20 ? e57.charCodeAt(u11++) : 0, u11 < l20 ? e57.charCodeAt(u11++) : 0), i25 = t45 >> 2, s17 = (3 & t45) << 4 | r86 >> 4, a45 = 1 < f7 ? (15 & r86) << 2 | n44 >> 6 : 64, o87 = 2 < f7 ? 63 & n44 : 64, h7.push(p8.charAt(i25) + p8.charAt(s17) + p8.charAt(a45) + p8.charAt(o87)); return h7.join(""); }, r85.decode = function(e57) { var t45, r86, n44, i25, s17, a45, o87 = 0, h7 = 0, u11 = "data:"; if (e57.substr(0, u11.length) === u11) throw new Error("Invalid base64 input, it looks like a data url."); var l20, f7 = 3 * (e57 = e57.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4; if (e57.charAt(e57.length - 1) === p8.charAt(64) && f7--, e57.charAt(e57.length - 2) === p8.charAt(64) && f7--, f7 % 1 != 0) throw new Error("Invalid base64 input, bad content length."); for (l20 = c27.uint8array ? new Uint8Array(0 | f7) : new Array(0 | f7); o87 < e57.length; ) t45 = p8.indexOf(e57.charAt(o87++)) << 2 | (i25 = p8.indexOf(e57.charAt(o87++))) >> 4, r86 = (15 & i25) << 4 | (s17 = p8.indexOf(e57.charAt(o87++))) >> 2, n44 = (3 & s17) << 6 | (a45 = p8.indexOf(e57.charAt(o87++))), l20[h7++] = t45, 64 !== s17 && (l20[h7++] = r86), 64 !== a45 && (l20[h7++] = n44); return l20; }; }, { "./support": 30, "./utils": 32 }], 2: [function(e56, t44, r85) { "use strict"; var n44 = e56("./external"), i25 = e56("./stream/DataWorker"), s17 = e56("./stream/Crc32Probe"), a45 = e56("./stream/DataLengthProbe"); function o87(e57, t45, r86, n45, i26) { this.compressedSize = e57, this.uncompressedSize = t45, this.crc32 = r86, this.compression = n45, this.compressedContent = i26; } o87.prototype = { getContentWorker: function() { var e57 = new i25(n44.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a45("data_length")), t45 = this; return e57.on("end", function() { if (this.streamInfo.data_length !== t45.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch"); }), e57; }, getCompressedWorker: function() { return new i25(n44.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression); } }, o87.createWorkerFrom = function(e57, t45, r86) { return e57.pipe(new s17()).pipe(new a45("uncompressedSize")).pipe(t45.compressWorker(r86)).pipe(new a45("compressedSize")).withStreamInfo("compression", t45); }, t44.exports = o87; }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e56, t44, r85) { "use strict"; var n44 = e56("./stream/GenericWorker"); r85.STORE = { magic: "\0\0", compressWorker: function() { return new n44("STORE compression"); }, uncompressWorker: function() { return new n44("STORE decompression"); } }, r85.DEFLATE = e56("./flate"); }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e56, t44, r85) { "use strict"; var n44 = e56("./utils"); var o87 = (function() { for (var e57, t45 = [], r86 = 0; r86 < 256; r86++) { e57 = r86; for (var n45 = 0; n45 < 8; n45++) e57 = 1 & e57 ? 3988292384 ^ e57 >>> 1 : e57 >>> 1; t45[r86] = e57; } return t45; })(); t44.exports = function(e57, t45) { return void 0 !== e57 && e57.length ? "string" !== n44.getTypeOf(e57) ? (function(e58, t46, r86, n45) { var i25 = o87, s17 = n45 + r86; e58 ^= -1; for (var a45 = n45; a45 < s17; a45++) e58 = e58 >>> 8 ^ i25[255 & (e58 ^ t46[a45])]; return -1 ^ e58; })(0 | t45, e57, e57.length, 0) : (function(e58, t46, r86, n45) { var i25 = o87, s17 = n45 + r86; e58 ^= -1; for (var a45 = n45; a45 < s17; a45++) e58 = e58 >>> 8 ^ i25[255 & (e58 ^ t46.charCodeAt(a45))]; return -1 ^ e58; })(0 | t45, e57, e57.length, 0) : 0; }; }, { "./utils": 32 }], 5: [function(e56, t44, r85) { "use strict"; r85.base64 = false, r85.binary = false, r85.dir = false, r85.createFolders = true, r85.date = null, r85.compression = null, r85.compressionOptions = null, r85.comment = null, r85.unixPermissions = null, r85.dosPermissions = null; }, {}], 6: [function(e56, t44, r85) { "use strict"; var n44 = null; n44 = "undefined" != typeof Promise ? Promise : e56("lie"), t44.exports = { Promise: n44 }; }, { lie: 37 }], 7: [function(e56, t44, r85) { "use strict"; var n44 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i25 = e56("pako"), s17 = e56("./utils"), a45 = e56("./stream/GenericWorker"), o87 = n44 ? "uint8array" : "array"; function h7(e57, t45) { a45.call(this, "FlateWorker/" + e57), this._pako = null, this._pakoAction = e57, this._pakoOptions = t45, this.meta = {}; } r85.magic = "\b\0", s17.inherits(h7, a45), h7.prototype.processChunk = function(e57) { this.meta = e57.meta, null === this._pako && this._createPako(), this._pako.push(s17.transformTo(o87, e57.data), false); }, h7.prototype.flush = function() { a45.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true); }, h7.prototype.cleanUp = function() { a45.prototype.cleanUp.call(this), this._pako = null; }, h7.prototype._createPako = function() { this._pako = new i25[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 }); var t45 = this; this._pako.onData = function(e57) { t45.push({ data: e57, meta: t45.meta }); }; }, r85.compressWorker = function(e57) { return new h7("Deflate", e57); }, r85.uncompressWorker = function() { return new h7("Inflate", {}); }; }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e56, t44, r85) { "use strict"; function A3(e57, t45) { var r86, n45 = ""; for (r86 = 0; r86 < t45; r86++) n45 += String.fromCharCode(255 & e57), e57 >>>= 8; return n45; } function n44(e57, t45, r86, n45, i26, s18) { var a45, o87, h7 = e57.file, u11 = e57.compression, l20 = s18 !== O3.utf8encode, f7 = I3.transformTo("string", s18(h7.name)), c27 = I3.transformTo("string", O3.utf8encode(h7.name)), d33 = h7.comment, p8 = I3.transformTo("string", s18(d33)), m5 = I3.transformTo("string", O3.utf8encode(d33)), _3 = c27.length !== h7.name.length, g8 = m5.length !== d33.length, b7 = "", v7 = "", y3 = "", w3 = h7.dir, k6 = h7.date, x3 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 }; t45 && !r86 || (x3.crc32 = e57.crc32, x3.compressedSize = e57.compressedSize, x3.uncompressedSize = e57.uncompressedSize); var S4 = 0; t45 && (S4 |= 8), l20 || !_3 && !g8 || (S4 |= 2048); var z3 = 0, C5 = 0; w3 && (z3 |= 16), "UNIX" === i26 ? (C5 = 798, z3 |= (function(e58, t46) { var r87 = e58; return e58 || (r87 = t46 ? 16893 : 33204), (65535 & r87) << 16; })(h7.unixPermissions, w3)) : (C5 = 20, z3 |= (function(e58) { return 63 & (e58 || 0); })(h7.dosPermissions)), a45 = k6.getUTCHours(), a45 <<= 6, a45 |= k6.getUTCMinutes(), a45 <<= 5, a45 |= k6.getUTCSeconds() / 2, o87 = k6.getUTCFullYear() - 1980, o87 <<= 4, o87 |= k6.getUTCMonth() + 1, o87 <<= 5, o87 |= k6.getUTCDate(), _3 && (v7 = A3(1, 1) + A3(B5(f7), 4) + c27, b7 += "up" + A3(v7.length, 2) + v7), g8 && (y3 = A3(1, 1) + A3(B5(p8), 4) + m5, b7 += "uc" + A3(y3.length, 2) + y3); var E4 = ""; return E4 += "\n\0", E4 += A3(S4, 2), E4 += u11.magic, E4 += A3(a45, 2), E4 += A3(o87, 2), E4 += A3(x3.crc32, 4), E4 += A3(x3.compressedSize, 4), E4 += A3(x3.uncompressedSize, 4), E4 += A3(f7.length, 2), E4 += A3(b7.length, 2), { fileRecord: R4.LOCAL_FILE_HEADER + E4 + f7 + b7, dirRecord: R4.CENTRAL_FILE_HEADER + A3(C5, 2) + E4 + A3(p8.length, 2) + "\0\0\0\0" + A3(z3, 4) + A3(n45, 4) + f7 + b7 + p8 }; } var I3 = e56("../utils"), i25 = e56("../stream/GenericWorker"), O3 = e56("../utf8"), B5 = e56("../crc32"), R4 = e56("../signature"); function s17(e57, t45, r86, n45) { i25.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t45, this.zipPlatform = r86, this.encodeFileName = n45, this.streamFiles = e57, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = []; } I3.inherits(s17, i25), s17.prototype.push = function(e57) { var t45 = e57.meta.percent || 0, r86 = this.entriesCount, n45 = this._sources.length; this.accumulate ? this.contentBuffer.push(e57) : (this.bytesWritten += e57.data.length, i25.prototype.push.call(this, { data: e57.data, meta: { currentFile: this.currentFile, percent: r86 ? (t45 + 100 * (r86 - n45 - 1)) / r86 : 100 } })); }, s17.prototype.openedSource = function(e57) { this.currentSourceOffset = this.bytesWritten, this.currentFile = e57.file.name; var t45 = this.streamFiles && !e57.file.dir; if (t45) { var r86 = n44(e57, t45, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); this.push({ data: r86.fileRecord, meta: { percent: 0 } }); } else this.accumulate = true; }, s17.prototype.closedSource = function(e57) { this.accumulate = false; var t45 = this.streamFiles && !e57.file.dir, r86 = n44(e57, t45, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); if (this.dirRecords.push(r86.dirRecord), t45) this.push({ data: (function(e58) { return R4.DATA_DESCRIPTOR + A3(e58.crc32, 4) + A3(e58.compressedSize, 4) + A3(e58.uncompressedSize, 4); })(e57), meta: { percent: 100 } }); else for (this.push({ data: r86.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift()); this.currentFile = null; }, s17.prototype.flush = function() { for (var e57 = this.bytesWritten, t45 = 0; t45 < this.dirRecords.length; t45++) this.push({ data: this.dirRecords[t45], meta: { percent: 100 } }); var r86 = this.bytesWritten - e57, n45 = (function(e58, t46, r87, n46, i26) { var s18 = I3.transformTo("string", i26(n46)); return R4.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A3(e58, 2) + A3(e58, 2) + A3(t46, 4) + A3(r87, 4) + A3(s18.length, 2) + s18; })(this.dirRecords.length, r86, e57, this.zipComment, this.encodeFileName); this.push({ data: n45, meta: { percent: 100 } }); }, s17.prototype.prepareNextSource = function() { this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume(); }, s17.prototype.registerPrevious = function(e57) { this._sources.push(e57); var t45 = this; return e57.on("data", function(e58) { t45.processChunk(e58); }), e57.on("end", function() { t45.closedSource(t45.previous.streamInfo), t45._sources.length ? t45.prepareNextSource() : t45.end(); }), e57.on("error", function(e58) { t45.error(e58); }), this; }, s17.prototype.resume = function() { return !!i25.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true)); }, s17.prototype.error = function(e57) { var t45 = this._sources; if (!i25.prototype.error.call(this, e57)) return false; for (var r86 = 0; r86 < t45.length; r86++) try { t45[r86].error(e57); } catch (e58) { } return true; }, s17.prototype.lock = function() { i25.prototype.lock.call(this); for (var e57 = this._sources, t45 = 0; t45 < e57.length; t45++) e57[t45].lock(); }, t44.exports = s17; }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e56, t44, r85) { "use strict"; var u11 = e56("../compressions"), n44 = e56("./ZipFileWorker"); r85.generateWorker = function(e57, a45, t45) { var o87 = new n44(a45.streamFiles, t45, a45.platform, a45.encodeFileName), h7 = 0; try { e57.forEach(function(e58, t46) { h7++; var r86 = (function(e59, t47) { var r87 = e59 || t47, n46 = u11[r87]; if (!n46) throw new Error(r87 + " is not a valid compression method !"); return n46; })(t46.options.compression, a45.compression), n45 = t46.options.compressionOptions || a45.compressionOptions || {}, i25 = t46.dir, s17 = t46.date; t46._compressWorker(r86, n45).withStreamInfo("file", { name: e58, dir: i25, date: s17, comment: t46.comment || "", unixPermissions: t46.unixPermissions, dosPermissions: t46.dosPermissions }).pipe(o87); }), o87.entriesCount = h7; } catch (e58) { o87.error(e58); } return o87; }; }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e56, t44, r85) { "use strict"; function n44() { if (!(this instanceof n44)) return new n44(); if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() { var e57 = new n44(); for (var t45 in this) "function" != typeof this[t45] && (e57[t45] = this[t45]); return e57; }; } (n44.prototype = e56("./object")).loadAsync = e56("./load"), n44.support = e56("./support"), n44.defaults = e56("./defaults"), n44.version = "3.10.1", n44.loadAsync = function(e57, t45) { return new n44().loadAsync(e57, t45); }, n44.external = e56("./external"), t44.exports = n44; }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e56, t44, r85) { "use strict"; var u11 = e56("./utils"), i25 = e56("./external"), n44 = e56("./utf8"), s17 = e56("./zipEntries"), a45 = e56("./stream/Crc32Probe"), l20 = e56("./nodejsUtils"); function f7(n45) { return new i25.Promise(function(e57, t45) { var r86 = n45.decompressed.getContentWorker().pipe(new a45()); r86.on("error", function(e58) { t45(e58); }).on("end", function() { r86.streamInfo.crc32 !== n45.decompressed.crc32 ? t45(new Error("Corrupted zip : CRC32 mismatch")) : e57(); }).resume(); }); } t44.exports = function(e57, o87) { var h7 = this; return o87 = u11.extend(o87 || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n44.utf8decode }), l20.isNode && l20.isStream(e57) ? i25.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u11.prepareContent("the loaded zip file", e57, true, o87.optimizedBinaryString, o87.base64).then(function(e58) { var t45 = new s17(o87); return t45.load(e58), t45; }).then(function(e58) { var t45 = [i25.Promise.resolve(e58)], r86 = e58.files; if (o87.checkCRC32) for (var n45 = 0; n45 < r86.length; n45++) t45.push(f7(r86[n45])); return i25.Promise.all(t45); }).then(function(e58) { for (var t45 = e58.shift(), r86 = t45.files, n45 = 0; n45 < r86.length; n45++) { var i26 = r86[n45], s18 = i26.fileNameStr, a46 = u11.resolve(i26.fileNameStr); h7.file(a46, i26.decompressed, { binary: true, optimizedBinaryString: true, date: i26.date, dir: i26.dir, comment: i26.fileCommentStr.length ? i26.fileCommentStr : null, unixPermissions: i26.unixPermissions, dosPermissions: i26.dosPermissions, createFolders: o87.createFolders }), i26.dir || (h7.file(a46).unsafeOriginalName = s18); } return t45.zipComment.length && (h7.comment = t45.zipComment), h7; }); }; }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e56, t44, r85) { "use strict"; var n44 = e56("../utils"), i25 = e56("../stream/GenericWorker"); function s17(e57, t45) { i25.call(this, "Nodejs stream input adapter for " + e57), this._upstreamEnded = false, this._bindStream(t45); } n44.inherits(s17, i25), s17.prototype._bindStream = function(e57) { var t45 = this; (this._stream = e57).pause(), e57.on("data", function(e58) { t45.push({ data: e58, meta: { percent: 0 } }); }).on("error", function(e58) { t45.isPaused ? this.generatedError = e58 : t45.error(e58); }).on("end", function() { t45.isPaused ? t45._upstreamEnded = true : t45.end(); }); }, s17.prototype.pause = function() { return !!i25.prototype.pause.call(this) && (this._stream.pause(), true); }, s17.prototype.resume = function() { return !!i25.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true); }, t44.exports = s17; }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e56, t44, r85) { "use strict"; var i25 = e56("readable-stream").Readable; function n44(e57, t45, r86) { i25.call(this, t45), this._helper = e57; var n45 = this; e57.on("data", function(e58, t46) { n45.push(e58) || n45._helper.pause(), r86 && r86(t46); }).on("error", function(e58) { n45.emit("error", e58); }).on("end", function() { n45.push(null); }); } e56("../utils").inherits(n44, i25), n44.prototype._read = function() { this._helper.resume(); }, t44.exports = n44; }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e56, t44, r85) { "use strict"; t44.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e57, t45) { if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(e57, t45); if ("number" == typeof e57) throw new Error('The "data" argument must not be a number'); return new Buffer(e57, t45); }, allocBuffer: function(e57) { if (Buffer.alloc) return Buffer.alloc(e57); var t45 = new Buffer(e57); return t45.fill(0), t45; }, isBuffer: function(e57) { return Buffer.isBuffer(e57); }, isStream: function(e57) { return e57 && "function" == typeof e57.on && "function" == typeof e57.pause && "function" == typeof e57.resume; } }; }, {}], 15: [function(e56, t44, r85) { "use strict"; function s17(e57, t45, r86) { var n45, i26 = u11.getTypeOf(t45), s18 = u11.extend(r86 || {}, f7); s18.date = s18.date || /* @__PURE__ */ new Date(), null !== s18.compression && (s18.compression = s18.compression.toUpperCase()), "string" == typeof s18.unixPermissions && (s18.unixPermissions = parseInt(s18.unixPermissions, 8)), s18.unixPermissions && 16384 & s18.unixPermissions && (s18.dir = true), s18.dosPermissions && 16 & s18.dosPermissions && (s18.dir = true), s18.dir && (e57 = g8(e57)), s18.createFolders && (n45 = _3(e57)) && b7.call(this, n45, true); var a46 = "string" === i26 && false === s18.binary && false === s18.base64; r86 && void 0 !== r86.binary || (s18.binary = !a46), (t45 instanceof c27 && 0 === t45.uncompressedSize || s18.dir || !t45 || 0 === t45.length) && (s18.base64 = false, s18.binary = true, t45 = "", s18.compression = "STORE", i26 = "string"); var o88 = null; o88 = t45 instanceof c27 || t45 instanceof l20 ? t45 : p8.isNode && p8.isStream(t45) ? new m5(e57, t45) : u11.prepareContent(e57, t45, s18.binary, s18.optimizedBinaryString, s18.base64); var h8 = new d33(e57, o88, s18); this.files[e57] = h8; } var i25 = e56("./utf8"), u11 = e56("./utils"), l20 = e56("./stream/GenericWorker"), a45 = e56("./stream/StreamHelper"), f7 = e56("./defaults"), c27 = e56("./compressedObject"), d33 = e56("./zipObject"), o87 = e56("./generate"), p8 = e56("./nodejsUtils"), m5 = e56("./nodejs/NodejsStreamInputAdapter"), _3 = function(e57) { "/" === e57.slice(-1) && (e57 = e57.substring(0, e57.length - 1)); var t45 = e57.lastIndexOf("/"); return 0 < t45 ? e57.substring(0, t45) : ""; }, g8 = function(e57) { return "/" !== e57.slice(-1) && (e57 += "/"), e57; }, b7 = function(e57, t45) { return t45 = void 0 !== t45 ? t45 : f7.createFolders, e57 = g8(e57), this.files[e57] || s17.call(this, e57, null, { dir: true, createFolders: t45 }), this.files[e57]; }; function h7(e57) { return "[object RegExp]" === Object.prototype.toString.call(e57); } var n44 = { load: function() { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }, forEach: function(e57) { var t45, r86, n45; for (t45 in this.files) n45 = this.files[t45], (r86 = t45.slice(this.root.length, t45.length)) && t45.slice(0, this.root.length) === this.root && e57(r86, n45); }, filter: function(r86) { var n45 = []; return this.forEach(function(e57, t45) { r86(e57, t45) && n45.push(t45); }), n45; }, file: function(e57, t45, r86) { if (1 !== arguments.length) return e57 = this.root + e57, s17.call(this, e57, t45, r86), this; if (h7(e57)) { var n45 = e57; return this.filter(function(e58, t46) { return !t46.dir && n45.test(e58); }); } var i26 = this.files[this.root + e57]; return i26 && !i26.dir ? i26 : null; }, folder: function(r86) { if (!r86) return this; if (h7(r86)) return this.filter(function(e58, t46) { return t46.dir && r86.test(e58); }); var e57 = this.root + r86, t45 = b7.call(this, e57), n45 = this.clone(); return n45.root = t45.name, n45; }, remove: function(r86) { r86 = this.root + r86; var e57 = this.files[r86]; if (e57 || ("/" !== r86.slice(-1) && (r86 += "/"), e57 = this.files[r86]), e57 && !e57.dir) delete this.files[r86]; else for (var t45 = this.filter(function(e58, t46) { return t46.name.slice(0, r86.length) === r86; }), n45 = 0; n45 < t45.length; n45++) delete this.files[t45[n45].name]; return this; }, generate: function() { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }, generateInternalStream: function(e57) { var t45, r86 = {}; try { if ((r86 = u11.extend(e57 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i25.utf8encode })).type = r86.type.toLowerCase(), r86.compression = r86.compression.toUpperCase(), "binarystring" === r86.type && (r86.type = "string"), !r86.type) throw new Error("No output type specified."); u11.checkSupport(r86.type), "darwin" !== r86.platform && "freebsd" !== r86.platform && "linux" !== r86.platform && "sunos" !== r86.platform || (r86.platform = "UNIX"), "win32" === r86.platform && (r86.platform = "DOS"); var n45 = r86.comment || this.comment || ""; t45 = o87.generateWorker(this, r86, n45); } catch (e58) { (t45 = new l20("error")).error(e58); } return new a45(t45, r86.type || "string", r86.mimeType); }, generateAsync: function(e57, t45) { return this.generateInternalStream(e57).accumulate(t45); }, generateNodeStream: function(e57, t45) { return (e57 = e57 || {}).type || (e57.type = "nodebuffer"), this.generateInternalStream(e57).toNodejsStream(t45); } }; t44.exports = n44; }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e56, t44, r85) { "use strict"; t44.exports = e56("stream"); }, { stream: void 0 }], 17: [function(e56, t44, r85) { "use strict"; var n44 = e56("./DataReader"); function i25(e57) { n44.call(this, e57); for (var t45 = 0; t45 < this.data.length; t45++) e57[t45] = 255 & e57[t45]; } e56("../utils").inherits(i25, n44), i25.prototype.byteAt = function(e57) { return this.data[this.zero + e57]; }, i25.prototype.lastIndexOfSignature = function(e57) { for (var t45 = e57.charCodeAt(0), r86 = e57.charCodeAt(1), n45 = e57.charCodeAt(2), i26 = e57.charCodeAt(3), s17 = this.length - 4; 0 <= s17; --s17) if (this.data[s17] === t45 && this.data[s17 + 1] === r86 && this.data[s17 + 2] === n45 && this.data[s17 + 3] === i26) return s17 - this.zero; return -1; }, i25.prototype.readAndCheckSignature = function(e57) { var t45 = e57.charCodeAt(0), r86 = e57.charCodeAt(1), n45 = e57.charCodeAt(2), i26 = e57.charCodeAt(3), s17 = this.readData(4); return t45 === s17[0] && r86 === s17[1] && n45 === s17[2] && i26 === s17[3]; }, i25.prototype.readData = function(e57) { if (this.checkOffset(e57), 0 === e57) return []; var t45 = this.data.slice(this.zero + this.index, this.zero + this.index + e57); return this.index += e57, t45; }, t44.exports = i25; }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e56, t44, r85) { "use strict"; var n44 = e56("../utils"); function i25(e57) { this.data = e57, this.length = e57.length, this.index = 0, this.zero = 0; } i25.prototype = { checkOffset: function(e57) { this.checkIndex(this.index + e57); }, checkIndex: function(e57) { if (this.length < this.zero + e57 || e57 < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e57 + "). Corrupted zip ?"); }, setIndex: function(e57) { this.checkIndex(e57), this.index = e57; }, skip: function(e57) { this.setIndex(this.index + e57); }, byteAt: function() { }, readInt: function(e57) { var t45, r86 = 0; for (this.checkOffset(e57), t45 = this.index + e57 - 1; t45 >= this.index; t45--) r86 = (r86 << 8) + this.byteAt(t45); return this.index += e57, r86; }, readString: function(e57) { return n44.transformTo("string", this.readData(e57)); }, readData: function() { }, lastIndexOfSignature: function() { }, readAndCheckSignature: function() { }, readDate: function() { var e57 = this.readInt(4); return new Date(Date.UTC(1980 + (e57 >> 25 & 127), (e57 >> 21 & 15) - 1, e57 >> 16 & 31, e57 >> 11 & 31, e57 >> 5 & 63, (31 & e57) << 1)); } }, t44.exports = i25; }, { "../utils": 32 }], 19: [function(e56, t44, r85) { "use strict"; var n44 = e56("./Uint8ArrayReader"); function i25(e57) { n44.call(this, e57); } e56("../utils").inherits(i25, n44), i25.prototype.readData = function(e57) { this.checkOffset(e57); var t45 = this.data.slice(this.zero + this.index, this.zero + this.index + e57); return this.index += e57, t45; }, t44.exports = i25; }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e56, t44, r85) { "use strict"; var n44 = e56("./DataReader"); function i25(e57) { n44.call(this, e57); } e56("../utils").inherits(i25, n44), i25.prototype.byteAt = function(e57) { return this.data.charCodeAt(this.zero + e57); }, i25.prototype.lastIndexOfSignature = function(e57) { return this.data.lastIndexOf(e57) - this.zero; }, i25.prototype.readAndCheckSignature = function(e57) { return e57 === this.readData(4); }, i25.prototype.readData = function(e57) { this.checkOffset(e57); var t45 = this.data.slice(this.zero + this.index, this.zero + this.index + e57); return this.index += e57, t45; }, t44.exports = i25; }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e56, t44, r85) { "use strict"; var n44 = e56("./ArrayReader"); function i25(e57) { n44.call(this, e57); } e56("../utils").inherits(i25, n44), i25.prototype.readData = function(e57) { if (this.checkOffset(e57), 0 === e57) return new Uint8Array(0); var t45 = this.data.subarray(this.zero + this.index, this.zero + this.index + e57); return this.index += e57, t45; }, t44.exports = i25; }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e56, t44, r85) { "use strict"; var n44 = e56("../utils"), i25 = e56("../support"), s17 = e56("./ArrayReader"), a45 = e56("./StringReader"), o87 = e56("./NodeBufferReader"), h7 = e56("./Uint8ArrayReader"); t44.exports = function(e57) { var t45 = n44.getTypeOf(e57); return n44.checkSupport(t45), "string" !== t45 || i25.uint8array ? "nodebuffer" === t45 ? new o87(e57) : i25.uint8array ? new h7(n44.transformTo("uint8array", e57)) : new s17(n44.transformTo("array", e57)) : new a45(e57); }; }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e56, t44, r85) { "use strict"; r85.LOCAL_FILE_HEADER = "PK", r85.CENTRAL_FILE_HEADER = "PK", r85.CENTRAL_DIRECTORY_END = "PK", r85.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r85.ZIP64_CENTRAL_DIRECTORY_END = "PK", r85.DATA_DESCRIPTOR = "PK\x07\b"; }, {}], 24: [function(e56, t44, r85) { "use strict"; var n44 = e56("./GenericWorker"), i25 = e56("../utils"); function s17(e57) { n44.call(this, "ConvertWorker to " + e57), this.destType = e57; } i25.inherits(s17, n44), s17.prototype.processChunk = function(e57) { this.push({ data: i25.transformTo(this.destType, e57.data), meta: e57.meta }); }, t44.exports = s17; }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e56, t44, r85) { "use strict"; var n44 = e56("./GenericWorker"), i25 = e56("../crc32"); function s17() { n44.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0); } e56("../utils").inherits(s17, n44), s17.prototype.processChunk = function(e57) { this.streamInfo.crc32 = i25(e57.data, this.streamInfo.crc32 || 0), this.push(e57); }, t44.exports = s17; }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e56, t44, r85) { "use strict"; var n44 = e56("../utils"), i25 = e56("./GenericWorker"); function s17(e57) { i25.call(this, "DataLengthProbe for " + e57), this.propName = e57, this.withStreamInfo(e57, 0); } n44.inherits(s17, i25), s17.prototype.processChunk = function(e57) { if (e57) { var t45 = this.streamInfo[this.propName] || 0; this.streamInfo[this.propName] = t45 + e57.data.length; } i25.prototype.processChunk.call(this, e57); }, t44.exports = s17; }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e56, t44, r85) { "use strict"; var n44 = e56("../utils"), i25 = e56("./GenericWorker"); function s17(e57) { i25.call(this, "DataWorker"); var t45 = this; this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e57.then(function(e58) { t45.dataIsReady = true, t45.data = e58, t45.max = e58 && e58.length || 0, t45.type = n44.getTypeOf(e58), t45.isPaused || t45._tickAndRepeat(); }, function(e58) { t45.error(e58); }); } n44.inherits(s17, i25), s17.prototype.cleanUp = function() { i25.prototype.cleanUp.call(this), this.data = null; }, s17.prototype.resume = function() { return !!i25.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n44.delay(this._tickAndRepeat, [], this)), true); }, s17.prototype._tickAndRepeat = function() { this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n44.delay(this._tickAndRepeat, [], this), this._tickScheduled = true)); }, s17.prototype._tick = function() { if (this.isPaused || this.isFinished) return false; var e57 = null, t45 = Math.min(this.max, this.index + 16384); if (this.index >= this.max) return this.end(); switch (this.type) { case "string": e57 = this.data.substring(this.index, t45); break; case "uint8array": e57 = this.data.subarray(this.index, t45); break; case "array": case "nodebuffer": e57 = this.data.slice(this.index, t45); } return this.index = t45, this.push({ data: e57, meta: { percent: this.max ? this.index / this.max * 100 : 0 } }); }, t44.exports = s17; }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e56, t44, r85) { "use strict"; function n44(e57) { this.name = e57 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null; } n44.prototype = { push: function(e57) { this.emit("data", e57); }, end: function() { if (this.isFinished) return false; this.flush(); try { this.emit("end"), this.cleanUp(), this.isFinished = true; } catch (e57) { this.emit("error", e57); } return true; }, error: function(e57) { return !this.isFinished && (this.isPaused ? this.generatedError = e57 : (this.isFinished = true, this.emit("error", e57), this.previous && this.previous.error(e57), this.cleanUp()), true); }, on: function(e57, t45) { return this._listeners[e57].push(t45), this; }, cleanUp: function() { this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = []; }, emit: function(e57, t45) { if (this._listeners[e57]) for (var r86 = 0; r86 < this._listeners[e57].length; r86++) this._listeners[e57][r86].call(this, t45); }, pipe: function(e57) { return e57.registerPrevious(this); }, registerPrevious: function(e57) { if (this.isLocked) throw new Error("The stream '" + this + "' has already been used."); this.streamInfo = e57.streamInfo, this.mergeStreamInfo(), this.previous = e57; var t45 = this; return e57.on("data", function(e58) { t45.processChunk(e58); }), e57.on("end", function() { t45.end(); }), e57.on("error", function(e58) { t45.error(e58); }), this; }, pause: function() { return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true); }, resume: function() { if (!this.isPaused || this.isFinished) return false; var e57 = this.isPaused = false; return this.generatedError && (this.error(this.generatedError), e57 = true), this.previous && this.previous.resume(), !e57; }, flush: function() { }, processChunk: function(e57) { this.push(e57); }, withStreamInfo: function(e57, t45) { return this.extraStreamInfo[e57] = t45, this.mergeStreamInfo(), this; }, mergeStreamInfo: function() { for (var e57 in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e57) && (this.streamInfo[e57] = this.extraStreamInfo[e57]); }, lock: function() { if (this.isLocked) throw new Error("The stream '" + this + "' has already been used."); this.isLocked = true, this.previous && this.previous.lock(); }, toString: function() { var e57 = "Worker " + this.name; return this.previous ? this.previous + " -> " + e57 : e57; } }, t44.exports = n44; }, {}], 29: [function(e56, t44, r85) { "use strict"; var h7 = e56("../utils"), i25 = e56("./ConvertWorker"), s17 = e56("./GenericWorker"), u11 = e56("../base64"), n44 = e56("../support"), a45 = e56("../external"), o87 = null; if (n44.nodestream) try { o87 = e56("../nodejs/NodejsStreamOutputAdapter"); } catch (e57) { } function l20(e57, o88) { return new a45.Promise(function(t45, r86) { var n45 = [], i26 = e57._internalType, s18 = e57._outputType, a46 = e57._mimeType; e57.on("data", function(e58, t46) { n45.push(e58), o88 && o88(t46); }).on("error", function(e58) { n45 = [], r86(e58); }).on("end", function() { try { var e58 = (function(e59, t46, r87) { switch (e59) { case "blob": return h7.newBlob(h7.transformTo("arraybuffer", t46), r87); case "base64": return u11.encode(t46); default: return h7.transformTo(e59, t46); } })(s18, (function(e59, t46) { var r87, n46 = 0, i27 = null, s19 = 0; for (r87 = 0; r87 < t46.length; r87++) s19 += t46[r87].length; switch (e59) { case "string": return t46.join(""); case "array": return Array.prototype.concat.apply([], t46); case "uint8array": for (i27 = new Uint8Array(s19), r87 = 0; r87 < t46.length; r87++) i27.set(t46[r87], n46), n46 += t46[r87].length; return i27; case "nodebuffer": return Buffer.concat(t46); default: throw new Error("concat : unsupported type '" + e59 + "'"); } })(i26, n45), a46); t45(e58); } catch (e59) { r86(e59); } n45 = []; }).resume(); }); } function f7(e57, t45, r86) { var n45 = t45; switch (t45) { case "blob": case "arraybuffer": n45 = "uint8array"; break; case "base64": n45 = "string"; } try { this._internalType = n45, this._outputType = t45, this._mimeType = r86, h7.checkSupport(n45), this._worker = e57.pipe(new i25(n45)), e57.lock(); } catch (e58) { this._worker = new s17("error"), this._worker.error(e58); } } f7.prototype = { accumulate: function(e57) { return l20(this, e57); }, on: function(e57, t45) { var r86 = this; return "data" === e57 ? this._worker.on(e57, function(e58) { t45.call(r86, e58.data, e58.meta); }) : this._worker.on(e57, function() { h7.delay(t45, arguments, r86); }), this; }, resume: function() { return h7.delay(this._worker.resume, [], this._worker), this; }, pause: function() { return this._worker.pause(), this; }, toNodejsStream: function(e57) { if (h7.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method"); return new o87(this, { objectMode: "nodebuffer" !== this._outputType }, e57); } }, t44.exports = f7; }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e56, t44, r85) { "use strict"; if (r85.base64 = true, r85.array = true, r85.string = true, r85.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r85.nodebuffer = "undefined" != typeof Buffer, r85.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer) r85.blob = false; else { var n44 = new ArrayBuffer(0); try { r85.blob = 0 === new Blob([n44], { type: "application/zip" }).size; } catch (e57) { try { var i25 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); i25.append(n44), r85.blob = 0 === i25.getBlob("application/zip").size; } catch (e58) { r85.blob = false; } } } try { r85.nodestream = !!e56("readable-stream").Readable; } catch (e57) { r85.nodestream = false; } }, { "readable-stream": 16 }], 31: [function(e56, t44, s17) { "use strict"; for (var o87 = e56("./utils"), h7 = e56("./support"), r85 = e56("./nodejsUtils"), n44 = e56("./stream/GenericWorker"), u11 = new Array(256), i25 = 0; i25 < 256; i25++) u11[i25] = 252 <= i25 ? 6 : 248 <= i25 ? 5 : 240 <= i25 ? 4 : 224 <= i25 ? 3 : 192 <= i25 ? 2 : 1; u11[254] = u11[254] = 1; function a45() { n44.call(this, "utf-8 decode"), this.leftOver = null; } function l20() { n44.call(this, "utf-8 encode"); } s17.utf8encode = function(e57) { return h7.nodebuffer ? r85.newBufferFrom(e57, "utf-8") : (function(e58) { var t45, r86, n45, i26, s18, a46 = e58.length, o88 = 0; for (i26 = 0; i26 < a46; i26++) 55296 == (64512 & (r86 = e58.charCodeAt(i26))) && i26 + 1 < a46 && 56320 == (64512 & (n45 = e58.charCodeAt(i26 + 1))) && (r86 = 65536 + (r86 - 55296 << 10) + (n45 - 56320), i26++), o88 += r86 < 128 ? 1 : r86 < 2048 ? 2 : r86 < 65536 ? 3 : 4; for (t45 = h7.uint8array ? new Uint8Array(o88) : new Array(o88), i26 = s18 = 0; s18 < o88; i26++) 55296 == (64512 & (r86 = e58.charCodeAt(i26))) && i26 + 1 < a46 && 56320 == (64512 & (n45 = e58.charCodeAt(i26 + 1))) && (r86 = 65536 + (r86 - 55296 << 10) + (n45 - 56320), i26++), r86 < 128 ? t45[s18++] = r86 : (r86 < 2048 ? t45[s18++] = 192 | r86 >>> 6 : (r86 < 65536 ? t45[s18++] = 224 | r86 >>> 12 : (t45[s18++] = 240 | r86 >>> 18, t45[s18++] = 128 | r86 >>> 12 & 63), t45[s18++] = 128 | r86 >>> 6 & 63), t45[s18++] = 128 | 63 & r86); return t45; })(e57); }, s17.utf8decode = function(e57) { return h7.nodebuffer ? o87.transformTo("nodebuffer", e57).toString("utf-8") : (function(e58) { var t45, r86, n45, i26, s18 = e58.length, a46 = new Array(2 * s18); for (t45 = r86 = 0; t45 < s18; ) if ((n45 = e58[t45++]) < 128) a46[r86++] = n45; else if (4 < (i26 = u11[n45])) a46[r86++] = 65533, t45 += i26 - 1; else { for (n45 &= 2 === i26 ? 31 : 3 === i26 ? 15 : 7; 1 < i26 && t45 < s18; ) n45 = n45 << 6 | 63 & e58[t45++], i26--; 1 < i26 ? a46[r86++] = 65533 : n45 < 65536 ? a46[r86++] = n45 : (n45 -= 65536, a46[r86++] = 55296 | n45 >> 10 & 1023, a46[r86++] = 56320 | 1023 & n45); } return a46.length !== r86 && (a46.subarray ? a46 = a46.subarray(0, r86) : a46.length = r86), o87.applyFromCharCode(a46); })(e57 = o87.transformTo(h7.uint8array ? "uint8array" : "array", e57)); }, o87.inherits(a45, n44), a45.prototype.processChunk = function(e57) { var t45 = o87.transformTo(h7.uint8array ? "uint8array" : "array", e57.data); if (this.leftOver && this.leftOver.length) { if (h7.uint8array) { var r86 = t45; (t45 = new Uint8Array(r86.length + this.leftOver.length)).set(this.leftOver, 0), t45.set(r86, this.leftOver.length); } else t45 = this.leftOver.concat(t45); this.leftOver = null; } var n45 = (function(e58, t46) { var r87; for ((t46 = t46 || e58.length) > e58.length && (t46 = e58.length), r87 = t46 - 1; 0 <= r87 && 128 == (192 & e58[r87]); ) r87--; return r87 < 0 ? t46 : 0 === r87 ? t46 : r87 + u11[e58[r87]] > t46 ? r87 : t46; })(t45), i26 = t45; n45 !== t45.length && (h7.uint8array ? (i26 = t45.subarray(0, n45), this.leftOver = t45.subarray(n45, t45.length)) : (i26 = t45.slice(0, n45), this.leftOver = t45.slice(n45, t45.length))), this.push({ data: s17.utf8decode(i26), meta: e57.meta }); }, a45.prototype.flush = function() { this.leftOver && this.leftOver.length && (this.push({ data: s17.utf8decode(this.leftOver), meta: {} }), this.leftOver = null); }, s17.Utf8DecodeWorker = a45, o87.inherits(l20, n44), l20.prototype.processChunk = function(e57) { this.push({ data: s17.utf8encode(e57.data), meta: e57.meta }); }, s17.Utf8EncodeWorker = l20; }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e56, t44, a45) { "use strict"; var o87 = e56("./support"), h7 = e56("./base64"), r85 = e56("./nodejsUtils"), u11 = e56("./external"); function n44(e57) { return e57; } function l20(e57, t45) { for (var r86 = 0; r86 < e57.length; ++r86) t45[r86] = 255 & e57.charCodeAt(r86); return t45; } e56("setimmediate"), a45.newBlob = function(t45, r86) { a45.checkSupport("blob"); try { return new Blob([t45], { type: r86 }); } catch (e57) { try { var n45 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)(); return n45.append(t45), n45.getBlob(r86); } catch (e58) { throw new Error("Bug : can't construct the Blob."); } } }; var i25 = { stringifyByChunk: function(e57, t45, r86) { var n45 = [], i26 = 0, s18 = e57.length; if (s18 <= r86) return String.fromCharCode.apply(null, e57); for (; i26 < s18; ) "array" === t45 || "nodebuffer" === t45 ? n45.push(String.fromCharCode.apply(null, e57.slice(i26, Math.min(i26 + r86, s18)))) : n45.push(String.fromCharCode.apply(null, e57.subarray(i26, Math.min(i26 + r86, s18)))), i26 += r86; return n45.join(""); }, stringifyByChar: function(e57) { for (var t45 = "", r86 = 0; r86 < e57.length; r86++) t45 += String.fromCharCode(e57[r86]); return t45; }, applyCanBeUsed: { uint8array: (function() { try { return o87.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length; } catch (e57) { return false; } })(), nodebuffer: (function() { try { return o87.nodebuffer && 1 === String.fromCharCode.apply(null, r85.allocBuffer(1)).length; } catch (e57) { return false; } })() } }; function s17(e57) { var t45 = 65536, r86 = a45.getTypeOf(e57), n45 = true; if ("uint8array" === r86 ? n45 = i25.applyCanBeUsed.uint8array : "nodebuffer" === r86 && (n45 = i25.applyCanBeUsed.nodebuffer), n45) for (; 1 < t45; ) try { return i25.stringifyByChunk(e57, r86, t45); } catch (e58) { t45 = Math.floor(t45 / 2); } return i25.stringifyByChar(e57); } function f7(e57, t45) { for (var r86 = 0; r86 < e57.length; r86++) t45[r86] = e57[r86]; return t45; } a45.applyFromCharCode = s17; var c27 = {}; c27.string = { string: n44, array: function(e57) { return l20(e57, new Array(e57.length)); }, arraybuffer: function(e57) { return c27.string.uint8array(e57).buffer; }, uint8array: function(e57) { return l20(e57, new Uint8Array(e57.length)); }, nodebuffer: function(e57) { return l20(e57, r85.allocBuffer(e57.length)); } }, c27.array = { string: s17, array: n44, arraybuffer: function(e57) { return new Uint8Array(e57).buffer; }, uint8array: function(e57) { return new Uint8Array(e57); }, nodebuffer: function(e57) { return r85.newBufferFrom(e57); } }, c27.arraybuffer = { string: function(e57) { return s17(new Uint8Array(e57)); }, array: function(e57) { return f7(new Uint8Array(e57), new Array(e57.byteLength)); }, arraybuffer: n44, uint8array: function(e57) { return new Uint8Array(e57); }, nodebuffer: function(e57) { return r85.newBufferFrom(new Uint8Array(e57)); } }, c27.uint8array = { string: s17, array: function(e57) { return f7(e57, new Array(e57.length)); }, arraybuffer: function(e57) { return e57.buffer; }, uint8array: n44, nodebuffer: function(e57) { return r85.newBufferFrom(e57); } }, c27.nodebuffer = { string: s17, array: function(e57) { return f7(e57, new Array(e57.length)); }, arraybuffer: function(e57) { return c27.nodebuffer.uint8array(e57).buffer; }, uint8array: function(e57) { return f7(e57, new Uint8Array(e57.length)); }, nodebuffer: n44 }, a45.transformTo = function(e57, t45) { if (t45 = t45 || "", !e57) return t45; a45.checkSupport(e57); var r86 = a45.getTypeOf(t45); return c27[r86][e57](t45); }, a45.resolve = function(e57) { for (var t45 = e57.split("/"), r86 = [], n45 = 0; n45 < t45.length; n45++) { var i26 = t45[n45]; "." === i26 || "" === i26 && 0 !== n45 && n45 !== t45.length - 1 || (".." === i26 ? r86.pop() : r86.push(i26)); } return r86.join("/"); }, a45.getTypeOf = function(e57) { return "string" == typeof e57 ? "string" : "[object Array]" === Object.prototype.toString.call(e57) ? "array" : o87.nodebuffer && r85.isBuffer(e57) ? "nodebuffer" : o87.uint8array && e57 instanceof Uint8Array ? "uint8array" : o87.arraybuffer && e57 instanceof ArrayBuffer ? "arraybuffer" : void 0; }, a45.checkSupport = function(e57) { if (!o87[e57.toLowerCase()]) throw new Error(e57 + " is not supported by this platform"); }, a45.MAX_VALUE_16BITS = 65535, a45.MAX_VALUE_32BITS = -1, a45.pretty = function(e57) { var t45, r86, n45 = ""; for (r86 = 0; r86 < (e57 || "").length; r86++) n45 += "\\x" + ((t45 = e57.charCodeAt(r86)) < 16 ? "0" : "") + t45.toString(16).toUpperCase(); return n45; }, a45.delay = function(e57, t45, r86) { setImmediate(function() { e57.apply(r86 || null, t45 || []); }); }, a45.inherits = function(e57, t45) { function r86() { } r86.prototype = t45.prototype, e57.prototype = new r86(); }, a45.extend = function() { var e57, t45, r86 = {}; for (e57 = 0; e57 < arguments.length; e57++) for (t45 in arguments[e57]) Object.prototype.hasOwnProperty.call(arguments[e57], t45) && void 0 === r86[t45] && (r86[t45] = arguments[e57][t45]); return r86; }, a45.prepareContent = function(r86, e57, n45, i26, s18) { return u11.Promise.resolve(e57).then(function(n46) { return o87.blob && (n46 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n46))) && "undefined" != typeof FileReader ? new u11.Promise(function(t45, r87) { var e58 = new FileReader(); e58.onload = function(e59) { t45(e59.target.result); }, e58.onerror = function(e59) { r87(e59.target.error); }, e58.readAsArrayBuffer(n46); }) : n46; }).then(function(e58) { var t45 = a45.getTypeOf(e58); return t45 ? ("arraybuffer" === t45 ? e58 = a45.transformTo("uint8array", e58) : "string" === t45 && (s18 ? e58 = h7.decode(e58) : n45 && true !== i26 && (e58 = (function(e59) { return l20(e59, o87.uint8array ? new Uint8Array(e59.length) : new Array(e59.length)); })(e58))), e58) : u11.Promise.reject(new Error("Can't read the data of '" + r86 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?")); }); }; }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e56, t44, r85) { "use strict"; var n44 = e56("./reader/readerFor"), i25 = e56("./utils"), s17 = e56("./signature"), a45 = e56("./zipEntry"), o87 = e56("./support"); function h7(e57) { this.files = [], this.loadOptions = e57; } h7.prototype = { checkSignature: function(e57) { if (!this.reader.readAndCheckSignature(e57)) { this.reader.index -= 4; var t45 = this.reader.readString(4); throw new Error("Corrupted zip or bug: unexpected signature (" + i25.pretty(t45) + ", expected " + i25.pretty(e57) + ")"); } }, isSignature: function(e57, t45) { var r86 = this.reader.index; this.reader.setIndex(e57); var n45 = this.reader.readString(4) === t45; return this.reader.setIndex(r86), n45; }, readBlockEndOfCentral: function() { this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2); var e57 = this.reader.readData(this.zipCommentLength), t45 = o87.uint8array ? "uint8array" : "array", r86 = i25.transformTo(t45, e57); this.zipComment = this.loadOptions.decodeFileName(r86); }, readBlockZip64EndOfCentral: function() { this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {}; for (var e57, t45, r86, n45 = this.zip64EndOfCentralSize - 44; 0 < n45; ) e57 = this.reader.readInt(2), t45 = this.reader.readInt(4), r86 = this.reader.readData(t45), this.zip64ExtensibleData[e57] = { id: e57, length: t45, value: r86 }; }, readBlockZip64EndOfCentralLocator: function() { if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported"); }, readLocalFiles: function() { var e57, t45; for (e57 = 0; e57 < this.files.length; e57++) t45 = this.files[e57], this.reader.setIndex(t45.localHeaderOffset), this.checkSignature(s17.LOCAL_FILE_HEADER), t45.readLocalPart(this.reader), t45.handleUTF8(), t45.processAttributes(); }, readCentralDir: function() { var e57; for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s17.CENTRAL_FILE_HEADER); ) (e57 = new a45({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e57); if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); }, readEndOfCentral: function() { var e57 = this.reader.lastIndexOfSignature(s17.CENTRAL_DIRECTORY_END); if (e57 < 0) throw !this.isSignature(0, s17.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory"); this.reader.setIndex(e57); var t45 = e57; if (this.checkSignature(s17.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i25.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i25.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i25.MAX_VALUE_16BITS || this.centralDirRecords === i25.MAX_VALUE_16BITS || this.centralDirSize === i25.MAX_VALUE_32BITS || this.centralDirOffset === i25.MAX_VALUE_32BITS) { if (this.zip64 = true, (e57 = this.reader.lastIndexOfSignature(s17.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); if (this.reader.setIndex(e57), this.checkSignature(s17.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s17.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s17.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s17.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral(); } var r86 = this.centralDirOffset + this.centralDirSize; this.zip64 && (r86 += 20, r86 += 12 + this.zip64EndOfCentralSize); var n45 = t45 - r86; if (0 < n45) this.isSignature(t45, s17.CENTRAL_FILE_HEADER) || (this.reader.zero = n45); else if (n45 < 0) throw new Error("Corrupted zip: missing " + Math.abs(n45) + " bytes."); }, prepareReader: function(e57) { this.reader = n44(e57); }, load: function(e57) { this.prepareReader(e57), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles(); } }, t44.exports = h7; }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e56, t44, r85) { "use strict"; var n44 = e56("./reader/readerFor"), s17 = e56("./utils"), i25 = e56("./compressedObject"), a45 = e56("./crc32"), o87 = e56("./utf8"), h7 = e56("./compressions"), u11 = e56("./support"); function l20(e57, t45) { this.options = e57, this.loadOptions = t45; } l20.prototype = { isEncrypted: function() { return 1 == (1 & this.bitFlag); }, useUTF8: function() { return 2048 == (2048 & this.bitFlag); }, readLocalPart: function(e57) { var t45, r86; if (e57.skip(22), this.fileNameLength = e57.readInt(2), r86 = e57.readInt(2), this.fileName = e57.readData(this.fileNameLength), e57.skip(r86), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)"); if (null === (t45 = (function(e58) { for (var t46 in h7) if (Object.prototype.hasOwnProperty.call(h7, t46) && h7[t46].magic === e58) return h7[t46]; return null; })(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s17.pretty(this.compressionMethod) + " unknown (inner file : " + s17.transformTo("string", this.fileName) + ")"); this.decompressed = new i25(this.compressedSize, this.uncompressedSize, this.crc32, t45, e57.readData(this.compressedSize)); }, readCentralPart: function(e57) { this.versionMadeBy = e57.readInt(2), e57.skip(2), this.bitFlag = e57.readInt(2), this.compressionMethod = e57.readString(2), this.date = e57.readDate(), this.crc32 = e57.readInt(4), this.compressedSize = e57.readInt(4), this.uncompressedSize = e57.readInt(4); var t45 = e57.readInt(2); if (this.extraFieldsLength = e57.readInt(2), this.fileCommentLength = e57.readInt(2), this.diskNumberStart = e57.readInt(2), this.internalFileAttributes = e57.readInt(2), this.externalFileAttributes = e57.readInt(4), this.localHeaderOffset = e57.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported"); e57.skip(t45), this.readExtraFields(e57), this.parseZIP64ExtraField(e57), this.fileComment = e57.readData(this.fileCommentLength); }, processAttributes: function() { this.unixPermissions = null, this.dosPermissions = null; var e57 = this.versionMadeBy >> 8; this.dir = !!(16 & this.externalFileAttributes), 0 == e57 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e57 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true); }, parseZIP64ExtraField: function() { if (this.extraFields[1]) { var e57 = n44(this.extraFields[1].value); this.uncompressedSize === s17.MAX_VALUE_32BITS && (this.uncompressedSize = e57.readInt(8)), this.compressedSize === s17.MAX_VALUE_32BITS && (this.compressedSize = e57.readInt(8)), this.localHeaderOffset === s17.MAX_VALUE_32BITS && (this.localHeaderOffset = e57.readInt(8)), this.diskNumberStart === s17.MAX_VALUE_32BITS && (this.diskNumberStart = e57.readInt(4)); } }, readExtraFields: function(e57) { var t45, r86, n45, i26 = e57.index + this.extraFieldsLength; for (this.extraFields || (this.extraFields = {}); e57.index + 4 < i26; ) t45 = e57.readInt(2), r86 = e57.readInt(2), n45 = e57.readData(r86), this.extraFields[t45] = { id: t45, length: r86, value: n45 }; e57.setIndex(i26); }, handleUTF8: function() { var e57 = u11.uint8array ? "uint8array" : "array"; if (this.useUTF8()) this.fileNameStr = o87.utf8decode(this.fileName), this.fileCommentStr = o87.utf8decode(this.fileComment); else { var t45 = this.findExtraFieldUnicodePath(); if (null !== t45) this.fileNameStr = t45; else { var r86 = s17.transformTo(e57, this.fileName); this.fileNameStr = this.loadOptions.decodeFileName(r86); } var n45 = this.findExtraFieldUnicodeComment(); if (null !== n45) this.fileCommentStr = n45; else { var i26 = s17.transformTo(e57, this.fileComment); this.fileCommentStr = this.loadOptions.decodeFileName(i26); } } }, findExtraFieldUnicodePath: function() { var e57 = this.extraFields[28789]; if (e57) { var t45 = n44(e57.value); return 1 !== t45.readInt(1) ? null : a45(this.fileName) !== t45.readInt(4) ? null : o87.utf8decode(t45.readData(e57.length - 5)); } return null; }, findExtraFieldUnicodeComment: function() { var e57 = this.extraFields[25461]; if (e57) { var t45 = n44(e57.value); return 1 !== t45.readInt(1) ? null : a45(this.fileComment) !== t45.readInt(4) ? null : o87.utf8decode(t45.readData(e57.length - 5)); } return null; } }, t44.exports = l20; }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e56, t44, r85) { "use strict"; function n44(e57, t45, r86) { this.name = e57, this.dir = r86.dir, this.date = r86.date, this.comment = r86.comment, this.unixPermissions = r86.unixPermissions, this.dosPermissions = r86.dosPermissions, this._data = t45, this._dataBinary = r86.binary, this.options = { compression: r86.compression, compressionOptions: r86.compressionOptions }; } var s17 = e56("./stream/StreamHelper"), i25 = e56("./stream/DataWorker"), a45 = e56("./utf8"), o87 = e56("./compressedObject"), h7 = e56("./stream/GenericWorker"); n44.prototype = { internalStream: function(e57) { var t45 = null, r86 = "string"; try { if (!e57) throw new Error("No output type specified."); var n45 = "string" === (r86 = e57.toLowerCase()) || "text" === r86; "binarystring" !== r86 && "text" !== r86 || (r86 = "string"), t45 = this._decompressWorker(); var i26 = !this._dataBinary; i26 && !n45 && (t45 = t45.pipe(new a45.Utf8EncodeWorker())), !i26 && n45 && (t45 = t45.pipe(new a45.Utf8DecodeWorker())); } catch (e58) { (t45 = new h7("error")).error(e58); } return new s17(t45, r86, ""); }, async: function(e57, t45) { return this.internalStream(e57).accumulate(t45); }, nodeStream: function(e57, t45) { return this.internalStream(e57 || "nodebuffer").toNodejsStream(t45); }, _compressWorker: function(e57, t45) { if (this._data instanceof o87 && this._data.compression.magic === e57.magic) return this._data.getCompressedWorker(); var r86 = this._decompressWorker(); return this._dataBinary || (r86 = r86.pipe(new a45.Utf8EncodeWorker())), o87.createWorkerFrom(r86, e57, t45); }, _decompressWorker: function() { return this._data instanceof o87 ? this._data.getContentWorker() : this._data instanceof h7 ? this._data : new i25(this._data); } }; for (var u11 = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l20 = function() { throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); }, f7 = 0; f7 < u11.length; f7++) n44.prototype[u11[f7]] = l20; t44.exports = n44; }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e56, l20, t44) { (function(t45) { "use strict"; var r85, n44, e57 = t45.MutationObserver || t45.WebKitMutationObserver; if (e57) { var i25 = 0, s17 = new e57(u11), a45 = t45.document.createTextNode(""); s17.observe(a45, { characterData: true }), r85 = function() { a45.data = i25 = ++i25 % 2; }; } else if (t45.setImmediate || void 0 === t45.MessageChannel) r85 = "document" in t45 && "onreadystatechange" in t45.document.createElement("script") ? function() { var e58 = t45.document.createElement("script"); e58.onreadystatechange = function() { u11(), e58.onreadystatechange = null, e58.parentNode.removeChild(e58), e58 = null; }, t45.document.documentElement.appendChild(e58); } : function() { setTimeout(u11, 0); }; else { var o87 = new t45.MessageChannel(); o87.port1.onmessage = u11, r85 = function() { o87.port2.postMessage(0); }; } var h7 = []; function u11() { var e58, t46; n44 = true; for (var r86 = h7.length; r86; ) { for (t46 = h7, h7 = [], e58 = -1; ++e58 < r86; ) t46[e58](); r86 = h7.length; } n44 = false; } l20.exports = function(e58) { 1 !== h7.push(e58) || n44 || r85(); }; }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); }, {}], 37: [function(e56, t44, r85) { "use strict"; var i25 = e56("immediate"); function u11() { } var l20 = {}, s17 = ["REJECTED"], a45 = ["FULFILLED"], n44 = ["PENDING"]; function o87(e57) { if ("function" != typeof e57) throw new TypeError("resolver must be a function"); this.state = n44, this.queue = [], this.outcome = void 0, e57 !== u11 && d33(this, e57); } function h7(e57, t45, r86) { this.promise = e57, "function" == typeof t45 && (this.onFulfilled = t45, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r86 && (this.onRejected = r86, this.callRejected = this.otherCallRejected); } function f7(t45, r86, n45) { i25(function() { var e57; try { e57 = r86(n45); } catch (e58) { return l20.reject(t45, e58); } e57 === t45 ? l20.reject(t45, new TypeError("Cannot resolve promise with itself")) : l20.resolve(t45, e57); }); } function c27(e57) { var t45 = e57 && e57.then; if (e57 && ("object" == typeof e57 || "function" == typeof e57) && "function" == typeof t45) return function() { t45.apply(e57, arguments); }; } function d33(t45, e57) { var r86 = false; function n45(e58) { r86 || (r86 = true, l20.reject(t45, e58)); } function i26(e58) { r86 || (r86 = true, l20.resolve(t45, e58)); } var s18 = p8(function() { e57(i26, n45); }); "error" === s18.status && n45(s18.value); } function p8(e57, t45) { var r86 = {}; try { r86.value = e57(t45), r86.status = "success"; } catch (e58) { r86.status = "error", r86.value = e58; } return r86; } (t44.exports = o87).prototype.finally = function(t45) { if ("function" != typeof t45) return this; var r86 = this.constructor; return this.then(function(e57) { return r86.resolve(t45()).then(function() { return e57; }); }, function(e57) { return r86.resolve(t45()).then(function() { throw e57; }); }); }, o87.prototype.catch = function(e57) { return this.then(null, e57); }, o87.prototype.then = function(e57, t45) { if ("function" != typeof e57 && this.state === a45 || "function" != typeof t45 && this.state === s17) return this; var r86 = new this.constructor(u11); this.state !== n44 ? f7(r86, this.state === a45 ? e57 : t45, this.outcome) : this.queue.push(new h7(r86, e57, t45)); return r86; }, h7.prototype.callFulfilled = function(e57) { l20.resolve(this.promise, e57); }, h7.prototype.otherCallFulfilled = function(e57) { f7(this.promise, this.onFulfilled, e57); }, h7.prototype.callRejected = function(e57) { l20.reject(this.promise, e57); }, h7.prototype.otherCallRejected = function(e57) { f7(this.promise, this.onRejected, e57); }, l20.resolve = function(e57, t45) { var r86 = p8(c27, t45); if ("error" === r86.status) return l20.reject(e57, r86.value); var n45 = r86.value; if (n45) d33(e57, n45); else { e57.state = a45, e57.outcome = t45; for (var i26 = -1, s18 = e57.queue.length; ++i26 < s18; ) e57.queue[i26].callFulfilled(t45); } return e57; }, l20.reject = function(e57, t45) { e57.state = s17, e57.outcome = t45; for (var r86 = -1, n45 = e57.queue.length; ++r86 < n45; ) e57.queue[r86].callRejected(t45); return e57; }, o87.resolve = function(e57) { if (e57 instanceof this) return e57; return l20.resolve(new this(u11), e57); }, o87.reject = function(e57) { var t45 = new this(u11); return l20.reject(t45, e57); }, o87.all = function(e57) { var r86 = this; if ("[object Array]" !== Object.prototype.toString.call(e57)) return this.reject(new TypeError("must be an array")); var n45 = e57.length, i26 = false; if (!n45) return this.resolve([]); var s18 = new Array(n45), a46 = 0, t45 = -1, o88 = new this(u11); for (; ++t45 < n45; ) h8(e57[t45], t45); return o88; function h8(e58, t46) { r86.resolve(e58).then(function(e59) { s18[t46] = e59, ++a46 !== n45 || i26 || (i26 = true, l20.resolve(o88, s18)); }, function(e59) { i26 || (i26 = true, l20.reject(o88, e59)); }); } }, o87.race = function(e57) { var t45 = this; if ("[object Array]" !== Object.prototype.toString.call(e57)) return this.reject(new TypeError("must be an array")); var r86 = e57.length, n45 = false; if (!r86) return this.resolve([]); var i26 = -1, s18 = new this(u11); for (; ++i26 < r86; ) a46 = e57[i26], t45.resolve(a46).then(function(e58) { n45 || (n45 = true, l20.resolve(s18, e58)); }, function(e58) { n45 || (n45 = true, l20.reject(s18, e58)); }); var a46; return s18; }; }, { immediate: 36 }], 38: [function(e56, t44, r85) { "use strict"; var n44 = {}; (0, e56("./lib/utils/common").assign)(n44, e56("./lib/deflate"), e56("./lib/inflate"), e56("./lib/zlib/constants")), t44.exports = n44; }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e56, t44, r85) { "use strict"; var a45 = e56("./zlib/deflate"), o87 = e56("./utils/common"), h7 = e56("./utils/strings"), i25 = e56("./zlib/messages"), s17 = e56("./zlib/zstream"), u11 = Object.prototype.toString, l20 = 0, f7 = -1, c27 = 0, d33 = 8; function p8(e57) { if (!(this instanceof p8)) return new p8(e57); this.options = o87.assign({ level: f7, method: d33, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c27, to: "" }, e57 || {}); var t45 = this.options; t45.raw && 0 < t45.windowBits ? t45.windowBits = -t45.windowBits : t45.gzip && 0 < t45.windowBits && t45.windowBits < 16 && (t45.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s17(), this.strm.avail_out = 0; var r86 = a45.deflateInit2(this.strm, t45.level, t45.method, t45.windowBits, t45.memLevel, t45.strategy); if (r86 !== l20) throw new Error(i25[r86]); if (t45.header && a45.deflateSetHeader(this.strm, t45.header), t45.dictionary) { var n45; if (n45 = "string" == typeof t45.dictionary ? h7.string2buf(t45.dictionary) : "[object ArrayBuffer]" === u11.call(t45.dictionary) ? new Uint8Array(t45.dictionary) : t45.dictionary, (r86 = a45.deflateSetDictionary(this.strm, n45)) !== l20) throw new Error(i25[r86]); this._dict_set = true; } } function n44(e57, t45) { var r86 = new p8(t45); if (r86.push(e57, true), r86.err) throw r86.msg || i25[r86.err]; return r86.result; } p8.prototype.push = function(e57, t45) { var r86, n45, i26 = this.strm, s18 = this.options.chunkSize; if (this.ended) return false; n45 = t45 === ~~t45 ? t45 : true === t45 ? 4 : 0, "string" == typeof e57 ? i26.input = h7.string2buf(e57) : "[object ArrayBuffer]" === u11.call(e57) ? i26.input = new Uint8Array(e57) : i26.input = e57, i26.next_in = 0, i26.avail_in = i26.input.length; do { if (0 === i26.avail_out && (i26.output = new o87.Buf8(s18), i26.next_out = 0, i26.avail_out = s18), 1 !== (r86 = a45.deflate(i26, n45)) && r86 !== l20) return this.onEnd(r86), !(this.ended = true); 0 !== i26.avail_out && (0 !== i26.avail_in || 4 !== n45 && 2 !== n45) || ("string" === this.options.to ? this.onData(h7.buf2binstring(o87.shrinkBuf(i26.output, i26.next_out))) : this.onData(o87.shrinkBuf(i26.output, i26.next_out))); } while ((0 < i26.avail_in || 0 === i26.avail_out) && 1 !== r86); return 4 === n45 ? (r86 = a45.deflateEnd(this.strm), this.onEnd(r86), this.ended = true, r86 === l20) : 2 !== n45 || (this.onEnd(l20), !(i26.avail_out = 0)); }, p8.prototype.onData = function(e57) { this.chunks.push(e57); }, p8.prototype.onEnd = function(e57) { e57 === l20 && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o87.flattenChunks(this.chunks)), this.chunks = [], this.err = e57, this.msg = this.strm.msg; }, r85.Deflate = p8, r85.deflate = n44, r85.deflateRaw = function(e57, t45) { return (t45 = t45 || {}).raw = true, n44(e57, t45); }, r85.gzip = function(e57, t45) { return (t45 = t45 || {}).gzip = true, n44(e57, t45); }; }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e56, t44, r85) { "use strict"; var c27 = e56("./zlib/inflate"), d33 = e56("./utils/common"), p8 = e56("./utils/strings"), m5 = e56("./zlib/constants"), n44 = e56("./zlib/messages"), i25 = e56("./zlib/zstream"), s17 = e56("./zlib/gzheader"), _3 = Object.prototype.toString; function a45(e57) { if (!(this instanceof a45)) return new a45(e57); this.options = d33.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e57 || {}); var t45 = this.options; t45.raw && 0 <= t45.windowBits && t45.windowBits < 16 && (t45.windowBits = -t45.windowBits, 0 === t45.windowBits && (t45.windowBits = -15)), !(0 <= t45.windowBits && t45.windowBits < 16) || e57 && e57.windowBits || (t45.windowBits += 32), 15 < t45.windowBits && t45.windowBits < 48 && 0 == (15 & t45.windowBits) && (t45.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i25(), this.strm.avail_out = 0; var r86 = c27.inflateInit2(this.strm, t45.windowBits); if (r86 !== m5.Z_OK) throw new Error(n44[r86]); this.header = new s17(), c27.inflateGetHeader(this.strm, this.header); } function o87(e57, t45) { var r86 = new a45(t45); if (r86.push(e57, true), r86.err) throw r86.msg || n44[r86.err]; return r86.result; } a45.prototype.push = function(e57, t45) { var r86, n45, i26, s18, a46, o88, h7 = this.strm, u11 = this.options.chunkSize, l20 = this.options.dictionary, f7 = false; if (this.ended) return false; n45 = t45 === ~~t45 ? t45 : true === t45 ? m5.Z_FINISH : m5.Z_NO_FLUSH, "string" == typeof e57 ? h7.input = p8.binstring2buf(e57) : "[object ArrayBuffer]" === _3.call(e57) ? h7.input = new Uint8Array(e57) : h7.input = e57, h7.next_in = 0, h7.avail_in = h7.input.length; do { if (0 === h7.avail_out && (h7.output = new d33.Buf8(u11), h7.next_out = 0, h7.avail_out = u11), (r86 = c27.inflate(h7, m5.Z_NO_FLUSH)) === m5.Z_NEED_DICT && l20 && (o88 = "string" == typeof l20 ? p8.string2buf(l20) : "[object ArrayBuffer]" === _3.call(l20) ? new Uint8Array(l20) : l20, r86 = c27.inflateSetDictionary(this.strm, o88)), r86 === m5.Z_BUF_ERROR && true === f7 && (r86 = m5.Z_OK, f7 = false), r86 !== m5.Z_STREAM_END && r86 !== m5.Z_OK) return this.onEnd(r86), !(this.ended = true); h7.next_out && (0 !== h7.avail_out && r86 !== m5.Z_STREAM_END && (0 !== h7.avail_in || n45 !== m5.Z_FINISH && n45 !== m5.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i26 = p8.utf8border(h7.output, h7.next_out), s18 = h7.next_out - i26, a46 = p8.buf2string(h7.output, i26), h7.next_out = s18, h7.avail_out = u11 - s18, s18 && d33.arraySet(h7.output, h7.output, i26, s18, 0), this.onData(a46)) : this.onData(d33.shrinkBuf(h7.output, h7.next_out)))), 0 === h7.avail_in && 0 === h7.avail_out && (f7 = true); } while ((0 < h7.avail_in || 0 === h7.avail_out) && r86 !== m5.Z_STREAM_END); return r86 === m5.Z_STREAM_END && (n45 = m5.Z_FINISH), n45 === m5.Z_FINISH ? (r86 = c27.inflateEnd(this.strm), this.onEnd(r86), this.ended = true, r86 === m5.Z_OK) : n45 !== m5.Z_SYNC_FLUSH || (this.onEnd(m5.Z_OK), !(h7.avail_out = 0)); }, a45.prototype.onData = function(e57) { this.chunks.push(e57); }, a45.prototype.onEnd = function(e57) { e57 === m5.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d33.flattenChunks(this.chunks)), this.chunks = [], this.err = e57, this.msg = this.strm.msg; }, r85.Inflate = a45, r85.inflate = o87, r85.inflateRaw = function(e57, t45) { return (t45 = t45 || {}).raw = true, o87(e57, t45); }, r85.ungzip = o87; }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e56, t44, r85) { "use strict"; var n44 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array; r85.assign = function(e57) { for (var t45 = Array.prototype.slice.call(arguments, 1); t45.length; ) { var r86 = t45.shift(); if (r86) { if ("object" != typeof r86) throw new TypeError(r86 + "must be non-object"); for (var n45 in r86) r86.hasOwnProperty(n45) && (e57[n45] = r86[n45]); } } return e57; }, r85.shrinkBuf = function(e57, t45) { return e57.length === t45 ? e57 : e57.subarray ? e57.subarray(0, t45) : (e57.length = t45, e57); }; var i25 = { arraySet: function(e57, t45, r86, n45, i26) { if (t45.subarray && e57.subarray) e57.set(t45.subarray(r86, r86 + n45), i26); else for (var s18 = 0; s18 < n45; s18++) e57[i26 + s18] = t45[r86 + s18]; }, flattenChunks: function(e57) { var t45, r86, n45, i26, s18, a45; for (t45 = n45 = 0, r86 = e57.length; t45 < r86; t45++) n45 += e57[t45].length; for (a45 = new Uint8Array(n45), t45 = i26 = 0, r86 = e57.length; t45 < r86; t45++) s18 = e57[t45], a45.set(s18, i26), i26 += s18.length; return a45; } }, s17 = { arraySet: function(e57, t45, r86, n45, i26) { for (var s18 = 0; s18 < n45; s18++) e57[i26 + s18] = t45[r86 + s18]; }, flattenChunks: function(e57) { return [].concat.apply([], e57); } }; r85.setTyped = function(e57) { e57 ? (r85.Buf8 = Uint8Array, r85.Buf16 = Uint16Array, r85.Buf32 = Int32Array, r85.assign(r85, i25)) : (r85.Buf8 = Array, r85.Buf16 = Array, r85.Buf32 = Array, r85.assign(r85, s17)); }, r85.setTyped(n44); }, {}], 42: [function(e56, t44, r85) { "use strict"; var h7 = e56("./common"), i25 = true, s17 = true; try { String.fromCharCode.apply(null, [0]); } catch (e57) { i25 = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (e57) { s17 = false; } for (var u11 = new h7.Buf8(256), n44 = 0; n44 < 256; n44++) u11[n44] = 252 <= n44 ? 6 : 248 <= n44 ? 5 : 240 <= n44 ? 4 : 224 <= n44 ? 3 : 192 <= n44 ? 2 : 1; function l20(e57, t45) { if (t45 < 65537 && (e57.subarray && s17 || !e57.subarray && i25)) return String.fromCharCode.apply(null, h7.shrinkBuf(e57, t45)); for (var r86 = "", n45 = 0; n45 < t45; n45++) r86 += String.fromCharCode(e57[n45]); return r86; } u11[254] = u11[254] = 1, r85.string2buf = function(e57) { var t45, r86, n45, i26, s18, a45 = e57.length, o87 = 0; for (i26 = 0; i26 < a45; i26++) 55296 == (64512 & (r86 = e57.charCodeAt(i26))) && i26 + 1 < a45 && 56320 == (64512 & (n45 = e57.charCodeAt(i26 + 1))) && (r86 = 65536 + (r86 - 55296 << 10) + (n45 - 56320), i26++), o87 += r86 < 128 ? 1 : r86 < 2048 ? 2 : r86 < 65536 ? 3 : 4; for (t45 = new h7.Buf8(o87), i26 = s18 = 0; s18 < o87; i26++) 55296 == (64512 & (r86 = e57.charCodeAt(i26))) && i26 + 1 < a45 && 56320 == (64512 & (n45 = e57.charCodeAt(i26 + 1))) && (r86 = 65536 + (r86 - 55296 << 10) + (n45 - 56320), i26++), r86 < 128 ? t45[s18++] = r86 : (r86 < 2048 ? t45[s18++] = 192 | r86 >>> 6 : (r86 < 65536 ? t45[s18++] = 224 | r86 >>> 12 : (t45[s18++] = 240 | r86 >>> 18, t45[s18++] = 128 | r86 >>> 12 & 63), t45[s18++] = 128 | r86 >>> 6 & 63), t45[s18++] = 128 | 63 & r86); return t45; }, r85.buf2binstring = function(e57) { return l20(e57, e57.length); }, r85.binstring2buf = function(e57) { for (var t45 = new h7.Buf8(e57.length), r86 = 0, n45 = t45.length; r86 < n45; r86++) t45[r86] = e57.charCodeAt(r86); return t45; }, r85.buf2string = function(e57, t45) { var r86, n45, i26, s18, a45 = t45 || e57.length, o87 = new Array(2 * a45); for (r86 = n45 = 0; r86 < a45; ) if ((i26 = e57[r86++]) < 128) o87[n45++] = i26; else if (4 < (s18 = u11[i26])) o87[n45++] = 65533, r86 += s18 - 1; else { for (i26 &= 2 === s18 ? 31 : 3 === s18 ? 15 : 7; 1 < s18 && r86 < a45; ) i26 = i26 << 6 | 63 & e57[r86++], s18--; 1 < s18 ? o87[n45++] = 65533 : i26 < 65536 ? o87[n45++] = i26 : (i26 -= 65536, o87[n45++] = 55296 | i26 >> 10 & 1023, o87[n45++] = 56320 | 1023 & i26); } return l20(o87, n45); }, r85.utf8border = function(e57, t45) { var r86; for ((t45 = t45 || e57.length) > e57.length && (t45 = e57.length), r86 = t45 - 1; 0 <= r86 && 128 == (192 & e57[r86]); ) r86--; return r86 < 0 ? t45 : 0 === r86 ? t45 : r86 + u11[e57[r86]] > t45 ? r86 : t45; }; }, { "./common": 41 }], 43: [function(e56, t44, r85) { "use strict"; t44.exports = function(e57, t45, r86, n44) { for (var i25 = 65535 & e57 | 0, s17 = e57 >>> 16 & 65535 | 0, a45 = 0; 0 !== r86; ) { for (r86 -= a45 = 2e3 < r86 ? 2e3 : r86; s17 = s17 + (i25 = i25 + t45[n44++] | 0) | 0, --a45; ) ; i25 %= 65521, s17 %= 65521; } return i25 | s17 << 16 | 0; }; }, {}], 44: [function(e56, t44, r85) { "use strict"; t44.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 }; }, {}], 45: [function(e56, t44, r85) { "use strict"; var o87 = (function() { for (var e57, t45 = [], r86 = 0; r86 < 256; r86++) { e57 = r86; for (var n44 = 0; n44 < 8; n44++) e57 = 1 & e57 ? 3988292384 ^ e57 >>> 1 : e57 >>> 1; t45[r86] = e57; } return t45; })(); t44.exports = function(e57, t45, r86, n44) { var i25 = o87, s17 = n44 + r86; e57 ^= -1; for (var a45 = n44; a45 < s17; a45++) e57 = e57 >>> 8 ^ i25[255 & (e57 ^ t45[a45])]; return -1 ^ e57; }; }, {}], 46: [function(e56, t44, r85) { "use strict"; var h7, c27 = e56("../utils/common"), u11 = e56("./trees"), d33 = e56("./adler32"), p8 = e56("./crc32"), n44 = e56("./messages"), l20 = 0, f7 = 4, m5 = 0, _3 = -2, g8 = -1, b7 = 4, i25 = 2, v7 = 8, y3 = 9, s17 = 286, a45 = 30, o87 = 19, w3 = 2 * s17 + 1, k6 = 15, x3 = 3, S4 = 258, z3 = S4 + x3 + 1, C5 = 42, E4 = 113, A3 = 1, I3 = 2, O3 = 3, B5 = 4; function R4(e57, t45) { return e57.msg = n44[t45], t45; } function T4(e57) { return (e57 << 1) - (4 < e57 ? 9 : 0); } function D4(e57) { for (var t45 = e57.length; 0 <= --t45; ) e57[t45] = 0; } function F16(e57) { var t45 = e57.state, r86 = t45.pending; r86 > e57.avail_out && (r86 = e57.avail_out), 0 !== r86 && (c27.arraySet(e57.output, t45.pending_buf, t45.pending_out, r86, e57.next_out), e57.next_out += r86, t45.pending_out += r86, e57.total_out += r86, e57.avail_out -= r86, t45.pending -= r86, 0 === t45.pending && (t45.pending_out = 0)); } function N4(e57, t45) { u11._tr_flush_block(e57, 0 <= e57.block_start ? e57.block_start : -1, e57.strstart - e57.block_start, t45), e57.block_start = e57.strstart, F16(e57.strm); } function U3(e57, t45) { e57.pending_buf[e57.pending++] = t45; } function P3(e57, t45) { e57.pending_buf[e57.pending++] = t45 >>> 8 & 255, e57.pending_buf[e57.pending++] = 255 & t45; } function L2(e57, t45) { var r86, n45, i26 = e57.max_chain_length, s18 = e57.strstart, a46 = e57.prev_length, o88 = e57.nice_match, h8 = e57.strstart > e57.w_size - z3 ? e57.strstart - (e57.w_size - z3) : 0, u12 = e57.window, l21 = e57.w_mask, f8 = e57.prev, c28 = e57.strstart + S4, d34 = u12[s18 + a46 - 1], p9 = u12[s18 + a46]; e57.prev_length >= e57.good_match && (i26 >>= 2), o88 > e57.lookahead && (o88 = e57.lookahead); do { if (u12[(r86 = t45) + a46] === p9 && u12[r86 + a46 - 1] === d34 && u12[r86] === u12[s18] && u12[++r86] === u12[s18 + 1]) { s18 += 2, r86++; do { } while (u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && u12[++s18] === u12[++r86] && s18 < c28); if (n45 = S4 - (c28 - s18), s18 = c28 - S4, a46 < n45) { if (e57.match_start = t45, o88 <= (a46 = n45)) break; d34 = u12[s18 + a46 - 1], p9 = u12[s18 + a46]; } } } while ((t45 = f8[t45 & l21]) > h8 && 0 != --i26); return a46 <= e57.lookahead ? a46 : e57.lookahead; } function j3(e57) { var t45, r86, n45, i26, s18, a46, o88, h8, u12, l21, f8 = e57.w_size; do { if (i26 = e57.window_size - e57.lookahead - e57.strstart, e57.strstart >= f8 + (f8 - z3)) { for (c27.arraySet(e57.window, e57.window, f8, f8, 0), e57.match_start -= f8, e57.strstart -= f8, e57.block_start -= f8, t45 = r86 = e57.hash_size; n45 = e57.head[--t45], e57.head[t45] = f8 <= n45 ? n45 - f8 : 0, --r86; ) ; for (t45 = r86 = f8; n45 = e57.prev[--t45], e57.prev[t45] = f8 <= n45 ? n45 - f8 : 0, --r86; ) ; i26 += f8; } if (0 === e57.strm.avail_in) break; if (a46 = e57.strm, o88 = e57.window, h8 = e57.strstart + e57.lookahead, u12 = i26, l21 = void 0, l21 = a46.avail_in, u12 < l21 && (l21 = u12), r86 = 0 === l21 ? 0 : (a46.avail_in -= l21, c27.arraySet(o88, a46.input, a46.next_in, l21, h8), 1 === a46.state.wrap ? a46.adler = d33(a46.adler, o88, l21, h8) : 2 === a46.state.wrap && (a46.adler = p8(a46.adler, o88, l21, h8)), a46.next_in += l21, a46.total_in += l21, l21), e57.lookahead += r86, e57.lookahead + e57.insert >= x3) for (s18 = e57.strstart - e57.insert, e57.ins_h = e57.window[s18], e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[s18 + 1]) & e57.hash_mask; e57.insert && (e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[s18 + x3 - 1]) & e57.hash_mask, e57.prev[s18 & e57.w_mask] = e57.head[e57.ins_h], e57.head[e57.ins_h] = s18, s18++, e57.insert--, !(e57.lookahead + e57.insert < x3)); ) ; } while (e57.lookahead < z3 && 0 !== e57.strm.avail_in); } function Z2(e57, t45) { for (var r86, n45; ; ) { if (e57.lookahead < z3) { if (j3(e57), e57.lookahead < z3 && t45 === l20) return A3; if (0 === e57.lookahead) break; } if (r86 = 0, e57.lookahead >= x3 && (e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[e57.strstart + x3 - 1]) & e57.hash_mask, r86 = e57.prev[e57.strstart & e57.w_mask] = e57.head[e57.ins_h], e57.head[e57.ins_h] = e57.strstart), 0 !== r86 && e57.strstart - r86 <= e57.w_size - z3 && (e57.match_length = L2(e57, r86)), e57.match_length >= x3) if (n45 = u11._tr_tally(e57, e57.strstart - e57.match_start, e57.match_length - x3), e57.lookahead -= e57.match_length, e57.match_length <= e57.max_lazy_match && e57.lookahead >= x3) { for (e57.match_length--; e57.strstart++, e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[e57.strstart + x3 - 1]) & e57.hash_mask, r86 = e57.prev[e57.strstart & e57.w_mask] = e57.head[e57.ins_h], e57.head[e57.ins_h] = e57.strstart, 0 != --e57.match_length; ) ; e57.strstart++; } else e57.strstart += e57.match_length, e57.match_length = 0, e57.ins_h = e57.window[e57.strstart], e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[e57.strstart + 1]) & e57.hash_mask; else n45 = u11._tr_tally(e57, 0, e57.window[e57.strstart]), e57.lookahead--, e57.strstart++; if (n45 && (N4(e57, false), 0 === e57.strm.avail_out)) return A3; } return e57.insert = e57.strstart < x3 - 1 ? e57.strstart : x3 - 1, t45 === f7 ? (N4(e57, true), 0 === e57.strm.avail_out ? O3 : B5) : e57.last_lit && (N4(e57, false), 0 === e57.strm.avail_out) ? A3 : I3; } function W3(e57, t45) { for (var r86, n45, i26; ; ) { if (e57.lookahead < z3) { if (j3(e57), e57.lookahead < z3 && t45 === l20) return A3; if (0 === e57.lookahead) break; } if (r86 = 0, e57.lookahead >= x3 && (e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[e57.strstart + x3 - 1]) & e57.hash_mask, r86 = e57.prev[e57.strstart & e57.w_mask] = e57.head[e57.ins_h], e57.head[e57.ins_h] = e57.strstart), e57.prev_length = e57.match_length, e57.prev_match = e57.match_start, e57.match_length = x3 - 1, 0 !== r86 && e57.prev_length < e57.max_lazy_match && e57.strstart - r86 <= e57.w_size - z3 && (e57.match_length = L2(e57, r86), e57.match_length <= 5 && (1 === e57.strategy || e57.match_length === x3 && 4096 < e57.strstart - e57.match_start) && (e57.match_length = x3 - 1)), e57.prev_length >= x3 && e57.match_length <= e57.prev_length) { for (i26 = e57.strstart + e57.lookahead - x3, n45 = u11._tr_tally(e57, e57.strstart - 1 - e57.prev_match, e57.prev_length - x3), e57.lookahead -= e57.prev_length - 1, e57.prev_length -= 2; ++e57.strstart <= i26 && (e57.ins_h = (e57.ins_h << e57.hash_shift ^ e57.window[e57.strstart + x3 - 1]) & e57.hash_mask, r86 = e57.prev[e57.strstart & e57.w_mask] = e57.head[e57.ins_h], e57.head[e57.ins_h] = e57.strstart), 0 != --e57.prev_length; ) ; if (e57.match_available = 0, e57.match_length = x3 - 1, e57.strstart++, n45 && (N4(e57, false), 0 === e57.strm.avail_out)) return A3; } else if (e57.match_available) { if ((n45 = u11._tr_tally(e57, 0, e57.window[e57.strstart - 1])) && N4(e57, false), e57.strstart++, e57.lookahead--, 0 === e57.strm.avail_out) return A3; } else e57.match_available = 1, e57.strstart++, e57.lookahead--; } return e57.match_available && (n45 = u11._tr_tally(e57, 0, e57.window[e57.strstart - 1]), e57.match_available = 0), e57.insert = e57.strstart < x3 - 1 ? e57.strstart : x3 - 1, t45 === f7 ? (N4(e57, true), 0 === e57.strm.avail_out ? O3 : B5) : e57.last_lit && (N4(e57, false), 0 === e57.strm.avail_out) ? A3 : I3; } function M4(e57, t45, r86, n45, i26) { this.good_length = e57, this.max_lazy = t45, this.nice_length = r86, this.max_chain = n45, this.func = i26; } function H3() { this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v7, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c27.Buf16(2 * w3), this.dyn_dtree = new c27.Buf16(2 * (2 * a45 + 1)), this.bl_tree = new c27.Buf16(2 * (2 * o87 + 1)), D4(this.dyn_ltree), D4(this.dyn_dtree), D4(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c27.Buf16(k6 + 1), this.heap = new c27.Buf16(2 * s17 + 1), D4(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c27.Buf16(2 * s17 + 1), D4(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0; } function G4(e57) { var t45; return e57 && e57.state ? (e57.total_in = e57.total_out = 0, e57.data_type = i25, (t45 = e57.state).pending = 0, t45.pending_out = 0, t45.wrap < 0 && (t45.wrap = -t45.wrap), t45.status = t45.wrap ? C5 : E4, e57.adler = 2 === t45.wrap ? 0 : 1, t45.last_flush = l20, u11._tr_init(t45), m5) : R4(e57, _3); } function K4(e57) { var t45 = G4(e57); return t45 === m5 && (function(e58) { e58.window_size = 2 * e58.w_size, D4(e58.head), e58.max_lazy_match = h7[e58.level].max_lazy, e58.good_match = h7[e58.level].good_length, e58.nice_match = h7[e58.level].nice_length, e58.max_chain_length = h7[e58.level].max_chain, e58.strstart = 0, e58.block_start = 0, e58.lookahead = 0, e58.insert = 0, e58.match_length = e58.prev_length = x3 - 1, e58.match_available = 0, e58.ins_h = 0; })(e57.state), t45; } function Y5(e57, t45, r86, n45, i26, s18) { if (!e57) return _3; var a46 = 1; if (t45 === g8 && (t45 = 6), n45 < 0 ? (a46 = 0, n45 = -n45) : 15 < n45 && (a46 = 2, n45 -= 16), i26 < 1 || y3 < i26 || r86 !== v7 || n45 < 8 || 15 < n45 || t45 < 0 || 9 < t45 || s18 < 0 || b7 < s18) return R4(e57, _3); 8 === n45 && (n45 = 9); var o88 = new H3(); return (e57.state = o88).strm = e57, o88.wrap = a46, o88.gzhead = null, o88.w_bits = n45, o88.w_size = 1 << o88.w_bits, o88.w_mask = o88.w_size - 1, o88.hash_bits = i26 + 7, o88.hash_size = 1 << o88.hash_bits, o88.hash_mask = o88.hash_size - 1, o88.hash_shift = ~~((o88.hash_bits + x3 - 1) / x3), o88.window = new c27.Buf8(2 * o88.w_size), o88.head = new c27.Buf16(o88.hash_size), o88.prev = new c27.Buf16(o88.w_size), o88.lit_bufsize = 1 << i26 + 6, o88.pending_buf_size = 4 * o88.lit_bufsize, o88.pending_buf = new c27.Buf8(o88.pending_buf_size), o88.d_buf = 1 * o88.lit_bufsize, o88.l_buf = 3 * o88.lit_bufsize, o88.level = t45, o88.strategy = s18, o88.method = r86, K4(e57); } h7 = [new M4(0, 0, 0, 0, function(e57, t45) { var r86 = 65535; for (r86 > e57.pending_buf_size - 5 && (r86 = e57.pending_buf_size - 5); ; ) { if (e57.lookahead <= 1) { if (j3(e57), 0 === e57.lookahead && t45 === l20) return A3; if (0 === e57.lookahead) break; } e57.strstart += e57.lookahead, e57.lookahead = 0; var n45 = e57.block_start + r86; if ((0 === e57.strstart || e57.strstart >= n45) && (e57.lookahead = e57.strstart - n45, e57.strstart = n45, N4(e57, false), 0 === e57.strm.avail_out)) return A3; if (e57.strstart - e57.block_start >= e57.w_size - z3 && (N4(e57, false), 0 === e57.strm.avail_out)) return A3; } return e57.insert = 0, t45 === f7 ? (N4(e57, true), 0 === e57.strm.avail_out ? O3 : B5) : (e57.strstart > e57.block_start && (N4(e57, false), e57.strm.avail_out), A3); }), new M4(4, 4, 8, 4, Z2), new M4(4, 5, 16, 8, Z2), new M4(4, 6, 32, 32, Z2), new M4(4, 4, 16, 16, W3), new M4(8, 16, 32, 32, W3), new M4(8, 16, 128, 128, W3), new M4(8, 32, 128, 256, W3), new M4(32, 128, 258, 1024, W3), new M4(32, 258, 258, 4096, W3)], r85.deflateInit = function(e57, t45) { return Y5(e57, t45, v7, 15, 8, 0); }, r85.deflateInit2 = Y5, r85.deflateReset = K4, r85.deflateResetKeep = G4, r85.deflateSetHeader = function(e57, t45) { return e57 && e57.state ? 2 !== e57.state.wrap ? _3 : (e57.state.gzhead = t45, m5) : _3; }, r85.deflate = function(e57, t45) { var r86, n45, i26, s18; if (!e57 || !e57.state || 5 < t45 || t45 < 0) return e57 ? R4(e57, _3) : _3; if (n45 = e57.state, !e57.output || !e57.input && 0 !== e57.avail_in || 666 === n45.status && t45 !== f7) return R4(e57, 0 === e57.avail_out ? -5 : _3); if (n45.strm = e57, r86 = n45.last_flush, n45.last_flush = t45, n45.status === C5) if (2 === n45.wrap) e57.adler = 0, U3(n45, 31), U3(n45, 139), U3(n45, 8), n45.gzhead ? (U3(n45, (n45.gzhead.text ? 1 : 0) + (n45.gzhead.hcrc ? 2 : 0) + (n45.gzhead.extra ? 4 : 0) + (n45.gzhead.name ? 8 : 0) + (n45.gzhead.comment ? 16 : 0)), U3(n45, 255 & n45.gzhead.time), U3(n45, n45.gzhead.time >> 8 & 255), U3(n45, n45.gzhead.time >> 16 & 255), U3(n45, n45.gzhead.time >> 24 & 255), U3(n45, 9 === n45.level ? 2 : 2 <= n45.strategy || n45.level < 2 ? 4 : 0), U3(n45, 255 & n45.gzhead.os), n45.gzhead.extra && n45.gzhead.extra.length && (U3(n45, 255 & n45.gzhead.extra.length), U3(n45, n45.gzhead.extra.length >> 8 & 255)), n45.gzhead.hcrc && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending, 0)), n45.gzindex = 0, n45.status = 69) : (U3(n45, 0), U3(n45, 0), U3(n45, 0), U3(n45, 0), U3(n45, 0), U3(n45, 9 === n45.level ? 2 : 2 <= n45.strategy || n45.level < 2 ? 4 : 0), U3(n45, 3), n45.status = E4); else { var a46 = v7 + (n45.w_bits - 8 << 4) << 8; a46 |= (2 <= n45.strategy || n45.level < 2 ? 0 : n45.level < 6 ? 1 : 6 === n45.level ? 2 : 3) << 6, 0 !== n45.strstart && (a46 |= 32), a46 += 31 - a46 % 31, n45.status = E4, P3(n45, a46), 0 !== n45.strstart && (P3(n45, e57.adler >>> 16), P3(n45, 65535 & e57.adler)), e57.adler = 1; } if (69 === n45.status) if (n45.gzhead.extra) { for (i26 = n45.pending; n45.gzindex < (65535 & n45.gzhead.extra.length) && (n45.pending !== n45.pending_buf_size || (n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), F16(e57), i26 = n45.pending, n45.pending !== n45.pending_buf_size)); ) U3(n45, 255 & n45.gzhead.extra[n45.gzindex]), n45.gzindex++; n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), n45.gzindex === n45.gzhead.extra.length && (n45.gzindex = 0, n45.status = 73); } else n45.status = 73; if (73 === n45.status) if (n45.gzhead.name) { i26 = n45.pending; do { if (n45.pending === n45.pending_buf_size && (n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), F16(e57), i26 = n45.pending, n45.pending === n45.pending_buf_size)) { s18 = 1; break; } s18 = n45.gzindex < n45.gzhead.name.length ? 255 & n45.gzhead.name.charCodeAt(n45.gzindex++) : 0, U3(n45, s18); } while (0 !== s18); n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), 0 === s18 && (n45.gzindex = 0, n45.status = 91); } else n45.status = 91; if (91 === n45.status) if (n45.gzhead.comment) { i26 = n45.pending; do { if (n45.pending === n45.pending_buf_size && (n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), F16(e57), i26 = n45.pending, n45.pending === n45.pending_buf_size)) { s18 = 1; break; } s18 = n45.gzindex < n45.gzhead.comment.length ? 255 & n45.gzhead.comment.charCodeAt(n45.gzindex++) : 0, U3(n45, s18); } while (0 !== s18); n45.gzhead.hcrc && n45.pending > i26 && (e57.adler = p8(e57.adler, n45.pending_buf, n45.pending - i26, i26)), 0 === s18 && (n45.status = 103); } else n45.status = 103; if (103 === n45.status && (n45.gzhead.hcrc ? (n45.pending + 2 > n45.pending_buf_size && F16(e57), n45.pending + 2 <= n45.pending_buf_size && (U3(n45, 255 & e57.adler), U3(n45, e57.adler >> 8 & 255), e57.adler = 0, n45.status = E4)) : n45.status = E4), 0 !== n45.pending) { if (F16(e57), 0 === e57.avail_out) return n45.last_flush = -1, m5; } else if (0 === e57.avail_in && T4(t45) <= T4(r86) && t45 !== f7) return R4(e57, -5); if (666 === n45.status && 0 !== e57.avail_in) return R4(e57, -5); if (0 !== e57.avail_in || 0 !== n45.lookahead || t45 !== l20 && 666 !== n45.status) { var o88 = 2 === n45.strategy ? (function(e58, t46) { for (var r87; ; ) { if (0 === e58.lookahead && (j3(e58), 0 === e58.lookahead)) { if (t46 === l20) return A3; break; } if (e58.match_length = 0, r87 = u11._tr_tally(e58, 0, e58.window[e58.strstart]), e58.lookahead--, e58.strstart++, r87 && (N4(e58, false), 0 === e58.strm.avail_out)) return A3; } return e58.insert = 0, t46 === f7 ? (N4(e58, true), 0 === e58.strm.avail_out ? O3 : B5) : e58.last_lit && (N4(e58, false), 0 === e58.strm.avail_out) ? A3 : I3; })(n45, t45) : 3 === n45.strategy ? (function(e58, t46) { for (var r87, n46, i27, s19, a47 = e58.window; ; ) { if (e58.lookahead <= S4) { if (j3(e58), e58.lookahead <= S4 && t46 === l20) return A3; if (0 === e58.lookahead) break; } if (e58.match_length = 0, e58.lookahead >= x3 && 0 < e58.strstart && (n46 = a47[i27 = e58.strstart - 1]) === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27]) { s19 = e58.strstart + S4; do { } while (n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && n46 === a47[++i27] && i27 < s19); e58.match_length = S4 - (s19 - i27), e58.match_length > e58.lookahead && (e58.match_length = e58.lookahead); } if (e58.match_length >= x3 ? (r87 = u11._tr_tally(e58, 1, e58.match_length - x3), e58.lookahead -= e58.match_length, e58.strstart += e58.match_length, e58.match_length = 0) : (r87 = u11._tr_tally(e58, 0, e58.window[e58.strstart]), e58.lookahead--, e58.strstart++), r87 && (N4(e58, false), 0 === e58.strm.avail_out)) return A3; } return e58.insert = 0, t46 === f7 ? (N4(e58, true), 0 === e58.strm.avail_out ? O3 : B5) : e58.last_lit && (N4(e58, false), 0 === e58.strm.avail_out) ? A3 : I3; })(n45, t45) : h7[n45.level].func(n45, t45); if (o88 !== O3 && o88 !== B5 || (n45.status = 666), o88 === A3 || o88 === O3) return 0 === e57.avail_out && (n45.last_flush = -1), m5; if (o88 === I3 && (1 === t45 ? u11._tr_align(n45) : 5 !== t45 && (u11._tr_stored_block(n45, 0, 0, false), 3 === t45 && (D4(n45.head), 0 === n45.lookahead && (n45.strstart = 0, n45.block_start = 0, n45.insert = 0))), F16(e57), 0 === e57.avail_out)) return n45.last_flush = -1, m5; } return t45 !== f7 ? m5 : n45.wrap <= 0 ? 1 : (2 === n45.wrap ? (U3(n45, 255 & e57.adler), U3(n45, e57.adler >> 8 & 255), U3(n45, e57.adler >> 16 & 255), U3(n45, e57.adler >> 24 & 255), U3(n45, 255 & e57.total_in), U3(n45, e57.total_in >> 8 & 255), U3(n45, e57.total_in >> 16 & 255), U3(n45, e57.total_in >> 24 & 255)) : (P3(n45, e57.adler >>> 16), P3(n45, 65535 & e57.adler)), F16(e57), 0 < n45.wrap && (n45.wrap = -n45.wrap), 0 !== n45.pending ? m5 : 1); }, r85.deflateEnd = function(e57) { var t45; return e57 && e57.state ? (t45 = e57.state.status) !== C5 && 69 !== t45 && 73 !== t45 && 91 !== t45 && 103 !== t45 && t45 !== E4 && 666 !== t45 ? R4(e57, _3) : (e57.state = null, t45 === E4 ? R4(e57, -3) : m5) : _3; }, r85.deflateSetDictionary = function(e57, t45) { var r86, n45, i26, s18, a46, o88, h8, u12, l21 = t45.length; if (!e57 || !e57.state) return _3; if (2 === (s18 = (r86 = e57.state).wrap) || 1 === s18 && r86.status !== C5 || r86.lookahead) return _3; for (1 === s18 && (e57.adler = d33(e57.adler, t45, l21, 0)), r86.wrap = 0, l21 >= r86.w_size && (0 === s18 && (D4(r86.head), r86.strstart = 0, r86.block_start = 0, r86.insert = 0), u12 = new c27.Buf8(r86.w_size), c27.arraySet(u12, t45, l21 - r86.w_size, r86.w_size, 0), t45 = u12, l21 = r86.w_size), a46 = e57.avail_in, o88 = e57.next_in, h8 = e57.input, e57.avail_in = l21, e57.next_in = 0, e57.input = t45, j3(r86); r86.lookahead >= x3; ) { for (n45 = r86.strstart, i26 = r86.lookahead - (x3 - 1); r86.ins_h = (r86.ins_h << r86.hash_shift ^ r86.window[n45 + x3 - 1]) & r86.hash_mask, r86.prev[n45 & r86.w_mask] = r86.head[r86.ins_h], r86.head[r86.ins_h] = n45, n45++, --i26; ) ; r86.strstart = n45, r86.lookahead = x3 - 1, j3(r86); } return r86.strstart += r86.lookahead, r86.block_start = r86.strstart, r86.insert = r86.lookahead, r86.lookahead = 0, r86.match_length = r86.prev_length = x3 - 1, r86.match_available = 0, e57.next_in = o88, e57.input = h8, e57.avail_in = a46, r86.wrap = s18, m5; }, r85.deflateInfo = "pako deflate (from Nodeca project)"; }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e56, t44, r85) { "use strict"; t44.exports = function() { this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false; }; }, {}], 48: [function(e56, t44, r85) { "use strict"; t44.exports = function(e57, t45) { var r86, n44, i25, s17, a45, o87, h7, u11, l20, f7, c27, d33, p8, m5, _3, g8, b7, v7, y3, w3, k6, x3, S4, z3, C5; r86 = e57.state, n44 = e57.next_in, z3 = e57.input, i25 = n44 + (e57.avail_in - 5), s17 = e57.next_out, C5 = e57.output, a45 = s17 - (t45 - e57.avail_out), o87 = s17 + (e57.avail_out - 257), h7 = r86.dmax, u11 = r86.wsize, l20 = r86.whave, f7 = r86.wnext, c27 = r86.window, d33 = r86.hold, p8 = r86.bits, m5 = r86.lencode, _3 = r86.distcode, g8 = (1 << r86.lenbits) - 1, b7 = (1 << r86.distbits) - 1; e: do { p8 < 15 && (d33 += z3[n44++] << p8, p8 += 8, d33 += z3[n44++] << p8, p8 += 8), v7 = m5[d33 & g8]; t: for (; ; ) { if (d33 >>>= y3 = v7 >>> 24, p8 -= y3, 0 === (y3 = v7 >>> 16 & 255)) C5[s17++] = 65535 & v7; else { if (!(16 & y3)) { if (0 == (64 & y3)) { v7 = m5[(65535 & v7) + (d33 & (1 << y3) - 1)]; continue t; } if (32 & y3) { r86.mode = 12; break e; } e57.msg = "invalid literal/length code", r86.mode = 30; break e; } w3 = 65535 & v7, (y3 &= 15) && (p8 < y3 && (d33 += z3[n44++] << p8, p8 += 8), w3 += d33 & (1 << y3) - 1, d33 >>>= y3, p8 -= y3), p8 < 15 && (d33 += z3[n44++] << p8, p8 += 8, d33 += z3[n44++] << p8, p8 += 8), v7 = _3[d33 & b7]; r: for (; ; ) { if (d33 >>>= y3 = v7 >>> 24, p8 -= y3, !(16 & (y3 = v7 >>> 16 & 255))) { if (0 == (64 & y3)) { v7 = _3[(65535 & v7) + (d33 & (1 << y3) - 1)]; continue r; } e57.msg = "invalid distance code", r86.mode = 30; break e; } if (k6 = 65535 & v7, p8 < (y3 &= 15) && (d33 += z3[n44++] << p8, (p8 += 8) < y3 && (d33 += z3[n44++] << p8, p8 += 8)), h7 < (k6 += d33 & (1 << y3) - 1)) { e57.msg = "invalid distance too far back", r86.mode = 30; break e; } if (d33 >>>= y3, p8 -= y3, (y3 = s17 - a45) < k6) { if (l20 < (y3 = k6 - y3) && r86.sane) { e57.msg = "invalid distance too far back", r86.mode = 30; break e; } if (S4 = c27, (x3 = 0) === f7) { if (x3 += u11 - y3, y3 < w3) { for (w3 -= y3; C5[s17++] = c27[x3++], --y3; ) ; x3 = s17 - k6, S4 = C5; } } else if (f7 < y3) { if (x3 += u11 + f7 - y3, (y3 -= f7) < w3) { for (w3 -= y3; C5[s17++] = c27[x3++], --y3; ) ; if (x3 = 0, f7 < w3) { for (w3 -= y3 = f7; C5[s17++] = c27[x3++], --y3; ) ; x3 = s17 - k6, S4 = C5; } } } else if (x3 += f7 - y3, y3 < w3) { for (w3 -= y3; C5[s17++] = c27[x3++], --y3; ) ; x3 = s17 - k6, S4 = C5; } for (; 2 < w3; ) C5[s17++] = S4[x3++], C5[s17++] = S4[x3++], C5[s17++] = S4[x3++], w3 -= 3; w3 && (C5[s17++] = S4[x3++], 1 < w3 && (C5[s17++] = S4[x3++])); } else { for (x3 = s17 - k6; C5[s17++] = C5[x3++], C5[s17++] = C5[x3++], C5[s17++] = C5[x3++], 2 < (w3 -= 3); ) ; w3 && (C5[s17++] = C5[x3++], 1 < w3 && (C5[s17++] = C5[x3++])); } break; } } break; } } while (n44 < i25 && s17 < o87); n44 -= w3 = p8 >> 3, d33 &= (1 << (p8 -= w3 << 3)) - 1, e57.next_in = n44, e57.next_out = s17, e57.avail_in = n44 < i25 ? i25 - n44 + 5 : 5 - (n44 - i25), e57.avail_out = s17 < o87 ? o87 - s17 + 257 : 257 - (s17 - o87), r86.hold = d33, r86.bits = p8; }; }, {}], 49: [function(e56, t44, r85) { "use strict"; var I3 = e56("../utils/common"), O3 = e56("./adler32"), B5 = e56("./crc32"), R4 = e56("./inffast"), T4 = e56("./inftrees"), D4 = 1, F16 = 2, N4 = 0, U3 = -2, P3 = 1, n44 = 852, i25 = 592; function L2(e57) { return (e57 >>> 24 & 255) + (e57 >>> 8 & 65280) + ((65280 & e57) << 8) + ((255 & e57) << 24); } function s17() { this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I3.Buf16(320), this.work = new I3.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0; } function a45(e57) { var t45; return e57 && e57.state ? (t45 = e57.state, e57.total_in = e57.total_out = t45.total = 0, e57.msg = "", t45.wrap && (e57.adler = 1 & t45.wrap), t45.mode = P3, t45.last = 0, t45.havedict = 0, t45.dmax = 32768, t45.head = null, t45.hold = 0, t45.bits = 0, t45.lencode = t45.lendyn = new I3.Buf32(n44), t45.distcode = t45.distdyn = new I3.Buf32(i25), t45.sane = 1, t45.back = -1, N4) : U3; } function o87(e57) { var t45; return e57 && e57.state ? ((t45 = e57.state).wsize = 0, t45.whave = 0, t45.wnext = 0, a45(e57)) : U3; } function h7(e57, t45) { var r86, n45; return e57 && e57.state ? (n45 = e57.state, t45 < 0 ? (r86 = 0, t45 = -t45) : (r86 = 1 + (t45 >> 4), t45 < 48 && (t45 &= 15)), t45 && (t45 < 8 || 15 < t45) ? U3 : (null !== n45.window && n45.wbits !== t45 && (n45.window = null), n45.wrap = r86, n45.wbits = t45, o87(e57))) : U3; } function u11(e57, t45) { var r86, n45; return e57 ? (n45 = new s17(), (e57.state = n45).window = null, (r86 = h7(e57, t45)) !== N4 && (e57.state = null), r86) : U3; } var l20, f7, c27 = true; function j3(e57) { if (c27) { var t45; for (l20 = new I3.Buf32(512), f7 = new I3.Buf32(32), t45 = 0; t45 < 144; ) e57.lens[t45++] = 8; for (; t45 < 256; ) e57.lens[t45++] = 9; for (; t45 < 280; ) e57.lens[t45++] = 7; for (; t45 < 288; ) e57.lens[t45++] = 8; for (T4(D4, e57.lens, 0, 288, l20, 0, e57.work, { bits: 9 }), t45 = 0; t45 < 32; ) e57.lens[t45++] = 5; T4(F16, e57.lens, 0, 32, f7, 0, e57.work, { bits: 5 }), c27 = false; } e57.lencode = l20, e57.lenbits = 9, e57.distcode = f7, e57.distbits = 5; } function Z2(e57, t45, r86, n45) { var i26, s18 = e57.state; return null === s18.window && (s18.wsize = 1 << s18.wbits, s18.wnext = 0, s18.whave = 0, s18.window = new I3.Buf8(s18.wsize)), n45 >= s18.wsize ? (I3.arraySet(s18.window, t45, r86 - s18.wsize, s18.wsize, 0), s18.wnext = 0, s18.whave = s18.wsize) : (n45 < (i26 = s18.wsize - s18.wnext) && (i26 = n45), I3.arraySet(s18.window, t45, r86 - n45, i26, s18.wnext), (n45 -= i26) ? (I3.arraySet(s18.window, t45, r86 - n45, n45, 0), s18.wnext = n45, s18.whave = s18.wsize) : (s18.wnext += i26, s18.wnext === s18.wsize && (s18.wnext = 0), s18.whave < s18.wsize && (s18.whave += i26))), 0; } r85.inflateReset = o87, r85.inflateReset2 = h7, r85.inflateResetKeep = a45, r85.inflateInit = function(e57) { return u11(e57, 15); }, r85.inflateInit2 = u11, r85.inflate = function(e57, t45) { var r86, n45, i26, s18, a46, o88, h8, u12, l21, f8, c28, d33, p8, m5, _3, g8, b7, v7, y3, w3, k6, x3, S4, z3, C5 = 0, E4 = new I3.Buf8(4), A3 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!e57 || !e57.state || !e57.output || !e57.input && 0 !== e57.avail_in) return U3; 12 === (r86 = e57.state).mode && (r86.mode = 13), a46 = e57.next_out, i26 = e57.output, h8 = e57.avail_out, s18 = e57.next_in, n45 = e57.input, o88 = e57.avail_in, u12 = r86.hold, l21 = r86.bits, f8 = o88, c28 = h8, x3 = N4; e: for (; ; ) switch (r86.mode) { case P3: if (0 === r86.wrap) { r86.mode = 13; break; } for (; l21 < 16; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (2 & r86.wrap && 35615 === u12) { E4[r86.check = 0] = 255 & u12, E4[1] = u12 >>> 8 & 255, r86.check = B5(r86.check, E4, 2, 0), l21 = u12 = 0, r86.mode = 2; break; } if (r86.flags = 0, r86.head && (r86.head.done = false), !(1 & r86.wrap) || (((255 & u12) << 8) + (u12 >> 8)) % 31) { e57.msg = "incorrect header check", r86.mode = 30; break; } if (8 != (15 & u12)) { e57.msg = "unknown compression method", r86.mode = 30; break; } if (l21 -= 4, k6 = 8 + (15 & (u12 >>>= 4)), 0 === r86.wbits) r86.wbits = k6; else if (k6 > r86.wbits) { e57.msg = "invalid window size", r86.mode = 30; break; } r86.dmax = 1 << k6, e57.adler = r86.check = 1, r86.mode = 512 & u12 ? 10 : 12, l21 = u12 = 0; break; case 2: for (; l21 < 16; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (r86.flags = u12, 8 != (255 & r86.flags)) { e57.msg = "unknown compression method", r86.mode = 30; break; } if (57344 & r86.flags) { e57.msg = "unknown header flags set", r86.mode = 30; break; } r86.head && (r86.head.text = u12 >> 8 & 1), 512 & r86.flags && (E4[0] = 255 & u12, E4[1] = u12 >>> 8 & 255, r86.check = B5(r86.check, E4, 2, 0)), l21 = u12 = 0, r86.mode = 3; case 3: for (; l21 < 32; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.head && (r86.head.time = u12), 512 & r86.flags && (E4[0] = 255 & u12, E4[1] = u12 >>> 8 & 255, E4[2] = u12 >>> 16 & 255, E4[3] = u12 >>> 24 & 255, r86.check = B5(r86.check, E4, 4, 0)), l21 = u12 = 0, r86.mode = 4; case 4: for (; l21 < 16; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.head && (r86.head.xflags = 255 & u12, r86.head.os = u12 >> 8), 512 & r86.flags && (E4[0] = 255 & u12, E4[1] = u12 >>> 8 & 255, r86.check = B5(r86.check, E4, 2, 0)), l21 = u12 = 0, r86.mode = 5; case 5: if (1024 & r86.flags) { for (; l21 < 16; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.length = u12, r86.head && (r86.head.extra_len = u12), 512 & r86.flags && (E4[0] = 255 & u12, E4[1] = u12 >>> 8 & 255, r86.check = B5(r86.check, E4, 2, 0)), l21 = u12 = 0; } else r86.head && (r86.head.extra = null); r86.mode = 6; case 6: if (1024 & r86.flags && (o88 < (d33 = r86.length) && (d33 = o88), d33 && (r86.head && (k6 = r86.head.extra_len - r86.length, r86.head.extra || (r86.head.extra = new Array(r86.head.extra_len)), I3.arraySet(r86.head.extra, n45, s18, d33, k6)), 512 & r86.flags && (r86.check = B5(r86.check, n45, d33, s18)), o88 -= d33, s18 += d33, r86.length -= d33), r86.length)) break e; r86.length = 0, r86.mode = 7; case 7: if (2048 & r86.flags) { if (0 === o88) break e; for (d33 = 0; k6 = n45[s18 + d33++], r86.head && k6 && r86.length < 65536 && (r86.head.name += String.fromCharCode(k6)), k6 && d33 < o88; ) ; if (512 & r86.flags && (r86.check = B5(r86.check, n45, d33, s18)), o88 -= d33, s18 += d33, k6) break e; } else r86.head && (r86.head.name = null); r86.length = 0, r86.mode = 8; case 8: if (4096 & r86.flags) { if (0 === o88) break e; for (d33 = 0; k6 = n45[s18 + d33++], r86.head && k6 && r86.length < 65536 && (r86.head.comment += String.fromCharCode(k6)), k6 && d33 < o88; ) ; if (512 & r86.flags && (r86.check = B5(r86.check, n45, d33, s18)), o88 -= d33, s18 += d33, k6) break e; } else r86.head && (r86.head.comment = null); r86.mode = 9; case 9: if (512 & r86.flags) { for (; l21 < 16; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (u12 !== (65535 & r86.check)) { e57.msg = "header crc mismatch", r86.mode = 30; break; } l21 = u12 = 0; } r86.head && (r86.head.hcrc = r86.flags >> 9 & 1, r86.head.done = true), e57.adler = r86.check = 0, r86.mode = 12; break; case 10: for (; l21 < 32; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } e57.adler = r86.check = L2(u12), l21 = u12 = 0, r86.mode = 11; case 11: if (0 === r86.havedict) return e57.next_out = a46, e57.avail_out = h8, e57.next_in = s18, e57.avail_in = o88, r86.hold = u12, r86.bits = l21, 2; e57.adler = r86.check = 1, r86.mode = 12; case 12: if (5 === t45 || 6 === t45) break e; case 13: if (r86.last) { u12 >>>= 7 & l21, l21 -= 7 & l21, r86.mode = 27; break; } for (; l21 < 3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } switch (r86.last = 1 & u12, l21 -= 1, 3 & (u12 >>>= 1)) { case 0: r86.mode = 14; break; case 1: if (j3(r86), r86.mode = 20, 6 !== t45) break; u12 >>>= 2, l21 -= 2; break e; case 2: r86.mode = 17; break; case 3: e57.msg = "invalid block type", r86.mode = 30; } u12 >>>= 2, l21 -= 2; break; case 14: for (u12 >>>= 7 & l21, l21 -= 7 & l21; l21 < 32; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if ((65535 & u12) != (u12 >>> 16 ^ 65535)) { e57.msg = "invalid stored block lengths", r86.mode = 30; break; } if (r86.length = 65535 & u12, l21 = u12 = 0, r86.mode = 15, 6 === t45) break e; case 15: r86.mode = 16; case 16: if (d33 = r86.length) { if (o88 < d33 && (d33 = o88), h8 < d33 && (d33 = h8), 0 === d33) break e; I3.arraySet(i26, n45, s18, d33, a46), o88 -= d33, s18 += d33, h8 -= d33, a46 += d33, r86.length -= d33; break; } r86.mode = 12; break; case 17: for (; l21 < 14; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (r86.nlen = 257 + (31 & u12), u12 >>>= 5, l21 -= 5, r86.ndist = 1 + (31 & u12), u12 >>>= 5, l21 -= 5, r86.ncode = 4 + (15 & u12), u12 >>>= 4, l21 -= 4, 286 < r86.nlen || 30 < r86.ndist) { e57.msg = "too many length or distance symbols", r86.mode = 30; break; } r86.have = 0, r86.mode = 18; case 18: for (; r86.have < r86.ncode; ) { for (; l21 < 3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.lens[A3[r86.have++]] = 7 & u12, u12 >>>= 3, l21 -= 3; } for (; r86.have < 19; ) r86.lens[A3[r86.have++]] = 0; if (r86.lencode = r86.lendyn, r86.lenbits = 7, S4 = { bits: r86.lenbits }, x3 = T4(0, r86.lens, 0, 19, r86.lencode, 0, r86.work, S4), r86.lenbits = S4.bits, x3) { e57.msg = "invalid code lengths set", r86.mode = 30; break; } r86.have = 0, r86.mode = 19; case 19: for (; r86.have < r86.nlen + r86.ndist; ) { for (; g8 = (C5 = r86.lencode[u12 & (1 << r86.lenbits) - 1]) >>> 16 & 255, b7 = 65535 & C5, !((_3 = C5 >>> 24) <= l21); ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (b7 < 16) u12 >>>= _3, l21 -= _3, r86.lens[r86.have++] = b7; else { if (16 === b7) { for (z3 = _3 + 2; l21 < z3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (u12 >>>= _3, l21 -= _3, 0 === r86.have) { e57.msg = "invalid bit length repeat", r86.mode = 30; break; } k6 = r86.lens[r86.have - 1], d33 = 3 + (3 & u12), u12 >>>= 2, l21 -= 2; } else if (17 === b7) { for (z3 = _3 + 3; l21 < z3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } l21 -= _3, k6 = 0, d33 = 3 + (7 & (u12 >>>= _3)), u12 >>>= 3, l21 -= 3; } else { for (z3 = _3 + 7; l21 < z3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } l21 -= _3, k6 = 0, d33 = 11 + (127 & (u12 >>>= _3)), u12 >>>= 7, l21 -= 7; } if (r86.have + d33 > r86.nlen + r86.ndist) { e57.msg = "invalid bit length repeat", r86.mode = 30; break; } for (; d33--; ) r86.lens[r86.have++] = k6; } } if (30 === r86.mode) break; if (0 === r86.lens[256]) { e57.msg = "invalid code -- missing end-of-block", r86.mode = 30; break; } if (r86.lenbits = 9, S4 = { bits: r86.lenbits }, x3 = T4(D4, r86.lens, 0, r86.nlen, r86.lencode, 0, r86.work, S4), r86.lenbits = S4.bits, x3) { e57.msg = "invalid literal/lengths set", r86.mode = 30; break; } if (r86.distbits = 6, r86.distcode = r86.distdyn, S4 = { bits: r86.distbits }, x3 = T4(F16, r86.lens, r86.nlen, r86.ndist, r86.distcode, 0, r86.work, S4), r86.distbits = S4.bits, x3) { e57.msg = "invalid distances set", r86.mode = 30; break; } if (r86.mode = 20, 6 === t45) break e; case 20: r86.mode = 21; case 21: if (6 <= o88 && 258 <= h8) { e57.next_out = a46, e57.avail_out = h8, e57.next_in = s18, e57.avail_in = o88, r86.hold = u12, r86.bits = l21, R4(e57, c28), a46 = e57.next_out, i26 = e57.output, h8 = e57.avail_out, s18 = e57.next_in, n45 = e57.input, o88 = e57.avail_in, u12 = r86.hold, l21 = r86.bits, 12 === r86.mode && (r86.back = -1); break; } for (r86.back = 0; g8 = (C5 = r86.lencode[u12 & (1 << r86.lenbits) - 1]) >>> 16 & 255, b7 = 65535 & C5, !((_3 = C5 >>> 24) <= l21); ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (g8 && 0 == (240 & g8)) { for (v7 = _3, y3 = g8, w3 = b7; g8 = (C5 = r86.lencode[w3 + ((u12 & (1 << v7 + y3) - 1) >> v7)]) >>> 16 & 255, b7 = 65535 & C5, !(v7 + (_3 = C5 >>> 24) <= l21); ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } u12 >>>= v7, l21 -= v7, r86.back += v7; } if (u12 >>>= _3, l21 -= _3, r86.back += _3, r86.length = b7, 0 === g8) { r86.mode = 26; break; } if (32 & g8) { r86.back = -1, r86.mode = 12; break; } if (64 & g8) { e57.msg = "invalid literal/length code", r86.mode = 30; break; } r86.extra = 15 & g8, r86.mode = 22; case 22: if (r86.extra) { for (z3 = r86.extra; l21 < z3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.length += u12 & (1 << r86.extra) - 1, u12 >>>= r86.extra, l21 -= r86.extra, r86.back += r86.extra; } r86.was = r86.length, r86.mode = 23; case 23: for (; g8 = (C5 = r86.distcode[u12 & (1 << r86.distbits) - 1]) >>> 16 & 255, b7 = 65535 & C5, !((_3 = C5 >>> 24) <= l21); ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (0 == (240 & g8)) { for (v7 = _3, y3 = g8, w3 = b7; g8 = (C5 = r86.distcode[w3 + ((u12 & (1 << v7 + y3) - 1) >> v7)]) >>> 16 & 255, b7 = 65535 & C5, !(v7 + (_3 = C5 >>> 24) <= l21); ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } u12 >>>= v7, l21 -= v7, r86.back += v7; } if (u12 >>>= _3, l21 -= _3, r86.back += _3, 64 & g8) { e57.msg = "invalid distance code", r86.mode = 30; break; } r86.offset = b7, r86.extra = 15 & g8, r86.mode = 24; case 24: if (r86.extra) { for (z3 = r86.extra; l21 < z3; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } r86.offset += u12 & (1 << r86.extra) - 1, u12 >>>= r86.extra, l21 -= r86.extra, r86.back += r86.extra; } if (r86.offset > r86.dmax) { e57.msg = "invalid distance too far back", r86.mode = 30; break; } r86.mode = 25; case 25: if (0 === h8) break e; if (d33 = c28 - h8, r86.offset > d33) { if ((d33 = r86.offset - d33) > r86.whave && r86.sane) { e57.msg = "invalid distance too far back", r86.mode = 30; break; } p8 = d33 > r86.wnext ? (d33 -= r86.wnext, r86.wsize - d33) : r86.wnext - d33, d33 > r86.length && (d33 = r86.length), m5 = r86.window; } else m5 = i26, p8 = a46 - r86.offset, d33 = r86.length; for (h8 < d33 && (d33 = h8), h8 -= d33, r86.length -= d33; i26[a46++] = m5[p8++], --d33; ) ; 0 === r86.length && (r86.mode = 21); break; case 26: if (0 === h8) break e; i26[a46++] = r86.length, h8--, r86.mode = 21; break; case 27: if (r86.wrap) { for (; l21 < 32; ) { if (0 === o88) break e; o88--, u12 |= n45[s18++] << l21, l21 += 8; } if (c28 -= h8, e57.total_out += c28, r86.total += c28, c28 && (e57.adler = r86.check = r86.flags ? B5(r86.check, i26, c28, a46 - c28) : O3(r86.check, i26, c28, a46 - c28)), c28 = h8, (r86.flags ? u12 : L2(u12)) !== r86.check) { e57.msg = "incorrect data check", r86.mode = 30; break; } l21 = u12 = 0; } r86.mode = 28; case 28: if (r86.wrap && r86.flags) { for (; l21 < 32; ) { if (0 === o88) break e; o88--, u12 += n45[s18++] << l21, l21 += 8; } if (u12 !== (4294967295 & r86.total)) { e57.msg = "incorrect length check", r86.mode = 30; break; } l21 = u12 = 0; } r86.mode = 29; case 29: x3 = 1; break e; case 30: x3 = -3; break e; case 31: return -4; case 32: default: return U3; } return e57.next_out = a46, e57.avail_out = h8, e57.next_in = s18, e57.avail_in = o88, r86.hold = u12, r86.bits = l21, (r86.wsize || c28 !== e57.avail_out && r86.mode < 30 && (r86.mode < 27 || 4 !== t45)) && Z2(e57, e57.output, e57.next_out, c28 - e57.avail_out) ? (r86.mode = 31, -4) : (f8 -= e57.avail_in, c28 -= e57.avail_out, e57.total_in += f8, e57.total_out += c28, r86.total += c28, r86.wrap && c28 && (e57.adler = r86.check = r86.flags ? B5(r86.check, i26, c28, e57.next_out - c28) : O3(r86.check, i26, c28, e57.next_out - c28)), e57.data_type = r86.bits + (r86.last ? 64 : 0) + (12 === r86.mode ? 128 : 0) + (20 === r86.mode || 15 === r86.mode ? 256 : 0), (0 == f8 && 0 === c28 || 4 === t45) && x3 === N4 && (x3 = -5), x3); }, r85.inflateEnd = function(e57) { if (!e57 || !e57.state) return U3; var t45 = e57.state; return t45.window && (t45.window = null), e57.state = null, N4; }, r85.inflateGetHeader = function(e57, t45) { var r86; return e57 && e57.state ? 0 == (2 & (r86 = e57.state).wrap) ? U3 : ((r86.head = t45).done = false, N4) : U3; }, r85.inflateSetDictionary = function(e57, t45) { var r86, n45 = t45.length; return e57 && e57.state ? 0 !== (r86 = e57.state).wrap && 11 !== r86.mode ? U3 : 11 === r86.mode && O3(1, t45, n45, 0) !== r86.check ? -3 : Z2(e57, t45, n45, n45) ? (r86.mode = 31, -4) : (r86.havedict = 1, N4) : U3; }, r85.inflateInfo = "pako inflate (from Nodeca project)"; }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e56, t44, r85) { "use strict"; var D4 = e56("../utils/common"), F16 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N4 = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U3 = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P3 = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; t44.exports = function(e57, t45, r86, n44, i25, s17, a45, o87) { var h7, u11, l20, f7, c27, d33, p8, m5, _3, g8 = o87.bits, b7 = 0, v7 = 0, y3 = 0, w3 = 0, k6 = 0, x3 = 0, S4 = 0, z3 = 0, C5 = 0, E4 = 0, A3 = null, I3 = 0, O3 = new D4.Buf16(16), B5 = new D4.Buf16(16), R4 = null, T4 = 0; for (b7 = 0; b7 <= 15; b7++) O3[b7] = 0; for (v7 = 0; v7 < n44; v7++) O3[t45[r86 + v7]]++; for (k6 = g8, w3 = 15; 1 <= w3 && 0 === O3[w3]; w3--) ; if (w3 < k6 && (k6 = w3), 0 === w3) return i25[s17++] = 20971520, i25[s17++] = 20971520, o87.bits = 1, 0; for (y3 = 1; y3 < w3 && 0 === O3[y3]; y3++) ; for (k6 < y3 && (k6 = y3), b7 = z3 = 1; b7 <= 15; b7++) if (z3 <<= 1, (z3 -= O3[b7]) < 0) return -1; if (0 < z3 && (0 === e57 || 1 !== w3)) return -1; for (B5[1] = 0, b7 = 1; b7 < 15; b7++) B5[b7 + 1] = B5[b7] + O3[b7]; for (v7 = 0; v7 < n44; v7++) 0 !== t45[r86 + v7] && (a45[B5[t45[r86 + v7]]++] = v7); if (d33 = 0 === e57 ? (A3 = R4 = a45, 19) : 1 === e57 ? (A3 = F16, I3 -= 257, R4 = N4, T4 -= 257, 256) : (A3 = U3, R4 = P3, -1), b7 = y3, c27 = s17, S4 = v7 = E4 = 0, l20 = -1, f7 = (C5 = 1 << (x3 = k6)) - 1, 1 === e57 && 852 < C5 || 2 === e57 && 592 < C5) return 1; for (; ; ) { for (p8 = b7 - S4, _3 = a45[v7] < d33 ? (m5 = 0, a45[v7]) : a45[v7] > d33 ? (m5 = R4[T4 + a45[v7]], A3[I3 + a45[v7]]) : (m5 = 96, 0), h7 = 1 << b7 - S4, y3 = u11 = 1 << x3; i25[c27 + (E4 >> S4) + (u11 -= h7)] = p8 << 24 | m5 << 16 | _3 | 0, 0 !== u11; ) ; for (h7 = 1 << b7 - 1; E4 & h7; ) h7 >>= 1; if (0 !== h7 ? (E4 &= h7 - 1, E4 += h7) : E4 = 0, v7++, 0 == --O3[b7]) { if (b7 === w3) break; b7 = t45[r86 + a45[v7]]; } if (k6 < b7 && (E4 & f7) !== l20) { for (0 === S4 && (S4 = k6), c27 += y3, z3 = 1 << (x3 = b7 - S4); x3 + S4 < w3 && !((z3 -= O3[x3 + S4]) <= 0); ) x3++, z3 <<= 1; if (C5 += 1 << x3, 1 === e57 && 852 < C5 || 2 === e57 && 592 < C5) return 1; i25[l20 = E4 & f7] = k6 << 24 | x3 << 16 | c27 - s17 | 0; } } return 0 !== E4 && (i25[c27 + E4] = b7 - S4 << 24 | 64 << 16 | 0), o87.bits = k6, 0; }; }, { "../utils/common": 41 }], 51: [function(e56, t44, r85) { "use strict"; t44.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }; }, {}], 52: [function(e56, t44, r85) { "use strict"; var i25 = e56("../utils/common"), o87 = 0, h7 = 1; function n44(e57) { for (var t45 = e57.length; 0 <= --t45; ) e57[t45] = 0; } var s17 = 0, a45 = 29, u11 = 256, l20 = u11 + 1 + a45, f7 = 30, c27 = 19, _3 = 2 * l20 + 1, g8 = 15, d33 = 16, p8 = 7, m5 = 256, b7 = 16, v7 = 17, y3 = 18, w3 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k6 = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x3 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S4 = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z3 = new Array(2 * (l20 + 2)); n44(z3); var C5 = new Array(2 * f7); n44(C5); var E4 = new Array(512); n44(E4); var A3 = new Array(256); n44(A3); var I3 = new Array(a45); n44(I3); var O3, B5, R4, T4 = new Array(f7); function D4(e57, t45, r86, n45, i26) { this.static_tree = e57, this.extra_bits = t45, this.extra_base = r86, this.elems = n45, this.max_length = i26, this.has_stree = e57 && e57.length; } function F16(e57, t45) { this.dyn_tree = e57, this.max_code = 0, this.stat_desc = t45; } function N4(e57) { return e57 < 256 ? E4[e57] : E4[256 + (e57 >>> 7)]; } function U3(e57, t45) { e57.pending_buf[e57.pending++] = 255 & t45, e57.pending_buf[e57.pending++] = t45 >>> 8 & 255; } function P3(e57, t45, r86) { e57.bi_valid > d33 - r86 ? (e57.bi_buf |= t45 << e57.bi_valid & 65535, U3(e57, e57.bi_buf), e57.bi_buf = t45 >> d33 - e57.bi_valid, e57.bi_valid += r86 - d33) : (e57.bi_buf |= t45 << e57.bi_valid & 65535, e57.bi_valid += r86); } function L2(e57, t45, r86) { P3(e57, r86[2 * t45], r86[2 * t45 + 1]); } function j3(e57, t45) { for (var r86 = 0; r86 |= 1 & e57, e57 >>>= 1, r86 <<= 1, 0 < --t45; ) ; return r86 >>> 1; } function Z2(e57, t45, r86) { var n45, i26, s18 = new Array(g8 + 1), a46 = 0; for (n45 = 1; n45 <= g8; n45++) s18[n45] = a46 = a46 + r86[n45 - 1] << 1; for (i26 = 0; i26 <= t45; i26++) { var o88 = e57[2 * i26 + 1]; 0 !== o88 && (e57[2 * i26] = j3(s18[o88]++, o88)); } } function W3(e57) { var t45; for (t45 = 0; t45 < l20; t45++) e57.dyn_ltree[2 * t45] = 0; for (t45 = 0; t45 < f7; t45++) e57.dyn_dtree[2 * t45] = 0; for (t45 = 0; t45 < c27; t45++) e57.bl_tree[2 * t45] = 0; e57.dyn_ltree[2 * m5] = 1, e57.opt_len = e57.static_len = 0, e57.last_lit = e57.matches = 0; } function M4(e57) { 8 < e57.bi_valid ? U3(e57, e57.bi_buf) : 0 < e57.bi_valid && (e57.pending_buf[e57.pending++] = e57.bi_buf), e57.bi_buf = 0, e57.bi_valid = 0; } function H3(e57, t45, r86, n45) { var i26 = 2 * t45, s18 = 2 * r86; return e57[i26] < e57[s18] || e57[i26] === e57[s18] && n45[t45] <= n45[r86]; } function G4(e57, t45, r86) { for (var n45 = e57.heap[r86], i26 = r86 << 1; i26 <= e57.heap_len && (i26 < e57.heap_len && H3(t45, e57.heap[i26 + 1], e57.heap[i26], e57.depth) && i26++, !H3(t45, n45, e57.heap[i26], e57.depth)); ) e57.heap[r86] = e57.heap[i26], r86 = i26, i26 <<= 1; e57.heap[r86] = n45; } function K4(e57, t45, r86) { var n45, i26, s18, a46, o88 = 0; if (0 !== e57.last_lit) for (; n45 = e57.pending_buf[e57.d_buf + 2 * o88] << 8 | e57.pending_buf[e57.d_buf + 2 * o88 + 1], i26 = e57.pending_buf[e57.l_buf + o88], o88++, 0 === n45 ? L2(e57, i26, t45) : (L2(e57, (s18 = A3[i26]) + u11 + 1, t45), 0 !== (a46 = w3[s18]) && P3(e57, i26 -= I3[s18], a46), L2(e57, s18 = N4(--n45), r86), 0 !== (a46 = k6[s18]) && P3(e57, n45 -= T4[s18], a46)), o88 < e57.last_lit; ) ; L2(e57, m5, t45); } function Y5(e57, t45) { var r86, n45, i26, s18 = t45.dyn_tree, a46 = t45.stat_desc.static_tree, o88 = t45.stat_desc.has_stree, h8 = t45.stat_desc.elems, u12 = -1; for (e57.heap_len = 0, e57.heap_max = _3, r86 = 0; r86 < h8; r86++) 0 !== s18[2 * r86] ? (e57.heap[++e57.heap_len] = u12 = r86, e57.depth[r86] = 0) : s18[2 * r86 + 1] = 0; for (; e57.heap_len < 2; ) s18[2 * (i26 = e57.heap[++e57.heap_len] = u12 < 2 ? ++u12 : 0)] = 1, e57.depth[i26] = 0, e57.opt_len--, o88 && (e57.static_len -= a46[2 * i26 + 1]); for (t45.max_code = u12, r86 = e57.heap_len >> 1; 1 <= r86; r86--) G4(e57, s18, r86); for (i26 = h8; r86 = e57.heap[1], e57.heap[1] = e57.heap[e57.heap_len--], G4(e57, s18, 1), n45 = e57.heap[1], e57.heap[--e57.heap_max] = r86, e57.heap[--e57.heap_max] = n45, s18[2 * i26] = s18[2 * r86] + s18[2 * n45], e57.depth[i26] = (e57.depth[r86] >= e57.depth[n45] ? e57.depth[r86] : e57.depth[n45]) + 1, s18[2 * r86 + 1] = s18[2 * n45 + 1] = i26, e57.heap[1] = i26++, G4(e57, s18, 1), 2 <= e57.heap_len; ) ; e57.heap[--e57.heap_max] = e57.heap[1], (function(e58, t46) { var r87, n46, i27, s19, a47, o89, h9 = t46.dyn_tree, u13 = t46.max_code, l21 = t46.stat_desc.static_tree, f8 = t46.stat_desc.has_stree, c28 = t46.stat_desc.extra_bits, d34 = t46.stat_desc.extra_base, p9 = t46.stat_desc.max_length, m6 = 0; for (s19 = 0; s19 <= g8; s19++) e58.bl_count[s19] = 0; for (h9[2 * e58.heap[e58.heap_max] + 1] = 0, r87 = e58.heap_max + 1; r87 < _3; r87++) p9 < (s19 = h9[2 * h9[2 * (n46 = e58.heap[r87]) + 1] + 1] + 1) && (s19 = p9, m6++), h9[2 * n46 + 1] = s19, u13 < n46 || (e58.bl_count[s19]++, a47 = 0, d34 <= n46 && (a47 = c28[n46 - d34]), o89 = h9[2 * n46], e58.opt_len += o89 * (s19 + a47), f8 && (e58.static_len += o89 * (l21[2 * n46 + 1] + a47))); if (0 !== m6) { do { for (s19 = p9 - 1; 0 === e58.bl_count[s19]; ) s19--; e58.bl_count[s19]--, e58.bl_count[s19 + 1] += 2, e58.bl_count[p9]--, m6 -= 2; } while (0 < m6); for (s19 = p9; 0 !== s19; s19--) for (n46 = e58.bl_count[s19]; 0 !== n46; ) u13 < (i27 = e58.heap[--r87]) || (h9[2 * i27 + 1] !== s19 && (e58.opt_len += (s19 - h9[2 * i27 + 1]) * h9[2 * i27], h9[2 * i27 + 1] = s19), n46--); } })(e57, t45), Z2(s18, u12, e57.bl_count); } function X2(e57, t45, r86) { var n45, i26, s18 = -1, a46 = t45[1], o88 = 0, h8 = 7, u12 = 4; for (0 === a46 && (h8 = 138, u12 = 3), t45[2 * (r86 + 1) + 1] = 65535, n45 = 0; n45 <= r86; n45++) i26 = a46, a46 = t45[2 * (n45 + 1) + 1], ++o88 < h8 && i26 === a46 || (o88 < u12 ? e57.bl_tree[2 * i26] += o88 : 0 !== i26 ? (i26 !== s18 && e57.bl_tree[2 * i26]++, e57.bl_tree[2 * b7]++) : o88 <= 10 ? e57.bl_tree[2 * v7]++ : e57.bl_tree[2 * y3]++, s18 = i26, u12 = (o88 = 0) === a46 ? (h8 = 138, 3) : i26 === a46 ? (h8 = 6, 3) : (h8 = 7, 4)); } function V3(e57, t45, r86) { var n45, i26, s18 = -1, a46 = t45[1], o88 = 0, h8 = 7, u12 = 4; for (0 === a46 && (h8 = 138, u12 = 3), n45 = 0; n45 <= r86; n45++) if (i26 = a46, a46 = t45[2 * (n45 + 1) + 1], !(++o88 < h8 && i26 === a46)) { if (o88 < u12) for (; L2(e57, i26, e57.bl_tree), 0 != --o88; ) ; else 0 !== i26 ? (i26 !== s18 && (L2(e57, i26, e57.bl_tree), o88--), L2(e57, b7, e57.bl_tree), P3(e57, o88 - 3, 2)) : o88 <= 10 ? (L2(e57, v7, e57.bl_tree), P3(e57, o88 - 3, 3)) : (L2(e57, y3, e57.bl_tree), P3(e57, o88 - 11, 7)); s18 = i26, u12 = (o88 = 0) === a46 ? (h8 = 138, 3) : i26 === a46 ? (h8 = 6, 3) : (h8 = 7, 4); } } n44(T4); var q2 = false; function J3(e57, t45, r86, n45) { P3(e57, (s17 << 1) + (n45 ? 1 : 0), 3), (function(e58, t46, r87, n46) { M4(e58), n46 && (U3(e58, r87), U3(e58, ~r87)), i25.arraySet(e58.pending_buf, e58.window, t46, r87, e58.pending), e58.pending += r87; })(e57, t45, r86, true); } r85._tr_init = function(e57) { q2 || ((function() { var e58, t45, r86, n45, i26, s18 = new Array(g8 + 1); for (n45 = r86 = 0; n45 < a45 - 1; n45++) for (I3[n45] = r86, e58 = 0; e58 < 1 << w3[n45]; e58++) A3[r86++] = n45; for (A3[r86 - 1] = n45, n45 = i26 = 0; n45 < 16; n45++) for (T4[n45] = i26, e58 = 0; e58 < 1 << k6[n45]; e58++) E4[i26++] = n45; for (i26 >>= 7; n45 < f7; n45++) for (T4[n45] = i26 << 7, e58 = 0; e58 < 1 << k6[n45] - 7; e58++) E4[256 + i26++] = n45; for (t45 = 0; t45 <= g8; t45++) s18[t45] = 0; for (e58 = 0; e58 <= 143; ) z3[2 * e58 + 1] = 8, e58++, s18[8]++; for (; e58 <= 255; ) z3[2 * e58 + 1] = 9, e58++, s18[9]++; for (; e58 <= 279; ) z3[2 * e58 + 1] = 7, e58++, s18[7]++; for (; e58 <= 287; ) z3[2 * e58 + 1] = 8, e58++, s18[8]++; for (Z2(z3, l20 + 1, s18), e58 = 0; e58 < f7; e58++) C5[2 * e58 + 1] = 5, C5[2 * e58] = j3(e58, 5); O3 = new D4(z3, w3, u11 + 1, l20, g8), B5 = new D4(C5, k6, 0, f7, g8), R4 = new D4(new Array(0), x3, 0, c27, p8); })(), q2 = true), e57.l_desc = new F16(e57.dyn_ltree, O3), e57.d_desc = new F16(e57.dyn_dtree, B5), e57.bl_desc = new F16(e57.bl_tree, R4), e57.bi_buf = 0, e57.bi_valid = 0, W3(e57); }, r85._tr_stored_block = J3, r85._tr_flush_block = function(e57, t45, r86, n45) { var i26, s18, a46 = 0; 0 < e57.level ? (2 === e57.strm.data_type && (e57.strm.data_type = (function(e58) { var t46, r87 = 4093624447; for (t46 = 0; t46 <= 31; t46++, r87 >>>= 1) if (1 & r87 && 0 !== e58.dyn_ltree[2 * t46]) return o87; if (0 !== e58.dyn_ltree[18] || 0 !== e58.dyn_ltree[20] || 0 !== e58.dyn_ltree[26]) return h7; for (t46 = 32; t46 < u11; t46++) if (0 !== e58.dyn_ltree[2 * t46]) return h7; return o87; })(e57)), Y5(e57, e57.l_desc), Y5(e57, e57.d_desc), a46 = (function(e58) { var t46; for (X2(e58, e58.dyn_ltree, e58.l_desc.max_code), X2(e58, e58.dyn_dtree, e58.d_desc.max_code), Y5(e58, e58.bl_desc), t46 = c27 - 1; 3 <= t46 && 0 === e58.bl_tree[2 * S4[t46] + 1]; t46--) ; return e58.opt_len += 3 * (t46 + 1) + 5 + 5 + 4, t46; })(e57), i26 = e57.opt_len + 3 + 7 >>> 3, (s18 = e57.static_len + 3 + 7 >>> 3) <= i26 && (i26 = s18)) : i26 = s18 = r86 + 5, r86 + 4 <= i26 && -1 !== t45 ? J3(e57, t45, r86, n45) : 4 === e57.strategy || s18 === i26 ? (P3(e57, 2 + (n45 ? 1 : 0), 3), K4(e57, z3, C5)) : (P3(e57, 4 + (n45 ? 1 : 0), 3), (function(e58, t46, r87, n46) { var i27; for (P3(e58, t46 - 257, 5), P3(e58, r87 - 1, 5), P3(e58, n46 - 4, 4), i27 = 0; i27 < n46; i27++) P3(e58, e58.bl_tree[2 * S4[i27] + 1], 3); V3(e58, e58.dyn_ltree, t46 - 1), V3(e58, e58.dyn_dtree, r87 - 1); })(e57, e57.l_desc.max_code + 1, e57.d_desc.max_code + 1, a46 + 1), K4(e57, e57.dyn_ltree, e57.dyn_dtree)), W3(e57), n45 && M4(e57); }, r85._tr_tally = function(e57, t45, r86) { return e57.pending_buf[e57.d_buf + 2 * e57.last_lit] = t45 >>> 8 & 255, e57.pending_buf[e57.d_buf + 2 * e57.last_lit + 1] = 255 & t45, e57.pending_buf[e57.l_buf + e57.last_lit] = 255 & r86, e57.last_lit++, 0 === t45 ? e57.dyn_ltree[2 * r86]++ : (e57.matches++, t45--, e57.dyn_ltree[2 * (A3[r86] + u11 + 1)]++, e57.dyn_dtree[2 * N4(t45)]++), e57.last_lit === e57.lit_bufsize - 1; }, r85._tr_align = function(e57) { P3(e57, 2, 3), L2(e57, m5, z3), (function(e58) { 16 === e58.bi_valid ? (U3(e58, e58.bi_buf), e58.bi_buf = 0, e58.bi_valid = 0) : 8 <= e58.bi_valid && (e58.pending_buf[e58.pending++] = 255 & e58.bi_buf, e58.bi_buf >>= 8, e58.bi_valid -= 8); })(e57); }; }, { "../utils/common": 41 }], 53: [function(e56, t44, r85) { "use strict"; t44.exports = function() { this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0; }; }, {}], 54: [function(e56, t44, r85) { (function(e57) { !(function(r86, n44) { "use strict"; if (!r86.setImmediate) { var i25, s17, t45, a45, o87 = 1, h7 = {}, u11 = false, l20 = r86.document, e58 = Object.getPrototypeOf && Object.getPrototypeOf(r86); e58 = e58 && e58.setTimeout ? e58 : r86, i25 = "[object process]" === {}.toString.call(r86.process) ? function(e59) { process.nextTick(function() { c27(e59); }); } : (function() { if (r86.postMessage && !r86.importScripts) { var e59 = true, t46 = r86.onmessage; return r86.onmessage = function() { e59 = false; }, r86.postMessage("", "*"), r86.onmessage = t46, e59; } })() ? (a45 = "setImmediate$" + Math.random() + "$", r86.addEventListener ? r86.addEventListener("message", d33, false) : r86.attachEvent("onmessage", d33), function(e59) { r86.postMessage(a45 + e59, "*"); }) : r86.MessageChannel ? ((t45 = new MessageChannel()).port1.onmessage = function(e59) { c27(e59.data); }, function(e59) { t45.port2.postMessage(e59); }) : l20 && "onreadystatechange" in l20.createElement("script") ? (s17 = l20.documentElement, function(e59) { var t46 = l20.createElement("script"); t46.onreadystatechange = function() { c27(e59), t46.onreadystatechange = null, s17.removeChild(t46), t46 = null; }, s17.appendChild(t46); }) : function(e59) { setTimeout(c27, 0, e59); }, e58.setImmediate = function(e59) { "function" != typeof e59 && (e59 = new Function("" + e59)); for (var t46 = new Array(arguments.length - 1), r87 = 0; r87 < t46.length; r87++) t46[r87] = arguments[r87 + 1]; var n45 = { callback: e59, args: t46 }; return h7[o87] = n45, i25(o87), o87++; }, e58.clearImmediate = f7; } function f7(e59) { delete h7[e59]; } function c27(e59) { if (u11) setTimeout(c27, 0, e59); else { var t46 = h7[e59]; if (t46) { u11 = true; try { !(function(e60) { var t47 = e60.callback, r87 = e60.args; switch (r87.length) { case 0: t47(); break; case 1: t47(r87[0]); break; case 2: t47(r87[0], r87[1]); break; case 3: t47(r87[0], r87[1], r87[2]); break; default: t47.apply(n44, r87); } })(t46); } finally { f7(e59), u11 = false; } } } } function d33(e59) { e59.source === r86 && "string" == typeof e59.data && 0 === e59.data.indexOf(a45) && c27(+e59.data.slice(a45.length)); } })("undefined" == typeof self ? void 0 === e57 ? this : e57 : self); }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}); }, {}] }, {}, [10])(10); }); } }); // node_modules/papaparse/papaparse.min.js var require_papaparse_min = __commonJS({ "node_modules/papaparse/papaparse.min.js"(exports, module) { "use strict"; ((e56, t44) => { "function" == typeof define && define.amd ? define([], t44) : "object" == typeof module && "undefined" != typeof exports ? module.exports = t44() : e56.Papa = t44(); })(exports, function r85() { var n44 = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n44 ? n44 : {}; var d33, s17 = !n44.document && !!n44.postMessage, a45 = n44.IS_PAPA_WORKER || false, o87 = {}, h7 = 0, v7 = {}; function u11(e56) { this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e57) { var t44 = b7(e57); t44.chunkSize = parseInt(t44.chunkSize), e57.step || e57.chunk || (t44.chunkSize = null); this._handle = new i25(t44), (this._handle.streamer = this)._config = t44; }.call(this, e56), this.parseChunk = function(t44, e57) { var i26 = parseInt(this._config.skipFirstNLines) || 0; if (this.isFirstChunk && 0 < i26) { let e58 = this._config.newline; e58 || (r86 = this._config.quoteChar || '"', e58 = this._handle.guessLineEndings(t44, r86)), t44 = [...t44.split(e58).slice(i26)].join(e58); } this.isFirstChunk && U3(this._config.beforeFirstChunk) && void 0 !== (r86 = this._config.beforeFirstChunk(t44)) && (t44 = r86), this.isFirstChunk = false, this._halted = false; var i26 = this._partialLine + t44, r86 = (this._partialLine = "", this._handle.parse(i26, this._baseIndex, !this._finished)); if (!this._handle.paused() && !this._handle.aborted()) { t44 = r86.meta.cursor, i26 = (this._finished || (this._partialLine = i26.substring(t44 - this._baseIndex), this._baseIndex = t44), r86 && r86.data && (this._rowCount += r86.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview); if (a45) n44.postMessage({ results: r86, workerId: v7.WORKER_ID, finished: i26 }); else if (U3(this._config.chunk) && !e57) { if (this._config.chunk(r86, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true); this._completeResults = r86 = void 0; } return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r86.data), this._completeResults.errors = this._completeResults.errors.concat(r86.errors), this._completeResults.meta = r86.meta), this._completed || !i26 || !U3(this._config.complete) || r86 && r86.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i26 || r86 && r86.meta.paused || this._nextChunk(), r86; } this._halted = true; }, this._sendError = function(e57) { U3(this._config.error) ? this._config.error(e57) : a45 && this._config.error && n44.postMessage({ workerId: v7.WORKER_ID, error: e57, finished: false }); }; } function f7(e56) { var r86; (e56 = e56 || {}).chunkSize || (e56.chunkSize = v7.RemoteChunkSize), u11.call(this, e56), this._nextChunk = s17 ? function() { this._readChunk(), this._chunkLoaded(); } : function() { this._readChunk(); }, this.stream = function(e57) { this._input = e57, this._nextChunk(); }, this._readChunk = function() { if (this._finished) this._chunkLoaded(); else { if (r86 = new XMLHttpRequest(), this._config.withCredentials && (r86.withCredentials = this._config.withCredentials), s17 || (r86.onload = y3(this._chunkLoaded, this), r86.onerror = y3(this._chunkError, this)), r86.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s17), this._config.downloadRequestHeaders) { var e57, t44 = this._config.downloadRequestHeaders; for (e57 in t44) r86.setRequestHeader(e57, t44[e57]); } var i26; this._config.chunkSize && (i26 = this._start + this._config.chunkSize - 1, r86.setRequestHeader("Range", "bytes=" + this._start + "-" + i26)); try { r86.send(this._config.downloadRequestBody); } catch (e58) { this._chunkError(e58.message); } s17 && 0 === r86.status && this._chunkError(); } }, this._chunkLoaded = function() { 4 === r86.readyState && (r86.status < 200 || 400 <= r86.status ? this._chunkError() : (this._start += this._config.chunkSize || r86.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e57) => null !== (e57 = e57.getResponseHeader("Content-Range")) ? parseInt(e57.substring(e57.lastIndexOf("/") + 1)) : -1)(r86), this.parseChunk(r86.responseText))); }, this._chunkError = function(e57) { e57 = r86.statusText || e57; this._sendError(new Error(e57)); }; } function l20(e56) { (e56 = e56 || {}).chunkSize || (e56.chunkSize = v7.LocalChunkSize), u11.call(this, e56); var i26, r86, n45 = "undefined" != typeof FileReader; this.stream = function(e57) { this._input = e57, r86 = e57.slice || e57.webkitSlice || e57.mozSlice, n45 ? ((i26 = new FileReader()).onload = y3(this._chunkLoaded, this), i26.onerror = y3(this._chunkError, this)) : i26 = new FileReaderSync(), this._nextChunk(); }, this._nextChunk = function() { this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk(); }, this._readChunk = function() { var e57 = this._input, t44 = (this._config.chunkSize && (t44 = Math.min(this._start + this._config.chunkSize, this._input.size), e57 = r86.call(e57, this._start, t44)), i26.readAsText(e57, this._config.encoding)); n45 || this._chunkLoaded({ target: { result: t44 } }); }, this._chunkLoaded = function(e57) { this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e57.target.result); }, this._chunkError = function() { this._sendError(i26.error); }; } function c27(e56) { var i26; u11.call(this, e56 = e56 || {}), this.stream = function(e57) { return i26 = e57, this._nextChunk(); }, this._nextChunk = function() { var e57, t44; if (!this._finished) return e57 = this._config.chunkSize, i26 = e57 ? (t44 = i26.substring(0, e57), i26.substring(e57)) : (t44 = i26, ""), this._finished = !i26, this.parseChunk(t44); }; } function p8(e56) { u11.call(this, e56 = e56 || {}); var t44 = [], i26 = true, r86 = false; this.pause = function() { u11.prototype.pause.apply(this, arguments), this._input.pause(); }, this.resume = function() { u11.prototype.resume.apply(this, arguments), this._input.resume(); }, this.stream = function(e57) { this._input = e57, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError); }, this._checkIsFinished = function() { r86 && 1 === t44.length && (this._finished = true); }, this._nextChunk = function() { this._checkIsFinished(), t44.length ? this.parseChunk(t44.shift()) : i26 = true; }, this._streamData = y3(function(e57) { try { t44.push("string" == typeof e57 ? e57 : e57.toString(this._config.encoding)), i26 && (i26 = false, this._checkIsFinished(), this.parseChunk(t44.shift())); } catch (e58) { this._streamError(e58); } }, this), this._streamError = y3(function(e57) { this._streamCleanUp(), this._sendError(e57); }, this), this._streamEnd = y3(function() { this._streamCleanUp(), r86 = true, this._streamData(""); }, this), this._streamCleanUp = y3(function() { this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError); }, this); } function i25(m6) { var n45, s18, a46, t44, o88 = Math.pow(2, 53), h8 = -o88, u12 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d34 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i26 = this, r86 = 0, f8 = 0, l21 = false, e56 = false, c28 = [], p9 = { data: [], errors: [], meta: {} }; function y4(e57) { return "greedy" === m6.skipEmptyLines ? "" === e57.join("").trim() : 1 === e57.length && 0 === e57[0].length; } function g9() { if (p9 && a46 && (k6("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v7.DefaultDelimiter + "'"), a46 = false), m6.skipEmptyLines && (p9.data = p9.data.filter(function(e58) { return !y4(e58); })), _4()) { let t46 = function(e58, t47) { U3(m6.transformHeader) && (e58 = m6.transformHeader(e58, t47)), c28.push(e58); }; var t45 = t46; if (p9) if (Array.isArray(p9.data[0])) { for (var e57 = 0; _4() && e57 < p9.data.length; e57++) p9.data[e57].forEach(t46); p9.data.splice(0, 1); } else p9.data.forEach(t46); } function i27(e58, t46) { for (var i28 = m6.header ? {} : [], r88 = 0; r88 < e58.length; r88++) { var n46 = r88, s19 = e58[r88], s19 = ((e59, t47) => ((e60) => (m6.dynamicTypingFunction && void 0 === m6.dynamicTyping[e60] && (m6.dynamicTyping[e60] = m6.dynamicTypingFunction(e60)), true === (m6.dynamicTyping[e60] || m6.dynamicTyping)))(e59) ? "true" === t47 || "TRUE" === t47 || "false" !== t47 && "FALSE" !== t47 && (((e60) => { if (u12.test(e60)) { e60 = parseFloat(e60); if (h8 < e60 && e60 < o88) return 1; } })(t47) ? parseFloat(t47) : d34.test(t47) ? new Date(t47) : "" === t47 ? null : t47) : t47)(n46 = m6.header ? r88 >= c28.length ? "__parsed_extra" : c28[r88] : n46, s19 = m6.transform ? m6.transform(s19, n46) : s19); "__parsed_extra" === n46 ? (i28[n46] = i28[n46] || [], i28[n46].push(s19)) : i28[n46] = s19; } return m6.header && (r88 > c28.length ? k6("FieldMismatch", "TooManyFields", "Too many fields: expected " + c28.length + " fields but parsed " + r88, f8 + t46) : r88 < c28.length && k6("FieldMismatch", "TooFewFields", "Too few fields: expected " + c28.length + " fields but parsed " + r88, f8 + t46)), i28; } var r87; p9 && (m6.header || m6.dynamicTyping || m6.transform) && (r87 = 1, !p9.data.length || Array.isArray(p9.data[0]) ? (p9.data = p9.data.map(i27), r87 = p9.data.length) : p9.data = i27(p9.data, 0), m6.header && p9.meta && (p9.meta.fields = c28), f8 += r87); } function _4() { return m6.header && 0 === c28.length; } function k6(e57, t45, i27, r87) { e57 = { type: e57, code: t45, message: i27 }; void 0 !== r87 && (e57.row = r87), p9.errors.push(e57); } U3(m6.step) && (t44 = m6.step, m6.step = function(e57) { p9 = e57, _4() ? g9() : (g9(), 0 !== p9.data.length && (r86 += e57.data.length, m6.preview && r86 > m6.preview ? s18.abort() : (p9.data = p9.data[0], t44(p9, i26)))); }), this.parse = function(e57, t45, i27) { var r87 = m6.quoteChar || '"', r87 = (m6.newline || (m6.newline = this.guessLineEndings(e57, r87)), a46 = false, m6.delimiter ? U3(m6.delimiter) && (m6.delimiter = m6.delimiter(e57), p9.meta.delimiter = m6.delimiter) : ((r87 = ((e58, t46, i28, r88, n46) => { var s19, a47, o89, h9; n46 = n46 || [",", " ", "|", ";", v7.RECORD_SEP, v7.UNIT_SEP]; for (var u13 = 0; u13 < n46.length; u13++) { for (var d35, f9 = n46[u13], l22 = 0, c29 = 0, p10 = 0, g10 = (o89 = void 0, new E4({ comments: r88, delimiter: f9, newline: t46, preview: 10 }).parse(e58)), _5 = 0; _5 < g10.data.length; _5++) i28 && y4(g10.data[_5]) ? p10++ : (d35 = g10.data[_5].length, c29 += d35, void 0 === o89 ? o89 = d35 : 0 < d35 && (l22 += Math.abs(d35 - o89), o89 = d35)); 0 < g10.data.length && (c29 /= g10.data.length - p10), (void 0 === a47 || l22 <= a47) && (void 0 === h9 || h9 < c29) && 1.99 < c29 && (a47 = l22, s19 = f9, h9 = c29); } return { successful: !!(m6.delimiter = s19), bestDelimiter: s19 }; })(e57, m6.newline, m6.skipEmptyLines, m6.comments, m6.delimitersToGuess)).successful ? m6.delimiter = r87.bestDelimiter : (a46 = true, m6.delimiter = v7.DefaultDelimiter), p9.meta.delimiter = m6.delimiter), b7(m6)); return m6.preview && m6.header && r87.preview++, n45 = e57, s18 = new E4(r87), p9 = s18.parse(n45, t45, i27), g9(), l21 ? { meta: { paused: true } } : p9 || { meta: { paused: false } }; }, this.paused = function() { return l21; }, this.pause = function() { l21 = true, s18.abort(), n45 = U3(m6.chunk) ? "" : n45.substring(s18.getCharIndex()); }, this.resume = function() { i26.streamer._halted ? (l21 = false, i26.streamer.parseChunk(n45, true)) : setTimeout(i26.resume, 3); }, this.aborted = function() { return e56; }, this.abort = function() { e56 = true, s18.abort(), p9.meta.aborted = true, U3(m6.complete) && m6.complete(p9), n45 = ""; }, this.guessLineEndings = function(e57, t45) { e57 = e57.substring(0, 1048576); var t45 = new RegExp(P3(t45) + "([^]*?)" + P3(t45), "gm"), i27 = (e57 = e57.replace(t45, "")).split("\r"), t45 = e57.split("\n"), e57 = 1 < t45.length && t45[0].length < i27[0].length; if (1 === i27.length || e57) return "\n"; for (var r87 = 0, n46 = 0; n46 < i27.length; n46++) "\n" === i27[n46][0] && r87++; return r87 >= i27.length / 2 ? "\r\n" : "\r"; }; } function P3(e56) { return e56.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function E4(C5) { var S4 = (C5 = C5 || {}).delimiter, O3 = C5.newline, x3 = C5.comments, I3 = C5.step, A3 = C5.preview, T4 = C5.fastMode, D4 = null, L2 = false, F16 = null == C5.quoteChar ? '"' : C5.quoteChar, j3 = F16; if (void 0 !== C5.escapeChar && (j3 = C5.escapeChar), ("string" != typeof S4 || -1 < v7.BAD_DELIMITERS.indexOf(S4)) && (S4 = ","), x3 === S4) throw new Error("Comment character same as delimiter"); true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v7.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !== O3 && "\r" !== O3 && "\r\n" !== O3 && (O3 = "\n"); var z3 = 0, M4 = false; this.parse = function(i26, t44, r86) { if ("string" != typeof i26) throw new Error("Input must be a string"); var n45 = i26.length, e56 = S4.length, s18 = O3.length, a46 = x3.length, o88 = U3(I3), h8 = [], u12 = [], d34 = [], f8 = z3 = 0; if (!i26) return w3(); if (T4 || false !== T4 && -1 === i26.indexOf(F16)) { for (var l21 = i26.split(O3), c28 = 0; c28 < l21.length; c28++) { if (d34 = l21[c28], z3 += d34.length, c28 !== l21.length - 1) z3 += O3.length; else if (r86) return w3(); if (!x3 || d34.substring(0, a46) !== x3) { if (o88) { if (h8 = [], k6(d34.split(S4)), R4(), M4) return w3(); } else k6(d34.split(S4)); if (A3 && A3 <= c28) return h8 = h8.slice(0, A3), w3(true); } } return w3(); } for (var p9 = i26.indexOf(S4, z3), g9 = i26.indexOf(O3, z3), _4 = new RegExp(P3(j3) + P3(F16), "g"), m6 = i26.indexOf(F16, z3); ; ) if (i26[z3] === F16) for (m6 = z3, z3++; ; ) { if (-1 === (m6 = i26.indexOf(F16, m6 + 1))) return r86 || u12.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h8.length, index: z3 }), E5(); if (m6 === n45 - 1) return E5(i26.substring(z3, m6).replace(_4, F16)); if (F16 === j3 && i26[m6 + 1] === j3) m6++; else if (F16 === j3 || 0 === m6 || i26[m6 - 1] !== j3) { -1 !== p9 && p9 < m6 + 1 && (p9 = i26.indexOf(S4, m6 + 1)); var y4 = v8(-1 === (g9 = -1 !== g9 && g9 < m6 + 1 ? i26.indexOf(O3, m6 + 1) : g9) ? p9 : Math.min(p9, g9)); if (i26.substr(m6 + 1 + y4, e56) === S4) { d34.push(i26.substring(z3, m6).replace(_4, F16)), i26[z3 = m6 + 1 + y4 + e56] !== F16 && (m6 = i26.indexOf(F16, z3)), p9 = i26.indexOf(S4, z3), g9 = i26.indexOf(O3, z3); break; } y4 = v8(g9); if (i26.substring(m6 + 1 + y4, m6 + 1 + y4 + s18) === O3) { if (d34.push(i26.substring(z3, m6).replace(_4, F16)), b8(m6 + 1 + y4 + s18), p9 = i26.indexOf(S4, z3), m6 = i26.indexOf(F16, z3), o88 && (R4(), M4)) return w3(); if (A3 && h8.length >= A3) return w3(true); break; } u12.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h8.length, index: z3 }), m6++; } } else if (x3 && 0 === d34.length && i26.substring(z3, z3 + a46) === x3) { if (-1 === g9) return w3(); z3 = g9 + s18, g9 = i26.indexOf(O3, z3), p9 = i26.indexOf(S4, z3); } else if (-1 !== p9 && (p9 < g9 || -1 === g9)) d34.push(i26.substring(z3, p9)), z3 = p9 + e56, p9 = i26.indexOf(S4, z3); else { if (-1 === g9) break; if (d34.push(i26.substring(z3, g9)), b8(g9 + s18), o88 && (R4(), M4)) return w3(); if (A3 && h8.length >= A3) return w3(true); } return E5(); function k6(e57) { h8.push(e57), f8 = z3; } function v8(e57) { var t45 = 0; return t45 = -1 !== e57 && (e57 = i26.substring(m6 + 1, e57)) && "" === e57.trim() ? e57.length : t45; } function E5(e57) { return r86 || (void 0 === e57 && (e57 = i26.substring(z3)), d34.push(e57), z3 = n45, k6(d34), o88 && R4()), w3(); } function b8(e57) { z3 = e57, k6(d34), d34 = [], g9 = i26.indexOf(O3, z3); } function w3(e57) { if (C5.header && !t44 && h8.length && !L2) { var s19 = h8[0], a47 = /* @__PURE__ */ Object.create(null), o89 = new Set(s19); let n46 = false; for (let r87 = 0; r87 < s19.length; r87++) { let i27 = s19[r87]; if (a47[i27 = U3(C5.transformHeader) ? C5.transformHeader(i27, r87) : i27]) { let e58, t45 = a47[i27]; for (; e58 = i27 + "_" + t45, t45++, o89.has(e58); ) ; o89.add(e58), s19[r87] = e58, a47[i27]++, n46 = true, (D4 = null === D4 ? {} : D4)[e58] = i27; } else a47[i27] = 1, s19[r87] = i27; o89.add(i27); } n46 && console.warn("Duplicate headers found and renamed."), L2 = true; } return { data: h8, errors: u12, meta: { delimiter: S4, linebreak: O3, aborted: M4, truncated: !!e57, cursor: f8 + (t44 || 0), renamedHeaders: D4 } }; } function R4() { I3(w3()), h8 = [], u12 = []; } }, this.abort = function() { M4 = true; }, this.getCharIndex = function() { return z3; }; } function g8(e56) { var t44 = e56.data, i26 = o87[t44.workerId], r86 = false; if (t44.error) i26.userError(t44.error, t44.file); else if (t44.results && t44.results.data) { var n45 = { abort: function() { r86 = true, _3(t44.workerId, { data: [], errors: [], meta: { aborted: true } }); }, pause: m5, resume: m5 }; if (U3(i26.userStep)) { for (var s18 = 0; s18 < t44.results.data.length && (i26.userStep({ data: t44.results.data[s18], errors: t44.results.errors, meta: t44.results.meta }, n45), !r86); s18++) ; delete t44.results; } else U3(i26.userChunk) && (i26.userChunk(t44.results, n45, t44.file), delete t44.results); } t44.finished && !r86 && _3(t44.workerId, t44.results); } function _3(e56, t44) { var i26 = o87[e56]; U3(i26.userComplete) && i26.userComplete(t44), i26.terminate(), delete o87[e56]; } function m5() { throw new Error("Not implemented."); } function b7(e56) { if ("object" != typeof e56 || null === e56) return e56; var t44, i26 = Array.isArray(e56) ? [] : {}; for (t44 in e56) i26[t44] = b7(e56[t44]); return i26; } function y3(e56, t44) { return function() { e56.apply(t44, arguments); }; } function U3(e56) { return "function" == typeof e56; } return v7.parse = function(e56, t44) { var i26 = (t44 = t44 || {}).dynamicTyping || false; U3(i26) && (t44.dynamicTypingFunction = i26, i26 = {}); if (t44.dynamicTyping = i26, t44.transform = !!U3(t44.transform) && t44.transform, !t44.worker || !v7.WORKERS_SUPPORTED) return i26 = null, v7.NODE_STREAM_INPUT, "string" == typeof e56 ? (e56 = ((e57) => 65279 !== e57.charCodeAt(0) ? e57 : e57.slice(1))(e56), i26 = new (t44.download ? f7 : c27)(t44)) : true === e56.readable && U3(e56.read) && U3(e56.on) ? i26 = new p8(t44) : (n44.File && e56 instanceof File || e56 instanceof Object) && (i26 = new l20(t44)), i26.stream(e56); (i26 = (() => { var e57; return !!v7.WORKERS_SUPPORTED && (e57 = (() => { var e58 = n44.URL || n44.webkitURL || null, t45 = r85.toString(); return v7.BLOB_URL || (v7.BLOB_URL = e58.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t45, ")();"], { type: "text/javascript" }))); })(), (e57 = new n44.Worker(e57)).onmessage = g8, e57.id = h7++, o87[e57.id] = e57); })()).userStep = t44.step, i26.userChunk = t44.chunk, i26.userComplete = t44.complete, i26.userError = t44.error, t44.step = U3(t44.step), t44.chunk = U3(t44.chunk), t44.complete = U3(t44.complete), t44.error = U3(t44.error), delete t44.worker, i26.postMessage({ input: e56, config: t44, workerId: i26.id }); }, v7.unparse = function(e56, t44) { var n45 = false, _4 = true, m6 = ",", y4 = "\r\n", s18 = '"', a46 = s18 + s18, i26 = false, r86 = null, o88 = false, h8 = ((() => { if ("object" == typeof t44) { if ("string" != typeof t44.delimiter || v7.BAD_DELIMITERS.filter(function(e57) { return -1 !== t44.delimiter.indexOf(e57); }).length || (m6 = t44.delimiter), "boolean" != typeof t44.quotes && "function" != typeof t44.quotes && !Array.isArray(t44.quotes) || (n45 = t44.quotes), "boolean" != typeof t44.skipEmptyLines && "string" != typeof t44.skipEmptyLines || (i26 = t44.skipEmptyLines), "string" == typeof t44.newline && (y4 = t44.newline), "string" == typeof t44.quoteChar && (s18 = t44.quoteChar), "boolean" == typeof t44.header && (_4 = t44.header), Array.isArray(t44.columns)) { if (0 === t44.columns.length) throw new Error("Option columns is empty"); r86 = t44.columns; } void 0 !== t44.escapeChar && (a46 = t44.escapeChar + s18), t44.escapeFormulae instanceof RegExp ? o88 = t44.escapeFormulae : "boolean" == typeof t44.escapeFormulae && t44.escapeFormulae && (o88 = /^[=+\-@\t\r].*$/); } })(), new RegExp(P3(s18), "g")); "string" == typeof e56 && (e56 = JSON.parse(e56)); if (Array.isArray(e56)) { if (!e56.length || Array.isArray(e56[0])) return u12(null, e56, i26); if ("object" == typeof e56[0]) return u12(r86 || Object.keys(e56[0]), e56, i26); } else if ("object" == typeof e56) return "string" == typeof e56.data && (e56.data = JSON.parse(e56.data)), Array.isArray(e56.data) && (e56.fields || (e56.fields = e56.meta && e56.meta.fields || r86), e56.fields || (e56.fields = Array.isArray(e56.data[0]) ? e56.fields : "object" == typeof e56.data[0] ? Object.keys(e56.data[0]) : []), Array.isArray(e56.data[0]) || "object" == typeof e56.data[0] || (e56.data = [e56.data])), u12(e56.fields || [], e56.data || [], i26); throw new Error("Unable to serialize unrecognized input"); function u12(e57, t45, i27) { var r87 = "", n46 = ("string" == typeof e57 && (e57 = JSON.parse(e57)), "string" == typeof t45 && (t45 = JSON.parse(t45)), Array.isArray(e57) && 0 < e57.length), s19 = !Array.isArray(t45[0]); if (n46 && _4) { for (var a47 = 0; a47 < e57.length; a47++) 0 < a47 && (r87 += m6), r87 += k6(e57[a47], a47); 0 < t45.length && (r87 += y4); } for (var o89 = 0; o89 < t45.length; o89++) { var h9 = (n46 ? e57 : t45[o89]).length, u13 = false, d34 = n46 ? 0 === Object.keys(t45[o89]).length : 0 === t45[o89].length; if (i27 && !n46 && (u13 = "greedy" === i27 ? "" === t45[o89].join("").trim() : 1 === t45[o89].length && 0 === t45[o89][0].length), "greedy" === i27 && n46) { for (var f8 = [], l21 = 0; l21 < h9; l21++) { var c28 = s19 ? e57[l21] : l21; f8.push(t45[o89][c28]); } u13 = "" === f8.join("").trim(); } if (!u13) { for (var p9 = 0; p9 < h9; p9++) { 0 < p9 && !d34 && (r87 += m6); var g9 = n46 && s19 ? e57[p9] : p9; r87 += k6(t45[o89][g9], p9); } o89 < t45.length - 1 && (!i27 || 0 < h9 && !d34) && (r87 += y4); } } return r87; } function k6(e57, t45) { var i27, r87; return null == e57 ? "" : e57.constructor === Date ? JSON.stringify(e57).slice(1, 25) : (r87 = false, o88 && "string" == typeof e57 && o88.test(e57) && (e57 = "'" + e57, r87 = true), i27 = e57.toString().replace(h8, a46), (r87 = r87 || true === n45 || "function" == typeof n45 && n45(e57, t45) || Array.isArray(n45) && n45[t45] || ((e58, t46) => { for (var i28 = 0; i28 < t46.length; i28++) if (-1 < e58.indexOf(t46[i28])) return true; return false; })(i27, v7.BAD_DELIMITERS) || -1 < i27.indexOf(m6) || " " === i27.charAt(0) || " " === i27.charAt(i27.length - 1)) ? s18 + i27 + s18 : i27); } }, v7.RECORD_SEP = String.fromCharCode(30), v7.UNIT_SEP = String.fromCharCode(31), v7.BYTE_ORDER_MARK = "\uFEFF", v7.BAD_DELIMITERS = ["\r", "\n", '"', v7.BYTE_ORDER_MARK], v7.WORKERS_SUPPORTED = !s17 && !!n44.Worker, v7.NODE_STREAM_INPUT = 1, v7.LocalChunkSize = 10485760, v7.RemoteChunkSize = 5242880, v7.DefaultDelimiter = ",", v7.Parser = E4, v7.ParserHandle = i25, v7.NetworkStreamer = f7, v7.FileStreamer = l20, v7.StringStreamer = c27, v7.ReadableStreamStreamer = p8, n44.jQuery && ((d33 = n44.jQuery).fn.parse = function(o88) { var i26 = o88.config || {}, h8 = []; return this.each(function(e57) { if (!("INPUT" === d33(this).prop("tagName").toUpperCase() && "file" === d33(this).attr("type").toLowerCase() && n44.FileReader) || !this.files || 0 === this.files.length) return true; for (var t44 = 0; t44 < this.files.length; t44++) h8.push({ file: this.files[t44], inputElem: this, instanceConfig: d33.extend({}, i26) }); }), e56(), this; function e56() { if (0 === h8.length) U3(o88.complete) && o88.complete(); else { var e57, t44, i27, r86, n45 = h8[0]; if (U3(o88.before)) { var s18 = o88.before(n45.file, n45.inputElem); if ("object" == typeof s18) { if ("abort" === s18.action) return e57 = "AbortError", t44 = n45.file, i27 = n45.inputElem, r86 = s18.reason, void (U3(o88.error) && o88.error({ name: e57 }, t44, i27, r86)); if ("skip" === s18.action) return void u12(); "object" == typeof s18.config && (n45.instanceConfig = d33.extend(n45.instanceConfig, s18.config)); } else if ("skip" === s18) return void u12(); } var a46 = n45.instanceConfig.complete; n45.instanceConfig.complete = function(e58) { U3(a46) && a46(e58, n45.file, n45.inputElem), u12(); }, v7.parse(n45.file, n45.instanceConfig); } } function u12() { h8.splice(0, 1), e56(); } }), a45 && (n44.onmessage = function(e56) { e56 = e56.data; void 0 === v7.WORKER_ID && e56 && (v7.WORKER_ID = e56.workerId); "string" == typeof e56.input ? n44.postMessage({ workerId: v7.WORKER_ID, results: v7.parse(e56.input, e56.config), finished: true }) : (n44.File && e56.input instanceof File || e56.input instanceof Object) && (e56 = v7.parse(e56.input, e56.config)) && n44.postMessage({ workerId: v7.WORKER_ID, results: e56, finished: true }); }), (f7.prototype = Object.create(u11.prototype)).constructor = f7, (l20.prototype = Object.create(u11.prototype)).constructor = l20, (c27.prototype = Object.create(c27.prototype)).constructor = c27, (p8.prototype = Object.create(u11.prototype)).constructor = p8, v7; }); } }); // node_modules/@mapbox/mapbox-gl-supported/index.js var require_mapbox_gl_supported = __commonJS({ "node_modules/@mapbox/mapbox-gl-supported/index.js"(exports) { "use strict"; exports.supported = isSupported; exports.notSupportedReason = notSupportedReason; function isSupported(options) { return !notSupportedReason(options); } function notSupportedReason(options) { if (!isBrowser()) return "not a browser"; if (!isWorkerSupported()) return "insufficient worker support"; if (!isCanvasGetImageDataSupported()) return "insufficient Canvas/getImageData support"; if (!isWebGLSupportedCached(options && options.failIfMajorPerformanceCaveat)) return "insufficient WebGL2 support"; if (!isNotIE()) return "insufficient ECMAScript 6 support"; } function isBrowser() { return typeof window !== "undefined" && typeof document !== "undefined"; } function isWorkerSupported() { if (!("Worker" in window && "Blob" in window && "URL" in window)) { return false; } var blob = new Blob([""], { type: "text/javascript" }); var workerURL = URL.createObjectURL(blob); var supported2; var worker; try { worker = new Worker(workerURL); supported2 = true; } catch (e56) { supported2 = false; } if (worker) { worker.terminate(); } URL.revokeObjectURL(workerURL); return supported2; } function isCanvasGetImageDataSupported() { var canvas = document.createElement("canvas"); canvas.width = canvas.height = 1; var context2 = canvas.getContext("2d"); if (!context2) { return false; } var imageData = context2.getImageData(0, 0, 1, 1); return imageData && imageData.width === canvas.width; } var isWebGLSupportedCache = {}; function isWebGLSupportedCached(failIfMajorPerformanceCaveat) { if (isWebGLSupportedCache[failIfMajorPerformanceCaveat] === void 0) { isWebGLSupportedCache[failIfMajorPerformanceCaveat] = isWebGLSupported(failIfMajorPerformanceCaveat); } return isWebGLSupportedCache[failIfMajorPerformanceCaveat]; } isSupported.webGLContextAttributes = { antialias: false, alpha: true, stencil: true, depth: true }; function getWebGLContext(failIfMajorPerformanceCaveat) { var canvas = document.createElement("canvas"); var attributes = Object.create(isSupported.webGLContextAttributes); attributes.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; return canvas.getContext("webgl2", attributes); } function isWebGLSupported(failIfMajorPerformanceCaveat) { var gl = getWebGLContext(failIfMajorPerformanceCaveat); if (!gl) { return false; } var shader; try { shader = gl.createShader(gl.VERTEX_SHADER); } catch (e56) { return false; } if (!shader || gl.isContextLost()) { return false; } gl.shaderSource(shader, "void main() {}"); gl.compileShader(shader); return gl.getShaderParameter(shader, gl.COMPILE_STATUS) === true; } function isNotIE() { return !document.documentMode; } } }); // node_modules/point-in-polygon/flat.js var require_flat = __commonJS({ "node_modules/point-in-polygon/flat.js"(exports, module) { "use strict"; module.exports = function pointInPolygonFlat(point2, vs, start, end) { var x3 = point2[0], y3 = point2[1]; var inside2 = false; if (start === void 0) start = 0; if (end === void 0) end = vs.length; var len = (end - start) / 2; for (var i25 = 0, j3 = len - 1; i25 < len; j3 = i25++) { var xi = vs[start + i25 * 2 + 0], yi = vs[start + i25 * 2 + 1]; var xj = vs[start + j3 * 2 + 0], yj = vs[start + j3 * 2 + 1]; var intersect = yi > y3 !== yj > y3 && x3 < (xj - xi) * (y3 - yi) / (yj - yi) + xi; if (intersect) inside2 = !inside2; } return inside2; }; } }); // node_modules/point-in-polygon/nested.js var require_nested = __commonJS({ "node_modules/point-in-polygon/nested.js"(exports, module) { "use strict"; module.exports = function pointInPolygonNested(point2, vs, start, end) { var x3 = point2[0], y3 = point2[1]; var inside2 = false; if (start === void 0) start = 0; if (end === void 0) end = vs.length; var len = end - start; for (var i25 = 0, j3 = len - 1; i25 < len; j3 = i25++) { var xi = vs[i25 + start][0], yi = vs[i25 + start][1]; var xj = vs[j3 + start][0], yj = vs[j3 + start][1]; var intersect = yi > y3 !== yj > y3 && x3 < (xj - xi) * (y3 - yi) / (yj - yi) + xi; if (intersect) inside2 = !inside2; } return inside2; }; } }); // node_modules/point-in-polygon/index.js var require_point_in_polygon = __commonJS({ "node_modules/point-in-polygon/index.js"(exports, module) { "use strict"; var pointInPolygonFlat = require_flat(); var pointInPolygonNested = require_nested(); module.exports = function pointInPolygon2(point2, vs, start, end) { if (vs.length > 0 && Array.isArray(vs[0])) { return pointInPolygonNested(point2, vs, start, end); } else { return pointInPolygonFlat(point2, vs, start, end); } }; module.exports.nested = pointInPolygonNested; module.exports.flat = pointInPolygonFlat; } }); // node_modules/geojson-rbush/node_modules/rbush/rbush.min.js var require_rbush_min = __commonJS({ "node_modules/geojson-rbush/node_modules/rbush/rbush.min.js"(exports, module) { "use strict"; !(function(t44, i25) { "object" == typeof exports && "undefined" != typeof module ? module.exports = i25() : "function" == typeof define && define.amd ? define(i25) : (t44 = t44 || self).RBush = i25(); })(exports, function() { "use strict"; function t44(t45, r86, e57, a46, h8) { !(function t46(n45, r87, e58, a47, h9) { for (; a47 > e58; ) { if (a47 - e58 > 600) { var o88 = a47 - e58 + 1, s18 = r87 - e58 + 1, l21 = Math.log(o88), f8 = 0.5 * Math.exp(2 * l21 / 3), u12 = 0.5 * Math.sqrt(l21 * f8 * (o88 - f8) / o88) * (s18 - o88 / 2 < 0 ? -1 : 1), m6 = Math.max(e58, Math.floor(r87 - s18 * f8 / o88 + u12)), c28 = Math.min(a47, Math.floor(r87 + (o88 - s18) * f8 / o88 + u12)); t46(n45, r87, m6, c28, h9); } var p9 = n45[r87], d34 = e58, x3 = a47; for (i25(n45, e58, r87), h9(n45[a47], p9) > 0 && i25(n45, e58, a47); d34 < x3; ) { for (i25(n45, d34, x3), d34++, x3--; h9(n45[d34], p9) < 0; ) d34++; for (; h9(n45[x3], p9) > 0; ) x3--; } 0 === h9(n45[e58], p9) ? i25(n45, e58, x3) : i25(n45, ++x3, a47), x3 <= r87 && (e58 = x3 + 1), r87 <= x3 && (a47 = x3 - 1); } })(t45, r86, e57 || 0, a46 || t45.length - 1, h8 || n44); } function i25(t45, i26, n45) { var r86 = t45[i26]; t45[i26] = t45[n45], t45[n45] = r86; } function n44(t45, i26) { return t45 < i26 ? -1 : t45 > i26 ? 1 : 0; } var r85 = function(t45) { void 0 === t45 && (t45 = 9), this._maxEntries = Math.max(4, t45), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear(); }; function e56(t45, i26, n45) { if (!n45) return i26.indexOf(t45); for (var r86 = 0; r86 < i26.length; r86++) if (n45(t45, i26[r86])) return r86; return -1; } function a45(t45, i26) { h7(t45, 0, t45.children.length, i26, t45); } function h7(t45, i26, n45, r86, e57) { e57 || (e57 = p8(null)), e57.minX = 1 / 0, e57.minY = 1 / 0, e57.maxX = -1 / 0, e57.maxY = -1 / 0; for (var a46 = i26; a46 < n45; a46++) { var h8 = t45.children[a46]; o87(e57, t45.leaf ? r86(h8) : h8); } return e57; } function o87(t45, i26) { return t45.minX = Math.min(t45.minX, i26.minX), t45.minY = Math.min(t45.minY, i26.minY), t45.maxX = Math.max(t45.maxX, i26.maxX), t45.maxY = Math.max(t45.maxY, i26.maxY), t45; } function s17(t45, i26) { return t45.minX - i26.minX; } function l20(t45, i26) { return t45.minY - i26.minY; } function f7(t45) { return (t45.maxX - t45.minX) * (t45.maxY - t45.minY); } function u11(t45) { return t45.maxX - t45.minX + (t45.maxY - t45.minY); } function m5(t45, i26) { return t45.minX <= i26.minX && t45.minY <= i26.minY && i26.maxX <= t45.maxX && i26.maxY <= t45.maxY; } function c27(t45, i26) { return i26.minX <= t45.maxX && i26.minY <= t45.maxY && i26.maxX >= t45.minX && i26.maxY >= t45.minY; } function p8(t45) { return { children: t45, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }; } function d33(i26, n45, r86, e57, a46) { for (var h8 = [n45, r86]; h8.length; ) if (!((r86 = h8.pop()) - (n45 = h8.pop()) <= e57)) { var o88 = n45 + Math.ceil((r86 - n45) / e57 / 2) * e57; t44(i26, o88, n45, r86, a46), h8.push(n45, o88, o88, r86); } } return r85.prototype.all = function() { return this._all(this.data, []); }, r85.prototype.search = function(t45) { var i26 = this.data, n45 = []; if (!c27(t45, i26)) return n45; for (var r86 = this.toBBox, e57 = []; i26; ) { for (var a46 = 0; a46 < i26.children.length; a46++) { var h8 = i26.children[a46], o88 = i26.leaf ? r86(h8) : h8; c27(t45, o88) && (i26.leaf ? n45.push(h8) : m5(t45, o88) ? this._all(h8, n45) : e57.push(h8)); } i26 = e57.pop(); } return n45; }, r85.prototype.collides = function(t45) { var i26 = this.data; if (!c27(t45, i26)) return false; for (var n45 = []; i26; ) { for (var r86 = 0; r86 < i26.children.length; r86++) { var e57 = i26.children[r86], a46 = i26.leaf ? this.toBBox(e57) : e57; if (c27(t45, a46)) { if (i26.leaf || m5(t45, a46)) return true; n45.push(e57); } } i26 = n45.pop(); } return false; }, r85.prototype.load = function(t45) { if (!t45 || !t45.length) return this; if (t45.length < this._minEntries) { for (var i26 = 0; i26 < t45.length; i26++) this.insert(t45[i26]); return this; } var n45 = this._build(t45.slice(), 0, t45.length - 1, 0); if (this.data.children.length) if (this.data.height === n45.height) this._splitRoot(this.data, n45); else { if (this.data.height < n45.height) { var r86 = this.data; this.data = n45, n45 = r86; } this._insert(n45, this.data.height - n45.height - 1, true); } else this.data = n45; return this; }, r85.prototype.insert = function(t45) { return t45 && this._insert(t45, this.data.height - 1), this; }, r85.prototype.clear = function() { return this.data = p8([]), this; }, r85.prototype.remove = function(t45, i26) { if (!t45) return this; for (var n45, r86, a46, h8 = this.data, o88 = this.toBBox(t45), s18 = [], l21 = []; h8 || s18.length; ) { if (h8 || (h8 = s18.pop(), r86 = s18[s18.length - 1], n45 = l21.pop(), a46 = true), h8.leaf) { var f8 = e56(t45, h8.children, i26); if (-1 !== f8) return h8.children.splice(f8, 1), s18.push(h8), this._condense(s18), this; } a46 || h8.leaf || !m5(h8, o88) ? r86 ? (n45++, h8 = r86.children[n45], a46 = false) : h8 = null : (s18.push(h8), l21.push(n45), n45 = 0, r86 = h8, h8 = h8.children[0]); } return this; }, r85.prototype.toBBox = function(t45) { return t45; }, r85.prototype.compareMinX = function(t45, i26) { return t45.minX - i26.minX; }, r85.prototype.compareMinY = function(t45, i26) { return t45.minY - i26.minY; }, r85.prototype.toJSON = function() { return this.data; }, r85.prototype.fromJSON = function(t45) { return this.data = t45, this; }, r85.prototype._all = function(t45, i26) { for (var n45 = []; t45; ) t45.leaf ? i26.push.apply(i26, t45.children) : n45.push.apply(n45, t45.children), t45 = n45.pop(); return i26; }, r85.prototype._build = function(t45, i26, n45, r86) { var e57, h8 = n45 - i26 + 1, o88 = this._maxEntries; if (h8 <= o88) return a45(e57 = p8(t45.slice(i26, n45 + 1)), this.toBBox), e57; r86 || (r86 = Math.ceil(Math.log(h8) / Math.log(o88)), o88 = Math.ceil(h8 / Math.pow(o88, r86 - 1))), (e57 = p8([])).leaf = false, e57.height = r86; var s18 = Math.ceil(h8 / o88), l21 = s18 * Math.ceil(Math.sqrt(o88)); d33(t45, i26, n45, l21, this.compareMinX); for (var f8 = i26; f8 <= n45; f8 += l21) { var u12 = Math.min(f8 + l21 - 1, n45); d33(t45, f8, u12, s18, this.compareMinY); for (var m6 = f8; m6 <= u12; m6 += s18) { var c28 = Math.min(m6 + s18 - 1, u12); e57.children.push(this._build(t45, m6, c28, r86 - 1)); } } return a45(e57, this.toBBox), e57; }, r85.prototype._chooseSubtree = function(t45, i26, n45, r86) { for (; r86.push(i26), !i26.leaf && r86.length - 1 !== n45; ) { for (var e57 = 1 / 0, a46 = 1 / 0, h8 = void 0, o88 = 0; o88 < i26.children.length; o88++) { var s18 = i26.children[o88], l21 = f7(s18), u12 = (m6 = t45, c28 = s18, (Math.max(c28.maxX, m6.maxX) - Math.min(c28.minX, m6.minX)) * (Math.max(c28.maxY, m6.maxY) - Math.min(c28.minY, m6.minY)) - l21); u12 < a46 ? (a46 = u12, e57 = l21 < e57 ? l21 : e57, h8 = s18) : u12 === a46 && l21 < e57 && (e57 = l21, h8 = s18); } i26 = h8 || i26.children[0]; } var m6, c28; return i26; }, r85.prototype._insert = function(t45, i26, n45) { var r86 = n45 ? t45 : this.toBBox(t45), e57 = [], a46 = this._chooseSubtree(r86, this.data, i26, e57); for (a46.children.push(t45), o87(a46, r86); i26 >= 0 && e57[i26].children.length > this._maxEntries; ) this._split(e57, i26), i26--; this._adjustParentBBoxes(r86, e57, i26); }, r85.prototype._split = function(t45, i26) { var n45 = t45[i26], r86 = n45.children.length, e57 = this._minEntries; this._chooseSplitAxis(n45, e57, r86); var h8 = this._chooseSplitIndex(n45, e57, r86), o88 = p8(n45.children.splice(h8, n45.children.length - h8)); o88.height = n45.height, o88.leaf = n45.leaf, a45(n45, this.toBBox), a45(o88, this.toBBox), i26 ? t45[i26 - 1].children.push(o88) : this._splitRoot(n45, o88); }, r85.prototype._splitRoot = function(t45, i26) { this.data = p8([t45, i26]), this.data.height = t45.height + 1, this.data.leaf = false, a45(this.data, this.toBBox); }, r85.prototype._chooseSplitIndex = function(t45, i26, n45) { for (var r86, e57, a46, o88, s18, l21, u12, m6 = 1 / 0, c28 = 1 / 0, p9 = i26; p9 <= n45 - i26; p9++) { var d34 = h7(t45, 0, p9, this.toBBox), x3 = h7(t45, p9, n45, this.toBBox), v7 = (e57 = d34, a46 = x3, o88 = void 0, s18 = void 0, l21 = void 0, u12 = void 0, o88 = Math.max(e57.minX, a46.minX), s18 = Math.max(e57.minY, a46.minY), l21 = Math.min(e57.maxX, a46.maxX), u12 = Math.min(e57.maxY, a46.maxY), Math.max(0, l21 - o88) * Math.max(0, u12 - s18)), M4 = f7(d34) + f7(x3); v7 < m6 ? (m6 = v7, r86 = p9, c28 = M4 < c28 ? M4 : c28) : v7 === m6 && M4 < c28 && (c28 = M4, r86 = p9); } return r86 || n45 - i26; }, r85.prototype._chooseSplitAxis = function(t45, i26, n45) { var r86 = t45.leaf ? this.compareMinX : s17, e57 = t45.leaf ? this.compareMinY : l20; this._allDistMargin(t45, i26, n45, r86) < this._allDistMargin(t45, i26, n45, e57) && t45.children.sort(r86); }, r85.prototype._allDistMargin = function(t45, i26, n45, r86) { t45.children.sort(r86); for (var e57 = this.toBBox, a46 = h7(t45, 0, i26, e57), s18 = h7(t45, n45 - i26, n45, e57), l21 = u11(a46) + u11(s18), f8 = i26; f8 < n45 - i26; f8++) { var m6 = t45.children[f8]; o87(a46, t45.leaf ? e57(m6) : m6), l21 += u11(a46); } for (var c28 = n45 - i26 - 1; c28 >= i26; c28--) { var p9 = t45.children[c28]; o87(s18, t45.leaf ? e57(p9) : p9), l21 += u11(s18); } return l21; }, r85.prototype._adjustParentBBoxes = function(t45, i26, n45) { for (var r86 = n45; r86 >= 0; r86--) o87(i26[r86], t45); }, r85.prototype._condense = function(t45) { for (var i26 = t45.length - 1, n45 = void 0; i26 >= 0; i26--) 0 === t45[i26].children.length ? i26 > 0 ? (n45 = t45[i26 - 1].children).splice(n45.indexOf(t45[i26]), 1) : this.clear() : a45(t45[i26], this.toBBox); }, r85; }); } }); // node_modules/@turf/helpers/dist/js/index.js var require_js = __commonJS({ "node_modules/@turf/helpers/dist/js/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.earthRadius = 63710088e-1; exports.factors = { centimeters: exports.earthRadius * 100, centimetres: exports.earthRadius * 100, degrees: exports.earthRadius / 111325, feet: exports.earthRadius * 3.28084, inches: exports.earthRadius * 39.37, kilometers: exports.earthRadius / 1e3, kilometres: exports.earthRadius / 1e3, meters: exports.earthRadius, metres: exports.earthRadius, miles: exports.earthRadius / 1609.344, millimeters: exports.earthRadius * 1e3, millimetres: exports.earthRadius * 1e3, nauticalmiles: exports.earthRadius / 1852, radians: 1, yards: exports.earthRadius * 1.0936 }; exports.unitsFactors = { centimeters: 100, centimetres: 100, degrees: 1 / 111325, feet: 3.28084, inches: 39.37, kilometers: 1 / 1e3, kilometres: 1 / 1e3, meters: 1, metres: 1, miles: 1 / 1609.344, millimeters: 1e3, millimetres: 1e3, nauticalmiles: 1 / 1852, radians: 1 / exports.earthRadius, yards: 1.0936133 }; exports.areaFactors = { acres: 247105e-9, centimeters: 1e4, centimetres: 1e4, feet: 10.763910417, hectares: 1e-4, inches: 1550.003100006, kilometers: 1e-6, kilometres: 1e-6, meters: 1, metres: 1, miles: 386e-9, millimeters: 1e6, millimetres: 1e6, yards: 1.195990046 }; function feature2(geom, properties, options) { if (options === void 0) { options = {}; } var feat = { type: "Feature" }; if (options.id === 0 || options.id) { feat.id = options.id; } if (options.bbox) { feat.bbox = options.bbox; } feat.properties = properties || {}; feat.geometry = geom; return feat; } exports.feature = feature2; function geometry(type, coordinates, _options) { if (_options === void 0) { _options = {}; } switch (type) { case "Point": return point2(coordinates).geometry; case "LineString": return lineString2(coordinates).geometry; case "Polygon": return polygon2(coordinates).geometry; case "MultiPoint": return multiPoint(coordinates).geometry; case "MultiLineString": return multiLineString2(coordinates).geometry; case "MultiPolygon": return multiPolygon(coordinates).geometry; default: throw new Error(type + " is invalid"); } } exports.geometry = geometry; function point2(coordinates, properties, options) { if (options === void 0) { options = {}; } if (!coordinates) { throw new Error("coordinates is required"); } if (!Array.isArray(coordinates)) { throw new Error("coordinates must be an Array"); } if (coordinates.length < 2) { throw new Error("coordinates must be at least 2 numbers long"); } if (!isNumber5(coordinates[0]) || !isNumber5(coordinates[1])) { throw new Error("coordinates must contain numbers"); } var geom = { type: "Point", coordinates }; return feature2(geom, properties, options); } exports.point = point2; function points(coordinates, properties, options) { if (options === void 0) { options = {}; } return featureCollection2(coordinates.map(function(coords) { return point2(coords, properties); }), options); } exports.points = points; function polygon2(coordinates, properties, options) { if (options === void 0) { options = {}; } for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) { var ring = coordinates_1[_i]; if (ring.length < 4) { throw new Error("Each LinearRing of a Polygon must have 4 or more Positions."); } for (var j3 = 0; j3 < ring[ring.length - 1].length; j3++) { if (ring[ring.length - 1][j3] !== ring[0][j3]) { throw new Error("First and last Position are not equivalent."); } } } var geom = { type: "Polygon", coordinates }; return feature2(geom, properties, options); } exports.polygon = polygon2; function polygons(coordinates, properties, options) { if (options === void 0) { options = {}; } return featureCollection2(coordinates.map(function(coords) { return polygon2(coords, properties); }), options); } exports.polygons = polygons; function lineString2(coordinates, properties, options) { if (options === void 0) { options = {}; } if (coordinates.length < 2) { throw new Error("coordinates must be an array of two or more positions"); } var geom = { type: "LineString", coordinates }; return feature2(geom, properties, options); } exports.lineString = lineString2; function lineStrings(coordinates, properties, options) { if (options === void 0) { options = {}; } return featureCollection2(coordinates.map(function(coords) { return lineString2(coords, properties); }), options); } exports.lineStrings = lineStrings; function featureCollection2(features, options) { if (options === void 0) { options = {}; } var fc = { type: "FeatureCollection" }; if (options.id) { fc.id = options.id; } if (options.bbox) { fc.bbox = options.bbox; } fc.features = features; return fc; } exports.featureCollection = featureCollection2; function multiLineString2(coordinates, properties, options) { if (options === void 0) { options = {}; } var geom = { type: "MultiLineString", coordinates }; return feature2(geom, properties, options); } exports.multiLineString = multiLineString2; function multiPoint(coordinates, properties, options) { if (options === void 0) { options = {}; } var geom = { type: "MultiPoint", coordinates }; return feature2(geom, properties, options); } exports.multiPoint = multiPoint; function multiPolygon(coordinates, properties, options) { if (options === void 0) { options = {}; } var geom = { type: "MultiPolygon", coordinates }; return feature2(geom, properties, options); } exports.multiPolygon = multiPolygon; function geometryCollection2(geometries, properties, options) { if (options === void 0) { options = {}; } var geom = { type: "GeometryCollection", geometries }; return feature2(geom, properties, options); } exports.geometryCollection = geometryCollection2; function round3(num, precision) { if (precision === void 0) { precision = 0; } if (precision && !(precision >= 0)) { throw new Error("precision must be a positive number"); } var multiplier = Math.pow(10, precision || 0); return Math.round(num * multiplier) / multiplier; } exports.round = round3; function radiansToLength(radians, units) { if (units === void 0) { units = "kilometers"; } var factor = exports.factors[units]; if (!factor) { throw new Error(units + " units is invalid"); } return radians * factor; } exports.radiansToLength = radiansToLength; function lengthToRadians2(distance, units) { if (units === void 0) { units = "kilometers"; } var factor = exports.factors[units]; if (!factor) { throw new Error(units + " units is invalid"); } return distance / factor; } exports.lengthToRadians = lengthToRadians2; function lengthToDegrees(distance, units) { return radiansToDegrees2(lengthToRadians2(distance, units)); } exports.lengthToDegrees = lengthToDegrees; function bearingToAzimuth(bearing) { var angle = bearing % 360; if (angle < 0) { angle += 360; } return angle; } exports.bearingToAzimuth = bearingToAzimuth; function radiansToDegrees2(radians) { var degrees = radians % (2 * Math.PI); return degrees * 180 / Math.PI; } exports.radiansToDegrees = radiansToDegrees2; function degreesToRadians2(degrees) { var radians = degrees % 360; return radians * Math.PI / 180; } exports.degreesToRadians = degreesToRadians2; function convertLength(length, originalUnit, finalUnit) { if (originalUnit === void 0) { originalUnit = "kilometers"; } if (finalUnit === void 0) { finalUnit = "kilometers"; } if (!(length >= 0)) { throw new Error("length must be a positive number"); } return radiansToLength(lengthToRadians2(length, originalUnit), finalUnit); } exports.convertLength = convertLength; function convertArea(area, originalUnit, finalUnit) { if (originalUnit === void 0) { originalUnit = "meters"; } if (finalUnit === void 0) { finalUnit = "kilometers"; } if (!(area >= 0)) { throw new Error("area must be a positive number"); } var startFactor = exports.areaFactors[originalUnit]; if (!startFactor) { throw new Error("invalid original units"); } var finalFactor = exports.areaFactors[finalUnit]; if (!finalFactor) { throw new Error("invalid final units"); } return area / startFactor * finalFactor; } exports.convertArea = convertArea; function isNumber5(num) { return !isNaN(num) && num !== null && !Array.isArray(num); } exports.isNumber = isNumber5; function isObject4(input2) { return !!input2 && input2.constructor === Object; } exports.isObject = isObject4; function validateBBox(bbox3) { if (!bbox3) { throw new Error("bbox is required"); } if (!Array.isArray(bbox3)) { throw new Error("bbox must be an Array"); } if (bbox3.length !== 4 && bbox3.length !== 6) { throw new Error("bbox must be an Array of 4 or 6 numbers"); } bbox3.forEach(function(num) { if (!isNumber5(num)) { throw new Error("bbox must only contain numbers"); } }); } exports.validateBBox = validateBBox; function validateId(id) { if (!id) { throw new Error("id is required"); } if (["string", "number"].indexOf(typeof id) === -1) { throw new Error("id must be a number or a string"); } } exports.validateId = validateId; } }); // node_modules/@turf/meta/dist/js/index.js var require_js2 = __commonJS({ "node_modules/@turf/meta/dist/js/index.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var helpers = require_js(); function coordEach2(geojson, callback2, excludeWrapCoord) { if (geojson === null) return; var j3, k6, l20, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1; for (var featureIndex = 0; featureIndex < stop; featureIndex++) { geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson; isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false; stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1; for (var geomIndex = 0; geomIndex < stopG; geomIndex++) { var multiFeatureIndex = 0; var geometryIndex = 0; geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection; if (geometry === null) continue; coords = geometry.coordinates; var geomType = geometry.type; wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0; switch (geomType) { case null: break; case "Point": if (callback2( coords, coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; multiFeatureIndex++; break; case "LineString": case "MultiPoint": for (j3 = 0; j3 < coords.length; j3++) { if (callback2( coords[j3], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; if (geomType === "MultiPoint") multiFeatureIndex++; } if (geomType === "LineString") multiFeatureIndex++; break; case "Polygon": case "MultiLineString": for (j3 = 0; j3 < coords.length; j3++) { for (k6 = 0; k6 < coords[j3].length - wrapShrink; k6++) { if (callback2( coords[j3][k6], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; } if (geomType === "MultiLineString") multiFeatureIndex++; if (geomType === "Polygon") geometryIndex++; } if (geomType === "Polygon") multiFeatureIndex++; break; case "MultiPolygon": for (j3 = 0; j3 < coords.length; j3++) { geometryIndex = 0; for (k6 = 0; k6 < coords[j3].length; k6++) { for (l20 = 0; l20 < coords[j3][k6].length - wrapShrink; l20++) { if (callback2( coords[j3][k6][l20], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; } geometryIndex++; } multiFeatureIndex++; } break; case "GeometryCollection": for (j3 = 0; j3 < geometry.geometries.length; j3++) if (coordEach2(geometry.geometries[j3], callback2, excludeWrapCoord) === false) return false; break; default: throw new Error("Unknown Geometry Type"); } } } } function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) { var previousValue = initialValue; coordEach2( geojson, function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) { if (coordIndex === 0 && initialValue === void 0) previousValue = currentCoord; else previousValue = callback2( previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex ); }, excludeWrapCoord ); return previousValue; } function propEach(geojson, callback2) { var i25; switch (geojson.type) { case "FeatureCollection": for (i25 = 0; i25 < geojson.features.length; i25++) { if (callback2(geojson.features[i25].properties, i25) === false) break; } break; case "Feature": callback2(geojson.properties, 0); break; } } function propReduce(geojson, callback2, initialValue) { var previousValue = initialValue; propEach(geojson, function(currentProperties, featureIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentProperties; else previousValue = callback2(previousValue, currentProperties, featureIndex); }); return previousValue; } function featureEach2(geojson, callback2) { if (geojson.type === "Feature") { callback2(geojson, 0); } else if (geojson.type === "FeatureCollection") { for (var i25 = 0; i25 < geojson.features.length; i25++) { if (callback2(geojson.features[i25], i25) === false) break; } } } function featureReduce(geojson, callback2, initialValue) { var previousValue = initialValue; featureEach2(geojson, function(currentFeature, featureIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentFeature; else previousValue = callback2(previousValue, currentFeature, featureIndex); }); return previousValue; } function coordAll(geojson) { var coords = []; coordEach2(geojson, function(coord) { coords.push(coord); }); return coords; } function geomEach2(geojson, callback2) { var i25, j3, g8, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1; for (i25 = 0; i25 < stop; i25++) { geometryMaybeCollection = isFeatureCollection ? geojson.features[i25].geometry : isFeature ? geojson.geometry : geojson; featureProperties = isFeatureCollection ? geojson.features[i25].properties : isFeature ? geojson.properties : {}; featureBBox = isFeatureCollection ? geojson.features[i25].bbox : isFeature ? geojson.bbox : void 0; featureId = isFeatureCollection ? geojson.features[i25].id : isFeature ? geojson.id : void 0; isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false; stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1; for (g8 = 0; g8 < stopG; g8++) { geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g8] : geometryMaybeCollection; if (geometry === null) { if (callback2( null, featureIndex, featureProperties, featureBBox, featureId ) === false) return false; continue; } switch (geometry.type) { case "Point": case "LineString": case "MultiPoint": case "Polygon": case "MultiLineString": case "MultiPolygon": { if (callback2( geometry, featureIndex, featureProperties, featureBBox, featureId ) === false) return false; break; } case "GeometryCollection": { for (j3 = 0; j3 < geometry.geometries.length; j3++) { if (callback2( geometry.geometries[j3], featureIndex, featureProperties, featureBBox, featureId ) === false) return false; } break; } default: throw new Error("Unknown Geometry Type"); } } featureIndex++; } } function geomReduce(geojson, callback2, initialValue) { var previousValue = initialValue; geomEach2( geojson, function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentGeometry; else previousValue = callback2( previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId ); } ); return previousValue; } function flattenEach2(geojson, callback2) { geomEach2(geojson, function(geometry, featureIndex, properties, bbox3, id) { var type = geometry === null ? null : geometry.type; switch (type) { case null: case "Point": case "LineString": case "Polygon": if (callback2( helpers.feature(geometry, properties, { bbox: bbox3, id }), featureIndex, 0 ) === false) return false; return; } var geomType; switch (type) { case "MultiPoint": geomType = "Point"; break; case "MultiLineString": geomType = "LineString"; break; case "MultiPolygon": geomType = "Polygon"; break; } for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) { var coordinate = geometry.coordinates[multiFeatureIndex]; var geom = { type: geomType, coordinates: coordinate }; if (callback2(helpers.feature(geom, properties), featureIndex, multiFeatureIndex) === false) return false; } }); } function flattenReduce(geojson, callback2, initialValue) { var previousValue = initialValue; flattenEach2( geojson, function(currentFeature, featureIndex, multiFeatureIndex) { if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0) previousValue = currentFeature; else previousValue = callback2( previousValue, currentFeature, featureIndex, multiFeatureIndex ); } ); return previousValue; } function segmentEach(geojson, callback2) { flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) { var segmentIndex = 0; if (!feature2.geometry) return; var type = feature2.geometry.type; if (type === "Point" || type === "MultiPoint") return; var previousCoords; var previousFeatureIndex = 0; var previousMultiIndex = 0; var prevGeomIndex = 0; if (coordEach2( feature2, function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) { if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) { previousCoords = currentCoord; previousFeatureIndex = featureIndex; previousMultiIndex = multiPartIndexCoord; prevGeomIndex = geometryIndex; segmentIndex = 0; return; } var currentSegment = helpers.lineString( [previousCoords, currentCoord], feature2.properties ); if (callback2( currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex ) === false) return false; segmentIndex++; previousCoords = currentCoord; } ) === false) return false; }); } function segmentReduce(geojson, callback2, initialValue) { var previousValue = initialValue; var started = false; segmentEach( geojson, function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) { if (started === false && initialValue === void 0) previousValue = currentSegment; else previousValue = callback2( previousValue, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex ); started = true; } ); return previousValue; } function lineEach(geojson, callback2) { if (!geojson) throw new Error("geojson is required"); flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) { if (feature2.geometry === null) return; var type = feature2.geometry.type; var coords = feature2.geometry.coordinates; switch (type) { case "LineString": if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false) return false; break; case "Polygon": for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) { if (callback2( helpers.lineString(coords[geometryIndex], feature2.properties), featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; } break; } }); } function lineReduce(geojson, callback2, initialValue) { var previousValue = initialValue; lineEach( geojson, function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentLine; else previousValue = callback2( previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex ); } ); return previousValue; } function findSegment(geojson, options) { options = options || {}; if (!helpers.isObject(options)) throw new Error("options is invalid"); var featureIndex = options.featureIndex || 0; var multiFeatureIndex = options.multiFeatureIndex || 0; var geometryIndex = options.geometryIndex || 0; var segmentIndex = options.segmentIndex || 0; var properties = options.properties; var geometry; switch (geojson.type) { case "FeatureCollection": if (featureIndex < 0) featureIndex = geojson.features.length + featureIndex; properties = properties || geojson.features[featureIndex].properties; geometry = geojson.features[featureIndex].geometry; break; case "Feature": properties = properties || geojson.properties; geometry = geojson.geometry; break; case "Point": case "MultiPoint": return null; case "LineString": case "Polygon": case "MultiLineString": case "MultiPolygon": geometry = geojson; break; default: throw new Error("geojson is invalid"); } if (geometry === null) return null; var coords = geometry.coordinates; switch (geometry.type) { case "Point": case "MultiPoint": return null; case "LineString": if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1; return helpers.lineString( [coords[segmentIndex], coords[segmentIndex + 1]], properties, options ); case "Polygon": if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex; if (segmentIndex < 0) segmentIndex = coords[geometryIndex].length + segmentIndex - 1; return helpers.lineString( [ coords[geometryIndex][segmentIndex], coords[geometryIndex][segmentIndex + 1] ], properties, options ); case "MultiLineString": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1; return helpers.lineString( [ coords[multiFeatureIndex][segmentIndex], coords[multiFeatureIndex][segmentIndex + 1] ], properties, options ); case "MultiPolygon": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex; if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1; return helpers.lineString( [ coords[multiFeatureIndex][geometryIndex][segmentIndex], coords[multiFeatureIndex][geometryIndex][segmentIndex + 1] ], properties, options ); } throw new Error("geojson is invalid"); } function findPoint(geojson, options) { options = options || {}; if (!helpers.isObject(options)) throw new Error("options is invalid"); var featureIndex = options.featureIndex || 0; var multiFeatureIndex = options.multiFeatureIndex || 0; var geometryIndex = options.geometryIndex || 0; var coordIndex = options.coordIndex || 0; var properties = options.properties; var geometry; switch (geojson.type) { case "FeatureCollection": if (featureIndex < 0) featureIndex = geojson.features.length + featureIndex; properties = properties || geojson.features[featureIndex].properties; geometry = geojson.features[featureIndex].geometry; break; case "Feature": properties = properties || geojson.properties; geometry = geojson.geometry; break; case "Point": case "MultiPoint": return null; case "LineString": case "Polygon": case "MultiLineString": case "MultiPolygon": geometry = geojson; break; default: throw new Error("geojson is invalid"); } if (geometry === null) return null; var coords = geometry.coordinates; switch (geometry.type) { case "Point": return helpers.point(coords, properties, options); case "MultiPoint": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; return helpers.point(coords[multiFeatureIndex], properties, options); case "LineString": if (coordIndex < 0) coordIndex = coords.length + coordIndex; return helpers.point(coords[coordIndex], properties, options); case "Polygon": if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex; if (coordIndex < 0) coordIndex = coords[geometryIndex].length + coordIndex; return helpers.point(coords[geometryIndex][coordIndex], properties, options); case "MultiLineString": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (coordIndex < 0) coordIndex = coords[multiFeatureIndex].length + coordIndex; return helpers.point(coords[multiFeatureIndex][coordIndex], properties, options); case "MultiPolygon": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex; if (coordIndex < 0) coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex; return helpers.point( coords[multiFeatureIndex][geometryIndex][coordIndex], properties, options ); } throw new Error("geojson is invalid"); } exports.coordAll = coordAll; exports.coordEach = coordEach2; exports.coordReduce = coordReduce; exports.featureEach = featureEach2; exports.featureReduce = featureReduce; exports.findPoint = findPoint; exports.findSegment = findSegment; exports.flattenEach = flattenEach2; exports.flattenReduce = flattenReduce; exports.geomEach = geomEach2; exports.geomReduce = geomReduce; exports.lineEach = lineEach; exports.lineReduce = lineReduce; exports.propEach = propEach; exports.propReduce = propReduce; exports.segmentEach = segmentEach; exports.segmentReduce = segmentReduce; } }); // node_modules/geojson-rbush/node_modules/@turf/bbox/node_modules/@turf/helpers/dist/cjs/index.cjs var require_cjs = __commonJS({ "node_modules/geojson-rbush/node_modules/@turf/bbox/node_modules/@turf/helpers/dist/cjs/index.cjs"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var earthRadius2 = 63710088e-1; var factors2 = { centimeters: earthRadius2 * 100, centimetres: earthRadius2 * 100, degrees: 360 / (2 * Math.PI), feet: earthRadius2 * 3.28084, inches: earthRadius2 * 39.37, kilometers: earthRadius2 / 1e3, kilometres: earthRadius2 / 1e3, meters: earthRadius2, metres: earthRadius2, miles: earthRadius2 / 1609.344, millimeters: earthRadius2 * 1e3, millimetres: earthRadius2 * 1e3, nauticalmiles: earthRadius2 / 1852, radians: 1, yards: earthRadius2 * 1.0936 }; var areaFactors = { acres: 247105e-9, centimeters: 1e4, centimetres: 1e4, feet: 10.763910417, hectares: 1e-4, inches: 1550.003100006, kilometers: 1e-6, kilometres: 1e-6, meters: 1, metres: 1, miles: 386e-9, nauticalmiles: 29155334959812285e-23, millimeters: 1e6, millimetres: 1e6, yards: 1.195990046 }; function feature2(geom, properties, options = {}) { const feat = { type: "Feature" }; if (options.id === 0 || options.id) { feat.id = options.id; } if (options.bbox) { feat.bbox = options.bbox; } feat.properties = properties || {}; feat.geometry = geom; return feat; } function geometry(type, coordinates, _options = {}) { switch (type) { case "Point": return point2(coordinates).geometry; case "LineString": return lineString2(coordinates).geometry; case "Polygon": return polygon2(coordinates).geometry; case "MultiPoint": return multiPoint(coordinates).geometry; case "MultiLineString": return multiLineString2(coordinates).geometry; case "MultiPolygon": return multiPolygon(coordinates).geometry; default: throw new Error(type + " is invalid"); } } function point2(coordinates, properties, options = {}) { if (!coordinates) { throw new Error("coordinates is required"); } if (!Array.isArray(coordinates)) { throw new Error("coordinates must be an Array"); } if (coordinates.length < 2) { throw new Error("coordinates must be at least 2 numbers long"); } if (!isNumber5(coordinates[0]) || !isNumber5(coordinates[1])) { throw new Error("coordinates must contain numbers"); } const geom = { type: "Point", coordinates }; return feature2(geom, properties, options); } function points(coordinates, properties, options = {}) { return featureCollection2( coordinates.map((coords) => { return point2(coords, properties); }), options ); } function polygon2(coordinates, properties, options = {}) { for (const ring of coordinates) { if (ring.length < 4) { throw new Error( "Each LinearRing of a Polygon must have 4 or more Positions." ); } if (ring[ring.length - 1].length !== ring[0].length) { throw new Error("First and last Position are not equivalent."); } for (let j3 = 0; j3 < ring[ring.length - 1].length; j3++) { if (ring[ring.length - 1][j3] !== ring[0][j3]) { throw new Error("First and last Position are not equivalent."); } } } const geom = { type: "Polygon", coordinates }; return feature2(geom, properties, options); } function polygons(coordinates, properties, options = {}) { return featureCollection2( coordinates.map((coords) => { return polygon2(coords, properties); }), options ); } function lineString2(coordinates, properties, options = {}) { if (coordinates.length < 2) { throw new Error("coordinates must be an array of two or more positions"); } const geom = { type: "LineString", coordinates }; return feature2(geom, properties, options); } function lineStrings(coordinates, properties, options = {}) { return featureCollection2( coordinates.map((coords) => { return lineString2(coords, properties); }), options ); } function featureCollection2(features, options = {}) { const fc = { type: "FeatureCollection" }; if (options.id) { fc.id = options.id; } if (options.bbox) { fc.bbox = options.bbox; } fc.features = features; return fc; } function multiLineString2(coordinates, properties, options = {}) { const geom = { type: "MultiLineString", coordinates }; return feature2(geom, properties, options); } function multiPoint(coordinates, properties, options = {}) { const geom = { type: "MultiPoint", coordinates }; return feature2(geom, properties, options); } function multiPolygon(coordinates, properties, options = {}) { const geom = { type: "MultiPolygon", coordinates }; return feature2(geom, properties, options); } function geometryCollection2(geometries, properties, options = {}) { const geom = { type: "GeometryCollection", geometries }; return feature2(geom, properties, options); } function round3(num, precision = 0) { if (precision && !(precision >= 0)) { throw new Error("precision must be a positive number"); } const multiplier = Math.pow(10, precision || 0); return Math.round(num * multiplier) / multiplier; } function radiansToLength(radians, units = "kilometers") { const factor = factors2[units]; if (!factor) { throw new Error(units + " units is invalid"); } return radians * factor; } function lengthToRadians2(distance, units = "kilometers") { const factor = factors2[units]; if (!factor) { throw new Error(units + " units is invalid"); } return distance / factor; } function lengthToDegrees(distance, units) { return radiansToDegrees2(lengthToRadians2(distance, units)); } function bearingToAzimuth(bearing) { let angle = bearing % 360; if (angle < 0) { angle += 360; } return angle; } function azimuthToBearing(angle) { angle = angle % 360; if (angle > 180) { return angle - 360; } else if (angle < -180) { return angle + 360; } return angle; } function radiansToDegrees2(radians) { const normalisedRadians = radians % (2 * Math.PI); return normalisedRadians * 180 / Math.PI; } function degreesToRadians2(degrees) { const normalisedDegrees = degrees % 360; return normalisedDegrees * Math.PI / 180; } function convertLength(length, originalUnit = "kilometers", finalUnit = "kilometers") { if (!(length >= 0)) { throw new Error("length must be a positive number"); } return radiansToLength(lengthToRadians2(length, originalUnit), finalUnit); } function convertArea(area, originalUnit = "meters", finalUnit = "kilometers") { if (!(area >= 0)) { throw new Error("area must be a positive number"); } const startFactor = areaFactors[originalUnit]; if (!startFactor) { throw new Error("invalid original units"); } const finalFactor = areaFactors[finalUnit]; if (!finalFactor) { throw new Error("invalid final units"); } return area / startFactor * finalFactor; } function isNumber5(num) { return !isNaN(num) && num !== null && !Array.isArray(num); } function isObject4(input2) { return input2 !== null && typeof input2 === "object" && !Array.isArray(input2); } function validateBBox(bbox3) { if (!bbox3) { throw new Error("bbox is required"); } if (!Array.isArray(bbox3)) { throw new Error("bbox must be an Array"); } if (bbox3.length !== 4 && bbox3.length !== 6) { throw new Error("bbox must be an Array of 4 or 6 numbers"); } bbox3.forEach((num) => { if (!isNumber5(num)) { throw new Error("bbox must only contain numbers"); } }); } function validateId(id) { if (!id) { throw new Error("id is required"); } if (["string", "number"].indexOf(typeof id) === -1) { throw new Error("id must be a number or a string"); } } exports.areaFactors = areaFactors; exports.azimuthToBearing = azimuthToBearing; exports.bearingToAzimuth = bearingToAzimuth; exports.convertArea = convertArea; exports.convertLength = convertLength; exports.degreesToRadians = degreesToRadians2; exports.earthRadius = earthRadius2; exports.factors = factors2; exports.feature = feature2; exports.featureCollection = featureCollection2; exports.geometry = geometry; exports.geometryCollection = geometryCollection2; exports.isNumber = isNumber5; exports.isObject = isObject4; exports.lengthToDegrees = lengthToDegrees; exports.lengthToRadians = lengthToRadians2; exports.lineString = lineString2; exports.lineStrings = lineStrings; exports.multiLineString = multiLineString2; exports.multiPoint = multiPoint; exports.multiPolygon = multiPolygon; exports.point = point2; exports.points = points; exports.polygon = polygon2; exports.polygons = polygons; exports.radiansToDegrees = radiansToDegrees2; exports.radiansToLength = radiansToLength; exports.round = round3; exports.validateBBox = validateBBox; exports.validateId = validateId; } }); // node_modules/geojson-rbush/node_modules/@turf/bbox/node_modules/@turf/meta/dist/cjs/index.cjs var require_cjs2 = __commonJS({ "node_modules/geojson-rbush/node_modules/@turf/bbox/node_modules/@turf/meta/dist/cjs/index.cjs"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _helpers = require_cjs(); function coordEach2(geojson, callback2, excludeWrapCoord) { if (geojson === null) return; var j3, k6, l20, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1; for (var featureIndex = 0; featureIndex < stop; featureIndex++) { geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson; isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false; stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1; for (var geomIndex = 0; geomIndex < stopG; geomIndex++) { var multiFeatureIndex = 0; var geometryIndex = 0; geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection; if (geometry === null) continue; coords = geometry.coordinates; var geomType = geometry.type; wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0; switch (geomType) { case null: break; case "Point": if (callback2( coords, coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; multiFeatureIndex++; break; case "LineString": case "MultiPoint": for (j3 = 0; j3 < coords.length; j3++) { if (callback2( coords[j3], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; if (geomType === "MultiPoint") multiFeatureIndex++; } if (geomType === "LineString") multiFeatureIndex++; break; case "Polygon": case "MultiLineString": for (j3 = 0; j3 < coords.length; j3++) { for (k6 = 0; k6 < coords[j3].length - wrapShrink; k6++) { if (callback2( coords[j3][k6], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; } if (geomType === "MultiLineString") multiFeatureIndex++; if (geomType === "Polygon") geometryIndex++; } if (geomType === "Polygon") multiFeatureIndex++; break; case "MultiPolygon": for (j3 = 0; j3 < coords.length; j3++) { geometryIndex = 0; for (k6 = 0; k6 < coords[j3].length; k6++) { for (l20 = 0; l20 < coords[j3][k6].length - wrapShrink; l20++) { if (callback2( coords[j3][k6][l20], coordIndex, featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; coordIndex++; } geometryIndex++; } multiFeatureIndex++; } break; case "GeometryCollection": for (j3 = 0; j3 < geometry.geometries.length; j3++) if (coordEach2(geometry.geometries[j3], callback2, excludeWrapCoord) === false) return false; break; default: throw new Error("Unknown Geometry Type"); } } } } function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) { var previousValue = initialValue; coordEach2( geojson, function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) { if (coordIndex === 0 && initialValue === void 0) previousValue = currentCoord; else previousValue = callback2( previousValue, currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex ); }, excludeWrapCoord ); return previousValue; } function propEach(geojson, callback2) { var i25; switch (geojson.type) { case "FeatureCollection": for (i25 = 0; i25 < geojson.features.length; i25++) { if (callback2(geojson.features[i25].properties, i25) === false) break; } break; case "Feature": callback2(geojson.properties, 0); break; } } function propReduce(geojson, callback2, initialValue) { var previousValue = initialValue; propEach(geojson, function(currentProperties, featureIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentProperties; else previousValue = callback2(previousValue, currentProperties, featureIndex); }); return previousValue; } function featureEach2(geojson, callback2) { if (geojson.type === "Feature") { callback2(geojson, 0); } else if (geojson.type === "FeatureCollection") { for (var i25 = 0; i25 < geojson.features.length; i25++) { if (callback2(geojson.features[i25], i25) === false) break; } } } function featureReduce(geojson, callback2, initialValue) { var previousValue = initialValue; featureEach2(geojson, function(currentFeature, featureIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentFeature; else previousValue = callback2(previousValue, currentFeature, featureIndex); }); return previousValue; } function coordAll(geojson) { var coords = []; coordEach2(geojson, function(coord) { coords.push(coord); }); return coords; } function geomEach2(geojson, callback2) { var i25, j3, g8, geometry, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1; for (i25 = 0; i25 < stop; i25++) { geometryMaybeCollection = isFeatureCollection ? geojson.features[i25].geometry : isFeature ? geojson.geometry : geojson; featureProperties = isFeatureCollection ? geojson.features[i25].properties : isFeature ? geojson.properties : {}; featureBBox = isFeatureCollection ? geojson.features[i25].bbox : isFeature ? geojson.bbox : void 0; featureId = isFeatureCollection ? geojson.features[i25].id : isFeature ? geojson.id : void 0; isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false; stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1; for (g8 = 0; g8 < stopG; g8++) { geometry = isGeometryCollection ? geometryMaybeCollection.geometries[g8] : geometryMaybeCollection; if (geometry === null) { if (callback2( null, featureIndex, featureProperties, featureBBox, featureId ) === false) return false; continue; } switch (geometry.type) { case "Point": case "LineString": case "MultiPoint": case "Polygon": case "MultiLineString": case "MultiPolygon": { if (callback2( geometry, featureIndex, featureProperties, featureBBox, featureId ) === false) return false; break; } case "GeometryCollection": { for (j3 = 0; j3 < geometry.geometries.length; j3++) { if (callback2( geometry.geometries[j3], featureIndex, featureProperties, featureBBox, featureId ) === false) return false; } break; } default: throw new Error("Unknown Geometry Type"); } } featureIndex++; } } function geomReduce(geojson, callback2, initialValue) { var previousValue = initialValue; geomEach2( geojson, function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentGeometry; else previousValue = callback2( previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId ); } ); return previousValue; } function flattenEach2(geojson, callback2) { geomEach2(geojson, function(geometry, featureIndex, properties, bbox3, id) { var type = geometry === null ? null : geometry.type; switch (type) { case null: case "Point": case "LineString": case "Polygon": if (callback2( _helpers.feature.call(void 0, geometry, properties, { bbox: bbox3, id }), featureIndex, 0 ) === false) return false; return; } var geomType; switch (type) { case "MultiPoint": geomType = "Point"; break; case "MultiLineString": geomType = "LineString"; break; case "MultiPolygon": geomType = "Polygon"; break; } for (var multiFeatureIndex = 0; multiFeatureIndex < geometry.coordinates.length; multiFeatureIndex++) { var coordinate = geometry.coordinates[multiFeatureIndex]; var geom = { type: geomType, coordinates: coordinate }; if (callback2(_helpers.feature.call(void 0, geom, properties), featureIndex, multiFeatureIndex) === false) return false; } }); } function flattenReduce(geojson, callback2, initialValue) { var previousValue = initialValue; flattenEach2( geojson, function(currentFeature, featureIndex, multiFeatureIndex) { if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0) previousValue = currentFeature; else previousValue = callback2( previousValue, currentFeature, featureIndex, multiFeatureIndex ); } ); return previousValue; } function segmentEach(geojson, callback2) { flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) { var segmentIndex = 0; if (!feature2.geometry) return; var type = feature2.geometry.type; if (type === "Point" || type === "MultiPoint") return; var previousCoords; var previousFeatureIndex = 0; var previousMultiIndex = 0; var prevGeomIndex = 0; if (coordEach2( feature2, function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) { if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) { previousCoords = currentCoord; previousFeatureIndex = featureIndex; previousMultiIndex = multiPartIndexCoord; prevGeomIndex = geometryIndex; segmentIndex = 0; return; } var currentSegment = _helpers.lineString.call( void 0, [previousCoords, currentCoord], feature2.properties ); if (callback2( currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex ) === false) return false; segmentIndex++; previousCoords = currentCoord; } ) === false) return false; }); } function segmentReduce(geojson, callback2, initialValue) { var previousValue = initialValue; var started = false; segmentEach( geojson, function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) { if (started === false && initialValue === void 0) previousValue = currentSegment; else previousValue = callback2( previousValue, currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex ); started = true; } ); return previousValue; } function lineEach(geojson, callback2) { if (!geojson) throw new Error("geojson is required"); flattenEach2(geojson, function(feature2, featureIndex, multiFeatureIndex) { if (feature2.geometry === null) return; var type = feature2.geometry.type; var coords = feature2.geometry.coordinates; switch (type) { case "LineString": if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false) return false; break; case "Polygon": for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) { if (callback2( _helpers.lineString.call(void 0, coords[geometryIndex], feature2.properties), featureIndex, multiFeatureIndex, geometryIndex ) === false) return false; } break; } }); } function lineReduce(geojson, callback2, initialValue) { var previousValue = initialValue; lineEach( geojson, function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) { if (featureIndex === 0 && initialValue === void 0) previousValue = currentLine; else previousValue = callback2( previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex ); } ); return previousValue; } function findSegment(geojson, options) { options = options || {}; if (!_helpers.isObject.call(void 0, options)) throw new Error("options is invalid"); var featureIndex = options.featureIndex || 0; var multiFeatureIndex = options.multiFeatureIndex || 0; var geometryIndex = options.geometryIndex || 0; var segmentIndex = options.segmentIndex || 0; var properties = options.properties; var geometry; switch (geojson.type) { case "FeatureCollection": if (featureIndex < 0) featureIndex = geojson.features.length + featureIndex; properties = properties || geojson.features[featureIndex].properties; geometry = geojson.features[featureIndex].geometry; break; case "Feature": properties = properties || geojson.properties; geometry = geojson.geometry; break; case "Point": case "MultiPoint": return null; case "LineString": case "Polygon": case "MultiLineString": case "MultiPolygon": geometry = geojson; break; default: throw new Error("geojson is invalid"); } if (geometry === null) return null; var coords = geometry.coordinates; switch (geometry.type) { case "Point": case "MultiPoint": return null; case "LineString": if (segmentIndex < 0) segmentIndex = coords.length + segmentIndex - 1; return _helpers.lineString.call( void 0, [coords[segmentIndex], coords[segmentIndex + 1]], properties, options ); case "Polygon": if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex; if (segmentIndex < 0) segmentIndex = coords[geometryIndex].length + segmentIndex - 1; return _helpers.lineString.call( void 0, [ coords[geometryIndex][segmentIndex], coords[geometryIndex][segmentIndex + 1] ], properties, options ); case "MultiLineString": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1; return _helpers.lineString.call( void 0, [ coords[multiFeatureIndex][segmentIndex], coords[multiFeatureIndex][segmentIndex + 1] ], properties, options ); case "MultiPolygon": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex; if (segmentIndex < 0) segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1; return _helpers.lineString.call( void 0, [ coords[multiFeatureIndex][geometryIndex][segmentIndex], coords[multiFeatureIndex][geometryIndex][segmentIndex + 1] ], properties, options ); } throw new Error("geojson is invalid"); } function findPoint(geojson, options) { options = options || {}; if (!_helpers.isObject.call(void 0, options)) throw new Error("options is invalid"); var featureIndex = options.featureIndex || 0; var multiFeatureIndex = options.multiFeatureIndex || 0; var geometryIndex = options.geometryIndex || 0; var coordIndex = options.coordIndex || 0; var properties = options.properties; var geometry; switch (geojson.type) { case "FeatureCollection": if (featureIndex < 0) featureIndex = geojson.features.length + featureIndex; properties = properties || geojson.features[featureIndex].properties; geometry = geojson.features[featureIndex].geometry; break; case "Feature": properties = properties || geojson.properties; geometry = geojson.geometry; break; case "Point": case "MultiPoint": return null; case "LineString": case "Polygon": case "MultiLineString": case "MultiPolygon": geometry = geojson; break; default: throw new Error("geojson is invalid"); } if (geometry === null) return null; var coords = geometry.coordinates; switch (geometry.type) { case "Point": return _helpers.point.call(void 0, coords, properties, options); case "MultiPoint": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; return _helpers.point.call(void 0, coords[multiFeatureIndex], properties, options); case "LineString": if (coordIndex < 0) coordIndex = coords.length + coordIndex; return _helpers.point.call(void 0, coords[coordIndex], properties, options); case "Polygon": if (geometryIndex < 0) geometryIndex = coords.length + geometryIndex; if (coordIndex < 0) coordIndex = coords[geometryIndex].length + coordIndex; return _helpers.point.call(void 0, coords[geometryIndex][coordIndex], properties, options); case "MultiLineString": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (coordIndex < 0) coordIndex = coords[multiFeatureIndex].length + coordIndex; return _helpers.point.call(void 0, coords[multiFeatureIndex][coordIndex], properties, options); case "MultiPolygon": if (multiFeatureIndex < 0) multiFeatureIndex = coords.length + multiFeatureIndex; if (geometryIndex < 0) geometryIndex = coords[multiFeatureIndex].length + geometryIndex; if (coordIndex < 0) coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex; return _helpers.point.call( void 0, coords[multiFeatureIndex][geometryIndex][coordIndex], properties, options ); } throw new Error("geojson is invalid"); } exports.coordAll = coordAll; exports.coordEach = coordEach2; exports.coordReduce = coordReduce; exports.featureEach = featureEach2; exports.featureReduce = featureReduce; exports.findPoint = findPoint; exports.findSegment = findSegment; exports.flattenEach = flattenEach2; exports.flattenReduce = flattenReduce; exports.geomEach = geomEach2; exports.geomReduce = geomReduce; exports.lineEach = lineEach; exports.lineReduce = lineReduce; exports.propEach = propEach; exports.propReduce = propReduce; exports.segmentEach = segmentEach; exports.segmentReduce = segmentReduce; } }); // node_modules/geojson-rbush/node_modules/@turf/bbox/dist/cjs/index.cjs var require_cjs3 = __commonJS({ "node_modules/geojson-rbush/node_modules/@turf/bbox/dist/cjs/index.cjs"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _meta = require_cjs2(); function bbox3(geojson, options = {}) { if (geojson.bbox != null && true !== options.recompute) { return geojson.bbox; } const result = [Infinity, Infinity, -Infinity, -Infinity]; _meta.coordEach.call(void 0, geojson, (coord) => { if (result[0] > coord[0]) { result[0] = coord[0]; } if (result[1] > coord[1]) { result[1] = coord[1]; } if (result[2] < coord[0]) { result[2] = coord[0]; } if (result[3] < coord[1]) { result[3] = coord[1]; } }); return result; } var turf_bbox_default = bbox3; exports.bbox = bbox3; exports.default = turf_bbox_default; } }); // node_modules/geojson-rbush/index.js var require_geojson_rbush = __commonJS({ "node_modules/geojson-rbush/index.js"(exports, module) { "use strict"; var rbush2 = require_rbush_min(); var helpers = require_js(); var meta = require_js2(); var turfBBox = require_cjs3().default; var featureEach2 = meta.featureEach; var coordEach2 = meta.coordEach; var polygon2 = helpers.polygon; var featureCollection2 = helpers.featureCollection; function geojsonRbush(maxEntries) { var tree2 = new rbush2(maxEntries); tree2.insert = function(feature2) { if (feature2.type !== "Feature") throw new Error("invalid feature"); feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2); return rbush2.prototype.insert.call(this, feature2); }; tree2.load = function(features) { var load2 = []; if (Array.isArray(features)) { features.forEach(function(feature2) { if (feature2.type !== "Feature") throw new Error("invalid features"); feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2); load2.push(feature2); }); } else { featureEach2(features, function(feature2) { if (feature2.type !== "Feature") throw new Error("invalid features"); feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2); load2.push(feature2); }); } return rbush2.prototype.load.call(this, load2); }; tree2.remove = function(feature2, equals2) { if (feature2.type !== "Feature") throw new Error("invalid feature"); feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2); return rbush2.prototype.remove.call(this, feature2, equals2); }; tree2.clear = function() { return rbush2.prototype.clear.call(this); }; tree2.search = function(geojson) { var features = rbush2.prototype.search.call(this, this.toBBox(geojson)); return featureCollection2(features); }; tree2.collides = function(geojson) { return rbush2.prototype.collides.call(this, this.toBBox(geojson)); }; tree2.all = function() { var features = rbush2.prototype.all.call(this); return featureCollection2(features); }; tree2.toJSON = function() { return rbush2.prototype.toJSON.call(this); }; tree2.fromJSON = function(json) { return rbush2.prototype.fromJSON.call(this, json); }; tree2.toBBox = function(geojson) { var bbox3; if (geojson.bbox) bbox3 = geojson.bbox; else if (Array.isArray(geojson) && geojson.length === 4) bbox3 = geojson; else if (Array.isArray(geojson) && geojson.length === 6) bbox3 = [geojson[0], geojson[1], geojson[3], geojson[4]]; else if (geojson.type === "Feature") bbox3 = turfBBox(geojson); else if (geojson.type === "FeatureCollection") bbox3 = turfBBox(geojson); else throw new Error("invalid geojson"); return { minX: bbox3[0], minY: bbox3[1], maxX: bbox3[2], maxY: bbox3[3] }; }; return tree2; } module.exports = geojsonRbush; module.exports.default = geojsonRbush; } }); // (disabled):crypto var require_crypto = __commonJS({ "(disabled):crypto"() { "use strict"; } }); // node_modules/crypto-js/core.js var require_core = __commonJS({ "node_modules/crypto-js/core.js"(exports, module) { "use strict"; (function(root, factory) { if (typeof exports === "object") { module.exports = exports = factory(); } else if (typeof define === "function" && define.amd) { define([], factory); } else { root.CryptoJS = factory(); } })(exports, function() { var CryptoJS = CryptoJS || (function(Math2, undefined2) { var crypto2; if (typeof window !== "undefined" && window.crypto) { crypto2 = window.crypto; } if (typeof self !== "undefined" && self.crypto) { crypto2 = self.crypto; } if (typeof globalThis !== "undefined" && globalThis.crypto) { crypto2 = globalThis.crypto; } if (!crypto2 && typeof window !== "undefined" && window.msCrypto) { crypto2 = window.msCrypto; } if (!crypto2 && typeof global !== "undefined" && global.crypto) { crypto2 = global.crypto; } if (!crypto2 && typeof __require === "function") { try { crypto2 = require_crypto(); } catch (err) { } } var cryptoSecureRandomInt = function() { if (crypto2) { if (typeof crypto2.getRandomValues === "function") { try { return crypto2.getRandomValues(new Uint32Array(1))[0]; } catch (err) { } } if (typeof crypto2.randomBytes === "function") { try { return crypto2.randomBytes(4).readInt32LE(); } catch (err) { } } } throw new Error("Native crypto module could not be used to get secure random number."); }; var create = Object.create || /* @__PURE__ */ (function() { function F16() { } return function(obj) { var subtype; F16.prototype = obj; subtype = new F16(); F16.prototype = null; return subtype; }; })(); var C5 = {}; var C_lib = C5.lib = {}; var Base = C_lib.Base = /* @__PURE__ */ (function() { return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function(overrides2) { var subtype = create(this); if (overrides2) { subtype.mixIn(overrides2); } if (!subtype.hasOwnProperty("init") || this.init === subtype.init) { subtype.init = function() { subtype.$super.init.apply(this, arguments); }; } subtype.init.prototype = subtype; subtype.$super = this; return subtype; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function() { var instance = this.extend(); instance.init.apply(instance, arguments); return instance; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function() { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function(properties) { for (var propertyName in properties) { if (properties.hasOwnProperty(propertyName)) { this[propertyName] = properties[propertyName]; } } if (properties.hasOwnProperty("toString")) { this.toString = properties.toString; } }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function() { return this.init.prototype.extend(this); } }; })(); var WordArray = C_lib.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function(words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined2) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 4; } }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function(encoder) { return (encoder || Hex).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function(wordArray) { var thisWords = this.words; var thatWords = wordArray.words; var thisSigBytes = this.sigBytes; var thatSigBytes = wordArray.sigBytes; this.clamp(); if (thisSigBytes % 4) { for (var i25 = 0; i25 < thatSigBytes; i25++) { var thatByte = thatWords[i25 >>> 2] >>> 24 - i25 % 4 * 8 & 255; thisWords[thisSigBytes + i25 >>> 2] |= thatByte << 24 - (thisSigBytes + i25) % 4 * 8; } } else { for (var j3 = 0; j3 < thatSigBytes; j3 += 4) { thisWords[thisSigBytes + j3 >>> 2] = thatWords[j3 >>> 2]; } } this.sigBytes += thatSigBytes; return this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function() { var words = this.words; var sigBytes = this.sigBytes; words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8; words.length = Math2.ceil(sigBytes / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function() { var clone3 = Base.clone.call(this); clone3.words = this.words.slice(0); return clone3; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function(nBytes) { var words = []; for (var i25 = 0; i25 < nBytes; i25 += 4) { words.push(cryptoSecureRandomInt()); } return new WordArray.init(words, nBytes); } }); var C_enc = C5.enc = {}; var Hex = C_enc.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function(wordArray) { var words = wordArray.words; var sigBytes = wordArray.sigBytes; var hexChars = []; for (var i25 = 0; i25 < sigBytes; i25++) { var bite = words[i25 >>> 2] >>> 24 - i25 % 4 * 8 & 255; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 15).toString(16)); } return hexChars.join(""); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function(hexStr) { var hexStrLength = hexStr.length; var words = []; for (var i25 = 0; i25 < hexStrLength; i25 += 2) { words[i25 >>> 3] |= parseInt(hexStr.substr(i25, 2), 16) << 24 - i25 % 8 * 4; } return new WordArray.init(words, hexStrLength / 2); } }; var Latin1 = C_enc.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function(wordArray) { var words = wordArray.words; var sigBytes = wordArray.sigBytes; var latin1Chars = []; for (var i25 = 0; i25 < sigBytes; i25++) { var bite = words[i25 >>> 2] >>> 24 - i25 % 4 * 8 & 255; latin1Chars.push(String.fromCharCode(bite)); } return latin1Chars.join(""); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function(latin1Str) { var latin1StrLength = latin1Str.length; var words = []; for (var i25 = 0; i25 < latin1StrLength; i25++) { words[i25 >>> 2] |= (latin1Str.charCodeAt(i25) & 255) << 24 - i25 % 4 * 8; } return new WordArray.init(words, latin1StrLength); } }; var Utf8 = C_enc.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function(wordArray) { try { return decodeURIComponent(escape(Latin1.stringify(wordArray))); } catch (e56) { throw new Error("Malformed UTF-8 data"); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function(utf8Str) { return Latin1.parse(unescape(encodeURIComponent(utf8Str))); } }; var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function() { this._data = new WordArray.init(); this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function(data) { if (typeof data == "string") { data = Utf8.parse(data); } this._data.concat(data); this._nDataBytes += data.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function(doFlush) { var processedWords; var data = this._data; var dataWords = data.words; var dataSigBytes = data.sigBytes; var blockSize = this.blockSize; var blockSizeBytes = blockSize * 4; var nBlocksReady = dataSigBytes / blockSizeBytes; if (doFlush) { nBlocksReady = Math2.ceil(nBlocksReady); } else { nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0); } var nWordsReady = nBlocksReady * blockSize; var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes); if (nWordsReady) { for (var offset2 = 0; offset2 < nWordsReady; offset2 += blockSize) { this._doProcessBlock(dataWords, offset2); } processedWords = dataWords.splice(0, nWordsReady); data.sigBytes -= nBytesReady; } return new WordArray.init(processedWords, nBytesReady); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function() { var clone3 = Base.clone.call(this); clone3._data = this._data.clone(); return clone3; }, _minBufferSize: 0 }); var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ /** * Configuration options. */ cfg: Base.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function(cfg) { this.cfg = this.cfg.extend(cfg); this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function() { BufferedBlockAlgorithm.reset.call(this); this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function(messageUpdate) { this._append(messageUpdate); this._process(); return this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function(messageUpdate) { if (messageUpdate) { this._append(messageUpdate); } var hash2 = this._doFinalize(); return hash2; }, blockSize: 512 / 32, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function(hasher) { return function(message2, cfg) { return new hasher.init(cfg).finalize(message2); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function(hasher) { return function(message2, key) { return new C_algo.HMAC.init(hasher, key).finalize(message2); }; } }); var C_algo = C5.algo = {}; return C5; })(Math); return CryptoJS; }); } }); // node_modules/crypto-js/sha256.js var require_sha256 = __commonJS({ "node_modules/crypto-js/sha256.js"(exports, module) { "use strict"; (function(root, factory) { if (typeof exports === "object") { module.exports = exports = factory(require_core()); } else if (typeof define === "function" && define.amd) { define(["./core"], factory); } else { factory(root.CryptoJS); } })(exports, function(CryptoJS) { (function(Math2) { var C5 = CryptoJS; var C_lib = C5.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C5.algo; var H3 = []; var K4 = []; (function() { function isPrime(n45) { var sqrtN = Math2.sqrt(n45); for (var factor = 2; factor <= sqrtN; factor++) { if (!(n45 % factor)) { return false; } } return true; } function getFractionalBits(n45) { return (n45 - (n45 | 0)) * 4294967296 | 0; } var n44 = 2; var nPrime = 0; while (nPrime < 64) { if (isPrime(n44)) { if (nPrime < 8) { H3[nPrime] = getFractionalBits(Math2.pow(n44, 1 / 2)); } K4[nPrime] = getFractionalBits(Math2.pow(n44, 1 / 3)); nPrime++; } n44++; } })(); var W3 = []; var SHA256 = C_algo.SHA256 = Hasher.extend({ _doReset: function() { this._hash = new WordArray.init(H3.slice(0)); }, _doProcessBlock: function(M4, offset2) { var H4 = this._hash.words; var a45 = H4[0]; var b7 = H4[1]; var c27 = H4[2]; var d33 = H4[3]; var e56 = H4[4]; var f7 = H4[5]; var g8 = H4[6]; var h7 = H4[7]; for (var i25 = 0; i25 < 64; i25++) { if (i25 < 16) { W3[i25] = M4[offset2 + i25] | 0; } else { var gamma0x = W3[i25 - 15]; var gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3; var gamma1x = W3[i25 - 2]; var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10; W3[i25] = gamma0 + W3[i25 - 7] + gamma1 + W3[i25 - 16]; } var ch = e56 & f7 ^ ~e56 & g8; var maj = a45 & b7 ^ a45 & c27 ^ b7 & c27; var sigma0 = (a45 << 30 | a45 >>> 2) ^ (a45 << 19 | a45 >>> 13) ^ (a45 << 10 | a45 >>> 22); var sigma1 = (e56 << 26 | e56 >>> 6) ^ (e56 << 21 | e56 >>> 11) ^ (e56 << 7 | e56 >>> 25); var t1 = h7 + sigma1 + ch + K4[i25] + W3[i25]; var t210 = sigma0 + maj; h7 = g8; g8 = f7; f7 = e56; e56 = d33 + t1 | 0; d33 = c27; c27 = b7; b7 = a45; a45 = t1 + t210 | 0; } H4[0] = H4[0] + a45 | 0; H4[1] = H4[1] + b7 | 0; H4[2] = H4[2] + c27 | 0; H4[3] = H4[3] + d33 | 0; H4[4] = H4[4] + e56 | 0; H4[5] = H4[5] + f7 | 0; H4[6] = H4[6] + g8 | 0; H4[7] = H4[7] + h7 | 0; }, _doFinalize: function() { var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32; dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math2.floor(nBitsTotal / 4294967296); dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; this._process(); return this._hash; }, clone: function() { var clone3 = Hasher.clone.call(this); clone3._hash = this._hash.clone(); return clone3; } }); C5.SHA256 = Hasher._createHelper(SHA256); C5.HmacSHA256 = Hasher._createHmacHelper(SHA256); })(Math); return CryptoJS.SHA256; }); } }); // apps/kost-data-import-de-app/src/environments/environment.ts var environment = { production: true, configRequestUrl: "/config/v2", configRequestMethod: "POST", platform: "Web" }; // node_modules/@angular/core/fesm2022/not_found.mjs var _currentInjector = void 0; function getCurrentInjector() { return _currentInjector; } function setCurrentInjector(injector) { const former = _currentInjector; _currentInjector = injector; return former; } var NOT_FOUND = Symbol("NotFound"); function isNotFound(e56) { return e56 === NOT_FOUND || e56?.name === "\u0275NotFound"; } // node_modules/@angular/core/fesm2022/signal.mjs function defaultEquals(a45, b7) { return Object.is(a45, b7); } var activeConsumer = null; var inNotificationPhase = false; var epoch = 1; var postProducerCreatedFn = null; var SIGNAL = /* @__PURE__ */ Symbol("SIGNAL"); function setActiveConsumer(consumer) { const prev = activeConsumer; activeConsumer = consumer; return prev; } function getActiveConsumer() { return activeConsumer; } function isInNotificationPhase() { return inNotificationPhase; } var REACTIVE_NODE = { version: 0, lastCleanEpoch: 0, dirty: false, producers: void 0, producersTail: void 0, consumers: void 0, consumersTail: void 0, recomputing: false, consumerAllowSignalWrites: false, consumerIsAlwaysLive: false, kind: "unknown", producerMustRecompute: () => false, producerRecomputeValue: () => { }, consumerMarkedDirty: () => { }, consumerOnSignalRead: () => { } }; function producerAccessed(node) { if (inNotificationPhase) { throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""); } if (activeConsumer === null) { return; } activeConsumer.consumerOnSignalRead(node); const prevProducerLink = activeConsumer.producersTail; if (prevProducerLink !== void 0 && prevProducerLink.producer === node) { return; } let nextProducerLink = void 0; const isRecomputing = activeConsumer.recomputing; if (isRecomputing) { nextProducerLink = prevProducerLink !== void 0 ? prevProducerLink.nextProducer : activeConsumer.producers; if (nextProducerLink !== void 0 && nextProducerLink.producer === node) { activeConsumer.producersTail = nextProducerLink; nextProducerLink.lastReadVersion = node.version; return; } } const prevConsumerLink = node.consumersTail; if (prevConsumerLink !== void 0 && prevConsumerLink.consumer === activeConsumer && // However, we have to make sure that the link we've discovered isn't from a node that is incrementally rebuilding its producer list (!isRecomputing || isValidLink(prevConsumerLink, activeConsumer))) { return; } const isLive = consumerIsLive(activeConsumer); const newLink = { producer: node, consumer: activeConsumer, // instead of eagerly destroying the previous link, we delay until we've finished recomputing // the producers list, so that we can destroy all of the old links at once. nextProducer: nextProducerLink, prevConsumer: prevConsumerLink, lastReadVersion: node.version, nextConsumer: void 0 }; activeConsumer.producersTail = newLink; if (prevProducerLink !== void 0) { prevProducerLink.nextProducer = newLink; } else { activeConsumer.producers = newLink; } if (isLive) { producerAddLiveConsumer(node, newLink); } } function producerIncrementEpoch() { epoch++; } function producerUpdateValueVersion(node) { if (consumerIsLive(node) && !node.dirty) { return; } if (!node.dirty && node.lastCleanEpoch === epoch) { return; } if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { producerMarkClean(node); return; } node.producerRecomputeValue(node); producerMarkClean(node); } function producerNotifyConsumers(node) { if (node.consumers === void 0) { return; } const prev = inNotificationPhase; inNotificationPhase = true; try { for (let link = node.consumers; link !== void 0; link = link.nextConsumer) { const consumer = link.consumer; if (!consumer.dirty) { consumerMarkDirty(consumer); } } } finally { inNotificationPhase = prev; } } function producerUpdatesAllowed() { return activeConsumer?.consumerAllowSignalWrites !== false; } function consumerMarkDirty(node) { node.dirty = true; producerNotifyConsumers(node); node.consumerMarkedDirty?.(node); } function producerMarkClean(node) { node.dirty = false; node.lastCleanEpoch = epoch; } function consumerBeforeComputation(node) { if (node) resetConsumerBeforeComputation(node); return setActiveConsumer(node); } function resetConsumerBeforeComputation(node) { node.producersTail = void 0; node.recomputing = true; } function consumerAfterComputation(node, prevConsumer) { setActiveConsumer(prevConsumer); if (node) finalizeConsumerAfterComputation(node); } function finalizeConsumerAfterComputation(node) { node.recomputing = false; const producersTail = node.producersTail; let toRemove = producersTail !== void 0 ? producersTail.nextProducer : node.producers; if (toRemove !== void 0) { if (consumerIsLive(node)) { do { toRemove = producerRemoveLiveConsumerLink(toRemove); } while (toRemove !== void 0); } if (producersTail !== void 0) { producersTail.nextProducer = void 0; } else { node.producers = void 0; } } } function consumerPollProducersForChange(node) { for (let link = node.producers; link !== void 0; link = link.nextProducer) { const producer = link.producer; const seenVersion = link.lastReadVersion; if (seenVersion !== producer.version) { return true; } producerUpdateValueVersion(producer); if (seenVersion !== producer.version) { return true; } } return false; } function consumerDestroy(node) { if (consumerIsLive(node)) { let link = node.producers; while (link !== void 0) { link = producerRemoveLiveConsumerLink(link); } } node.producers = void 0; node.producersTail = void 0; node.consumers = void 0; node.consumersTail = void 0; } function producerAddLiveConsumer(node, link) { const consumersTail = node.consumersTail; const wasLive = consumerIsLive(node); if (consumersTail !== void 0) { link.nextConsumer = consumersTail.nextConsumer; consumersTail.nextConsumer = link; } else { link.nextConsumer = void 0; node.consumers = link; } link.prevConsumer = consumersTail; node.consumersTail = link; if (!wasLive) { for (let link2 = node.producers; link2 !== void 0; link2 = link2.nextProducer) { producerAddLiveConsumer(link2.producer, link2); } } } function producerRemoveLiveConsumerLink(link) { const producer = link.producer; const nextProducer = link.nextProducer; const nextConsumer = link.nextConsumer; const prevConsumer = link.prevConsumer; link.nextConsumer = void 0; link.prevConsumer = void 0; if (nextConsumer !== void 0) { nextConsumer.prevConsumer = prevConsumer; } else { producer.consumersTail = prevConsumer; } if (prevConsumer !== void 0) { prevConsumer.nextConsumer = nextConsumer; } else { producer.consumers = nextConsumer; if (!consumerIsLive(producer)) { let producerLink = producer.producers; while (producerLink !== void 0) { producerLink = producerRemoveLiveConsumerLink(producerLink); } } } return nextProducer; } function consumerIsLive(node) { return node.consumerIsAlwaysLive || node.consumers !== void 0; } function runPostProducerCreatedFn(node) { postProducerCreatedFn?.(node); } function isValidLink(checkLink, consumer) { const producersTail = consumer.producersTail; if (producersTail !== void 0) { let link = consumer.producers; do { if (link === checkLink) { return true; } if (link === producersTail) { break; } link = link.nextProducer; } while (link !== void 0); } return false; } function createComputed(computation, equal) { const node = Object.create(COMPUTED_NODE); node.computation = computation; if (equal !== void 0) { node.equal = equal; } const computed2 = () => { producerUpdateValueVersion(node); producerAccessed(node); if (node.value === ERRORED) { throw node.error; } return node.value; }; computed2[SIGNAL] = node; if (typeof ngDevMode !== "undefined" && ngDevMode) { const debugName = node.debugName ? " (" + node.debugName + ")" : ""; computed2.toString = () => `[Computed${debugName}: ${node.value}]`; } runPostProducerCreatedFn(node); return computed2; } var UNSET = /* @__PURE__ */ Symbol("UNSET"); var COMPUTING = /* @__PURE__ */ Symbol("COMPUTING"); var ERRORED = /* @__PURE__ */ Symbol("ERRORED"); var COMPUTED_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, REACTIVE_NODE), { value: UNSET, dirty: true, error: null, equal: defaultEquals, kind: "computed", producerMustRecompute(node) { return node.value === UNSET || node.value === COMPUTING; }, producerRecomputeValue(node) { if (node.value === COMPUTING) { throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Detected cycle in computations." : ""); } const oldValue = node.value; node.value = COMPUTING; const prevConsumer = consumerBeforeComputation(node); let newValue; let wasEqual = false; try { newValue = node.computation(); setActiveConsumer(null); wasEqual = oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue); } catch (err) { newValue = ERRORED; node.error = err; } finally { consumerAfterComputation(node, prevConsumer); } if (wasEqual) { node.value = oldValue; return; } node.value = newValue; node.version++; } }); })(); function defaultThrowError() { throw new Error(); } var throwInvalidWriteToSignalErrorFn = defaultThrowError; function throwInvalidWriteToSignalError(node) { throwInvalidWriteToSignalErrorFn(node); } function setThrowInvalidWriteToSignalError(fn) { throwInvalidWriteToSignalErrorFn = fn; } var postSignalSetFn = null; function createSignal(initialValue, equal) { const node = Object.create(SIGNAL_NODE); node.value = initialValue; if (equal !== void 0) { node.equal = equal; } const getter = (() => signalGetFn(node)); getter[SIGNAL] = node; if (typeof ngDevMode !== "undefined" && ngDevMode) { const debugName = node.debugName ? " (" + node.debugName + ")" : ""; getter.toString = () => `[Signal${debugName}: ${node.value}]`; } runPostProducerCreatedFn(node); const set2 = (newValue) => signalSetFn(node, newValue); const update = (updateFn) => signalUpdateFn(node, updateFn); return [getter, set2, update]; } function signalGetFn(node) { producerAccessed(node); return node.value; } function signalSetFn(node, newValue) { if (!producerUpdatesAllowed()) { throwInvalidWriteToSignalError(node); } if (!node.equal(node.value, newValue)) { node.value = newValue; signalValueChanged(node); } } function signalUpdateFn(node, updater) { if (!producerUpdatesAllowed()) { throwInvalidWriteToSignalError(node); } signalSetFn(node, updater(node.value)); } var SIGNAL_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, REACTIVE_NODE), { equal: defaultEquals, value: void 0, kind: "signal" }); })(); function signalValueChanged(node) { node.version++; producerIncrementEpoch(); producerNotifyConsumers(node); postSignalSetFn?.(node); } // node_modules/rxjs/dist/esm/internal/util/isFunction.js function isFunction(value) { return typeof value === "function"; } // node_modules/rxjs/dist/esm/internal/util/createErrorClass.js function createErrorClass(createImpl) { const _super = (instance) => { Error.call(instance); instance.stack = new Error().stack; }; const ctorFunc = createImpl(_super); ctorFunc.prototype = Object.create(Error.prototype); ctorFunc.prototype.constructor = ctorFunc; return ctorFunc; } // node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js var UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) { _super(this); this.message = errors ? `${errors.length} errors occurred during unsubscription: ${errors.map((err, i25) => `${i25 + 1}) ${err.toString()}`).join("\n ")}` : ""; this.name = "UnsubscriptionError"; this.errors = errors; }); // node_modules/rxjs/dist/esm/internal/util/arrRemove.js function arrRemove(arr, item) { if (arr) { const index = arr.indexOf(item); 0 <= index && arr.splice(index, 1); } } // node_modules/rxjs/dist/esm/internal/Subscription.js var Subscription = class _Subscription { constructor(initialTeardown) { this.initialTeardown = initialTeardown; this.closed = false; this._parentage = null; this._finalizers = null; } unsubscribe() { let errors; if (!this.closed) { this.closed = true; const { _parentage } = this; if (_parentage) { this._parentage = null; if (Array.isArray(_parentage)) { for (const parent2 of _parentage) { parent2.remove(this); } } else { _parentage.remove(this); } } const { initialTeardown: initialFinalizer } = this; if (isFunction(initialFinalizer)) { try { initialFinalizer(); } catch (e56) { errors = e56 instanceof UnsubscriptionError ? e56.errors : [e56]; } } const { _finalizers } = this; if (_finalizers) { this._finalizers = null; for (const finalizer of _finalizers) { try { execFinalizer(finalizer); } catch (err) { errors = errors !== null && errors !== void 0 ? errors : []; if (err instanceof UnsubscriptionError) { errors = [...errors, ...err.errors]; } else { errors.push(err); } } } } if (errors) { throw new UnsubscriptionError(errors); } } } add(teardown) { var _a12; if (teardown && teardown !== this) { if (this.closed) { execFinalizer(teardown); } else { if (teardown instanceof _Subscription) { if (teardown.closed || teardown._hasParent(this)) { return; } teardown._addParent(this); } (this._finalizers = (_a12 = this._finalizers) !== null && _a12 !== void 0 ? _a12 : []).push(teardown); } } } _hasParent(parent2) { const { _parentage } = this; return _parentage === parent2 || Array.isArray(_parentage) && _parentage.includes(parent2); } _addParent(parent2) { const { _parentage } = this; this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent2), _parentage) : _parentage ? [_parentage, parent2] : parent2; } _removeParent(parent2) { const { _parentage } = this; if (_parentage === parent2) { this._parentage = null; } else if (Array.isArray(_parentage)) { arrRemove(_parentage, parent2); } } remove(teardown) { const { _finalizers } = this; _finalizers && arrRemove(_finalizers, teardown); if (teardown instanceof _Subscription) { teardown._removeParent(this); } } }; Subscription.EMPTY = (() => { const empty = new Subscription(); empty.closed = true; return empty; })(); var EMPTY_SUBSCRIPTION = Subscription.EMPTY; function isSubscription(value) { return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe); } function execFinalizer(finalizer) { if (isFunction(finalizer)) { finalizer(); } else { finalizer.unsubscribe(); } } // node_modules/rxjs/dist/esm/internal/config.js var config = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: false, useDeprecatedNextContext: false }; // node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js var timeoutProvider = { setTimeout(handler, timeout, ...args) { const { delegate } = timeoutProvider; if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) { return delegate.setTimeout(handler, timeout, ...args); } return setTimeout(handler, timeout, ...args); }, clearTimeout(handle) { const { delegate } = timeoutProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js function reportUnhandledError(err) { timeoutProvider.setTimeout(() => { const { onUnhandledError } = config; if (onUnhandledError) { onUnhandledError(err); } else { throw err; } }); } // node_modules/rxjs/dist/esm/internal/util/noop.js function noop() { } // node_modules/rxjs/dist/esm/internal/NotificationFactories.js var COMPLETE_NOTIFICATION = (() => createNotification("C", void 0, void 0))(); function errorNotification(error) { return createNotification("E", void 0, error); } function nextNotification(value) { return createNotification("N", value, void 0); } function createNotification(kind, value, error) { return { kind, value, error }; } // node_modules/rxjs/dist/esm/internal/util/errorContext.js var context = null; function errorContext(cb) { if (config.useDeprecatedSynchronousErrorHandling) { const isRoot = !context; if (isRoot) { context = { errorThrown: false, error: null }; } cb(); if (isRoot) { const { errorThrown, error } = context; context = null; if (errorThrown) { throw error; } } } else { cb(); } } function captureError(err) { if (config.useDeprecatedSynchronousErrorHandling && context) { context.errorThrown = true; context.error = err; } } // node_modules/rxjs/dist/esm/internal/Subscriber.js var Subscriber = class extends Subscription { constructor(destination2) { super(); this.isStopped = false; if (destination2) { this.destination = destination2; if (isSubscription(destination2)) { destination2.add(this); } } else { this.destination = EMPTY_OBSERVER; } } static create(next, error, complete) { return new SafeSubscriber(next, error, complete); } next(value) { if (this.isStopped) { handleStoppedNotification(nextNotification(value), this); } else { this._next(value); } } error(err) { if (this.isStopped) { handleStoppedNotification(errorNotification(err), this); } else { this.isStopped = true; this._error(err); } } complete() { if (this.isStopped) { handleStoppedNotification(COMPLETE_NOTIFICATION, this); } else { this.isStopped = true; this._complete(); } } unsubscribe() { if (!this.closed) { this.isStopped = true; super.unsubscribe(); this.destination = null; } } _next(value) { this.destination.next(value); } _error(err) { try { this.destination.error(err); } finally { this.unsubscribe(); } } _complete() { try { this.destination.complete(); } finally { this.unsubscribe(); } } }; var _bind = Function.prototype.bind; function bind(fn, thisArg) { return _bind.call(fn, thisArg); } var ConsumerObserver = class { constructor(partialObserver) { this.partialObserver = partialObserver; } next(value) { const { partialObserver } = this; if (partialObserver.next) { try { partialObserver.next(value); } catch (error) { handleUnhandledError(error); } } } error(err) { const { partialObserver } = this; if (partialObserver.error) { try { partialObserver.error(err); } catch (error) { handleUnhandledError(error); } } else { handleUnhandledError(err); } } complete() { const { partialObserver } = this; if (partialObserver.complete) { try { partialObserver.complete(); } catch (error) { handleUnhandledError(error); } } } }; var SafeSubscriber = class extends Subscriber { constructor(observerOrNext, error, complete) { super(); let partialObserver; if (isFunction(observerOrNext) || !observerOrNext) { partialObserver = { next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, error: error !== null && error !== void 0 ? error : void 0, complete: complete !== null && complete !== void 0 ? complete : void 0 }; } else { let context2; if (this && config.useDeprecatedNextContext) { context2 = Object.create(observerOrNext); context2.unsubscribe = () => this.unsubscribe(); partialObserver = { next: observerOrNext.next && bind(observerOrNext.next, context2), error: observerOrNext.error && bind(observerOrNext.error, context2), complete: observerOrNext.complete && bind(observerOrNext.complete, context2) }; } else { partialObserver = observerOrNext; } } this.destination = new ConsumerObserver(partialObserver); } }; function handleUnhandledError(error) { if (config.useDeprecatedSynchronousErrorHandling) { captureError(error); } else { reportUnhandledError(error); } } function defaultErrorHandler(err) { throw err; } function handleStoppedNotification(notification, subscriber) { const { onStoppedNotification } = config; onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber)); } var EMPTY_OBSERVER = { closed: true, next: noop, error: defaultErrorHandler, complete: noop }; // node_modules/rxjs/dist/esm/internal/symbol/observable.js var observable = (() => typeof Symbol === "function" && Symbol.observable || "@@observable")(); // node_modules/rxjs/dist/esm/internal/util/identity.js function identity(x3) { return x3; } // node_modules/rxjs/dist/esm/internal/util/pipe.js function pipe(...fns) { return pipeFromArray(fns); } function pipeFromArray(fns) { if (fns.length === 0) { return identity; } if (fns.length === 1) { return fns[0]; } return function piped(input2) { return fns.reduce((prev, fn) => fn(prev), input2); }; } // node_modules/rxjs/dist/esm/internal/Observable.js var Observable = class _Observable { constructor(subscribe) { if (subscribe) { this._subscribe = subscribe; } } lift(operator) { const observable2 = new _Observable(); observable2.source = this; observable2.operator = operator; return observable2; } subscribe(observerOrNext, error, complete) { const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); errorContext(() => { const { operator, source } = this; subscriber.add(operator ? operator.call(subscriber, source) : source ? this._subscribe(subscriber) : this._trySubscribe(subscriber)); }); return subscriber; } _trySubscribe(sink) { try { return this._subscribe(sink); } catch (err) { sink.error(err); } } forEach(next, promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve2, reject) => { const subscriber = new SafeSubscriber({ next: (value) => { try { next(value); } catch (err) { reject(err); subscriber.unsubscribe(); } }, error: reject, complete: resolve2 }); this.subscribe(subscriber); }); } _subscribe(subscriber) { var _a12; return (_a12 = this.source) === null || _a12 === void 0 ? void 0 : _a12.subscribe(subscriber); } [observable]() { return this; } pipe(...operations) { return pipeFromArray(operations)(this); } toPromise(promiseCtor) { promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor((resolve2, reject) => { let value; this.subscribe((x3) => value = x3, (err) => reject(err), () => resolve2(value)); }); } }; Observable.create = (subscribe) => { return new Observable(subscribe); }; function getPromiseCtor(promiseCtor) { var _a12; return (_a12 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a12 !== void 0 ? _a12 : Promise; } function isObserver(value) { return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); } function isSubscriber(value) { return value && value instanceof Subscriber || isObserver(value) && isSubscription(value); } // node_modules/rxjs/dist/esm/internal/util/lift.js function hasLift(source) { return isFunction(source === null || source === void 0 ? void 0 : source.lift); } function operate(init2) { return (source) => { if (hasLift(source)) { return source.lift(function(liftedSource) { try { return init2(liftedSource, this); } catch (err) { this.error(err); } }); } throw new TypeError("Unable to lift unknown Observable type"); }; } // node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js function createOperatorSubscriber(destination2, onNext, onComplete, onError, onFinalize) { return new OperatorSubscriber(destination2, onNext, onComplete, onError, onFinalize); } var OperatorSubscriber = class extends Subscriber { constructor(destination2, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { super(destination2); this.onFinalize = onFinalize; this.shouldUnsubscribe = shouldUnsubscribe; this._next = onNext ? function(value) { try { onNext(value); } catch (err) { destination2.error(err); } } : super._next; this._error = onError ? function(err) { try { onError(err); } catch (err2) { destination2.error(err2); } finally { this.unsubscribe(); } } : super._error; this._complete = onComplete ? function() { try { onComplete(); } catch (err) { destination2.error(err); } finally { this.unsubscribe(); } } : super._complete; } unsubscribe() { var _a12; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { const { closed } = this; super.unsubscribe(); !closed && ((_a12 = this.onFinalize) === null || _a12 === void 0 ? void 0 : _a12.call(this)); } } }; // node_modules/rxjs/dist/esm/internal/operators/refCount.js function refCount() { return operate((source, subscriber) => { let connection = null; source._refCount++; const refCounter = createOperatorSubscriber(subscriber, void 0, void 0, void 0, () => { if (!source || source._refCount <= 0 || 0 < --source._refCount) { connection = null; return; } const sharedConnection = source._connection; const conn = connection; connection = null; if (sharedConnection && (!conn || sharedConnection === conn)) { sharedConnection.unsubscribe(); } subscriber.unsubscribe(); }); source.subscribe(refCounter); if (!refCounter.closed) { connection = source.connect(); } }); } // node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js var ConnectableObservable = class extends Observable { constructor(source, subjectFactory) { super(); this.source = source; this.subjectFactory = subjectFactory; this._subject = null; this._refCount = 0; this._connection = null; if (hasLift(source)) { this.lift = source.lift; } } _subscribe(subscriber) { return this.getSubject().subscribe(subscriber); } getSubject() { const subject = this._subject; if (!subject || subject.isStopped) { this._subject = this.subjectFactory(); } return this._subject; } _teardown() { this._refCount = 0; const { _connection } = this; this._subject = this._connection = null; _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe(); } connect() { let connection = this._connection; if (!connection) { connection = this._connection = new Subscription(); const subject = this.getSubject(); connection.add(this.source.subscribe(createOperatorSubscriber(subject, void 0, () => { this._teardown(); subject.complete(); }, (err) => { this._teardown(); subject.error(err); }, () => this._teardown()))); if (connection.closed) { this._connection = null; connection = Subscription.EMPTY; } } return connection; } refCount() { return refCount()(this); } }; // node_modules/rxjs/dist/esm/internal/scheduler/animationFrameProvider.js var animationFrameProvider = { schedule(callback2) { let request = requestAnimationFrame; let cancel = cancelAnimationFrame; const { delegate } = animationFrameProvider; if (delegate) { request = delegate.requestAnimationFrame; cancel = delegate.cancelAnimationFrame; } const handle = request((timestamp) => { cancel = void 0; callback2(timestamp); }); return new Subscription(() => cancel === null || cancel === void 0 ? void 0 : cancel(handle)); }, requestAnimationFrame(...args) { const { delegate } = animationFrameProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame)(...args); }, cancelAnimationFrame(...args) { const { delegate } = animationFrameProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame)(...args); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js var ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() { _super(this); this.name = "ObjectUnsubscribedError"; this.message = "object unsubscribed"; }); // node_modules/rxjs/dist/esm/internal/Subject.js var Subject = class extends Observable { constructor() { super(); this.closed = false; this.currentObservers = null; this.observers = []; this.isStopped = false; this.hasError = false; this.thrownError = null; } lift(operator) { const subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; } _throwIfClosed() { if (this.closed) { throw new ObjectUnsubscribedError(); } } next(value) { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { if (!this.currentObservers) { this.currentObservers = Array.from(this.observers); } for (const observer of this.currentObservers) { observer.next(value); } } }); } error(err) { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { this.hasError = this.isStopped = true; this.thrownError = err; const { observers } = this; while (observers.length) { observers.shift().error(err); } } }); } complete() { errorContext(() => { this._throwIfClosed(); if (!this.isStopped) { this.isStopped = true; const { observers } = this; while (observers.length) { observers.shift().complete(); } } }); } unsubscribe() { this.isStopped = this.closed = true; this.observers = this.currentObservers = null; } get observed() { var _a12; return ((_a12 = this.observers) === null || _a12 === void 0 ? void 0 : _a12.length) > 0; } _trySubscribe(subscriber) { this._throwIfClosed(); return super._trySubscribe(subscriber); } _subscribe(subscriber) { this._throwIfClosed(); this._checkFinalizedStatuses(subscriber); return this._innerSubscribe(subscriber); } _innerSubscribe(subscriber) { const { hasError, isStopped, observers } = this; if (hasError || isStopped) { return EMPTY_SUBSCRIPTION; } this.currentObservers = null; observers.push(subscriber); return new Subscription(() => { this.currentObservers = null; arrRemove(observers, subscriber); }); } _checkFinalizedStatuses(subscriber) { const { hasError, thrownError, isStopped } = this; if (hasError) { subscriber.error(thrownError); } else if (isStopped) { subscriber.complete(); } } asObservable() { const observable2 = new Observable(); observable2.source = this; return observable2; } }; Subject.create = (destination2, source) => { return new AnonymousSubject(destination2, source); }; var AnonymousSubject = class extends Subject { constructor(destination2, source) { super(); this.destination = destination2; this.source = source; } next(value) { var _a12, _b4; (_b4 = (_a12 = this.destination) === null || _a12 === void 0 ? void 0 : _a12.next) === null || _b4 === void 0 ? void 0 : _b4.call(_a12, value); } error(err) { var _a12, _b4; (_b4 = (_a12 = this.destination) === null || _a12 === void 0 ? void 0 : _a12.error) === null || _b4 === void 0 ? void 0 : _b4.call(_a12, err); } complete() { var _a12, _b4; (_b4 = (_a12 = this.destination) === null || _a12 === void 0 ? void 0 : _a12.complete) === null || _b4 === void 0 ? void 0 : _b4.call(_a12); } _subscribe(subscriber) { var _a12, _b4; return (_b4 = (_a12 = this.source) === null || _a12 === void 0 ? void 0 : _a12.subscribe(subscriber)) !== null && _b4 !== void 0 ? _b4 : EMPTY_SUBSCRIPTION; } }; // node_modules/rxjs/dist/esm/internal/BehaviorSubject.js var BehaviorSubject = class extends Subject { constructor(_value) { super(); this._value = _value; } get value() { return this.getValue(); } _subscribe(subscriber) { const subscription = super._subscribe(subscriber); !subscription.closed && subscriber.next(this._value); return subscription; } getValue() { const { hasError, thrownError, _value } = this; if (hasError) { throw thrownError; } this._throwIfClosed(); return _value; } next(value) { super.next(this._value = value); } }; // node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js var dateTimestampProvider = { now() { return (dateTimestampProvider.delegate || Date).now(); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/ReplaySubject.js var ReplaySubject = class extends Subject { constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) { super(); this._bufferSize = _bufferSize; this._windowTime = _windowTime; this._timestampProvider = _timestampProvider; this._buffer = []; this._infiniteTimeWindow = true; this._infiniteTimeWindow = _windowTime === Infinity; this._bufferSize = Math.max(1, _bufferSize); this._windowTime = Math.max(1, _windowTime); } next(value) { const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this; if (!isStopped) { _buffer.push(value); !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime); } this._trimBuffer(); super.next(value); } _subscribe(subscriber) { this._throwIfClosed(); this._trimBuffer(); const subscription = this._innerSubscribe(subscriber); const { _infiniteTimeWindow, _buffer } = this; const copy = _buffer.slice(); for (let i25 = 0; i25 < copy.length && !subscriber.closed; i25 += _infiniteTimeWindow ? 1 : 2) { subscriber.next(copy[i25]); } this._checkFinalizedStatuses(subscriber); return subscription; } _trimBuffer() { const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this; const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize; _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize); if (!_infiniteTimeWindow) { const now = _timestampProvider.now(); let last5 = 0; for (let i25 = 1; i25 < _buffer.length && _buffer[i25] <= now; i25 += 2) { last5 = i25; } last5 && _buffer.splice(0, last5 + 1); } } }; // node_modules/rxjs/dist/esm/internal/AsyncSubject.js var AsyncSubject = class extends Subject { constructor() { super(...arguments); this._value = null; this._hasValue = false; this._isComplete = false; } _checkFinalizedStatuses(subscriber) { const { hasError, _hasValue, _value, thrownError, isStopped, _isComplete } = this; if (hasError) { subscriber.error(thrownError); } else if (isStopped || _isComplete) { _hasValue && subscriber.next(_value); subscriber.complete(); } } next(value) { if (!this.isStopped) { this._value = value; this._hasValue = true; } } complete() { const { _hasValue, _value, _isComplete } = this; if (!_isComplete) { this._isComplete = true; _hasValue && super.next(_value); super.complete(); } } }; // node_modules/rxjs/dist/esm/internal/scheduler/Action.js var Action = class extends Subscription { constructor(scheduler, work) { super(); } schedule(state2, delay3 = 0) { return this; } }; // node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js var intervalProvider = { setInterval(handler, timeout, ...args) { const { delegate } = intervalProvider; if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) { return delegate.setInterval(handler, timeout, ...args); } return setInterval(handler, timeout, ...args); }, clearInterval(handle) { const { delegate } = intervalProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js var AsyncAction = class extends Action { constructor(scheduler, work) { super(scheduler, work); this.scheduler = scheduler; this.work = work; this.pending = false; } schedule(state2, delay3 = 0) { var _a12; if (this.closed) { return this; } this.state = state2; const id = this.id; const scheduler = this.scheduler; if (id != null) { this.id = this.recycleAsyncId(scheduler, id, delay3); } this.pending = true; this.delay = delay3; this.id = (_a12 = this.id) !== null && _a12 !== void 0 ? _a12 : this.requestAsyncId(scheduler, this.id, delay3); return this; } requestAsyncId(scheduler, _id2, delay3 = 0) { return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay3); } recycleAsyncId(_scheduler, id, delay3 = 0) { if (delay3 != null && this.delay === delay3 && this.pending === false) { return id; } if (id != null) { intervalProvider.clearInterval(id); } return void 0; } execute(state2, delay3) { if (this.closed) { return new Error("executing a cancelled action"); } this.pending = false; const error = this._execute(state2, delay3); if (error) { return error; } else if (this.pending === false && this.id != null) { this.id = this.recycleAsyncId(this.scheduler, this.id, null); } } _execute(state2, _delay) { let errored = false; let errorValue; try { this.work(state2); } catch (e56) { errored = true; errorValue = e56 ? e56 : new Error("Scheduled action threw falsy error"); } if (errored) { this.unsubscribe(); return errorValue; } } unsubscribe() { if (!this.closed) { const { id, scheduler } = this; const { actions } = scheduler; this.work = this.state = this.scheduler = null; this.pending = false; arrRemove(actions, this); if (id != null) { this.id = this.recycleAsyncId(scheduler, id, null); } this.delay = null; super.unsubscribe(); } } }; // node_modules/rxjs/dist/esm/internal/util/Immediate.js var nextHandle = 1; var resolved; var activeHandles = {}; function findAndClearHandle(handle) { if (handle in activeHandles) { delete activeHandles[handle]; return true; } return false; } var Immediate = { setImmediate(cb) { const handle = nextHandle++; activeHandles[handle] = true; if (!resolved) { resolved = Promise.resolve(); } resolved.then(() => findAndClearHandle(handle) && cb()); return handle; }, clearImmediate(handle) { findAndClearHandle(handle); } }; // node_modules/rxjs/dist/esm/internal/scheduler/immediateProvider.js var { setImmediate: setImmediate2, clearImmediate } = Immediate; var immediateProvider = { setImmediate(...args) { const { delegate } = immediateProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate2)(...args); }, clearImmediate(handle) { const { delegate } = immediateProvider; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle); }, delegate: void 0 }; // node_modules/rxjs/dist/esm/internal/scheduler/AsapAction.js var AsapAction = class extends AsyncAction { constructor(scheduler, work) { super(scheduler, work); this.scheduler = scheduler; this.work = work; } requestAsyncId(scheduler, id, delay3 = 0) { if (delay3 !== null && delay3 > 0) { return super.requestAsyncId(scheduler, id, delay3); } scheduler.actions.push(this); return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, void 0))); } recycleAsyncId(scheduler, id, delay3 = 0) { var _a12; if (delay3 != null ? delay3 > 0 : this.delay > 0) { return super.recycleAsyncId(scheduler, id, delay3); } const { actions } = scheduler; if (id != null && ((_a12 = actions[actions.length - 1]) === null || _a12 === void 0 ? void 0 : _a12.id) !== id) { immediateProvider.clearImmediate(id); if (scheduler._scheduled === id) { scheduler._scheduled = void 0; } } return void 0; } }; // node_modules/rxjs/dist/esm/internal/Scheduler.js var Scheduler = class _Scheduler { constructor(schedulerActionCtor, now = _Scheduler.now) { this.schedulerActionCtor = schedulerActionCtor; this.now = now; } schedule(work, delay3 = 0, state2) { return new this.schedulerActionCtor(this, work).schedule(state2, delay3); } }; Scheduler.now = dateTimestampProvider.now; // node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js var AsyncScheduler = class extends Scheduler { constructor(SchedulerAction, now = Scheduler.now) { super(SchedulerAction, now); this.actions = []; this._active = false; } flush(action) { const { actions } = this; if (this._active) { actions.push(action); return; } let error; this._active = true; do { if (error = action.execute(action.state, action.delay)) { break; } } while (action = actions.shift()); this._active = false; if (error) { while (action = actions.shift()) { action.unsubscribe(); } throw error; } } }; // node_modules/rxjs/dist/esm/internal/scheduler/AsapScheduler.js var AsapScheduler = class extends AsyncScheduler { flush(action) { this._active = true; const flushId = this._scheduled; this._scheduled = void 0; const { actions } = this; let error; action = action || actions.shift(); do { if (error = action.execute(action.state, action.delay)) { break; } } while ((action = actions[0]) && action.id === flushId && actions.shift()); this._active = false; if (error) { while ((action = actions[0]) && action.id === flushId && actions.shift()) { action.unsubscribe(); } throw error; } } }; // node_modules/rxjs/dist/esm/internal/scheduler/asap.js var asapScheduler = new AsapScheduler(AsapAction); // node_modules/rxjs/dist/esm/internal/scheduler/async.js var asyncScheduler = new AsyncScheduler(AsyncAction); var async = asyncScheduler; // node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js var AnimationFrameAction = class extends AsyncAction { constructor(scheduler, work) { super(scheduler, work); this.scheduler = scheduler; this.work = work; } requestAsyncId(scheduler, id, delay3 = 0) { if (delay3 !== null && delay3 > 0) { return super.requestAsyncId(scheduler, id, delay3); } scheduler.actions.push(this); return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(void 0))); } recycleAsyncId(scheduler, id, delay3 = 0) { var _a12; if (delay3 != null ? delay3 > 0 : this.delay > 0) { return super.recycleAsyncId(scheduler, id, delay3); } const { actions } = scheduler; if (id != null && id === scheduler._scheduled && ((_a12 = actions[actions.length - 1]) === null || _a12 === void 0 ? void 0 : _a12.id) !== id) { animationFrameProvider.cancelAnimationFrame(id); scheduler._scheduled = void 0; } return void 0; } }; // node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameScheduler.js var AnimationFrameScheduler = class extends AsyncScheduler { flush(action) { this._active = true; let flushId; if (action) { flushId = action.id; } else { flushId = this._scheduled; this._scheduled = void 0; } const { actions } = this; let error; action = action || actions.shift(); do { if (error = action.execute(action.state, action.delay)) { break; } } while ((action = actions[0]) && action.id === flushId && actions.shift()); this._active = false; if (error) { while ((action = actions[0]) && action.id === flushId && actions.shift()) { action.unsubscribe(); } throw error; } } }; // node_modules/rxjs/dist/esm/internal/scheduler/animationFrame.js var animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction); // node_modules/rxjs/dist/esm/internal/observable/empty.js var EMPTY = new Observable((subscriber) => subscriber.complete()); // node_modules/rxjs/dist/esm/internal/util/isScheduler.js function isScheduler(value) { return value && isFunction(value.schedule); } // node_modules/rxjs/dist/esm/internal/util/args.js function last(arr) { return arr[arr.length - 1]; } function popResultSelector(args) { return isFunction(last(args)) ? args.pop() : void 0; } function popScheduler(args) { return isScheduler(last(args)) ? args.pop() : void 0; } function popNumber(args, defaultValue) { return typeof last(args) === "number" ? args.pop() : defaultValue; } // node_modules/tslib/tslib.es6.mjs function __awaiter(thisArg, _arguments, P3, generator) { function adopt(value) { return value instanceof P3 ? value : new P3(function(resolve2) { resolve2(value); }); } return new (P3 || (P3 = Promise))(function(resolve2, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e56) { reject(e56); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e56) { reject(e56); } } function step(result) { result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __values(o87) { var s17 = typeof Symbol === "function" && Symbol.iterator, m5 = s17 && o87[s17], i25 = 0; if (m5) return m5.call(o87); if (o87 && typeof o87.length === "number") return { next: function() { if (o87 && i25 >= o87.length) o87 = void 0; return { value: o87 && o87[i25++], done: !o87 }; } }; throw new TypeError(s17 ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __await(v7) { return this instanceof __await ? (this.v = v7, this) : new __await(v7); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g8 = generator.apply(thisArg, _arguments || []), i25, q2 = []; return i25 = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i25[Symbol.asyncIterator] = function() { return this; }, i25; function awaitReturn(f7) { return function(v7) { return Promise.resolve(v7).then(f7, reject); }; } function verb(n44, f7) { if (g8[n44]) { i25[n44] = function(v7) { return new Promise(function(a45, b7) { q2.push([n44, v7, a45, b7]) > 1 || resume(n44, v7); }); }; if (f7) i25[n44] = f7(i25[n44]); } } function resume(n44, v7) { try { step(g8[n44](v7)); } catch (e56) { settle(q2[0][3], e56); } } function step(r85) { r85.value instanceof __await ? Promise.resolve(r85.value.v).then(fulfill, reject) : settle(q2[0][2], r85); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f7, v7) { if (f7(v7), q2.shift(), q2.length) resume(q2[0][0], q2[0][1]); } } function __asyncValues(o87) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m5 = o87[Symbol.asyncIterator], i25; return m5 ? m5.call(o87) : (o87 = typeof __values === "function" ? __values(o87) : o87[Symbol.iterator](), i25 = {}, verb("next"), verb("throw"), verb("return"), i25[Symbol.asyncIterator] = function() { return this; }, i25); function verb(n44) { i25[n44] = o87[n44] && function(v7) { return new Promise(function(resolve2, reject) { v7 = o87[n44](v7), settle(resolve2, reject, v7.done, v7.value); }); }; } function settle(resolve2, reject, d33, v7) { Promise.resolve(v7).then(function(v8) { resolve2({ value: v8, done: d33 }); }, reject); } } // node_modules/rxjs/dist/esm/internal/util/isArrayLike.js var isArrayLike = ((x3) => x3 && typeof x3.length === "number" && typeof x3 !== "function"); // node_modules/rxjs/dist/esm/internal/util/isPromise.js function isPromise(value) { return isFunction(value === null || value === void 0 ? void 0 : value.then); } // node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js function isInteropObservable(input2) { return isFunction(input2[observable]); } // node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js function isAsyncIterable(obj) { return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]); } // node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js function createInvalidObservableTypeError(input2) { return new TypeError(`You provided ${input2 !== null && typeof input2 === "object" ? "an invalid object" : `'${input2}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`); } // node_modules/rxjs/dist/esm/internal/symbol/iterator.js function getSymbolIterator() { if (typeof Symbol !== "function" || !Symbol.iterator) { return "@@iterator"; } return Symbol.iterator; } var iterator = getSymbolIterator(); // node_modules/rxjs/dist/esm/internal/util/isIterable.js function isIterable(input2) { return isFunction(input2 === null || input2 === void 0 ? void 0 : input2[iterator]); } // node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js function readableStreamLikeToAsyncGenerator(readableStream) { return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() { const reader = readableStream.getReader(); try { while (true) { const { value, done } = yield __await(reader.read()); if (done) { return yield __await(void 0); } yield yield __await(value); } } finally { reader.releaseLock(); } }); } function isReadableStreamLike(obj) { return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); } // node_modules/rxjs/dist/esm/internal/observable/innerFrom.js function innerFrom(input2) { if (input2 instanceof Observable) { return input2; } if (input2 != null) { if (isInteropObservable(input2)) { return fromInteropObservable(input2); } if (isArrayLike(input2)) { return fromArrayLike(input2); } if (isPromise(input2)) { return fromPromise(input2); } if (isAsyncIterable(input2)) { return fromAsyncIterable(input2); } if (isIterable(input2)) { return fromIterable(input2); } if (isReadableStreamLike(input2)) { return fromReadableStreamLike(input2); } } throw createInvalidObservableTypeError(input2); } function fromInteropObservable(obj) { return new Observable((subscriber) => { const obs = obj[observable](); if (isFunction(obs.subscribe)) { return obs.subscribe(subscriber); } throw new TypeError("Provided object does not correctly implement Symbol.observable"); }); } function fromArrayLike(array) { return new Observable((subscriber) => { for (let i25 = 0; i25 < array.length && !subscriber.closed; i25++) { subscriber.next(array[i25]); } subscriber.complete(); }); } function fromPromise(promise) { return new Observable((subscriber) => { promise.then((value) => { if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } }, (err) => subscriber.error(err)).then(null, reportUnhandledError); }); } function fromIterable(iterable) { return new Observable((subscriber) => { for (const value of iterable) { subscriber.next(value); if (subscriber.closed) { return; } } subscriber.complete(); }); } function fromAsyncIterable(asyncIterable) { return new Observable((subscriber) => { process2(asyncIterable, subscriber).catch((err) => subscriber.error(err)); }); } function fromReadableStreamLike(readableStream) { return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream)); } function process2(asyncIterable, subscriber) { var asyncIterable_1, asyncIterable_1_1; var e_1, _a12; return __awaiter(this, void 0, void 0, function* () { try { for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done; ) { const value = asyncIterable_1_1.value; subscriber.next(value); if (subscriber.closed) { return; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a12 = asyncIterable_1.return)) yield _a12.call(asyncIterable_1); } finally { if (e_1) throw e_1.error; } } subscriber.complete(); }); } // node_modules/rxjs/dist/esm/internal/util/executeSchedule.js function executeSchedule(parentSubscription, scheduler, work, delay3 = 0, repeat2 = false) { const scheduleSubscription = scheduler.schedule(function() { work(); if (repeat2) { parentSubscription.add(this.schedule(null, delay3)); } else { this.unsubscribe(); } }, delay3); parentSubscription.add(scheduleSubscription); if (!repeat2) { return scheduleSubscription; } } // node_modules/rxjs/dist/esm/internal/operators/observeOn.js function observeOn(scheduler, delay3 = 0) { return operate((source, subscriber) => { source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay3), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay3), (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay3))); }); } // node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js function subscribeOn(scheduler, delay3 = 0) { return operate((source, subscriber) => { subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay3)); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js function scheduleObservable(input2, scheduler) { return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler)); } // node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js function schedulePromise(input2, scheduler) { return innerFrom(input2).pipe(subscribeOn(scheduler), observeOn(scheduler)); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js function scheduleArray(input2, scheduler) { return new Observable((subscriber) => { let i25 = 0; return scheduler.schedule(function() { if (i25 === input2.length) { subscriber.complete(); } else { subscriber.next(input2[i25++]); if (!subscriber.closed) { this.schedule(); } } }); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js function scheduleIterable(input2, scheduler) { return new Observable((subscriber) => { let iterator3; executeSchedule(subscriber, scheduler, () => { iterator3 = input2[iterator](); executeSchedule(subscriber, scheduler, () => { let value; let done; try { ({ value, done } = iterator3.next()); } catch (err) { subscriber.error(err); return; } if (done) { subscriber.complete(); } else { subscriber.next(value); } }, 0, true); }); return () => isFunction(iterator3 === null || iterator3 === void 0 ? void 0 : iterator3.return) && iterator3.return(); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js function scheduleAsyncIterable(input2, scheduler) { if (!input2) { throw new Error("Iterable cannot be null"); } return new Observable((subscriber) => { executeSchedule(subscriber, scheduler, () => { const iterator3 = input2[Symbol.asyncIterator](); executeSchedule(subscriber, scheduler, () => { iterator3.next().then((result) => { if (result.done) { subscriber.complete(); } else { subscriber.next(result.value); } }); }, 0, true); }); }); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js function scheduleReadableStreamLike(input2, scheduler) { return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input2), scheduler); } // node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js function scheduled(input2, scheduler) { if (input2 != null) { if (isInteropObservable(input2)) { return scheduleObservable(input2, scheduler); } if (isArrayLike(input2)) { return scheduleArray(input2, scheduler); } if (isPromise(input2)) { return schedulePromise(input2, scheduler); } if (isAsyncIterable(input2)) { return scheduleAsyncIterable(input2, scheduler); } if (isIterable(input2)) { return scheduleIterable(input2, scheduler); } if (isReadableStreamLike(input2)) { return scheduleReadableStreamLike(input2, scheduler); } } throw createInvalidObservableTypeError(input2); } // node_modules/rxjs/dist/esm/internal/observable/from.js function from(input2, scheduler) { return scheduler ? scheduled(input2, scheduler) : innerFrom(input2); } // node_modules/rxjs/dist/esm/internal/observable/of.js function of(...args) { const scheduler = popScheduler(args); return from(args, scheduler); } // node_modules/rxjs/dist/esm/internal/observable/throwError.js function throwError(errorOrErrorFactory, scheduler) { const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory; const init2 = (subscriber) => subscriber.error(errorFactory()); return new Observable(scheduler ? (subscriber) => scheduler.schedule(init2, 0, subscriber) : init2); } // node_modules/rxjs/dist/esm/internal/util/isObservable.js function isObservable(obj) { return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe)); } // node_modules/rxjs/dist/esm/internal/util/EmptyError.js var EmptyError = createErrorClass((_super) => function EmptyErrorImpl() { _super(this); this.name = "EmptyError"; this.message = "no elements in sequence"; }); // node_modules/rxjs/dist/esm/internal/firstValueFrom.js function firstValueFrom(source, config2) { const hasConfig = typeof config2 === "object"; return new Promise((resolve2, reject) => { const subscriber = new SafeSubscriber({ next: (value) => { resolve2(value); subscriber.unsubscribe(); }, error: reject, complete: () => { if (hasConfig) { resolve2(config2.defaultValue); } else { reject(new EmptyError()); } } }); source.subscribe(subscriber); }); } // node_modules/rxjs/dist/esm/internal/util/isDate.js function isValidDate(value) { return value instanceof Date && !isNaN(value); } // node_modules/rxjs/dist/esm/internal/operators/map.js function map(project, thisArg) { return operate((source, subscriber) => { let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { subscriber.next(project.call(thisArg, value, index++)); })); }); } // node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js var { isArray } = Array; function callOrApply(fn, args) { return isArray(args) ? fn(...args) : fn(args); } function mapOneOrManyArgs(fn) { return map((args) => callOrApply(fn, args)); } // node_modules/rxjs/dist/esm/internal/observable/bindCallbackInternals.js function bindCallbackInternals(isNodeStyle, callbackFunc, resultSelector, scheduler) { if (resultSelector) { if (isScheduler(resultSelector)) { scheduler = resultSelector; } else { return function(...args) { return bindCallbackInternals(isNodeStyle, callbackFunc, scheduler).apply(this, args).pipe(mapOneOrManyArgs(resultSelector)); }; } } if (scheduler) { return function(...args) { return bindCallbackInternals(isNodeStyle, callbackFunc).apply(this, args).pipe(subscribeOn(scheduler), observeOn(scheduler)); }; } return function(...args) { const subject = new AsyncSubject(); let uninitialized = true; return new Observable((subscriber) => { const subs = subject.subscribe(subscriber); if (uninitialized) { uninitialized = false; let isAsync = false; let isComplete = false; callbackFunc.apply(this, [ ...args, (...results) => { if (isNodeStyle) { const err = results.shift(); if (err != null) { subject.error(err); return; } } subject.next(1 < results.length ? results : results[0]); isComplete = true; if (isAsync) { subject.complete(); } } ]); if (isComplete) { subject.complete(); } isAsync = true; } return subs; }); }; } // node_modules/rxjs/dist/esm/internal/observable/bindCallback.js function bindCallback(callbackFunc, resultSelector, scheduler) { return bindCallbackInternals(false, callbackFunc, resultSelector, scheduler); } // node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js var { isArray: isArray2 } = Array; var { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object; function argsArgArrayOrObject(args) { if (args.length === 1) { const first2 = args[0]; if (isArray2(first2)) { return { args: first2, keys: null }; } if (isPOJO(first2)) { const keys = getKeys(first2); return { args: keys.map((key) => first2[key]), keys }; } } return { args, keys: null }; } function isPOJO(obj) { return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto; } // node_modules/rxjs/dist/esm/internal/util/createObject.js function createObject(keys, values3) { return keys.reduce((result, key, i25) => (result[key] = values3[i25], result), {}); } // node_modules/rxjs/dist/esm/internal/observable/combineLatest.js function combineLatest(...args) { const scheduler = popScheduler(args); const resultSelector = popResultSelector(args); const { args: observables, keys } = argsArgArrayOrObject(args); if (observables.length === 0) { return from([], scheduler); } const result = new Observable(combineLatestInit(observables, scheduler, keys ? (values3) => createObject(keys, values3) : identity)); return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result; } function combineLatestInit(observables, scheduler, valueTransform = identity) { return (subscriber) => { maybeSchedule(scheduler, () => { const { length } = observables; const values3 = new Array(length); let active = length; let remainingFirstValues = length; for (let i25 = 0; i25 < length; i25++) { maybeSchedule(scheduler, () => { const source = from(observables[i25], scheduler); let hasFirstValue = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { values3[i25] = value; if (!hasFirstValue) { hasFirstValue = true; remainingFirstValues--; } if (!remainingFirstValues) { subscriber.next(valueTransform(values3.slice())); } }, () => { if (!--active) { subscriber.complete(); } })); }, subscriber); } }, subscriber); }; } function maybeSchedule(scheduler, execute, subscription) { if (scheduler) { executeSchedule(subscription, scheduler, execute); } else { execute(); } } // node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) { const buffer = []; let active = 0; let index = 0; let isComplete = false; const checkComplete = () => { if (isComplete && !buffer.length && !active) { subscriber.complete(); } }; const outerNext = (value) => active < concurrent ? doInnerSub(value) : buffer.push(value); const doInnerSub = (value) => { expand && subscriber.next(value); active++; let innerComplete = false; innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, (innerValue) => { onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue); if (expand) { outerNext(innerValue); } else { subscriber.next(innerValue); } }, () => { innerComplete = true; }, void 0, () => { if (innerComplete) { try { active--; while (buffer.length && active < concurrent) { const bufferedValue = buffer.shift(); if (innerSubScheduler) { executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue)); } else { doInnerSub(bufferedValue); } } checkComplete(); } catch (err) { subscriber.error(err); } } })); }; source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => { isComplete = true; checkComplete(); })); return () => { additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer(); }; } // node_modules/rxjs/dist/esm/internal/operators/mergeMap.js function mergeMap(project, resultSelector, concurrent = Infinity) { if (isFunction(resultSelector)) { return mergeMap((a45, i25) => map((b7, ii) => resultSelector(a45, b7, i25, ii))(innerFrom(project(a45, i25))), concurrent); } else if (typeof resultSelector === "number") { concurrent = resultSelector; } return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent)); } // node_modules/rxjs/dist/esm/internal/operators/mergeAll.js function mergeAll(concurrent = Infinity) { return mergeMap(identity, concurrent); } // node_modules/rxjs/dist/esm/internal/operators/concatAll.js function concatAll() { return mergeAll(1); } // node_modules/rxjs/dist/esm/internal/observable/concat.js function concat(...args) { return concatAll()(from(args, popScheduler(args))); } // node_modules/rxjs/dist/esm/internal/observable/defer.js function defer(observableFactory) { return new Observable((subscriber) => { innerFrom(observableFactory()).subscribe(subscriber); }); } // node_modules/rxjs/dist/esm/internal/observable/forkJoin.js function forkJoin(...args) { const resultSelector = popResultSelector(args); const { args: sources, keys } = argsArgArrayOrObject(args); const result = new Observable((subscriber) => { const { length } = sources; if (!length) { subscriber.complete(); return; } const values3 = new Array(length); let remainingCompletions = length; let remainingEmissions = length; for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) { let hasValue = false; innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, (value) => { if (!hasValue) { hasValue = true; remainingEmissions--; } values3[sourceIndex] = value; }, () => remainingCompletions--, void 0, () => { if (!remainingCompletions || !hasValue) { if (!remainingEmissions) { subscriber.next(keys ? createObject(keys, values3) : values3); } subscriber.complete(); } })); } }); return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result; } // node_modules/rxjs/dist/esm/internal/observable/fromEvent.js var nodeEventEmitterMethods = ["addListener", "removeListener"]; var eventTargetMethods = ["addEventListener", "removeEventListener"]; var jqueryMethods = ["on", "off"]; function fromEvent(target, eventName, options, resultSelector) { if (isFunction(options)) { resultSelector = options; options = void 0; } if (resultSelector) { return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector)); } const [add2, remove2] = isEventTarget(target) ? eventTargetMethods.map((methodName) => (handler) => target[methodName](eventName, handler, options)) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : []; if (!add2) { if (isArrayLike(target)) { return mergeMap((subTarget) => fromEvent(subTarget, eventName, options))(innerFrom(target)); } } if (!add2) { throw new TypeError("Invalid event target"); } return new Observable((subscriber) => { const handler = (...args) => subscriber.next(1 < args.length ? args : args[0]); add2(handler); return () => remove2(handler); }); } function toCommonHandlerRegistry(target, eventName) { return (methodName) => (handler) => target[methodName](eventName, handler); } function isNodeStyleEventEmitter(target) { return isFunction(target.addListener) && isFunction(target.removeListener); } function isJQueryStyleEventEmitter(target) { return isFunction(target.on) && isFunction(target.off); } function isEventTarget(target) { return isFunction(target.addEventListener) && isFunction(target.removeEventListener); } // node_modules/rxjs/dist/esm/internal/observable/iif.js function iif(condition, trueResult, falseResult) { return defer(() => condition() ? trueResult : falseResult); } // node_modules/rxjs/dist/esm/internal/observable/timer.js function timer(dueTime = 0, intervalOrScheduler, scheduler = async) { let intervalDuration = -1; if (intervalOrScheduler != null) { if (isScheduler(intervalOrScheduler)) { scheduler = intervalOrScheduler; } else { intervalDuration = intervalOrScheduler; } } return new Observable((subscriber) => { let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime; if (due < 0) { due = 0; } let n44 = 0; return scheduler.schedule(function() { if (!subscriber.closed) { subscriber.next(n44++); if (0 <= intervalDuration) { this.schedule(void 0, intervalDuration); } else { subscriber.complete(); } } }, due); }); } // node_modules/rxjs/dist/esm/internal/observable/interval.js function interval(period = 0, scheduler = asyncScheduler) { if (period < 0) { period = 0; } return timer(period, period, scheduler); } // node_modules/rxjs/dist/esm/internal/observable/merge.js function merge(...args) { const scheduler = popScheduler(args); const concurrent = popNumber(args, Infinity); const sources = args; return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler)); } // node_modules/rxjs/dist/esm/internal/observable/never.js var NEVER = new Observable(noop); // node_modules/rxjs/dist/esm/internal/util/argsOrArgArray.js var { isArray: isArray3 } = Array; function argsOrArgArray(args) { return args.length === 1 && isArray3(args[0]) ? args[0] : args; } // node_modules/rxjs/dist/esm/internal/operators/filter.js function filter(predicate, thisArg) { return operate((source, subscriber) => { let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value))); }); } // node_modules/rxjs/dist/esm/internal/observable/race.js function race(...sources) { sources = argsOrArgArray(sources); return sources.length === 1 ? innerFrom(sources[0]) : new Observable(raceInit(sources)); } function raceInit(sources) { return (subscriber) => { let subscriptions = []; for (let i25 = 0; subscriptions && !subscriber.closed && i25 < sources.length; i25++) { subscriptions.push(innerFrom(sources[i25]).subscribe(createOperatorSubscriber(subscriber, (value) => { if (subscriptions) { for (let s17 = 0; s17 < subscriptions.length; s17++) { s17 !== i25 && subscriptions[s17].unsubscribe(); } subscriptions = null; } subscriber.next(value); }))); } }; } // node_modules/rxjs/dist/esm/internal/operators/audit.js function audit(durationSelector) { return operate((source, subscriber) => { let hasValue = false; let lastValue = null; let durationSubscriber = null; let isComplete = false; const endDuration = () => { durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe(); durationSubscriber = null; if (hasValue) { hasValue = false; const value = lastValue; lastValue = null; subscriber.next(value); } isComplete && subscriber.complete(); }; const cleanupDuration = () => { durationSubscriber = null; isComplete && subscriber.complete(); }; source.subscribe(createOperatorSubscriber(subscriber, (value) => { hasValue = true; lastValue = value; if (!durationSubscriber) { innerFrom(durationSelector(value)).subscribe(durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration)); } }, () => { isComplete = true; (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete(); })); }); } // node_modules/rxjs/dist/esm/internal/operators/auditTime.js function auditTime(duration, scheduler = asyncScheduler) { return audit(() => timer(duration, scheduler)); } // node_modules/rxjs/dist/esm/internal/operators/bufferCount.js function bufferCount(bufferSize, startBufferEvery = null) { startBufferEvery = startBufferEvery !== null && startBufferEvery !== void 0 ? startBufferEvery : bufferSize; return operate((source, subscriber) => { let buffers = []; let count = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { let toEmit = null; if (count++ % startBufferEvery === 0) { buffers.push([]); } for (const buffer of buffers) { buffer.push(value); if (bufferSize <= buffer.length) { toEmit = toEmit !== null && toEmit !== void 0 ? toEmit : []; toEmit.push(buffer); } } if (toEmit) { for (const buffer of toEmit) { arrRemove(buffers, buffer); subscriber.next(buffer); } } }, () => { for (const buffer of buffers) { subscriber.next(buffer); } subscriber.complete(); }, void 0, () => { buffers = null; })); }); } // node_modules/rxjs/dist/esm/internal/operators/catchError.js function catchError(selector) { return operate((source, subscriber) => { let innerSub = null; let syncUnsub = false; let handledResult; innerSub = source.subscribe(createOperatorSubscriber(subscriber, void 0, void 0, (err) => { handledResult = innerFrom(selector(err, catchError(selector)(source))); if (innerSub) { innerSub.unsubscribe(); innerSub = null; handledResult.subscribe(subscriber); } else { syncUnsub = true; } })); if (syncUnsub) { innerSub.unsubscribe(); innerSub = null; handledResult.subscribe(subscriber); } }); } // node_modules/rxjs/dist/esm/internal/operators/scanInternals.js function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) { return (source, subscriber) => { let hasState = hasSeed; let state2 = seed; let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { const i25 = index++; state2 = hasState ? accumulator(state2, value, i25) : (hasState = true, value); emitOnNext && subscriber.next(state2); }, emitBeforeComplete && (() => { hasState && subscriber.next(state2); subscriber.complete(); }))); }; } // node_modules/rxjs/dist/esm/internal/operators/reduce.js function reduce(accumulator, seed) { return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true)); } // node_modules/rxjs/dist/esm/internal/operators/concatMap.js function concatMap(project, resultSelector) { return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1); } // node_modules/rxjs/dist/esm/internal/operators/debounceTime.js function debounceTime(dueTime, scheduler = asyncScheduler) { return operate((source, subscriber) => { let activeTask = null; let lastValue = null; let lastTime = null; const emit = () => { if (activeTask) { activeTask.unsubscribe(); activeTask = null; const value = lastValue; lastValue = null; subscriber.next(value); } }; function emitWhenIdle() { const targetTime = lastTime + dueTime; const now = scheduler.now(); if (now < targetTime) { activeTask = this.schedule(void 0, targetTime - now); subscriber.add(activeTask); return; } emit(); } source.subscribe(createOperatorSubscriber(subscriber, (value) => { lastValue = value; lastTime = scheduler.now(); if (!activeTask) { activeTask = scheduler.schedule(emitWhenIdle, dueTime); subscriber.add(activeTask); } }, () => { emit(); subscriber.complete(); }, void 0, () => { lastValue = activeTask = null; })); }); } // node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js function defaultIfEmpty(defaultValue) { return operate((source, subscriber) => { let hasValue = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { hasValue = true; subscriber.next(value); }, () => { if (!hasValue) { subscriber.next(defaultValue); } subscriber.complete(); })); }); } // node_modules/rxjs/dist/esm/internal/operators/take.js function take(count) { return count <= 0 ? () => EMPTY : operate((source, subscriber) => { let seen = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { if (++seen <= count) { subscriber.next(value); if (count <= seen) { subscriber.complete(); } } })); }); } // node_modules/rxjs/dist/esm/internal/operators/ignoreElements.js function ignoreElements() { return operate((source, subscriber) => { source.subscribe(createOperatorSubscriber(subscriber, noop)); }); } // node_modules/rxjs/dist/esm/internal/operators/mapTo.js function mapTo(value) { return map(() => value); } // node_modules/rxjs/dist/esm/internal/operators/delayWhen.js function delayWhen(delayDurationSelector, subscriptionDelay) { if (subscriptionDelay) { return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector))); } return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value))); } // node_modules/rxjs/dist/esm/internal/operators/delay.js function delay(due, scheduler = asyncScheduler) { const duration = timer(due, scheduler); return delayWhen(() => duration); } // node_modules/rxjs/dist/esm/internal/operators/distinct.js function distinct(keySelector, flushes) { return operate((source, subscriber) => { const distinctKeys = /* @__PURE__ */ new Set(); source.subscribe(createOperatorSubscriber(subscriber, (value) => { const key = keySelector ? keySelector(value) : value; if (!distinctKeys.has(key)) { distinctKeys.add(key); subscriber.next(value); } })); flushes && innerFrom(flushes).subscribe(createOperatorSubscriber(subscriber, () => distinctKeys.clear(), noop)); }); } // node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js function distinctUntilChanged(comparator, keySelector = identity) { comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare; return operate((source, subscriber) => { let previousKey; let first2 = true; source.subscribe(createOperatorSubscriber(subscriber, (value) => { const currentKey = keySelector(value); if (first2 || !comparator(previousKey, currentKey)) { first2 = false; previousKey = currentKey; subscriber.next(value); } })); }); } function defaultCompare(a45, b7) { return a45 === b7; } // node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js function throwIfEmpty(errorFactory = defaultErrorFactory) { return operate((source, subscriber) => { let hasValue = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { hasValue = true; subscriber.next(value); }, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory()))); }); } function defaultErrorFactory() { return new EmptyError(); } // node_modules/rxjs/dist/esm/internal/operators/finalize.js function finalize(callback2) { return operate((source, subscriber) => { try { source.subscribe(subscriber); } finally { subscriber.add(callback2); } }); } // node_modules/rxjs/dist/esm/internal/operators/first.js function first(predicate, defaultValue) { const hasDefaultValue = arguments.length >= 2; return (source) => source.pipe(predicate ? filter((v7, i25) => predicate(v7, i25, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError())); } // node_modules/rxjs/dist/esm/internal/operators/takeLast.js function takeLast(count) { return count <= 0 ? () => EMPTY : operate((source, subscriber) => { let buffer = []; source.subscribe(createOperatorSubscriber(subscriber, (value) => { buffer.push(value); count < buffer.length && buffer.shift(); }, () => { for (const value of buffer) { subscriber.next(value); } subscriber.complete(); }, void 0, () => { buffer = null; })); }); } // node_modules/rxjs/dist/esm/internal/operators/last.js function last2(predicate, defaultValue) { const hasDefaultValue = arguments.length >= 2; return (source) => source.pipe(predicate ? filter((v7, i25) => predicate(v7, i25, source)) : identity, takeLast(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError())); } // node_modules/rxjs/dist/esm/internal/operators/pairwise.js function pairwise() { return operate((source, subscriber) => { let prev; let hasPrev = false; source.subscribe(createOperatorSubscriber(subscriber, (value) => { const p8 = prev; prev = value; hasPrev && subscriber.next([p8, value]); hasPrev = true; })); }); } // node_modules/rxjs/dist/esm/internal/operators/scan.js function scan(accumulator, seed) { return operate(scanInternals(accumulator, seed, arguments.length >= 2, true)); } // node_modules/rxjs/dist/esm/internal/operators/share.js function share(options = {}) { const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options; return (wrapperSource) => { let connection; let resetConnection; let subject; let refCount2 = 0; let hasCompleted = false; let hasErrored = false; const cancelReset = () => { resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe(); resetConnection = void 0; }; const reset2 = () => { cancelReset(); connection = subject = void 0; hasCompleted = hasErrored = false; }; const resetAndUnsubscribe = () => { const conn = connection; reset2(); conn === null || conn === void 0 ? void 0 : conn.unsubscribe(); }; return operate((source, subscriber) => { refCount2++; if (!hasErrored && !hasCompleted) { cancelReset(); } const dest = subject = subject !== null && subject !== void 0 ? subject : connector(); subscriber.add(() => { refCount2--; if (refCount2 === 0 && !hasErrored && !hasCompleted) { resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero); } }); dest.subscribe(subscriber); if (!connection && refCount2 > 0) { connection = new SafeSubscriber({ next: (value) => dest.next(value), error: (err) => { hasErrored = true; cancelReset(); resetConnection = handleReset(reset2, resetOnError, err); dest.error(err); }, complete: () => { hasCompleted = true; cancelReset(); resetConnection = handleReset(reset2, resetOnComplete); dest.complete(); } }); innerFrom(source).subscribe(connection); } })(wrapperSource); }; } function handleReset(reset2, on, ...args) { if (on === true) { reset2(); return; } if (on === false) { return; } const onSubscriber = new SafeSubscriber({ next: () => { onSubscriber.unsubscribe(); reset2(); } }); return innerFrom(on(...args)).subscribe(onSubscriber); } // node_modules/rxjs/dist/esm/internal/operators/shareReplay.js function shareReplay(configOrBufferSize, windowTime, scheduler) { let bufferSize; let refCount2 = false; if (configOrBufferSize && typeof configOrBufferSize === "object") { ({ bufferSize = Infinity, windowTime = Infinity, refCount: refCount2 = false, scheduler } = configOrBufferSize); } else { bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity; } return share({ connector: () => new ReplaySubject(bufferSize, windowTime, scheduler), resetOnError: true, resetOnComplete: false, resetOnRefCountZero: refCount2 }); } // node_modules/rxjs/dist/esm/internal/operators/skip.js function skip(count) { return filter((_3, index) => count <= index); } // node_modules/rxjs/dist/esm/internal/operators/skipWhile.js function skipWhile(predicate) { return operate((source, subscriber) => { let taking = false; let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => (taking || (taking = !predicate(value, index++))) && subscriber.next(value))); }); } // node_modules/rxjs/dist/esm/internal/operators/startWith.js function startWith(...values3) { const scheduler = popScheduler(values3); return operate((source, subscriber) => { (scheduler ? concat(values3, source, scheduler) : concat(values3, source)).subscribe(subscriber); }); } // node_modules/rxjs/dist/esm/internal/operators/switchMap.js function switchMap(project, resultSelector) { return operate((source, subscriber) => { let innerSubscriber = null; let index = 0; let isComplete = false; const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete(); source.subscribe(createOperatorSubscriber(subscriber, (value) => { innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe(); let innerIndex = 0; const outerIndex = index++; innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => { innerSubscriber = null; checkComplete(); })); }, () => { isComplete = true; checkComplete(); })); }); } // node_modules/rxjs/dist/esm/internal/operators/takeUntil.js function takeUntil(notifier) { return operate((source, subscriber) => { innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop)); !subscriber.closed && source.subscribe(subscriber); }); } // node_modules/rxjs/dist/esm/internal/operators/takeWhile.js function takeWhile(predicate, inclusive = false) { return operate((source, subscriber) => { let index = 0; source.subscribe(createOperatorSubscriber(subscriber, (value) => { const result = predicate(value, index++); (result || inclusive) && subscriber.next(value); !result && subscriber.complete(); })); }); } // node_modules/rxjs/dist/esm/internal/operators/tap.js function tap(observerOrNext, error, complete) { const tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext; return tapObserver ? operate((source, subscriber) => { var _a12; (_a12 = tapObserver.subscribe) === null || _a12 === void 0 ? void 0 : _a12.call(tapObserver); let isUnsub = true; source.subscribe(createOperatorSubscriber(subscriber, (value) => { var _a13; (_a13 = tapObserver.next) === null || _a13 === void 0 ? void 0 : _a13.call(tapObserver, value); subscriber.next(value); }, () => { var _a13; isUnsub = false; (_a13 = tapObserver.complete) === null || _a13 === void 0 ? void 0 : _a13.call(tapObserver); subscriber.complete(); }, (err) => { var _a13; isUnsub = false; (_a13 = tapObserver.error) === null || _a13 === void 0 ? void 0 : _a13.call(tapObserver, err); subscriber.error(err); }, () => { var _a13, _b4; if (isUnsub) { (_a13 = tapObserver.unsubscribe) === null || _a13 === void 0 ? void 0 : _a13.call(tapObserver); } (_b4 = tapObserver.finalize) === null || _b4 === void 0 ? void 0 : _b4.call(tapObserver); })); }) : identity; } // node_modules/@angular/core/fesm2022/effect.mjs function createLinkedSignal(sourceFn, computationFn, equalityFn) { const node = Object.create(LINKED_SIGNAL_NODE); node.source = sourceFn; node.computation = computationFn; if (equalityFn != void 0) { node.equal = equalityFn; } const linkedSignalGetter = () => { producerUpdateValueVersion(node); producerAccessed(node); if (node.value === ERRORED) { throw node.error; } return node.value; }; const getter = linkedSignalGetter; getter[SIGNAL] = node; if (typeof ngDevMode !== "undefined" && ngDevMode) { const debugName = node.debugName ? " (" + node.debugName + ")" : ""; getter.toString = () => `[LinkedSignal${debugName}: ${node.value}]`; } runPostProducerCreatedFn(node); return getter; } function linkedSignalSetFn(node, newValue) { producerUpdateValueVersion(node); signalSetFn(node, newValue); producerMarkClean(node); } function linkedSignalUpdateFn(node, updater) { producerUpdateValueVersion(node); signalUpdateFn(node, updater); producerMarkClean(node); } var LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => { return __spreadProps(__spreadValues({}, REACTIVE_NODE), { value: UNSET, dirty: true, error: null, equal: defaultEquals, kind: "linkedSignal", producerMustRecompute(node) { return node.value === UNSET || node.value === COMPUTING; }, producerRecomputeValue(node) { if (node.value === COMPUTING) { throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Detected cycle in computations." : ""); } const oldValue = node.value; node.value = COMPUTING; const prevConsumer = consumerBeforeComputation(node); let newValue; try { const newSourceValue = node.source(); const prev = oldValue === UNSET || oldValue === ERRORED ? void 0 : { source: node.sourceValue, value: oldValue }; newValue = node.computation(newSourceValue, prev); node.sourceValue = newSourceValue; } catch (err) { newValue = ERRORED; node.error = err; } finally { consumerAfterComputation(node, prevConsumer); } if (oldValue !== UNSET && newValue !== ERRORED && node.equal(oldValue, newValue)) { node.value = oldValue; return; } node.value = newValue; node.version++; } }); })(); function untracked(nonReactiveReadsFn) { const prevConsumer = setActiveConsumer(null); try { return nonReactiveReadsFn(); } finally { setActiveConsumer(prevConsumer); } } var BASE_EFFECT_NODE = /* @__PURE__ */ (() => __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, consumerAllowSignalWrites: true, dirty: true, hasRun: false, kind: "effect" }))(); function runEffect(node) { node.dirty = false; if (node.hasRun && !consumerPollProducersForChange(node)) { return; } node.hasRun = true; const prevNode = consumerBeforeComputation(node); try { node.cleanup(); node.fn(); } finally { consumerAfterComputation(node, prevNode); } } // node_modules/@angular/core/fesm2022/root_effect_scheduler.mjs var Version = class { full; major; minor; patch; constructor(full) { this.full = full; const parts = full.split("."); this.major = parts[0]; this.minor = parts[1]; this.patch = parts.slice(2).join("."); } }; var VERSION = /* @__PURE__ */ new Version("20.3.1"); var ERROR_DETAILS_PAGE_BASE_URL = (() => { const versionSubDomain = VERSION.major !== "0" ? `v${VERSION.major}.` : ""; return `https://${versionSubDomain}angular.dev/errors`; })(); var XSS_SECURITY_URL = "https://angular.dev/best-practices/security#preventing-cross-site-scripting-xss"; var RuntimeError = class extends Error { code; constructor(code, message2) { super(formatRuntimeError(code, message2)); this.code = code; } }; function formatRuntimeErrorCode(code) { return `NG0${Math.abs(code)}`; } function formatRuntimeError(code, message2) { const fullCode = formatRuntimeErrorCode(code); let errorMessage = `${fullCode}${message2 ? ": " + message2 : ""}`; if (ngDevMode && code < 0) { const addPeriodSeparator = !errorMessage.match(/[.,;!?\n]$/); const separator = addPeriodSeparator ? "." : ""; errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`; } return errorMessage; } var _global = globalThis; function ngDevModeResetPerfCounters() { const locationString = typeof location !== "undefined" ? location.toString() : ""; const newCounters = { hydratedNodes: 0, hydratedComponents: 0, dehydratedViewsRemoved: 0, dehydratedViewsCleanupRuns: 0, componentsSkippedHydration: 0, deferBlocksWithIncrementalHydration: 0 }; const allowNgDevModeTrue = locationString.indexOf("ngDevMode=false") === -1; if (!allowNgDevModeTrue) { _global["ngDevMode"] = false; } else { if (typeof _global["ngDevMode"] !== "object") { _global["ngDevMode"] = {}; } Object.assign(_global["ngDevMode"], newCounters); } return newCounters; } function initNgDevMode() { if (typeof ngDevMode === "undefined" || ngDevMode) { if (typeof ngDevMode !== "object" || Object.keys(ngDevMode).length === 0) { ngDevModeResetPerfCounters(); } return typeof ngDevMode !== "undefined" && !!ngDevMode; } return false; } function getClosureSafeProperty(objWithPropertyToExtract) { for (let key in objWithPropertyToExtract) { if (objWithPropertyToExtract[key] === getClosureSafeProperty) { return key; } } throw Error(typeof ngDevMode !== "undefined" && ngDevMode ? "Could not find renamed property on target object." : ""); } function fillProperties(target, source) { for (const key in source) { if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) { target[key] = source[key]; } } } function stringify(token) { if (typeof token === "string") { return token; } if (Array.isArray(token)) { return `[${token.map(stringify).join(", ")}]`; } if (token == null) { return "" + token; } const name5 = token.overriddenName || token.name; if (name5) { return `${name5}`; } const result = token.toString(); if (result == null) { return "" + result; } const newLineIndex = result.indexOf("\n"); return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result; } function concatStringsWithSpace(before, after) { if (!before) return after || ""; if (!after) return before; return `${before} ${after}`; } var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty }); function forwardRef(forwardRefFn) { forwardRefFn.__forward_ref__ = forwardRef; forwardRefFn.toString = function() { return stringify(this()); }; return forwardRefFn; } function resolveForwardRef(type) { return isForwardRef(type) ? type() : type; } function isForwardRef(fn) { return typeof fn === "function" && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef; } function assertNumber(actual, msg) { if (!(typeof actual === "number")) { throwError2(msg, typeof actual, "number", "==="); } } function assertNumberInRange(actual, minInclusive, maxInclusive) { assertNumber(actual, "Expected a number"); assertLessThanOrEqual(actual, maxInclusive, "Expected number to be less than or equal to"); assertGreaterThanOrEqual(actual, minInclusive, "Expected number to be greater than or equal to"); } function assertString(actual, msg) { if (!(typeof actual === "string")) { throwError2(msg, actual === null ? "null" : typeof actual, "string", "==="); } } function assertFunction(actual, msg) { if (!(typeof actual === "function")) { throwError2(msg, actual === null ? "null" : typeof actual, "function", "==="); } } function assertEqual(actual, expected, msg) { if (!(actual == expected)) { throwError2(msg, actual, expected, "=="); } } function assertNotEqual(actual, expected, msg) { if (!(actual != expected)) { throwError2(msg, actual, expected, "!="); } } function assertSame(actual, expected, msg) { if (!(actual === expected)) { throwError2(msg, actual, expected, "==="); } } function assertNotSame(actual, expected, msg) { if (!(actual !== expected)) { throwError2(msg, actual, expected, "!=="); } } function assertLessThan(actual, expected, msg) { if (!(actual < expected)) { throwError2(msg, actual, expected, "<"); } } function assertLessThanOrEqual(actual, expected, msg) { if (!(actual <= expected)) { throwError2(msg, actual, expected, "<="); } } function assertGreaterThan(actual, expected, msg) { if (!(actual > expected)) { throwError2(msg, actual, expected, ">"); } } function assertGreaterThanOrEqual(actual, expected, msg) { if (!(actual >= expected)) { throwError2(msg, actual, expected, ">="); } } function assertDefined(actual, msg) { if (actual == null) { throwError2(msg, actual, null, "!="); } } function throwError2(msg, actual, expected, comparison) { throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? "" : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`)); } function assertDomNode(node) { if (!(node instanceof Node)) { throwError2(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`); } } function assertElement(node) { if (!(node instanceof Element)) { throwError2(`The provided value must be an element but got ${stringify(node)}`); } } function assertIndexInRange(arr, index) { assertDefined(arr, "Array must be defined."); const maxLen = arr.length; if (index < 0 || index >= maxLen) { throwError2(`Index expected to be less than ${maxLen} but got ${index}`); } } function assertOneOf(value, ...validValues) { if (validValues.indexOf(value) !== -1) return true; throwError2(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`); } function assertNotReactive(fn) { if (getActiveConsumer() !== null) { throwError2(`${fn}() should never be called in a reactive context.`); } } function \u0275\u0275defineInjectable(opts) { return { token: opts.token, providedIn: opts.providedIn || null, factory: opts.factory, value: void 0 }; } function \u0275\u0275defineInjector(options) { return { providers: options.providers || [], imports: options.imports || [] }; } function getInjectableDef(type) { return getOwnDefinition(type, NG_PROV_DEF); } function isInjectable(type) { return getInjectableDef(type) !== null; } function getOwnDefinition(type, field) { return type.hasOwnProperty(field) && type[field] || null; } function getInheritedInjectableDef(type) { const def = type?.[NG_PROV_DEF] ?? null; if (def) { ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token "${type.name}" that inherits its @Injectable decorator but does not provide one itself. This will become an error in a future version of Angular. Please add @Injectable() to the "${type.name}" class.`); return def; } else { return null; } } function getInjectorDef(type) { return type && type.hasOwnProperty(NG_INJ_DEF) ? type[NG_INJ_DEF] : null; } var NG_PROV_DEF = getClosureSafeProperty({ \u0275prov: getClosureSafeProperty }); var NG_INJ_DEF = getClosureSafeProperty({ \u0275inj: getClosureSafeProperty }); var InjectionToken = class { _desc; /** @internal */ ngMetadataName = "InjectionToken"; \u0275prov; /** * @param _desc Description for the token, * used only for debugging purposes, * it should but does not need to be unique * @param options Options for the token's usage, as described above */ constructor(_desc, options) { this._desc = _desc; this.\u0275prov = void 0; if (typeof options == "number") { (typeof ngDevMode === "undefined" || ngDevMode) && assertLessThan(options, 0, "Only negative numbers are supported here"); this.__NG_ELEMENT_ID__ = options; } else if (options !== void 0) { this.\u0275prov = \u0275\u0275defineInjectable({ token: this, providedIn: options.providedIn || "root", factory: options.factory }); } } /** * @internal */ get multi() { return this; } toString() { return `InjectionToken ${this._desc}`; } }; var _injectorProfilerContext; function getInjectorProfilerContext() { !ngDevMode && throwError2("getInjectorProfilerContext should never be called in production mode"); return _injectorProfilerContext; } function setInjectorProfilerContext(context2) { !ngDevMode && throwError2("setInjectorProfilerContext should never be called in production mode"); const previous = _injectorProfilerContext; _injectorProfilerContext = context2; return previous; } var injectorProfilerCallbacks = []; var NOOP_PROFILER_REMOVAL = () => { }; function removeProfiler(profiler2) { const profilerIdx = injectorProfilerCallbacks.indexOf(profiler2); if (profilerIdx !== -1) { injectorProfilerCallbacks.splice(profilerIdx, 1); } } function setInjectorProfiler(injectorProfiler2) { !ngDevMode && throwError2("setInjectorProfiler should never be called in production mode"); if (injectorProfiler2 !== null) { if (!injectorProfilerCallbacks.includes(injectorProfiler2)) { injectorProfilerCallbacks.push(injectorProfiler2); } return () => removeProfiler(injectorProfiler2); } else { injectorProfilerCallbacks.length = 0; return NOOP_PROFILER_REMOVAL; } } function injectorProfiler(event2) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); for (let i25 = 0; i25 < injectorProfilerCallbacks.length; i25++) { const injectorProfilerCallback = injectorProfilerCallbacks[i25]; injectorProfilerCallback(event2); } } function emitProviderConfiguredEvent(eventProvider, isViewProvider = false) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); let token; if (typeof eventProvider === "function") { token = eventProvider; } else if (eventProvider instanceof InjectionToken) { token = eventProvider; } else { token = resolveForwardRef(eventProvider.provide); } let provider = eventProvider; if (eventProvider instanceof InjectionToken) { provider = eventProvider.\u0275prov || eventProvider; } injectorProfiler({ type: 2, context: getInjectorProfilerContext(), providerRecord: { token, provider, isViewProvider } }); } function emitInjectorToCreateInstanceEvent(token) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); injectorProfiler({ type: 4, context: getInjectorProfilerContext(), token }); } function emitInstanceCreatedByInjectorEvent(instance) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); injectorProfiler({ type: 1, context: getInjectorProfilerContext(), instance: { value: instance } }); } function emitInjectEvent(token, value, flags) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); injectorProfiler({ type: 0, context: getInjectorProfilerContext(), service: { token, value, flags } }); } function emitEffectCreatedEvent(effect2) { !ngDevMode && throwError2("Injector profiler should never be called in production mode"); injectorProfiler({ type: 3, context: getInjectorProfilerContext(), effect: effect2 }); } function runInInjectorProfilerContext(injector, token, callback2) { !ngDevMode && throwError2("runInInjectorProfilerContext should never be called in production mode"); const prevInjectContext = setInjectorProfilerContext({ injector, token }); try { callback2(); } finally { setInjectorProfilerContext(prevInjectContext); } } function isEnvironmentProviders(value) { return value && !!value.\u0275providers; } var NG_COMP_DEF = getClosureSafeProperty({ \u0275cmp: getClosureSafeProperty }); var NG_DIR_DEF = getClosureSafeProperty({ \u0275dir: getClosureSafeProperty }); var NG_PIPE_DEF = getClosureSafeProperty({ \u0275pipe: getClosureSafeProperty }); var NG_MOD_DEF = getClosureSafeProperty({ \u0275mod: getClosureSafeProperty }); var NG_FACTORY_DEF = getClosureSafeProperty({ \u0275fac: getClosureSafeProperty }); var NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty }); var NG_ENV_ID = getClosureSafeProperty({ __NG_ENV_ID__: getClosureSafeProperty }); function renderStringify(value) { if (typeof value === "string") return value; if (value == null) return ""; return String(value); } function stringifyForError(value) { if (typeof value === "function") return value.name || value.toString(); if (typeof value === "object" && value != null && typeof value.type === "function") { return value.type.name || value.type.toString(); } return renderStringify(value); } var NG_RUNTIME_ERROR_CODE = getClosureSafeProperty({ "ngErrorCode": getClosureSafeProperty }); var NG_RUNTIME_ERROR_MESSAGE = getClosureSafeProperty({ "ngErrorMessage": getClosureSafeProperty }); var NG_TOKEN_PATH = getClosureSafeProperty({ "ngTokenPath": getClosureSafeProperty }); function cyclicDependencyError(token, path) { const message2 = ngDevMode ? `Circular dependency detected for \`${token}\`.` : ""; return createRuntimeError(message2, -200, path); } function cyclicDependencyErrorWithDetails(token, path) { return augmentRuntimeError(cyclicDependencyError(token, path), null); } function throwMixedMultiProviderError() { throw new Error(`Cannot mix multi providers and regular providers`); } function throwInvalidProviderError(ngModuleType, providers, provider) { if (ngModuleType && providers) { const providerDetail = providers.map((v7) => v7 == provider ? "?" + provider + "?" : "..."); throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(", ")}]`); } else if (isEnvironmentProviders(provider)) { if (provider.\u0275fromNgModule) { throw new RuntimeError(207, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`); } else { throw new RuntimeError(207, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`); } } else { throw new Error("Invalid provider"); } } function throwProviderNotFoundError(token, injectorName) { const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ""}`; throw new RuntimeError(-201, errorMessage); } function prependTokenToDependencyPath(error, token) { error[NG_TOKEN_PATH] ??= []; const currentPath = error[NG_TOKEN_PATH]; let pathStr; if (typeof token === "object" && "multi" in token && token?.multi === true) { assertDefined(token.provide, "Token with multi: true should have a provide property"); pathStr = stringifyForError(token.provide); } else { pathStr = stringifyForError(token); } if (currentPath[0] !== pathStr) { error[NG_TOKEN_PATH].unshift(pathStr); } } function augmentRuntimeError(error, source) { const tokenPath = error[NG_TOKEN_PATH]; const errorCode = error[NG_RUNTIME_ERROR_CODE]; const message2 = error[NG_RUNTIME_ERROR_MESSAGE] || error.message; error.message = formatErrorMessage(message2, errorCode, tokenPath, source); return error; } function createRuntimeError(message2, code, path) { const error = new RuntimeError(code, message2); error[NG_RUNTIME_ERROR_CODE] = code; error[NG_RUNTIME_ERROR_MESSAGE] = message2; if (path) { error[NG_TOKEN_PATH] = path; } return error; } function getRuntimeErrorCode(error) { return error[NG_RUNTIME_ERROR_CODE]; } function formatErrorMessage(text, code, path = [], source = null) { let pathDetails = ""; if (path && path.length > 1) { pathDetails = ` Path: ${path.join(" -> ")}.`; } const sourceDetails = source ? ` Source: ${source}.` : ""; return formatRuntimeError(code, `${text}${sourceDetails}${pathDetails}`); } var _injectImplementation; function getInjectImplementation() { return _injectImplementation; } function setInjectImplementation(impl) { const previous = _injectImplementation; _injectImplementation = impl; return previous; } function injectRootLimpMode(token, notFoundValue, flags) { const injectableDef = getInjectableDef(token); if (injectableDef && injectableDef.providedIn == "root") { return injectableDef.value === void 0 ? injectableDef.value = injectableDef.factory() : injectableDef.value; } if (flags & 8) return null; if (notFoundValue !== void 0) return notFoundValue; throwProviderNotFoundError(token, "Injector"); } function assertInjectImplementationNotEqual(fn) { ngDevMode && assertNotEqual(_injectImplementation, fn, "Calling \u0275\u0275inject would cause infinite recursion"); } var _THROW_IF_NOT_FOUND = {}; var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; var DI_DECORATOR_FLAG = "__NG_DI_FLAG__"; var RetrievingInjector = class { injector; constructor(injector) { this.injector = injector; } retrieve(token, options) { const flags = convertToBitFlags(options) || 0; try { return this.injector.get( token, // When a dependency is requested with an optional flag, DI returns null as the default value. flags & 8 ? null : THROW_IF_NOT_FOUND, flags ); } catch (e56) { if (isNotFound(e56)) { return e56; } throw e56; } } }; function injectInjectorOnly(token, flags = 0) { const currentInjector = getCurrentInjector(); if (currentInjector === void 0) { throw new RuntimeError(-203, ngDevMode && `The \`${stringify(token)}\` token injection failed. \`inject()\` function must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`); } else if (currentInjector === null) { return injectRootLimpMode(token, void 0, flags); } else { const options = convertToInjectOptions(flags); const value = currentInjector.retrieve(token, options); ngDevMode && emitInjectEvent(token, value, flags); if (isNotFound(value)) { if (options.optional) { return null; } throw value; } return value; } } function \u0275\u0275inject(token, flags = 0) { return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags); } function \u0275\u0275invalidFactoryDep(index) { throw new RuntimeError(202, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid. This can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator. Please check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`); } function inject2(token, options) { return \u0275\u0275inject(token, convertToBitFlags(options)); } function convertToBitFlags(flags) { if (typeof flags === "undefined" || typeof flags === "number") { return flags; } return 0 | // comment to force a line break in the formatter (flags.optional && 8) | (flags.host && 1) | (flags.self && 2) | (flags.skipSelf && 4); } function convertToInjectOptions(flags) { return { optional: !!(flags & 8), host: !!(flags & 1), self: !!(flags & 2), skipSelf: !!(flags & 4) }; } function injectArgs(types) { const args = []; for (let i25 = 0; i25 < types.length; i25++) { const arg = resolveForwardRef(types[i25]); if (Array.isArray(arg)) { if (arg.length === 0) { throw new RuntimeError(900, ngDevMode && "Arguments array must have arguments."); } let type = void 0; let flags = 0; for (let j3 = 0; j3 < arg.length; j3++) { const meta = arg[j3]; const flag = getInjectFlag(meta); if (typeof flag === "number") { if (flag === -1) { type = meta.token; } else { flags |= flag; } } else { type = meta; } } args.push(\u0275\u0275inject(type, flags)); } else { args.push(\u0275\u0275inject(arg)); } } return args; } function attachInjectFlag(decorator, flag) { decorator[DI_DECORATOR_FLAG] = flag; decorator.prototype[DI_DECORATOR_FLAG] = flag; return decorator; } function getInjectFlag(token) { return token[DI_DECORATOR_FLAG]; } function getFactoryDef(type, throwNotFound) { const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF); if (!hasFactoryDef && throwNotFound === true && ngDevMode) { throw new Error(`Type ${stringify(type)} does not have '\u0275fac' property.`); } return hasFactoryDef ? type[NG_FACTORY_DEF] : null; } function arrayEquals(a45, b7, identityAccessor) { if (a45.length !== b7.length) return false; for (let i25 = 0; i25 < a45.length; i25++) { let valueA = a45[i25]; let valueB = b7[i25]; if (identityAccessor) { valueA = identityAccessor(valueA); valueB = identityAccessor(valueB); } if (valueB !== valueA) { return false; } } return true; } function flatten(list) { return list.flat(Number.POSITIVE_INFINITY); } function deepForEach(input2, fn) { input2.forEach((value) => Array.isArray(value) ? deepForEach(value, fn) : fn(value)); } function addToArray(arr, index, value) { if (index >= arr.length) { arr.push(value); } else { arr.splice(index, 0, value); } } function removeFromArray(arr, index) { if (index >= arr.length - 1) { return arr.pop(); } else { return arr.splice(index, 1)[0]; } } function newArray(size, value) { const list = []; for (let i25 = 0; i25 < size; i25++) { list.push(value); } return list; } function arraySplice(array, index, count) { const length = array.length - count; while (index < length) { array[index] = array[index + count]; index++; } while (count--) { array.pop(); } } function arrayInsert2(array, index, value1, value2) { ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end."); let end = array.length; if (end == index) { array.push(value1, value2); } else if (end === 1) { array.push(value2, array[0]); array[0] = value1; } else { end--; array.push(array[end - 1], array[end]); while (end > index) { const previousEnd = end - 2; array[end] = array[previousEnd]; end--; } array[index] = value1; array[index + 1] = value2; } } function keyValueArraySet(keyValueArray, key, value) { let index = keyValueArrayIndexOf(keyValueArray, key); if (index >= 0) { keyValueArray[index | 1] = value; } else { index = ~index; arrayInsert2(keyValueArray, index, key, value); } return index; } function keyValueArrayGet(keyValueArray, key) { const index = keyValueArrayIndexOf(keyValueArray, key); if (index >= 0) { return keyValueArray[index | 1]; } return void 0; } function keyValueArrayIndexOf(keyValueArray, key) { return _arrayIndexOfSorted(keyValueArray, key, 1); } function _arrayIndexOfSorted(array, value, shift) { ngDevMode && assertEqual(Array.isArray(array), true, "Expecting an array"); let start = 0; let end = array.length >> shift; while (end !== start) { const middle = start + (end - start >> 1); const current = array[middle << shift]; if (value === current) { return middle << shift; } else if (current > value) { end = middle; } else { start = middle + 1; } } return ~(end << shift); } var EMPTY_OBJ = {}; var EMPTY_ARRAY = []; if ((typeof ngDevMode === "undefined" || ngDevMode) && initNgDevMode()) { Object.freeze(EMPTY_OBJ); Object.freeze(EMPTY_ARRAY); } var ENVIRONMENT_INITIALIZER = new InjectionToken(ngDevMode ? "ENVIRONMENT_INITIALIZER" : ""); var INJECTOR$1 = new InjectionToken( ngDevMode ? "INJECTOR" : "", // Disable tslint because this is const enum which gets inlined not top level prop access. // tslint:disable-next-line: no-toplevel-property-access -1 /* InjectorMarkers.Injector */ ); var INJECTOR_DEF_TYPES = new InjectionToken(ngDevMode ? "INJECTOR_DEF_TYPES" : ""); var NullInjector = class { get(token, notFoundValue = THROW_IF_NOT_FOUND) { if (notFoundValue === THROW_IF_NOT_FOUND) { const message2 = ngDevMode ? `No provider found for \`${stringify(token)}\`.` : ""; const error = createRuntimeError( message2, -201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */ ); error.name = "\u0275NotFound"; throw error; } return notFoundValue; } }; function getNgModuleDef(type) { return type[NG_MOD_DEF] || null; } function getNgModuleDefOrThrow(type) { const ngModuleDef = getNgModuleDef(type); if (!ngModuleDef) { throw new RuntimeError(915, (typeof ngDevMode === "undefined" || ngDevMode) && `Type ${stringify(type)} does not have '\u0275mod' property.`); } return ngModuleDef; } function getComponentDef(type) { return type[NG_COMP_DEF] || null; } function getDirectiveDefOrThrow(type) { const def = getDirectiveDef(type); if (!def) { throw new RuntimeError(916, (typeof ngDevMode === "undefined" || ngDevMode) && `Type ${stringify(type)} does not have '\u0275dir' property.`); } return def; } function getDirectiveDef(type) { return type[NG_DIR_DEF] || null; } function getPipeDef(type) { return type[NG_PIPE_DEF] || null; } function isStandalone(type) { const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type); return def !== null && def.standalone; } function makeEnvironmentProviders(providers) { return { \u0275providers: providers }; } function importProvidersFrom(...sources) { return { \u0275providers: internalImportProvidersFrom(true, sources), \u0275fromNgModule: true }; } function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) { const providersOut = []; const dedup = /* @__PURE__ */ new Set(); let injectorTypesWithProviders; const collectProviders = (provider) => { providersOut.push(provider); }; deepForEach(sources, (source) => { if ((typeof ngDevMode === "undefined" || ngDevMode) && checkForStandaloneCmp) { const cmpDef = getComponentDef(source); if (cmpDef?.standalone) { throw new RuntimeError(800, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component "${stringifyForError(source)}"`); } } const internalSource = source; if (walkProviderTree(internalSource, collectProviders, [], dedup)) { injectorTypesWithProviders ||= []; injectorTypesWithProviders.push(internalSource); } }); if (injectorTypesWithProviders !== void 0) { processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders); } return providersOut; } function processInjectorTypesWithProviders(typesWithProviders, visitor) { for (let i25 = 0; i25 < typesWithProviders.length; i25++) { const { ngModule, providers } = typesWithProviders[i25]; deepForEachProvider(providers, (provider) => { ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule); visitor(provider, ngModule); }); } } function walkProviderTree(container, visitor, parents, dedup) { container = resolveForwardRef(container); if (!container) return false; let defType = null; let injDef = getInjectorDef(container); const cmpDef = !injDef && getComponentDef(container); if (!injDef && !cmpDef) { const ngModule = container.ngModule; injDef = getInjectorDef(ngModule); if (injDef) { defType = ngModule; } else { return false; } } else if (cmpDef && !cmpDef.standalone) { return false; } else { defType = container; } if (ngDevMode && parents.indexOf(defType) !== -1) { const defName = stringify(defType); const path = parents.map(stringify).concat(defName); throw cyclicDependencyErrorWithDetails(defName, path); } const isDuplicate = dedup.has(defType); if (cmpDef) { if (isDuplicate) { return false; } dedup.add(defType); if (cmpDef.dependencies) { const deps = typeof cmpDef.dependencies === "function" ? cmpDef.dependencies() : cmpDef.dependencies; for (const dep of deps) { walkProviderTree(dep, visitor, parents, dedup); } } } else if (injDef) { if (injDef.imports != null && !isDuplicate) { ngDevMode && parents.push(defType); dedup.add(defType); let importTypesWithProviders; try { deepForEach(injDef.imports, (imported) => { if (walkProviderTree(imported, visitor, parents, dedup)) { importTypesWithProviders ||= []; importTypesWithProviders.push(imported); } }); } finally { ngDevMode && parents.pop(); } if (importTypesWithProviders !== void 0) { processInjectorTypesWithProviders(importTypesWithProviders, visitor); } } if (!isDuplicate) { const factory = getFactoryDef(defType) || (() => new defType()); visitor({ provide: defType, useFactory: factory, deps: EMPTY_ARRAY }, defType); visitor({ provide: INJECTOR_DEF_TYPES, useValue: defType, multi: true }, defType); visitor({ provide: ENVIRONMENT_INITIALIZER, useValue: () => \u0275\u0275inject(defType), multi: true }, defType); } const defProviders = injDef.providers; if (defProviders != null && !isDuplicate) { const injectorType = container; deepForEachProvider(defProviders, (provider) => { ngDevMode && validateProvider(provider, defProviders, injectorType); visitor(provider, injectorType); }); } } else { return false; } return defType !== container && container.providers !== void 0; } function validateProvider(provider, providers, containerType) { if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) { return; } const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide)); if (!classRef) { throwInvalidProviderError(containerType, providers, provider); } } function deepForEachProvider(providers, fn) { for (let provider of providers) { if (isEnvironmentProviders(provider)) { provider = provider.\u0275providers; } if (Array.isArray(provider)) { deepForEachProvider(provider, fn); } else { fn(provider); } } } var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty }); function isValueProvider(value) { return value !== null && typeof value == "object" && USE_VALUE in value; } function isExistingProvider(value) { return !!(value && value.useExisting); } function isFactoryProvider(value) { return !!(value && value.useFactory); } function isTypeProvider(value) { return typeof value === "function"; } function isClassProvider(value) { return !!value.useClass; } var INJECTOR_SCOPE = new InjectionToken(ngDevMode ? "Set Injector scope." : ""); var NOT_YET = {}; var CIRCULAR = {}; var NULL_INJECTOR = void 0; function getNullInjector() { if (NULL_INJECTOR === void 0) { NULL_INJECTOR = new NullInjector(); } return NULL_INJECTOR; } var EnvironmentInjector = class { }; var R3Injector = class extends EnvironmentInjector { parent; source; scopes; /** * Map of tokens to records which contain the instances of those tokens. * - `null` value implies that we don't have the record. Used by tree-shakable injectors * to prevent further searches. */ records = /* @__PURE__ */ new Map(); /** * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks. */ _ngOnDestroyHooks = /* @__PURE__ */ new Set(); _onDestroyHooks = []; /** * Flag indicating that this injector was previously destroyed. */ get destroyed() { return this._destroyed; } _destroyed = false; injectorDefTypes; constructor(providers, parent2, source, scopes) { super(); this.parent = parent2; this.source = source; this.scopes = scopes; forEachSingleProvider(providers, (provider) => this.processProvider(provider)); this.records.set(INJECTOR$1, makeRecord(void 0, this)); if (scopes.has("environment")) { this.records.set(EnvironmentInjector, makeRecord(void 0, this)); } const record = this.records.get(INJECTOR_SCOPE); if (record != null && typeof record.value === "string") { this.scopes.add(record.value); } this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, { self: true })); } retrieve(token, options) { const flags = convertToBitFlags(options) || 0; try { return this.get( token, // When a dependency is requested with an optional flag, DI returns null as the default value. THROW_IF_NOT_FOUND, flags ); } catch (e56) { if (isNotFound(e56)) { return e56; } throw e56; } } /** * Destroy the injector and release references to every instance or provider associated with it. * * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a * hook was found. */ destroy() { assertNotDestroyed(this); this._destroyed = true; const prevConsumer = setActiveConsumer(null); try { for (const service of this._ngOnDestroyHooks) { service.ngOnDestroy(); } const onDestroyHooks = this._onDestroyHooks; this._onDestroyHooks = []; for (const hook of onDestroyHooks) { hook(); } } finally { this.records.clear(); this._ngOnDestroyHooks.clear(); this.injectorDefTypes.clear(); setActiveConsumer(prevConsumer); } } onDestroy(callback2) { assertNotDestroyed(this); this._onDestroyHooks.push(callback2); return () => this.removeOnDestroy(callback2); } runInContext(fn) { assertNotDestroyed(this); const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token: null }); } try { return fn(); } finally { setCurrentInjector(previousInjector); setInjectImplementation(previousInjectImplementation); ngDevMode && setInjectorProfilerContext(prevInjectContext); } } get(token, notFoundValue = THROW_IF_NOT_FOUND, options) { assertNotDestroyed(this); if (token.hasOwnProperty(NG_ENV_ID)) { return token[NG_ENV_ID](this); } const flags = convertToBitFlags(options); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token }); } const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); try { if (!(flags & 4)) { let record = this.records.get(token); if (record === void 0) { const def = couldBeInjectableType(token) && getInjectableDef(token); if (def && this.injectableDefInScope(def)) { if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { emitProviderConfiguredEvent(token); }); } record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET); } else { record = null; } this.records.set(token, record); } if (record != null) { return this.hydrate(token, record, flags); } } const nextInjector = !(flags & 2) ? this.parent : getNullInjector(); notFoundValue = flags & 8 && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue; return nextInjector.get(token, notFoundValue); } catch (error) { const errorCode = getRuntimeErrorCode(error); if (errorCode === -200 || errorCode === -201) { if (ngDevMode) { prependTokenToDependencyPath(error, token); if (previousInjector) { throw error; } else { throw augmentRuntimeError(error, this.source); } } else { throw new RuntimeError(errorCode, null); } } else { throw error; } } finally { setInjectImplementation(previousInjectImplementation); setCurrentInjector(previousInjector); ngDevMode && setInjectorProfilerContext(prevInjectContext); } } /** @internal */ resolveInjectorInitializers() { const prevConsumer = setActiveConsumer(null); const previousInjector = setCurrentInjector(this); const previousInjectImplementation = setInjectImplementation(void 0); let prevInjectContext; if (ngDevMode) { prevInjectContext = setInjectorProfilerContext({ injector: this, token: null }); } try { const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, { self: true }); if (ngDevMode && !Array.isArray(initializers)) { throw new RuntimeError(-209, `Unexpected type of the \`ENVIRONMENT_INITIALIZER\` token value (expected an array, but got ${typeof initializers}). Please check that the \`ENVIRONMENT_INITIALIZER\` token is configured as a \`multi: true\` provider.`); } for (const initializer of initializers) { initializer(); } } finally { setCurrentInjector(previousInjector); setInjectImplementation(previousInjectImplementation); ngDevMode && setInjectorProfilerContext(prevInjectContext); setActiveConsumer(prevConsumer); } } toString() { const tokens = []; const records = this.records; for (const token of records.keys()) { tokens.push(stringify(token)); } return `R3Injector[${tokens.join(", ")}]`; } /** * Process a `SingleProvider` and add it. */ processProvider(provider) { provider = resolveForwardRef(provider); let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide); const record = providerToRecord(provider); if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { if (isValueProvider(provider)) { emitInjectorToCreateInstanceEvent(token); emitInstanceCreatedByInjectorEvent(provider.useValue); } emitProviderConfiguredEvent(provider); }); } if (!isTypeProvider(provider) && provider.multi === true) { let multiRecord = this.records.get(token); if (multiRecord) { if (ngDevMode && multiRecord.multi === void 0) { throwMixedMultiProviderError(); } } else { multiRecord = makeRecord(void 0, NOT_YET, true); multiRecord.factory = () => injectArgs(multiRecord.multi); this.records.set(token, multiRecord); } token = provider; multiRecord.multi.push(provider); } else { if (ngDevMode) { const existing = this.records.get(token); if (existing && existing.multi !== void 0) { throwMixedMultiProviderError(); } } } this.records.set(token, record); } hydrate(token, record, flags) { const prevConsumer = setActiveConsumer(null); try { if (record.value === CIRCULAR) { throw cyclicDependencyError(stringify(token)); } else if (record.value === NOT_YET) { record.value = CIRCULAR; if (ngDevMode) { runInInjectorProfilerContext(this, token, () => { emitInjectorToCreateInstanceEvent(token); record.value = record.factory(void 0, flags); emitInstanceCreatedByInjectorEvent(record.value); }); } else { record.value = record.factory(void 0, flags); } } if (typeof record.value === "object" && record.value && hasOnDestroy(record.value)) { this._ngOnDestroyHooks.add(record.value); } return record.value; } finally { setActiveConsumer(prevConsumer); } } injectableDefInScope(def) { if (!def.providedIn) { return false; } const providedIn = resolveForwardRef(def.providedIn); if (typeof providedIn === "string") { return providedIn === "any" || this.scopes.has(providedIn); } else { return this.injectorDefTypes.has(providedIn); } } removeOnDestroy(callback2) { const destroyCBIdx = this._onDestroyHooks.indexOf(callback2); if (destroyCBIdx !== -1) { this._onDestroyHooks.splice(destroyCBIdx, 1); } } }; function injectableDefOrInjectorDefFactory(token) { const injectableDef = getInjectableDef(token); const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token); if (factory !== null) { return factory; } if (token instanceof InjectionToken) { throw new RuntimeError(204, ngDevMode && `Token ${stringify(token)} is missing a \u0275prov definition.`); } if (token instanceof Function) { return getUndecoratedInjectableFactory(token); } throw new RuntimeError(204, ngDevMode && "unreachable"); } function getUndecoratedInjectableFactory(token) { const paramLength = token.length; if (paramLength > 0) { throw new RuntimeError(204, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, "?").join(", ")}).`); } const inheritedInjectableDef = getInheritedInjectableDef(token); if (inheritedInjectableDef !== null) { return () => inheritedInjectableDef.factory(token); } else { return () => new token(); } } function providerToRecord(provider) { if (isValueProvider(provider)) { return makeRecord(void 0, provider.useValue); } else { const factory = providerToFactory(provider); return makeRecord(factory, NOT_YET); } } function providerToFactory(provider, ngModuleType, providers) { let factory = void 0; if (ngDevMode && isEnvironmentProviders(provider)) { throwInvalidProviderError(void 0, providers, provider); } if (isTypeProvider(provider)) { const unwrappedProvider = resolveForwardRef(provider); return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider); } else { if (isValueProvider(provider)) { factory = () => resolveForwardRef(provider.useValue); } else if (isFactoryProvider(provider)) { factory = () => provider.useFactory(...injectArgs(provider.deps || [])); } else if (isExistingProvider(provider)) { factory = (_3, flags) => \u0275\u0275inject(resolveForwardRef(provider.useExisting), flags !== void 0 && flags & 8 ? 8 : void 0); } else { const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide)); if (ngDevMode && !classRef) { throwInvalidProviderError(ngModuleType, providers, provider); } if (hasDeps(provider)) { factory = () => new classRef(...injectArgs(provider.deps)); } else { return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef); } } } return factory; } function assertNotDestroyed(injector) { if (injector.destroyed) { throw new RuntimeError(205, ngDevMode && "Injector has already been destroyed."); } } function makeRecord(factory, value, multi = false) { return { factory, value, multi: multi ? [] : void 0 }; } function hasDeps(value) { return !!value.deps; } function hasOnDestroy(value) { return value !== null && typeof value === "object" && typeof value.ngOnDestroy === "function"; } function couldBeInjectableType(value) { return typeof value === "function" || typeof value === "object" && value.ngMetadataName === "InjectionToken"; } function forEachSingleProvider(providers, fn) { for (const provider of providers) { if (Array.isArray(provider)) { forEachSingleProvider(provider, fn); } else if (provider && isEnvironmentProviders(provider)) { forEachSingleProvider(provider.\u0275providers, fn); } else { fn(provider); } } } function runInInjectionContext(injector, fn) { let internalInjector; if (injector instanceof R3Injector) { assertNotDestroyed(injector); internalInjector = injector; } else { internalInjector = new RetrievingInjector(injector); } let prevInjectorProfilerContext; if (ngDevMode) { prevInjectorProfilerContext = setInjectorProfilerContext({ injector, token: null }); } const prevInjector = setCurrentInjector(internalInjector); const previousInjectImplementation = setInjectImplementation(void 0); try { return fn(); } finally { setCurrentInjector(prevInjector); ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext); setInjectImplementation(previousInjectImplementation); } } function isInInjectionContext() { return getInjectImplementation() !== void 0 || getCurrentInjector() != null; } function assertInInjectionContext(debugFn) { if (!isInInjectionContext()) { throw new RuntimeError(-203, ngDevMode && debugFn.name + "() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`"); } } var HOST = 0; var TVIEW = 1; var FLAGS = 2; var PARENT = 3; var NEXT = 4; var T_HOST = 5; var HYDRATION = 6; var CLEANUP = 7; var CONTEXT = 8; var INJECTOR = 9; var ENVIRONMENT = 10; var RENDERER = 11; var CHILD_HEAD = 12; var CHILD_TAIL = 13; var DECLARATION_VIEW = 14; var DECLARATION_COMPONENT_VIEW = 15; var DECLARATION_LCONTAINER = 16; var PREORDER_HOOK_FLAGS = 17; var QUERIES = 18; var ID = 19; var EMBEDDED_VIEW_INJECTOR = 20; var ON_DESTROY_HOOKS = 21; var EFFECTS_TO_SCHEDULE = 22; var EFFECTS = 23; var REACTIVE_TEMPLATE_CONSUMER = 24; var AFTER_RENDER_SEQUENCES_TO_ADD = 25; var ANIMATIONS = 26; var HEADER_OFFSET = 27; var TYPE = 1; var DEHYDRATED_VIEWS = 6; var NATIVE = 7; var VIEW_REFS = 8; var MOVED_VIEWS = 9; var CONTAINER_HEADER_OFFSET = 10; function isLView(value) { return Array.isArray(value) && typeof value[TYPE] === "object"; } function isLContainer(value) { return Array.isArray(value) && value[TYPE] === true; } function isContentQueryHost(tNode) { return (tNode.flags & 4) !== 0; } function isComponentHost(tNode) { return tNode.componentOffset > -1; } function isDirectiveHost(tNode) { return (tNode.flags & 1) === 1; } function isComponentDef(def) { return !!def.template; } function isRootView(target) { return (target[FLAGS] & 512) !== 0; } function isDestroyed(lView) { return (lView[FLAGS] & 256) === 256; } function assertTNodeForLView(tNode, lView) { assertTNodeForTView(tNode, lView[TVIEW]); } function assertTNodeCreationIndex(lView, index) { const adjustedIndex = index + HEADER_OFFSET; assertIndexInRange(lView, adjustedIndex); assertLessThan(adjustedIndex, lView[TVIEW].bindingStartIndex, "TNodes should be created before any bindings"); } function assertTNodeForTView(tNode, tView) { assertTNode(tNode); const tData = tView.data; for (let i25 = HEADER_OFFSET; i25 < tData.length; i25++) { if (tData[i25] === tNode) { return; } } throwError2("This TNode does not belong to this TView."); } function assertTNode(tNode) { assertDefined(tNode, "TNode must be defined"); if (!(tNode && typeof tNode === "object" && tNode.hasOwnProperty("directiveStylingLast"))) { throwError2("Not of type TNode, got: " + tNode); } } function assertTIcu(tIcu) { assertDefined(tIcu, "Expected TIcu to be defined"); if (!(typeof tIcu.currentCaseLViewIndex === "number")) { throwError2("Object is not of TIcu type."); } } function assertComponentType(actual, msg = "Type passed in is not ComponentType, it does not have '\u0275cmp' property.") { if (!getComponentDef(actual)) { throwError2(msg); } } function assertNgModuleType(actual, msg = "Type passed in is not NgModuleType, it does not have '\u0275mod' property.") { if (!getNgModuleDef(actual)) { throwError2(msg); } } function assertHasParent(tNode) { assertDefined(tNode, "currentTNode should exist!"); assertDefined(tNode.parent, "currentTNode should have a parent"); } function assertLContainer(value) { assertDefined(value, "LContainer must be defined"); assertEqual(isLContainer(value), true, "Expecting LContainer"); } function assertLViewOrUndefined(value) { value && assertEqual(isLView(value), true, "Expecting LView or undefined or null"); } function assertLView(value) { assertDefined(value, "LView must be defined"); assertEqual(isLView(value), true, "Expecting LView"); } function assertFirstCreatePass(tView, errMessage) { assertEqual(tView.firstCreatePass, true, errMessage || "Should only be called in first create pass."); } function assertFirstUpdatePass(tView, errMessage) { assertEqual(tView.firstUpdatePass, true, "Should only be called in first update pass."); } function assertDirectiveDef(obj) { if (obj.type === void 0 || obj.selectors == void 0 || obj.inputs === void 0) { throwError2(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`); } } function assertIndexInDeclRange(tView, index) { assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index); } function assertIndexInExpandoRange(lView, index) { const tView = lView[1]; assertBetween(tView.expandoStartIndex, lView.length, index); } function assertBetween(lower, upper, index) { if (!(lower <= index && index < upper)) { throwError2(`Index out of range (expecting ${lower} <= ${index} < ${upper})`); } } function assertProjectionSlots(lView, errMessage) { assertDefined(lView[DECLARATION_COMPONENT_VIEW], "Component views should exist."); assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, "Components with projection nodes () must have projection slots defined."); } function assertParentView(lView, errMessage) { assertDefined(lView, "Component views should always have a parent view (component's host view)"); } function assertNodeInjector(lView, injectorIndex) { assertIndexInExpandoRange(lView, injectorIndex); assertIndexInExpandoRange( lView, injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ); assertNumber(lView[injectorIndex + 0], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 1], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 2], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 3], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 4], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 5], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 6], "injectorIndex should point to a bloom filter"); assertNumber(lView[injectorIndex + 7], "injectorIndex should point to a bloom filter"); assertNumber(lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ], "injectorIndex should point to parent injector"); } var SVG_NAMESPACE = "svg"; var MATH_ML_NAMESPACE = "math"; function unwrapRNode(value) { while (Array.isArray(value)) { value = value[HOST]; } return value; } function unwrapLView(value) { while (Array.isArray(value)) { if (typeof value[TYPE] === "object") return value; value = value[HOST]; } return null; } function getNativeByIndex(index, lView) { ngDevMode && assertIndexInRange(lView, index); ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Expected to be past HEADER_OFFSET"); return unwrapRNode(lView[index]); } function getNativeByTNode(tNode, lView) { ngDevMode && assertTNodeForLView(tNode, lView); ngDevMode && assertIndexInRange(lView, tNode.index); const node = unwrapRNode(lView[tNode.index]); return node; } function getTNode(tView, index) { ngDevMode && assertGreaterThan(index, -1, "wrong index for TNode"); ngDevMode && assertLessThan(index, tView.data.length, "wrong index for TNode"); const tNode = tView.data[index]; ngDevMode && tNode !== null && assertTNode(tNode); return tNode; } function load(view, index) { ngDevMode && assertIndexInRange(view, index); return view[index]; } function store(tView, lView, index, value) { if (index >= tView.data.length) { tView.data[index] = null; tView.blueprint[index] = null; } lView[index] = value; } function getComponentLViewByIndex(nodeIndex, hostView) { ngDevMode && assertIndexInRange(hostView, nodeIndex); const slotValue = hostView[nodeIndex]; const lView = isLView(slotValue) ? slotValue : slotValue[HOST]; return lView; } function isCreationMode(view) { return (view[FLAGS] & 4) === 4; } function viewAttachedToChangeDetector(view) { return (view[FLAGS] & 128) === 128; } function viewAttachedToContainer(view) { return isLContainer(view[PARENT]); } function getConstant(consts, index) { if (index === null || index === void 0) return null; ngDevMode && assertIndexInRange(consts, index); return consts[index]; } function resetPreOrderHookFlags(lView) { lView[PREORDER_HOOK_FLAGS] = 0; } function markViewForRefresh(lView) { if (lView[FLAGS] & 1024) { return; } lView[FLAGS] |= 1024; if (viewAttachedToChangeDetector(lView)) { markAncestorsForTraversal(lView); } } function walkUpViews(nestingLevel, currentView) { while (nestingLevel > 0) { ngDevMode && assertDefined(currentView[DECLARATION_VIEW], "Declaration view should be defined if nesting level is greater than 0."); currentView = currentView[DECLARATION_VIEW]; nestingLevel--; } return currentView; } function requiresRefreshOrTraversal(lView) { return !!(lView[FLAGS] & (1024 | 8192) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty); } function updateAncestorTraversalFlagsOnAttach(lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 8 /* NotificationSource.ViewAttached */ ); if (lView[FLAGS] & 64) { lView[FLAGS] |= 1024; } if (requiresRefreshOrTraversal(lView)) { markAncestorsForTraversal(lView); } } function markAncestorsForTraversal(lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 0 /* NotificationSource.MarkAncestorsForTraversal */ ); let parent2 = getLViewParent(lView); while (parent2 !== null) { if (parent2[FLAGS] & 8192) { break; } parent2[FLAGS] |= 8192; if (!viewAttachedToChangeDetector(parent2)) { break; } parent2 = getLViewParent(parent2); } } function storeLViewOnDestroy(lView, onDestroyCallback) { if (isDestroyed(lView)) { throw new RuntimeError(911, ngDevMode && "View has already been destroyed."); } if (lView[ON_DESTROY_HOOKS] === null) { lView[ON_DESTROY_HOOKS] = []; } lView[ON_DESTROY_HOOKS].push(onDestroyCallback); } function removeLViewOnDestroy(lView, onDestroyCallback) { if (lView[ON_DESTROY_HOOKS] === null) return; const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback); if (destroyCBIdx !== -1) { lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1); } } function getLViewParent(lView) { ngDevMode && assertLView(lView); const parent2 = lView[PARENT]; return isLContainer(parent2) ? parent2[PARENT] : parent2; } function getOrCreateLViewCleanup(view) { return view[CLEANUP] ??= []; } function getOrCreateTViewCleanup(tView) { return tView.cleanup ??= []; } function storeCleanupWithContext(tView, lView, context2, cleanupFn) { const lCleanup = getOrCreateLViewCleanup(lView); ngDevMode && assertDefined(context2, "Cleanup context is mandatory when registering framework-level destroy hooks"); lCleanup.push(context2); if (tView.firstCreatePass) { getOrCreateTViewCleanup(tView).push(cleanupFn, lCleanup.length - 1); } else { if (ngDevMode) { Object.freeze(getOrCreateTViewCleanup(tView)); } } } var instructionState = { lFrame: createLFrame(null), bindingsEnabled: true, skipHydrationRootTNode: null }; var CheckNoChangesMode; (function(CheckNoChangesMode2) { CheckNoChangesMode2[CheckNoChangesMode2["Off"] = 0] = "Off"; CheckNoChangesMode2[CheckNoChangesMode2["Exhaustive"] = 1] = "Exhaustive"; CheckNoChangesMode2[CheckNoChangesMode2["OnlyDirtyViews"] = 2] = "OnlyDirtyViews"; })(CheckNoChangesMode || (CheckNoChangesMode = {})); var _checkNoChangesMode = 0; var _isRefreshingViews = false; function getElementDepthCount() { return instructionState.lFrame.elementDepthCount; } function increaseElementDepthCount() { instructionState.lFrame.elementDepthCount++; } function decreaseElementDepthCount() { instructionState.lFrame.elementDepthCount--; } function getBindingsEnabled() { return instructionState.bindingsEnabled; } function isInSkipHydrationBlock() { return instructionState.skipHydrationRootTNode !== null; } function isSkipHydrationRootTNode(tNode) { return instructionState.skipHydrationRootTNode === tNode; } function \u0275\u0275enableBindings() { instructionState.bindingsEnabled = true; } function \u0275\u0275disableBindings() { instructionState.bindingsEnabled = false; } function leaveSkipHydrationBlock() { instructionState.skipHydrationRootTNode = null; } function getLView() { return instructionState.lFrame.lView; } function getTView() { return instructionState.lFrame.tView; } function \u0275\u0275restoreView(viewToRestore) { instructionState.lFrame.contextLView = viewToRestore; return viewToRestore[CONTEXT]; } function \u0275\u0275resetView(value) { instructionState.lFrame.contextLView = null; return value; } function getCurrentTNode() { let currentTNode = getCurrentTNodePlaceholderOk(); while (currentTNode !== null && currentTNode.type === 64) { currentTNode = currentTNode.parent; } return currentTNode; } function getCurrentTNodePlaceholderOk() { return instructionState.lFrame.currentTNode; } function getCurrentParentTNode() { const lFrame = instructionState.lFrame; const currentTNode = lFrame.currentTNode; return lFrame.isParent ? currentTNode : currentTNode.parent; } function setCurrentTNode(tNode, isParent) { ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView); const lFrame = instructionState.lFrame; lFrame.currentTNode = tNode; lFrame.isParent = isParent; } function isCurrentTNodeParent() { return instructionState.lFrame.isParent; } function setCurrentTNodeAsNotParent() { instructionState.lFrame.isParent = false; } function getContextLView() { const contextLView = instructionState.lFrame.contextLView; ngDevMode && assertDefined(contextLView, "contextLView must be defined."); return contextLView; } function isInCheckNoChangesMode() { !ngDevMode && throwError2("Must never be called in production mode"); return _checkNoChangesMode !== CheckNoChangesMode.Off; } function isExhaustiveCheckNoChanges() { !ngDevMode && throwError2("Must never be called in production mode"); return _checkNoChangesMode === CheckNoChangesMode.Exhaustive; } function setIsInCheckNoChangesMode(mode) { !ngDevMode && throwError2("Must never be called in production mode"); _checkNoChangesMode = mode; } function isRefreshingViews() { return _isRefreshingViews; } function setIsRefreshingViews(mode) { const prev = _isRefreshingViews; _isRefreshingViews = mode; return prev; } function getBindingRoot() { const lFrame = instructionState.lFrame; let index = lFrame.bindingRootIndex; if (index === -1) { index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex; } return index; } function getBindingIndex() { return instructionState.lFrame.bindingIndex; } function setBindingIndex(value) { return instructionState.lFrame.bindingIndex = value; } function nextBindingIndex() { return instructionState.lFrame.bindingIndex++; } function incrementBindingIndex(count) { const lFrame = instructionState.lFrame; const index = lFrame.bindingIndex; lFrame.bindingIndex = lFrame.bindingIndex + count; return index; } function isInI18nBlock() { return instructionState.lFrame.inI18n; } function setInI18nBlock(isInI18nBlock2) { instructionState.lFrame.inI18n = isInI18nBlock2; } function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) { const lFrame = instructionState.lFrame; lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex; setCurrentDirectiveIndex(currentDirectiveIndex); } function getCurrentDirectiveIndex() { return instructionState.lFrame.currentDirectiveIndex; } function setCurrentDirectiveIndex(currentDirectiveIndex) { instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex; } function getCurrentDirectiveDef(tData) { const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex; return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex]; } function getCurrentQueryIndex() { return instructionState.lFrame.currentQueryIndex; } function setCurrentQueryIndex(value) { instructionState.lFrame.currentQueryIndex = value; } function getDeclarationTNode(lView) { const tView = lView[TVIEW]; if (tView.type === 2) { ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents."); return tView.declTNode; } if (tView.type === 1) { return lView[T_HOST]; } return null; } function enterDI(lView, tNode, flags) { ngDevMode && assertLViewOrUndefined(lView); if (flags & 4) { ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]); let parentTNode = tNode; let parentLView = lView; while (true) { ngDevMode && assertDefined(parentTNode, "Parent TNode should be defined"); parentTNode = parentTNode.parent; if (parentTNode === null && !(flags & 1)) { parentTNode = getDeclarationTNode(parentLView); if (parentTNode === null) break; ngDevMode && assertDefined(parentLView, "Parent LView should be defined"); parentLView = parentLView[DECLARATION_VIEW]; if (parentTNode.type & (2 | 8)) { break; } } else { break; } } if (parentTNode === null) { return false; } else { tNode = parentTNode; lView = parentLView; } } ngDevMode && assertTNodeForLView(tNode, lView); const lFrame = instructionState.lFrame = allocLFrame(); lFrame.currentTNode = tNode; lFrame.lView = lView; return true; } function enterView(newView) { ngDevMode && assertNotEqual(newView[0], newView[1], "????"); ngDevMode && assertLViewOrUndefined(newView); const newLFrame = allocLFrame(); if (ngDevMode) { assertEqual(newLFrame.isParent, true, "Expected clean LFrame"); assertEqual(newLFrame.lView, null, "Expected clean LFrame"); assertEqual(newLFrame.tView, null, "Expected clean LFrame"); assertEqual(newLFrame.selectedIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.elementDepthCount, 0, "Expected clean LFrame"); assertEqual(newLFrame.currentDirectiveIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.currentNamespace, null, "Expected clean LFrame"); assertEqual(newLFrame.bindingRootIndex, -1, "Expected clean LFrame"); assertEqual(newLFrame.currentQueryIndex, 0, "Expected clean LFrame"); } const tView = newView[TVIEW]; instructionState.lFrame = newLFrame; ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView); newLFrame.currentTNode = tView.firstChild; newLFrame.lView = newView; newLFrame.tView = tView; newLFrame.contextLView = newView; newLFrame.bindingIndex = tView.bindingStartIndex; newLFrame.inI18n = false; } function allocLFrame() { const currentLFrame = instructionState.lFrame; const childLFrame = currentLFrame === null ? null : currentLFrame.child; const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame; return newLFrame; } function createLFrame(parent2) { const lFrame = { currentTNode: null, isParent: true, lView: null, tView: null, selectedIndex: -1, contextLView: null, elementDepthCount: 0, currentNamespace: null, currentDirectiveIndex: -1, bindingRootIndex: -1, bindingIndex: -1, currentQueryIndex: 0, parent: parent2, child: null, inI18n: false }; parent2 !== null && (parent2.child = lFrame); return lFrame; } function leaveViewLight() { const oldLFrame = instructionState.lFrame; instructionState.lFrame = oldLFrame.parent; oldLFrame.currentTNode = null; oldLFrame.lView = null; return oldLFrame; } var leaveDI = leaveViewLight; function leaveView() { const oldLFrame = leaveViewLight(); oldLFrame.isParent = true; oldLFrame.tView = null; oldLFrame.selectedIndex = -1; oldLFrame.contextLView = null; oldLFrame.elementDepthCount = 0; oldLFrame.currentDirectiveIndex = -1; oldLFrame.currentNamespace = null; oldLFrame.bindingRootIndex = -1; oldLFrame.bindingIndex = -1; oldLFrame.currentQueryIndex = 0; } function nextContextImpl(level) { const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView); return contextLView[CONTEXT]; } function getSelectedIndex() { return instructionState.lFrame.selectedIndex; } function setSelectedIndex(index) { ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, "Index must be past HEADER_OFFSET (or -1)."); ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, "Can't set index passed end of LView"); instructionState.lFrame.selectedIndex = index; } function getSelectedTNode() { const lFrame = instructionState.lFrame; return getTNode(lFrame.tView, lFrame.selectedIndex); } function \u0275\u0275namespaceSVG() { instructionState.lFrame.currentNamespace = SVG_NAMESPACE; } function \u0275\u0275namespaceMathML() { instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE; } function \u0275\u0275namespaceHTML() { namespaceHTMLInternal(); } function namespaceHTMLInternal() { instructionState.lFrame.currentNamespace = null; } function getNamespace() { return instructionState.lFrame.currentNamespace; } var _wasLastNodeCreated = true; function wasLastNodeCreated() { return _wasLastNodeCreated; } function lastNodeWasCreated(flag) { _wasLastNodeCreated = flag; } function createInjector(defType, parent2 = null, additionalProviders = null, name5) { const injector = createInjectorWithoutInjectorInstances(defType, parent2, additionalProviders, name5); injector.resolveInjectorInitializers(); return injector; } function createInjectorWithoutInjectorInstances(defType, parent2 = null, additionalProviders = null, name5, scopes = /* @__PURE__ */ new Set()) { const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)]; name5 = name5 || (typeof defType === "object" ? void 0 : stringify(defType)); return new R3Injector(providers, parent2 || getNullInjector(), name5 || null, scopes); } var Injector = class _Injector { static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND; static NULL = new NullInjector(); static create(options, parent2) { if (Array.isArray(options)) { return createInjector({ name: "" }, parent2, options, ""); } else { const name5 = options.name ?? ""; return createInjector({ name: name5 }, options.parent, options.providers, name5); } } /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _Injector, providedIn: "any", factory: () => \u0275\u0275inject(INJECTOR$1) }) ); /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = -1; }; var DOCUMENT = new InjectionToken(ngDevMode ? "DocumentToken" : ""); var DestroyRef = class { /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectDestroyRef; /** * @internal * @nocollapse */ static __NG_ENV_ID__ = (injector) => injector; }; var NodeInjectorDestroyRef = class extends DestroyRef { _lView; constructor(_lView) { super(); this._lView = _lView; } get destroyed() { return isDestroyed(this._lView); } onDestroy(callback2) { const lView = this._lView; storeLViewOnDestroy(lView, callback2); return () => removeLViewOnDestroy(lView, callback2); } }; function injectDestroyRef() { return new NodeInjectorDestroyRef(getLView()); } var ErrorHandler = class { /** * @internal */ _console = console; handleError(error) { this._console.error("ERROR", error); } }; var INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "internal error handler" : "", { providedIn: "root", factory: () => { const injector = inject2(EnvironmentInjector); let userErrorHandler; return (e56) => { if (injector.destroyed && !userErrorHandler) { setTimeout(() => { throw e56; }); } else { userErrorHandler ??= injector.get(ErrorHandler); userErrorHandler.handleError(e56); } }; } }); var errorHandlerEnvironmentInitializer = { provide: ENVIRONMENT_INITIALIZER, useValue: () => void inject2(ErrorHandler), multi: true }; var globalErrorListeners = new InjectionToken(ngDevMode ? "GlobalErrorListeners" : "", { providedIn: "root", factory: () => { if (false) { return; } const window2 = inject2(DOCUMENT).defaultView; if (!window2) { return; } const errorHandler2 = inject2(INTERNAL_APPLICATION_ERROR_HANDLER); const rejectionListener = (e56) => { errorHandler2(e56.reason); e56.preventDefault(); }; const errorListener = (e56) => { if (e56.error) { errorHandler2(e56.error); } else { errorHandler2(new Error(ngDevMode ? `An ErrorEvent with no error occurred. See Error.cause for details: ${e56.message}` : e56.message, { cause: e56 })); } e56.preventDefault(); }; const setupEventListeners = () => { window2.addEventListener("unhandledrejection", rejectionListener); window2.addEventListener("error", errorListener); }; if (typeof Zone !== "undefined") { Zone.root.run(setupEventListeners); } else { setupEventListeners(); } inject2(DestroyRef).onDestroy(() => { window2.removeEventListener("error", errorListener); window2.removeEventListener("unhandledrejection", rejectionListener); }); } }); function isSignal(value) { return typeof value === "function" && value[SIGNAL] !== void 0; } function signal(initialValue, options) { const [get, set2, update] = createSignal(initialValue, options?.equal); const signalFn = get; const node = signalFn[SIGNAL]; signalFn.set = set2; signalFn.update = update; signalFn.asReadonly = signalAsReadonlyFn.bind(signalFn); if (ngDevMode) { signalFn.toString = () => `[Signal: ${signalFn()}]`; node.debugName = options?.debugName; } return signalFn; } function signalAsReadonlyFn() { const node = this[SIGNAL]; if (node.readonlyFn === void 0) { const readonlyFn = () => this(); readonlyFn[SIGNAL] = node; node.readonlyFn = readonlyFn; } return node.readonlyFn; } function isWritableSignal(value) { return isSignal(value) && typeof value.set === "function"; } var ChangeDetectionScheduler = class { }; var ZONELESS_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless enabled" : "", { providedIn: "root", factory: () => false }); var PROVIDED_ZONELESS = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Zoneless provided" : "", { providedIn: "root", factory: () => false }); var ZONELESS_SCHEDULER_DISABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "scheduler disabled" : ""); var SCHEDULE_IN_ROOT_ZONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "run changes outside zone in root" : ""); function assertNotInReactiveContext(debugFn, extraContext) { if (getActiveConsumer() !== null) { throw new RuntimeError(-602, ngDevMode && `${debugFn.name}() cannot be called from within a reactive context.${extraContext ? ` ${extraContext}` : ""}`); } } var ViewContext = class { view; node; constructor(view, node) { this.view = view; this.node = node; } /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectViewContext; }; function injectViewContext() { return new ViewContext(getLView(), getCurrentTNode()); } var PendingTasksInternal = class _PendingTasksInternal { taskId = 0; pendingTasks = /* @__PURE__ */ new Set(); destroyed = false; pendingTask = new BehaviorSubject(false); get hasPendingTasks() { return this.destroyed ? false : this.pendingTask.value; } /** * In case the service is about to be destroyed, return a self-completing observable. * Otherwise, return the observable that emits the current state of pending tasks. */ get hasPendingTasksObservable() { if (this.destroyed) { return new Observable((subscriber) => { subscriber.next(false); subscriber.complete(); }); } return this.pendingTask; } add() { if (!this.hasPendingTasks && !this.destroyed) { this.pendingTask.next(true); } const taskId = this.taskId++; this.pendingTasks.add(taskId); return taskId; } has(taskId) { return this.pendingTasks.has(taskId); } remove(taskId) { this.pendingTasks.delete(taskId); if (this.pendingTasks.size === 0 && this.hasPendingTasks) { this.pendingTask.next(false); } } ngOnDestroy() { this.pendingTasks.clear(); if (this.hasPendingTasks) { this.pendingTask.next(false); } this.destroyed = true; this.pendingTask.unsubscribe(); } /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _PendingTasksInternal, providedIn: "root", factory: () => new _PendingTasksInternal() }) ); }; var PendingTasks = class _PendingTasks { internalPendingTasks = inject2(PendingTasksInternal); scheduler = inject2(ChangeDetectionScheduler); errorHandler = inject2(INTERNAL_APPLICATION_ERROR_HANDLER); /** * Adds a new task that should block application's stability. * @returns A cleanup function that removes a task when called. */ add() { const taskId = this.internalPendingTasks.add(); return () => { if (!this.internalPendingTasks.has(taskId)) { return; } this.scheduler.notify( 11 /* NotificationSource.PendingTaskRemoved */ ); this.internalPendingTasks.remove(taskId); }; } /** * Runs an asynchronous function and blocks the application's stability until the function completes. * * ```ts * pendingTasks.run(async () => { * const userData = await fetch('/api/user'); * this.userData.set(userData); * }); * ``` * * @param fn The asynchronous function to execute * @developerPreview 19.0 */ run(fn) { const removeTask = this.add(); fn().catch(this.errorHandler).finally(removeTask); } /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _PendingTasks, providedIn: "root", factory: () => new _PendingTasks() }) ); }; function noop2(...args) { } var EffectScheduler = class _EffectScheduler { /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _EffectScheduler, providedIn: "root", factory: () => new ZoneAwareEffectScheduler() }) ); }; var ZoneAwareEffectScheduler = class { dirtyEffectCount = 0; queues = /* @__PURE__ */ new Map(); add(handle) { this.enqueue(handle); this.schedule(handle); } schedule(handle) { if (!handle.dirty) { return; } this.dirtyEffectCount++; } remove(handle) { const zone = handle.zone; const queue = this.queues.get(zone); if (!queue.has(handle)) { return; } queue.delete(handle); if (handle.dirty) { this.dirtyEffectCount--; } } enqueue(handle) { const zone = handle.zone; if (!this.queues.has(zone)) { this.queues.set(zone, /* @__PURE__ */ new Set()); } const queue = this.queues.get(zone); if (queue.has(handle)) { return; } queue.add(handle); } /** * Run all scheduled effects. * * Execution order of effects within the same zone is guaranteed to be FIFO, but there is no * ordering guarantee between effects scheduled in different zones. */ flush() { while (this.dirtyEffectCount > 0) { let ranOneEffect = false; for (const [zone, queue] of this.queues) { if (zone === null) { ranOneEffect ||= this.flushQueue(queue); } else { ranOneEffect ||= zone.run(() => this.flushQueue(queue)); } } if (!ranOneEffect) { this.dirtyEffectCount = 0; } } } flushQueue(queue) { let ranOneEffect = false; for (const handle of queue) { if (!handle.dirty) { continue; } this.dirtyEffectCount--; ranOneEffect = true; handle.run(); } return ranOneEffect; } }; // node_modules/@angular/core/fesm2022/debug_node.mjs function noSideEffects(fn) { return { toString: fn }.toString(); } var ANNOTATIONS = "__annotations__"; var PARAMETERS = "__parameters__"; var PROP_METADATA = "__prop__metadata__"; function makeDecorator(name5, props, parentClass, additionalProcessing, typeFn) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function DecoratorFactory(...args) { if (this instanceof DecoratorFactory) { metaCtor.call(this, ...args); return this; } const annotationInstance = new DecoratorFactory(...args); return function TypeDecorator(cls) { if (typeFn) typeFn(cls, ...args); const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS]; annotations.push(annotationInstance); return cls; }; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.ngMetadataName = name5; DecoratorFactory.annotationCls = DecoratorFactory; return DecoratorFactory; }); } function makeMetadataCtor(props) { return function ctor(...args) { if (props) { const values3 = props(...args); for (const propName in values3) { this[propName] = values3[propName]; } } }; } function makeParamDecorator(name5, props, parentClass) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function ParamDecoratorFactory(...args) { if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } const annotationInstance = new ParamDecoratorFactory(...args); ParamDecorator.annotation = annotationInstance; return ParamDecorator; function ParamDecorator(cls, unusedKey, index) { const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS]; while (parameters.length <= index) { parameters.push(null); } (parameters[index] = parameters[index] || []).push(annotationInstance); return cls; } } ParamDecoratorFactory.prototype.ngMetadataName = name5; ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; }); } function makePropDecorator(name5, props, parentClass, additionalProcessing) { return noSideEffects(() => { const metaCtor = makeMetadataCtor(props); function PropDecoratorFactory(...args) { if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } const decoratorInstance = new PropDecoratorFactory(...args); function PropDecorator(target, name6) { if (target === void 0) { throw new Error("Standard Angular field decorators are not supported in JIT mode."); } const constructor = target.constructor; const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA]; meta[name6] = meta.hasOwnProperty(name6) && meta[name6] || []; meta[name6].unshift(decoratorInstance); } return PropDecorator; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.ngMetadataName = name5; PropDecoratorFactory.annotationCls = PropDecoratorFactory; return PropDecoratorFactory; }); } var Inject = attachInjectFlag( // Disable tslint because `DecoratorFlags` is a const enum which gets inlined. makeParamDecorator("Inject", (token) => ({ token })), -1 /* DecoratorFlags.Inject */ ); var Optional = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Optional"), 8 /* InternalInjectFlags.Optional */ ) ); var Self = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Self"), 2 /* InternalInjectFlags.Self */ ) ); var SkipSelf = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("SkipSelf"), 4 /* InternalInjectFlags.SkipSelf */ ) ); var Host = ( // Disable tslint because `InternalInjectFlags` is a const enum which gets inlined. // tslint:disable-next-line: no-toplevel-property-access attachInjectFlag( makeParamDecorator("Host"), 1 /* InternalInjectFlags.Host */ ) ); function getCompilerFacade(request) { const globalNg = _global["ng"]; if (globalNg && globalNg.\u0275compilerFacade) { return globalNg.\u0275compilerFacade; } if (typeof ngDevMode === "undefined" || ngDevMode) { console.error(`JIT compilation failed for ${request.kind}`, request.type); let message2 = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available. `; if (request.usage === 1) { message2 += `The ${request.kind} is part of a library that has been partially compiled. `; message2 += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback. `; message2 += "\n"; message2 += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled. `; } else { message2 += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead. `; } message2 += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server', `; message2 += `or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.`; throw new Error(message2); } else { throw new Error("JIT compiler unavailable"); } } var angularCoreDiEnv = { "\u0275\u0275defineInjectable": \u0275\u0275defineInjectable, "\u0275\u0275defineInjector": \u0275\u0275defineInjector, "\u0275\u0275inject": \u0275\u0275inject, "\u0275\u0275invalidFactoryDep": \u0275\u0275invalidFactoryDep, "resolveForwardRef": resolveForwardRef }; var Type = Function; function isType(v7) { return typeof v7 === "function"; } var ES5_DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*(arguments|(?:[^()]+\(\[\],)?[^()]+\(arguments\).*)\)/; var ES2015_INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; var ES2015_INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/; var ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{[^}]*super\(\.\.\.arguments\)/; function isDelegateCtor(typeStr) { return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr); } var ReflectionCapabilities = class { _reflect; constructor(reflect) { this._reflect = reflect || _global["Reflect"]; } factory(t44) { return (...args) => new t44(...args); } /** @internal */ _zipTypesAndAnnotations(paramTypes, paramAnnotations) { let result; if (typeof paramTypes === "undefined") { result = newArray(paramAnnotations.length); } else { result = newArray(paramTypes.length); } for (let i25 = 0; i25 < result.length; i25++) { if (typeof paramTypes === "undefined") { result[i25] = []; } else if (paramTypes[i25] && paramTypes[i25] != Object) { result[i25] = [paramTypes[i25]]; } else { result[i25] = []; } if (paramAnnotations && paramAnnotations[i25] != null) { result[i25] = result[i25].concat(paramAnnotations[i25]); } } return result; } _ownParameters(type, parentCtor) { const typeStr = type.toString(); if (isDelegateCtor(typeStr)) { return null; } if (type.parameters && type.parameters !== parentCtor.parameters) { return type.parameters; } const tsickleCtorParams = type.ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { const ctorParameters = typeof tsickleCtorParams === "function" ? tsickleCtorParams() : tsickleCtorParams; const paramTypes2 = ctorParameters.map((ctorParam) => ctorParam && ctorParam.type); const paramAnnotations2 = ctorParameters.map((ctorParam) => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators)); return this._zipTypesAndAnnotations(paramTypes2, paramAnnotations2); } const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS]; const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata("design:paramtypes", type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } return newArray(type.length); } parameters(type) { if (!isType(type)) { return []; } const parentCtor = getParentCtor(type); let parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; } _ownAnnotations(typeOrFunc, parentCtor) { if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { let annotations = typeOrFunc.annotations; if (typeof annotations === "function" && annotations.annotations) { annotations = annotations.annotations; } return annotations; } if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); } if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) { return typeOrFunc[ANNOTATIONS]; } return null; } annotations(typeOrFunc) { if (!isType(typeOrFunc)) { return []; } const parentCtor = getParentCtor(typeOrFunc); const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); } _ownPropMetadata(typeOrFunc, parentCtor) { if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) { let propMetadata = typeOrFunc.propMetadata; if (typeof propMetadata === "function" && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) { const propDecorators = typeOrFunc.propDecorators; const propMetadata = {}; Object.keys(propDecorators).forEach((prop) => { propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]); }); return propMetadata; } if (typeOrFunc.hasOwnProperty(PROP_METADATA)) { return typeOrFunc[PROP_METADATA]; } return null; } propMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } const parentCtor = getParentCtor(typeOrFunc); const propMetadata = {}; if (parentCtor !== Object) { const parentPropMetadata = this.propMetadata(parentCtor); Object.keys(parentPropMetadata).forEach((propName) => { propMetadata[propName] = parentPropMetadata[propName]; }); } const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach((propName) => { const decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push(...propMetadata[propName]); } decorators.push(...ownPropMetadata[propName]); propMetadata[propName] = decorators; }); } return propMetadata; } ownPropMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {}; } hasLifecycleHook(type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; } }; function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map((decoratorInvocation) => { const decoratorType = decoratorInvocation.type; const annotationCls = decoratorType.annotationCls; const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return new annotationCls(...annotationArgs); }); } function getParentCtor(ctor) { const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null; const parentCtor = parentProto ? parentProto.constructor : null; return parentCtor || Object; } var SimpleChange = class { previousValue; currentValue; firstChange; constructor(previousValue, currentValue, firstChange) { this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. */ isFirstChange() { return this.firstChange; } }; function applyValueToInputField(instance, inputSignalNode, privateName, value) { if (inputSignalNode !== null) { inputSignalNode.applyValueToInputSignal(inputSignalNode, value); } else { instance[privateName] = value; } } var \u0275\u0275NgOnChangesFeature = /* @__PURE__ */ (() => { const \u0275\u0275NgOnChangesFeatureImpl = () => NgOnChangesFeatureImpl; \u0275\u0275NgOnChangesFeatureImpl.ngInherit = true; return \u0275\u0275NgOnChangesFeatureImpl; })(); function NgOnChangesFeatureImpl(definition) { if (definition.type.prototype.ngOnChanges) { definition.setInput = ngOnChangesSetInput; } return rememberChangeHistoryAndInvokeOnChangesHook; } function rememberChangeHistoryAndInvokeOnChangesHook() { const simpleChangesStore = getSimpleChangesStore(this); const current = simpleChangesStore?.current; if (current) { const previous = simpleChangesStore.previous; if (previous === EMPTY_OBJ) { simpleChangesStore.previous = current; } else { for (let key in current) { previous[key] = current[key]; } } simpleChangesStore.current = null; this.ngOnChanges(current); } } function ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) { const declaredName = this.declaredInputs[publicName]; ngDevMode && assertString(declaredName, "Name of input in ngOnChanges has to be a string"); const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null }); const current = simpleChangesStore.current || (simpleChangesStore.current = {}); const previous = simpleChangesStore.previous; const previousChange = previous[declaredName]; current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ); applyValueToInputField(instance, inputSignalNode, privateName, value); } var SIMPLE_CHANGES_STORE = "__ngSimpleChanges__"; function getSimpleChangesStore(instance) { return instance[SIMPLE_CHANGES_STORE] || null; } function setSimpleChangesStore(instance, store2) { return instance[SIMPLE_CHANGES_STORE] = store2; } var profilerCallbacks = []; var NOOP_PROFILER_REMOVAL2 = () => { }; function removeProfiler2(profiler2) { const profilerIdx = profilerCallbacks.indexOf(profiler2); if (profilerIdx !== -1) { profilerCallbacks.splice(profilerIdx, 1); } } function setProfiler(profiler2) { if (profiler2 !== null) { if (!profilerCallbacks.includes(profiler2)) { profilerCallbacks.push(profiler2); } return () => removeProfiler2(profiler2); } else { profilerCallbacks.length = 0; return NOOP_PROFILER_REMOVAL2; } } var profiler = function(event2, instance = null, eventFn) { for (let i25 = 0; i25 < profilerCallbacks.length; i25++) { const profilerCallback = profilerCallbacks[i25]; profilerCallback(event2, instance, eventFn); } }; function registerPreOrderHooks(directiveIndex, directiveDef, tView) { ngDevMode && assertFirstCreatePass(tView); const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype; if (ngOnChanges) { const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef); (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges); (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges); } if (ngOnInit) { (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit); } if (ngDoCheck) { (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck); (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck); } } function registerPostOrderHooks(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); for (let i25 = tNode.directiveStart, end = tNode.directiveEnd; i25 < end; i25++) { const directiveDef = tView.data[i25]; ngDevMode && assertDefined(directiveDef, "Expecting DirectiveDef"); const lifecycleHooks = directiveDef.type.prototype; const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks; if (ngAfterContentInit) { (tView.contentHooks ??= []).push(-i25, ngAfterContentInit); } if (ngAfterContentChecked) { (tView.contentHooks ??= []).push(i25, ngAfterContentChecked); (tView.contentCheckHooks ??= []).push(i25, ngAfterContentChecked); } if (ngAfterViewInit) { (tView.viewHooks ??= []).push(-i25, ngAfterViewInit); } if (ngAfterViewChecked) { (tView.viewHooks ??= []).push(i25, ngAfterViewChecked); (tView.viewCheckHooks ??= []).push(i25, ngAfterViewChecked); } if (ngOnDestroy != null) { (tView.destroyHooks ??= []).push(i25, ngOnDestroy); } } } function executeCheckHooks(lView, hooks, nodeIndex) { callHooks(lView, hooks, 3, nodeIndex); } function executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) { ngDevMode && assertNotEqual(initPhase, 3, "Init pre-order hooks should not be called more than once"); if ((lView[FLAGS] & 3) === initPhase) { callHooks(lView, hooks, initPhase, nodeIndex); } } function incrementInitPhaseFlags(lView, initPhase) { ngDevMode && assertNotEqual(initPhase, 3, "Init hooks phase should not be incremented after all init hooks have been run."); let flags = lView[FLAGS]; if ((flags & 3) === initPhase) { flags &= 16383; flags += 1; lView[FLAGS] = flags; } } function callHooks(currentView, arr, initPhase, currentNodeIndex) { ngDevMode && assertEqual(isInCheckNoChangesMode(), false, "Hooks should never be run when in check no changes mode."); const startIndex = currentNodeIndex !== void 0 ? currentView[PREORDER_HOOK_FLAGS] & 65535 : 0; const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1; const max = arr.length - 1; let lastNodeIndexFound = 0; for (let i25 = startIndex; i25 < max; i25++) { const hook = arr[i25 + 1]; if (typeof hook === "number") { lastNodeIndexFound = arr[i25]; if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) { break; } } else { const isInitHook = arr[i25] < 0; if (isInitHook) { currentView[PREORDER_HOOK_FLAGS] += 65536; } if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) { callHook(currentView, initPhase, arr, i25); currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760) + i25 + 2; } i25++; } } } function callHookInternal(directive, hook) { profiler(4, directive, hook); const prevConsumer = setActiveConsumer(null); try { hook.call(directive); } finally { setActiveConsumer(prevConsumer); profiler(5, directive, hook); } } function callHook(currentView, initPhase, arr, i25) { const isInitHook = arr[i25] < 0; const hook = arr[i25 + 1]; const directiveIndex = isInitHook ? -arr[i25] : arr[i25]; const directive = currentView[directiveIndex]; if (isInitHook) { const indexWithintInitPhase = currentView[FLAGS] >> 14; if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 && (currentView[FLAGS] & 3) === initPhase) { currentView[FLAGS] += 16384; callHookInternal(directive, hook); } } else { callHookInternal(directive, hook); } } var NO_PARENT_INJECTOR = -1; var NodeInjectorFactory = class { factory; name; /** * The inject implementation to be activated when using the factory. */ injectImpl; /** * Marker set to true during factory invocation to see if we get into recursive loop. * Recursive loop causes an error to be displayed. */ resolving = false; /** * Marks that the token can see other Tokens declared in `viewProviders` on the same node. */ canSeeViewProviders; /** * An array of factories to use in case of `multi` provider. */ multi; /** * Number of `multi`-providers which belong to the component. * * This is needed because when multiple components and directives declare the `multi` provider * they have to be concatenated in the correct order. * * Example: * * If we have a component and directive active an a single element as declared here * ```ts * component: * providers: [ {provide: String, useValue: 'component', multi: true} ], * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ], * * directive: * providers: [ {provide: String, useValue: 'directive', multi: true} ], * ``` * * Then the expected results are: * * ```ts * providers: ['component', 'directive'] * viewProviders: ['component', 'componentView', 'directive'] * ``` * * The way to think about it is that the `viewProviders` have been inserted after the component * but before the directives, which is why we need to know how many `multi`s have been declared by * the component. */ componentProviders; /** * Current index of the Factory in the `data`. Needed for `viewProviders` and `providers` merging. * See `providerFactory`. */ index; /** * Because the same `multi` provider can be declared in `providers` and `viewProviders` it is * possible for `viewProviders` to shadow the `providers`. For this reason we store the * `provideFactory` of the `providers` so that `providers` can be extended with `viewProviders`. * * Example: * * Given: * ```ts * providers: [ {provide: String, useValue: 'all', multi: true} ], * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ], * ``` * * We have to return `['all']` in case of content injection, but `['all', 'viewOnly']` in case * of view injection. We further have to make sure that the shared instances (in our case * `all`) are the exact same instance in both the content as well as the view injection. (We * have to make sure that we don't double instantiate.) For this reason the `viewProviders` * `Factory` has a pointer to the shadowed `providers` factory so that it can instantiate the * `providers` (`['all']`) and then extend it with `viewProviders` (`['all'] + ['viewOnly'] = * ['all', 'viewOnly']`). */ providerFactory; constructor(factory, isViewProvider, injectImplementation, name5) { this.factory = factory; this.name = name5; ngDevMode && assertDefined(factory, "Factory not specified"); ngDevMode && assertEqual(typeof factory, "function", "Expected factory function."); this.canSeeViewProviders = isViewProvider; this.injectImpl = injectImplementation; } }; function toTNodeTypeAsString(tNodeType) { let text = ""; tNodeType & 1 && (text += "|Text"); tNodeType & 2 && (text += "|Element"); tNodeType & 4 && (text += "|Container"); tNodeType & 8 && (text += "|ElementContainer"); tNodeType & 16 && (text += "|Projection"); tNodeType & 32 && (text += "|IcuContainer"); tNodeType & 64 && (text += "|Placeholder"); tNodeType & 128 && (text += "|LetDeclaration"); return text.length > 0 ? text.substring(1) : text; } function isTNodeShape(value) { return value != null && typeof value === "object" && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === "number" || Array.isArray(value.insertBeforeIndex)); } function hasClassInput(tNode) { return (tNode.flags & 8) !== 0; } function hasStyleInput(tNode) { return (tNode.flags & 16) !== 0; } function assertTNodeType(tNode, expectedTypes, message2) { assertDefined(tNode, "should be called with a TNode"); if ((tNode.type & expectedTypes) === 0) { throwError2(message2 || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`); } } function assertPureTNodeType(type) { if (!(type === 2 || type === 1 || type === 4 || type === 8 || type === 32 || type === 16 || type === 64 || type === 128)) { throwError2(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`); } } function setUpAttributes(renderer, native, attrs) { let i25 = 0; while (i25 < attrs.length) { const value = attrs[i25]; if (typeof value === "number") { if (value !== 0) { break; } i25++; const namespaceURI = attrs[i25++]; const attrName = attrs[i25++]; const attrVal = attrs[i25++]; renderer.setAttribute(native, attrName, attrVal, namespaceURI); } else { const attrName = value; const attrVal = attrs[++i25]; if (isAnimationProp(attrName)) { renderer.setProperty(native, attrName, attrVal); } else { renderer.setAttribute(native, attrName, attrVal); } i25++; } } return i25; } function isNameOnlyAttributeMarker(marker) { return marker === 3 || marker === 4 || marker === 6; } function isAnimationProp(name5) { return name5.charCodeAt(0) === 64; } function mergeHostAttrs(dst, src) { if (src === null || src.length === 0) ; else if (dst === null || dst.length === 0) { dst = src.slice(); } else { let srcMarker = -1; for (let i25 = 0; i25 < src.length; i25++) { const item = src[i25]; if (typeof item === "number") { srcMarker = item; } else { if (srcMarker === 0) ; else if (srcMarker === -1 || srcMarker === 2) { mergeHostAttribute(dst, srcMarker, item, null, src[++i25]); } else { mergeHostAttribute(dst, srcMarker, item, null, null); } } } } return dst; } function mergeHostAttribute(dst, marker, key1, key2, value) { let i25 = 0; let markerInsertPosition = dst.length; if (marker === -1) { markerInsertPosition = -1; } else { while (i25 < dst.length) { const dstValue = dst[i25++]; if (typeof dstValue === "number") { if (dstValue === marker) { markerInsertPosition = -1; break; } else if (dstValue > marker) { markerInsertPosition = i25 - 1; break; } } } } while (i25 < dst.length) { const item = dst[i25]; if (typeof item === "number") { break; } else if (item === key1) { { if (value !== null) { dst[i25 + 1] = value; } return; } } i25++; if (value !== null) i25++; } if (markerInsertPosition !== -1) { dst.splice(markerInsertPosition, 0, marker); i25 = markerInsertPosition + 1; } dst.splice(i25++, 0, key1); if (value !== null) { dst.splice(i25++, 0, value); } } function hasParentInjector(parentLocation) { return parentLocation !== NO_PARENT_INJECTOR; } function getParentInjectorIndex(parentLocation) { if (ngDevMode) { assertNumber(parentLocation, "Number expected"); assertNotEqual(parentLocation, -1, "Not a valid state."); const parentInjectorIndex = parentLocation & 32767; assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, "Parent injector must be pointing past HEADER_OFFSET."); } return parentLocation & 32767; } function getParentInjectorViewOffset(parentLocation) { return parentLocation >> 16; } function getParentInjectorView(location2, startView) { let viewOffset = getParentInjectorViewOffset(location2); let parentView = startView; while (viewOffset > 0) { parentView = parentView[DECLARATION_VIEW]; viewOffset--; } return parentView; } var includeViewProviders = true; function setIncludeViewProviders(v7) { const oldValue = includeViewProviders; includeViewProviders = v7; return oldValue; } var BLOOM_SIZE = 256; var BLOOM_MASK = BLOOM_SIZE - 1; var BLOOM_BUCKET_BITS = 5; var nextNgElementId = 0; var NOT_FOUND2 = {}; function bloomAdd(injectorIndex, tView, type) { ngDevMode && assertEqual(tView.firstCreatePass, true, "expected firstCreatePass to be true"); let id; if (typeof type === "string") { id = type.charCodeAt(0) || 0; } else if (type.hasOwnProperty(NG_ELEMENT_ID)) { id = type[NG_ELEMENT_ID]; } if (id == null) { id = type[NG_ELEMENT_ID] = nextNgElementId++; } const bloomHash = id & BLOOM_MASK; const mask = 1 << bloomHash; tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask; } function getOrCreateNodeInjectorForNode(tNode, lView) { const existingInjectorIndex = getInjectorIndex(tNode, lView); if (existingInjectorIndex !== -1) { return existingInjectorIndex; } const tView = lView[TVIEW]; if (tView.firstCreatePass) { tNode.injectorIndex = lView.length; insertBloom(tView.data, tNode); insertBloom(lView, null); insertBloom(tView.blueprint, null); } const parentLoc = getParentInjectorLocation(tNode, lView); const injectorIndex = tNode.injectorIndex; if (hasParentInjector(parentLoc)) { const parentIndex = getParentInjectorIndex(parentLoc); const parentLView = getParentInjectorView(parentLoc, lView); const parentData = parentLView[TVIEW].data; for (let i25 = 0; i25 < 8; i25++) { lView[injectorIndex + i25] = parentLView[parentIndex + i25] | parentData[parentIndex + i25]; } } lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] = parentLoc; return injectorIndex; } function insertBloom(arr, footer) { arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer); } function getInjectorIndex(tNode, lView) { if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been // copied down from the parent node. No injector has been created yet on this node. tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values // might not have been calculated yet for this instance lView[ tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ] === null) { return -1; } else { ngDevMode && assertIndexInRange(lView, tNode.injectorIndex); return tNode.injectorIndex; } } function getParentInjectorLocation(tNode, lView) { if (tNode.parent && tNode.parent.injectorIndex !== -1) { return tNode.parent.injectorIndex; } let declarationViewOffset = 0; let parentTNode = null; let lViewCursor = lView; while (lViewCursor !== null) { parentTNode = getTNodeFromLView(lViewCursor); if (parentTNode === null) { return NO_PARENT_INJECTOR; } ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]); declarationViewOffset++; lViewCursor = lViewCursor[DECLARATION_VIEW]; if (parentTNode.injectorIndex !== -1) { return parentTNode.injectorIndex | declarationViewOffset << 16; } } return NO_PARENT_INJECTOR; } function diPublicInInjector(injectorIndex, tView, token) { bloomAdd(injectorIndex, tView, token); } function injectAttributeImpl(tNode, attrNameToInject) { ngDevMode && assertTNodeType( tNode, 12 | 3 /* TNodeType.AnyRNode */ ); ngDevMode && assertDefined(tNode, "expecting tNode"); if (attrNameToInject === "class") { return tNode.classes; } if (attrNameToInject === "style") { return tNode.styles; } const attrs = tNode.attrs; if (attrs) { const attrsLength = attrs.length; let i25 = 0; while (i25 < attrsLength) { const value = attrs[i25]; if (isNameOnlyAttributeMarker(value)) break; if (value === 0) { i25 = i25 + 2; } else if (typeof value === "number") { i25++; while (i25 < attrsLength && typeof attrs[i25] === "string") { i25++; } } else if (value === attrNameToInject) { return attrs[i25 + 1]; } else { i25 = i25 + 2; } } } return null; } function notFoundValueOrThrow(notFoundValue, token, flags) { if (flags & 8 || notFoundValue !== void 0) { return notFoundValue; } else { throwProviderNotFoundError(token, "NodeInjector"); } } function lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) { if (flags & 8 && notFoundValue === void 0) { notFoundValue = null; } if ((flags & (2 | 1)) === 0) { const moduleInjector = lView[INJECTOR]; const previousInjectImplementation = setInjectImplementation(void 0); try { if (moduleInjector) { return moduleInjector.get( token, notFoundValue, flags & 8 /* InternalInjectFlags.Optional */ ); } else { return injectRootLimpMode( token, notFoundValue, flags & 8 /* InternalInjectFlags.Optional */ ); } } finally { setInjectImplementation(previousInjectImplementation); } } return notFoundValueOrThrow(notFoundValue, token, flags); } function getOrCreateInjectable(tNode, lView, token, flags = 0, notFoundValue) { if (tNode !== null) { if (lView[FLAGS] & 2048 && // The token must be present on the current node injector when the `Self` // flag is set, so the lookup on embedded view injector(s) can be skipped. !(flags & 2)) { const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND2); if (embeddedInjectorValue !== NOT_FOUND2) { return embeddedInjectorValue; } } const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND2); if (value !== NOT_FOUND2) { return value; } } return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } function lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) { const bloomHash = bloomHashBitOrFactory(token); if (typeof bloomHash === "function") { if (!enterDI(lView, tNode, flags)) { return flags & 1 ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue); } try { let value; if (ngDevMode) { runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => { emitInjectorToCreateInstanceEvent(token); value = bloomHash(flags); emitInstanceCreatedByInjectorEvent(value); }); } else { value = bloomHash(flags); } if (value == null && !(flags & 8)) { throwProviderNotFoundError(token); } else { return value; } } finally { leaveDI(); } } else if (typeof bloomHash === "number") { let previousTView = null; let injectorIndex = getInjectorIndex(tNode, lView); let parentLocation = NO_PARENT_INJECTOR; let hostTElementNode = flags & 1 ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null; if (injectorIndex === -1 || flags & 4) { parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) { injectorIndex = -1; } else { previousTView = lView[TVIEW]; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } } while (injectorIndex !== -1) { ngDevMode && assertNodeInjector(lView, injectorIndex); const tView = lView[TVIEW]; ngDevMode && assertTNodeForLView(tView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ], lView); if (bloomHasToken(bloomHash, injectorIndex, tView.data)) { const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode); if (instance !== NOT_FOUND2) { return instance; } } parentLocation = lView[ injectorIndex + 8 /* NodeInjectorOffset.PARENT */ ]; if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) { previousTView = tView; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } else { injectorIndex = -1; } } } return notFoundValue; } function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) { const currentTView = lView[TVIEW]; const tNode = currentTView.data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; const canAccessViewProviders = previousTView == null ? ( // 1) This is the first invocation `previousTView == null` which means that we are at the // `TNode` of where injector is starting to look. In such a case the only time we are allowed // to look into the ViewProviders is if: // - we are on a component // - AND the injector set `includeViewProviders` to true (implying that the token can see // ViewProviders because it is the Component or a Service which itself was declared in // ViewProviders) isComponentHost(tNode) && includeViewProviders ) : ( // 2) `previousTView != null` which means that we are now walking across the parent nodes. // In such a case we are only allowed to look into the ViewProviders if: // - We just crossed from child View to Parent View `previousTView != currentTView` // - AND the parent TNode is an Element. // This means that we just came from the Component's View and therefore are allowed to see // into the ViewProviders. previousTView != currentTView && (tNode.type & 3) !== 0 ); const isHostSpecialCase = flags & 1 && hostTElementNode === tNode; const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase); if (injectableIdx !== null) { return getNodeInjectable(lView, currentTView, injectableIdx, tNode, flags); } else { return NOT_FOUND2; } } function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) { const nodeProviderIndexes = tNode.providerIndexes; const tInjectables = tView.data; const injectablesStart = nodeProviderIndexes & 1048575; const directivesStart = tNode.directiveStart; const directiveEnd = tNode.directiveEnd; const cptViewProvidersCount = nodeProviderIndexes >> 20; const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount; const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd; for (let i25 = startingIndex; i25 < endIndex; i25++) { const providerTokenOrDef = tInjectables[i25]; if (i25 < directivesStart && token === providerTokenOrDef || i25 >= directivesStart && providerTokenOrDef.type === token) { return i25; } } if (isHostSpecialCase) { const dirDef = tInjectables[directivesStart]; if (dirDef && isComponentDef(dirDef) && dirDef.type === token) { return directivesStart; } } return null; } var injectionPath = []; function getNodeInjectable(lView, tView, index, tNode, flags) { let value = lView[index]; const tData = tView.data; if (value instanceof NodeInjectorFactory) { const factory = value; ngDevMode && injectionPath.push(factory.name ?? "unknown"); if (factory.resolving) { const token2 = stringifyForError(tData[index]); if (ngDevMode) { throw cyclicDependencyErrorWithDetails(token2, injectionPath); } else { throw cyclicDependencyError(token2); } } const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders); factory.resolving = true; const token = tData[index].type || tData[index]; let prevInjectContext; if (ngDevMode) { const injector = new NodeInjector(tNode, lView); prevInjectContext = setInjectorProfilerContext({ injector, token }); } const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null; const success = enterDI( lView, tNode, 0 /* InternalInjectFlags.Default */ ); ngDevMode && assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed."); try { ngDevMode && emitInjectorToCreateInstanceEvent(token); value = lView[index] = factory.factory(void 0, flags, tData, lView, tNode); ngDevMode && emitInstanceCreatedByInjectorEvent(value); if (tView.firstCreatePass && index >= tNode.directiveStart) { ngDevMode && assertDirectiveDef(tData[index]); registerPreOrderHooks(index, tData[index], tView); } } finally { ngDevMode && setInjectorProfilerContext(prevInjectContext); previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation); setIncludeViewProviders(previousIncludeViewProviders); factory.resolving = false; leaveDI(); ngDevMode && (injectionPath = []); } } return value; } function bloomHashBitOrFactory(token) { ngDevMode && assertDefined(token, "token must be defined"); if (typeof token === "string") { return token.charCodeAt(0) || 0; } const tokenId = ( // First check with `hasOwnProperty` so we don't get an inherited ID. token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : void 0 ); if (typeof tokenId === "number") { if (tokenId >= 0) { return tokenId & BLOOM_MASK; } else { ngDevMode && assertEqual(tokenId, -1, "Expecting to get Special Injector Id"); return createNodeInjector; } } else { return tokenId; } } function bloomHasToken(bloomHash, injectorIndex, injectorView) { const mask = 1 << bloomHash; const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)]; return !!(value & mask); } function shouldSearchParent(flags, isFirstHostTNode) { return !(flags & 2) && !(flags & 1 && isFirstHostTNode); } function getNodeInjectorLView(nodeInjector) { return nodeInjector._lView; } function getNodeInjectorTNode(nodeInjector) { return nodeInjector._tNode; } var NodeInjector = class { _tNode; _lView; constructor(_tNode, _lView) { this._tNode = _tNode; this._lView = _lView; } get(token, notFoundValue, flags) { return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue); } }; function createNodeInjector() { return new NodeInjector(getCurrentTNode(), getLView()); } function \u0275\u0275getInheritedFactory(type) { return noSideEffects(() => { const ownConstructor = type.prototype.constructor; const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor); const objectPrototype = Object.prototype; let parent2 = Object.getPrototypeOf(type.prototype).constructor; while (parent2 && parent2 !== objectPrototype) { const factory = parent2[NG_FACTORY_DEF] || getFactoryOf(parent2); if (factory && factory !== ownFactory) { return factory; } parent2 = Object.getPrototypeOf(parent2); } return (t44) => new t44(); }); } function getFactoryOf(type) { if (isForwardRef(type)) { return () => { const factory = getFactoryOf(resolveForwardRef(type)); return factory && factory(); }; } return getFactoryDef(type); } function lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) { let currentTNode = tNode; let currentLView = lView; while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 && !isRootView(currentLView)) { ngDevMode && assertTNodeForLView(currentTNode, currentLView); const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | 2, NOT_FOUND2); if (nodeInjectorValue !== NOT_FOUND2) { return nodeInjectorValue; } let parentTNode = currentTNode.parent; if (!parentTNode) { const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR]; if (embeddedViewInjector) { const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND2, flags); if (embeddedViewInjectorValue !== NOT_FOUND2) { return embeddedViewInjectorValue; } } parentTNode = getTNodeFromLView(currentLView); currentLView = currentLView[DECLARATION_VIEW]; } currentTNode = parentTNode; } return notFoundValue; } function getTNodeFromLView(lView) { const tView = lView[TVIEW]; const tViewType = tView.type; if (tViewType === 2) { ngDevMode && assertDefined(tView.declTNode, "Embedded TNodes should have declaration parents."); return tView.declTNode; } else if (tViewType === 1) { return lView[T_HOST]; } return null; } function \u0275\u0275injectAttribute(attrNameToInject) { return injectAttributeImpl(getCurrentTNode(), attrNameToInject); } var Attribute = makeParamDecorator("Attribute", (attributeName) => ({ attributeName, __NG_ELEMENT_ID__: () => \u0275\u0275injectAttribute(attributeName) })); var _reflect = null; function getReflect() { return _reflect = _reflect || new ReflectionCapabilities(); } function reflectDependencies(type) { return convertDependencies(getReflect().parameters(type)); } function convertDependencies(deps) { return deps.map((dep) => reflectDependency(dep)); } function reflectDependency(dep) { const meta = { token: null, attribute: null, host: false, optional: false, self: false, skipSelf: false }; if (Array.isArray(dep) && dep.length > 0) { for (let j3 = 0; j3 < dep.length; j3++) { const param = dep[j3]; if (param === void 0) { continue; } const proto = Object.getPrototypeOf(param); if (param instanceof Optional || proto.ngMetadataName === "Optional") { meta.optional = true; } else if (param instanceof SkipSelf || proto.ngMetadataName === "SkipSelf") { meta.skipSelf = true; } else if (param instanceof Self || proto.ngMetadataName === "Self") { meta.self = true; } else if (param instanceof Host || proto.ngMetadataName === "Host") { meta.host = true; } else if (param instanceof Inject) { meta.token = param.token; } else if (param instanceof Attribute) { if (param.attributeName === void 0) { throw new RuntimeError(204, ngDevMode && `Attribute name must be defined.`); } meta.attribute = param.attributeName; } else { meta.token = param; } } } else if (dep === void 0 || Array.isArray(dep) && dep.length === 0) { meta.token = null; } else { meta.token = dep; } return meta; } function compileInjectable(type, meta) { let ngInjectableDef = null; let ngFactoryDef = null; if (!type.hasOwnProperty(NG_PROV_DEF)) { Object.defineProperty(type, NG_PROV_DEF, { get: () => { if (ngInjectableDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/\u0275prov.js`, getInjectableMetadata(type, meta)); } return ngInjectableDef; } }); } if (!type.hasOwnProperty(NG_FACTORY_DEF)) { Object.defineProperty(type, NG_FACTORY_DEF, { get: () => { if (ngFactoryDef === null) { const compiler = getCompilerFacade({ usage: 0, kind: "injectable", type }); ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/\u0275fac.js`, { name: type.name, type, typeArgumentCount: 0, // In JIT mode types are not available nor used. deps: reflectDependencies(type), target: compiler.FactoryTarget.Injectable }); } return ngFactoryDef; }, // Leave this configurable so that the factories from directives or pipes can take precedence. configurable: true }); } } var USE_VALUE2 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty }); function isUseClassProvider(meta) { return meta.useClass !== void 0; } function isUseValueProvider(meta) { return USE_VALUE2 in meta; } function isUseFactoryProvider(meta) { return meta.useFactory !== void 0; } function isUseExistingProvider(meta) { return meta.useExisting !== void 0; } function getInjectableMetadata(type, srcMeta) { const meta = srcMeta || { providedIn: null }; const compilerMeta = { name: type.name, type, typeArgumentCount: 0, providedIn: meta.providedIn }; if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== void 0) { compilerMeta.deps = convertDependencies(meta.deps); } if (isUseClassProvider(meta)) { compilerMeta.useClass = meta.useClass; } else if (isUseValueProvider(meta)) { compilerMeta.useValue = meta.useValue; } else if (isUseFactoryProvider(meta)) { compilerMeta.useFactory = meta.useFactory; } else if (isUseExistingProvider(meta)) { compilerMeta.useExisting = meta.useExisting; } return compilerMeta; } var Injectable = makeDecorator("Injectable", void 0, void 0, void 0, (type, meta) => compileInjectable(type, meta)); function injectElementRef() { return createElementRef(getCurrentTNode(), getLView()); } function createElementRef(tNode, lView) { return new ElementRef(getNativeByTNode(tNode, lView)); } var ElementRef = class { /** *
*
Use with caution
*

* Use this API as the last resort when direct access to DOM is needed. Use templating and * data-binding provided by Angular instead. If used, it is recommended in combination with * {@link /best-practices/security#direct-use-of-the-dom-apis-and-explicit-sanitization-calls DomSanitizer} * for maxiumum security; *

*
*/ nativeElement; constructor(nativeElement) { this.nativeElement = nativeElement; } /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectElementRef; }; function unwrapElementRef(value) { return value instanceof ElementRef ? value.nativeElement : value; } function symbolIterator() { return this._results[Symbol.iterator](); } var QueryList = class { _emitDistinctChangesOnly; dirty = true; _onDirty = void 0; _results = []; _changesDetected = false; _changes = void 0; length = 0; first = void 0; last = void 0; /** * Returns `Observable` of `QueryList` notifying the subscriber of changes. */ get changes() { return this._changes ??= new Subject(); } /** * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in * the same result) */ constructor(_emitDistinctChangesOnly = false) { this._emitDistinctChangesOnly = _emitDistinctChangesOnly; } /** * Returns the QueryList entry at `index`. */ get(index) { return this._results[index]; } /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) */ map(fn) { return this._results.map(fn); } filter(fn) { return this._results.filter(fn); } /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) */ find(fn) { return this._results.find(fn); } /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) */ reduce(fn, init2) { return this._results.reduce(fn, init2); } /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) */ forEach(fn) { this._results.forEach(fn); } /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) */ some(fn) { return this._results.some(fn); } /** * Returns a copy of the internal results list as an Array. */ toArray() { return this._results.slice(); } toString() { return this._results.toString(); } /** * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that * on change detection, it will not notify of changes to the queries, unless a new change * occurs. * * @param resultsTree The query results to store * @param identityAccessor Optional function for extracting stable object identity from a value * in the array. This function is executed for each element of the query result list while * comparing current query list with the new one (provided as a first argument of the `reset` * function) to detect if the lists are different. If the function is not provided, elements * are compared as is (without any pre-processing). */ reset(resultsTree, identityAccessor) { this.dirty = false; const newResultFlat = flatten(resultsTree); if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) { this._results = newResultFlat; this.length = newResultFlat.length; this.last = newResultFlat[this.length - 1]; this.first = newResultFlat[0]; } } /** * Triggers a change event by emitting on the `changes` {@link EventEmitter}. */ notifyOnChanges() { if (this._changes !== void 0 && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.next(this); } /** @internal */ onDirty(cb) { this._onDirty = cb; } /** internal */ setDirty() { this.dirty = true; this._onDirty?.(); } /** internal */ destroy() { if (this._changes !== void 0) { this._changes.complete(); this._changes.unsubscribe(); } } [Symbol.iterator] = /* @__PURE__ */ (() => symbolIterator)(); }; function hasInSkipHydrationBlockFlag(tNode) { return (tNode.flags & 128) === 128; } var ChangeDetectionStrategy; (function(ChangeDetectionStrategy2) { ChangeDetectionStrategy2[ChangeDetectionStrategy2["OnPush"] = 0] = "OnPush"; ChangeDetectionStrategy2[ChangeDetectionStrategy2["Default"] = 1] = "Default"; })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {})); var TRACKED_LVIEWS = /* @__PURE__ */ new Map(); var uniqueIdCounter = 0; function getUniqueLViewId() { return uniqueIdCounter++; } function registerLView(lView) { ngDevMode && assertNumber(lView[ID], "LView must have an ID in order to be registered"); TRACKED_LVIEWS.set(lView[ID], lView); } function getLViewById(id) { ngDevMode && assertNumber(id, "ID used for LView lookup must be a number"); return TRACKED_LVIEWS.get(id) || null; } function unregisterLView(lView) { ngDevMode && assertNumber(lView[ID], "Cannot stop tracking an LView that does not have an ID"); TRACKED_LVIEWS.delete(lView[ID]); } function getTrackedLViews() { return TRACKED_LVIEWS; } var LContext = class { lViewId; nodeIndex; native; /** * The instance of the Component node. */ component; /** * The list of active directives that exist on this element. */ directives; /** * The map of local references (local reference name => element or directive instance) that * exist on this element. */ localRefs; /** Component's parent view data. */ get lView() { return getLViewById(this.lViewId); } constructor(lViewId, nodeIndex, native) { this.lViewId = lViewId; this.nodeIndex = nodeIndex; this.native = native; } }; function getLContext(target) { let mpValue = readPatchedData(target); if (mpValue) { if (isLView(mpValue)) { const lView = mpValue; let nodeIndex; let component = void 0; let directives = void 0; if (isComponentInstance(target)) { nodeIndex = findViaComponent(lView, target); if (nodeIndex == -1) { throw new Error("The provided component was not found in the application"); } component = target; } else if (isDirectiveInstance(target)) { nodeIndex = findViaDirective(lView, target); if (nodeIndex == -1) { throw new Error("The provided directive was not found in the application"); } directives = getDirectivesAtNodeIndex(nodeIndex, lView); } else { nodeIndex = findViaNativeElement(lView, target); if (nodeIndex == -1) { return null; } } const native = unwrapRNode(lView[nodeIndex]); const existingCtx = readPatchedData(native); const context2 = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native); if (component && context2.component === void 0) { context2.component = component; attachPatchData(context2.component, context2); } if (directives && context2.directives === void 0) { context2.directives = directives; for (let i25 = 0; i25 < directives.length; i25++) { attachPatchData(directives[i25], context2); } } attachPatchData(context2.native, context2); mpValue = context2; } } else { const rElement = target; ngDevMode && assertDomNode(rElement); let parent2 = rElement; while (parent2 = parent2.parentNode) { const parentContext = readPatchedData(parent2); if (parentContext) { const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView; if (!lView) { return null; } const index = findViaNativeElement(lView, rElement); if (index >= 0) { const native = unwrapRNode(lView[index]); const context2 = createLContext(lView, index, native); attachPatchData(native, context2); mpValue = context2; break; } } } } return mpValue || null; } function createLContext(lView, nodeIndex, native) { return new LContext(lView[ID], nodeIndex, native); } function getComponentViewByInstance(componentInstance) { let patchedData = readPatchedData(componentInstance); let lView; if (isLView(patchedData)) { const contextLView = patchedData; const nodeIndex = findViaComponent(contextLView, componentInstance); lView = getComponentLViewByIndex(nodeIndex, contextLView); const context2 = createLContext(contextLView, nodeIndex, lView[HOST]); context2.component = componentInstance; attachPatchData(componentInstance, context2); attachPatchData(context2.native, context2); } else { const context2 = patchedData; const contextLView = context2.lView; ngDevMode && assertLView(contextLView); lView = getComponentLViewByIndex(context2.nodeIndex, contextLView); } return lView; } var MONKEY_PATCH_KEY_NAME = "__ngContext__"; function attachPatchData(target, data) { ngDevMode && assertDefined(target, "Target expected"); if (isLView(data)) { target[MONKEY_PATCH_KEY_NAME] = data[ID]; registerLView(data); } else { target[MONKEY_PATCH_KEY_NAME] = data; } } function readPatchedData(target) { ngDevMode && assertDefined(target, "Target expected"); const data = target[MONKEY_PATCH_KEY_NAME]; return typeof data === "number" ? getLViewById(data) : data || null; } function readPatchedLView(target) { const value = readPatchedData(target); if (value) { return isLView(value) ? value : value.lView; } return null; } function isComponentInstance(instance) { return instance && instance.constructor && instance.constructor.\u0275cmp; } function isDirectiveInstance(instance) { return instance && instance.constructor && instance.constructor.\u0275dir; } function findViaNativeElement(lView, target) { const tView = lView[TVIEW]; for (let i25 = HEADER_OFFSET; i25 < tView.bindingStartIndex; i25++) { if (unwrapRNode(lView[i25]) === target) { return i25; } } return -1; } function traverseNextElement(tNode) { if (tNode.child) { return tNode.child; } else if (tNode.next) { return tNode.next; } else { while (tNode.parent && !tNode.parent.next) { tNode = tNode.parent; } return tNode.parent && tNode.parent.next; } } function findViaComponent(lView, componentInstance) { const componentIndices = lView[TVIEW].components; if (componentIndices) { for (let i25 = 0; i25 < componentIndices.length; i25++) { const elementComponentIndex = componentIndices[i25]; const componentView = getComponentLViewByIndex(elementComponentIndex, lView); if (componentView[CONTEXT] === componentInstance) { return elementComponentIndex; } } } else { const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView); const rootComponent = rootComponentView[CONTEXT]; if (rootComponent === componentInstance) { return HEADER_OFFSET; } } return -1; } function findViaDirective(lView, directiveInstance) { let tNode = lView[TVIEW].firstChild; while (tNode) { const directiveIndexStart = tNode.directiveStart; const directiveIndexEnd = tNode.directiveEnd; for (let i25 = directiveIndexStart; i25 < directiveIndexEnd; i25++) { if (lView[i25] === directiveInstance) { return tNode.index; } } tNode = traverseNextElement(tNode); } return -1; } function getDirectivesAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; if (tNode.directiveStart === 0) return EMPTY_ARRAY; const results = []; for (let i25 = tNode.directiveStart; i25 < tNode.directiveEnd; i25++) { const directiveInstance = lView[i25]; if (!isComponentInstance(directiveInstance)) { results.push(directiveInstance); } } return results; } function getComponentAtNodeIndex(nodeIndex, lView) { const tNode = lView[TVIEW].data[nodeIndex]; return isComponentHost(tNode) ? lView[tNode.directiveStart + tNode.componentOffset] : null; } function getRootView(componentOrLView) { ngDevMode && assertDefined(componentOrLView, "component"); let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView); while (lView && !isRootView(lView)) { lView = getLViewParent(lView); } ngDevMode && assertLView(lView); return lView; } function getRootContext(viewOrComponent) { const rootView = getRootView(viewOrComponent); ngDevMode && assertDefined(rootView[CONTEXT], "Root view has no context. Perhaps it is disconnected?"); return rootView[CONTEXT]; } function getFirstLContainer(lView) { return getNearestLContainer(lView[CHILD_HEAD]); } function getNextLContainer(container) { return getNearestLContainer(container[NEXT]); } function getNearestLContainer(viewOrContainer) { while (viewOrContainer !== null && !isLContainer(viewOrContainer)) { viewOrContainer = viewOrContainer[NEXT]; } return viewOrContainer; } function getComponent(element) { ngDevMode && assertDomElement(element); const context2 = getLContext(element); if (context2 === null) return null; if (context2.component === void 0) { const lView = context2.lView; if (lView === null) { return null; } context2.component = getComponentAtNodeIndex(context2.nodeIndex, lView); } return context2.component; } function getContext(element) { assertDomElement(element); const context2 = getLContext(element); const lView = context2 ? context2.lView : null; return lView === null ? null : lView[CONTEXT]; } function getOwningComponent(elementOrDir) { const context2 = getLContext(elementOrDir); let lView = context2 ? context2.lView : null; if (lView === null) return null; let parent2; while (lView[TVIEW].type === 2 && (parent2 = getLViewParent(lView))) { lView = parent2; } return isRootView(lView) ? null : lView[CONTEXT]; } function getRootComponents(elementOrDir) { const lView = readPatchedLView(elementOrDir); return lView !== null ? [getRootContext(lView)] : []; } function getInjector(elementOrDir) { const context2 = getLContext(elementOrDir); const lView = context2 ? context2.lView : null; if (lView === null) return Injector.NULL; const tNode = lView[TVIEW].data[context2.nodeIndex]; return new NodeInjector(tNode, lView); } function getDirectives(node) { if (node instanceof Text) { return []; } const context2 = getLContext(node); const lView = context2 ? context2.lView : null; if (lView === null) { return []; } const tView = lView[TVIEW]; const nodeIndex = context2.nodeIndex; if (!tView?.data[nodeIndex]) { return []; } if (context2.directives === void 0) { context2.directives = getDirectivesAtNodeIndex(nodeIndex, lView); } return context2.directives === null ? [] : [...context2.directives]; } var Framework; (function(Framework2) { Framework2["Angular"] = "angular"; Framework2["ACX"] = "acx"; Framework2["Wiz"] = "wiz"; })(Framework || (Framework = {})); var AcxChangeDetectionStrategy; (function(AcxChangeDetectionStrategy2) { AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["Default"] = 0] = "Default"; AcxChangeDetectionStrategy2[AcxChangeDetectionStrategy2["OnPush"] = 1] = "OnPush"; })(AcxChangeDetectionStrategy || (AcxChangeDetectionStrategy = {})); var AcxViewEncapsulation; (function(AcxViewEncapsulation2) { AcxViewEncapsulation2[AcxViewEncapsulation2["Emulated"] = 0] = "Emulated"; AcxViewEncapsulation2[AcxViewEncapsulation2["None"] = 1] = "None"; })(AcxViewEncapsulation || (AcxViewEncapsulation = {})); function getDirectiveMetadata$1(directiveOrComponentInstance) { const { constructor } = directiveOrComponentInstance; if (!constructor) { throw new Error("Unable to find the instance constructor"); } const componentDef = getComponentDef(constructor); if (componentDef) { const inputs = extractInputDebugMetadata(componentDef.inputs); return { inputs, outputs: componentDef.outputs, encapsulation: componentDef.encapsulation, changeDetection: componentDef.onPush ? ChangeDetectionStrategy.OnPush : ChangeDetectionStrategy.Default }; } const directiveDef = getDirectiveDef(constructor); if (directiveDef) { const inputs = extractInputDebugMetadata(directiveDef.inputs); return { inputs, outputs: directiveDef.outputs }; } return null; } function getHostElement(componentOrDirective) { return getLContext(componentOrDirective).native; } function getListeners(element) { ngDevMode && assertDomElement(element); const lContext = getLContext(element); const lView = lContext === null ? null : lContext.lView; if (lView === null) return []; const tView = lView[TVIEW]; const lCleanup = lView[CLEANUP]; const tCleanup = tView.cleanup; const listeners = []; if (tCleanup && lCleanup) { for (let i25 = 0; i25 < tCleanup.length; ) { const firstParam = tCleanup[i25++]; const secondParam = tCleanup[i25++]; if (typeof firstParam === "string") { const name5 = firstParam; const listenerElement = unwrapRNode(lView[secondParam]); const callback2 = lCleanup[tCleanup[i25++]]; const useCaptureOrIndx = tCleanup[i25++]; const type = typeof useCaptureOrIndx === "boolean" || useCaptureOrIndx >= 0 ? "dom" : "output"; const useCapture = typeof useCaptureOrIndx === "boolean" ? useCaptureOrIndx : false; if (element == listenerElement) { listeners.push({ element, name: name5, callback: callback2, useCapture, type }); } } } } listeners.sort(sortListeners); return listeners; } function sortListeners(a45, b7) { if (a45.name == b7.name) return 0; return a45.name < b7.name ? -1 : 1; } function assertDomElement(value) { if (typeof Element !== "undefined" && !(value instanceof Element)) { throw new Error("Expecting instance of DOM Element"); } } function extractInputDebugMetadata(inputs) { const res = {}; for (const key in inputs) { if (inputs.hasOwnProperty(key)) { const value = inputs[key]; if (value !== void 0) { res[key] = value[0]; } } } return res; } var DOCUMENT2 = void 0; function setDocument(document2) { DOCUMENT2 = document2; } function getDocument() { if (DOCUMENT2 !== void 0) { return DOCUMENT2; } else if (typeof document !== "undefined") { return document; } throw new RuntimeError(210, (typeof ngDevMode === "undefined" || ngDevMode) && `The document object is not available in this context. Make sure the DOCUMENT injection token is provided.`); } var APP_ID = new InjectionToken(ngDevMode ? "AppId" : "", { providedIn: "root", factory: () => DEFAULT_APP_ID }); var DEFAULT_APP_ID = "ng"; var PLATFORM_INITIALIZER = new InjectionToken(ngDevMode ? "Platform Initializer" : ""); var PLATFORM_ID = new InjectionToken(ngDevMode ? "Platform ID" : "", { providedIn: "platform", factory: () => "unknown" // set a default platform name, when none set explicitly }); var PACKAGE_ROOT_URL = new InjectionToken(ngDevMode ? "Application Packages Root URL" : ""); var ANIMATION_MODULE_TYPE = new InjectionToken(ngDevMode ? "AnimationModuleType" : ""); var CSP_NONCE = new InjectionToken(ngDevMode ? "CSP nonce" : "", { providedIn: "root", factory: () => { return getDocument().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce") || null; } }); var IMAGE_CONFIG_DEFAULTS = { breakpoints: [16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840], placeholderResolution: 30, disableImageSizeWarning: false, disableImageLazyLoadWarning: false }; var IMAGE_CONFIG = new InjectionToken(ngDevMode ? "ImageConfig" : "", { providedIn: "root", factory: () => IMAGE_CONFIG_DEFAULTS }); function makeStateKey(key) { return key; } function initTransferState() { const transferState = new TransferState(); if (true) { transferState.store = retrieveTransferredState(getDocument(), inject2(APP_ID)); } return transferState; } var TransferState = class _TransferState { /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _TransferState, providedIn: "root", factory: initTransferState }) ); /** @internal */ store = {}; onSerializeCallbacks = {}; /** * Get the value corresponding to a key. Return `defaultValue` if key is not found. */ get(key, defaultValue) { return this.store[key] !== void 0 ? this.store[key] : defaultValue; } /** * Set the value corresponding to a key. */ set(key, value) { this.store[key] = value; } /** * Remove a key from the store. */ remove(key) { delete this.store[key]; } /** * Test whether a key exists in the store. */ hasKey(key) { return this.store.hasOwnProperty(key); } /** * Indicates whether the state is empty. */ get isEmpty() { return Object.keys(this.store).length === 0; } /** * Register a callback to provide the value for a key when `toJson` is called. */ onSerialize(key, callback2) { this.onSerializeCallbacks[key] = callback2; } /** * Serialize the current state of the store to JSON. */ toJson() { for (const key in this.onSerializeCallbacks) { if (this.onSerializeCallbacks.hasOwnProperty(key)) { try { this.store[key] = this.onSerializeCallbacks[key](); } catch (e56) { console.warn("Exception in onSerialize callback: ", e56); } } } return JSON.stringify(this.store).replace(/ PRESERVE_HOST_CONTENT_DEFAULT }); var IS_I18N_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_I18N_HYDRATION_ENABLED" : ""); var IS_EVENT_REPLAY_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_EVENT_REPLAY_ENABLED" : ""); var IS_INCREMENTAL_HYDRATION_ENABLED = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_INCREMENTAL_HYDRATION_ENABLED" : ""); var JSACTION_BLOCK_ELEMENT_MAP = new InjectionToken(ngDevMode ? "JSACTION_BLOCK_ELEMENT_MAP" : "", { providedIn: "root", factory: () => /* @__PURE__ */ new Map() }); var IS_ENABLED_BLOCKING_INITIAL_NAVIGATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "IS_ENABLED_BLOCKING_INITIAL_NAVIGATION" : ""); var eventListenerOptions = { passive: true, capture: true }; var hoverTriggers = /* @__PURE__ */ new WeakMap(); var interactionTriggers = /* @__PURE__ */ new WeakMap(); var viewportTriggers = /* @__PURE__ */ new WeakMap(); var interactionEventNames = ["click", "keydown"]; var hoverEventNames = ["mouseenter", "mouseover", "focusin"]; var intersectionObserver = null; var observedViewportElements = 0; var DeferEventEntry = class { callbacks = /* @__PURE__ */ new Set(); listener = () => { for (const callback2 of this.callbacks) { callback2(); } }; }; function onInteraction(trigger2, callback2) { let entry = interactionTriggers.get(trigger2); if (!entry) { entry = new DeferEventEntry(); interactionTriggers.set(trigger2, entry); for (const name5 of interactionEventNames) { trigger2.addEventListener(name5, entry.listener, eventListenerOptions); } } entry.callbacks.add(callback2); return () => { const { callbacks, listener } = entry; callbacks.delete(callback2); if (callbacks.size === 0) { interactionTriggers.delete(trigger2); for (const name5 of interactionEventNames) { trigger2.removeEventListener(name5, listener, eventListenerOptions); } } }; } function onHover(trigger2, callback2) { let entry = hoverTriggers.get(trigger2); if (!entry) { entry = new DeferEventEntry(); hoverTriggers.set(trigger2, entry); for (const name5 of hoverEventNames) { trigger2.addEventListener(name5, entry.listener, eventListenerOptions); } } entry.callbacks.add(callback2); return () => { const { callbacks, listener } = entry; callbacks.delete(callback2); if (callbacks.size === 0) { for (const name5 of hoverEventNames) { trigger2.removeEventListener(name5, listener, eventListenerOptions); } hoverTriggers.delete(trigger2); } }; } function createIntersectionObserver() { return new IntersectionObserver((entries) => { for (const current of entries) { if (current.isIntersecting && viewportTriggers.has(current.target)) { viewportTriggers.get(current.target).listener(); } } }); } function onViewport(trigger2, callback2, observerFactoryFn) { let entry = viewportTriggers.get(trigger2); intersectionObserver = intersectionObserver || observerFactoryFn(); if (!entry) { entry = new DeferEventEntry(); intersectionObserver.observe(trigger2); viewportTriggers.set(trigger2, entry); observedViewportElements++; } entry.callbacks.add(callback2); return () => { if (!viewportTriggers.has(trigger2)) { return; } entry.callbacks.delete(callback2); if (entry.callbacks.size === 0) { intersectionObserver?.unobserve(trigger2); viewportTriggers.delete(trigger2); observedViewportElements--; } if (observedViewportElements === 0) { intersectionObserver?.disconnect(); intersectionObserver = null; } }; } var JSACTION_EVENT_CONTRACT = new InjectionToken(ngDevMode ? "EVENT_CONTRACT_DETAILS" : "", { providedIn: "root", factory: () => ({}) }); var _stashEventListenerImpl = (lView, target, eventName, wrappedListener) => { }; function stashEventListenerImpl(lView, target, eventName, wrappedListener) { _stashEventListenerImpl(lView, target, eventName, wrappedListener); } var DEHYDRATED_BLOCK_REGISTRY = new InjectionToken(ngDevMode ? "DEHYDRATED_BLOCK_REGISTRY" : ""); function isDetachedByI18n(tNode) { return (tNode.flags & 32) === 32; } var TRANSFER_STATE_TOKEN_ID = "__nghData__"; var NGH_DATA_KEY = makeStateKey(TRANSFER_STATE_TOKEN_ID); var TRANSFER_STATE_DEFER_BLOCKS_INFO = "__nghDeferData__"; var NGH_DEFER_BLOCKS_KEY = makeStateKey(TRANSFER_STATE_DEFER_BLOCKS_INFO); function isInternalHydrationTransferStateKey(key) { return key === TRANSFER_STATE_TOKEN_ID || key === TRANSFER_STATE_DEFER_BLOCKS_INFO; } var _retrieveHydrationInfoImpl = () => null; function retrieveHydrationInfo(rNode, injector, isRootView2 = false) { return _retrieveHydrationInfoImpl(rNode, injector, isRootView2); } function getLNodeForHydration(viewRef) { let lView = viewRef._lView; const tView = lView[TVIEW]; if (tView.type === 2) { return null; } if (isRootView(lView)) { lView = lView[HEADER_OFFSET]; } return lView; } var HydrationStatus; (function(HydrationStatus2) { HydrationStatus2["Hydrated"] = "hydrated"; HydrationStatus2["Skipped"] = "skipped"; HydrationStatus2["Mismatched"] = "mismatched"; })(HydrationStatus || (HydrationStatus = {})); var HYDRATION_INFO_KEY = "__ngDebugHydrationInfo__"; function patchHydrationInfo(node, info) { node[HYDRATION_INFO_KEY] = info; } function markRNodeAsHavingHydrationMismatch(node, expectedNodeDetails = null, actualNodeDetails = null) { if (!ngDevMode) { throw new Error("Calling `markRNodeAsMismatchedByHydration` in prod mode is not supported and likely a mistake."); } while (node && !getComponent(node)) { node = node?.parentNode; } if (node) { patchHydrationInfo(node, { status: HydrationStatus.Mismatched, expectedNodeDetails, actualNodeDetails }); } } function isIncrementalHydrationEnabled(injector) { return injector.get(IS_INCREMENTAL_HYDRATION_ENABLED, false, { optional: true }); } function assertIncrementalHydrationIsConfigured(injector) { if (!isIncrementalHydrationEnabled(injector)) { throw new RuntimeError(508, "Angular has detected that some `@defer` blocks use `hydrate` triggers, but incremental hydration was not enabled. Please ensure that the `withIncrementalHydration()` call is added as an argument for the `provideClientHydration()` function call in your application config."); } } function assertSsrIdDefined(ssrUniqueId) { assertDefined(ssrUniqueId, "Internal error: expecting an SSR id for a defer block that should be hydrated, but the id is not present"); } function getParentBlockHydrationQueue(deferBlockId, injector) { const dehydratedBlockRegistry = injector.get(DEHYDRATED_BLOCK_REGISTRY); const transferState = injector.get(TransferState); const deferBlockParents = transferState.get(NGH_DEFER_BLOCKS_KEY, {}); let isTopMostDeferBlock = false; let currentBlockId = deferBlockId; let parentBlockPromise = null; const hydrationQueue = []; while (!isTopMostDeferBlock && currentBlockId) { ngDevMode && assertEqual(hydrationQueue.indexOf(currentBlockId), -1, "Internal error: defer block hierarchy has a cycle."); isTopMostDeferBlock = dehydratedBlockRegistry.has(currentBlockId); const hydratingParentBlock = dehydratedBlockRegistry.hydrating.get(currentBlockId); if (parentBlockPromise === null && hydratingParentBlock != null) { parentBlockPromise = hydratingParentBlock.promise; break; } hydrationQueue.unshift(currentBlockId); currentBlockId = deferBlockParents[currentBlockId][DEFER_PARENT_BLOCK_ID]; } return { parentBlockPromise, hydrationQueue }; } function refreshContentQueries(tView, lView) { const contentQueries = tView.contentQueries; if (contentQueries !== null) { const prevConsumer = setActiveConsumer(null); try { for (let i25 = 0; i25 < contentQueries.length; i25 += 2) { const queryStartIdx = contentQueries[i25]; const directiveDefIdx = contentQueries[i25 + 1]; if (directiveDefIdx !== -1) { const directiveDef = tView.data[directiveDefIdx]; ngDevMode && assertDefined(directiveDef, "DirectiveDef not found."); ngDevMode && assertDefined(directiveDef.contentQueries, "contentQueries function should be defined"); setCurrentQueryIndex(queryStartIdx); directiveDef.contentQueries(2, lView[directiveDefIdx], directiveDefIdx); } } } finally { setActiveConsumer(prevConsumer); } } } function executeViewQueryFn(flags, viewQueryFn, component) { ngDevMode && assertDefined(viewQueryFn, "View queries function to execute must be defined."); setCurrentQueryIndex(0); const prevConsumer = setActiveConsumer(null); try { viewQueryFn(flags, component); } finally { setActiveConsumer(prevConsumer); } } function executeContentQueries(tView, tNode, lView) { if (isContentQueryHost(tNode)) { const prevConsumer = setActiveConsumer(null); try { const start = tNode.directiveStart; const end = tNode.directiveEnd; for (let directiveIndex = start; directiveIndex < end; directiveIndex++) { const def = tView.data[directiveIndex]; if (def.contentQueries) { const directiveInstance = lView[directiveIndex]; ngDevMode && assertDefined(directiveIndex, "Incorrect reference to a directive defining a content query"); def.contentQueries(1, directiveInstance, directiveIndex); } } } finally { setActiveConsumer(prevConsumer); } } } var ViewEncapsulation; (function(ViewEncapsulation3) { ViewEncapsulation3[ViewEncapsulation3["Emulated"] = 0] = "Emulated"; ViewEncapsulation3[ViewEncapsulation3["None"] = 2] = "None"; ViewEncapsulation3[ViewEncapsulation3["ShadowDom"] = 3] = "ShadowDom"; })(ViewEncapsulation || (ViewEncapsulation = {})); var policy$1; function getPolicy$1() { if (policy$1 === void 0) { policy$1 = null; if (_global.trustedTypes) { try { policy$1 = _global.trustedTypes.createPolicy("angular", { createHTML: (s17) => s17, createScript: (s17) => s17, createScriptURL: (s17) => s17 }); } catch { } } } return policy$1; } function trustedHTMLFromString(html) { return getPolicy$1()?.createHTML(html) || html; } function trustedScriptURLFromString(url) { return getPolicy$1()?.createScriptURL(url) || url; } var policy; function getPolicy() { if (policy === void 0) { policy = null; if (_global.trustedTypes) { try { policy = _global.trustedTypes.createPolicy("angular#unsafe-bypass", { createHTML: (s17) => s17, createScript: (s17) => s17, createScriptURL: (s17) => s17 }); } catch { } } } return policy; } function trustedHTMLFromStringBypass(html) { return getPolicy()?.createHTML(html) || html; } function trustedScriptFromStringBypass(script) { return getPolicy()?.createScript(script) || script; } function trustedScriptURLFromStringBypass(url) { return getPolicy()?.createScriptURL(url) || url; } var SafeValueImpl = class { changingThisBreaksApplicationSecurity; constructor(changingThisBreaksApplicationSecurity) { this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; } toString() { return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${XSS_SECURITY_URL})`; } }; var SafeHtmlImpl = class extends SafeValueImpl { getTypeName() { return "HTML"; } }; var SafeStyleImpl = class extends SafeValueImpl { getTypeName() { return "Style"; } }; var SafeScriptImpl = class extends SafeValueImpl { getTypeName() { return "Script"; } }; var SafeUrlImpl = class extends SafeValueImpl { getTypeName() { return "URL"; } }; var SafeResourceUrlImpl = class extends SafeValueImpl { getTypeName() { return "ResourceURL"; } }; function unwrapSafeValue(value) { return value instanceof SafeValueImpl ? value.changingThisBreaksApplicationSecurity : value; } function allowSanitizationBypassAndThrow(value, type) { const actualType = getSanitizationBypassType(value); if (actualType != null && actualType !== type) { if (actualType === "ResourceURL" && type === "URL") return true; throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`); } return actualType === type; } function getSanitizationBypassType(value) { return value instanceof SafeValueImpl && value.getTypeName() || null; } function bypassSanitizationTrustHtml(trustedHtml) { return new SafeHtmlImpl(trustedHtml); } function bypassSanitizationTrustStyle(trustedStyle) { return new SafeStyleImpl(trustedStyle); } function bypassSanitizationTrustScript(trustedScript) { return new SafeScriptImpl(trustedScript); } function bypassSanitizationTrustUrl(trustedUrl) { return new SafeUrlImpl(trustedUrl); } function bypassSanitizationTrustResourceUrl(trustedResourceUrl) { return new SafeResourceUrlImpl(trustedResourceUrl); } function getInertBodyHelper(defaultDoc) { const inertDocumentHelper = new InertDocumentHelper(defaultDoc); return isDOMParserAvailable() ? new DOMParserHelper(inertDocumentHelper) : inertDocumentHelper; } var DOMParserHelper = class { inertDocumentHelper; constructor(inertDocumentHelper) { this.inertDocumentHelper = inertDocumentHelper; } getInertBodyElement(html) { html = "" + html; try { const body = new window.DOMParser().parseFromString(trustedHTMLFromString(html), "text/html").body; if (body === null) { return this.inertDocumentHelper.getInertBodyElement(html); } body.firstChild?.remove(); return body; } catch { return null; } } }; var InertDocumentHelper = class { defaultDoc; inertDocument; constructor(defaultDoc) { this.defaultDoc = defaultDoc; this.inertDocument = this.defaultDoc.implementation.createHTMLDocument("sanitization-inert"); } getInertBodyElement(html) { const templateEl = this.inertDocument.createElement("template"); templateEl.innerHTML = trustedHTMLFromString(html); return templateEl; } }; function isDOMParserAvailable() { try { return !!new window.DOMParser().parseFromString(trustedHTMLFromString(""), "text/html"); } catch { return false; } } var SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i; function _sanitizeUrl(url) { url = String(url); if (url.match(SAFE_URL_PATTERN)) return url; if (typeof ngDevMode === "undefined" || ngDevMode) { console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`); } return "unsafe:" + url; } function tagSet(tags) { const res = {}; for (const t44 of tags.split(",")) res[t44] = true; return res; } function merge2(...sets) { const res = {}; for (const s17 of sets) { for (const v7 in s17) { if (s17.hasOwnProperty(v7)) res[v7] = true; } } return res; } var VOID_ELEMENTS = tagSet("area,br,col,hr,img,wbr"); var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"); var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet("rp,rt"); var OPTIONAL_END_TAG_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); var BLOCK_ELEMENTS = merge2(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")); var INLINE_ELEMENTS = merge2(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")); var VALID_ELEMENTS = merge2(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); var URI_ATTRS = tagSet("background,cite,href,itemtype,longdesc,poster,src,xlink:href"); var HTML_ATTRS = tagSet("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"); var ARIA_ATTRS = tagSet("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"); var VALID_ATTRS = merge2(URI_ATTRS, HTML_ATTRS, ARIA_ATTRS); var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet("script,style,template"); var SanitizingHtmlSerializer = class { // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just // because characters were re-encoded. sanitizedSomething = false; buf = []; sanitizeChildren(el) { let current = el.firstChild; let traverseContent = true; let parentNodes = []; while (current) { if (current.nodeType === Node.ELEMENT_NODE) { traverseContent = this.startElement(current); } else if (current.nodeType === Node.TEXT_NODE) { this.chars(current.nodeValue); } else { this.sanitizedSomething = true; } if (traverseContent && current.firstChild) { parentNodes.push(current); current = getFirstChild(current); continue; } while (current) { if (current.nodeType === Node.ELEMENT_NODE) { this.endElement(current); } let next = getNextSibling(current); if (next) { current = next; break; } current = parentNodes.pop(); } } return this.buf.join(""); } /** * Sanitizes an opening element tag (if valid) and returns whether the element's contents should * be traversed. Element content must always be traversed (even if the element itself is not * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`. * * @param element The element to sanitize. * @return True if the element's contents should be traversed. */ startElement(element) { const tagName = getNodeName(element).toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { this.sanitizedSomething = true; return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName); } this.buf.push("<"); this.buf.push(tagName); const elAttrs = element.attributes; for (let i25 = 0; i25 < elAttrs.length; i25++) { const elAttr = elAttrs.item(i25); const attrName = elAttr.name; const lower = attrName.toLowerCase(); if (!VALID_ATTRS.hasOwnProperty(lower)) { this.sanitizedSomething = true; continue; } let value = elAttr.value; if (URI_ATTRS[lower]) value = _sanitizeUrl(value); this.buf.push(" ", attrName, '="', encodeEntities(value), '"'); } this.buf.push(">"); return true; } endElement(current) { const tagName = getNodeName(current).toLowerCase(); if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { this.buf.push(""); } } chars(chars2) { this.buf.push(encodeEntities(chars2)); } }; function isClobberedElement(parentNode, childNode) { return (parentNode.compareDocumentPosition(childNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) !== Node.DOCUMENT_POSITION_CONTAINED_BY; } function getNextSibling(node) { const nextSibling = node.nextSibling; if (nextSibling && node !== nextSibling.previousSibling) { throw clobberedElementError(nextSibling); } return nextSibling; } function getFirstChild(node) { const firstChild = node.firstChild; if (firstChild && isClobberedElement(node, firstChild)) { throw clobberedElementError(firstChild); } return firstChild; } function getNodeName(node) { const nodeName = node.nodeName; return typeof nodeName === "string" ? nodeName : "FORM"; } function clobberedElementError(node) { return new Error(`Failed to sanitize html because the element is clobbered: ${node.outerHTML}`); } var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; function encodeEntities(value) { return value.replace(/&/g, "&").replace(SURROGATE_PAIR_REGEXP, function(match3) { const hi = match3.charCodeAt(0); const low = match3.charCodeAt(1); return "&#" + ((hi - 55296) * 1024 + (low - 56320) + 65536) + ";"; }).replace(NON_ALPHANUMERIC_REGEXP, function(match3) { return "&#" + match3.charCodeAt(0) + ";"; }).replace(//g, ">"); } var inertBodyHelper; function _sanitizeHtml(defaultDoc, unsafeHtmlInput) { let inertBodyElement = null; try { inertBodyHelper = inertBodyHelper || getInertBodyHelper(defaultDoc); let unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ""; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); let mXSSAttempts = 5; let parsedHtml = unsafeHtml; do { if (mXSSAttempts === 0) { throw new Error("Failed to sanitize html because the input is unstable"); } mXSSAttempts--; unsafeHtml = parsedHtml; parsedHtml = inertBodyElement.innerHTML; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); } while (unsafeHtml !== parsedHtml); const sanitizer = new SanitizingHtmlSerializer(); const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement); if ((typeof ngDevMode === "undefined" || ngDevMode) && sanitizer.sanitizedSomething) { console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`); } return trustedHTMLFromString(safeHtml); } finally { if (inertBodyElement) { const parent2 = getTemplateContent(inertBodyElement) || inertBodyElement; while (parent2.firstChild) { parent2.firstChild.remove(); } } } } function getTemplateContent(el) { return "content" in el && isTemplateElement(el) ? el.content : null; } function isTemplateElement(el) { return el.nodeType === Node.ELEMENT_NODE && el.nodeName === "TEMPLATE"; } var SecurityContext; (function(SecurityContext2) { SecurityContext2[SecurityContext2["NONE"] = 0] = "NONE"; SecurityContext2[SecurityContext2["HTML"] = 1] = "HTML"; SecurityContext2[SecurityContext2["STYLE"] = 2] = "STYLE"; SecurityContext2[SecurityContext2["SCRIPT"] = 3] = "SCRIPT"; SecurityContext2[SecurityContext2["URL"] = 4] = "URL"; SecurityContext2[SecurityContext2["RESOURCE_URL"] = 5] = "RESOURCE_URL"; })(SecurityContext || (SecurityContext = {})); function \u0275\u0275sanitizeHtml(unsafeHtml) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || ""); } if (allowSanitizationBypassAndThrow( unsafeHtml, "HTML" /* BypassType.Html */ )) { return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml)); } return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml)); } function \u0275\u0275sanitizeStyle(unsafeStyle) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || ""; } if (allowSanitizationBypassAndThrow( unsafeStyle, "Style" /* BypassType.Style */ )) { return unwrapSafeValue(unsafeStyle); } return renderStringify(unsafeStyle); } function \u0275\u0275sanitizeUrl(unsafeUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || ""; } if (allowSanitizationBypassAndThrow( unsafeUrl, "URL" /* BypassType.Url */ )) { return unwrapSafeValue(unsafeUrl); } return _sanitizeUrl(renderStringify(unsafeUrl)); } function \u0275\u0275sanitizeResourceUrl(unsafeResourceUrl) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptURLFromStringBypass(sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || ""); } if (allowSanitizationBypassAndThrow( unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */ )) { return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl)); } throw new RuntimeError(904, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`); } function \u0275\u0275sanitizeScript(unsafeScript) { const sanitizer = getSanitizer(); if (sanitizer) { return trustedScriptFromStringBypass(sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || ""); } if (allowSanitizationBypassAndThrow( unsafeScript, "Script" /* BypassType.Script */ )) { return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript)); } throw new RuntimeError(905, ngDevMode && "unsafe value used in a script context"); } function \u0275\u0275trustConstantHtml(html) { if (ngDevMode && (!Array.isArray(html) || !Array.isArray(html.raw) || html.length !== 1)) { throw new Error(`Unexpected interpolation in trusted HTML constant: ${html.join("?")}`); } return trustedHTMLFromString(html[0]); } function \u0275\u0275trustConstantResourceUrl(url) { if (ngDevMode && (!Array.isArray(url) || !Array.isArray(url.raw) || url.length !== 1)) { throw new Error(`Unexpected interpolation in trusted URL constant: ${url.join("?")}`); } return trustedScriptURLFromString(url[0]); } function getUrlSanitizer(tag, prop) { if (prop === "src" && (tag === "embed" || tag === "frame" || tag === "iframe" || tag === "media" || tag === "script") || prop === "href" && (tag === "base" || tag === "link")) { return \u0275\u0275sanitizeResourceUrl; } return \u0275\u0275sanitizeUrl; } function \u0275\u0275sanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) { return getUrlSanitizer(tag, prop)(unsafeUrl); } function validateAgainstEventProperties(name5) { if (name5.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event property '${name5}' is disallowed for security reasons, please use (${name5.slice(2)})=... If '${name5}' is a directive input, make sure the directive is imported by the current module.`; throw new RuntimeError(306, errorMessage); } } function validateAgainstEventAttributes(name5) { if (name5.toLowerCase().startsWith("on")) { const errorMessage = `Binding to event attribute '${name5}' is disallowed for security reasons, please use (${name5.slice(2)})=...`; throw new RuntimeError(306, errorMessage); } } function getSanitizer() { const lView = getLView(); return lView && lView[ENVIRONMENT].sanitizer; } var COMMENT_DISALLOWED = /^>|^->||--!>|)/g; var COMMENT_DELIMITER_ESCAPED = "\u200B$1\u200B"; function escapeCommentText(value) { return value.replace(COMMENT_DISALLOWED, (text) => text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED)); } var NG_REFLECT_ATTRS_FLAG_DEFAULT = false; var NG_REFLECT_ATTRS_FLAG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_REFLECT_FLAG" : "", { providedIn: "root", factory: () => NG_REFLECT_ATTRS_FLAG_DEFAULT }); function normalizeDebugBindingName(name5) { name5 = camelCaseToDashCase(name5.replace(/[$@]/g, "_")); return `ng-reflect-${name5}`; } var CAMEL_CASE_REGEXP = /([A-Z])/g; function camelCaseToDashCase(input2) { return input2.replace(CAMEL_CASE_REGEXP, (...m5) => "-" + m5[1].toLowerCase()); } function normalizeDebugBindingValue(value) { try { return value != null ? value.toString().slice(0, 30) : value; } catch (e56) { return "[ERROR] Exception while trying to serialize the value"; } } var CUSTOM_ELEMENTS_SCHEMA = { name: "custom-elements" }; var NO_ERRORS_SCHEMA = { name: "no-errors-schema" }; var shouldThrowErrorOnUnknownElement = false; var shouldThrowErrorOnUnknownProperty = false; function validateElementIsKnown(lView, tNode) { const tView = lView[TVIEW]; if (tView.schemas === null) return; const tagName = tNode.value; if (!isDirectiveHost(tNode) && tagName !== null) { const isUnknown = ( // Note that we can't check for `typeof HTMLUnknownElement === 'function'` because // Domino doesn't expose HTMLUnknownElement globally. typeof HTMLUnknownElement !== "undefined" && HTMLUnknownElement && getNativeByTNode(tNode, lView) instanceof HTMLUnknownElement || typeof customElements !== "undefined" && tagName.indexOf("-") > -1 && !customElements.get(tagName) ); if (isUnknown && !matchingSchemas(tView.schemas, tagName)) { const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; let message2 = `'${tagName}' is not a known element${templateLocation}: `; message2 += `1. If '${tagName}' is an Angular component, then verify that it is ${isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"}. `; if (tagName && tagName.indexOf("-") > -1) { message2 += `2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`; } else { message2 += `2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } if (shouldThrowErrorOnUnknownElement) { throw new RuntimeError(304, message2); } else { console.error(formatRuntimeError(304, message2)); } } } } function isPropertyValid(element, propName, tagName, schemas) { if (schemas === null) return true; if (matchingSchemas(schemas, tagName) || propName in element || isAnimationProp(propName)) { return true; } return typeof Node === "undefined" || Node === null || !(element instanceof Node); } function handleUnknownPropertyError(propName, tagName, nodeType, lView) { if (!tagName && nodeType === 4) { tagName = "ng-template"; } const isHostStandalone = isHostComponentStandalone(lView); const templateLocation = getTemplateLocationDetails(lView); let message2 = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'${templateLocation}.`; const schemas = `'${isHostStandalone ? "@Component" : "@NgModule"}.schemas'`; const importLocation = isHostStandalone ? "included in the '@Component.imports' of this component" : "a part of an @NgModule where this component is declared"; if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) { const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName); message2 += ` If the '${propName}' is an Angular control flow directive, please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`; } else { message2 += ` 1. If '${tagName}' is an Angular component and it has the '${propName}' input, then verify that it is ${importLocation}.`; if (tagName && tagName.indexOf("-") > -1) { message2 += ` 2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`; message2 += ` 3. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } else { message2 += ` 2. To allow any property add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`; } } reportUnknownPropertyError(message2); } function reportUnknownPropertyError(message2) { if (shouldThrowErrorOnUnknownProperty) { throw new RuntimeError(303, message2); } else { console.error(formatRuntimeError(303, message2)); } } function getDeclarationComponentDef(lView) { !ngDevMode && throwError2("Must never be called in production mode"); const declarationLView = lView[DECLARATION_COMPONENT_VIEW]; const context2 = declarationLView[CONTEXT]; if (!context2) return null; return context2.constructor ? getComponentDef(context2.constructor) : null; } function isHostComponentStandalone(lView) { !ngDevMode && throwError2("Must never be called in production mode"); const componentDef = getDeclarationComponentDef(lView); return !!componentDef?.standalone; } function getTemplateLocationDetails(lView) { !ngDevMode && throwError2("Must never be called in production mode"); const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; return componentClassName ? ` (used in the '${componentClassName}' component template)` : ""; } var KNOWN_CONTROL_FLOW_DIRECTIVES = /* @__PURE__ */ new Map([ ["ngIf", "NgIf"], ["ngFor", "NgFor"], ["ngSwitchCase", "NgSwitchCase"], ["ngSwitchDefault", "NgSwitchDefault"] ]); function matchingSchemas(schemas, tagName) { if (schemas !== null) { for (let i25 = 0; i25 < schemas.length; i25++) { const schema = schemas[i25]; if (schema === NO_ERRORS_SCHEMA || schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf("-") > -1) { return true; } } } return false; } function \u0275\u0275resolveWindow(element) { return element.ownerDocument.defaultView; } function \u0275\u0275resolveDocument(element) { return element.ownerDocument; } function \u0275\u0275resolveBody(element) { return element.ownerDocument.body; } var INTERPOLATION_DELIMITER = `\uFFFD`; function maybeUnwrapFn(value) { if (value instanceof Function) { return value(); } else { return value; } } var VALUE_STRING_LENGTH_LIMIT = 200; function assertStandaloneComponentType(type) { assertComponentDef(type); const componentDef = getComponentDef(type); if (!componentDef.standalone) { throw new RuntimeError(907, `The ${stringifyForError(type)} component is not marked as standalone, but Angular expects to have a standalone component here. Please make sure the ${stringifyForError(type)} component has the \`standalone: true\` flag in the decorator.`); } } function assertComponentDef(type) { if (!getComponentDef(type)) { throw new RuntimeError(906, `The ${stringifyForError(type)} is not an Angular component, make sure it has the \`@Component\` decorator.`); } } function throwMultipleComponentError(tNode, first2, second2) { throw new RuntimeError(-300, `Multiple components match node with tagname ${tNode.value}: ${stringifyForError(first2)} and ${stringifyForError(second2)}`); } function throwErrorIfNoChangesMode(creationMode, oldValue, currValue, propName, lView) { const hostComponentDef = getDeclarationComponentDef(lView); const componentClassName = hostComponentDef?.type?.name; const field = propName ? ` for '${propName}'` : ""; let msg = `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value${field}: '${formatValue(oldValue)}'. Current value: '${formatValue(currValue)}'.${componentClassName ? ` Expression location: ${componentClassName} component` : ""}`; if (creationMode) { msg += ` It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook?`; } throw new RuntimeError(-100, msg); } function formatValue(value) { let strValue = String(value); try { if (Array.isArray(value) || strValue === "[object Object]") { strValue = JSON.stringify(value); } } catch (error) { } return strValue.length > VALUE_STRING_LENGTH_LIMIT ? strValue.substring(0, VALUE_STRING_LENGTH_LIMIT) + "\u2026" : strValue; } function constructDetailsForInterpolation(lView, rootIndex, expressionIndex, meta, changedValue) { const [propName, prefix, ...chunks] = meta.split(INTERPOLATION_DELIMITER); let oldValue = prefix, newValue = prefix; for (let i25 = 0; i25 < chunks.length; i25++) { const slotIdx = rootIndex + i25; oldValue += `${lView[slotIdx]}${chunks[i25]}`; newValue += `${slotIdx === expressionIndex ? changedValue : lView[slotIdx]}${chunks[i25]}`; } return { propName, oldValue, newValue }; } function getExpressionChangedErrorDetails(lView, bindingIndex, oldValue, newValue) { const tData = lView[TVIEW].data; const metadata = tData[bindingIndex]; if (typeof metadata === "string") { if (metadata.indexOf(INTERPOLATION_DELIMITER) > -1) { return constructDetailsForInterpolation(lView, bindingIndex, bindingIndex, metadata, newValue); } return { propName: metadata, oldValue, newValue }; } if (metadata === null) { let idx = bindingIndex - 1; while (typeof tData[idx] !== "string" && tData[idx + 1] === null) { idx--; } const meta = tData[idx]; if (typeof meta === "string") { const matches = meta.match(new RegExp(INTERPOLATION_DELIMITER, "g")); if (matches && matches.length - 1 > bindingIndex - idx) { return constructDetailsForInterpolation(lView, idx, bindingIndex, meta, newValue); } } } return { propName: void 0, oldValue, newValue }; } function classIndexOf(className, classToSearch, startingIndex) { ngDevMode && assertNotEqual(classToSearch, "", 'can not look for "" string.'); let end = className.length; while (true) { const foundIndex = className.indexOf(classToSearch, startingIndex); if (foundIndex === -1) return foundIndex; if (foundIndex === 0 || className.charCodeAt(foundIndex - 1) <= 32) { const length = classToSearch.length; if (foundIndex + length === end || className.charCodeAt(foundIndex + length) <= 32) { return foundIndex; } } startingIndex = foundIndex + 1; } } var NG_TEMPLATE_SELECTOR = "ng-template"; function isCssClassMatching(tNode, attrs, cssClassToMatch, isProjectionMode) { ngDevMode && assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), "Class name expected to be lowercase."); let i25 = 0; if (isProjectionMode) { for (; i25 < attrs.length && typeof attrs[i25] === "string"; i25 += 2) { if (attrs[i25] === "class" && classIndexOf(attrs[i25 + 1].toLowerCase(), cssClassToMatch, 0) !== -1) { return true; } } } else if (isInlineTemplate(tNode)) { return false; } i25 = attrs.indexOf(1, i25); if (i25 > -1) { let item; while (++i25 < attrs.length && typeof (item = attrs[i25]) === "string") { if (item.toLowerCase() === cssClassToMatch) { return true; } } } return false; } function isInlineTemplate(tNode) { return tNode.type === 4 && tNode.value !== NG_TEMPLATE_SELECTOR; } function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) { const tagNameToCompare = tNode.type === 4 && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.value; return currentSelector === tagNameToCompare; } function isNodeMatchingSelector(tNode, selector, isProjectionMode) { ngDevMode && assertDefined(selector[0], "Selector should have a tag name"); let mode = 4; const nodeAttrs = tNode.attrs; const nameOnlyMarkerIdx = nodeAttrs !== null ? getNameOnlyMarkerIndex(nodeAttrs) : 0; let skipToNextSelector = false; for (let i25 = 0; i25 < selector.length; i25++) { const current = selector[i25]; if (typeof current === "number") { if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) { return false; } if (skipToNextSelector && isPositive(current)) continue; skipToNextSelector = false; mode = current | mode & 1; continue; } if (skipToNextSelector) continue; if (mode & 4) { mode = 2 | mode & 1; if (current !== "" && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === "" && selector.length === 1) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else if (mode & 8) { if (nodeAttrs === null || !isCssClassMatching(tNode, nodeAttrs, current, isProjectionMode)) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else { const selectorAttrValue = selector[++i25]; const attrIndexInNode = findAttrIndexInNode(current, nodeAttrs, isInlineTemplate(tNode), isProjectionMode); if (attrIndexInNode === -1) { if (isPositive(mode)) return false; skipToNextSelector = true; continue; } if (selectorAttrValue !== "") { let nodeAttrValue; if (attrIndexInNode > nameOnlyMarkerIdx) { nodeAttrValue = ""; } else { ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0, "We do not match directives on namespaced attributes"); nodeAttrValue = nodeAttrs[attrIndexInNode + 1].toLowerCase(); } if (mode & 2 && selectorAttrValue !== nodeAttrValue) { if (isPositive(mode)) return false; skipToNextSelector = true; } } } } return isPositive(mode) || skipToNextSelector; } function isPositive(mode) { return (mode & 1) === 0; } function findAttrIndexInNode(name5, attrs, isInlineTemplate2, isProjectionMode) { if (attrs === null) return -1; let i25 = 0; if (isProjectionMode || !isInlineTemplate2) { let bindingsMode = false; while (i25 < attrs.length) { const maybeAttrName = attrs[i25]; if (maybeAttrName === name5) { return i25; } else if (maybeAttrName === 3 || maybeAttrName === 6) { bindingsMode = true; } else if (maybeAttrName === 1 || maybeAttrName === 2) { let value = attrs[++i25]; while (typeof value === "string") { value = attrs[++i25]; } continue; } else if (maybeAttrName === 4) { break; } else if (maybeAttrName === 0) { i25 += 4; continue; } i25 += bindingsMode ? 1 : 2; } return -1; } else { return matchTemplateAttribute(attrs, name5); } } function isNodeMatchingSelectorList(tNode, selector, isProjectionMode = false) { for (let i25 = 0; i25 < selector.length; i25++) { if (isNodeMatchingSelector(tNode, selector[i25], isProjectionMode)) { return true; } } return false; } function getProjectAsAttrValue(tNode) { const nodeAttrs = tNode.attrs; if (nodeAttrs != null) { const ngProjectAsAttrIdx = nodeAttrs.indexOf( 5 /* AttributeMarker.ProjectAs */ ); if ((ngProjectAsAttrIdx & 1) === 0) { return nodeAttrs[ngProjectAsAttrIdx + 1]; } } return null; } function getNameOnlyMarkerIndex(nodeAttrs) { for (let i25 = 0; i25 < nodeAttrs.length; i25++) { const nodeAttr = nodeAttrs[i25]; if (isNameOnlyAttributeMarker(nodeAttr)) { return i25; } } return nodeAttrs.length; } function matchTemplateAttribute(attrs, name5) { let i25 = attrs.indexOf( 4 /* AttributeMarker.Template */ ); if (i25 > -1) { i25++; while (i25 < attrs.length) { const attr = attrs[i25]; if (typeof attr === "number") return -1; if (attr === name5) return i25; i25++; } } return -1; } function isSelectorInSelectorList(selector, list) { selectorListLoop: for (let i25 = 0; i25 < list.length; i25++) { const currentSelectorInList = list[i25]; if (selector.length !== currentSelectorInList.length) { continue; } for (let j3 = 0; j3 < selector.length; j3++) { if (selector[j3] !== currentSelectorInList[j3]) { continue selectorListLoop; } } return true; } return false; } function maybeWrapInNotSelector(isNegativeMode, chunk) { return isNegativeMode ? ":not(" + chunk.trim() + ")" : chunk; } function stringifyCSSSelector(selector) { let result = selector[0]; let i25 = 1; let mode = 2; let currentChunk = ""; let isNegativeMode = false; while (i25 < selector.length) { let valueOrMarker = selector[i25]; if (typeof valueOrMarker === "string") { if (mode & 2) { const attrValue = selector[++i25]; currentChunk += "[" + valueOrMarker + (attrValue.length > 0 ? '="' + attrValue + '"' : "") + "]"; } else if (mode & 8) { currentChunk += "." + valueOrMarker; } else if (mode & 4) { currentChunk += " " + valueOrMarker; } } else { if (currentChunk !== "" && !isPositive(valueOrMarker)) { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); currentChunk = ""; } mode = valueOrMarker; isNegativeMode = isNegativeMode || !isPositive(mode); } i25++; } if (currentChunk !== "") { result += maybeWrapInNotSelector(isNegativeMode, currentChunk); } return result; } function stringifyCSSSelectorList(selectorList) { return selectorList.map(stringifyCSSSelector).join(","); } function extractAttrsAndClassesFromSelector(selector) { const attrs = []; const classes43 = []; let i25 = 1; let mode = 2; while (i25 < selector.length) { let valueOrMarker = selector[i25]; if (typeof valueOrMarker === "string") { if (mode === 2) { if (valueOrMarker !== "") { attrs.push(valueOrMarker, selector[++i25]); } } else if (mode === 8) { classes43.push(valueOrMarker); } } else { if (!isPositive(mode)) break; mode = valueOrMarker; } i25++; } if (classes43.length) { attrs.push(1, ...classes43); } return attrs; } var NO_CHANGE = typeof ngDevMode === "undefined" || ngDevMode ? { __brand__: "NO_CHANGE" } : {}; function createTextNode(renderer, value) { return renderer.createText(value); } function updateTextNode(renderer, rNode, value) { renderer.setValue(rNode, value); } function createCommentNode(renderer, value) { return renderer.createComment(escapeCommentText(value)); } function createElementNode(renderer, name5, namespace) { return renderer.createElement(name5, namespace); } function nativeInsertBefore(renderer, parent2, child, beforeNode, isMove) { renderer.insertBefore(parent2, child, beforeNode, isMove); } function nativeAppendChild(renderer, parent2, child) { ngDevMode && assertDefined(parent2, "parent node must be defined"); renderer.appendChild(parent2, child); } function nativeAppendOrInsertBefore(renderer, parent2, child, beforeNode, isMove) { if (beforeNode !== null) { nativeInsertBefore(renderer, parent2, child, beforeNode, isMove); } else { nativeAppendChild(renderer, parent2, child); } } function nativeRemoveNode(renderer, rNode, isHostElement) { renderer.removeChild(null, rNode, isHostElement); } function writeDirectStyle(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); renderer.setAttribute(element, "style", newValue); } function writeDirectClass(renderer, element, newValue) { ngDevMode && assertString(newValue, "'newValue' should be a string"); if (newValue === "") { renderer.removeAttribute(element, "class"); } else { renderer.setAttribute(element, "class", newValue); } } function setupStaticAttributes(renderer, element, tNode) { const { mergedAttrs, classes: classes43, styles } = tNode; if (mergedAttrs !== null) { setUpAttributes(renderer, element, mergedAttrs); } if (classes43 !== null) { writeDirectClass(renderer, element, classes43); } if (styles !== null) { writeDirectStyle(renderer, element, styles); } } function createTView(type, declTNode, templateFn, decls, vars, directives, pipes, viewQuery, schemas, constsOrFactory, ssrId) { const bindingStartIndex = HEADER_OFFSET + decls; const initialViewLength = bindingStartIndex + vars; const blueprint = createViewBlueprint(bindingStartIndex, initialViewLength); const consts = typeof constsOrFactory === "function" ? constsOrFactory() : constsOrFactory; const tView = blueprint[TVIEW] = { type, blueprint, template: templateFn, queries: null, viewQuery, declTNode, data: blueprint.slice().fill(null, bindingStartIndex), bindingStartIndex, expandoStartIndex: initialViewLength, hostBindingOpCodes: null, firstCreatePass: true, firstUpdatePass: true, staticViewQueries: false, staticContentQueries: false, preOrderHooks: null, preOrderCheckHooks: null, contentHooks: null, contentCheckHooks: null, viewHooks: null, viewCheckHooks: null, destroyHooks: null, cleanup: null, contentQueries: null, components: null, directiveRegistry: typeof directives === "function" ? directives() : directives, pipeRegistry: typeof pipes === "function" ? pipes() : pipes, firstChild: null, schemas, consts, incompleteFirstPass: false, ssrId }; if (ngDevMode) { Object.seal(tView); } return tView; } function createViewBlueprint(bindingStartIndex, initialViewLength) { const blueprint = []; for (let i25 = 0; i25 < initialViewLength; i25++) { blueprint.push(i25 < bindingStartIndex ? null : NO_CHANGE); } return blueprint; } function getOrCreateComponentTView(def) { const tView = def.tView; if (tView === null || tView.incompleteFirstPass) { const declTNode = null; return def.tView = createTView(1, declTNode, def.template, def.decls, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas, def.consts, def.id); } return tView; } function createLView(parentLView, tView, context2, flags, host, tHostNode, environment2, renderer, injector, embeddedViewInjector, hydrationInfo) { const lView = tView.blueprint.slice(); lView[HOST] = host; lView[FLAGS] = flags | 4 | 128 | 8 | 64 | 1024; if (embeddedViewInjector !== null || parentLView && parentLView[FLAGS] & 2048) { lView[FLAGS] |= 2048; } resetPreOrderHookFlags(lView); ngDevMode && tView.declTNode && parentLView && assertTNodeForLView(tView.declTNode, parentLView); lView[PARENT] = lView[DECLARATION_VIEW] = parentLView; lView[CONTEXT] = context2; lView[ENVIRONMENT] = environment2 || parentLView && parentLView[ENVIRONMENT]; ngDevMode && assertDefined(lView[ENVIRONMENT], "LViewEnvironment is required"); lView[RENDERER] = renderer || parentLView && parentLView[RENDERER]; ngDevMode && assertDefined(lView[RENDERER], "Renderer is required"); lView[INJECTOR] = injector || parentLView && parentLView[INJECTOR] || null; lView[T_HOST] = tHostNode; lView[ID] = getUniqueLViewId(); lView[HYDRATION] = hydrationInfo; lView[EMBEDDED_VIEW_INJECTOR] = embeddedViewInjector; ngDevMode && assertEqual(tView.type == 2 ? parentLView !== null : true, true, "Embedded views must have parentLView"); lView[DECLARATION_COMPONENT_VIEW] = tView.type == 2 ? parentLView[DECLARATION_COMPONENT_VIEW] : lView; return lView; } function createComponentLView(lView, hostTNode, def) { const native = getNativeByTNode(hostTNode, lView); const tView = getOrCreateComponentTView(def); const rendererFactory = lView[ENVIRONMENT].rendererFactory; const componentView = addToEndOfViewTree(lView, createLView(lView, tView, null, getInitialLViewFlagsFromDef(def), native, hostTNode, null, rendererFactory.createRenderer(native, def), null, null, null)); return lView[hostTNode.index] = componentView; } function getInitialLViewFlagsFromDef(def) { let flags = 16; if (def.signals) { flags = 4096; } else if (def.onPush) { flags = 64; } return flags; } function allocExpando(tView, lView, numSlotsToAlloc, initialValue) { if (numSlotsToAlloc === 0) return -1; if (ngDevMode) { assertFirstCreatePass(tView); assertSame(tView, lView[TVIEW], "`LView` must be associated with `TView`!"); assertEqual(tView.data.length, lView.length, "Expecting LView to be same size as TView"); assertEqual(tView.data.length, tView.blueprint.length, "Expecting Blueprint to be same size as TView"); assertFirstUpdatePass(tView); } const allocIdx = lView.length; for (let i25 = 0; i25 < numSlotsToAlloc; i25++) { lView.push(initialValue); tView.blueprint.push(initialValue); tView.data.push(null); } return allocIdx; } function addToEndOfViewTree(lView, lViewOrLContainer) { if (lView[CHILD_HEAD]) { lView[CHILD_TAIL][NEXT] = lViewOrLContainer; } else { lView[CHILD_HEAD] = lViewOrLContainer; } lView[CHILD_TAIL] = lViewOrLContainer; return lViewOrLContainer; } function \u0275\u0275advance(delta = 1) { ngDevMode && assertGreaterThan(delta, 0, "Can only advance forward"); selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, !!ngDevMode && isInCheckNoChangesMode()); } function selectIndexInternal(tView, lView, index, checkNoChangesMode) { ngDevMode && assertIndexInDeclRange(lView[TVIEW], index); if (!checkNoChangesMode) { const hooksInitPhaseCompleted = (lView[FLAGS] & 3) === 3; if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, index); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, index); } } } setSelectedIndex(index); } var InputFlags; (function(InputFlags2) { InputFlags2[InputFlags2["None"] = 0] = "None"; InputFlags2[InputFlags2["SignalBased"] = 1] = "SignalBased"; InputFlags2[InputFlags2["HasDecoratorInputTransform"] = 2] = "HasDecoratorInputTransform"; })(InputFlags || (InputFlags = {})); function writeToDirectiveInput(def, instance, publicName, value) { const prevConsumer = setActiveConsumer(null); try { if (ngDevMode) { if (!def.inputs.hasOwnProperty(publicName)) { throw new Error(`ASSERTION ERROR: Directive ${def.type.name} does not have an input with a public name of "${publicName}"`); } if (instance instanceof NodeInjectorFactory) { throw new Error(`ASSERTION ERROR: Cannot write input to factory for type ${def.type.name}. Directive has not been created yet.`); } } const [privateName, flags, transform] = def.inputs[publicName]; let inputSignalNode = null; if ((flags & InputFlags.SignalBased) !== 0) { const field = instance[privateName]; inputSignalNode = field[SIGNAL]; } if (inputSignalNode !== null && inputSignalNode.transformFn !== void 0) { value = inputSignalNode.transformFn(value); } else if (transform !== null) { value = transform.call(instance, value); } if (def.setInput !== null) { def.setInput(instance, inputSignalNode, value, publicName, privateName); } else { applyValueToInputField(instance, inputSignalNode, privateName, value); } } finally { setActiveConsumer(prevConsumer); } } var RendererStyleFlags2; (function(RendererStyleFlags22) { RendererStyleFlags22[RendererStyleFlags22["Important"] = 1] = "Important"; RendererStyleFlags22[RendererStyleFlags22["DashCase"] = 2] = "DashCase"; })(RendererStyleFlags2 || (RendererStyleFlags2 = {})); var _icuContainerIterate; function icuContainerIterate(tIcuContainerNode, lView) { return _icuContainerIterate(tIcuContainerNode, lView); } function ensureIcuContainerVisitorLoaded(loader) { if (_icuContainerIterate === void 0) { _icuContainerIterate = loader(); } } function parseCssTimeUnitsToMs(value) { const multiplier = value.toLowerCase().indexOf("ms") > -1 ? 1 : 1e3; return parseFloat(value) * multiplier; } function parseCssPropertyValue(computedStyle, name5) { const value = computedStyle.getPropertyValue(name5); return value.split(",").map((part) => part.trim()); } function getLongestComputedTransition(computedStyle) { const transitionedProperties = parseCssPropertyValue(computedStyle, "transition-property"); const rawDurations = parseCssPropertyValue(computedStyle, "transition-duration"); const rawDelays = parseCssPropertyValue(computedStyle, "transition-delay"); const longest = { propertyName: "", duration: 0, animationName: void 0 }; for (let i25 = 0; i25 < transitionedProperties.length; i25++) { const duration = parseCssTimeUnitsToMs(rawDelays[i25]) + parseCssTimeUnitsToMs(rawDurations[i25]); if (duration > longest.duration) { longest.propertyName = transitionedProperties[i25]; longest.duration = duration; } } return longest; } function getLongestComputedAnimation(computedStyle) { const rawNames = parseCssPropertyValue(computedStyle, "animation-name"); const rawDelays = parseCssPropertyValue(computedStyle, "animation-delay"); const rawDurations = parseCssPropertyValue(computedStyle, "animation-duration"); const longest = { animationName: "", propertyName: void 0, duration: 0 }; for (let i25 = 0; i25 < rawNames.length; i25++) { const duration = parseCssTimeUnitsToMs(rawDelays[i25]) + parseCssTimeUnitsToMs(rawDurations[i25]); if (duration > longest.duration) { longest.animationName = rawNames[i25]; longest.duration = duration; } } return longest; } function isShorterThanExistingAnimation(existing, longest) { return existing !== void 0 && existing.duration > longest.duration; } function longestExists(longest) { return (longest.animationName != void 0 || longest.propertyName != void 0) && longest.duration > 0; } function determineLongestAnimationFromComputedStyles(el, animationsMap) { const computedStyle = getComputedStyle(el); const longestAnimation = getLongestComputedAnimation(computedStyle); const longestTransition = getLongestComputedTransition(computedStyle); const longest = longestAnimation.duration > longestTransition.duration ? longestAnimation : longestTransition; if (isShorterThanExistingAnimation(animationsMap.get(el), longest)) return; if (longestExists(longest)) { animationsMap.set(el, longest); } } function determineLongestAnimation(el, animationsMap, areAnimationSupported2) { if (!areAnimationSupported2) return; const animations = el.getAnimations(); return animations.length === 0 ? ( // fallback to computed styles if getAnimations is empty. This would happen if styles are // currently recalculating due to a reflow happening elsewhere. determineLongestAnimationFromComputedStyles(el, animationsMap) ) : determineLongestAnimationFromElementAnimations(el, animationsMap, animations); } function determineLongestAnimationFromElementAnimations(el, animationsMap, animations) { let longest = { animationName: void 0, propertyName: void 0, duration: 0 }; for (const animation2 of animations) { const timing = animation2.effect?.getTiming(); const animDuration = typeof timing?.duration === "number" ? timing.duration : 0; let duration = (timing?.delay ?? 0) + animDuration; let propertyName; let animationName; if (animation2.animationName) { animationName = animation2.animationName; } else { propertyName = animation2.transitionProperty; } if (duration >= longest.duration) { longest = { animationName, propertyName, duration }; } } if (isShorterThanExistingAnimation(animationsMap.get(el), longest)) return; if (longestExists(longest)) { animationsMap.set(el, longest); } } var allLeavingAnimations = /* @__PURE__ */ new Set(); function applyToElementOrContainer(action, renderer, parent2, lNodeToHandle, beforeNode, parentLView) { if (lNodeToHandle != null) { let lContainer; let isComponent2 = false; if (isLContainer(lNodeToHandle)) { lContainer = lNodeToHandle; } else if (isLView(lNodeToHandle)) { isComponent2 = true; ngDevMode && assertDefined(lNodeToHandle[HOST], "HOST must be defined for a component LView"); lNodeToHandle = lNodeToHandle[HOST]; } const rNode = unwrapRNode(lNodeToHandle); if (action === 0 && parent2 !== null) { if (beforeNode == null) { nativeAppendChild(renderer, parent2, rNode); } else { nativeInsertBefore(renderer, parent2, rNode, beforeNode || null, true); } } else if (action === 1 && parent2 !== null) { nativeInsertBefore(renderer, parent2, rNode, beforeNode || null, true); } else if (action === 2) { runLeaveAnimationsWithCallback(parentLView, () => { nativeRemoveNode(renderer, rNode, isComponent2); }); } else if (action === 3) { runLeaveAnimationsWithCallback(parentLView, () => { renderer.destroyNode(rNode); }); } if (lContainer != null) { applyContainer(renderer, action, lContainer, parent2, beforeNode); } } } function removeViewFromDOM(tView, lView) { detachViewFromDOM(tView, lView); lView[HOST] = null; lView[T_HOST] = null; } function addViewToDOM(tView, parentTNode, renderer, lView, parentNativeNode, beforeNode) { lView[HOST] = parentNativeNode; lView[T_HOST] = parentTNode; applyView(tView, lView, renderer, 1, parentNativeNode, beforeNode); } function detachViewFromDOM(tView, lView) { lView[ENVIRONMENT].changeDetectionScheduler?.notify( 9 /* NotificationSource.ViewDetachedFromDOM */ ); applyView(tView, lView, lView[RENDERER], 2, null, null); } function destroyViewTree(rootView) { let lViewOrLContainer = rootView[CHILD_HEAD]; if (!lViewOrLContainer) { return cleanUpView(rootView[TVIEW], rootView); } while (lViewOrLContainer) { let next = null; if (isLView(lViewOrLContainer)) { next = lViewOrLContainer[CHILD_HEAD]; } else { ngDevMode && assertLContainer(lViewOrLContainer); const firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET]; if (firstView) next = firstView; } if (!next) { while (lViewOrLContainer && !lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) { if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } lViewOrLContainer = lViewOrLContainer[PARENT]; } if (lViewOrLContainer === null) lViewOrLContainer = rootView; if (isLView(lViewOrLContainer)) { cleanUpView(lViewOrLContainer[TVIEW], lViewOrLContainer); } next = lViewOrLContainer && lViewOrLContainer[NEXT]; } lViewOrLContainer = next; } } function detachMovedView(declarationContainer, lView) { ngDevMode && assertLContainer(declarationContainer); ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], "A projected view should belong to a non-empty projected views collection"); const movedViews = declarationContainer[MOVED_VIEWS]; const declarationViewIndex = movedViews.indexOf(lView); movedViews.splice(declarationViewIndex, 1); } function destroyLView(tView, lView) { if (isDestroyed(lView)) { return; } const renderer = lView[RENDERER]; if (renderer.destroyNode) { applyView(tView, lView, renderer, 3, null, null); } destroyViewTree(lView); } function cleanUpView(tView, lView) { if (isDestroyed(lView)) { return; } const prevConsumer = setActiveConsumer(null); try { lView[FLAGS] &= ~128; lView[FLAGS] |= 256; lView[REACTIVE_TEMPLATE_CONSUMER] && consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); executeOnDestroys(tView, lView); processCleanups(tView, lView); if (lView[TVIEW].type === 1) { lView[RENDERER].destroy(); } const declarationContainer = lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && isLContainer(lView[PARENT])) { if (declarationContainer !== lView[PARENT]) { detachMovedView(declarationContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.detachView(tView); } } unregisterLView(lView); } finally { setActiveConsumer(prevConsumer); } } function runLeaveAnimationsWithCallback(lView, callback2) { if (lView && lView[ANIMATIONS] && lView[ANIMATIONS].leave) { if (lView[ANIMATIONS].skipLeaveAnimations) { lView[ANIMATIONS].skipLeaveAnimations = false; } else { const leaveAnimations = lView[ANIMATIONS].leave; const runningAnimations = []; for (let index = 0; index < leaveAnimations.length; index++) { const animateFn = leaveAnimations[index]; runningAnimations.push(animateFn()); } lView[ANIMATIONS].running = Promise.allSettled(runningAnimations); lView[ANIMATIONS].leave = void 0; } } runAfterLeaveAnimations(lView, callback2); } function runAfterLeaveAnimations(lView, callback2) { if (lView && lView[ANIMATIONS] && lView[ANIMATIONS].running) { lView[ANIMATIONS].running.then(() => { if (lView[ANIMATIONS] && lView[ANIMATIONS].running) { lView[ANIMATIONS].running = void 0; } allLeavingAnimations.delete(lView); callback2(); }); return; } callback2(); } function processCleanups(tView, lView) { ngDevMode && assertNotReactive(processCleanups.name); const tCleanup = tView.cleanup; const lCleanup = lView[CLEANUP]; if (tCleanup !== null) { for (let i25 = 0; i25 < tCleanup.length - 1; i25 += 2) { if (typeof tCleanup[i25] === "string") { const targetIdx = tCleanup[i25 + 3]; ngDevMode && assertNumber(targetIdx, "cleanup target must be a number"); if (targetIdx >= 0) { lCleanup[targetIdx](); } else { lCleanup[-targetIdx].unsubscribe(); } i25 += 2; } else { const context2 = lCleanup[tCleanup[i25 + 1]]; tCleanup[i25].call(context2); } } } if (lCleanup !== null) { lView[CLEANUP] = null; } const destroyHooks = lView[ON_DESTROY_HOOKS]; if (destroyHooks !== null) { lView[ON_DESTROY_HOOKS] = null; for (let i25 = 0; i25 < destroyHooks.length; i25++) { const destroyHooksFn = destroyHooks[i25]; ngDevMode && assertFunction(destroyHooksFn, "Expecting destroy hook to be a function."); destroyHooksFn(); } } const effects2 = lView[EFFECTS]; if (effects2 !== null) { lView[EFFECTS] = null; for (const effect2 of effects2) { effect2.destroy(); } } } function executeOnDestroys(tView, lView) { ngDevMode && assertNotReactive(executeOnDestroys.name); let destroyHooks; if (tView != null && (destroyHooks = tView.destroyHooks) != null) { for (let i25 = 0; i25 < destroyHooks.length; i25 += 2) { const context2 = lView[destroyHooks[i25]]; if (!(context2 instanceof NodeInjectorFactory)) { const toCall = destroyHooks[i25 + 1]; if (Array.isArray(toCall)) { for (let j3 = 0; j3 < toCall.length; j3 += 2) { const callContext = context2[toCall[j3]]; const hook = toCall[j3 + 1]; profiler(4, callContext, hook); try { hook.call(callContext); } finally { profiler(5, callContext, hook); } } } else { profiler(4, context2, toCall); try { toCall.call(context2); } finally { profiler(5, context2, toCall); } } } } } } function getParentRElement(tView, tNode, lView) { return getClosestRElement(tView, tNode.parent, lView); } function getClosestRElement(tView, tNode, lView) { let parentTNode = tNode; while (parentTNode !== null && parentTNode.type & (8 | 32 | 128)) { tNode = parentTNode; parentTNode = tNode.parent; } if (parentTNode === null) { return lView[HOST]; } else { ngDevMode && assertTNodeType( parentTNode, 3 | 4 /* TNodeType.Container */ ); if (isComponentHost(parentTNode)) { ngDevMode && assertTNodeForLView(parentTNode, lView); const { encapsulation } = tView.data[parentTNode.directiveStart + parentTNode.componentOffset]; if (encapsulation === ViewEncapsulation.None || encapsulation === ViewEncapsulation.Emulated) { return null; } } return getNativeByTNode(parentTNode, lView); } } function getInsertInFrontOfRNode(parentTNode, currentTNode, lView) { return _getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView); } function getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView) { if (parentTNode.type & (8 | 32)) { return getNativeByTNode(parentTNode, lView); } return null; } var _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithNoI18n; var _processI18nInsertBefore; function setI18nHandling(getInsertInFrontOfRNodeWithI18n2, processI18nInsertBefore2) { _getInsertInFrontOfRNodeWithI18n = getInsertInFrontOfRNodeWithI18n2; _processI18nInsertBefore = processI18nInsertBefore2; } function appendChild(tView, lView, childRNode, childTNode) { const parentRNode = getParentRElement(tView, childTNode, lView); const renderer = lView[RENDERER]; const parentTNode = childTNode.parent || lView[T_HOST]; const anchorNode = getInsertInFrontOfRNode(parentTNode, childTNode, lView); if (parentRNode != null) { if (Array.isArray(childRNode)) { for (let i25 = 0; i25 < childRNode.length; i25++) { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode[i25], anchorNode, false); } } else { nativeAppendOrInsertBefore(renderer, parentRNode, childRNode, anchorNode, false); } } _processI18nInsertBefore !== void 0 && _processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRNode); } function getFirstNativeNode(lView, tNode) { if (tNode !== null) { ngDevMode && assertTNodeType( tNode, 3 | 12 | 32 | 16 | 128 /* TNodeType.LetDeclaration */ ); const tNodeType = tNode.type; if (tNodeType & 3) { return getNativeByTNode(tNode, lView); } else if (tNodeType & 4) { return getBeforeNodeForView(-1, lView[tNode.index]); } else if (tNodeType & 8) { const elIcuContainerChild = tNode.child; if (elIcuContainerChild !== null) { return getFirstNativeNode(lView, elIcuContainerChild); } else { const rNodeOrLContainer = lView[tNode.index]; if (isLContainer(rNodeOrLContainer)) { return getBeforeNodeForView(-1, rNodeOrLContainer); } else { return unwrapRNode(rNodeOrLContainer); } } } else if (tNodeType & 128) { return getFirstNativeNode(lView, tNode.next); } else if (tNodeType & 32) { let nextRNode = icuContainerIterate(tNode, lView); let rNode = nextRNode(); return rNode || unwrapRNode(lView[tNode.index]); } else { const projectionNodes = getProjectionNodes(lView, tNode); if (projectionNodes !== null) { if (Array.isArray(projectionNodes)) { return projectionNodes[0]; } const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); return getFirstNativeNode(parentView, projectionNodes); } else { return getFirstNativeNode(lView, tNode.next); } } } return null; } function getProjectionNodes(lView, tNode) { if (tNode !== null) { const componentView = lView[DECLARATION_COMPONENT_VIEW]; const componentHost = componentView[T_HOST]; const slotIdx = tNode.projection; ngDevMode && assertProjectionSlots(lView); return componentHost.projection[slotIdx]; } return null; } function getBeforeNodeForView(viewIndexInContainer, lContainer) { const nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1; if (nextViewIndex < lContainer.length) { const lView = lContainer[nextViewIndex]; const firstTNodeOfView = lView[TVIEW].firstChild; if (firstTNodeOfView !== null) { return getFirstNativeNode(lView, firstTNodeOfView); } } return lContainer[NATIVE]; } function applyNodes(renderer, action, tNode, lView, parentRElement, beforeNode, isProjection) { while (tNode != null) { ngDevMode && assertTNodeForLView(tNode, lView); if (tNode.type === 128) { tNode = tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const rawSlotValue = lView[tNode.index]; const tNodeType = tNode.type; if (isProjection) { if (action === 0) { rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView); tNode.flags |= 2; } } if (!isDetachedByI18n(tNode)) { if (tNodeType & 8) { applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode, lView); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode, lView); } applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode, lView); } else if (tNodeType & 16) { applyProjectionRecursive(renderer, action, lView, tNode, parentRElement, beforeNode); } else { ngDevMode && assertTNodeType( tNode, 3 | 4 /* TNodeType.Container */ ); applyToElementOrContainer(action, renderer, parentRElement, rawSlotValue, beforeNode, lView); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } } function applyView(tView, lView, renderer, action, parentRElement, beforeNode) { applyNodes(renderer, action, tView.firstChild, lView, parentRElement, beforeNode, false); } function applyProjection(tView, lView, tProjectionNode) { const renderer = lView[RENDERER]; const parentRNode = getParentRElement(tView, tProjectionNode, lView); const parentTNode = tProjectionNode.parent || lView[T_HOST]; let beforeNode = getInsertInFrontOfRNode(parentTNode, tProjectionNode, lView); applyProjectionRecursive(renderer, 0, lView, tProjectionNode, parentRNode, beforeNode); } function applyProjectionRecursive(renderer, action, lView, tProjectionNode, parentRElement, beforeNode) { const componentLView = lView[DECLARATION_COMPONENT_VIEW]; const componentNode = componentLView[T_HOST]; ngDevMode && assertEqual(typeof tProjectionNode.projection, "number", "expecting projection index"); const nodeToProjectOrRNodes = componentNode.projection[tProjectionNode.projection]; if (Array.isArray(nodeToProjectOrRNodes)) { for (let i25 = 0; i25 < nodeToProjectOrRNodes.length; i25++) { const rNode = nodeToProjectOrRNodes[i25]; applyToElementOrContainer(action, renderer, parentRElement, rNode, beforeNode, lView); } } else { let nodeToProject = nodeToProjectOrRNodes; const projectedComponentLView = componentLView[PARENT]; if (hasInSkipHydrationBlockFlag(tProjectionNode)) { nodeToProject.flags |= 128; } applyNodes(renderer, action, nodeToProject, projectedComponentLView, parentRElement, beforeNode, true); } } function applyContainer(renderer, action, lContainer, parentRElement, beforeNode) { ngDevMode && assertLContainer(lContainer); const anchor = lContainer[NATIVE]; const native = unwrapRNode(lContainer); if (anchor !== native) { applyToElementOrContainer(action, renderer, parentRElement, anchor, beforeNode); } for (let i25 = CONTAINER_HEADER_OFFSET; i25 < lContainer.length; i25++) { const lView = lContainer[i25]; applyView(lView[TVIEW], lView, renderer, action, parentRElement, anchor); } } function applyStyling(renderer, isClassBased, rNode, prop, value) { if (isClassBased) { if (!value) { renderer.removeClass(rNode, prop); } else { renderer.addClass(rNode, prop); } } else { let flags = prop.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase; if (value == null) { renderer.removeStyle(rNode, prop, flags); } else { const isImportant = typeof value === "string" ? value.endsWith("!important") : false; if (isImportant) { value = value.slice(0, -10); flags |= RendererStyleFlags2.Important; } renderer.setStyle(rNode, prop, value, flags); } } } function executeTemplate(tView, lView, templateFn, rf, context2) { const prevSelectedIndex = getSelectedIndex(); const isUpdatePhase = rf & 2; try { setSelectedIndex(-1); if (isUpdatePhase && lView.length > HEADER_OFFSET) { selectIndexInternal(tView, lView, HEADER_OFFSET, !!ngDevMode && isInCheckNoChangesMode()); } const preHookType = isUpdatePhase ? 2 : 0; profiler(preHookType, context2, templateFn); templateFn(rf, context2); } finally { setSelectedIndex(prevSelectedIndex); const postHookType = isUpdatePhase ? 3 : 1; profiler(postHookType, context2, templateFn); } } function createDirectivesInstances(tView, lView, tNode) { instantiateAllDirectives(tView, lView, tNode); if ((tNode.flags & 64) === 64) { invokeDirectivesHostBindings(tView, lView, tNode); } } function saveResolvedLocalsInData(viewData, tNode, localRefExtractor = getNativeByTNode) { const localNames = tNode.localNames; if (localNames !== null) { let localIndex = tNode.index + 1; for (let i25 = 0; i25 < localNames.length; i25 += 2) { const index = localNames[i25 + 1]; const value = index === -1 ? localRefExtractor(tNode, viewData) : viewData[index]; viewData[localIndex++] = value; } } } function locateHostElement(renderer, elementOrSelector, encapsulation, injector) { const preserveHostContent = injector.get(PRESERVE_HOST_CONTENT, PRESERVE_HOST_CONTENT_DEFAULT); const preserveContent = preserveHostContent || encapsulation === ViewEncapsulation.ShadowDom; const rootElement = renderer.selectRootElement(elementOrSelector, preserveContent); applyRootElementTransform(rootElement); return rootElement; } function applyRootElementTransform(rootElement) { _applyRootElementTransformImpl(rootElement); } var _applyRootElementTransformImpl = () => null; function mapPropName(name5) { if (name5 === "class") return "className"; if (name5 === "for") return "htmlFor"; if (name5 === "formaction") return "formAction"; if (name5 === "innerHtml") return "innerHTML"; if (name5 === "readonly") return "readOnly"; if (name5 === "tabindex") return "tabIndex"; return name5; } function setPropertyAndInputs(tNode, lView, propName, value, renderer, sanitizer) { ngDevMode && assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); const tView = lView[TVIEW]; const hasSetInput = setAllInputsForProperty(tNode, tView, lView, propName, value); if (hasSetInput) { isComponentHost(tNode) && markDirtyIfOnPush(lView, tNode.index); ngDevMode && setNgReflectProperties(lView, tView, tNode, propName, value); return; } if (tNode.type & 3) { propName = mapPropName(propName); } setDomProperty(tNode, lView, propName, value, renderer, sanitizer); } function setDomProperty(tNode, lView, propName, value, renderer, sanitizer) { if (tNode.type & 3) { const element = getNativeByTNode(tNode, lView); if (ngDevMode) { validateAgainstEventProperties(propName); if (!isPropertyValid(element, propName, tNode.value, lView[TVIEW].schemas)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } } value = sanitizer != null ? sanitizer(value, tNode.value || "", propName) : value; renderer.setProperty(element, propName, value); } else if (tNode.type & 12) { if (ngDevMode && !matchingSchemas(lView[TVIEW].schemas, tNode.value)) { handleUnknownPropertyError(propName, tNode.value, tNode.type, lView); } } } function markDirtyIfOnPush(lView, viewIndex) { ngDevMode && assertLView(lView); const childComponentLView = getComponentLViewByIndex(viewIndex, lView); if (!(childComponentLView[FLAGS] & 16)) { childComponentLView[FLAGS] |= 64; } } function setNgReflectProperty(lView, tNode, attrName, value) { const environment2 = lView[ENVIRONMENT]; if (!environment2.ngReflect) { return; } const element = getNativeByTNode(tNode, lView); const renderer = lView[RENDERER]; attrName = normalizeDebugBindingName(attrName); const debugValue = normalizeDebugBindingValue(value); if (tNode.type & 3) { if (value == null) { renderer.removeAttribute(element, attrName); } else { renderer.setAttribute(element, attrName, debugValue); } } else { const textContent = escapeCommentText(`bindings=${JSON.stringify({ [attrName]: debugValue }, null, 2)}`); renderer.setValue(element, textContent); } } function setNgReflectProperties(lView, tView, tNode, publicName, value) { const environment2 = lView[ENVIRONMENT]; if (!environment2.ngReflect || !(tNode.type & (3 | 4))) { return; } const inputConfig = tNode.inputs?.[publicName]; const hostInputConfig = tNode.hostDirectiveInputs?.[publicName]; if (hostInputConfig) { for (let i25 = 0; i25 < hostInputConfig.length; i25 += 2) { const index = hostInputConfig[i25]; const publicName2 = hostInputConfig[i25 + 1]; const def = tView.data[index]; setNgReflectProperty(lView, tNode, def.inputs[publicName2][0], value); } } if (inputConfig) { for (const index of inputConfig) { const def = tView.data[index]; setNgReflectProperty(lView, tNode, def.inputs[publicName][0], value); } } } function instantiateAllDirectives(tView, lView, tNode) { const start = tNode.directiveStart; const end = tNode.directiveEnd; if (isComponentHost(tNode)) { ngDevMode && assertTNodeType( tNode, 3 /* TNodeType.AnyRNode */ ); createComponentLView(lView, tNode, tView.data[start + tNode.componentOffset]); } if (!tView.firstCreatePass) { getOrCreateNodeInjectorForNode(tNode, lView); } const initialInputs = tNode.initialInputs; for (let i25 = start; i25 < end; i25++) { const def = tView.data[i25]; const directive = getNodeInjectable(lView, tView, i25, tNode); attachPatchData(directive, lView); if (initialInputs !== null) { setInputsFromAttrs(lView, i25 - start, directive, def, tNode, initialInputs); } if (isComponentDef(def)) { const componentView = getComponentLViewByIndex(tNode.index, lView); componentView[CONTEXT] = getNodeInjectable(lView, tView, i25, tNode); } } } function invokeDirectivesHostBindings(tView, lView, tNode) { const start = tNode.directiveStart; const end = tNode.directiveEnd; const elementIndex = tNode.index; const currentDirectiveIndex = getCurrentDirectiveIndex(); try { setSelectedIndex(elementIndex); for (let dirIndex = start; dirIndex < end; dirIndex++) { const def = tView.data[dirIndex]; const directive = lView[dirIndex]; setCurrentDirectiveIndex(dirIndex); if (def.hostBindings !== null || def.hostVars !== 0 || def.hostAttrs !== null) { invokeHostBindingsInCreationMode(def, directive); } } } finally { setSelectedIndex(-1); setCurrentDirectiveIndex(currentDirectiveIndex); } } function invokeHostBindingsInCreationMode(def, directive) { if (def.hostBindings !== null) { def.hostBindings(1, directive); } } function findDirectiveDefMatches(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); const registry2 = tView.directiveRegistry; let matches = null; if (registry2) { for (let i25 = 0; i25 < registry2.length; i25++) { const def = registry2[i25]; if (isNodeMatchingSelectorList( tNode, def.selectors, /* isProjectionMode */ false )) { matches ??= []; if (isComponentDef(def)) { if (ngDevMode) { assertTNodeType(tNode, 2, `"${tNode.value}" tags cannot be used as component hosts. Please use a different tag to activate the ${stringify(def.type)} component.`); if (matches.length && isComponentDef(matches[0])) { throwMultipleComponentError(tNode, matches.find(isComponentDef).type, def.type); } } matches.unshift(def); } else { matches.push(def); } } } } return matches; } function elementAttributeInternal(tNode, lView, name5, value, sanitizer, namespace) { if (ngDevMode) { assertNotSame(value, NO_CHANGE, "Incoming value should never be NO_CHANGE."); validateAgainstEventAttributes(name5); assertTNodeType(tNode, 2, `Attempted to set attribute \`${name5}\` on a container node. Host bindings are not valid on ng-container or ng-template.`); } const element = getNativeByTNode(tNode, lView); setElementAttribute(lView[RENDERER], element, namespace, tNode.value, name5, value, sanitizer); } function setElementAttribute(renderer, element, namespace, tagName, name5, value, sanitizer) { if (value == null) { renderer.removeAttribute(element, name5, namespace); } else { const strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tagName || "", name5); renderer.setAttribute(element, name5, strValue, namespace); } } function setInputsFromAttrs(lView, directiveIndex, instance, def, tNode, initialInputData) { const initialInputs = initialInputData[directiveIndex]; if (initialInputs !== null) { for (let i25 = 0; i25 < initialInputs.length; i25 += 2) { const lookupName = initialInputs[i25]; const value = initialInputs[i25 + 1]; writeToDirectiveInput(def, instance, lookupName, value); if (ngDevMode) { setNgReflectProperty(lView, tNode, def.inputs[lookupName][0], value); } } } } function elementLikeStartShared(tNode, lView, index, name5, locateOrCreateNativeNode) { const adjustedIndex = HEADER_OFFSET + index; const tView = lView[TVIEW]; const native = locateOrCreateNativeNode(tView, lView, tNode, name5, index); lView[adjustedIndex] = native; setCurrentTNode(tNode, true); const isElement = tNode.type === 2; if (isElement) { setupStaticAttributes(lView[RENDERER], native, tNode); if (getElementDepthCount() === 0 || isDirectiveHost(tNode)) { attachPatchData(native, lView); } increaseElementDepthCount(); } else { attachPatchData(native, lView); } if (wasLastNodeCreated() && (!isElement || !isDetachedByI18n(tNode))) { appendChild(tView, lView, native, tNode); } return tNode; } function elementLikeEndShared(tNode) { let currentTNode = tNode; if (isCurrentTNodeParent()) { setCurrentTNodeAsNotParent(); } else { ngDevMode && assertHasParent(getCurrentTNode()); currentTNode = currentTNode.parent; setCurrentTNode(currentTNode, false); } return currentTNode; } function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex, ...interpolationParts) { if (tData[bindingIndex] === null) { if (!tNode.inputs?.[propertyName] && !tNode.hostDirectiveInputs?.[propertyName]) { const propBindingIdxs = tNode.propertyBindings || (tNode.propertyBindings = []); propBindingIdxs.push(bindingIndex); let bindingMetadata = propertyName; if (interpolationParts.length > 0) { bindingMetadata += INTERPOLATION_DELIMITER + interpolationParts.join(INTERPOLATION_DELIMITER); } tData[bindingIndex] = bindingMetadata; } } } function loadComponentRenderer(currentDef, tNode, lView) { if (currentDef === null || isComponentDef(currentDef)) { lView = unwrapLView(lView[tNode.index]); } return lView[RENDERER]; } function handleUncaughtError(lView, error) { const injector = lView[INJECTOR]; if (!injector) { return; } let errorHandler2; try { errorHandler2 = injector.get(INTERNAL_APPLICATION_ERROR_HANDLER, null); } catch { errorHandler2 = null; } errorHandler2?.(error); } function setAllInputsForProperty(tNode, tView, lView, publicName, value) { const inputs = tNode.inputs?.[publicName]; const hostDirectiveInputs = tNode.hostDirectiveInputs?.[publicName]; let hasMatch = false; if (hostDirectiveInputs) { for (let i25 = 0; i25 < hostDirectiveInputs.length; i25 += 2) { const index = hostDirectiveInputs[i25]; ngDevMode && assertIndexInRange(lView, index); const publicName2 = hostDirectiveInputs[i25 + 1]; const def = tView.data[index]; writeToDirectiveInput(def, lView[index], publicName2, value); hasMatch = true; } } if (inputs) { for (const index of inputs) { ngDevMode && assertIndexInRange(lView, index); const instance = lView[index]; const def = tView.data[index]; writeToDirectiveInput(def, instance, publicName, value); hasMatch = true; } } return hasMatch; } function renderComponent(hostLView, componentHostIdx) { ngDevMode && assertEqual(isCreationMode(hostLView), true, "Should be run in creation mode"); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); const componentTView = componentView[TVIEW]; syncViewWithBlueprint(componentTView, componentView); const hostRNode = componentView[HOST]; if (hostRNode !== null && componentView[HYDRATION] === null) { componentView[HYDRATION] = retrieveHydrationInfo(hostRNode, componentView[INJECTOR]); } profiler( 18 /* ProfilerEvent.ComponentStart */ ); renderView(componentTView, componentView, componentView[CONTEXT]); profiler(19, componentView[CONTEXT]); } function syncViewWithBlueprint(tView, lView) { for (let i25 = lView.length; i25 < tView.blueprint.length; i25++) { lView.push(tView.blueprint[i25]); } } function renderView(tView, lView, context2) { ngDevMode && assertEqual(isCreationMode(lView), true, "Should be run in creation mode"); ngDevMode && assertNotReactive(renderView.name); enterView(lView); try { const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(1, viewQuery, context2); } const templateFn = tView.template; if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 1, context2); } if (tView.firstCreatePass) { tView.firstCreatePass = false; } lView[QUERIES]?.finishViewCreation(tView); if (tView.staticContentQueries) { refreshContentQueries(tView, lView); } if (tView.staticViewQueries) { executeViewQueryFn(2, tView.viewQuery, context2); } const components = tView.components; if (components !== null) { renderChildComponents(lView, components); } } catch (error) { if (tView.firstCreatePass) { tView.incompleteFirstPass = true; tView.firstCreatePass = false; } throw error; } finally { lView[FLAGS] &= ~4; leaveView(); } } function renderChildComponents(hostLView, components) { for (let i25 = 0; i25 < components.length; i25++) { renderComponent(hostLView, components[i25]); } } function createAndRenderEmbeddedLView(declarationLView, templateTNode, context2, options) { const prevConsumer = setActiveConsumer(null); try { const embeddedTView = templateTNode.tView; ngDevMode && assertDefined(embeddedTView, "TView must be defined for a template node."); ngDevMode && assertTNodeForLView(templateTNode, declarationLView); const isSignalView = declarationLView[FLAGS] & 4096; const viewFlags = isSignalView ? 4096 : 16; const embeddedLView = createLView(declarationLView, embeddedTView, context2, viewFlags, null, templateTNode, null, null, options?.injector ?? null, options?.embeddedViewInjector ?? null, options?.dehydratedView ?? null); const declarationLContainer = declarationLView[templateTNode.index]; ngDevMode && assertLContainer(declarationLContainer); embeddedLView[DECLARATION_LCONTAINER] = declarationLContainer; const declarationViewLQueries = declarationLView[QUERIES]; if (declarationViewLQueries !== null) { embeddedLView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView); } renderView(embeddedTView, embeddedLView, context2); return embeddedLView; } finally { setActiveConsumer(prevConsumer); } } function shouldAddViewToDom(tNode, dehydratedView) { return !dehydratedView || dehydratedView.firstChild === null || hasInSkipHydrationBlockFlag(tNode); } var USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT = false; var UseExhaustiveCheckNoChanges = new InjectionToken(ngDevMode ? "exhaustive checkNoChanges" : ""); function collectNativeNodes(tView, lView, tNode, result, isProjection = false) { while (tNode !== null) { if (tNode.type === 128) { tNode = isProjection ? tNode.projectionNext : tNode.next; continue; } ngDevMode && assertTNodeType( tNode, 3 | 12 | 16 | 32 /* TNodeType.Icu */ ); const lNode = lView[tNode.index]; if (lNode !== null) { result.push(unwrapRNode(lNode)); } if (isLContainer(lNode)) { collectNativeNodesInLContainer(lNode, result); } const tNodeType = tNode.type; if (tNodeType & 8) { collectNativeNodes(tView, lView, tNode.child, result); } else if (tNodeType & 32) { const nextRNode = icuContainerIterate(tNode, lView); let rNode; while (rNode = nextRNode()) { result.push(rNode); } } else if (tNodeType & 16) { const nodesInSlot = getProjectionNodes(lView, tNode); if (Array.isArray(nodesInSlot)) { result.push(...nodesInSlot); } else { const parentView = getLViewParent(lView[DECLARATION_COMPONENT_VIEW]); ngDevMode && assertParentView(parentView); collectNativeNodes(parentView[TVIEW], parentView, nodesInSlot, result, true); } } tNode = isProjection ? tNode.projectionNext : tNode.next; } return result; } function collectNativeNodesInLContainer(lContainer, result) { for (let i25 = CONTAINER_HEADER_OFFSET; i25 < lContainer.length; i25++) { const lViewInAContainer = lContainer[i25]; const lViewFirstChildTNode = lViewInAContainer[TVIEW].firstChild; if (lViewFirstChildTNode !== null) { collectNativeNodes(lViewInAContainer[TVIEW], lViewInAContainer, lViewFirstChildTNode, result); } } if (lContainer[NATIVE] !== lContainer[HOST]) { result.push(lContainer[NATIVE]); } } function addAfterRenderSequencesForView(lView) { if (lView[AFTER_RENDER_SEQUENCES_TO_ADD] !== null) { for (const sequence2 of lView[AFTER_RENDER_SEQUENCES_TO_ADD]) { sequence2.impl.addSequence(sequence2); } lView[AFTER_RENDER_SEQUENCES_TO_ADD].length = 0; } } var freeConsumers = []; function getOrBorrowReactiveLViewConsumer(lView) { return lView[REACTIVE_TEMPLATE_CONSUMER] ?? borrowReactiveLViewConsumer(lView); } function borrowReactiveLViewConsumer(lView) { const consumer = freeConsumers.pop() ?? Object.create(REACTIVE_LVIEW_CONSUMER_NODE); consumer.lView = lView; return consumer; } function maybeReturnReactiveLViewConsumer(consumer) { if (consumer.lView[REACTIVE_TEMPLATE_CONSUMER] === consumer) { return; } consumer.lView = null; freeConsumers.push(consumer); } var REACTIVE_LVIEW_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, kind: "template", consumerMarkedDirty: (node) => { markAncestorsForTraversal(node.lView); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function getOrCreateTemporaryConsumer(lView) { const consumer = lView[REACTIVE_TEMPLATE_CONSUMER] ?? Object.create(TEMPORARY_CONSUMER_NODE); consumer.lView = lView; return consumer; } var TEMPORARY_CONSUMER_NODE = __spreadProps(__spreadValues({}, REACTIVE_NODE), { consumerIsAlwaysLive: true, kind: "template", consumerMarkedDirty: (node) => { let parent2 = getLViewParent(node.lView); while (parent2 && !viewShouldHaveReactiveConsumer(parent2[TVIEW])) { parent2 = getLViewParent(parent2); } if (!parent2) { return; } markViewForRefresh(parent2); }, consumerOnSignalRead() { this.lView[REACTIVE_TEMPLATE_CONSUMER] = this; } }); function viewShouldHaveReactiveConsumer(tView) { return tView.type !== 2; } function isReactiveLViewConsumer(node) { return node.kind === "template"; } function runEffectsInView(view) { if (view[EFFECTS] === null) { return; } let tryFlushEffects = true; while (tryFlushEffects) { let foundDirtyEffect = false; for (const effect2 of view[EFFECTS]) { if (!effect2.dirty) { continue; } foundDirtyEffect = true; if (effect2.zone === null || Zone.current === effect2.zone) { effect2.run(); } else { effect2.zone.run(() => effect2.run()); } } tryFlushEffects = foundDirtyEffect && !!(view[FLAGS] & 8192); } } var MAXIMUM_REFRESH_RERUNS$1 = 100; function detectChangesInternal(lView, mode = 0) { const environment2 = lView[ENVIRONMENT]; const rendererFactory = environment2.rendererFactory; const checkNoChangesMode = !!ngDevMode && isInCheckNoChangesMode(); if (!checkNoChangesMode) { rendererFactory.begin?.(); } try { detectChangesInViewWhileDirty(lView, mode); } finally { if (!checkNoChangesMode) { rendererFactory.end?.(); } } } function detectChangesInViewWhileDirty(lView, mode) { const lastIsRefreshingViewsValue = isRefreshingViews(); try { setIsRefreshingViews(true); detectChangesInView(lView, mode); if (ngDevMode && isExhaustiveCheckNoChanges()) { return; } let retries = 0; while (requiresRefreshOrTraversal(lView)) { if (retries === MAXIMUM_REFRESH_RERUNS$1) { throw new RuntimeError(103, ngDevMode && "Infinite change detection while trying to refresh views. There may be components which each cause the other to require a refresh, causing an infinite loop."); } retries++; detectChangesInView( lView, 1 /* ChangeDetectionMode.Targeted */ ); } } finally { setIsRefreshingViews(lastIsRefreshingViewsValue); } } function checkNoChangesInternal(lView, exhaustive) { setIsInCheckNoChangesMode(exhaustive ? CheckNoChangesMode.Exhaustive : CheckNoChangesMode.OnlyDirtyViews); try { detectChangesInternal(lView); } finally { setIsInCheckNoChangesMode(CheckNoChangesMode.Off); } } function refreshView(tView, lView, templateFn, context2) { ngDevMode && assertEqual(isCreationMode(lView), false, "Should be run in update mode"); if (isDestroyed(lView)) return; const flags = lView[FLAGS]; const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const isInExhaustiveCheckNoChangesPass = ngDevMode && isExhaustiveCheckNoChanges(); enterView(lView); let returnConsumerToPool = true; let prevConsumer = null; let currentConsumer = null; if (!isInCheckNoChangesPass) { if (viewShouldHaveReactiveConsumer(tView)) { currentConsumer = getOrBorrowReactiveLViewConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (getActiveConsumer() === null) { returnConsumerToPool = false; currentConsumer = getOrCreateTemporaryConsumer(lView); prevConsumer = consumerBeforeComputation(currentConsumer); } else if (lView[REACTIVE_TEMPLATE_CONSUMER]) { consumerDestroy(lView[REACTIVE_TEMPLATE_CONSUMER]); lView[REACTIVE_TEMPLATE_CONSUMER] = null; } } try { resetPreOrderHookFlags(lView); setBindingIndex(tView.bindingStartIndex); if (templateFn !== null) { executeTemplate(tView, lView, templateFn, 2, context2); } runEnterAnimations(lView); const hooksInitPhaseCompleted = (flags & 3) === 3; if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const preOrderCheckHooks = tView.preOrderCheckHooks; if (preOrderCheckHooks !== null) { executeCheckHooks(lView, preOrderCheckHooks, null); } } else { const preOrderHooks = tView.preOrderHooks; if (preOrderHooks !== null) { executeInitAndCheckHooks(lView, preOrderHooks, 0, null); } incrementInitPhaseFlags( lView, 0 /* InitPhaseState.OnInitHooksToBeRun */ ); } } if (!isInExhaustiveCheckNoChangesPass) { markTransplantedViewsForRefresh(lView); } runEffectsInView(lView); detectChangesInEmbeddedViews( lView, 0 /* ChangeDetectionMode.Global */ ); if (tView.contentQueries !== null) { refreshContentQueries(tView, lView); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const contentCheckHooks = tView.contentCheckHooks; if (contentCheckHooks !== null) { executeCheckHooks(lView, contentCheckHooks); } } else { const contentHooks = tView.contentHooks; if (contentHooks !== null) { executeInitAndCheckHooks( lView, contentHooks, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 1 /* InitPhaseState.AfterContentInitHooksToBeRun */ ); } } processHostBindingOpCodes(tView, lView); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 0 /* ChangeDetectionMode.Global */ ); } const viewQuery = tView.viewQuery; if (viewQuery !== null) { executeViewQueryFn(2, viewQuery, context2); } if (!isInCheckNoChangesPass) { if (hooksInitPhaseCompleted) { const viewCheckHooks = tView.viewCheckHooks; if (viewCheckHooks !== null) { executeCheckHooks(lView, viewCheckHooks); } } else { const viewHooks = tView.viewHooks; if (viewHooks !== null) { executeInitAndCheckHooks( lView, viewHooks, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } incrementInitPhaseFlags( lView, 2 /* InitPhaseState.AfterViewInitHooksToBeRun */ ); } } if (tView.firstUpdatePass === true) { tView.firstUpdatePass = false; } if (lView[EFFECTS_TO_SCHEDULE]) { for (const notifyEffect of lView[EFFECTS_TO_SCHEDULE]) { notifyEffect(); } lView[EFFECTS_TO_SCHEDULE] = null; } if (!isInCheckNoChangesPass) { addAfterRenderSequencesForView(lView); lView[FLAGS] &= ~(64 | 8); } } catch (e56) { if (!isInCheckNoChangesPass) { markAncestorsForTraversal(lView); } throw e56; } finally { if (currentConsumer !== null) { consumerAfterComputation(currentConsumer, prevConsumer); if (returnConsumerToPool) { maybeReturnReactiveLViewConsumer(currentConsumer); } } leaveView(); } } function runEnterAnimations(lView) { const animationData = lView[ANIMATIONS]; if (animationData?.enter) { for (const animateFn of animationData.enter) { animateFn(); } animationData.enter = void 0; } } function detectChangesInEmbeddedViews(lView, mode) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { for (let i25 = CONTAINER_HEADER_OFFSET; i25 < lContainer.length; i25++) { const embeddedLView = lContainer[i25]; detectChangesInViewIfAttached(embeddedLView, mode); } } } function markTransplantedViewsForRefresh(lView) { for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) { if (!(lContainer[FLAGS] & 2)) continue; const movedViews = lContainer[MOVED_VIEWS]; ngDevMode && assertDefined(movedViews, "Transplanted View flags set but missing MOVED_VIEWS"); for (let i25 = 0; i25 < movedViews.length; i25++) { const movedLView = movedViews[i25]; markViewForRefresh(movedLView); } } } function detectChangesInComponent(hostLView, componentHostIdx, mode) { ngDevMode && assertEqual(isCreationMode(hostLView), false, "Should be run in update mode"); profiler( 18 /* ProfilerEvent.ComponentStart */ ); const componentView = getComponentLViewByIndex(componentHostIdx, hostLView); detectChangesInViewIfAttached(componentView, mode); profiler(19, componentView[CONTEXT]); } function detectChangesInViewIfAttached(lView, mode) { if (!viewAttachedToChangeDetector(lView)) { return; } detectChangesInView(lView, mode); } function detectChangesInView(lView, mode) { const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode(); const tView = lView[TVIEW]; const flags = lView[FLAGS]; const consumer = lView[REACTIVE_TEMPLATE_CONSUMER]; let shouldRefreshView = !!(mode === 0 && flags & 16); shouldRefreshView ||= !!(flags & 64 && mode === 0 && !isInCheckNoChangesPass); shouldRefreshView ||= !!(flags & 1024); shouldRefreshView ||= !!(consumer?.dirty && consumerPollProducersForChange(consumer)); shouldRefreshView ||= !!(ngDevMode && isExhaustiveCheckNoChanges()); if (consumer) { consumer.dirty = false; } lView[FLAGS] &= ~(8192 | 1024); if (shouldRefreshView) { refreshView(tView, lView, tView.template, lView[CONTEXT]); } else if (flags & 8192) { const prevConsumer = setActiveConsumer(null); try { if (!isInCheckNoChangesPass) { runEffectsInView(lView); } detectChangesInEmbeddedViews( lView, 1 /* ChangeDetectionMode.Targeted */ ); const components = tView.components; if (components !== null) { detectChangesInChildComponents( lView, components, 1 /* ChangeDetectionMode.Targeted */ ); } if (!isInCheckNoChangesPass) { addAfterRenderSequencesForView(lView); } } finally { setActiveConsumer(prevConsumer); } } } function detectChangesInChildComponents(hostLView, components, mode) { for (let i25 = 0; i25 < components.length; i25++) { detectChangesInComponent(hostLView, components[i25], mode); } } function processHostBindingOpCodes(tView, lView) { const hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) return; try { for (let i25 = 0; i25 < hostBindingOpCodes.length; i25++) { const opCode = hostBindingOpCodes[i25]; if (opCode < 0) { setSelectedIndex(~opCode); } else { const directiveIdx = opCode; const bindingRootIndx = hostBindingOpCodes[++i25]; const hostBindingFn = hostBindingOpCodes[++i25]; setBindingRootForHostBindings(bindingRootIndx, directiveIdx); const context2 = lView[directiveIdx]; profiler(24, context2); hostBindingFn(2, context2); profiler(25, context2); } } } finally { setSelectedIndex(-1); } } function markViewDirty(lView, source) { const dirtyBitsToUse = isRefreshingViews() ? ( // When we are actively refreshing views, we only use the `Dirty` bit to mark a view 64 ) : ( // When we are not actively refreshing a view tree, it is absolutely // valid to update state and mark views dirty. We use the `RefreshView` flag in this // case to allow synchronously rerunning change detection. This applies today to // afterRender hooks as well as animation listeners which execute after detecting // changes in a view when the render factory flushes. 1024 | 64 ); lView[ENVIRONMENT].changeDetectionScheduler?.notify(source); while (lView) { lView[FLAGS] |= dirtyBitsToUse; const parent2 = getLViewParent(lView); if (isRootView(lView) && !parent2) { return lView; } lView = parent2; } return null; } function createLContainer(hostNative, currentView, native, tNode) { ngDevMode && assertLView(currentView); const lContainer = [ hostNative, // host native true, // Boolean `true` in this position signifies that this is an `LContainer` 0, // flags currentView, // parent null, // next tNode, // t_host null, // dehydrated views native, // native, null, // view refs null // moved views ]; ngDevMode && assertEqual(lContainer.length, CONTAINER_HEADER_OFFSET, "Should allocate correct number of slots for LContainer header."); return lContainer; } function getLViewFromLContainer(lContainer, index) { const adjustedIndex = CONTAINER_HEADER_OFFSET + index; if (adjustedIndex < lContainer.length) { const lView = lContainer[adjustedIndex]; ngDevMode && assertLView(lView); return lView; } return void 0; } function addLViewToLContainer(lContainer, lView, index, addToDOM = true) { const tView = lView[TVIEW]; insertView(tView, lView, lContainer, index); if (addToDOM) { const beforeNode = getBeforeNodeForView(index, lContainer); const renderer = lView[RENDERER]; const parentRNode = renderer.parentNode(lContainer[NATIVE]); if (parentRNode !== null) { addViewToDOM(tView, lContainer[T_HOST], renderer, lView, parentRNode, beforeNode); } } const hydrationInfo = lView[HYDRATION]; if (hydrationInfo !== null && hydrationInfo.firstChild !== null) { hydrationInfo.firstChild = null; } } function removeLViewFromLContainer(lContainer, index) { const lView = detachView(lContainer, index); if (lView !== void 0) { destroyLView(lView[TVIEW], lView); } return lView; } function detachView(lContainer, removeIndex) { if (lContainer.length <= CONTAINER_HEADER_OFFSET) return; const indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex; const viewToDetach = lContainer[indexInContainer]; if (viewToDetach) { const declarationLContainer = viewToDetach[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && declarationLContainer !== lContainer) { detachMovedView(declarationLContainer, viewToDetach); } if (removeIndex > 0) { lContainer[indexInContainer - 1][NEXT] = viewToDetach[NEXT]; } const removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex); removeViewFromDOM(viewToDetach[TVIEW], viewToDetach); const lQueries = removedLView[QUERIES]; if (lQueries !== null) { lQueries.detachView(removedLView[TVIEW]); } viewToDetach[PARENT] = null; viewToDetach[NEXT] = null; viewToDetach[FLAGS] &= ~128; } return viewToDetach; } function insertView(tView, lView, lContainer, index) { ngDevMode && assertLView(lView); ngDevMode && assertLContainer(lContainer); const indexInContainer = CONTAINER_HEADER_OFFSET + index; const containerLength = lContainer.length; if (index > 0) { lContainer[indexInContainer - 1][NEXT] = lView; } if (index < containerLength - CONTAINER_HEADER_OFFSET) { lView[NEXT] = lContainer[indexInContainer]; addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView); } else { lContainer.push(lView); lView[NEXT] = null; } lView[PARENT] = lContainer; const declarationLContainer = lView[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && lContainer !== declarationLContainer) { trackMovedView(declarationLContainer, lView); } const lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.insertView(tView); } updateAncestorTraversalFlagsOnAttach(lView); lView[FLAGS] |= 128; } function trackMovedView(declarationContainer, lView) { ngDevMode && assertDefined(lView, "LView required"); ngDevMode && assertLContainer(declarationContainer); const movedViews = declarationContainer[MOVED_VIEWS]; const parent2 = lView[PARENT]; ngDevMode && assertDefined(parent2, "missing parent"); if (isLView(parent2)) { declarationContainer[FLAGS] |= 2; } else { const insertedComponentLView = parent2[PARENT][DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(insertedComponentLView, "Missing insertedComponentLView"); const declaredComponentLView = lView[DECLARATION_COMPONENT_VIEW]; ngDevMode && assertDefined(declaredComponentLView, "Missing declaredComponentLView"); if (declaredComponentLView !== insertedComponentLView) { declarationContainer[FLAGS] |= 2; } } if (movedViews === null) { declarationContainer[MOVED_VIEWS] = [lView]; } else { movedViews.push(lView); } } var ViewRef = class { _lView; _cdRefInjectingView; _appRef = null; _attachedToViewContainer = false; exhaustive; get rootNodes() { const lView = this._lView; const tView = lView[TVIEW]; return collectNativeNodes(tView, lView, tView.firstChild, []); } constructor(_lView, _cdRefInjectingView) { this._lView = _lView; this._cdRefInjectingView = _cdRefInjectingView; } get context() { return this._lView[CONTEXT]; } /** * @deprecated Replacing the full context object is not supported. Modify the context * directly, or consider using a `Proxy` if you need to replace the full object. * // TODO(devversion): Remove this. */ set context(value) { if (ngDevMode) { console.warn("Angular: Replacing the `context` object of an `EmbeddedViewRef` is deprecated."); } this._lView[CONTEXT] = value; } get destroyed() { return isDestroyed(this._lView); } destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._attachedToViewContainer) { const parent2 = this._lView[PARENT]; if (isLContainer(parent2)) { const viewRefs = parent2[VIEW_REFS]; const index = viewRefs ? viewRefs.indexOf(this) : -1; if (index > -1) { ngDevMode && assertEqual(index, parent2.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, "An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array."); detachView(parent2, index); removeFromArray(viewRefs, index); } } this._attachedToViewContainer = false; } destroyLView(this._lView[TVIEW], this._lView); } onDestroy(callback2) { storeLViewOnDestroy(this._lView, callback2); } /** * Marks a view and all of its ancestors dirty. * * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush} component is * checked when it needs to be re-rendered but the two normal triggers haven't marked it * dirty (i.e. inputs haven't changed and events haven't fired in the view). * * * * @usageNotes * ### Example * * ```ts * @Component({ * selector: 'app-root', * template: `Number of ticks: {{numberOfTicks}}` * changeDetection: ChangeDetectionStrategy.OnPush, * }) * class AppComponent { * numberOfTicks = 0; * * constructor(private ref: ChangeDetectorRef) { * setInterval(() => { * this.numberOfTicks++; * // the following is required, otherwise the view will not be updated * this.ref.markForCheck(); * }, 1000); * } * } * ``` */ markForCheck() { markViewDirty( this._cdRefInjectingView || this._lView, 4 /* NotificationSource.MarkForCheck */ ); } /** * Detaches the view from the change detection tree. * * Detached views will not be checked during change detection runs until they are * re-attached, even if they are dirty. `detach` can be used in combination with * {@link ChangeDetectorRef#detectChanges} to implement local change * detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. We can do that by detaching * the component's change detector and doing a local check every five seconds. * * ```ts * class DataProvider { * // in a real application the returned data will be different every time * get data() { * return [1,2,3,4,5]; * } * } * * @Component({ * selector: 'giant-list', * template: ` * @for(d of dataProvider.data; track $index) { *
  • Data {{d}}
  • * } * `, * }) * class GiantList { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) { * ref.detach(); * setInterval(() => { * this.ref.detectChanges(); * }, 5000); * } * } * * @Component({ * selector: 'app', * providers: [DataProvider], * template: ` * * `, * }) * class App { * } * ``` */ detach() { this._lView[FLAGS] &= ~128; } /** * Re-attaches a view to the change detection tree. * * This can be used to re-attach views that were previously detached from the tree * using {@link ChangeDetectorRef#detach}. Views are attached to the tree by default. * * * * @usageNotes * ### Example * * The following example creates a component displaying `live` data. The component will detach * its change detector from the main change detector tree when the component's live property * is set to false. * * ```ts * class DataProvider { * data = 1; * * constructor() { * setInterval(() => { * this.data = this.data * 2; * }, 500); * } * } * * @Component({ * selector: 'live-data', * inputs: ['live'], * template: 'Data: {{dataProvider.data}}' * }) * class LiveData { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {} * * set live(value) { * if (value) { * this.ref.reattach(); * } else { * this.ref.detach(); * } * } * } * * @Component({ * selector: 'app-root', * providers: [DataProvider], * template: ` * Live Update: * * `, * }) * class AppComponent { * live = true; * } * ``` */ reattach() { updateAncestorTraversalFlagsOnAttach(this._lView); this._lView[FLAGS] |= 128; } /** * Checks the view and its children. * * This can also be used in combination with {@link ChangeDetectorRef#detach} to implement * local change detection checks. * * * * * @usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine, the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. * * We can do that by detaching the component's change detector and doing a local change detection * check every five seconds. * * See {@link ChangeDetectorRef#detach} for more information. */ detectChanges() { this._lView[FLAGS] |= 1024; detectChangesInternal(this._lView); } /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. */ checkNoChanges() { if (ngDevMode) { try { this.exhaustive ??= this._lView[INJECTOR].get(UseExhaustiveCheckNoChanges, USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT); } catch { this.exhaustive = USE_EXHAUSTIVE_CHECK_NO_CHANGES_DEFAULT; } checkNoChangesInternal(this._lView, this.exhaustive); } } attachToViewContainerRef() { if (this._appRef) { throw new RuntimeError(902, ngDevMode && "This view is already attached directly to the ApplicationRef!"); } this._attachedToViewContainer = true; } detachFromAppRef() { this._appRef = null; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { detachMovedView(declarationContainer, this._lView); } detachViewFromDOM(this._lView[TVIEW], this._lView); } attachToAppRef(appRef) { if (this._attachedToViewContainer) { throw new RuntimeError(902, ngDevMode && "This view is already attached to a ViewContainer!"); } this._appRef = appRef; const isRoot = isRootView(this._lView); const declarationContainer = this._lView[DECLARATION_LCONTAINER]; if (declarationContainer !== null && !isRoot) { trackMovedView(declarationContainer, this._lView); } updateAncestorTraversalFlagsOnAttach(this._lView); } }; var TemplateRef = class { _declarationLView; _declarationTContainer; /** * The anchor element in the parent view for this embedded view. * * The data-binding and [injection contexts](guide/di/dependency-injection-context) of embedded * views created from this `TemplateRef` inherit from the contexts of this location. * * Typically new embedded views are attached to the view container of this location, but in * advanced use-cases, the view can be attached to a different container while keeping the * data-binding and injection context from the original location. * */ elementRef; /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectTemplateRef; /** @internal */ constructor(_declarationLView, _declarationTContainer, elementRef) { this._declarationLView = _declarationLView; this._declarationTContainer = _declarationTContainer; this.elementRef = elementRef; } /** * Returns an `ssrId` associated with a TView, which was used to * create this instance of the `TemplateRef`. * * @internal */ get ssrId() { return this._declarationTContainer.tView?.ssrId || null; } /** * Instantiates an unattached embedded view based on this template. * @param context The data-binding context of the embedded view, as declared * in the `` usage. * @param injector Injector to be used within the embedded view. * @returns The new embedded view object. */ createEmbeddedView(context2, injector) { return this.createEmbeddedViewImpl(context2, injector); } /** * Implementation of the `createEmbeddedView` function. * * This implementation is internal and allows framework code * to invoke it with extra parameters (e.g. for hydration) without * affecting public API. * * @internal */ createEmbeddedViewImpl(context2, injector, dehydratedView) { const embeddedLView = createAndRenderEmbeddedLView(this._declarationLView, this._declarationTContainer, context2, { embeddedViewInjector: injector, dehydratedView }); return new ViewRef(embeddedLView); } }; function injectTemplateRef() { return createTemplateRef(getCurrentTNode(), getLView()); } function createTemplateRef(hostTNode, hostLView) { if (hostTNode.type & 4) { ngDevMode && assertDefined(hostTNode.tView, "TView must be allocated"); return new TemplateRef(hostLView, hostTNode, createElementRef(hostTNode, hostLView)); } return null; } var AT_THIS_LOCATION = "<-- AT THIS LOCATION"; function getFriendlyStringFromTNodeType(tNodeType) { switch (tNodeType) { case 4: return "view container"; case 2: return "element"; case 8: return "ng-container"; case 32: return "icu"; case 64: return "i18n"; case 16: return "projection"; case 1: return "text"; case 128: return "@let"; default: return ""; } } function validateSiblingNodeExists(node) { validateNodeExists(node); if (!node.nextSibling) { const header = "During hydration Angular expected more sibling nodes to be present.\n\n"; const actual = `Actual DOM is: ${describeDomFromNode(node)} `; const footer = getHydrationErrorFooter(); const message2 = header + actual + footer; markRNodeAsHavingHydrationMismatch(node, "", actual); throw new RuntimeError(-501, message2); } } function validateNodeExists(node, lView = null, tNode = null) { if (!node) { const header = "During hydration, Angular expected an element to be present at this location.\n\n"; let expected = ""; let footer = ""; if (lView !== null && tNode !== null) { expected = describeExpectedDom(lView, tNode, false); footer = getHydrationErrorFooter(); markRNodeAsHavingHydrationMismatch(unwrapRNode(lView[HOST]), expected, ""); } throw new RuntimeError(-502, `${header}${expected} ${footer}`); } } function stringifyTNodeAttrs(tNode) { const results = []; if (tNode.attrs) { for (let i25 = 0; i25 < tNode.attrs.length; ) { const attrName = tNode.attrs[i25++]; if (typeof attrName == "number") { break; } const attrValue = tNode.attrs[i25++]; results.push(`${attrName}="${shorten(attrValue)}"`); } } return results.join(" "); } var internalAttrs = /* @__PURE__ */ new Set(["ngh", "ng-version", "ng-server-context"]); function stringifyRNodeAttrs(rNode) { const results = []; for (let i25 = 0; i25 < rNode.attributes.length; i25++) { const attr = rNode.attributes[i25]; if (internalAttrs.has(attr.name)) continue; results.push(`${attr.name}="${shorten(attr.value)}"`); } return results.join(" "); } function describeTNode(tNode, innerContent = "\u2026") { switch (tNode.type) { case 1: const content = tNode.value ? `(${tNode.value})` : ""; return `#text${content}`; case 2: const attrs = stringifyTNodeAttrs(tNode); const tag = tNode.value.toLowerCase(); return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}`; case 8: return ""; case 4: return ""; default: const typeAsString = getFriendlyStringFromTNodeType(tNode.type); return `#node(${typeAsString})`; } } function describeRNode(rNode, innerContent = "\u2026") { const node = rNode; switch (node.nodeType) { case Node.ELEMENT_NODE: const tag = node.tagName.toLowerCase(); const attrs = stringifyRNodeAttrs(node); return `<${tag}${attrs ? " " + attrs : ""}>${innerContent}`; case Node.TEXT_NODE: const content = node.textContent ? shorten(node.textContent) : ""; return `#text${content ? `(${content})` : ""}`; case Node.COMMENT_NODE: return ``; default: return `#node(${node.nodeType})`; } } function describeExpectedDom(lView, tNode, isViewContainerAnchor) { const spacer = " "; let content = ""; if (tNode.prev) { content += spacer + "\u2026\n"; content += spacer + describeTNode(tNode.prev) + "\n"; } else if (tNode.type && tNode.type & 12) { content += spacer + "\u2026\n"; } if (isViewContainerAnchor) { content += spacer + describeTNode(tNode) + "\n"; content += spacer + ` ${AT_THIS_LOCATION} `; } else { content += spacer + describeTNode(tNode) + ` ${AT_THIS_LOCATION} `; } content += spacer + "\u2026\n"; const parentRNode = tNode.type ? getParentRElement(lView[TVIEW], tNode, lView) : null; if (parentRNode) { content = describeRNode(parentRNode, "\n" + content); } return content; } function describeDomFromNode(node) { const spacer = " "; let content = ""; const currentNode = node; if (currentNode.previousSibling) { content += spacer + "\u2026\n"; content += spacer + describeRNode(currentNode.previousSibling) + "\n"; } content += spacer + describeRNode(currentNode) + ` ${AT_THIS_LOCATION} `; if (node.nextSibling) { content += spacer + "\u2026\n"; } if (node.parentNode) { content = describeRNode(currentNode.parentNode, "\n" + content); } return content; } function getHydrationErrorFooter(componentClassName) { const componentInfo = componentClassName ? `the "${componentClassName}"` : "corresponding"; return `To fix this problem: * check ${componentInfo} component for hydration-related issues * check to see if your template has valid HTML structure * or skip hydration by adding the \`ngSkipHydration\` attribute to its host node in a template `; } function stripNewlines(input2) { return input2.replace(/\s+/gm, ""); } function shorten(input2, maxLength = 50) { if (!input2) { return ""; } input2 = stripNewlines(input2); return input2.length > maxLength ? `${input2.substring(0, maxLength - 1)}\u2026` : input2; } function getInsertInFrontOfRNodeWithI18n(parentTNode, currentTNode, lView) { const tNodeInsertBeforeIndex = currentTNode.insertBeforeIndex; const insertBeforeIndex = Array.isArray(tNodeInsertBeforeIndex) ? tNodeInsertBeforeIndex[0] : tNodeInsertBeforeIndex; if (insertBeforeIndex === null) { return getInsertInFrontOfRNodeWithNoI18n(parentTNode, currentTNode, lView); } else { ngDevMode && assertIndexInRange(lView, insertBeforeIndex); return unwrapRNode(lView[insertBeforeIndex]); } } function processI18nInsertBefore(renderer, childTNode, lView, childRNode, parentRElement) { const tNodeInsertBeforeIndex = childTNode.insertBeforeIndex; if (Array.isArray(tNodeInsertBeforeIndex)) { ngDevMode && assertDomNode(childRNode); let i18nParent = childRNode; let anchorRNode = null; if (!(childTNode.type & 3)) { anchorRNode = i18nParent; i18nParent = parentRElement; } if (i18nParent !== null && childTNode.componentOffset === -1) { for (let i25 = 1; i25 < tNodeInsertBeforeIndex.length; i25++) { const i18nChild = lView[tNodeInsertBeforeIndex[i25]]; nativeInsertBefore(renderer, i18nParent, i18nChild, anchorRNode, false); } } } } function getOrCreateTNode(tView, index, type, name5, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertPureTNodeType(type); let tNode = tView.data[index]; if (tNode === null) { tNode = createTNodeAtIndex(tView, index, type, name5, attrs); if (isInI18nBlock()) { tNode.flags |= 32; } } else if (tNode.type & 64) { tNode.type = type; tNode.value = name5; tNode.attrs = attrs; const parent2 = getCurrentParentTNode(); tNode.injectorIndex = parent2 === null ? -1 : parent2.injectorIndex; ngDevMode && assertTNodeForTView(tNode, tView); ngDevMode && assertEqual(index, tNode.index, "Expecting same index"); } setCurrentTNode(tNode, true); return tNode; } function createTNodeAtIndex(tView, index, type, name5, attrs) { const currentTNode = getCurrentTNodePlaceholderOk(); const isParent = isCurrentTNodeParent(); const parent2 = isParent ? currentTNode : currentTNode && currentTNode.parent; const tNode = tView.data[index] = createTNode(tView, parent2, type, index, name5, attrs); linkTNodeInTView(tView, tNode, currentTNode, isParent); return tNode; } function linkTNodeInTView(tView, tNode, currentTNode, isParent) { if (tView.firstChild === null) { tView.firstChild = tNode; } if (currentTNode !== null) { if (isParent) { if (currentTNode.child == null && tNode.parent !== null) { currentTNode.child = tNode; } } else { if (currentTNode.next === null) { currentTNode.next = tNode; tNode.prev = currentTNode; } } } } function createTNode(tView, tParent, type, index, value, attrs) { ngDevMode && index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in // `view_engine_compatibility` for additional context. assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header."); ngDevMode && assertNotSame(attrs, void 0, "'undefined' is not valid value for 'attrs'"); ngDevMode && tParent && assertTNodeForTView(tParent, tView); let injectorIndex = tParent ? tParent.injectorIndex : -1; let flags = 0; if (isInSkipHydrationBlock()) { flags |= 128; } const tNode = { type, index, insertBeforeIndex: null, injectorIndex, directiveStart: -1, directiveEnd: -1, directiveStylingLast: -1, componentOffset: -1, propertyBindings: null, flags, providerIndexes: 0, value, attrs, mergedAttrs: null, localNames: null, initialInputs: null, inputs: null, hostDirectiveInputs: null, outputs: null, hostDirectiveOutputs: null, directiveToIndex: null, tView: null, next: null, prev: null, projectionNext: null, child: null, parent: tParent, projection: null, styles: null, stylesWithoutHost: null, residualStyles: void 0, classes: null, classesWithoutHost: null, residualClasses: void 0, classBindings: 0, styleBindings: 0 }; if (ngDevMode) { Object.seal(tNode); } return tNode; } function addTNodeAndUpdateInsertBeforeIndex(previousTNodes, newTNode) { ngDevMode && assertEqual(newTNode.insertBeforeIndex, null, "We expect that insertBeforeIndex is not set"); previousTNodes.push(newTNode); if (previousTNodes.length > 1) { for (let i25 = previousTNodes.length - 2; i25 >= 0; i25--) { const existingTNode = previousTNodes[i25]; if (!isI18nText(existingTNode)) { if (isNewTNodeCreatedBefore(existingTNode, newTNode) && getInsertBeforeIndex(existingTNode) === null) { setInsertBeforeIndex(existingTNode, newTNode.index); } } } } } function isI18nText(tNode) { return !(tNode.type & 64); } function isNewTNodeCreatedBefore(existingTNode, newTNode) { return isI18nText(newTNode) || existingTNode.index > newTNode.index; } function getInsertBeforeIndex(tNode) { const index = tNode.insertBeforeIndex; return Array.isArray(index) ? index[0] : index; } function setInsertBeforeIndex(tNode, value) { const index = tNode.insertBeforeIndex; if (Array.isArray(index)) { index[0] = value; } else { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); tNode.insertBeforeIndex = value; } } function getTIcu(tView, index) { const value = tView.data[index]; if (value === null || typeof value === "string") return null; if (ngDevMode && !(value.hasOwnProperty("tView") || value.hasOwnProperty("currentCaseLViewIndex"))) { throwError2("We expect to get 'null'|'TIcu'|'TIcuContainer', but got: " + value); } const tIcu = value.hasOwnProperty("currentCaseLViewIndex") ? value : value.value; ngDevMode && assertTIcu(tIcu); return tIcu; } function setTIcu(tView, index, tIcu) { const tNode = tView.data[index]; ngDevMode && assertEqual(tNode === null || tNode.hasOwnProperty("tView"), true, "We expect to get 'null'|'TIcuContainer'"); if (tNode === null) { tView.data[index] = tIcu; } else { ngDevMode && assertTNodeType( tNode, 32 /* TNodeType.Icu */ ); tNode.value = tIcu; } } function setTNodeInsertBeforeIndex(tNode, index) { ngDevMode && assertTNode(tNode); let insertBeforeIndex = tNode.insertBeforeIndex; if (insertBeforeIndex === null) { setI18nHandling(getInsertInFrontOfRNodeWithI18n, processI18nInsertBefore); insertBeforeIndex = tNode.insertBeforeIndex = [ null, index ]; } else { assertEqual(Array.isArray(insertBeforeIndex), true, "Expecting array here"); insertBeforeIndex.push(index); } } function createTNodePlaceholder(tView, previousTNodes, index) { const tNode = createTNodeAtIndex(tView, index, 64, null, null); addTNodeAndUpdateInsertBeforeIndex(previousTNodes, tNode); return tNode; } function getCurrentICUCaseIndex(tIcu, lView) { const currentCase = lView[tIcu.currentCaseLViewIndex]; return currentCase === null ? currentCase : currentCase < 0 ? ~currentCase : currentCase; } function getParentFromIcuCreateOpCode(mergedCode) { return mergedCode >>> 17; } function getRefFromIcuCreateOpCode(mergedCode) { return (mergedCode & 131070) >>> 1; } function getInstructionFromIcuCreateOpCode(mergedCode) { return mergedCode & 1; } function icuCreateOpCode(opCode, parentIdx, refIdx) { ngDevMode && assertGreaterThanOrEqual(parentIdx, 0, "Missing parent index"); ngDevMode && assertGreaterThan(refIdx, 0, "Missing ref index"); return opCode | parentIdx << 17 | refIdx << 1; } function isRootTemplateMessage(subTemplateIndex) { return subTemplateIndex === -1; } function enterIcu(state2, tIcu, lView) { state2.index = 0; const currentCase = getCurrentICUCaseIndex(tIcu, lView); if (currentCase !== null) { ngDevMode && assertNumberInRange(currentCase, 0, tIcu.cases.length - 1); state2.removes = tIcu.remove[currentCase]; } else { state2.removes = EMPTY_ARRAY; } } function icuContainerIteratorNext(state2) { if (state2.index < state2.removes.length) { const removeOpCode = state2.removes[state2.index++]; ngDevMode && assertNumber(removeOpCode, "Expecting OpCode number"); if (removeOpCode > 0) { const rNode = state2.lView[removeOpCode]; ngDevMode && assertDomNode(rNode); return rNode; } else { state2.stack.push(state2.index, state2.removes); const tIcuIndex = ~removeOpCode; const tIcu = state2.lView[TVIEW].data[tIcuIndex]; ngDevMode && assertTIcu(tIcu); enterIcu(state2, tIcu, state2.lView); return icuContainerIteratorNext(state2); } } else { if (state2.stack.length === 0) { return null; } else { state2.removes = state2.stack.pop(); state2.index = state2.stack.pop(); return icuContainerIteratorNext(state2); } } } function loadIcuContainerVisitor() { const _state = { stack: [], index: -1 }; function icuContainerIteratorStart(tIcuContainerNode, lView) { _state.lView = lView; while (_state.stack.length) _state.stack.pop(); ngDevMode && assertTNodeForLView(tIcuContainerNode, lView); enterIcu(_state, tIcuContainerNode.value, lView); return icuContainerIteratorNext.bind(null, _state); } return icuContainerIteratorStart; } var REF_EXTRACTOR_REGEXP = /* @__PURE__ */ new RegExp(`^(\\d+)*(${REFERENCE_NODE_BODY}|${REFERENCE_NODE_HOST})*(.*)`); var _prepareI18nBlockForHydrationImpl = () => { }; function prepareI18nBlockForHydration(lView, index, parentTNode, subTemplateIndex) { _prepareI18nBlockForHydrationImpl(lView, index, parentTNode, subTemplateIndex); } var _claimDehydratedIcuCaseImpl = () => { }; function claimDehydratedIcuCase(lView, icuIndex, caseIndex) { _claimDehydratedIcuCaseImpl(lView, icuIndex, caseIndex); } function cleanupI18nHydrationData(lView) { const hydrationInfo = lView[HYDRATION]; if (hydrationInfo) { const { i18nNodes, dehydratedIcuData: dehydratedIcuDataMap } = hydrationInfo; if (i18nNodes && dehydratedIcuDataMap) { const renderer = lView[RENDERER]; for (const dehydratedIcuData of dehydratedIcuDataMap.values()) { cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData); } } hydrationInfo.i18nNodes = void 0; hydrationInfo.dehydratedIcuData = void 0; } } function cleanupDehydratedIcuData(renderer, i18nNodes, dehydratedIcuData) { for (const node of dehydratedIcuData.node.cases[dehydratedIcuData.case]) { const rNode = i18nNodes.get(node.index - HEADER_OFFSET); if (rNode) { nativeRemoveNode(renderer, rNode, false); } } } function removeDehydratedViews(lContainer) { const views = lContainer[DEHYDRATED_VIEWS] ?? []; const parentLView = lContainer[PARENT]; const renderer = parentLView[RENDERER]; const retainedViews = []; for (const view of views) { if (view.data[DEFER_BLOCK_ID] !== void 0) { retainedViews.push(view); } else { removeDehydratedView(view, renderer); ngDevMode && ngDevMode.dehydratedViewsRemoved++; } } lContainer[DEHYDRATED_VIEWS] = retainedViews; } function removeDehydratedViewList(deferBlock) { const { lContainer } = deferBlock; const dehydratedViews = lContainer[DEHYDRATED_VIEWS]; if (dehydratedViews === null) return; const parentLView = lContainer[PARENT]; const renderer = parentLView[RENDERER]; for (const view of dehydratedViews) { removeDehydratedView(view, renderer); ngDevMode && ngDevMode.dehydratedViewsRemoved++; } } function removeDehydratedView(dehydratedView, renderer) { let nodesRemoved = 0; let currentRNode = dehydratedView.firstChild; if (currentRNode) { const numNodes = dehydratedView.data[NUM_ROOT_NODES]; while (nodesRemoved < numNodes) { ngDevMode && validateSiblingNodeExists(currentRNode); const nextSibling = currentRNode.nextSibling; nativeRemoveNode(renderer, currentRNode, false); currentRNode = nextSibling; nodesRemoved++; } } } function cleanupLContainer(lContainer) { removeDehydratedViews(lContainer); const hostLView = lContainer[HOST]; if (isLView(hostLView)) { cleanupLView(hostLView); } for (let i25 = CONTAINER_HEADER_OFFSET; i25 < lContainer.length; i25++) { cleanupLView(lContainer[i25]); } } function cleanupLView(lView) { cleanupI18nHydrationData(lView); const tView = lView[TVIEW]; for (let i25 = HEADER_OFFSET; i25 < tView.bindingStartIndex; i25++) { if (isLContainer(lView[i25])) { const lContainer = lView[i25]; cleanupLContainer(lContainer); } else if (isLView(lView[i25])) { cleanupLView(lView[i25]); } } } function cleanupDehydratedViews(appRef) { const viewRefs = appRef._views; for (const viewRef of viewRefs) { const lNode = getLNodeForHydration(viewRef); if (lNode !== null && lNode[HOST] !== null) { if (isLView(lNode)) { cleanupLView(lNode); } else { cleanupLContainer(lNode); } ngDevMode && ngDevMode.dehydratedViewsCleanupRuns++; } } } function cleanupHydratedDeferBlocks(deferBlock, hydratedBlocks, registry2, appRef) { if (deferBlock !== null) { registry2.cleanup(hydratedBlocks); cleanupLContainer(deferBlock.lContainer); cleanupDehydratedViews(appRef); } } var _findMatchingDehydratedViewImpl = () => null; var _findAndReconcileMatchingDehydratedViewsImpl = () => null; function findMatchingDehydratedView(lContainer, template) { return _findMatchingDehydratedViewImpl(lContainer, template); } function findAndReconcileMatchingDehydratedViews(lContainer, templateTNode, hostLView) { return _findAndReconcileMatchingDehydratedViewsImpl(lContainer, templateTNode, hostLView); } var ComponentRef$1 = class ComponentRef { }; var ComponentFactory$1 = class ComponentFactory { }; var _NullComponentFactoryResolver = class { resolveComponentFactory(component) { throw new RuntimeError(917, typeof ngDevMode !== "undefined" && ngDevMode && `No component factory found for ${stringify(component)}.`); } }; var ComponentFactoryResolver$1 = class ComponentFactoryResolver { static NULL = new _NullComponentFactoryResolver(); }; var RendererFactory2 = class { }; var Renderer2 = class { /** * If null or undefined, the view engine won't call it. * This is used as a performance optimization for production mode. */ destroyNode = null; /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = () => injectRenderer2(); }; function injectRenderer2() { const lView = getLView(); const tNode = getCurrentTNode(); const nodeAtIndex = getComponentLViewByIndex(tNode.index, lView); return (isLView(nodeAtIndex) ? nodeAtIndex : lView)[RENDERER]; } var Sanitizer = class _Sanitizer { /** @nocollapse */ static \u0275prov = ( /** @pureOrBreakMyCode */ /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _Sanitizer, providedIn: "root", factory: () => null }) ); }; function isModuleWithProviders(value) { return value.ngModule !== void 0; } function isNgModule(value) { return !!getNgModuleDef(value); } function isPipe(value) { return !!getPipeDef(value); } function isDirective(value) { return !!getDirectiveDef(value); } function isComponent(value) { return !!getComponentDef(value); } function getDependencyTypeForError(type) { if (getComponentDef(type)) return "component"; if (getDirectiveDef(type)) return "directive"; if (getPipeDef(type)) return "pipe"; return "type"; } function verifyStandaloneImport(depType, importingType) { if (isForwardRef(depType)) { depType = resolveForwardRef(depType); if (!depType) { throw new Error(`Expected forwardRef function, imported from "${stringifyForError(importingType)}", to return a standalone entity or NgModule but got "${stringifyForError(depType) || depType}".`); } } if (getNgModuleDef(depType) == null) { const def = getComponentDef(depType) || getDirectiveDef(depType) || getPipeDef(depType); if (def != null) { if (!def.standalone) { throw new Error(`The "${stringifyForError(depType)}" ${getDependencyTypeForError(depType)}, imported from "${stringifyForError(importingType)}", is not standalone. Did you forget to add the standalone: true flag?`); } } else { if (isModuleWithProviders(depType)) { throw new Error(`A module with providers was imported from "${stringifyForError(importingType)}". Modules with providers are not supported in standalone components imports.`); } else { throw new Error(`The "${stringifyForError(depType)}" type, imported from "${stringifyForError(importingType)}", must be a standalone component / directive / pipe or an NgModule. Did you forget to add the required @Component / @Directive / @Pipe or @NgModule annotation?`); } } } } var DepsTracker = class { ownerNgModule = /* @__PURE__ */ new Map(); ngModulesWithSomeUnresolvedDecls = /* @__PURE__ */ new Set(); ngModulesScopeCache = /* @__PURE__ */ new Map(); standaloneComponentsScopeCache = /* @__PURE__ */ new Map(); /** * Attempts to resolve ng module's forward ref declarations as much as possible and add them to * the `ownerNgModule` map. This method normally should be called after the initial parsing when * all the forward refs are resolved (e.g., when trying to render a component) */ resolveNgModulesDecls() { if (this.ngModulesWithSomeUnresolvedDecls.size === 0) { return; } for (const moduleType of this.ngModulesWithSomeUnresolvedDecls) { const def = getNgModuleDef(moduleType); if (def?.declarations) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isComponent(decl)) { this.ownerNgModule.set(decl, moduleType); } } } } this.ngModulesWithSomeUnresolvedDecls.clear(); } /** @override */ getComponentDependencies(type, rawImports) { this.resolveNgModulesDecls(); const def = getComponentDef(type); if (def === null) { throw new Error(`Attempting to get component dependencies for a type that is not a component: ${type}`); } if (def.standalone) { const scope2 = this.getStandaloneComponentScope(type, rawImports); if (scope2.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [ ...scope2.compilation.directives, ...scope2.compilation.pipes, ...scope2.compilation.ngModules ] }; } else { if (!this.ownerNgModule.has(type)) { return { dependencies: [] }; } const scope2 = this.getNgModuleScope(this.ownerNgModule.get(type)); if (scope2.compilation.isPoisoned) { return { dependencies: [] }; } return { dependencies: [...scope2.compilation.directives, ...scope2.compilation.pipes] }; } } /** * @override * This implementation does not make use of param scopeInfo since it assumes the scope info is * already added to the type itself through methods like {@link ɵɵsetNgModuleScope} */ registerNgModule(type, scopeInfo) { if (!isNgModule(type)) { throw new Error(`Attempting to register a Type which is not NgModule as NgModule: ${type}`); } this.ngModulesWithSomeUnresolvedDecls.add(type); } /** @override */ clearScopeCacheFor(type) { this.ngModulesScopeCache.delete(type); this.standaloneComponentsScopeCache.delete(type); } /** @override */ getNgModuleScope(type) { if (this.ngModulesScopeCache.has(type)) { return this.ngModulesScopeCache.get(type); } const scope2 = this.computeNgModuleScope(type); this.ngModulesScopeCache.set(type, scope2); return scope2; } /** Compute NgModule scope afresh. */ computeNgModuleScope(type) { const def = getNgModuleDefOrThrow(type); const scope2 = { exported: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() }, compilation: { directives: /* @__PURE__ */ new Set(), pipes: /* @__PURE__ */ new Set() } }; for (const imported of maybeUnwrapFn(def.imports)) { if (isNgModule(imported)) { const importedScope = this.getNgModuleScope(imported); addSet(importedScope.exported.directives, scope2.compilation.directives); addSet(importedScope.exported.pipes, scope2.compilation.pipes); } else if (isStandalone(imported)) { if (isDirective(imported) || isComponent(imported)) { scope2.compilation.directives.add(imported); } else if (isPipe(imported)) { scope2.compilation.pipes.add(imported); } else { throw new RuntimeError(980, "The standalone imported type is neither a component nor a directive nor a pipe"); } } else { scope2.compilation.isPoisoned = true; break; } } if (!scope2.compilation.isPoisoned) { for (const decl of maybeUnwrapFn(def.declarations)) { if (isNgModule(decl) || isStandalone(decl)) { scope2.compilation.isPoisoned = true; break; } if (isPipe(decl)) { scope2.compilation.pipes.add(decl); } else { scope2.compilation.directives.add(decl); } } } for (const exported of maybeUnwrapFn(def.exports)) { if (isNgModule(exported)) { const exportedScope = this.getNgModuleScope(exported); addSet(exportedScope.exported.directives, scope2.exported.directives); addSet(exportedScope.exported.pipes, scope2.exported.pipes); addSet(exportedScope.exported.directives, scope2.compilation.directives); addSet(exportedScope.exported.pipes, scope2.compilation.pipes); } else if (isPipe(exported)) { scope2.exported.pipes.add(exported); } else { scope2.exported.directives.add(exported); } } return scope2; } /** @override */ getStandaloneComponentScope(type, rawImports) { if (this.standaloneComponentsScopeCache.has(type)) { return this.standaloneComponentsScopeCache.get(type); } const ans = this.computeStandaloneComponentScope(type, rawImports); this.standaloneComponentsScopeCache.set(type, ans); return ans; } computeStandaloneComponentScope(type, rawImports) { const ans = { compilation: { // Standalone components are always able to self-reference. directives: /* @__PURE__ */ new Set([type]), pipes: /* @__PURE__ */ new Set(), ngModules: /* @__PURE__ */ new Set() } }; for (const rawImport of flatten(rawImports ?? [])) { const imported = resolveForwardRef(rawImport); try { verifyStandaloneImport(imported, type); } catch (e56) { ans.compilation.isPoisoned = true; return ans; } if (isNgModule(imported)) { ans.compilation.ngModules.add(imported); const importedScope = this.getNgModuleScope(imported); if (importedScope.exported.isPoisoned) { ans.compilation.isPoisoned = true; return ans; } addSet(importedScope.exported.directives, ans.compilation.directives); addSet(importedScope.exported.pipes, ans.compilation.pipes); } else if (isPipe(imported)) { ans.compilation.pipes.add(imported); } else if (isDirective(imported) || isComponent(imported)) { ans.compilation.directives.add(imported); } else { ans.compilation.isPoisoned = true; return ans; } } return ans; } /** @override */ isOrphanComponent(cmp) { const def = getComponentDef(cmp); if (!def || def.standalone) { return false; } this.resolveNgModulesDecls(); return !this.ownerNgModule.has(cmp); } }; function addSet(sourceSet, targetSet) { for (const m5 of sourceSet) { targetSet.add(m5); } } var depsTracker = new DepsTracker(); var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; var ChainedInjector = class { injector; parentInjector; constructor(injector, parentInjector) { this.injector = injector; this.parentInjector = parentInjector; } get(token, notFoundValue, options) { const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, options); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { return value; } return this.parentInjector.get(token, notFoundValue, options); } }; function computeStaticStyling(tNode, attrs, writeToHost) { ngDevMode && assertFirstCreatePass(getTView(), "Expecting to be called in first template pass only"); let styles = writeToHost ? tNode.styles : null; let classes43 = writeToHost ? tNode.classes : null; let mode = 0; if (attrs !== null) { for (let i25 = 0; i25 < attrs.length; i25++) { const value = attrs[i25]; if (typeof value === "number") { mode = value; } else if (mode == 1) { classes43 = concatStringsWithSpace(classes43, value); } else if (mode == 2) { const style40 = value; const styleValue = attrs[++i25]; styles = concatStringsWithSpace(styles, style40 + ": " + styleValue + ";"); } } } writeToHost ? tNode.styles = styles : tNode.stylesWithoutHost = styles; writeToHost ? tNode.classes = classes43 : tNode.classesWithoutHost = classes43; } function \u0275\u0275directiveInject(token, flags = 0) { const lView = getLView(); if (lView === null) { ngDevMode && assertInjectImplementationNotEqual(\u0275\u0275directiveInject); return \u0275\u0275inject(token, flags); } const tNode = getCurrentTNode(); const value = getOrCreateInjectable(tNode, lView, resolveForwardRef(token), flags); ngDevMode && emitInjectEvent(token, value, flags); return value; } function \u0275\u0275invalidFactory() { const msg = ngDevMode ? `This constructor was not compatible with Dependency Injection.` : "invalid"; throw new Error(msg); } function resolveDirectives(tView, lView, tNode, localRefs, directiveMatcher) { ngDevMode && assertFirstCreatePass(tView); const exportsMap = localRefs === null ? null : { "": -1 }; const matchedDirectiveDefs = directiveMatcher(tView, tNode); if (matchedDirectiveDefs !== null) { let directiveDefs = matchedDirectiveDefs; let hostDirectiveDefs = null; let hostDirectiveRanges = null; for (const def of matchedDirectiveDefs) { if (def.resolveHostDirectives !== null) { [directiveDefs, hostDirectiveDefs, hostDirectiveRanges] = def.resolveHostDirectives(matchedDirectiveDefs); break; } } ngDevMode && assertNoDuplicateDirectives(directiveDefs); initializeDirectives(tView, lView, tNode, directiveDefs, exportsMap, hostDirectiveDefs, hostDirectiveRanges); } if (exportsMap !== null && localRefs !== null) { cacheMatchingLocalNames(tNode, localRefs, exportsMap); } } function cacheMatchingLocalNames(tNode, localRefs, exportsMap) { const localNames = tNode.localNames = []; for (let i25 = 0; i25 < localRefs.length; i25 += 2) { const index = exportsMap[localRefs[i25 + 1]]; if (index == null) throw new RuntimeError(-301, ngDevMode && `Export of name '${localRefs[i25 + 1]}' not found!`); localNames.push(localRefs[i25], index); } } function markAsComponentHost(tView, hostTNode, componentOffset) { ngDevMode && assertFirstCreatePass(tView); ngDevMode && assertGreaterThan(componentOffset, -1, "componentOffset must be great than -1"); hostTNode.componentOffset = componentOffset; (tView.components ??= []).push(hostTNode.index); } function initializeDirectives(tView, lView, tNode, directives, exportsMap, hostDirectiveDefs, hostDirectiveRanges) { ngDevMode && assertFirstCreatePass(tView); const directivesLength = directives.length; let hasSeenComponent = false; for (let i25 = 0; i25 < directivesLength; i25++) { const def = directives[i25]; if (!hasSeenComponent && isComponentDef(def)) { hasSeenComponent = true; markAsComponentHost(tView, tNode, i25); } diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, lView), tView, def.type); } initTNodeFlags(tNode, tView.data.length, directivesLength); for (let i25 = 0; i25 < directivesLength; i25++) { const def = directives[i25]; if (def.providersResolver) def.providersResolver(def); } let preOrderHooksFound = false; let preOrderCheckHooksFound = false; let directiveIdx = allocExpando(tView, lView, directivesLength, null); ngDevMode && assertSame(directiveIdx, tNode.directiveStart, "TNode.directiveStart should point to just allocated space"); if (directivesLength > 0) { tNode.directiveToIndex = /* @__PURE__ */ new Map(); } for (let i25 = 0; i25 < directivesLength; i25++) { const def = directives[i25]; tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, def.hostAttrs); configureViewWithDirective(tView, tNode, lView, directiveIdx, def); saveNameToExportMap(directiveIdx, def, exportsMap); if (hostDirectiveRanges !== null && hostDirectiveRanges.has(def)) { const [start, end] = hostDirectiveRanges.get(def); tNode.directiveToIndex.set(def.type, [ directiveIdx, start + tNode.directiveStart, end + tNode.directiveStart ]); } else if (hostDirectiveDefs === null || !hostDirectiveDefs.has(def)) { tNode.directiveToIndex.set(def.type, directiveIdx); } if (def.contentQueries !== null) tNode.flags |= 4; if (def.hostBindings !== null || def.hostAttrs !== null || def.hostVars !== 0) tNode.flags |= 64; const lifeCycleHooks = def.type.prototype; if (!preOrderHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngOnInit || lifeCycleHooks.ngDoCheck)) { (tView.preOrderHooks ??= []).push(tNode.index); preOrderHooksFound = true; } if (!preOrderCheckHooksFound && (lifeCycleHooks.ngOnChanges || lifeCycleHooks.ngDoCheck)) { (tView.preOrderCheckHooks ??= []).push(tNode.index); preOrderCheckHooksFound = true; } directiveIdx++; } initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs); } function initializeInputAndOutputAliases(tView, tNode, hostDirectiveDefs) { ngDevMode && assertFirstCreatePass(tView); for (let index = tNode.directiveStart; index < tNode.directiveEnd; index++) { const directiveDef = tView.data[index]; if (hostDirectiveDefs === null || !hostDirectiveDefs.has(directiveDef)) { setupSelectorMatchedInputsOrOutputs(0, tNode, directiveDef, index); setupSelectorMatchedInputsOrOutputs(1, tNode, directiveDef, index); setupInitialInputs(tNode, index, false); } else { const hostDirectiveDef = hostDirectiveDefs.get(directiveDef); setupHostDirectiveInputsOrOutputs(0, tNode, hostDirectiveDef, index); setupHostDirectiveInputsOrOutputs(1, tNode, hostDirectiveDef, index); setupInitialInputs(tNode, index, true); } } } function setupSelectorMatchedInputsOrOutputs(mode, tNode, def, directiveIndex) { const aliasMap = mode === 0 ? def.inputs : def.outputs; for (const publicName in aliasMap) { if (aliasMap.hasOwnProperty(publicName)) { let bindings; if (mode === 0) { bindings = tNode.inputs ??= {}; } else { bindings = tNode.outputs ??= {}; } bindings[publicName] ??= []; bindings[publicName].push(directiveIndex); setShadowStylingInputFlags(tNode, publicName); } } } function setupHostDirectiveInputsOrOutputs(mode, tNode, config2, directiveIndex) { const aliasMap = mode === 0 ? config2.inputs : config2.outputs; for (const initialName in aliasMap) { if (aliasMap.hasOwnProperty(initialName)) { const publicName = aliasMap[initialName]; let bindings; if (mode === 0) { bindings = tNode.hostDirectiveInputs ??= {}; } else { bindings = tNode.hostDirectiveOutputs ??= {}; } bindings[publicName] ??= []; bindings[publicName].push(directiveIndex, initialName); setShadowStylingInputFlags(tNode, publicName); } } } function setShadowStylingInputFlags(tNode, publicName) { if (publicName === "class") { tNode.flags |= 8; } else if (publicName === "style") { tNode.flags |= 16; } } function setupInitialInputs(tNode, directiveIndex, isHostDirective) { const { attrs, inputs, hostDirectiveInputs } = tNode; if (attrs === null || !isHostDirective && inputs === null || isHostDirective && hostDirectiveInputs === null || // Do not use unbound attributes as inputs to structural directives, since structural // directive inputs can only be set using microsyntax (e.g. `
    `). isInlineTemplate(tNode)) { tNode.initialInputs ??= []; tNode.initialInputs.push(null); return; } let inputsToStore = null; let i25 = 0; while (i25 < attrs.length) { const attrName = attrs[i25]; if (attrName === 0) { i25 += 4; continue; } else if (attrName === 5) { i25 += 2; continue; } else if (typeof attrName === "number") { break; } if (!isHostDirective && inputs.hasOwnProperty(attrName)) { const inputConfig = inputs[attrName]; for (const index of inputConfig) { if (index === directiveIndex) { inputsToStore ??= []; inputsToStore.push(attrName, attrs[i25 + 1]); break; } } } else if (isHostDirective && hostDirectiveInputs.hasOwnProperty(attrName)) { const config2 = hostDirectiveInputs[attrName]; for (let j3 = 0; j3 < config2.length; j3 += 2) { if (config2[j3] === directiveIndex) { inputsToStore ??= []; inputsToStore.push(config2[j3 + 1], attrs[i25 + 1]); break; } } } i25 += 2; } tNode.initialInputs ??= []; tNode.initialInputs.push(inputsToStore); } function configureViewWithDirective(tView, tNode, lView, directiveIndex, def) { ngDevMode && assertGreaterThanOrEqual(directiveIndex, HEADER_OFFSET, "Must be in Expando section"); tView.data[directiveIndex] = def; const directiveFactory = def.factory || (def.factory = getFactoryDef(def.type, true)); const nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), \u0275\u0275directiveInject, ngDevMode ? def.type.name : null); tView.blueprint[directiveIndex] = nodeInjectorFactory; lView[directiveIndex] = nodeInjectorFactory; registerHostBindingOpCodes(tView, tNode, directiveIndex, allocExpando(tView, lView, def.hostVars, NO_CHANGE), def); } function registerHostBindingOpCodes(tView, tNode, directiveIdx, directiveVarsIdx, def) { ngDevMode && assertFirstCreatePass(tView); const hostBindings = def.hostBindings; if (hostBindings) { let hostBindingOpCodes = tView.hostBindingOpCodes; if (hostBindingOpCodes === null) { hostBindingOpCodes = tView.hostBindingOpCodes = []; } const elementIndx = ~tNode.index; if (lastSelectedElementIdx(hostBindingOpCodes) != elementIndx) { hostBindingOpCodes.push(elementIndx); } hostBindingOpCodes.push(directiveIdx, directiveVarsIdx, hostBindings); } } function lastSelectedElementIdx(hostBindingOpCodes) { let i25 = hostBindingOpCodes.length; while (i25 > 0) { const value = hostBindingOpCodes[--i25]; if (typeof value === "number" && value < 0) { return value; } } return 0; } function saveNameToExportMap(directiveIdx, def, exportsMap) { if (exportsMap) { if (def.exportAs) { for (let i25 = 0; i25 < def.exportAs.length; i25++) { exportsMap[def.exportAs[i25]] = directiveIdx; } } if (isComponentDef(def)) exportsMap[""] = directiveIdx; } } function initTNodeFlags(tNode, index, numberOfDirectives) { ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, "Reached the max number of directives"); tNode.flags |= 1; tNode.directiveStart = index; tNode.directiveEnd = index + numberOfDirectives; tNode.providerIndexes = index; } function assertNoDuplicateDirectives(directives) { if (directives.length < 2) { return; } const seenDirectives = /* @__PURE__ */ new Set(); for (const current of directives) { if (seenDirectives.has(current)) { throw new RuntimeError(309, `Directive ${current.type.name} matches multiple times on the same element. Directives can only match an element once.`); } seenDirectives.add(current); } } function directiveHostFirstCreatePass(index, lView, type, name5, directiveMatcher, bindingsEnabled, attrsIndex, localRefsIndex) { const tView = lView[TVIEW]; ngDevMode && assertFirstCreatePass(tView); const tViewConsts = tView.consts; const attrs = getConstant(tViewConsts, attrsIndex); const tNode = getOrCreateTNode(tView, index, type, name5, attrs); if (bindingsEnabled) { resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex), directiveMatcher); } tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs); if (tNode.attrs !== null) { computeStaticStyling(tNode, tNode.attrs, false); } if (tNode.mergedAttrs !== null) { computeStaticStyling(tNode, tNode.mergedAttrs, true); } if (tView.queries !== null) { tView.queries.elementStart(tView, tNode); } return tNode; } function directiveHostEndFirstCreatePass(tView, tNode) { ngDevMode && assertFirstCreatePass(tView); registerPostOrderHooks(tView, tNode); if (isContentQueryHost(tNode)) { tView.queries.elementEnd(tNode); } } function domOnlyFirstCreatePass(index, tView, type, name5, attrsIndex, localRefsIndex) { ngDevMode && assertFirstCreatePass(tView); const tViewConsts = tView.consts; const attrs = getConstant(tViewConsts, attrsIndex); const tNode = getOrCreateTNode(tView, index, type, name5, attrs); tNode.mergedAttrs = mergeHostAttrs(tNode.mergedAttrs, tNode.attrs); if (localRefsIndex != null) { const refs = getConstant(tViewConsts, localRefsIndex); tNode.localNames = []; for (let i25 = 0; i25 < refs.length; i25 += 2) { tNode.localNames.push(refs[i25], -1); } } if (tNode.attrs !== null) { computeStaticStyling(tNode, tNode.attrs, false); } if (tNode.mergedAttrs !== null) { computeStaticStyling(tNode, tNode.mergedAttrs, true); } if (tView.queries !== null) { tView.queries.elementStart(tView, tNode); } return tNode; } function isListLikeIterable(obj) { if (!isJsObject(obj)) return false; return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] Symbol.iterator in obj; } function areIterablesEqual(a45, b7, comparator) { const iterator1 = a45[Symbol.iterator](); const iterator22 = b7[Symbol.iterator](); while (true) { const item1 = iterator1.next(); const item2 = iterator22.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } function iterateListLike(obj, fn) { if (Array.isArray(obj)) { for (let i25 = 0; i25 < obj.length; i25++) { fn(obj[i25]); } } else { const iterator3 = obj[Symbol.iterator](); let item; while (!(item = iterator3.next()).done) { fn(item.value); } } } function isJsObject(o87) { return o87 !== null && (typeof o87 === "function" || typeof o87 === "object"); } function devModeEqual(a45, b7) { const isListLikeIterableA = isListLikeIterable(a45); const isListLikeIterableB = isListLikeIterable(b7); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual(a45, b7, devModeEqual); } else { const isAObject = a45 && (typeof a45 === "object" || typeof a45 === "function"); const isBObject = b7 && (typeof b7 === "object" || typeof b7 === "function"); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return Object.is(a45, b7); } } } function updateBinding(lView, bindingIndex, value) { return lView[bindingIndex] = value; } function getBinding(lView, bindingIndex) { ngDevMode && assertIndexInRange(lView, bindingIndex); ngDevMode && assertNotSame(lView[bindingIndex], NO_CHANGE, "Stored value should never be NO_CHANGE."); return lView[bindingIndex]; } function bindingUpdated(lView, bindingIndex, value) { ngDevMode && assertLessThan(bindingIndex, lView.length, `Slot should have been initialized to NO_CHANGE`); if (value === NO_CHANGE) { return false; } const oldValue = lView[bindingIndex]; if (Object.is(oldValue, value)) { return false; } else { if (ngDevMode && isInCheckNoChangesMode()) { const oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : void 0; if (!devModeEqual(oldValueToCompare, value)) { const details = getExpressionChangedErrorDetails(lView, bindingIndex, oldValueToCompare, value); throwErrorIfNoChangesMode(oldValue === NO_CHANGE, details.oldValue, details.newValue, details.propName, lView); } return false; } lView[bindingIndex] = value; return true; } } function bindingUpdated2(lView, bindingIndex, exp1, exp2) { const different = bindingUpdated(lView, bindingIndex, exp1); return bindingUpdated(lView, bindingIndex + 1, exp2) || different; } function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) { const different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated(lView, bindingIndex + 2, exp3) || different; } function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) { const different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different; } function wrapListener(tNode, lView, listenerFn) { return function wrapListenerIn_markDirtyAndPreventDefault(event2) { const startView = isComponentHost(tNode) ? getComponentLViewByIndex(tNode.index, lView) : lView; markViewDirty( startView, 5 /* NotificationSource.Listener */ ); const context2 = lView[CONTEXT]; let result = executeListenerWithErrorHandling(lView, context2, listenerFn, event2); let nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__; while (nextListenerFn) { result = executeListenerWithErrorHandling(lView, context2, nextListenerFn, event2) && result; nextListenerFn = nextListenerFn.__ngNextListenerFn__; } return result; }; } function executeListenerWithErrorHandling(lView, context2, listenerFn, e56) { const prevConsumer = setActiveConsumer(null); try { profiler(6, context2, listenerFn); return listenerFn(e56) !== false; } catch (error) { handleUncaughtError(lView, error); return false; } finally { profiler(7, context2, listenerFn); setActiveConsumer(prevConsumer); } } function listenToDomEvent(tNode, tView, lView, eventTargetResolver, renderer, eventName, originalListener, wrappedListener) { ngDevMode && assertNotSame(wrappedListener, originalListener, "Expected wrapped and original listeners to be different."); const isTNodeDirectiveHost = isDirectiveHost(tNode); let hasCoalesced = false; let existingListener = null; if (!eventTargetResolver && isTNodeDirectiveHost) { existingListener = findExistingListener(tView, lView, eventName, tNode.index); } if (existingListener !== null) { const lastListenerFn = existingListener.__ngLastListenerFn__ || existingListener; lastListenerFn.__ngNextListenerFn__ = originalListener; existingListener.__ngLastListenerFn__ = originalListener; hasCoalesced = true; } else { const native = getNativeByTNode(tNode, lView); const target = eventTargetResolver ? eventTargetResolver(native) : native; stashEventListenerImpl(lView, target, eventName, wrappedListener); const cleanupFn = renderer.listen(target, eventName, wrappedListener); if (!isAnimationEventType(eventName)) { const idxOrTargetGetter = eventTargetResolver ? (_lView) => eventTargetResolver(unwrapRNode(_lView[tNode.index])) : tNode.index; storeListenerCleanup(idxOrTargetGetter, tView, lView, eventName, wrappedListener, cleanupFn, false); } } return hasCoalesced; } function isAnimationEventType(eventName) { return eventName.startsWith("animation") || eventName.startsWith("transition"); } function findExistingListener(tView, lView, eventName, tNodeIndex) { const tCleanup = tView.cleanup; if (tCleanup != null) { for (let i25 = 0; i25 < tCleanup.length - 1; i25 += 2) { const cleanupEventName = tCleanup[i25]; if (cleanupEventName === eventName && tCleanup[i25 + 1] === tNodeIndex) { const lCleanup = lView[CLEANUP]; const listenerIdxInLCleanup = tCleanup[i25 + 2]; return lCleanup && lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null; } if (typeof cleanupEventName === "string") { i25 += 2; } } } return null; } function storeListenerCleanup(indexOrTargetGetter, tView, lView, eventName, listenerFn, cleanup, isOutput) { const tCleanup = tView.firstCreatePass ? getOrCreateTViewCleanup(tView) : null; const lCleanup = getOrCreateLViewCleanup(lView); const index = lCleanup.length; lCleanup.push(listenerFn, cleanup); tCleanup && tCleanup.push(eventName, indexOrTargetGetter, index, (index + 1) * (isOutput ? -1 : 1)); } function listenToOutput(tNode, lView, directiveIndex, lookupName, eventName, listenerFn) { ngDevMode && assertIndexInRange(lView, directiveIndex); const instance = lView[directiveIndex]; const tView = lView[TVIEW]; const def = tView.data[directiveIndex]; const propertyName = def.outputs[lookupName]; const output2 = instance[propertyName]; if (ngDevMode && !isOutputSubscribable(output2)) { throw new Error(`@Output ${propertyName} not initialized in '${instance.constructor.name}'.`); } const subscription = output2.subscribe(listenerFn); storeListenerCleanup(tNode.index, tView, lView, eventName, listenerFn, subscription, true); } function isOutputSubscribable(value) { return value != null && typeof value.subscribe === "function"; } var BINDING = /* @__PURE__ */ Symbol("BINDING"); var ComponentFactoryResolver2 = class extends ComponentFactoryResolver$1 { ngModule; /** * @param ngModule The NgModuleRef to which all resolved factories are bound. */ constructor(ngModule) { super(); this.ngModule = ngModule; } resolveComponentFactory(component) { ngDevMode && assertComponentType(component); const componentDef = getComponentDef(component); return new ComponentFactory2(componentDef, this.ngModule); } }; function toInputRefArray(map4) { return Object.keys(map4).map((name5) => { const [propName, flags, transform] = map4[name5]; const inputData = { propName, templateName: name5, isSignal: (flags & InputFlags.SignalBased) !== 0 }; if (transform) { inputData.transform = transform; } return inputData; }); } function toOutputRefArray(map4) { return Object.keys(map4).map((name5) => ({ propName: map4[name5], templateName: name5 })); } function verifyNotAnOrphanComponent(componentDef) { if (false) { if (depsTracker.isOrphanComponent(componentDef.type)) { throw new RuntimeError(981, `Orphan component found! Trying to render the component ${debugStringifyTypeForError(componentDef.type)} without first loading the NgModule that declares it. It is recommended to make this component standalone in order to avoid this error. If this is not possible now, import the component's NgModule in the appropriate NgModule, or the standalone component in which you are trying to render this component. If this is a lazy import, load the NgModule lazily as well and use its module injector.`); } } } function createRootViewInjector(componentDef, environmentInjector, injector) { let realEnvironmentInjector = environmentInjector instanceof EnvironmentInjector ? environmentInjector : environmentInjector?.injector; if (realEnvironmentInjector && componentDef.getStandaloneInjector !== null) { realEnvironmentInjector = componentDef.getStandaloneInjector(realEnvironmentInjector) || realEnvironmentInjector; } const rootViewInjector = realEnvironmentInjector ? new ChainedInjector(injector, realEnvironmentInjector) : injector; return rootViewInjector; } function createRootLViewEnvironment(rootLViewInjector) { const rendererFactory = rootLViewInjector.get(RendererFactory2, null); if (rendererFactory === null) { throw new RuntimeError(407, ngDevMode && "Angular was not able to inject a renderer (RendererFactory2). Likely this is due to a broken DI hierarchy. Make sure that any injector used to create this component has a correct parent."); } const sanitizer = rootLViewInjector.get(Sanitizer, null); const changeDetectionScheduler = rootLViewInjector.get(ChangeDetectionScheduler, null); let ngReflect = false; if (typeof ngDevMode === "undefined" || ngDevMode) { ngReflect = rootLViewInjector.get(NG_REFLECT_ATTRS_FLAG, NG_REFLECT_ATTRS_FLAG_DEFAULT); } return { rendererFactory, sanitizer, changeDetectionScheduler, ngReflect }; } function createHostElement(componentDef, renderer) { const tagName = inferTagNameFromDefinition(componentDef); const namespace = tagName === "svg" ? SVG_NAMESPACE : tagName === "math" ? MATH_ML_NAMESPACE : null; return createElementNode(renderer, tagName, namespace); } function inferTagNameFromDefinition(componentDef) { return (componentDef.selectors[0][0] || "div").toLowerCase(); } var ComponentFactory2 = class extends ComponentFactory$1 { componentDef; ngModule; selector; componentType; ngContentSelectors; isBoundToModule; cachedInputs = null; cachedOutputs = null; get inputs() { this.cachedInputs ??= toInputRefArray(this.componentDef.inputs); return this.cachedInputs; } get outputs() { this.cachedOutputs ??= toOutputRefArray(this.componentDef.outputs); return this.cachedOutputs; } /** * @param componentDef The component definition. * @param ngModule The NgModuleRef to which the factory is bound. */ constructor(componentDef, ngModule) { super(); this.componentDef = componentDef; this.ngModule = ngModule; this.componentType = componentDef.type; this.selector = stringifyCSSSelectorList(componentDef.selectors); this.ngContentSelectors = componentDef.ngContentSelectors ?? []; this.isBoundToModule = !!ngModule; } create(injector, projectableNodes, rootSelectorOrNode, environmentInjector, directives, componentBindings) { profiler( 22 /* ProfilerEvent.DynamicComponentStart */ ); const prevConsumer = setActiveConsumer(null); try { const cmpDef = this.componentDef; ngDevMode && verifyNotAnOrphanComponent(cmpDef); const rootTView = createRootTView(rootSelectorOrNode, cmpDef, componentBindings, directives); const rootViewInjector = createRootViewInjector(cmpDef, environmentInjector || this.ngModule, injector); const environment2 = createRootLViewEnvironment(rootViewInjector); const hostRenderer = environment2.rendererFactory.createRenderer(null, cmpDef); const hostElement = rootSelectorOrNode ? locateHostElement(hostRenderer, rootSelectorOrNode, cmpDef.encapsulation, rootViewInjector) : createHostElement(cmpDef, hostRenderer); const hasInputBindings = componentBindings?.some(isInputBinding) || directives?.some((d33) => typeof d33 !== "function" && d33.bindings.some(isInputBinding)); const rootLView = createLView(null, rootTView, null, 512 | getInitialLViewFlagsFromDef(cmpDef), null, null, environment2, hostRenderer, rootViewInjector, null, retrieveHydrationInfo( hostElement, rootViewInjector, true /* isRootView */ )); rootLView[HEADER_OFFSET] = hostElement; enterView(rootLView); let componentView = null; try { const hostTNode = directiveHostFirstCreatePass(HEADER_OFFSET, rootLView, 2, "#host", () => rootTView.directiveRegistry, true, 0); if (hostElement) { setupStaticAttributes(hostRenderer, hostElement, hostTNode); attachPatchData(hostElement, rootLView); } createDirectivesInstances(rootTView, rootLView, hostTNode); executeContentQueries(rootTView, hostTNode, rootLView); directiveHostEndFirstCreatePass(rootTView, hostTNode); if (projectableNodes !== void 0) { projectNodes(hostTNode, this.ngContentSelectors, projectableNodes); } componentView = getComponentLViewByIndex(hostTNode.index, rootLView); rootLView[CONTEXT] = componentView[CONTEXT]; renderView(rootTView, rootLView, null); } catch (e56) { if (componentView !== null) { unregisterLView(componentView); } unregisterLView(rootLView); throw e56; } finally { profiler( 23 /* ProfilerEvent.DynamicComponentEnd */ ); leaveView(); } return new ComponentRef2(this.componentType, rootLView, !!hasInputBindings); } finally { setActiveConsumer(prevConsumer); } } }; function createRootTView(rootSelectorOrNode, componentDef, componentBindings, directives) { const tAttributes = rootSelectorOrNode ? ["ng-version", "20.3.1"] : ( // Extract attributes and classes from the first selector only to match VE behavior. extractAttrsAndClassesFromSelector(componentDef.selectors[0]) ); let creationBindings = null; let updateBindings = null; let varsToAllocate = 0; if (componentBindings) { for (const binding of componentBindings) { varsToAllocate += binding[BINDING].requiredVars; if (binding.create) { binding.targetIdx = 0; (creationBindings ??= []).push(binding); } if (binding.update) { binding.targetIdx = 0; (updateBindings ??= []).push(binding); } } } if (directives) { for (let i25 = 0; i25 < directives.length; i25++) { const directive = directives[i25]; if (typeof directive !== "function") { for (const binding of directive.bindings) { varsToAllocate += binding[BINDING].requiredVars; const targetDirectiveIdx = i25 + 1; if (binding.create) { binding.targetIdx = targetDirectiveIdx; (creationBindings ??= []).push(binding); } if (binding.update) { binding.targetIdx = targetDirectiveIdx; (updateBindings ??= []).push(binding); } } } } } const directivesToApply = [componentDef]; if (directives) { for (const directive of directives) { const directiveType = typeof directive === "function" ? directive : directive.type; const directiveDef = ngDevMode ? getDirectiveDefOrThrow(directiveType) : getDirectiveDef(directiveType); if (ngDevMode && !directiveDef.standalone) { throw new RuntimeError(907, `The ${stringifyForError(directiveType)} directive must be standalone in order to be applied to a dynamically-created component.`); } directivesToApply.push(directiveDef); } } const rootTView = createTView(0, null, getRootTViewTemplate(creationBindings, updateBindings), 1, varsToAllocate, directivesToApply, null, null, null, [tAttributes], null); return rootTView; } function getRootTViewTemplate(creationBindings, updateBindings) { if (!creationBindings && !updateBindings) { return null; } return (flags) => { if (flags & 1 && creationBindings) { for (const binding of creationBindings) { binding.create(); } } if (flags & 2 && updateBindings) { for (const binding of updateBindings) { binding.update(); } } }; } function isInputBinding(binding) { const kind = binding[BINDING].kind; return kind === "input" || kind === "twoWay"; } var ComponentRef2 = class extends ComponentRef$1 { _rootLView; _hasInputBindings; instance; hostView; changeDetectorRef; componentType; location; previousInputValues = null; _tNode; constructor(componentType, _rootLView, _hasInputBindings) { super(); this._rootLView = _rootLView; this._hasInputBindings = _hasInputBindings; this._tNode = getTNode(_rootLView[TVIEW], HEADER_OFFSET); this.location = createElementRef(this._tNode, _rootLView); this.instance = getComponentLViewByIndex(this._tNode.index, _rootLView)[CONTEXT]; this.hostView = this.changeDetectorRef = new ViewRef( _rootLView, void 0 /* _cdRefInjectingView */ ); this.componentType = componentType; } setInput(name5, value) { if (this._hasInputBindings && ngDevMode) { throw new RuntimeError(317, "Cannot call `setInput` on a component that is using the `inputBinding` or `twoWayBinding` functions."); } const tNode = this._tNode; this.previousInputValues ??= /* @__PURE__ */ new Map(); if (this.previousInputValues.has(name5) && Object.is(this.previousInputValues.get(name5), value)) { return; } const lView = this._rootLView; const hasSetInput = setAllInputsForProperty(tNode, lView[TVIEW], lView, name5, value); this.previousInputValues.set(name5, value); const childComponentLView = getComponentLViewByIndex(tNode.index, lView); markViewDirty( childComponentLView, 1 /* NotificationSource.SetInput */ ); if (ngDevMode && !hasSetInput) { const cmpNameForError = stringifyForError(this.componentType); let message2 = `Can't set value of the '${name5}' input on the '${cmpNameForError}' component. `; message2 += `Make sure that the '${name5}' property is declared as an input using the input() or model() function or the @Input() decorator.`; reportUnknownPropertyError(message2); } } get injector() { return new NodeInjector(this._tNode, this._rootLView); } destroy() { this.hostView.destroy(); } onDestroy(callback2) { this.hostView.onDestroy(callback2); } }; function projectNodes(tNode, ngContentSelectors, projectableNodes) { const projection = tNode.projection = []; for (let i25 = 0; i25 < ngContentSelectors.length; i25++) { const nodesforSlot = projectableNodes[i25]; projection.push(nodesforSlot != null && nodesforSlot.length ? Array.from(nodesforSlot) : null); } } var ViewContainerRef = class { /** * @internal * @nocollapse */ static __NG_ELEMENT_ID__ = injectViewContainerRef; }; function injectViewContainerRef() { const previousTNode = getCurrentTNode(); return createContainerRef(previousTNode, getLView()); } var VE_ViewContainerRef = ViewContainerRef; var R3ViewContainerRef = class ViewContainerRef2 extends VE_ViewContainerRef { _lContainer; _hostTNode; _hostLView; constructor(_lContainer, _hostTNode, _hostLView) { super(); this._lContainer = _lContainer; this._hostTNode = _hostTNode; this._hostLView = _hostLView; } get element() { return createElementRef(this._hostTNode, this._hostLView); } get injector() { return new NodeInjector(this._hostTNode, this._hostLView); } /** @deprecated No replacement */ get parentInjector() { const parentLocation = getParentInjectorLocation(this._hostTNode, this._hostLView); if (hasParentInjector(parentLocation)) { const parentView = getParentInjectorView(parentLocation, this._hostLView); const injectorIndex = getParentInjectorIndex(parentLocation); ngDevMode && assertNodeInjector(parentView, injectorIndex); const parentTNode = parentView[TVIEW].data[ injectorIndex + 8 /* NodeInjectorOffset.TNODE */ ]; return new NodeInjector(parentTNode, parentView); } else { return new NodeInjector(null, this._hostLView); } } clear() { while (this.length > 0) { this.remove(this.length - 1); } } get(index) { const viewRefs = getViewRefs(this._lContainer); return viewRefs !== null && viewRefs[index] || null; } get length() { return this._lContainer.length - CONTAINER_HEADER_OFFSET; } createEmbeddedView(templateRef, context2, indexOrOptions) { let index; let injector; if (typeof indexOrOptions === "number") { index = indexOrOptions; } else if (indexOrOptions != null) { index = indexOrOptions.index; injector = indexOrOptions.injector; } const dehydratedView = findMatchingDehydratedView(this._lContainer, templateRef.ssrId); const viewRef = templateRef.createEmbeddedViewImpl(context2 || {}, injector, dehydratedView); this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return viewRef; } createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector, directives, bindings) { const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType); let index; if (isComponentFactory) { if (ngDevMode) { assertEqual(typeof indexOrOptions !== "object", true, "It looks like Component factory was provided as the first argument and an options object as the second argument. This combination of arguments is incompatible. You can either change the first argument to provide Component type or change the second argument to be a number (representing an index at which to insert the new component's host view into this container)"); } index = indexOrOptions; } else { if (ngDevMode) { assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. Please check whether provided class has @Component decorator.`); assertEqual(typeof indexOrOptions !== "number", true, "It looks like Component type was provided as the first argument and a number (representing an index at which to insert the new component's host view into this container as the second argument. This combination of arguments is incompatible. Please use an object as the second argument instead."); } const options = indexOrOptions || {}; if (ngDevMode && options.environmentInjector && options.ngModuleRef) { throwError2(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`); } index = options.index; injector = options.injector; projectableNodes = options.projectableNodes; environmentInjector = options.environmentInjector || options.ngModuleRef; directives = options.directives; bindings = options.bindings; } const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory2(getComponentDef(componentFactoryOrType)); const contextInjector = injector || this.parentInjector; if (!environmentInjector && componentFactory.ngModule == null) { const _injector = isComponentFactory ? contextInjector : this.parentInjector; const result = _injector.get(EnvironmentInjector, null); if (result) { environmentInjector = result; } } const componentDef = getComponentDef(componentFactory.componentType ?? {}); const dehydratedView = findMatchingDehydratedView(this._lContainer, componentDef?.id ?? null); const rNode = dehydratedView?.firstChild ?? null; const componentRef = componentFactory.create(contextInjector, projectableNodes, rNode, environmentInjector, directives, bindings); this.insertImpl(componentRef.hostView, index, shouldAddViewToDom(this._hostTNode, dehydratedView)); return componentRef; } insert(viewRef, index) { return this.insertImpl(viewRef, index, true); } insertImpl(viewRef, index, addToDOM) { const lView = viewRef._lView; if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot insert a destroyed View in a ViewContainer!"); } if (viewAttachedToContainer(lView)) { const prevIdx = this.indexOf(viewRef); if (prevIdx !== -1) { this.detach(prevIdx); } else { const prevLContainer = lView[PARENT]; ngDevMode && assertEqual(isLContainer(prevLContainer), true, "An attached view should have its PARENT point to a container."); const prevVCRef = new R3ViewContainerRef(prevLContainer, prevLContainer[T_HOST], prevLContainer[PARENT]); prevVCRef.detach(prevVCRef.indexOf(viewRef)); } } const adjustedIdx = this._adjustIndex(index); const lContainer = this._lContainer; addLViewToLContainer(lContainer, lView, adjustedIdx, addToDOM); viewRef.attachToViewContainerRef(); addToArray(getOrCreateViewRefs(lContainer), adjustedIdx, viewRef); return viewRef; } move(viewRef, newIndex) { if (ngDevMode && viewRef.destroyed) { throw new Error("Cannot move a destroyed View in a ViewContainer!"); } return this.insert(viewRef, newIndex); } indexOf(viewRef) { const viewRefsArr = getViewRefs(this._lContainer); return viewRefsArr !== null ? viewRefsArr.indexOf(viewRef) : -1; } remove(index) { const adjustedIdx = this._adjustIndex(index, -1); const detachedView = detachView(this._lContainer, adjustedIdx); if (detachedView) { removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx); destroyLView(detachedView[TVIEW], detachedView); } } detach(index) { const adjustedIdx = this._adjustIndex(index, -1); const view = detachView(this._lContainer, adjustedIdx); const wasDetached = view && removeFromArray(getOrCreateViewRefs(this._lContainer), adjustedIdx) != null; return wasDetached ? new ViewRef(view) : null; } _adjustIndex(index, shift = 0) { if (index == null) { return this.length + shift; } if (ngDevMode) { assertGreaterThan(index, -1, `ViewRef index must be positive, got ${index}`); assertLessThan(index, this.length + 1 + shift, "index"); } return index; } }; function getViewRefs(lContainer) { return lContainer[VIEW_REFS]; } function getOrCreateViewRefs(lContainer) { return lContainer[VIEW_REFS] || (lContainer[VIEW_REFS] = []); } function createContainerRef(hostTNode, hostLView) { ngDevMode && assertTNodeType( hostTNode, 12 | 3 /* TNodeType.AnyRNode */ ); let lContainer; const slotValue = hostLView[hostTNode.index]; if (isLContainer(slotValue)) { lContainer = slotValue; } else { lContainer = createLContainer(slotValue, hostLView, null, hostTNode); hostLView[hostTNode.index] = lContainer; addToEndOfViewTree(hostLView, lContainer); } _locateOrCreateAnchorNode(lContainer, hostLView, hostTNode, slotValue); return new R3ViewContainerRef(lContainer, hostTNode, hostLView); } function insertAnchorNode(hostLView, hostTNode) { const renderer = hostLView[RENDERER]; const commentNode = renderer.createComment(ngDevMode ? "container" : ""); const hostNative = getNativeByTNode(hostTNode, hostLView); const parentOfHostNative = renderer.parentNode(hostNative); nativeInsertBefore(renderer, parentOfHostNative, commentNode, renderer.nextSibling(hostNative), false); return commentNode; } var _locateOrCreateAnchorNode = createAnchorNode; var _populateDehydratedViewsInLContainer = () => false; function populateDehydratedViewsInLContainer(lContainer, tNode, hostLView) { return _populateDehydratedViewsInLContainer(lContainer, tNode, hostLView); } function createAnchorNode(lContainer, hostLView, hostTNode, slotValue) { if (lContainer[NATIVE]) return; let commentNode; if (hostTNode.type & 8) { commentNode = unwrapRNode(slotValue); } else { commentNode = insertAnchorNode(hostLView, hostTNode); } lContainer[NATIVE] = commentNode; } var LQuery_ = class _LQuery_ { queryList; matches = null; constructor(queryList) { this.queryList = queryList; } clone() { return new _LQuery_(this.queryList); } setDirty() { this.queryList.setDirty(); } }; var LQueries_ = class _LQueries_ { queries; constructor(queries = []) { this.queries = queries; } createEmbeddedView(tView) { const tQueries = tView.queries; if (tQueries !== null) { const noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length; const viewLQueries = []; for (let i25 = 0; i25 < noOfInheritedQueries; i25++) { const tQuery = tQueries.getByIndex(i25); const parentLQuery = this.queries[tQuery.indexInDeclarationView]; viewLQueries.push(parentLQuery.clone()); } return new _LQueries_(viewLQueries); } return null; } insertView(tView) { this.dirtyQueriesWithMatches(tView); } detachView(tView) { this.dirtyQueriesWithMatches(tView); } finishViewCreation(tView) { this.dirtyQueriesWithMatches(tView); } dirtyQueriesWithMatches(tView) { for (let i25 = 0; i25 < this.queries.length; i25++) { if (getTQuery(tView, i25).matches !== null) { this.queries[i25].setDirty(); } } } }; var TQueryMetadata_ = class { flags; read; predicate; constructor(predicate, flags, read = null) { this.flags = flags; this.read = read; if (typeof predicate === "string") { this.predicate = splitQueryMultiSelectors(predicate); } else { this.predicate = predicate; } } }; var TQueries_ = class _TQueries_ { queries; constructor(queries = []) { this.queries = queries; } elementStart(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i25 = 0; i25 < this.queries.length; i25++) { this.queries[i25].elementStart(tView, tNode); } } elementEnd(tNode) { for (let i25 = 0; i25 < this.queries.length; i25++) { this.queries[i25].elementEnd(tNode); } } embeddedTView(tNode) { let queriesForTemplateRef = null; for (let i25 = 0; i25 < this.length; i25++) { const childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0; const tqueryClone = this.getByIndex(i25).embeddedTView(tNode, childQueryIndex); if (tqueryClone) { tqueryClone.indexInDeclarationView = i25; if (queriesForTemplateRef !== null) { queriesForTemplateRef.push(tqueryClone); } else { queriesForTemplateRef = [tqueryClone]; } } } return queriesForTemplateRef !== null ? new _TQueries_(queriesForTemplateRef) : null; } template(tView, tNode) { ngDevMode && assertFirstCreatePass(tView, "Queries should collect results on the first template pass only"); for (let i25 = 0; i25 < this.queries.length; i25++) { this.queries[i25].template(tView, tNode); } } getByIndex(index) { ngDevMode && assertIndexInRange(this.queries, index); return this.queries[index]; } get length() { return this.queries.length; } track(tquery) { this.queries.push(tquery); } }; var TQuery_ = class _TQuery_ { metadata; matches = null; indexInDeclarationView = -1; crossesNgTemplate = false; /** * A node index on which a query was declared (-1 for view queries and ones inherited from the * declaration template). We use this index (alongside with _appliesToNextNode flag) to know * when to apply content queries to elements in a template. */ _declarationNodeIndex; /** * A flag indicating if a given query still applies to nodes it is crossing. We use this flag * (alongside with _declarationNodeIndex) to know when to stop applying content queries to * elements in a template. */ _appliesToNextNode = true; constructor(metadata, nodeIndex = -1) { this.metadata = metadata; this._declarationNodeIndex = nodeIndex; } elementStart(tView, tNode) { if (this.isApplyingToNode(tNode)) { this.matchTNode(tView, tNode); } } elementEnd(tNode) { if (this._declarationNodeIndex === tNode.index) { this._appliesToNextNode = false; } } template(tView, tNode) { this.elementStart(tView, tNode); } embeddedTView(tNode, childQueryIndex) { if (this.isApplyingToNode(tNode)) { this.crossesNgTemplate = true; this.addMatch(-tNode.index, childQueryIndex); return new _TQuery_(this.metadata); } return null; } isApplyingToNode(tNode) { if (this._appliesToNextNode && (this.metadata.flags & 1) !== 1) { const declarationNodeIdx = this._declarationNodeIndex; let parent2 = tNode.parent; while (parent2 !== null && parent2.type & 8 && parent2.index !== declarationNodeIdx) { parent2 = parent2.parent; } return declarationNodeIdx === (parent2 !== null ? parent2.index : -1); } return this._appliesToNextNode; } matchTNode(tView, tNode) { const predicate = this.metadata.predicate; if (Array.isArray(predicate)) { for (let i25 = 0; i25 < predicate.length; i25++) { const name5 = predicate[i25]; this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, name5)); this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, name5, false, false)); } } else { if (predicate === TemplateRef) { if (tNode.type & 4) { this.matchTNodeWithReadOption(tView, tNode, -1); } } else { this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, predicate, false, false)); } } } matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) { if (nodeMatchIdx !== null) { const read = this.metadata.read; if (read !== null) { if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type & 4) { this.addMatch(tNode.index, -2); } else { const directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false); if (directiveOrProviderIdx !== null) { this.addMatch(tNode.index, directiveOrProviderIdx); } } } else { this.addMatch(tNode.index, nodeMatchIdx); } } } addMatch(tNodeIdx, matchIdx) { if (this.matches === null) { this.matches = [tNodeIdx, matchIdx]; } else { this.matches.push(tNodeIdx, matchIdx); } } }; function getIdxOfMatchingSelector(tNode, selector) { const localNames = tNode.localNames; if (localNames !== null) { for (let i25 = 0; i25 < localNames.length; i25 += 2) { if (localNames[i25] === selector) { return localNames[i25 + 1]; } } } return null; } function createResultByTNodeType(tNode, currentView) { if (tNode.type & (3 | 8)) { return createElementRef(tNode, currentView); } else if (tNode.type & 4) { return createTemplateRef(tNode, currentView); } return null; } function createResultForNode(lView, tNode, matchingIdx, read) { if (matchingIdx === -1) { return createResultByTNodeType(tNode, lView); } else if (matchingIdx === -2) { return createSpecialToken(lView, tNode, read); } else { return getNodeInjectable(lView, lView[TVIEW], matchingIdx, tNode); } } function createSpecialToken(lView, tNode, read) { if (read === ElementRef) { return createElementRef(tNode, lView); } else if (read === TemplateRef) { return createTemplateRef(tNode, lView); } else if (read === ViewContainerRef) { ngDevMode && assertTNodeType( tNode, 3 | 12 /* TNodeType.AnyContainer */ ); return createContainerRef(tNode, lView); } else { ngDevMode && throwError2(`Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ${stringify(read)}.`); } } function materializeViewResults(tView, lView, tQuery, queryIndex) { const lQuery = lView[QUERIES].queries[queryIndex]; if (lQuery.matches === null) { const tViewData = tView.data; const tQueryMatches = tQuery.matches; const result = []; for (let i25 = 0; tQueryMatches !== null && i25 < tQueryMatches.length; i25 += 2) { const matchedNodeIdx = tQueryMatches[i25]; if (matchedNodeIdx < 0) { result.push(null); } else { ngDevMode && assertIndexInRange(tViewData, matchedNodeIdx); const tNode = tViewData[matchedNodeIdx]; result.push(createResultForNode(lView, tNode, tQueryMatches[i25 + 1], tQuery.metadata.read)); } } lQuery.matches = result; } return lQuery.matches; } function collectQueryResults(tView, lView, queryIndex, result) { const tQuery = tView.queries.getByIndex(queryIndex); const tQueryMatches = tQuery.matches; if (tQueryMatches !== null) { const lViewResults = materializeViewResults(tView, lView, tQuery, queryIndex); for (let i25 = 0; i25 < tQueryMatches.length; i25 += 2) { const tNodeIdx = tQueryMatches[i25]; if (tNodeIdx > 0) { result.push(lViewResults[i25 / 2]); } else { const childQueryIndex = tQueryMatches[i25 + 1]; const declarationLContainer = lView[-tNodeIdx]; ngDevMode && assertLContainer(declarationLContainer); for (let i26 = CONTAINER_HEADER_OFFSET; i26 < declarationLContainer.length; i26++) { const embeddedLView = declarationLContainer[i26]; if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) { collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } if (declarationLContainer[MOVED_VIEWS] !== null) { const embeddedLViews = declarationLContainer[MOVED_VIEWS]; for (let i26 = 0; i26 < embeddedLViews.length; i26++) { const embeddedLView = embeddedLViews[i26]; collectQueryResults(embeddedLView[TVIEW], embeddedLView, childQueryIndex, result); } } } } } return result; } function loadQueryInternal(lView, queryIndex) { ngDevMode && assertDefined(lView[QUERIES], "LQueries should be defined when trying to load a query"); ngDevMode && assertIndexInRange(lView[QUERIES].queries, queryIndex); return lView[QUERIES].queries[queryIndex].queryList; } function createLQuery(tView, lView, flags) { const queryList = new QueryList( (flags & 4) === 4 /* QueryFlags.emitDistinctChangesOnly */ ); storeCleanupWithContext(tView, lView, queryList, queryList.destroy); const lQueries = (lView[QUERIES] ??= new LQueries_()).queries; return lQueries.push(new LQuery_(queryList)) - 1; } function createViewQuery(predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { createTQuery(tView, new TQueryMetadata_(predicate, flags, read), -1); if ((flags & 2) === 2) { tView.staticViewQueries = true; } } return createLQuery(tView, getLView(), flags); } function createContentQuery(directiveIndex, predicate, flags, read) { ngDevMode && assertNumber(flags, "Expecting flags"); const tView = getTView(); if (tView.firstCreatePass) { const tNode = getCurrentTNode(); createTQuery(tView, new TQueryMetadata_(predicate, flags, read), tNode.index); saveContentQueryAndDirectiveIndex(tView, directiveIndex); if ((flags & 2) === 2) { tView.staticContentQueries = true; } } return createLQuery(tView, getLView(), flags); } function splitQueryMultiSelectors(locator) { return locator.split(",").map((s17) => s17.trim()); } function createTQuery(tView, metadata, nodeIndex) { if (tView.queries === null) tView.queries = new TQueries_(); tView.queries.track(new TQuery_(metadata, nodeIndex)); } function saveContentQueryAndDirectiveIndex(tView, directiveIndex) { const tViewContentQueries = tView.contentQueries || (tView.contentQueries = []); const lastSavedDirectiveIndex = tViewContentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1; if (directiveIndex !== lastSavedDirectiveIndex) { tViewContentQueries.push(tView.queries.length - 1, directiveIndex); } } function getTQuery(tView, index) { ngDevMode && assertDefined(tView.queries, "TQueries must be defined to retrieve a TQuery"); return tView.queries.getByIndex(index); } function getQueryResults(lView, queryIndex) { const tView = lView[TVIEW]; const tQuery = getTQuery(tView, queryIndex); return tQuery.crossesNgTemplate ? collectQueryResults(tView, lView, queryIndex, []) : materializeViewResults(tView, lView, tQuery, queryIndex); } function createQuerySignalFn(firstOnly, required, opts) { let node; const signalFn = createComputed(() => { node._dirtyCounter(); const value = refreshSignalQuery(node, firstOnly); if (required && value === void 0) { throw new RuntimeError(-951, ngDevMode && "Child query result is required but no value is available."); } return value; }); node = signalFn[SIGNAL]; node._dirtyCounter = signal(0); node._flatValue = void 0; if (ngDevMode) { signalFn.toString = () => `[Query Signal]`; node.debugName = opts?.debugName; } return signalFn; } function createSingleResultOptionalQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ true, /* required */ false, opts ); } function createSingleResultRequiredQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ true, /* required */ true, opts ); } function createMultiResultQuerySignalFn(opts) { return createQuerySignalFn( /* firstOnly */ false, /* required */ false, opts ); } function bindQueryToSignal(target, queryIndex) { const node = target[SIGNAL]; node._lView = getLView(); node._queryIndex = queryIndex; node._queryList = loadQueryInternal(node._lView, queryIndex); node._queryList.onDirty(() => node._dirtyCounter.update((v7) => v7 + 1)); } function refreshSignalQuery(node, firstOnly) { const lView = node._lView; const queryIndex = node._queryIndex; if (lView === void 0 || queryIndex === void 0 || lView[FLAGS] & 4) { return firstOnly ? void 0 : EMPTY_ARRAY; } const queryList = loadQueryInternal(lView, queryIndex); const results = getQueryResults(lView, queryIndex); queryList.reset(results, unwrapElementRef); if (firstOnly) { return queryList.first; } else { const resultChanged = queryList._changesDetected; if (resultChanged || node._flatValue === void 0) { return node._flatValue = queryList.toArray(); } return node._flatValue; } } function resolveComponentResources(resourceResolver) { const componentResolved = []; const urlMap = /* @__PURE__ */ new Map(); function cachedResourceResolve(url) { let promise = urlMap.get(url); if (!promise) { const resp = resourceResolver(url); urlMap.set(url, promise = resp.then((res) => unwrapResponse(url, res))); } return promise; } componentResourceResolutionQueue.forEach((component, type) => { const promises = []; if (component.templateUrl) { promises.push(cachedResourceResolve(component.templateUrl).then((template) => { component.template = template; })); } const styles = typeof component.styles === "string" ? [component.styles] : component.styles || []; component.styles = styles; if (component.styleUrl && component.styleUrls?.length) { throw new Error("@Component cannot define both `styleUrl` and `styleUrls`. Use `styleUrl` if the component has one stylesheet, or `styleUrls` if it has multiple"); } else if (component.styleUrls?.length) { const styleOffset = component.styles.length; const styleUrls = component.styleUrls; component.styleUrls.forEach((styleUrl, index) => { styles.push(""); promises.push(cachedResourceResolve(styleUrl).then((style40) => { styles[styleOffset + index] = style40; styleUrls.splice(styleUrls.indexOf(styleUrl), 1); if (styleUrls.length == 0) { component.styleUrls = void 0; } })); }); } else if (component.styleUrl) { promises.push(cachedResourceResolve(component.styleUrl).then((style40) => { styles.push(style40); component.styleUrl = void 0; })); } const fullyResolved = Promise.all(promises).then(() => componentDefResolved(type)); componentResolved.push(fullyResolved); }); clearResolutionOfComponentResourcesQueue(); return Promise.all(componentResolved).then(() => void 0); } var componentResourceResolutionQueue = /* @__PURE__ */ new Map(); var componentDefPendingResolution = /* @__PURE__ */ new Set(); function maybeQueueResolutionOfComponentResources(type, metadata) { if (componentNeedsResolution(metadata)) { componentResourceResolutionQueue.set(type, metadata); componentDefPendingResolution.add(type); } } function componentNeedsResolution(component) { return !!(component.templateUrl && !component.hasOwnProperty("template") || component.styleUrls && component.styleUrls.length || component.styleUrl); } function clearResolutionOfComponentResourcesQueue() { const old = componentResourceResolutionQueue; componentResourceResolutionQueue = /* @__PURE__ */ new Map(); return old; } function isComponentResourceResolutionQueueEmpty() { return componentResourceResolutionQueue.size === 0; } function unwrapResponse(url, response) { if (typeof response === "string") { return response; } if (response.status !== void 0 && response.status !== 200) { return Promise.reject(new RuntimeError(918, ngDevMode && `Could not load resource: ${url}. Response status: ${response.status}`)); } return response.text(); } function componentDefResolved(type) { componentDefPendingResolution.delete(type); } var modules = /* @__PURE__ */ new Map(); var checkForDuplicateNgModules = true; function assertSameOrNotExisting(id, type, incoming) { if (type && type !== incoming && checkForDuplicateNgModules) { throw new Error(`Duplicate module registered for ${id} - ${stringify(type)} vs ${stringify(type.name)}`); } } function registerNgModuleType(ngModuleType, id) { const existing = modules.get(id) || null; assertSameOrNotExisting(id, existing, ngModuleType); modules.set(id, ngModuleType); } function \u0275\u0275validateIframeAttribute(attrValue, tagName, attrName) { const lView = getLView(); const tNode = getSelectedTNode(); const element = getNativeByTNode(tNode, lView); if (tNode.type === 2 && tagName.toLowerCase() === "iframe") { const iframe = element; iframe.src = ""; iframe.srcdoc = trustedHTMLFromString(""); nativeRemoveNode(lView[RENDERER], iframe); const errorMessage = ngDevMode && `Angular has detected that the \`${attrName}\` was applied as a binding to an